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.
93 lines
2.7 KiB
93 lines
2.7 KiB
#include "rgooseIPCamera.h"
|
|
|
|
#define LOG( X ) m_pLog->Log( "ONVIFCAM", this, X )
|
|
#define LOG_ERROR( X ) m_pLog->Log( "ONVIFCAM", 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::startService(){//create( ){//CSTR ip, CSTR username, CSTR password ){
|
|
if( m_pOnVif == NULL ) return false;
|
|
m_pOnVif = new pOnvif();
|
|
|
|
if( m_pOnVif != NULL ){
|
|
m_pOnVif->setIPAddress( m_sCamData.ip );// ip );
|
|
m_pOnVif->setUsername( m_sCamData.username );// username );
|
|
m_pOnVif->setPassword( m_sCamData.password );// password );
|
|
if( m_pOnVif->create() ){
|
|
//videoSourceProfile *tPtr;
|
|
m_pProfile = 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 m_sCamData.online = true;
|
|
};
|
|
};
|
|
return false;
|
|
};
|
|
|
|
bool ARGUS_IPCAM::relativeMove( float PanSPD, float TiltSPD, float ZoomSPD ){
|
|
if( m_sCamData.online ) {
|
|
if( m_pOnVif->ptz_ContinuousMove( m_pProfile->profiletoken, PanSPD , TiltSPD ) ){
|
|
return m_pOnVif->ptz_ContinuousMoveZoom( m_pProfile->profiletoken, ZoomSPD );
|
|
};
|
|
};
|
|
return false;
|
|
};
|
|
|
|
bool ARGUS_IPCAM::relativeStop(){
|
|
if( m_sCamData.online ) {
|
|
return m_pOnVif->ptz_Stop( m_pProfile->profiletoken, true, true );
|
|
};
|
|
return false;
|
|
};
|
|
|
|
bool ARGUS_IPCAM::absoluteMove( float PanPOS, float TiltPOS, float ZoomPOS ){
|
|
if( m_sCamData.online ) {
|
|
return m_pOnVif->ptz_AbsoluteMove( m_pProfile->profiletoken, PanPOS, TiltPOS, ZoomPOS );
|
|
};
|
|
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( EVENT_CONTAINER *Evt ){
|
|
if( m_bOnline ) {
|
|
LOG("EVENT!");
|
|
};
|
|
};
|
|
*/
|
|
#undef LOG
|
|
#undef LOG_ERROR
|