Browse Source

Fixed Serial Camera Protocols

AGP
Evgeny Gagua 5 years ago
parent
commit
80b5942050
  1. 9
      lib/data/media/video/videoAVLIBSource.cpp
  2. 4
      lib/data/media/video/videoAVLIBSource.h
  3. 31
      lib/data/protocol/protocolPTZ_PELCO.cpp
  4. 3
      lib/data/protocol/protocolPTZ_PELCO.h
  5. 64
      lib/data/protocol/protocolPTZ_VISCA.cpp
  6. 1
      lib/data/protocol/protocolPTZ_VISCA.h
  7. 87
      lib/hardware/uart/serialSOL.cpp
  8. 2
      lib/hardware/uart/serialSOL.h
  9. 40
      lib/rgoose/rgooseCamera.cpp
  10. 3
      lib/rgoose/rgooseCamera.h
  11. 148
      lib/rgoose/rgooseDBConnector.cpp
  12. 8
      lib/rgoose/rgooseDBConnector.h
  13. 9
      lib/rgoose/rgooseKernel.cpp
  14. 66
      lib/rgoose/rgooseModuleEmbedVideo.cpp
  15. 17
      lib/rgoose/rgooseNode.cpp
  16. 6
      lib/rgoose/rgooseNode.h
  17. 28
      lib/rgoose/rgooseNode2D.cpp
  18. 4
      lib/rgoose/rgooseNodePTZCamControl.cpp
  19. 2
      lib/rgoose/rgooseNodeStaticCamControl.cpp
  20. 12
      lib/rgoose/rgooseTypes.h

9
lib/data/media/video/videoAVLIBSource.cpp

