You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.9 KiB
59 lines
1.9 KiB
<?php
|
|
require_once('../ajax_asm.php');
|
|
require_once('../php/onvif/toto.php');
|
|
function getDeviceName( $Dev ){
|
|
$CMD = 'v4l2-ctl -D -d ' . $Dev;
|
|
$Data = `$CMD`;
|
|
$TArr = explode( "\n", $Data );
|
|
$RD = array();
|
|
foreach( $TArr as $R ){
|
|
$CL = trim( $R );
|
|
$TB = explode(':', $CL );
|
|
if( stripos( $R, 'Model' )!== false ) $RD['name'] = trim( $TB[1] );
|
|
if( stripos( $R, 'Driver name' )!== false ) $RD['dev'] = trim( $TB[1] );
|
|
};
|
|
if( count( $RD ) ) return $RD;
|
|
return array('name'=>'-noname-','dev'=>'unknown');
|
|
};
|
|
if( $CUser->Data['id'] > 1 ){
|
|
if( isset( $_POST['cam_sources'] ) ){
|
|
if( $_POST['cam_sources'] == 'ipv' ){
|
|
$QS = "SELECT * FROM `cameras` WHERE `node_id`=0";
|
|
$Result = $DATABASE->Query($QS,false);
|
|
foreach( $Result as $CD ){
|
|
$cnode['id'] = $CD['id'];
|
|
$cnode['status'] = $CD['status'];
|
|
$cnode['login'] = $CD['access_login'];
|
|
$cnode['password']= $CD['access_pass'];
|
|
$cnode['name'] = urldecode($CD['name']);
|
|
$cnode['hardware']= urldecode($CD['hardware']);
|
|
$cnode['caps'] = 'IP';
|
|
$cnode['ip'] = $CD['ip'];
|
|
$cnode['mac'] = $CD['mac'];
|
|
$cnode['ena'] = 1;
|
|
$Data['nodes'][] = $cnode;
|
|
};
|
|
} else {
|
|
$QS = "SELECT * FROM `media_streams` WHERE `source_type`='A' AND `source_id`=0";
|
|
$Result = $DATABASE->Query($QS,false);
|
|
foreach( $Result as $CD ){
|
|
$cnode['id'] = $CD['id'];
|
|
$cnode['status'] = 'local';
|
|
$T = getDeviceName($CD['mrl']);
|
|
$cnode['name'] = $T['name'];
|
|
$cnode['hardware']= $T['dev'];
|
|
$cnode['caps'] = 'Analog';
|
|
$cnode['ip'] = '['.$CD['img_width'] .'x' . $CD['img_height'] .']';
|
|
$cnode['mac'] = $CD['mrl'];
|
|
if( $T['dev']=='unknown') $cnode['ena'] = 0; else $cnode['ena'] = 1;
|
|
$Data['nodes'][] = $cnode;
|
|
};
|
|
};
|
|
echo json_encode( $Data );
|
|
} else {
|
|
header('location: /');
|
|
};
|
|
} else {
|
|
header('location: /');
|
|
};
|
|
?>
|