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.

47 lines
1.6 KiB

6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #include "rgooseHardwareResource.h"
  2. #define LOG( X ) m_pLog->Log( "HWR", this, X )
  3. #ifdef DEBUG
  4. #define LOG_ERROR( X ) {\
  5. char _tBfrErrMSG2w34[256];\
  6. sprintf( _tBfrErrMSG2w34, "In file %s[%d] in func:%s %s",__FILE__, __LINE__, __func__, X );\
  7. m_pLog->Log( "HWR", this, _LOG_ERROR, _tBfrErrMSG2w34 );\
  8. }
  9. #else
  10. #define LOG_ERROR( X ) m_pLog->Log( "HWR", this, _LOG_ERROR, X );
  11. #endif
  12. argusHardwareResource::argusHardwareResource( uint32_t id, ARGUS_HARDWARE_TYPE type ): basicObject(){
  13. m_pDBC = argusDBC::getInstance();
  14. m_pLog = basicLogCollection::getInstance();
  15. if( id > 0 ){
  16. if( m_pDBC!=NULL ){
  17. DBC_SOCKET_DATA *tData = m_pDBC->getSocketData( id );
  18. if( tData != NULL ) {
  19. memcpy( &m_sSettings, tData, sizeof(DBC_SOCKET_DATA));
  20. free( tData );
  21. } else {
  22. LOG_ERROR("Cannot Fetch Hardware Data from DB!");
  23. memset( &m_sSettings, 0, sizeof( DBC_SOCKET_DATA ));
  24. m_sSettings.socket_id = id;
  25. m_sSettings.type = type;
  26. };
  27. } else {
  28. memset( &m_sSettings, 0, sizeof( DBC_SOCKET_DATA ));
  29. m_sSettings.socket_id = id;
  30. m_sSettings.type = type;
  31. };
  32. } else {
  33. memset( &m_sSettings, 0, sizeof( DBC_SOCKET_DATA ));
  34. m_sSettings.socket_id = id;
  35. m_sSettings.type = type;
  36. };
  37. };
  38. argusHardwareResource::~argusHardwareResource(){
  39. };
  40. #undef LOG
  41. #undef LOG_ERROR