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

7 years ago
​
​
7 years ago
7 years ago
​
​
7 years ago
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
7 years ago
​
  1. #include "rgooseIPCamera.h"
  2. #define LOG( X ) m_pLog->Log( "ONVIFCAM", this, X )
  3. #define LOG_ERROR( X ) m_pLog->Log( "ONVIFCAM", this, _LOG_ERROR, X )
  4. ARGUS_IPCAM::ARGUS_IPCAM( uint32_t id ): ARGUS_Camera( id ) /*, basicThread() */{
  5. m_pLog = basicLogCollection::getInstance();
  6. m_pOnVif = NULL;
  7. //m_pPosition = NULL;
  8. //m_bOnline = false;
  9. };
  10. ARGUS_IPCAM::~ARGUS_IPCAM(){
  11. //waitThreadEnd( true );
  12. if( m_pOnVif != NULL ) delete( m_pOnVif );
  13. };
  14. bool ARGUS_IPCAM::startService(){//create( ){//CSTR ip, CSTR username, CSTR password ){
  15. if( m_pOnVif == NULL ) return false;
  16. m_pOnVif = new pOnvif();
  17. if( m_pOnVif != NULL ){
  18. m_pOnVif->setIPAddress( m_sCamData.ip );// ip );
  19. m_pOnVif->setUsername( m_sCamData.username );// username );
  20. m_pOnVif->setPassword( m_sCamData.password );// password );
  21. if( m_pOnVif->create() ){
  22. //videoSourceProfile *tPtr;
  23. m_pProfile = m_pOnVif->getProfiles()->at(0);
  24. //sprintf( m_pProfileToken, "%s", tPtr->profiletoken );
  25. //LOG( m_pProfileToken );
  26. //sprintf( m_pDevToken, "%s", tPtr->sourcetoken );
  27. //LOG( m_pDevToken );
  28. //return basicThread::init();
  29. return m_sCamData.online = true;
  30. };
  31. };
  32. return false;
  33. };
  34. bool ARGUS_IPCAM::relativeMove( float PanSPD, float TiltSPD, float ZoomSPD ){
  35. if( m_sCamData.online ) {
  36. if( m_pOnVif->ptz_ContinuousMove( m_pProfile->profiletoken, PanSPD , TiltSPD ) ){
  37. return m_pOnVif->ptz_ContinuousMoveZoom( m_pProfile->profiletoken, ZoomSPD );
  38. };
  39. };
  40. return false;
  41. };
  42. bool ARGUS_IPCAM::relativeStop(){
  43. if( m_sCamData.online ) {
  44. return m_pOnVif->ptz_Stop( m_pProfile->profiletoken, true, true );
  45. };
  46. return false;
  47. };
  48. bool ARGUS_IPCAM::absoluteMove( float PanPOS, float TiltPOS, float ZoomPOS ){
  49. if( m_sCamData.online ) {
  50. return m_pOnVif->ptz_AbsoluteMove( m_pProfile->profiletoken, PanPOS, TiltPOS, ZoomPOS );
  51. };
  52. return false;
  53. };
  54. /*
  55. void ARGUS_IPCAM::m_fThreadProc( void ){
  56. pid_t pid = gettid();
  57. char pidBuf[16];
  58. sprintf(pidBuf,"pid:%d", pid);
  59. LOG(pidBuf);
  60. m_bThreadStatus = TH_WORKING;
  61. float Direction = 1.f;
  62. while( m_bThreadStatus < TH_ENDED ){
  63. m_tTimeTSeconds = time( NULL );
  64. if( ( m_tTimeTSeconds % 30 ) == 0 ) {
  65. m_pOnVif->ptz_AbsoluteMove( m_pProfileToken, 0, -1, 0 );
  66. SLEEP(1000);
  67. }
  68. if( ( ( m_tTimeTSeconds - 15 ) % 30 ) == 0 ) {
  69. m_pOnVif->ptz_AbsoluteMove( m_pProfileToken, Direction, -1, 0 );
  70. Direction *= -1.f;
  71. SLEEP(1000);
  72. }
  73. SLEEP( 100 );
  74. };
  75. };
  76. void ARGUS_IPCAM::dispatchEvent( EVENT_CONTAINER *Evt ){
  77. if( m_bOnline ) {
  78. LOG("EVENT!");
  79. };
  80. };
  81. */
  82. #undef LOG
  83. #undef LOG_ERROR