Browse Source

before GEO

master
Evgeny Gagua 4 years ago
parent
commit
60fb52ead8
  1. BIN
      lib/controller/data/mysqlitedb.db
  2. 38
      lib/controller/doCameraOperation.php
  3. 34
      lib/controller/getCameraEditor.php

BIN
lib/controller/data/mysqlitedb.db

Binary file not shown.

38
lib/controller/doCameraOperation.php

@ -5,14 +5,13 @@
$Data['status'] = 'na';
if( isset( $_POST['CMD'] ) ){
$CMD = intval( $_POST['CMD'] );
} else {
$CMD = 0;
};
} else $CMD = 0;
if( isset( $_POST['CID'] ) ) {
$CameraID = intval($_POST['CID']);
} else $CameraID = 0;
switch( $CMD ){
case 0:{
echo "CMD is 0";
// List Discovered Cameras
break;
};
@ -20,7 +19,38 @@
// List Registered Cameras
break;
};
case 2:
case 2:{
//Assign Camera to the system
$QS ="SELECT * FROM `cameras` WHERE `id`={$CameraID}";
$JJ = $DATABASE->Query( $QS );
if( count( $JJ ) ){
$CC = $JJ[0];
$S_Stream = intval( $CC['stream_id'] );
$S_PTZ = intval( $CC['protocol'] );
if( $S_Stream == 0 ){
$QS = "SELECT `id`,`source_type` FROM `media_streams` WHERE `source_id`={$CameraID} LIMIT 1";
} else {
$QS = "SELECT `id`,`source_type` FROM `media_streams` WHERE `id`={$S_Stream}";
};
$SJ = $DATABASE->Query( $QS );
if( count( $SJ ) ){
$S_Stream = intval( $SJ[0]['id'] );
$CT = $SJ[0]['source_type'];
if( $CT == 'D' ){
if( $S_PTZ ) $S_Type = 13; else $S_Type = 12;
} else {
if( $S_PTZ ) $S_Type = 11; else $S_Type = 10;
};
$S_Name = $CC['name'].'_'.$CameraID;
$QS = "INSERT INTO `nodes`(`type`,`aux_id`,`aux_parameter`,`enable`,`name`) VALUES({$S_Type},{$CameraID},{$S_Stream}, 1,'{$S_Name}')";
$DATABASE->Query( $QS );
$QS = "UPDATE `cameras` SET `status` = 3 WHERE `id`={$CameraID}";
$DATABASE->Query( $QS );
$Data['status'] = 'ok';
};
};
break;
};
case 3:{
// Checkup Onvif Camera By IP
require_once('../php/onvif/toto.php');

34
lib/controller/getCameraEditor.php

@ -32,6 +32,7 @@
$QS = "SELECT * FROM media_streams WHERE source_id={$CID}";
$Result = $DATABASE->Query($QS,false);
$SELECTED_STREAM = 0;
$STREAMS = array();
if( count( $Result ) > 0 ){
$ii = 0;
foreach( $Result as $CD ){
@ -74,6 +75,29 @@ kskjhiiuwye;
width: '100%',
text: '{$Labels->GetLabel('_ASSIGN_CAMERA_')}',
handler: function(){
Ext.Ajax.request({
url: '/lib/controller/doCameraOperation.php',
params: {
UID: {$UserID},
SID: '{$Session}',
CMD: 2,
CID: {$CID}
},
success: function( response, opts ){
var tData = Ext.decode(response.responseText);
if( tData.status == 'ok' ){
loadDetectedCameras();
} else {
Ext.Msg.show({
title:'Error!',
msg: tData.msg,
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.ERROR
});
};
},
failure: failureAJAXFunction
});
}
}
hzzhoiuyhetrkh;
@ -170,14 +194,8 @@ hhoiuyhetrkh;
success: function( response, opts ){
addDetCamWM.hide();
var data = Ext.decode(response.responseText);
if( data.status == 'ok' ){
Ext.Msg.show({
title:'Sucess!',
msg: data.msg,
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
//loadDetectedCameras();
if( data.status == 'ok' ){
loadDetectedCameras();
} else {
Ext.Msg.show({
title:'Error!',

Loading…
Cancel
Save