Web UI for ARGUS server
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.

58 lines
1.9 KiB

6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
6 years ago
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. require_once('../php/onvif/toto.php');
  4. function getDeviceName( $Dev ){
  5. $CMD = 'v4l2-ctl -D -d ' . $Dev;
  6. $Data = `$CMD`;
  7. $TArr = explode( "\n", $Data );
  8. $RD = array();
  9. foreach( $TArr as $R ){
  10. $CL = trim( $R );
  11. $TB = explode(':', $CL );
  12. if( stripos( $R, 'Model' )!== false ) $RD['name'] = trim( $TB[1] );
  13. if( stripos( $R, 'Driver name' )!== false ) $RD['dev'] = trim( $TB[1] );
  14. };
  15. if( count( $RD ) ) return $RD;
  16. return array('name'=>'-noname-','dev'=>'unknown');
  17. };
  18. if( $CUser->Data['id'] > 1 ){
  19. if( isset( $_POST['cam_sources'] ) ){
  20. if( $_POST['cam_sources'] == 'ipv' ){
  21. $QS = "SELECT * FROM `cameras` WHERE `node_id`=0";
  22. $Result = $DATABASE->Query($QS,false);
  23. foreach( $Result as $CD ){
  24. $cnode['id'] = $CD['id'];
  25. $cnode['status'] = $CD['status'];
  26. $cnode['login'] = $CD['access_login'];
  27. $cnode['password']= $CD['access_pass'];
  28. $cnode['name'] = urldecode($CD['name']);
  29. $cnode['hardware']= urldecode($CD['hardware']);
  30. $cnode['caps'] = 'IP';
  31. $cnode['ip'] = $CD['ip'];
  32. $cnode['mac'] = $CD['mac'];
  33. $cnode['ena'] = 1;
  34. $Data['nodes'][] = $cnode;
  35. };
  36. } else {
  37. $QS = "SELECT * FROM `media_streams` WHERE `source_type`='A' AND `source_id`=0";
  38. $Result = $DATABASE->Query($QS,false);
  39. foreach( $Result as $CD ){
  40. $cnode['id'] = $CD['id'];
  41. $cnode['status'] = 'local';
  42. $T = getDeviceName($CD['mrl']);
  43. $cnode['name'] = $T['name'];
  44. $cnode['hardware']= $T['dev'];
  45. $cnode['caps'] = 'Analog';
  46. $cnode['ip'] = '['.$CD['img_width'] .'x' . $CD['img_height'] .']';
  47. $cnode['mac'] = $CD['mrl'];
  48. if( $T['dev']=='unknown') $cnode['ena'] = 0; else $cnode['ena'] = 1;
  49. $Data['nodes'][] = $cnode;
  50. };
  51. };
  52. echo json_encode( $Data );
  53. } else {
  54. header('location: /');
  55. };
  56. } else {
  57. header('location: /');
  58. };
  59. ?>