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.

143 lines
3.9 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #include "rgooseNodeFactory.h"
  2. #define LOG( X ) m_pLog->Log( "NFAC", this, X )
  3. #define LOG_ERROR( X ) m_pLog->Log( "NFAC", this, _LOG_ERROR, X )
  4. argusNodeFactory * argusNodeFactory::_instance = 0;
  5. /**
  6. * Returns the single instance of the object.
  7. */
  8. argusNodeFactory* argusNodeFactory::getInstance() {
  9. // check if the instance has been created yet
  10. if (0 == _instance) {
  11. // if not, then create it
  12. _instance = new argusNodeFactory;
  13. }
  14. // return the single instance
  15. return _instance;
  16. };
  17. argusNodeFactory::argusNodeFactory(){
  18. m_pLog = basicLogCollection::getInstance();
  19. m_pDBC = NULL;
  20. };
  21. argusNodeFactory::~argusNodeFactory(){
  22. if( m_vNetNodes.size() > 0 ){
  23. for( vectorNetNodes::iterator index = m_vNetNodes.begin(); index < m_vNetNodes.end(); index++ ){
  24. switch( (*index)->type ){
  25. //case ARGUS_ANALOG_STATIC_CAMERA: delete( (chucha*) (*index) ); break;
  26. case ARGUS_IP_STATIC_CAMERA: delete( (ARGUS_Camera*) (*index) ); break;
  27. };
  28. };
  29. m_vNetNodes.clear();
  30. };
  31. };
  32. void argusNodeFactory::setDBC(ARGUS_DBC * tPtr){
  33. if( (m_pDBC == NULL) && (tPtr != NULL) ) m_pDBC = tPtr;
  34. };
  35. bool argusNodeFactory::loadNodes( uint32_t SiteID ){
  36. if(m_pDBC == NULL) return false;
  37. m_nSiteID = SiteID;
  38. DBC_INT_LIST *tList = NULL;
  39. tList = m_pDBC->listNodes( SiteID );
  40. if( tList != NULL ) {
  41. for(int index=0; index< tList->size(); index++) {
  42. createNode( tList->at(index) );
  43. };
  44. tList->clear();
  45. delete( tList );
  46. return true;
  47. };
  48. return false;
  49. };
  50. argusNetNode *argusNodeFactory::createNode( int id ){
  51. argusNetNode *tVal = NULL;
  52. if( m_pDBC != NULL ){
  53. DBC_NODE_DATA *tData = NULL;
  54. tData = m_pDBC->getNodeData( id );
  55. if( tData!= NULL ) {
  56. switch( tData->type ) {
  57. case ARGUS_ANALOG_STATIC_CAMERA:
  58. #ifdef DEBUG
  59. LOG("Creating Analog Static Camera");
  60. #endif
  61. break;
  62. case ARGUS_ANALOG_PTZ_CAMERA:
  63. #ifdef DEBUG
  64. LOG("Creating Analog PTZ Camera");
  65. #endif
  66. break;
  67. case ARGUS_IP_STATIC_CAMERA:
  68. #ifdef DEBUG
  69. LOG("Creating Network Static Camera");
  70. #endif
  71. break;
  72. case ARGUS_IP_PTZ_CAMERA:
  73. #ifdef DEBUG
  74. LOG("Creating Network PTZ Camera");
  75. #endif
  76. break;
  77. case ARGUS_IP_UART_GATEWAY:
  78. #ifdef DEBUG
  79. LOG("Creating Ethernet to UART Gateway");
  80. #endif
  81. break;
  82. case ARGUS_IP_VIDEO_SERVER:
  83. #ifdef DEBUG
  84. LOG("Creating Network Video Encoder");
  85. #endif
  86. break;
  87. case ARGUS_LFS_SENSOR:
  88. #ifdef DEBUG
  89. LOG("Creating LFS Sensor");
  90. #endif
  91. break;
  92. case ARGUS_ALS_SENSOR:
  93. #ifdef DEBUG
  94. LOG("Creating ALS Sensor");
  95. #endif
  96. break;
  97. case ARGUS_PLS_200_SENSOR:
  98. #ifdef DEBUG
  99. LOG("Creating PLS200 Sensor");
  100. #endif
  101. break;
  102. case ARGUS_PLS_360_SENSOR:
  103. #ifdef DEBUG
  104. LOG("Creating PLS360 Sensor");
  105. #endif
  106. break;
  107. case ARGUS_3D_SENSOR:
  108. #ifdef DEBUG
  109. LOG("Creating 3D Sensor");
  110. #endif
  111. break;
  112. case ARGUS_JAMER:
  113. #ifdef DEBUG
  114. LOG("Creating RF Jamer");
  115. #endif
  116. break;
  117. case ARGUS_NET_PLS_200:
  118. #ifdef DEBUG
  119. LOG("Creating Network-PLS200 Sensor");
  120. #endif
  121. break;
  122. case ARGUS_DRONE_CONTROL:
  123. #ifdef DEBUG
  124. LOG("Creating Drone Controll");
  125. #endif
  126. break;
  127. };
  128. free(tData);
  129. };
  130. };
  131. if( tVal != NULL ) m_vNetNodes.push_back( tVal );
  132. return tVal;
  133. };
  134. #undef LOG
  135. #undef LOG_ERROR