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.
64 lines
1.7 KiB
64 lines
1.7 KiB
#include "rgooseIPCamera.h"
|
|
|
|
#define LOG( X ) m_pLog->Log( "ARGUS_CAM", this, X )
|
|
#define LOG_ERROR( X ) m_pLog->Log( "ARGUS_CAM", this, _LOG_ERROR, X )
|
|
|
|
ARGUS_Camera::ARGUS_Camera():basicEventHandler(),basicThread(){
|
|
m_pLog = basicLogCollection::getInstance();
|
|
m_pOnVif = NULL;
|
|
m_pPos = NULL;
|
|
m_bOnline = false;
|
|
};
|
|
|
|
ARGUS_Camera::~ARGUS_Camera(){
|
|
waitThreadEnd( true );
|
|
if(m_pOnVif != NULL) delete(m_pOnVif);
|
|
if(m_pPos != NULL ) delete(m_pPos);
|
|
};
|
|
|
|
bool ARGUS_Camera::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 );
|
|
m_bOnline = basicThread::init();
|
|
return m_bOnline;
|
|
};
|
|
};
|
|
return false;
|
|
};
|
|
|
|
void ARGUS_Camera::m_fThreadProc( void ){
|
|
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_Camera::dispatchEvent( basicEvent *Evt ){
|
|
if( m_bOnline ) {
|
|
LOG("EVENT!");
|
|
};
|
|
};
|
|
|
|
#undef LOG
|
|
#undef LOG_ERROR
|