You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

66 lines
1.7 KiB

#include "rgooseIPCamera.h"
#define LOG( X ) m_pLog->Log( "ARGUS_IPCAM", this, X )
#define LOG_ERROR( X ) m_pLog->Log( "ARGUS_IPCAM", this, _LOG_ERROR, X )
ARGUS_IPCAM::ARGUS_IPCAM( uint32_t id ): ARGUS_Camera( id ), basicThread(){
m_pLog = basicLogCollection::getInstance();
m_pOnVif = NULL;
m_pPosition = NULL;
m_bOnline = false;
};
ARGUS_IPCAM::~ARGUS_IPCAM(){
waitThreadEnd( true );
if(m_pOnVif != NULL) delete(m_pOnVif);
};
bool ARGUS_IPCAM::create( CSTR ip, CSTR username, CSTR password ){
m_pOnVif = new pOnvif();
if(m_pOnVif != NULL) {
m_pOnVif->setIPAddress( ip );
m_pOnVif->setUsername( username );
m_pOnVif->setPassword( password );
if( m_pOnVif->create() ){
videoSourceProfile *tPtr;
tPtr = m_pOnVif->getProfiles()->at(0);
sprintf( m_pProfileToken, "%s", tPtr->profiletoken );
LOG( m_pProfileToken );
sprintf( m_pDevToken, "%s", tPtr->sourcetoken );
LOG( m_pDevToken );
return basicThread::init();
};
};
return false;
};
void ARGUS_IPCAM::m_fThreadProc( void ){
pid_t pid = gettid();
char pidBuf[16];
sprintf(pidBuf,"pid:%d", pid);
LOG(pidBuf);
m_bThreadStatus = TH_WORKING;
float Direction = 1.f;
while( m_bThreadStatus < TH_ENDED ){
m_tTimeTSeconds = time( NULL );
if( ( m_tTimeTSeconds % 30 ) == 0 ) {
m_pOnVif->ptz_AbsoluteMove( m_pProfileToken, 0, -1, 0 );
SLEEP(1000);
}
if( ( ( m_tTimeTSeconds - 15 ) % 30 ) == 0 ) {
m_pOnVif->ptz_AbsoluteMove( m_pProfileToken, Direction, -1, 0 );
Direction *= -1.f;
SLEEP(1000);
}
SLEEP( 100 );
};
};
void ARGUS_IPCAM::dispatchEvent( basicEvent *Evt ){
if( m_bOnline ) {
LOG("EVENT!");
};
};
#undef LOG
#undef LOG_ERROR