31 changed files with 1597 additions and 338 deletions
-
4Projects/argus/argus.vpj
-
104Projects/argus/makefile
-
57lib/components/base/basicFunctionality.cpp
-
2lib/components/base/basicFunctionality.h
-
2lib/data/curl/curlRequestsManager.cpp
-
97lib/data/media/video/videoAVLIBSource.cpp
-
1lib/data/ponvif/ponvif.cpp
-
75lib/data/protocol/protocolAT.cpp
-
24lib/data/protocol/protocolAT.h
-
2lib/data/protocol/protocolLGS_data.h
-
62lib/hardware/sensors/lrf/lrf_3d.cpp
-
13lib/rgoose/rgooseCamera.cpp
-
261lib/rgoose/rgooseDBConnector.cpp
-
14lib/rgoose/rgooseDBConnector.h
-
455lib/rgoose/rgooseHardwareManager.cpp
-
36lib/rgoose/rgooseHardwareManager.h
-
61lib/rgoose/rgooseHardwareResourceSerialProvider.cpp
-
2lib/rgoose/rgooseKernel.cpp
-
3lib/rgoose/rgooseModule.h
-
9lib/rgoose/rgooseModuleFactory.cpp
-
170lib/rgoose/rgooseModuleModemManager.cpp
-
22lib/rgoose/rgooseModuleModemManager.h
-
18lib/rgoose/rgooseModuleOnvifObserver.cpp
-
10lib/rgoose/rgooseNode.cpp
-
11lib/rgoose/rgooseNode.h
-
304lib/rgoose/rgooseNode2D.cpp
-
6lib/rgoose/rgooseNode2D.h
-
4lib/rgoose/rgooseNode3D.cpp
-
18lib/rgoose/rgooseNodeFactory.cpp
-
2lib/rgoose/rgooseNodeStaticCamControl.cpp
-
86lib/rgoose/rgooseTypes.h
104
Projects/argus/makefile
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,75 @@ |
|||||
|
#include "protocolAT.h"
|
||||
|
|
||||
|
#define LOG( X ) m_pLog->Log( "pAT", this, X )
|
||||
|
|
||||
|
#ifdef DEBUG
|
||||
|
#define LOG_ERROR( X ) {\
|
||||
|
char _tBfrErrMSG2w34[256];\ |
||||
|
sprintf( _tBfrErrMSG2w34, "In file %s[%d] in func:%s %s",__FILE__, __LINE__, __func__, X );\ |
||||
|
m_pLog->Log( "pAT", this, _LOG_ERROR, _tBfrErrMSG2w34 );\ |
||||
|
} |
||||
|
#else
|
||||
|
#define LOG_ERROR( X ) m_pLog->Log( "pAT", this, _LOG_ERROR, X );
|
||||
|
#endif
|
||||
|
|
||||
|
protocolAT::protocolAT(){ |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
protocolAT::~protocolAT(){ |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
bool protocolAT::create(void) { |
||||
|
if ( m_oDataTransport ) { |
||||
|
if( m_oDataTransport->getConnectionStatus() == CS_CONNECTED ){ |
||||
|
// Turn Off Echo
|
||||
|
m_oDataTransport->sendData( (unsigned char*)AT_BEG "E" AT_EOL, 5 ); |
||||
|
waitResponce(); |
||||
|
m_oDataTransport->sendData( (unsigned char*)AT_BEG "I" AT_EOL, 5 ); |
||||
|
waitResponce(); |
||||
|
}; |
||||
|
}; |
||||
|
return false; |
||||
|
}; |
||||
|
|
||||
|
int protocolAT::packetChecker(U8 *Buffer, size_t BufferSize){ |
||||
|
if ( BufferSize ) { |
||||
|
if( Buffer[0] < 0x20 ) return -1; |
||||
|
if( Buffer[BufferSize-1] == 0x0A ) return 0; |
||||
|
}; |
||||
|
return 1; |
||||
|
}; |
||||
|
|
||||
|
bool protocolAT::packetHandler(protocolPackage *Package) { |
||||
|
}; |
||||
|
|
||||
|
protocolPackage *protocolAT::packetExtractor(U8 *Buffer, size_t BufferSize) { |
||||
|
protocolPackage *tVal=NULL; |
||||
|
if( BufferSize ){ |
||||
|
int idx = 0; |
||||
|
tVal = (protocolPackage *) malloc( sizeof(protocolPackage) ); |
||||
|
if ( tVal ) { |
||||
|
memset( tVal, 0, sizeof(protocolPackage)); |
||||
|
for (idx = 0; idx < BufferSize; idx++) { |
||||
|
if( Buffer[idx]==0x0D ) break; |
||||
|
}; |
||||
|
tVal->m_nCode = 200; |
||||
|
if( idx < (BufferSize-2) ){ |
||||
|
// Must be fetched OK status
|
||||
|
|
||||
|
}; |
||||
|
} else { |
||||
|
LOG_ERROR("pkg malloc!"); |
||||
|
} |
||||
|
}; |
||||
|
return tVal; |
||||
|
}; |
||||
|
|
||||
|
void protocolAT::waitResponce( uint32_t TO ){ |
||||
|
while( TO--) SLEEP(50); |
||||
|
}; |
||||
|
|
||||
|
#undef LOG
|
||||
|
#undef LOG_ERROR
|
||||
|
|
||||
@ -0,0 +1,24 @@ |
|||||
|
#ifndef __AT_COMMANDS_PROTOCOL_HEADER__ |
||||
|
#define __AT_COMMANDS_PROTOCOL_HEADER__ |
||||
|
|
||||
|
#include "protocol.h" |
||||
|
|
||||
|
#define AT_BEG "AT" |
||||
|
#define AT_EOL "\n\r" |
||||
|
|
||||
|
|
||||
|
class protocolAT: public protocolParser { |
||||
|
private: |
||||
|
basicLogCollection * m_pLog; |
||||
|
void waitResponce( uint32_t TO = 200 ); |
||||
|
protected: |
||||
|
protocolPackage * packetExtractor(U8 *Buffer, size_t BufferSize) override; |
||||
|
int packetChecker(U8 *Buffer, size_t BufferSize) override; |
||||
|
bool packetHandler(protocolPackage *Package) override; |
||||
|
public: |
||||
|
protocolAT(); |
||||
|
virtual ~protocolAT(); |
||||
|
bool create(void) override; |
||||
|
}; |
||||
|
|
||||
|
#endif |
||||
@ -0,0 +1,170 @@ |
|||||
|
#include "rgooseModuleModemManager.h"
|
||||
|
|
||||
|
#define LOG( X ) argusKernelModule::m_pLog->Log( "MOD_MODEM", this, X )
|
||||
|
#ifdef DEBUG
|
||||
|
#define LOG_ERROR( X ) {\
|
||||
|
char _tBfrErrMSG2w34[256];\ |
||||
|
sprintf( _tBfrErrMSG2w34, "In file %s[%d] in func:%s %s",__FILE__, __LINE__, __func__, X );\ |
||||
|
argusKernelModule::m_pLog->Log( "MOD_MODEM", this, _LOG_ERROR, _tBfrErrMSG2w34 );\ |
||||
|
} |
||||
|
#else
|
||||
|
#define LOG_ERROR( X ) argusKernelModule::m_pLog->Log( "MOD_MODEM", this, _LOG_ERROR, X );
|
||||
|
#endif
|
||||
|
|
||||
|
|
||||
|
argusModuleModemManager::argusModuleModemManager( uint32_t moduleID ): argusKernelModule( moduleID, ARGUS_MODULE_MODEM_MANAGER ), basicThread(){ |
||||
|
LOG("Creating!"); |
||||
|
if( checkCmdExists("mmcli") > 0 ){ |
||||
|
//Modem Manager Exists
|
||||
|
LOG("Manager OK!"); |
||||
|
}; |
||||
|
}; |
||||
|
|
||||
|
argusModuleModemManager::~argusModuleModemManager(){ |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
bool argusModuleModemManager::reloadSettings(){ |
||||
|
return true; |
||||
|
}; |
||||
|
|
||||
|
bool argusModuleModemManager::startService(){ |
||||
|
return true; |
||||
|
}; |
||||
|
|
||||
|
bool argusModuleModemManager::stopService( bool force ){ |
||||
|
return true; |
||||
|
}; |
||||
|
|
||||
|
void argusModuleModemManager::m_fThreadProc( void ){ |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
void argusModuleModemManager::dispatchEvent(EVENT_CONTAINER *Evt){ |
||||
|
}; |
||||
|
|
||||
|
bool argusModuleModemManager::validate(){ |
||||
|
return true; |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
void parseModemsInSystem(){ |
||||
|
"mmcli --list-modems"; |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
typedef enum E_CFG_TAG_ID{ |
||||
|
CFG_GENERAL = 0, |
||||
|
CFG_HARDWARE = 1, |
||||
|
CFG_SYSTEM, |
||||
|
CFG_STATUS, |
||||
|
CFG_MODES, |
||||
|
CFG_BANDS, |
||||
|
CFG_IP, |
||||
|
CFG_EPS, |
||||
|
CFG_3GPP, |
||||
|
CFG_SIM, |
||||
|
CFG_BEARER, |
||||
|
CFG_COUNT |
||||
|
}CFG_TAG_ID; |
||||
|
|
||||
|
const CSTR cfg_tags[]={ |
||||
|
"General", |
||||
|
"Hardware", |
||||
|
"System", |
||||
|
"Status", |
||||
|
"Modes", |
||||
|
"Bands", |
||||
|
"IP", |
||||
|
"3GPP EPS", |
||||
|
"3GPP", |
||||
|
"SIM", |
||||
|
"Bearer" |
||||
|
}; |
||||
|
|
||||
|
DBC_MODEM_DATA *getModemInfo( uint32_t modem_id ){ |
||||
|
char tB[1024]; |
||||
|
char expBuf[1024]; |
||||
|
FILE * fd = NULL; |
||||
|
CFG_TAG_ID cMode = CFG_GENERIC; |
||||
|
|
||||
|
DBC_MODEM_DATA *retVal = (DBC_MODEM_DATA *)malloc(sizeof(DBC_MODEM_DATA)); |
||||
|
if ( retVal != NULL ) { |
||||
|
memset( retVal, 0 , sizeof(DBC_MODEM_DATA)); |
||||
|
sprintf( tB, "mmcli --modem=%d", modem_id ); |
||||
|
fd = popen( tB, "r"); |
||||
|
if (fd!= NULL ) { |
||||
|
retVal->modem_id = modem_id; |
||||
|
while ( !feof( fd )) { |
||||
|
fgets( (CSTR)tB, 1024, fd ); |
||||
|
trim( tB ); |
||||
|
if( strstr(tB, "error:" ) != NULL){ |
||||
|
free( retVal ); |
||||
|
retVal = NULL; |
||||
|
break; |
||||
|
}; |
||||
|
for( CFG_TAG_ID ii = CFG_GENERIC; ii < CFG_COUNT; ii++ ){ |
||||
|
if( strstr( tB, cfg_tags[ii] ) != NULL ){ |
||||
|
cMode = ii; |
||||
|
break; |
||||
|
}; |
||||
|
}; |
||||
|
strncpy( expBuf, tB, 1024 ); |
||||
|
CArray *CA = explode( ':', expBuf ); |
||||
|
if( CA ){ |
||||
|
if( CA->size() ){ |
||||
|
switch( cMode ){ |
||||
|
case CFG_GENERAL:{ |
||||
|
if ( strstr( CA->at(0), "device id") != NULL ) { |
||||
|
trim(CA->at(1)); |
||||
|
strncpy( retVal->dbus_dev_id, CA->at(1), 64 ); |
||||
|
retVal->dbus_dev_id[64] = (char)0; |
||||
|
}; |
||||
|
break; |
||||
|
}; |
||||
|
case CFG_HARDWARE:{ |
||||
|
break; |
||||
|
}; |
||||
|
case CFG_SYSTEM:{ |
||||
|
break; |
||||
|
}; |
||||
|
case CFG_STATUS:{ |
||||
|
break; |
||||
|
}; |
||||
|
case CFG_MODES:{ |
||||
|
if ( strstr( tB, "current:") != NULL ) { |
||||
|
|
||||
|
}; |
||||
|
break; |
||||
|
}; |
||||
|
case CFG_IP:{ |
||||
|
break; |
||||
|
}; |
||||
|
case CFG_EPS:{ |
||||
|
break; |
||||
|
}; |
||||
|
case CFG_3GPP:{ |
||||
|
break; |
||||
|
}; |
||||
|
case CFG_SIM:{ |
||||
|
break; |
||||
|
}; |
||||
|
case CFG_BEARER:{ |
||||
|
break; |
||||
|
}; |
||||
|
}; |
||||
|
}; |
||||
|
delete( CA ); |
||||
|
}; |
||||
|
}; |
||||
|
fclose(fd); |
||||
|
}; |
||||
|
}; |
||||
|
return retVal; |
||||
|
}; |
||||
|
|
||||
|
#undef LOG
|
||||
|
#undef LOG_ERROR
|
||||
|
|
||||
|
|
||||
|
|
||||
@ -0,0 +1,22 @@ |
|||||
|
#ifndef __ARGUS_MODULE_MODEM_MANAGER_HEADER__ |
||||
|
#define __ARGUS_MODULE_MODEM_MANAGER_HEADER__ |
||||
|
|
||||
|
#include "rgooseModule.h" |
||||
|
#include "../components/base/basicThread.h" |
||||
|
|
||||
|
class argusModuleModemManager: public argusKernelModule, public basicThread { |
||||
|
protected: |
||||
|
/* From Basic Thread */ |
||||
|
virtual void m_fThreadProc( void ); |
||||
|
public: |
||||
|
explicit argusModuleModemManager( uint32_t moduleID ); |
||||
|
~argusModuleModemManager(); |
||||
|
/* From Kernel Module */ |
||||
|
virtual bool reloadSettings(); |
||||
|
virtual bool startService(); |
||||
|
virtual bool stopService( bool force = false ); |
||||
|
virtual void dispatchEvent(EVENT_CONTAINER *Evt); |
||||
|
virtual bool validate(); |
||||
|
}; |
||||
|
|
||||
|
#endif |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue