Copy Profile Token to ControlDevice for use with Netcat PTZ script

This commit is contained in:
Isaac Connor 2019-06-21 12:42:26 -04:00
parent 60618d5998
commit 85b9b045cc
1 changed files with 2 additions and 1 deletions

View File

@ -86,7 +86,7 @@ function probeCameras( $localIp ) {
function probeProfiles( $device_ep, $soapversion, $username, $password ) { function probeProfiles( $device_ep, $soapversion, $username, $password ) {
$profiles = array(); $profiles = array();
if ( $lines = @execONVIF( "profiles $device_ep $soapversion $username $password" ) ) { if ( $lines = @execONVIF("profiles $device_ep $soapversion $username $password") ) {
foreach ( $lines as $line ) { foreach ( $lines as $line ) {
$line = rtrim( $line ); $line = rtrim( $line );
if ( preg_match('|^(.+),\s*(.+),\s*(.+),\s*(.+),\s*(.+),\s*(.+),\s*(.+)\s*$|', $line, $matches) ) { if ( preg_match('|^(.+),\s*(.+),\s*(.+),\s*(.+),\s*(.+),\s*(.+),\s*(.+)\s*$|', $line, $matches) ) {
@ -234,6 +234,7 @@ if ( !isset($_REQUEST['step']) || ($_REQUEST['step'] == '1') ) {
// $monitor['MaxFPS'] = $profile['MaxFPS']; // $monitor['MaxFPS'] = $profile['MaxFPS'];
// $monitor['AlarmMaxFPS'] = $profile['AlarmMaxFPS']; // $monitor['AlarmMaxFPS'] = $profile['AlarmMaxFPS'];
$monitor['Path'] = $profile['Path']; $monitor['Path'] = $profile['Path'];
$monitor['ControlDevice'] = $profile['Profile']; # Netcat needs this for ProfileToken
$sourceDesc = base64_encode(json_encode($monitor)); $sourceDesc = base64_encode(json_encode($monitor));
$profiles[$sourceDesc] = $sourceString; $profiles[$sourceDesc] = $sourceString;
} }