Controlling Sricam SP015 pan tilt using curl

Chron0s

n3wb
Joined
Apr 1, 2018
Messages
2
Reaction score
0
Fairly simple, may work with other [Sri|Shonky]cams with PTZ. Note it's so screwed up it has its axes reversed, although that could be a mistake by me - I marked the two stepper connectors when I dumped the ROM with an SPI clip but stranger things have happened than me getting it wrong. Perhaps swapping them would make it work as Onvif expects, although the pan-tilt in Sricam's desktop app works as expected.
Code:
#!/bin/bash

if [ -z $1 ]
then
  echo "Usage: sc.sh [up|down|left|right]"
  exit
fi

if [ $1 = "up" ]
then
  curl --data-binary "<s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><ContinuousMove xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>000</ProfileToken><Velocity><PanTilt x=\"1\" y=\"0\" xmlns=\"http://www.onvif.org/ver10/schema\"/></Velocity></ContinuousMove></s:Body></s:Envelope>" 192.168.0.16:5000 > /dev/null 2>&1
fi

if [ $1 = "down" ]
then
  curl --data-binary "<s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><ContinuousMove xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>000</ProfileToken><Velocity><PanTilt x=\"-1\" y=\"0\" xmlns=\"http://www.onvif.org/ver10/schema\"/></Velocity></ContinuousMove></s:Body></s:Envelope>" 192.168.0.16:5000 > /dev/null 2>&1
fi

if [ $1 = "left" ]
then
  curl --data-binary "<s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><ContinuousMove xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>000</ProfileToken><Velocity><PanTilt x=\"0\" y=\"1\" xmlns=\"http://www.onvif.org/ver10/schema\"/></Velocity></ContinuousMove></s:Body></s:Envelope>" 192.168.0.16:5000 > /dev/null 2>&1
fi

if [ $1 = "right" ]
then
  curl --data-binary "<s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><ContinuousMove xmlns=\"http://www.onvif.org/ver20/ptz/wsdl\"><ProfileToken>000</ProfileToken><Velocity><PanTilt x=\"0\" y=\"-1\" xmlns=\"http://www.onvif.org/ver10/schema\"/></Velocity></ContinuousMove></s:Body></s:Envelope>" 192.168.0.16:5000 > /dev/null 2>&1
fi
You'd expect the PanTilt parameter to accept a value for the number of steps. No dice, I'm afraid. Fractions, integers, stupid numbers, all it seems to take note of is whether the number is positive or negative. Still, gives us some control of the daft things without resorting to Sri's rotten app and leaving the door open to the Internet.
 
Top