@ -446,7 +446,14 @@ bool videoAVLIBSource::_open(char *URI, bool ShowDeviceMenu, float framerate, in
sprintf(Buffer, "Codec [%d] not found for %s", m_pVideoState->m_pCodecCtx->codec_id, URI);
LOG_ERROR( Buffer );
return false;
};
};
/*
End-user application may configure the number of threads to utilize (via AVCodecContext::thread_count property set before avcodec_open2())
and threaded mode (AVCodecContext::thread_type set to FF_THREAD_FRAME or FF_THREAD_SLICE).
Thread pool will be managed by FFmpeg itself, although some answers say that it is also possible using application-provided pool.
*/
m_pVideoState->m_pCodecCtx->thread_count = 2;
m_pVideoState->m_pCodecCtx->thread_type = FF_THREAD_FRAME;
if( avcodec_open2( m_pVideoState->m_pCodecCtx, m_pVideoState->m_pVideoCodec, NULL ) < 0 ){
sprintf(Buffer, "Could not open Video codec[%d] for %s", m_pVideoState->m_pCodecCtx->codec_id, URI );

4
lib/data/media/video/videoAVLIBSource.h

@ -35,13 +35,15 @@ class videoAVLIBSource : public basicMediaSource, public basicThread {
void m_fThreadProc( void );
#ifndef _NOAUDIO_
mediaBus * m_pAudioBus;
static void * m_tAudioProc( void *args);
static void * m_tAudioProc( void *args );
#endif
bool m_bSizeIsAutomatic;
public:
bool _open( CSTR URI, bool ShowDeviceMenu = false, float framerate=-1.f, int inputPin = -1, int width = -1, int height = -1 , bool scaled=false, int s_width=-1, int s_height=-1 );
bool _close( void );
bool _stop( void );
bool isFinished( void ){ return !(m_bThreadStatus<TH_ENDED); };
uint8_t getStatus( void ){ if( m_pVideoState ){ return m_pVideoState->m_bStatus; }; return 0; };
videoAVLIBSource( void *opaque=NULL );
videoAVLIBSource( CSTR URI, void *opaque=NULL );
videoAVLIBSource( config_setting_t *CFG, void *opaque=NULL );

31
lib/data/protocol/protocolPTZ_PELCO.cpp

@ -4,9 +4,8 @@
#define LOG( X ) m_pLog->Log( "Proto[PELCO]", this, X )
#define LOG_ERROR( X ) m_pLog->Log( "Proto[PELCO]", this, _LOG_ERROR, X )
protocolPTZ_PELCO::protocolPTZ_PELCO(config_setting_t *Settings) :protocolPTZ(), m_mInquiryMutex(){
protocolPTZ_PELCO::protocolPTZ_PELCO(config_setting_t *Settings): protocolPTZ(), m_mInquiryMutex(){
m_pLog = basicLogCollection::getInstance();
//m_pDataTransport = NULL;
m_pSettings = Settings;
m_bReplyRequired = false;
m_bDPlusEna = false;
@ -14,8 +13,16 @@ protocolPTZ_PELCO::protocolPTZ_PELCO(config_setting_t *Settings) :protocolPTZ(),
m_bLastCommandIssued = CMD_PTZ_NOOP;
};
protocolPTZ_PELCO::protocolPTZ_PELCO( uint8_t CAM_ID ): protocolPTZ(), m_mInquiryMutex(){
m_pLog = basicLogCollection::getInstance();
m_pSettings = NULL;
m_bReplyRequired = false;
m_bDPlusEna = false;
m_bCAM_ID = CAM_ID;
m_bLastCommandIssued = CMD_PTZ_NOOP;
};
protocolPTZ_PELCO::~protocolPTZ_PELCO(){
//if (m_pDataTransport!=NULL)delete((serialPort*)m_pDataTransport);
};
U8 protocolPTZ_PELCO::finishUpPackage(U8 *pBuffer){
@ -394,13 +401,15 @@ bool protocolPTZ_PELCO::move(uint32_t MoveMatrix){
Buffer[DATA1_IDX] = Param1; // Max = 3f Turbo Pan = FF
Buffer[DATA2_IDX] = Param2;
LOG("Make move");
return m_oDataTransport->sendData(Buffer, finishUpPackage(Buffer));
bool tv = m_oDataTransport->sendData(Buffer, finishUpPackage(Buffer));
if( tv ) SLEEP(500);
return tv;
};
bool protocolPTZ_PELCO::goAbsolute( float dPan, float dTilt, float dZoom) {
if (m_bStatus == 0) return false;
if( m_bStatus == 0 ) return false;
// if (m_bReplyRequired) if (m_bLastCommandIssued != CMD_PTZ_NOOP) return false;
if (m_bDPlusEna) {
if( m_bDPlusEna ) {
U8 Buffer[16];
U8 Param1, Param2;
memset(Buffer, 0, 16 );
@ -425,15 +434,17 @@ bool protocolPTZ_PELCO::goAbsolute( float dPan, float dTilt, float dZoom) {
Buffer[13] = 0x0F & tPos;
Buffer[14] = 0xFF;
LOG("ABS move");
return m_oDataTransport->sendData(Buffer, 15);
bool tv = m_oDataTransport->sendData(Buffer, 15);
if( tv ) SLEEP(500);
return tv;
} else {
LOG("ABS move");
if( setPanPos( dPan ) ){
SLEEP( 5000 );
SLEEP( 500 );
if( setTiltPos(dTilt) ){
SLEEP( 5000 );
SLEEP( 500 );
if( setZoom(dZoom)){
SLEEP( 5000 );
SLEEP( 500 );
return true;
};
};

3
lib/data/protocol/protocolPTZ_PELCO.h

@ -28,7 +28,8 @@ class protocolPTZ_PELCO: public protocolPTZ{
int packetChecker( U8 *Buffer, size_t BufferSize );
bool packetHandler( protocolPackage *Package );
public:
explicit protocolPTZ_PELCO(config_setting_t *Settings = NULL);
explicit protocolPTZ_PELCO( config_setting_t *Settings = NULL );
explicit protocolPTZ_PELCO( uint8_t CAM_ID );
virtual ~protocolPTZ_PELCO();
virtual bool create( void );
virtual bool initCamera( void );

64
lib/data/protocol/protocolPTZ_VISCA.cpp

@ -4,17 +4,23 @@
#define LOG( X ) m_pLog->Log( "Proto[VISCA]", this, X )
#define LOG_ERROR( X ) m_pLog->Log( "Proto[VISCA]", this, _LOG_ERROR, X )
protocolPTZ_VISCA::protocolPTZ_VISCA(config_setting_t *Settings) :protocolPTZ(), m_mInquiryMutex(){
protocolPTZ_VISCA::protocolPTZ_VISCA(config_setting_t *Settings): protocolPTZ(), m_mInquiryMutex(){
m_pLog = basicLogCollection::getInstance();
m_oDataTransport = NULL;
m_pSettings = Settings;
m_bLANC_ID = 1;
m_bLastCommandIssued = CMD_PTZ_NOOP;
memset( m_aSlots, 0 , 10 );
};
protocolPTZ_VISCA::protocolPTZ_VISCA( uint8_t CAM_ID ): protocolPTZ(), m_mInquiryMutex(){
m_pLog = basicLogCollection::getInstance();
m_pSettings = NULL;
m_bLANC_ID = CAM_ID;
m_bLastCommandIssued = CMD_PTZ_NOOP;
memset( m_aSlots, 0 , 10 );
};
protocolPTZ_VISCA::~protocolPTZ_VISCA(){
if (m_oDataTransport != NULL)delete((serialPort*)m_oDataTransport);
};
int protocolPTZ_VISCA::packetChecker( unsigned char *Buffer, size_t BufferSize ){
@ -123,33 +129,37 @@ bool protocolPTZ_VISCA::packetHandler(protocolPackage *Package){
};
bool protocolPTZ_VISCA::create( void ){
config_setting_t *pSetting;
int tPort, tSpeed;
if (!protocolPTZ::create()) return false;
m_bStatus = 0;
pSetting = config_setting_get_member(m_pSettings, PPTZ_TAG_COM_PORT);
if (pSetting == NULL) return false;
tPort = config_setting_get_int(pSetting);
pSetting = config_setting_get_member(m_pSettings, PPTZ_TAG_COM_SPEED);
if (pSetting == NULL) return false;
tSpeed = config_setting_get_int(pSetting);
pSetting = config_setting_get_member(m_pSettings, PPTZ_TAG_CAM_ID);
if (pSetting == NULL) return false;
m_bLANC_ID = (U8)config_setting_get_int(pSetting);
char tBuf[16];
if( !protocolPTZ::create() ) return false;
if( m_pSettings != NULL ) {
config_setting_t *pSetting;
int tPort, tSpeed;
m_bStatus = 0;
pSetting = config_setting_get_member(m_pSettings, PPTZ_TAG_COM_PORT);
if (pSetting == NULL) return false;
tPort = config_setting_get_int(pSetting);
pSetting = config_setting_get_member(m_pSettings, PPTZ_TAG_COM_SPEED);
if (pSetting == NULL) return false;
tSpeed = config_setting_get_int(pSetting);
pSetting = config_setting_get_member(m_pSettings, PPTZ_TAG_CAM_ID);
if (pSetting == NULL) return false;
m_bLANC_ID = (U8)config_setting_get_int(pSetting);
char tBuf[16];
#ifdef __linux__
sprintf( tBuf,"/dev/ttyS%d",tPort);
sprintf( tBuf,"/dev/ttyS%d",tPort);
#else
sprintf(tBuf, "com%d", tPort);
sprintf(tBuf, "com%d", tPort);
#endif
m_oDataTransport = new serialPort(tBuf,tSpeed);
if (m_oDataTransport != NULL){
if (m_oDataTransport->addRecipient(this)){
m_bStatus = 1;
return true;
};
};
return false;
m_oDataTransport = new serialPort(tBuf,tSpeed);
if (m_oDataTransport != NULL){
if (m_oDataTransport->addRecipient(this)){
m_bStatus = 1;
return true;
};
};
};
if( m_oDataTransport == NULL ) return false;
m_bStatus = 1;
return true;
};
bool protocolPTZ_VISCA::initCamera(void){

1
lib/data/protocol/protocolPTZ_VISCA.h

@ -29,6 +29,7 @@ class protocolPTZ_VISCA: public protocolPTZ{
bool packetHandler( protocolPackage *Package );
public:
explicit protocolPTZ_VISCA(config_setting_t *Settings = NULL);
explicit protocolPTZ_VISCA( uint8_t CAM_ID );
~protocolPTZ_VISCA();
/* Implemen Generic PTZ Interface */

87
lib/hardware/uart/serialSOL.cpp

@ -17,7 +17,7 @@ serialSOL::serialSOL( SOL_TYPE t ): transportSocket(){
memset( &m_sClientAddr, 0, sizeof( m_sClientAddr ) );
#endif
};
serialSOL::serialSOL( SOL_PORT_SETTINGS *PortSettings ): transportSocket(){
m_pLog = m_pLog = basicLogCollection::getInstance();
//memset( &m_sPortSettings, 0, sizeof( SOL_PORT_SETTINGS ));
@ -298,24 +298,10 @@ bool serialSOL::create( CSTR address, uint16_t port, int Speed, SOL_TYPE t ){
m_sServerAddr.sin_addr.s_addr = inet_addr( m_cDeviceAddress );
m_sServerAddr.sin_port = htons( m_nPort );
// connect the client socket to server socket
#ifdef __linux__
if( connect( m_nSocketFD, (struct sockaddr *)&m_sServerAddr, sizeof( struct sockaddr ) ) !=0 ){
#else
if (connect(m_sSocket, (struct sockaddr*) & m_sServerAddr, sizeof(struct sockaddr)) != 0) {
#endif
char cBuffer[128];
sprintf(cBuffer,"ERROR connect to [%s:%d] (%s)", m_cDeviceAddress, m_nPort, strerror(errno) );
LOG_ERROR( cBuffer );
return false;
}
#ifdef DEBUG
else LOG("Connected to the server");
#endif
// Set non-blocking
#ifdef __linux__
int arg;
int arg;
if( (arg = fcntl( m_nSocketFD, F_GETFL, NULL)) < 0) {
char tBuf[128];
sprintf( tBuf, "Error fcntl(..., F_GETFL) (%s)", strerror(errno));
@ -329,16 +315,77 @@ bool serialSOL::create( CSTR address, uint16_t port, int Speed, SOL_TYPE t ){
LOG_ERROR( tBuf );
return false;
};
// connect the client socket to server socket
if( connect( m_nSocketFD, (struct sockaddr *)&m_sServerAddr, sizeof( struct sockaddr ) ) < 0 ){
if( errno == EINPROGRESS ){
#ifdef DEBUG
LOG( "EINPROGRESS in connect() - selecting" );
#endif
do {
fd_set myset;
struct timeval tv;
tv.tv_sec = 3;
tv.tv_usec = 0;
FD_ZERO( &myset );
FD_SET( m_nSocketFD, &myset );
int res = select( m_nSocketFD+1, NULL, &myset, NULL, &tv );
if( res < 0 && errno != EINTR ){
char tBuff[128];
sprintf( tBuff, "Error connecting %d - %s", errno, strerror(errno));
LOG_ERROR( tBuff );
return false;
} else if( res > 0 ){
// Socket selected for write
int valopt;
socklen_t lon = sizeof(int);
if( getsockopt( m_nSocketFD, SOL_SOCKET, SO_ERROR, (void*)(&valopt), &lon) < 0 ){
char tBuff[128];
sprintf( tBuff, "Error in getsockopt() %d - %s", errno, strerror(errno));
LOG_ERROR( tBuff );
return false;
};
// Check the value returned...
if( valopt ){
char tBuff[128];
sprintf( tBuff, "Error in delayed connection() %d - %s", valopt, strerror(valopt) );
LOG_ERROR( tBuff );
return false;
};
break;
} else {
LOG_ERROR("Timeout in select() - Cancelling!");
return false;
};
} while( 1 );
} else {
char tBuff[128];
sprintf( tBuff, "Error connecting %d - %s", errno, strerror(errno));
LOG_ERROR( tBuff );
return false;
};
}
#else
u_long arg = 1;
if (ioctlsocket(m_sSocket, FIONBIO, &arg) < 0) {
// Set non-blocking
u_long arg = 1;
if( ioctlsocket(m_sSocket, FIONBIO, &arg) < 0 ){
char tBuf[128];
sprintf(tBuf, "Error ioctlsocket(..., FIONBIO) (%s)", strerror(errno));
LOG_ERROR(tBuf);
return false;
};
// connect the client socket to server socket
if (connect(m_sSocket, (struct sockaddr*) & m_sServerAddr, sizeof(struct sockaddr)) != 0) {
char cBuffer[128];
sprintf(cBuffer,"ERROR connect to [%s:%d] (%s)", m_cDeviceAddress, m_nPort, strerror(errno) );
LOG_ERROR( cBuffer );
return false;
}
#endif
#ifdef DEBUG
else LOG("Connected to the server");
#endif
setConnectionStatus( CS_CONNECTED );
break;
};

2
lib/hardware/uart/serialSOL.h

@ -33,7 +33,7 @@
#endif
#ifdef DEBUG
//#define _DEBUG_SOL_COMMUNICATION_
#define _DEBUG_SOL_COMMUNICATION_
#endif
#include "../../components/base/basicThread.h"

40
lib/rgoose/rgooseCamera.cpp

@ -101,9 +101,9 @@ ARGUS_Camera::~ARGUS_Camera(){
};
bool ARGUS_Camera::create( uint32_t id ){
DBC_CAM_DATA * tData = m_pDBC->getCamData( id );
bool ARGUS_Camera::create( uint32_t CameraID ){
if( CameraID == 0 ) return false;
DBC_CAM_DATA * tData = m_pDBC->getCamData( CameraID );
if( tData != NULL ) {
memcpy( &m_sCamData, tData, sizeof(DBC_CAM_DATA) );
free( tData );
@ -150,7 +150,7 @@ bool ARGUS_Camera::create( uint32_t id ){
#ifdef DEBUG
LOG("VISCA");
#endif
m_pProtocol = (protocolPTZ *) new protocolPTZ_VISCA();
m_pProtocol = (protocolPTZ *) new protocolPTZ_VISCA( m_sCamData.protocol_aux );
if( m_pProtocol!= NULL ) {
DBC_UART_DATA *tData = NULL;
tData = m_pDBC->getUartData( m_sCamData.uart_id );
@ -183,7 +183,18 @@ bool ARGUS_Camera::create( uint32_t id ){
};
};
if( tTransport!= NULL ) {
m_pProtocol->setTransport( tTransport );
LOG( "Bind Transport Port!" );
if( m_pProtocol->setTransport( tTransport )){
if( !m_pProtocol->create() ){
LOG_ERROR("Protocol <<< Create >>> Failure!");
};
} else {
LOG_ERROR("Binding Port Failure!");
};
} else {
LOG_ERROR("Transport Creation Failure!");
delete( ( protocolPTZ_VISCA * )m_pProtocol );
m_pProtocol = NULL;
};
free( tData );
};
@ -194,7 +205,7 @@ bool ARGUS_Camera::create( uint32_t id ){
#ifdef DEBUG
LOG("PELCO");
#endif
m_pProtocol = (protocolPTZ *) new protocolPTZ_PELCO();
m_pProtocol = (protocolPTZ *) new protocolPTZ_PELCO( m_sCamData.protocol_aux );
if( m_pProtocol!= NULL ) {
DBC_UART_DATA *tData = NULL;
tData = m_pDBC->getUartData( m_sCamData.uart_id );
@ -245,7 +256,11 @@ bool ARGUS_Camera::create( uint32_t id ){
} else {
LOG_ERROR("Binding Port Failure!");
};
} else LOG_ERROR("Transport Creation Failure!");
} else {
LOG_ERROR("Transport Creation Failure!");
delete( ( protocolPTZ_PELCO * )m_pProtocol );
m_pProtocol = NULL;
};
free( tData );
}
#ifdef DEBUG
@ -361,7 +376,7 @@ void ARGUS_Camera::m_fThreadProc( void ){
if( m_bSourceConnected ) {
};
DBC_PUSHED_CMD * PUSHED = m_pDBC->getCamPushedCMD( m_sCamData.id );
DBC_PUSHED_CMD * PUSHED = m_pDBC->getNodePushedCMD( m_sCamData.node_id );
if( PUSHED ) {
if( ( PUSHED->CMD & ARGUS_CAM_PCMD_CMD_MASK ) == ARGUS_CAM_PCMD_CMD_MASK ) {
switch( PUSHED->CMD ) {
@ -839,6 +854,15 @@ bool ARGUS_Camera::disconnectFromStream( void ){
return !m_bSourceConnected;
};
bool ARGUS_Camera::validateStream( void ){
if( m_bSourceConnected ) {
if( m_pSource ) {
return !m_pSource->isFinished();
};
};
return false;
};
#undef LOG
#undef LOG_ERROR

3
lib/rgoose/rgooseCamera.h

@ -120,11 +120,12 @@ class ARGUS_Camera: public basicThread {
void setBusy( bool Status );
bool connectToStream( uint32_t id );
bool disconnectFromStream( void );
bool validateStream( void );
virtual void m_fThreadProc( void );
public:
ARGUS_Camera();
~ARGUS_Camera();
bool create( uint32_t id );
bool create( uint32_t CameraID );
};

148
lib/rgoose/rgooseDBConnector.cpp

@ -451,7 +451,7 @@ bool argusDBC::getAllCamRecords( uint32_t SiteID, vectorCamRecords &VR ){
};
it = cArr->find("protocol_aux");
if( it != cArr->end() ){
strncpy( tVal->protocol_aux, it->second.c_str(), 64 );
tVal->protocol_aux = atoi( it->second.c_str() );
};
it = cArr->find("lat");
if( it != cArr->end() ){
@ -1150,7 +1150,7 @@ uint8_t argusDBC::getLRFDataStatus( uint32_t ID ){
};
return RetVal;
};
/*
DBC_PUSHED_CMD *argusDBC::getLRFPushedCMD( uint32_t ID ){
DBC_PUSHED_CMD *RetVal = NULL;
if(m_bIsConnected){
@ -1186,6 +1186,7 @@ DBC_PUSHED_CMD *argusDBC::getLRFPushedCMD( uint32_t ID ){
};
return RetVal;
};
*/
DBC_INT_LIST *argusDBC::listModules( uint32_t ServerID ){
DBC_INT_LIST * tVal = NULL;
@ -1578,7 +1579,7 @@ DBC_CAM_DATA *argusDBC::getCamData( uint32_t ID ){
};
it = cArr->find("protocol_aux");
if( it != cArr->end() ){
strncpy( tVal->protocol_aux, it->second.c_str(), 64 );
tVal->protocol_aux = atoi( it->second.c_str() );
};
it = cArr->find("uart_id");
if( it != cArr->end() ){
@ -1688,12 +1689,12 @@ DBC_CAM_DATA *argusDBC::getCamData( uint32_t ID ){
return tVal;
};
DBC_PUSHED_CMD *argusDBC::getCamPushedCMD( uint32_t ID ){
DBC_PUSHED_CMD *argusDBC::getNodePushedCMD( uint32_t NodeID ){
DBC_PUSHED_CMD *RetVal = NULL;
if(m_bIsConnected){
char tQBuf[CTEXT];
AAssoc *result;
sprintf(tQBuf, "SELECT `pushed_cmd`, `pushed_param` FROM `cameras` WHERE `id`=%d AND `pushed_cmd` > 0", ID );
sprintf(tQBuf, "SELECT * FROM `nodes_qcq` WHERE `node_id`=%d AND `status`=0 LIMIT 1", NodeID );
#ifdef DEBUG_ALL
LOG(tQBuf);
#endif
@ -1702,28 +1703,37 @@ DBC_PUSHED_CMD *argusDBC::getCamPushedCMD( uint32_t ID ){
if( result->size() > 0 ) {
RetVal = (DBC_PUSHED_CMD*)malloc(sizeof(DBC_PUSHED_CMD));
if( RetVal ) {
Assoc *cArr;
Assoc::iterator it;
Assoc * cArr;
Assoc::iterator it;
memset( RetVal, 0, sizeof(DBC_PUSHED_CMD));
cArr = result->at(0);
it = cArr->find("pushed_cmd");
it = cArr->find("id");
if( it != cArr->end() ){
RetVal->id = atoi( it->second.c_str() );
};
it = cArr->find("cmd");
if( it != cArr->end() ){
RetVal->CMD = atoi( it->second.c_str() );
};
it = cArr->find("pushed_param");
it = cArr->find("parameter");
if( it != cArr->end() ){
RetVal->PARAM = atoi( it->second.c_str() );
strncpy( RetVal->PARAM, it->second.c_str(), 256 );
RetVal->PARAM[255] = (char)0;
};
//Only If Result is Fetched - Clear Current CMD
sprintf(tQBuf, "DELETE FROM `nodes_qcq` WHERE `id`=%d", RetVal->id );
m_pDatabase->SilentQuery( tQBuf );
};
};
//Only If Result is Fetched - Clear Current CMD
sprintf(tQBuf, "UPDATE `cameras` SET `pushed_cmd`=0, `pushed_param`=0 WHERE `id`=%d", ID );
m_pDatabase->SilentQuery( tQBuf );
};
deleteResult( result );
};
return RetVal;
};
DBC_MODULE_DATA *argusDBC::getModuleData( uint32_t ID ){
DBC_MODULE_DATA *tVal = NULL;
if(m_bIsConnected){
@ -2817,118 +2827,6 @@ uint32_t argusDBC::addVideoRecord( uint32_t streamID, CSTR md5, uint32_t partID
return tID;
};
DBC_KRNL_CMD *argusDBC::getActiveSiteCommand( uint32_t SiteID ){
DBC_KRNL_CMD *tPtr = NULL;
if( m_bIsConnected ) {
char tQBuf[MAX_PATH_LEN];
AAssoc *result;
sprintf( tQBuf, "SELECT * FROM `cmd_queue` WHERE `status`=0 AND `site_id`=%d LIMIT 1", SiteID );
#ifdef DEBUG_ALL
LOG(tQBuf);
#endif
result = m_pDatabase->Query( tQBuf );
if( result != NULL ) {
if( result->size() > 0 ) {
Assoc *cArr;
tPtr = (DBC_KRNL_CMD*)malloc(sizeof(DBC_KRNL_CMD));
if( tPtr!= NULL ) {
Assoc::iterator it;
memset(tPtr,0,sizeof(DBC_KRNL_CMD));
cArr = result->at(0);
it = cArr->find("id");
if( it != cArr->end() ){
tPtr->id = atoi( it->second.c_str() );
};
it = cArr->find("cmd");
if( it != cArr->end() ){
tPtr->cmd = atoi( it->second.c_str() );
};
it = cArr->find("param");
if( it != cArr->end() ){
strncpy( tPtr->param, it->second.c_str(), 255 );
};
it = cArr->find("aux_param");
if( it != cArr->end() ){
strncpy( tPtr->aux_param, it->second.c_str(), 255 );
};
};
};
};
deleteResult( result );
};
return tPtr;
};
DBC_KRNL_CMD *argusDBC::getActiveServerCommand( uint32_t ServerID ){
DBC_KRNL_CMD *tPtr = NULL;
if( m_bIsConnected ) {
char tQBuf[MAX_PATH_LEN];
AAssoc *result;
sprintf( tQBuf, "SELECT * FROM `servers_queue` WHERE `status`=0 AND `server_id`=%d LIMIT 1", ServerID );
#ifdef DEBUG_ALL
LOG(tQBuf);
#endif
result = m_pDatabase->Query( tQBuf );
if( result != NULL ) {
if( result->size() > 0 ) {
Assoc *cArr;
tPtr = (DBC_KRNL_CMD*)malloc(sizeof(DBC_KRNL_CMD));
if( tPtr!= NULL ) {
Assoc::iterator it;
memset(tPtr,0,sizeof(DBC_KRNL_CMD));
cArr = result->at(0);
it = cArr->find("id");
if( it != cArr->end() ){
tPtr->id = atoi( it->second.c_str() );
};
it = cArr->find("cmd");
if( it != cArr->end() ){
tPtr->cmd = atoi( it->second.c_str() );
};
it = cArr->find("param");
if( it != cArr->end() ){
strncpy( tPtr->param, it->second.c_str(), 255 );
};
it = cArr->find("aux_param");
if( it != cArr->end() ){
strncpy( tPtr->aux_param, it->second.c_str(), 255 );
};
};
};
};
deleteResult( result );
};
return tPtr;
};
bool argusDBC::updateSiteCommand( uint32_t CMD_ID, uint8_t STATUS ){
if( m_bIsConnected ) {
char tQBuf[MAX_PATH_LEN];
sprintf( tQBuf, "UPDATE `cmd_queue` SET `status`=%d WHERE id=%d", STATUS, CMD_ID );
#ifdef DEBUG_ALL
LOG(tQBuf);
#endif
m_pDatabase->SilentQuery( tQBuf );
return true;
};
return false;
};
bool argusDBC::updateServerCommand( uint32_t CMD_ID, uint8_t STATUS ){
if( m_bIsConnected ) {
char tQBuf[MAX_PATH_LEN];
sprintf( tQBuf, "UPDATE `servers_queue` SET `status`=%d WHERE id=%d", STATUS, CMD_ID );
#ifdef DEBUG_ALL
LOG(tQBuf);
#endif
m_pDatabase->SilentQuery( tQBuf );
return true;
};
return false;
};
bool argusDBC::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 ){
if( m_bIsConnected ) {
char tQBuf[MAX_PATH_LEN];

8
lib/rgoose/rgooseDBConnector.h

@ -61,13 +61,11 @@ class argusDBC{
//DBC_INT_LIST * listSockets( uint32_t NodeID );
DBC_INT_LIST * listResources( uint32_t NodeID = 0 );
DBC_KRNL_CMD * getActiveServerCommand( uint32_t ServerID );
DBC_KRNL_CMD * getActiveSiteCommand( uint32_t SiteID );
bool getAllCamRecords( uint32_t SiteID, vectorCamRecords &VR );
DBC_APF_DATA * getAPFData( uint32_t APFID );
DBC_CAM_DATA * getCamData( uint32_t CamID );
uint32_t getCamId( CSTR UUID );
DBC_PUSHED_CMD * getCamPushedCMD( uint32_t ID );
bool getConnectionStatus(void){return m_bIsConnected;};
DBC_EVT_DATA * getEventByUUID( CSTR UUID );
DBC_MODULE_EMBED_VIDEO_DATA * getEmbedVideoData( uint32_t ID );
@ -77,7 +75,6 @@ class argusDBC{
bool getLastEvents( vectorEventRecords &VR, uint32_t tss, uint32_t tsms );
DBC_LRF_DATA * getLRFData( uint32_t ID );
uint8_t getLRFDataStatus( uint32_t ID );
DBC_PUSHED_CMD * getLRFPushedCMD( uint32_t ID );
DBC_MEDIA_STREAM_DATA * getMediaStreamData( uint32_t ID );
DBC_MEDIA_SERVER_DATA * getMediaServerData( uint32_t ID );
DBC_MEDIA_SERVER_STREAM_DATA * getMediaServerStreamData( uint32_t ID );
@ -88,6 +85,7 @@ class argusDBC{
DBC_NODE_DATA * getNodeData( uint32_t ID );
CSTR getNodeIP4( uint32_t NodeID );
CSTR getNodeIP6( uint32_t NodeID );
DBC_PUSHED_CMD * getNodePushedCMD( uint32_t NodeID );
//uint32_t getNodeSocketID( uint32_t NodeID, uint32_t auxID, uint8_t SocketType, CSTR path );
DBC_RESOURCE_DATA * getResourceData( uint32_t ResourceID );
uint32_t getResourceID( uint32_t SiteID, uint32_t NodeID, uint8_t type, uint32_t auxID );
@ -121,8 +119,6 @@ class argusDBC{
bool setLRFAltVerison( uint32_t lrfID, CSTR version );
bool setStreamValid( uint32_t streamID );
bool updateAFPBox( uint32_t filterID, CSTR Tag, float x, float y, float z );
bool updateServerCommand( uint32_t CMD_ID, uint8_t STATUS );
bool updateSiteCommand( uint32_t CMD_ID, uint8_t STATUS );
bool updateIPCam( uint32_t SiteID, CSTR uuid, CSTR Addr );
bool updateIPCam( uint32_t SiteID, uint32_t CamID, CSTR Addr );
bool updateLRFSerial( uint32_t lrfID, CSTR Serial );

9
lib/rgoose/rgooseKernel.cpp

@ -390,11 +390,10 @@ void argusKernel::m_fThreadProc( void ){
};
if( !m_pDBC->updateServerUtilisation( m_nServerID, cCORES, cpu1, cpu5, cpu15, mem, disk, tMEM, cMEM, tDISK, cDISK ) ) LOG_ERROR("Cannot update System Utilisation Stats!");
//Get Queued Commands
DBC_KRNL_CMD *tCMD = NULL;
tCMD = m_pDBC->getActiveServerCommand( m_nServerID );
DBC_PUSHED_CMD *tCMD = m_pDBC->getNodePushedCMD( m_nServerNodeID );
//tCMD = m_pDBC->getActiveSiteCommand( m_nSiteID );
if( tCMD != NULL ){
switch( tCMD->cmd ) {
switch( tCMD->CMD ) {
case ARGUS_CMD_KRNL_RELOAD:{
LOG("Reload ARGUS SERVER!");
m_bThreadStatus = TH_ENDED;
@ -414,7 +413,7 @@ void argusKernel::m_fThreadProc( void ){
break;
};
case ARGUS_CMD_NODE_RELOAD:{
uint32_t tNodeID = atoi( tCMD->param );
uint32_t tNodeID = atoi( tCMD->PARAM );
if( m_pNodeFactory != NULL ) {
m_pNodeFactory->reloadNode( tNodeID );
};
@ -431,8 +430,6 @@ void argusKernel::m_fThreadProc( void ){
break;
};
};
m_pDBC->updateServerCommand( tCMD->id, ARGUS_CMD_STATUS_FINISHED );
//m_pDBC->updateSiteCommand( tCMD->id, ARGUS_CMD_STATUS_FINISHED );
free( tCMD );
};
// Validate Hardware

66
lib/rgoose/rgooseModuleEmbedVideo.cpp

@ -232,11 +232,13 @@ void *argusModuleEmbedVideo::webClientProc( void *ptr ){
};
CTX->initDone = true;
continue;
} else {
}
#ifdef DEBUG_EXTRA
else {
TLOG("Stream id Not Online");
}
#endif
};
;
}
#ifdef DEBUG_EXTRA
else TLOG("No Stream ID")
@ -262,7 +264,7 @@ void *argusModuleEmbedVideo::webClientProc( void *ptr ){
CTX->bValid = false;
continue;
} else {
/*
retVal = read( CTX->m_iEncoderPipe[0], &msgSize, sizeof(uint32_t));
if( retVal == -1 ){
if( errno == EAGAIN || errno == EWOULDBLOCK ){
@ -271,13 +273,10 @@ void *argusModuleEmbedVideo::webClientProc( void *ptr ){
TLOG_ERROR("Pipe Communication Error[1]!");
CTX->bValid = false;
continue;
};
};
if( msgSize < FILESTREAMBUFFERSZ ) {
retVal = read( CTX->m_iEncoderPipe[0], tBuf, msgSize );
} else {
//Read Some Data or Abort Whole Thing
//retVal = read( CTX->m_iEncoderPipe[0], tBuf, FILESTREAMBUFFERSZ );
TLOG_ERROR("Data too Big in Pipe Transfer!");
CTX->bValid = false;
continue;
@ -290,7 +289,33 @@ void *argusModuleEmbedVideo::webClientProc( void *ptr ){
TLOG_ERROR("Pipe Communication Error[2]!");
CTX->bValid = false;
continue;
};
*/
/**************/
CTX->ModulePtr->m_mEncodedProtector.lock();
if( CTX->ModulePtr->m_mapCAPTURES[CTX->mediaStreamId].size() ) {
msgSize = CTX->ModulePtr->m_mapCAPTURES[CTX->mediaStreamId].size();
if( msgSize < FILESTREAMBUFFERSZ ) {
memcpy( tBuf, CTX->ModulePtr->m_mapCAPTURES[CTX->mediaStreamId].data(), msgSize );
CTX->ModulePtr->m_mEncodedProtector.unlock();
} else {
CTX->ModulePtr->m_mEncodedProtector.unlock();
TLOG_ERROR("Data too Big in Pipe Transfer!");
CTX->bValid = false;
continue;
};
} else {
CTX->ModulePtr->m_mEncodedProtector.unlock();
if( CTX->ModulePtr->n_pNoSignalData ){
msgSize = CTX->ModulePtr->m_nNoSignalSize;
memcpy( tBuf, CTX->ModulePtr->n_pNoSignalData, msgSize );
} else {
TLOG_ERROR("Data too Big in Pipe Transfer!");
CTX->bValid = false;
continue;
};
};
/*********/
sprintf( mesg, "--MPFrame\r\nContent-type: image/jpeg\r\nContent-length: %d\r\n\r\n", msgSize );
if( send( CTX->m_iSocketFID, mesg, strlen( mesg ), 0 )< 0 ){
sprintf( mesg, "[1]Failed sending file to client: %s", strerror(errno));
@ -310,6 +335,7 @@ void *argusModuleEmbedVideo::webClientProc( void *ptr ){
CTX->bValid = false;
continue;
};
SLEEP( 80 );
};
};
};
@ -775,16 +801,13 @@ void argusModuleEmbedVideo::pushFrame( cv::Mat &Frame, void* src ){
//compression_params.push_back(CV_IMWRITE_PNG_COMPRESSION);
//compression_params.push_back(9);
compression_params.push_back( cv::IMWRITE_JPEG_QUALITY );
compression_params.push_back( m_sEmbedVideoData.compression_quality );
//vector<uchar> buf;
uint32_t DataSize;
//m_mPictureProtector.lock();
compression_params.push_back( m_sEmbedVideoData.compression_quality );
m_mEncodedProtector.lock();
m_mapCAPTURES[tMD->mediaStreamId].clear();
cv::imencode( ".jpg", m_mapMATS[tMD->mediaStreamId], m_mapCAPTURES[tMD->mediaStreamId], compression_params );
m_mEncodedProtector.unlock();
/*ToDo: Move Broadcast Pic From Push Frame Procedure */
DataSize = m_mapCAPTURES[tMD->mediaStreamId].size(); //buf.size();
/*ToDo: Move Broadcast Pic From Push Frame Procedure
uint32_t DataSize = m_mapCAPTURES[tMD->mediaStreamId].size(); //buf.size();
if( DataSize ) {
uint8_t *pData = m_mapCAPTURES[tMD->mediaStreamId].data(); //buf.data();
@ -797,6 +820,7 @@ void argusModuleEmbedVideo::pushFrame( cv::Mat &Frame, void* src ){
};
};
};
*/
m_mPictureProtector.unlock();
};
};
@ -807,15 +831,15 @@ bool argusModuleEmbedVideo::registerForMediaStream( uint32_t id, WEB_CLIENT_CTX
//Check if its Valid!
DBC_MEDIA_STREAM_DATA *tSD = m_pDBC->getMediaStreamData( id );
if( tSD ) {
if( ! tSD->valid ) {
free( tSD );
return false;
};
//if( !tSD->valid ) {
// free( tSD );
// return false;
//};
free( tSD );
if( pipe( CTX->m_iEncoderPipe ) == -1 ){
CTX->bValid = false;
return false;
};
//if( pipe( CTX->m_iEncoderPipe ) == -1 ){
// CTX->bValid = false;
// return false;
//};
CTX->mediaStreamId = id;
return true;
};

17
lib/rgoose/rgooseNode.cpp

@ -13,17 +13,15 @@
#endif
argusNetNode::argusNetNode( uint32_t id ):basicObject(){
m_nDBID = id;
m_pDBC = argusDBC::getInstance();
m_pLog = basicLogCollection::getInstance();
m_pPosition = NULL;
m_pTargetFilter = NULL;
if( m_pDBC != NULL ) {
DBC_NODE_DATA *tData = NULL;
m_pDBC->setNodeOnline( m_nDBID );
tData = m_pDBC->getNodeData( m_nDBID );
DBC_NODE_DATA *tData = m_pDBC->getNodeData( id );
if( tData != NULL ) {
memcpy( &m_sNodeData , tData, sizeof(DBC_NODE_DATA));
m_sNodeData.online = m_pDBC->setNodeOnline( m_sNodeData.node_id );
free( tData );
} else {
memset( &m_sNodeData , 0, sizeof(DBC_NODE_DATA));
@ -38,9 +36,16 @@ argusNetNode::argusNetNode( uint32_t id ):basicObject(){
};
argusNetNode::argusNetNode( DBC_NODE_DATA *Data ):basicObject(){
m_nDBID = Data->node_id;
m_pDBC = argusDBC::getInstance();
memcpy( &m_sNodeData , Data, sizeof(DBC_NODE_DATA));
if( Data ) {
memcpy( &m_sNodeData , Data, sizeof(DBC_NODE_DATA));
if( m_pDBC ) {
m_sNodeData.online = m_pDBC->setNodeOnline( m_sNodeData.node_id );
};
} else {
memset( &m_sNodeData , 0, sizeof(DBC_NODE_DATA));
m_sNodeData.type = ARGUS_UNKNOWN;
};
};
argusNetNode::~argusNetNode(){

6
lib/rgoose/rgooseNode.h

@ -25,7 +25,7 @@ class argusNetNode: public basicObject{
basicMutex m_mCommandProtector;
protected:
argusDBC * m_pDBC;
uint32_t m_nDBID;
//uint32_t m_nDBID;
DBC_NODE_DATA m_sNodeData;
basicPosition * m_pPosition;
ARGUS_TARGET_FILTER * m_pTargetFilter;
@ -34,14 +34,14 @@ class argusNetNode: public basicObject{
explicit argusNetNode( uint32_t id );
explicit argusNetNode( DBC_NODE_DATA *Data );
virtual ~argusNetNode();
uint32_t getDbId() const { return m_nDBID;};
uint32_t getDbId() const { return m_sNodeData.node_id; };
ARGUS_NODE_TYPE getType() const { return m_sNodeData.type; };
bool isOnline( void ) const { return m_sNodeData.online; };
virtual bool isDetached() { return true; };
virtual bool isAttached() { return false; };
virtual bool startService(){ return false; };
virtual bool stopService(){ return true; };
virtual bool validate(){ return false; };
virtual bool validate(){ return true; };
virtual void simulateTarget( void ){};
void enqueueCommand( NODE_COMMAND *ptr );
};

28
lib/rgoose/rgooseNode2D.cpp

@ -107,7 +107,7 @@ bool ARGUS_2DSensor::startService() {
bool ARGUS_2DSensor::stopService() {
m_mWMProtector.unlock();
waitThreadEnd( true );
m_pDBC->setNodeOffline( m_nDBID );
m_pDBC->setNodeOffline( m_sNodeData.node_id );
return true;
};
@ -116,7 +116,7 @@ bool ARGUS_2DSensor::validate(){
switch( m_bWM ){
case ANODE_WM_2D_PING:{
// In Idle Mode
DBC_PUSHED_CMD * PUSHED = m_pDBC->getLRFPushedCMD( m_sLRF_DATA.id );
DBC_PUSHED_CMD * PUSHED = m_pDBC->getNodePushedCMD( m_sNodeData.node_id );
if( PUSHED ) {
switch( PUSHED->CMD ) {
case ARGUS_LRF_PCMD_FULL_RESET:{
@ -185,7 +185,7 @@ void ARGUS_2DSensor::m_fThreadProc( void ){
LOG_ERROR("Can not access Kernel");
};
setTransport( NULL, false );
m_pDBC->setNodeOffline( m_nDBID );
m_pDBC->setNodeOffline( m_sNodeData.node_id );
m_bInitialFlips = LGS_INITIAL_FLIPS;
SLEEP( 500 );
break;
@ -480,7 +480,7 @@ bool ARGUS_2DSensor::packetHandler( protocolPackage *Package ){
LOG("CMD State");
#endif
// Set Node Online!
m_pDBC->setNodeOnline( m_nDBID, ARGUS_NODE_STATUS_WORK );
m_pDBC->setNodeOnline( m_sNodeData.node_id, ARGUS_NODE_STATUS_WORK );
setWM( ANODE_WM_2D_GET_MASTER_PARAM );
break;
};
@ -528,7 +528,7 @@ bool ARGUS_2DSensor::packetHandler( protocolPackage *Package ){
switch( getWM() ) {
case ANODE_WM_2D_WAIT_CONNECT:{
// Initial Connection
m_pDBC->setNodeOnline( m_nDBID, ARGUS_NODE_STATUS_INIT );
m_pDBC->setNodeOnline( m_sNodeData.node_id, ARGUS_NODE_STATUS_INIT );
if( m_bDeviceWM != MODE_DETECTOR ) {
setWM( ANODE_WM_2D_SET_INIT_MODE );
} else {
@ -628,7 +628,7 @@ bool ARGUS_2DSensor::packetHandler( protocolPackage *Package ){
if( m_bVersionStringValid && m_bSerialStringValid ) {
// The Device is OK
setWM( ANODE_WM_2D_GET_DETECTION_PROFILE );
m_pDBC->setNodeOnline( m_nDBID, ARGUS_NODE_STATUS_WORK );
m_pDBC->setNodeOnline( m_sNodeData.node_id, ARGUS_NODE_STATUS_WORK );
} else {
m_sLRF_DATA.data_status = m_pDBC->getLRFDataStatus( m_sLRF_DATA.id );
if( m_sLRF_DATA.data_status ) {
@ -643,7 +643,7 @@ bool ARGUS_2DSensor::packetHandler( protocolPackage *Package ){
m_pDBC->updateLRFVerison( m_sLRF_DATA.id, m_tSV );
m_pDBC->setLRFDataStatus( m_sLRF_DATA.id, ARGUS_DS_VALID );
//m_pDBC->setLRFDataStatus( m_sLRF_DATA.id, ARGUS_DS_GET_CONFIG );
m_pDBC->setNodeOnline( m_nDBID, ARGUS_NODE_STATUS_WORK );
m_pDBC->setNodeOnline( m_sNodeData.node_id, ARGUS_NODE_STATUS_WORK );
} else {
// Go Sleep and Restart in 2 seconds
m_bVersionStringValid = false;
@ -654,8 +654,8 @@ bool ARGUS_2DSensor::packetHandler( protocolPackage *Package ){
m_pDBC->setLRFAltSerial( m_sLRF_DATA.id, m_tSN );
m_pDBC->setLRFAltVerison( m_sLRF_DATA.id, m_tSV );
m_pDBC->setLRFDataStatus( m_sLRF_DATA.id, ARGUS_DS_CONF_MISTMATCH );
m_pDBC->addNotification( ARGUS_NM_DEVICE_MISTMATCH, ARGUS_NM_DISMISS_LEVEL_ADMIN, m_nDBID );
m_pDBC->setNodeOnline( m_nDBID, ARGUS_NODE_STATUS_TROUBLE );
m_pDBC->addNotification( ARGUS_NM_DEVICE_MISTMATCH, ARGUS_NM_DISMISS_LEVEL_ADMIN, m_sNodeData.node_id );
m_pDBC->setNodeOnline( m_sNodeData.node_id, ARGUS_NODE_STATUS_TROUBLE );
};
} else {
// Go Sleep and Restart in 2 seconds
@ -664,8 +664,8 @@ bool ARGUS_2DSensor::packetHandler( protocolPackage *Package ){
m_bTimeOutCounter = 6; // 2 sec
setWM( ANODE_WM_2D_SLEEP_AND_RECONNECT );
m_pDBC->addNotification( ARGUS_NM_DEVICE_MISTMATCH, ARGUS_NM_DISMISS_LEVEL_ADMIN, m_nDBID );
m_pDBC->setNodeOnline( m_nDBID, ARGUS_NODE_STATUS_TROUBLE );
m_pDBC->addNotification( ARGUS_NM_DEVICE_MISTMATCH, ARGUS_NM_DISMISS_LEVEL_ADMIN, m_sNodeData.node_id );
m_pDBC->setNodeOnline( m_sNodeData.node_id, ARGUS_NODE_STATUS_TROUBLE );
};
};
break;
@ -855,7 +855,7 @@ bool ARGUS_2DSensor::packetHandler( protocolPackage *Package ){
EVENT_CONTAINER * bEVT = NULL;
TARGET_DATA * tData = prepareTargetData( AZ, RANGE, WIDTH );
if( m_pTargetFilter != NULL ) {
if( !m_pTargetFilter->validateTarget( m_nDBID, tData ) ){
if( !m_pTargetFilter->validateTarget( m_sNodeData.node_id, tData ) ){
free( tData );
break;
};
@ -944,7 +944,7 @@ void ARGUS_2DSensor::simulateTarget( void ){
if( tData != NULL ){
if( m_pTargetFilter != NULL ) {
if( !m_pTargetFilter->validateTarget( m_nDBID, tData ) ){
if( !m_pTargetFilter->validateTarget( m_sNodeData.node_id, tData ) ){
free( tData );
return;
};
@ -968,7 +968,7 @@ void ARGUS_2DSensor::saveRawDrawData( uint16_t alngles ){
fwrite( &tVal, 4, 1, fp );
fwrite( m_vDrawRanges, 4, alngles, fp );
fclose( fp );
m_pDBC->addDraw( m_nDBID, alngles, tID );
m_pDBC->addDraw( m_sNodeData.node_id, alngles, tID );
} else {
LOG_ERROR("Cannot open DRAW file!");
}

4
lib/rgoose/rgooseNodePTZCamControl.cpp

@ -152,7 +152,7 @@ bool ARGUS_PTZCAM::validate(){
if( !argusNetNode::m_pDBC ) return false;
//Validate Node Settings
{
DBC_NODE_DATA *tDATA = argusNetNode::m_pDBC->getNodeData( m_nDBID );
DBC_NODE_DATA *tDATA = argusNetNode::m_pDBC->getNodeData( m_sNodeData.node_id );
if( tDATA ) {
if( memcmp( &m_sNodeData, tDATA, sizeof(DBC_NODE_DATA)) != 0 ){
free( tDATA );
@ -190,6 +190,8 @@ bool ARGUS_PTZCAM::validate(){
return argusNetNode::m_pDBC->setStreamValid( m_sNodeData.aux_parameter );
};
};
} else {
return validateStream();
};
}
return true;

2
lib/rgoose/rgooseNodeStaticCamControl.cpp

@ -129,7 +129,7 @@ bool ARGUS_CAM::validate(){
if( !argusNetNode::m_pDBC ) return false;
//Validate Node Settings
{
DBC_NODE_DATA *tDATA = argusNetNode::m_pDBC->getNodeData( m_nDBID );
DBC_NODE_DATA *tDATA = argusNetNode::m_pDBC->getNodeData( m_sNodeData.node_id );
if( tDATA ) {
if( memcmp( &m_sNodeData, tDATA, sizeof(DBC_NODE_DATA)) != 0 ){
free( tDATA );

12
lib/rgoose/rgooseTypes.h

@ -147,7 +147,7 @@ typedef struct S_DBC_CAM_DATA{
uint8_t status;
char session[33];
uint8_t protocol;
char protocol_aux[65];
uint8_t protocol_aux;
uint32_t uart_id;
float lat;
float lon;
@ -253,8 +253,9 @@ typedef struct S_DBC_RESOURCE_DATA{
}DBC_RESOURCE_DATA;
typedef struct S_DBC_PUSHED_CMD{
uint32_t id;
uint8_t CMD;
int PARAM;
char PARAM[256];
}DBC_PUSHED_CMD;
typedef struct S_DBC_MEDIA_STREAM_DATA{
@ -390,13 +391,6 @@ typedef struct S_DBC_FH_DATA{
uint32_t uart_id;
}DBC_FH_DATA;
typedef struct S_DBC_KRNL_CMD{
uint32_t id;
uint8_t cmd;
char param[255];
char aux_param[255];
}DBC_KRNL_CMD;
typedef struct S_DBC_TARGET_FLITER_DATA{
uint32_t id;
uint8_t type;

Loading…
Cancel
Save