Skip to content

Commit

Permalink
Add Onvif functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
jmtatsch committed Mar 20, 2020
1 parent 5c8f372 commit a05a6e7
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
Binary file added firmware_mod/bin/onvif_srvd
Binary file not shown.
1 change: 1 addition & 0 deletions firmware_mod/config/ptz_presets.conf.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"presets":{"home":{"x":1300,"y":300}}}
55 changes: 55 additions & 0 deletions firmware_mod/controlscripts/onvif-srvd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#! /bin/sh
export LD_LIBRARY_PATH='/system/sdcard/lib:/thirdlib:/system/lib'

DAEMON=onvif_srvd
DAEMON_PATH=/system/sdcard/bin
PID_FILE="/var/run/$DAEMON.pid"

DAEMON_ARGS="--pid_file $PID_FILE --ifs wlan0"

start()
{
if [ -f $PID_FILE ] && kill -0 $(cat $PID_FILE); then
echo "$DAEMON already running"
return 1
fi

echo "Starting $DAEMON..."
$DAEMON_PATH/$DAEMON $DAEMON_ARGS && echo "$DAEMON started"
}

stop()
{
if [ ! -f "$PID_FILE" ] || ! kill -0 $(cat "$PID_FILE"); then
echo "$DAEMON not running"
return 1
fi

echo "Stopping $DAEMON..."
kill -15 $(cat $PID_FILE) && rm -f $PID_FILE
echo "$DAEMON stopped"
}

status()
{
pid="$(cat "$PID_FILE" 2>/dev/null)"
if [ "$pid" ]; then
kill -0 "$pid" >/dev/null && echo "PID: $pid" || return 1
fi
}

restart()
{
$0 stop
sleep 1
$0 start
}

if [ $# -eq 0 ]; then
start
else
case $1 in start|stop|restart|status)
$1
;;
esac
fi
5 changes: 5 additions & 0 deletions firmware_mod/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ if [ ! -f $CONFIGPATH/autonight.conf ]; then
cp $CONFIGPATH/autonight.conf.dist $CONFIGPATH/autonight.conf
fi

## Copy onvif camera ptz configuration:
if [ ! -f $CONFIGPATH/ptz_presets.conf ]; then
cp $CONFIGPATH/ptz_presets.conf.dist $CONFIGPATH/ptz_presets.conf
fi

## Configure OSD:
if [ -f /system/sdcard/controlscripts/configureOsd ]; then
. /system/sdcard/controlscripts/configureOsd 2>/dev/null
Expand Down

0 comments on commit a05a6e7

Please sign in to comment.