Data['id'] > 1 ){ $EID = intval( $_POST['CID'] ); $QS = "SELECT `sen`.*, `no`.`enable`, `no`.`name`, `no`.`id` as `node_id` FROM `lrf_sensors` `sen` LEFT JOIN `nodes` `no` ON( `no`.`aux_id`=`sen`.`id` AND `no`.`type`=`sen`.`type`) WHERE `sen`.`id`={$EID}"; $Result = $DATABASE->Query( $QS, false ); if( count( $Result ) ){ $CR = $Result[0]; $TTPL=<<
ALS ' . $Labels->getLabel('SENSOR'); break; case 2: $NAME = ''.$CR['name'].'
LFS ' . $Labels->getLabel('SENSOR'); break; case 3: $NAME = ''.$CR['name'].'
PLS200 ' . $Labels->getLabel('SENSOR'); break; case 4: $NAME = ''.$CR['name'].'
PLS360 ' . $Labels->getLabel('SENSOR'); break; default: $NAME = ''.$CR['name'].'
Unknown Sensor'; }; $NAME .='
communication errors per minute: '.$CR['com_epm']; $INFO = '
Serial:'.(($CR['serial']!='')?$CR['serial']:'No Serial Defined').'
Version:'.(($CR['version']!='')?$CR['version']:'No Version Info').'
'; $ITEMS[0]="{ xtype:'panel', border: false, frame: false, html: '
{$NAME}
{$INFO}

'}"; $QS="SELECT aux_id, device FROM resources WHERE ( type=1 OR type=129 )"; $RR=$DATABASE->Query( $QS ); if( count( $RR ) ){ $RE=array(); foreach( $RR as $R ){ $RE[] = "[ {$R['aux_id']}, '{$R['device']}']"; }; $UARTS = implode( ',', $RE ); } else { $UARTS = "[0, \"".$Labels->GetLabel('_NO_UARTS_DEF_')."\"]"; }; $QS = "SELECT * FROM `lrf_ini_settings` WHERE `sensor_id`={$EID}"; $RRR = $DATABASE->Query( $QS ); if( count( $RRR ) ){ $INI_S = $RRR[0]; } else { $INI_S = array(); $INI_S['AUTORESET_ENABLE'] = 0; $INI_S['AUTORESET_INTERLEAVE'] = 2000; $INI_S['AUTORESET_TIMEOUT'] = 60000; $INI_S['BOARD_TEMPERATURE'] = 1; $INI_S['BOARD_ZEROSHIFT'] = 0; $INI_S['BOARD_SPEED'] = 4; $INI_S['RUN_DIR'] = 2; $INI_S['NO_BLACK_TARGETS'] = 1; $INI_S['JUST_MOVING_TARGETS'] = 0; $INI_S['JUST_MOVING_RADIAL'] = 0; $INI_S['JUST_MOVING_DISTANCE'] = 0; if( stripos( $CR['version'], 'FF' )!== false ) { $INI_S['FREEZ_FIRST_TH'] = 1; $INI_S['SAVE_FIRST_TH'] = 1; } else if( stripos( $CR['version'], 'FS' )!== false ){ $INI_S['FREEZ_FIRST_TH'] = 1; $INI_S['SAVE_FIRST_TH'] = 1; } else if( stripos( $CR['version'], 'FD' )!== false ){ $INI_S['FREEZ_FIRST_TH'] = 0; $INI_S['SAVE_FIRST_TH'] = 0; } else { $INI_S['FREEZ_FIRST_TH'] = 0; $INI_S['SAVE_FIRST_TH'] = 0; }; $QS = "INSERT INTO `lrf_ini_settings`(`sensor_id`,`AUTORESET_ENABLE`,`AUTORESET_INTERLEAVE`,`AUTORESET_TIMEOUT`,`BOARD_TEMPERATURE`,`BOARD_ZEROSHIFT`,`BOARD_SPEED`,`RUN_DIR`,`NO_BLACK_TARGETS`,`JUST_MOVING_TARGETS`,`JUST_MOVING_RADIAL`,`JUST_MOVING_DISTANCE`,`FREEZ_FIRST_TH`,`SAVE_FIRST_TH`) VALUES({$EID},0,0,0,0,0,4,2,0,0,0,0,{$INI_S['FREEZ_FIRST_TH']},{$INI_S['SAVE_FIRST_TH']})"; $DATABASE->Query( $QS ); }; if( ( stripos( $CR['version'], 'FD' )!== false ) || ( stripos( $CR['version'], 'FS' )!== false ) || ( stripos( $CR['version'], 'FF' )!== false ) ){ //Frozen TH if( stripos( $CR['version'], 'FD' )!== false ){ $THF_OPERATION = ",{ xtype: 'button', text: 'Enable Frozen Threshold', width: '100%', iconCls: 'srv_op_fth_ble', scale: 'large', handler: function(){ doSensorOperation( {$CR['id']}, 21, 0, true ); } }"; } else { if( stripos( $CR['version'], 'FS' )!== false ){ $THF_OPERATION = ",{ xtype: 'button', text: 'Finish Frozen Threshold Study', width: '100%', iconCls: 'srv_op_fth_study', scale: 'large', handler: function(){ doSensorOperation( {$CR['id']}, 24, 0, true ); } }"; }; if( stripos( $CR['version'], 'FF' )!== false ){ $THF_OPERATION = ",{ xtype: 'button', text: 'Delete Frozen Threshold', width: '100%', iconCls: 'srv_op_fth_frozen', scale: 'large', handler: function(){ doSensorOperation( {$CR['id']}, 23, 0, true ); } }"; }; $THF_OPERATION .= ",{ xtype: 'button', text: 'Disable Frozen Threshold', width: '100%', iconCls: 'srv_op_fth_ble', scale: 'large', handler: function(){ doSensorOperation( {$CR['id']}, 22, 0, true ); } }"; }; } else { $THF_OPERATION = ''; } $ED =<<GetLabel('_SENS_STATUS_')}", lazyRender: true, mode: 'local', forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, store: new Ext.data.ArrayStore({ fields: ['mode','mode_txt'], data: [ [0,'{$Labels->GetLabel('__DISABLED__')}'], [1,'{$Labels->GetLabel('___ENABLED__')}'] ] }), valueField: 'mode', displayField: 'mode_txt', value: {$CR['enable']}, width: 200, listeners:{ select: function( a, c, b ){ doSensorOperation( {$CR['id']}, 1, b, true ); } } },{ xtype: 'combo', id: 'sens_range', fieldLabel: "{$Labels->GetLabel('SENS_RANGE')}", lazyRender: true, mode: 'local', forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, store: new Ext.data.ArrayStore({ fields: ['range','range_txt'], data: [ [15,'15 Meters'], [35,'35 Meters'], [45,'45 Meters'], [65,'65 Meters'], [75,'75 Meters'], [150,'150 Meters'], [200,'200 Meters'], [300,'300 Meters'] ] }), valueField: 'range', displayField: 'range_txt', value: {$CR['max_range']}, width: 200, listeners:{ select: function( a, c, b ){ doSensorOperation( {$CR['id']}, 2, b, true ); } } },{ xtype: 'numberfield', id: 'sens_id', fieldLabel: '{$Labels->GetLabel('_PROTO_DEVICE_ID_')}', width: 200, value: {$CR['device_id']}, listeners:{ change: function( a, c, b ){ doSensorOperation( {$CR['id']}, 3, c, true ); } } },{ xtype: 'combo', fieldLabel: '{$Labels->GetLabel('_UART_PORT_')}', lazyRender: true, id: 'uart_id', mode: 'local', disabled: false, forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, store: new Ext.data.ArrayStore({ fields: ['uart','uart_txt'], data: [{$UARTS}] }), valueField: 'uart', displayField: 'uart_txt', value: {$CR['uart_id']}, width: 200, listeners:{ select: function( a, c, b ){ doSensorOperation( {$CR['id']}, 4, c.data.uart, true ); } } },{ xtype: 'combo', id: 'ad_se', fieldLabel: "{$Labels->GetLabel('AUTO_DRAW')}", lazyRender: true, mode: 'local', forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, store: new Ext.data.ArrayStore({ fields: ['ad','ad_txt'], data: [ [0,'{$Labels->GetLabel('__DISABLED__')}'], [10,'Each 10 Flips'], [20,'Each 20 Flips'], [30,'Each 30 Flips'], [40,'Each 40 Flips'], [50,'Each 50 Flips'], [100,'Each 100 Flips'], [200,'Each 200 Flips'] ] }), valueField: 'ad', displayField: 'ad_txt', value: {$CR['auto_draw']}, width: 200, listeners:{ select: function( a, c, b ){ doSensorOperation( {$CR['id']}, 5, b, true ); } } },{ xtype: 'numberfield', id: 'basesh_id', fieldLabel: 'Background {$Labels->GetLabel('__ZERO_SHIFT__')}', width: 200, value: {$CR['base_shift']}, listeners:{ change: function( a, c, b ){ doSensorOperation( {$CR['id']}, 6, c, true ); } } }] },{ xtype: 'form', title: 'Hardware', labelWidth: 200, border: false, frame: false, labelAlign: 'right', height: PanelH - 283, items:[{ xtype: 'checkbox', id: 'autores_ena', fieldLabel: 'Auto Reset Enabled', width: 200, checked: {$INI_S['AUTORESET_ENABLE']}, listeners:{ check: function( a, c ){ if( c ){ doSensorOperation( {$CR['id']}, 7, 1, false ); } else { doSensorOperation( {$CR['id']}, 7, 0, false ); }; } } },{ xtype: 'numberfield', id: 'autores_il', fieldLabel: 'Auto Reset Interleave', width: 200, value: {$INI_S['AUTORESET_INTERLEAVE']}, listeners:{ change: function( a, c, b ){ doSensorOperation( {$CR['id']}, 8, c, false ); } } },{ xtype: 'numberfield', id: 'autores_to', fieldLabel: 'Auto Timeout', width: 200, value: {$INI_S['AUTORESET_TIMEOUT']}, listeners:{ change: function( a, c, b ){ doSensorOperation( {$CR['id']}, 9, c, false ); } } },{ xtype: 'numberfield', id: 'board_zsh', fieldLabel: 'Board Zero Shift', width: 200, value: {$INI_S['BOARD_ZEROSHIFT']}, listeners:{ change: function( a, c, b ){ doSensorOperation( {$CR['id']}, 10, c, false ); } } },{ xtype: 'numberfield', id: 'board_temp', fieldLabel: 'Heater Temperature', width: 200, value: {$INI_S['BOARD_TEMPERATURE']}, listeners:{ change: function( a, c, b ){ doSensorOperation( {$CR['id']}, 11, c, false ); } } },{ xtype: 'combo', id: 'board_spd', fieldLabel: "Scan Speed", lazyRender: true, mode: 'local', forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, store: new Ext.data.ArrayStore({ fields: ['sd','sd_txt'], data: [ [2,'2 Scans per second'], [4,'4 Scans per second'], [6,'6 Scans per second'], [8,'8 Scans per second'], [10,'10 Scans per second'], [12,'12 Scans per second'] ] }), valueField: 'sd', displayField: 'sd_txt', value: {$INI_S['BOARD_SPEED']}, width: 200, listeners:{ select: function( a, c, b ){ doSensorOperation( {$CR['id']}, 12, b, false ); } } },{ xtype: 'checkbox', id: 'nbt_ena', fieldLabel: 'No Black Targets', width: 200, checked: {$INI_S['NO_BLACK_TARGETS']}, listeners:{ check: function( a, c ){ if( c ){ doSensorOperation( {$CR['id']}, 13, 1, false ); } else { doSensorOperation( {$CR['id']}, 13, 0, false ); }; } } },{ xtype: 'checkbox', id: 'jmt_ena', fieldLabel: 'Just Moving Targets', width: 200, checked: {$INI_S['JUST_MOVING_TARGETS']}, listeners:{ check: function( a, c ){ if( c ){ doSensorOperation( {$CR['id']}, 14, 1, false ); } else { doSensorOperation( {$CR['id']}, 14, 0, false ); }; } } },{ xtype: 'checkbox', id: 'jmt_rad', fieldLabel: 'Just Moving Radial', width: 200, checked: {$INI_S['JUST_MOVING_RADIAL']}, listeners:{ check: function( a, c ){ if( c ){ doSensorOperation( {$CR['id']}, 15, 1, false ); } else { doSensorOperation( {$CR['id']}, 15, 0, false ); }; } } },{ xtype: 'checkbox', id: 'jmt_range', fieldLabel: 'Just Moving Distance', width: 200, checked: {$INI_S['JUST_MOVING_DISTANCE']}, listeners:{ check: function( a, c ){ if( c ){ doSensorOperation( {$CR['id']}, 16, 1, false ); } else { doSensorOperation( {$CR['id']}, 16, 0, false ); }; } } },{ xtype: 'checkbox', id: 'fth_freeze', fieldLabel: 'Freeze First Threshold', width: 200, checked: {$INI_S['FREEZ_FIRST_TH']}, listeners:{ check: function( a, c ){ if( c ){ doSensorOperation( {$CR['id']}, 17, 1, false ); } else { doSensorOperation( {$CR['id']}, 17, 0, false ); }; } } },{ xtype: 'checkbox', id: 'fth_save', fieldLabel: 'Save First Threshold', width: 200, checked: {$INI_S['SAVE_FIRST_TH']}, listeners:{ check: function( a, c ){ if( c ){ doSensorOperation( {$CR['id']}, 18, 1, false ); } else { doSensorOperation( {$CR['id']}, 18, 0, false ); }; } } },{ xtype: 'button', text: 'Apply To Device and Reset', width: '100%', iconCls: 'srv_op_download', scale: 'large', handler: function(){ doSensorOperation( {$CR['id']}, 20, 0, true ); } }] },{ xtype: 'panel', title: 'Position', height: PanelH - 283, items:[] },{ xtype: 'panel', title: 'Maintenence', height: PanelH - 283, items:[{ xtype: 'button', text: 'Issue Sensor Full Reset', width: '100%', iconCls: 'srv_op_restart', scale: 'large', handler: function(){ doDeviceOperation( {$CR['node_id']}, 1,'', true ); } },{ xtype: 'button', text: 'Read All Settings from Sensor', width: '100%', iconCls: 'srv_op_upload', scale: 'large', handler: function(){ doDeviceOperation( {$CR['node_id']}, 128,'', true ); } },{ xtype: 'button', text: 'Save All Settings to Sensor', width: '100%', iconCls: 'srv_op_download', scale: 'large', handler: function(){ doDeviceOperation( {$CR['node_id']}, 129,'', true ); } }{$THF_OPERATION}] },{ xtype: 'panel', title: '{$Labels->getLabel('_SND_FILES2_DEV__')}', height: PanelH - 283, items:[{ title: '{$Labels->getLabel('_UPLOAD_PACKAGE_')}', xtype: 'panel', //height: 300, //flex: 1, frame: true, border: false, //layout: 'vbox', items:[{ xtype:'button', id: 'pickfiles_3', width: '100%', text: 'Choose File', listeners:{ afterrender: function(){ muploader = new plupload.Uploader({ runtimes : 'html5,html4', browse_button : Ext.getDom('pickfiles_3'), max_file_size : '1000mb', chunk_size: '200kb', max_retries: 3, multi_selection: false, max_file_count: 1, url: '/lib/controller/uploadToDevice.php?DID={$EID}', init: { PostInit: function() { }, FilesAdded: function( up, files ) { Ext.getCmp('upload_files_btn').enable(); Ext.getCmp('uploads_clr_btn').enable(); plupload.each( files, function(file) { uploads_store.loadData( [[ uploads_store_id, file.name, file.id, plupload.formatSize( file.size ), 0, 'N' ]], true ); uploads_store_id++; Ext.getCmp('upload_grid').doLayout(); }); }, UploadProgress: function(up, file) { var pb = Ext.getCmp( 'progress_'+file.id ); if( file.percent < 100 ){ pb.updateProgress( file.percent / 100, file.percent + '%', false ); } else { pb.updateProgress( 1.0, 'Uploaded', false ); uploads_store.removeAll(); loadModuleFiles( {$EID} ); }; }, Error: function(up, err) { Ext.Msg.show({ title:'Upload Status', msg: "Error #" + err.code + ": " + err.message, buttons: Ext.Msg.OK, icon: Ext.MessageBox.ERROR }); } } }); muploader.init(); //Ext.getCmp('uploaded_grid').hide(); //Ext.getCmp('upload_progres_panel').show(); devUploadID = {$CR['id']}; fetchDeviceUploadStatus(); //loadModuleFiles( {$EID} ); } } },{ height: 200, xtype: 'grid', id: 'upload_grid', border: false, frame: false, mode: 'local', lazyRender: true, width: '100%', autoScroll: true, ds: uploads_store, cm: new Ext.grid.ColumnModel( fileUploadsColModel_ops ), sm: new Ext.grid.RowSelectionModel( fileUploadsSelModel_ops ), viewConfig: { forceFit: true }, bbar: [{ text: 'Clear', id: 'uploads_clr_btn', disabled: true, handler: function(){ muploader.splice(); uploads_store.removeAll(); uploads_store_id = 0; Ext.getCmp('uploads_clr_btn').disable(); Ext.getCmp('upload_files_btn').disable(); } },{ xtype:'button', id: 'upload_files_btn', disabled: true, text: 'Upload to Module', handler: function(){ if( muploader!= null ){ muploader.start(); Ext.getCmp('upload_files_btn').disable(); }; } }] },{ xtype: 'panel', height: 20 },{ title: 'Files Saved on Module', height: 200, xtype: 'grid', id: 'uploaded_grid', border: false, hidden: true, frame: false, mode: 'local', lazyRender: true, width: '100%', autoScroll: true, ds: uploaded_store, cm: new Ext.grid.ColumnModel( fileModuleColModel_ops ), sm: new Ext.grid.RowSelectionModel( fileUploadsSelModel_ops ), viewConfig: { forceFit: true }, bbar: [{ text: 'Clear', id: 'oploaded_clr_btn', disabled: false, handler: function(){ //muploader.splice(); uploaded_store.removeAll(); uploaded_store_id = 0; } },{ text: 'Reset Status', id: 'oploaded_rst_btn', disabled: true, handler: function(){ //muploader.splice(); //uploaded_store.removeAll(); //uploaded_store_id = 0; } },{ text: 'Issue Reset', id: 'oploaded_sres_btn', disabled: true, handler: function(){ //muploader.splice(); //uploaded_store.removeAll(); //uploaded_store_id = 0; } },{ xtype:'button', //disabled: true, id: 'oploaded_snd_btn', text: 'Send to Sensor', handler: function(){ doDeviceOperation( {$CR['node_id']}, 120,'', true ); Ext.getCmp('uploaded_grid').hide(); Ext.getCmp('upload_progres_panel').show(); devUploadID = {$CR['id']}; fetchDeviceUploadStatus(); } }] },{ xtype: 'panel', id: 'upload_progres_panel', hidden: false, items:[{ id: 'upp_ttext', html: 'Sending 3 file(s) to the device' },{ id: 'upp_ctext_', html: '
 
' },{ xtype: 'progress', id: 'upp_pbar', width: '100%', value: 0.0 }] }] }] }], bbar:[{ text: 'Remove Sensor', handler: function(){ doSensorOperation( {$CR['id']}, 255,'', true ); } }] } kokakskhkajhskr; $ITEMS[1] = $ED; $CONTENT = implode(',',$ITEMS); $TTPL = str_ireplace( '%%%ITEMS%%%', $CONTENT, $TTPL ); echo $TTPL; } else { echo '{ xtype: \'panel\', html: \'Node '.$_POST['NODE'].' Loadded\'}'; }; } else { header('location: /'); }; ?>