Browse Source

MER STage 3

AGP
Evgeny Gagua 3 years ago
parent
commit
60a06f0c19
  1. 14
      lib/App/common/SQLite_dataBinder.cpp
  2. 1
      lib/App/common/SQLite_dataBinder.h
  3. 2
      lib/App/common/dataBinder.h
  4. 33
      lib/App/common/deviceNode2D.cpp
  5. 4
      lib/data/protocol/protocolLGS2D.cpp

14
lib/App/common/SQLite_dataBinder.cpp

@ -3901,6 +3901,20 @@ bool sqliteDBC::updateLRFDetectionProfile( uint32_t lrfID, uint8_t profileID, bo
return false;
};
bool sqliteDBC::updateLRFDryContact( uint32_t lrfID, bool bAuto, bool bNO, uint16_t wWindow ){
if( m_bStoIsConnected ) {
char tQBuf[MAX_PATH_LEN];
sprintf( tQBuf, "UPDATE `lrf_sensors` SET `dc_auto`=%d, `dc_no`=%d, `dc_window`=%d WHERE `id`=%d", bAuto, bNO, wWindow, lrfID );
#ifdef DEBUG_ALL
LOG(tQBuf);
#endif
m_pDataStorage->SilentQuery( tQBuf );
return true;
};
return false;
};
bool sqliteDBC::updateLRFSerial( uint32_t lrfID, CSTR Serial ){
if( m_bStoIsConnected ) {
char tQBuf[MAX_PATH_LEN];

1
lib/App/common/SQLite_dataBinder.h

@ -167,6 +167,7 @@ class sqliteDBC: public dataBinder {
virtual bool updateLRFComStat( uint32_t lrfID, uint32_t ErrorPerMinute );
virtual bool updateLRFFrozenStatus( uint32_t lrfID, bool FFT, bool SFT );
virtual bool updateLRFDetectionProfile( uint32_t lrfID, uint8_t profileID, bool master, uint16_t nOrder, uint16_t nOffset, uint16_t nDelta, uint16_t nWidth, uint16_t nFlip, uint16_t nSun, uint8_t bSST, uint32_t GP, uint32_t spikes );
virtual bool updateLRFDryContact( uint32_t lrfID, bool bAuto, bool bNO, uint16_t wWindow );
virtual bool updateLRFSerial( uint32_t lrfID, CSTR Serial );
virtual bool updateLRFUpload( uint32_t id, uint8_t status );
virtual bool updateLRFUnfinishedUploads( uint32_t deviceID );

2
lib/App/common/dataBinder.h

@ -193,7 +193,7 @@ class dataBinder{
virtual bool updateLRFSerial( uint32_t lrfID, CSTR Serial ){ return false;};
virtual bool updateLRFVerison( uint32_t lrfID, CSTR version ){ return false;};
virtual bool updateLRFDetectionProfile( uint32_t lrfID, uint8_t profileID, bool master, uint16_t nOrder, uint16_t nOffset, uint16_t nDelta, uint16_t nWidth, uint16_t nFlip, uint16_t nSun, uint8_t bSST, uint32_t GP=0, uint32_t spikes=0 ){ return false;};
virtual bool updateLRFDryContact( uint32_t lrfID, bool bAuto, bool bNO, uint16_t wWindow ){ return false;};
virtual bool updateLRFUpload( uint32_t id, uint8_t status ){ return false;};
virtual bool updateLRFUnfinishedUploads( uint32_t deviceID ){ return false;};
virtual bool updateMediaServerStream( uint32_t id, CSTR mrl=NULL, CSTR key = NULL ){ return false;};

33
lib/App/common/deviceNode2D.cpp

@ -8,7 +8,7 @@
#define LGS_MAX_DETECTOR_RANGE 2047
//#define DEBUG_EXTRA
#define DEBUG_EXTRA
#undef LOG
#undef LOG_ERROR
@ -576,7 +576,7 @@ void device2DSensor::syncMode(){
setWM( LRF_WM_CONNECTION );
} else transactionWaitResult();
} else {
setStage( LRF_WS_STAGE_1 );
setStage( LRF_WS_STAGE_2 );
};
break;
};
@ -705,6 +705,18 @@ void device2DSensor::syncMode(){
break;
};
case LRF_WS_STAGE_10:{
LOG("Send DC Settings!");
RELAY_PARAMETERS tParams;
tParams.bAuto = m_sLRF_DATA.dc_auto;
tParams.bNormallyClose = !m_sLRF_DATA.dc_no;
tParams.nAutoDelay = m_sLRF_DATA.dc_window;
if (!setRelayParameters( &tParams )) {
LOG_ERROR("Fall Back to Disconnected!");
setWM( LRF_WM_CONNECTION );
} else transactionWaitResult();
break;
};
case LRF_WS_STAGE_11:{
//ANODE_WM_2D_SET_GETFILE_MODE
if ( m_bActualDeviceWM != MODE_GETFILE ) {
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER;
@ -718,7 +730,7 @@ void device2DSensor::syncMode(){
};
break;
};
case LRF_WS_STAGE_11:{
case LRF_WS_STAGE_12:{
if( m_sGetFileTransfers.helpers.size() ){
m_sGetFileTransfers.helpers[m_sGetFileTransfers.current]->index = ( m_sGetFileTransfers.helpers[m_sGetFileTransfers.current]->index + 0x04) % GF_OP_INDEX;
switch( m_sGetFileTransfers.helpers[m_sGetFileTransfers.current]->state ) {
@ -840,7 +852,7 @@ void device2DSensor::syncMode(){
};
break;
};
case LRF_WS_STAGE_12:{
case LRF_WS_STAGE_13:{
// Remove Generated Files
if( m_bTGENFILECNT ){
for( uint8_t idx = 0; idx < m_bTGENFILECNT; idx++){
@ -852,7 +864,7 @@ void device2DSensor::syncMode(){
transactionSetResult( TRANSACTION_RESULT_OK );
break;
};
case LRF_WS_STAGE_13:{
case LRF_WS_STAGE_14:{
//Issue Full Reset
m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER;
if ( !doFullReset() ) {
@ -861,7 +873,7 @@ void device2DSensor::syncMode(){
} else transactionWaitResult();
break;
};
case LRF_WS_STAGE_14: setWM( LRF_WM_IDLE ); break;
case LRF_WS_STAGE_15: setWM( LRF_WM_IDLE ); break;
default: setStage( LRF_WS_INIT ); break;
};
break;
@ -2762,7 +2774,14 @@ bool device2DSensor::packetHandler( protocolPackage *Package ){
break;
};
case CMD_GET_RELAY_PARAMETERS:{
LOG("R-Params!");
m_sLRF_DATA.dc_auto = (bool) Package->m_pData[4];
m_sLRF_DATA.dc_no = !( (bool) Package->m_pData[5] );
m_sLRF_DATA.dc_window = Package->m_pData[7];
m_sLRF_DATA.dc_window = ( m_sLRF_DATA.dc_window << 8 ) | Package->m_pData[6];
char tB[128];
sprintf( tB, "DC Params: AUTO:%d, NO:%d, TO:%d", m_sLRF_DATA.dc_auto, m_sLRF_DATA.dc_no, m_sLRF_DATA.dc_window );
LOG( tB );
m_pDBC->updateLRFDryContact( m_sLRF_DATA.id, m_sLRF_DATA.dc_auto, m_sLRF_DATA.dc_no, m_sLRF_DATA.dc_window );
transactionSetResult( TRANSACTION_RESULT_OK );
break;
};

4
lib/data/protocol/protocolLGS2D.cpp

@ -588,8 +588,8 @@ bool protocolLGS_2D::setRelayParameters( PRELAY_PARAMETERS ptr ){
Buffer[CMD_IDX] = CMD_SET_RELAY_PARAMETERS;
Buffer[4] = ptr->bAuto;
Buffer[5] = ptr->bNormallyClose;
Buffer[6] = (ptr->nAutoDelay >> 8) & 0xFF;
Buffer[7] = ptr->nAutoDelay & 0xFF;
Buffer[7] = (ptr->nAutoDelay >> 8) & 0xFF;
Buffer[6] = ptr->nAutoDelay & 0xFF;
#ifdef DEBUG_EXTRA
LOG("setParameters");
#endif

Loading…
Cancel
Save