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.

58 lines
2.7 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
4 years ago
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
  1. #ifndef __DFSL_HARDWARE_MANAGER_HEADER__
  2. #define __DFSL_HARDWARE_MANAGER_HEADER__
  3. #include "../components/base/basicLogCollection.h"
  4. #include "../components/base/basicMutex.h"
  5. #include "hardwareResource.h"
  6. class hardwareManager{
  7. private:
  8. basicLogCollection * m_pLog;
  9. VECTOR_HW_RESOURCES m_vResources;
  10. basicMutex m_mVectorProtector;
  11. dataBinder * m_pDBC;
  12. DBC_SYS_INFO m_sSYS_INFO;
  13. uint32_t m_nServerNodeID;
  14. uint32_t m_nServerID; // Prop of DBC
  15. uint32_t m_nSiteID; // Prop of Kernel
  16. size_t m_nMemoryLimitHeapSize;
  17. //bool m_bHardwareEnumerated;
  18. void loadResources( void );
  19. void unloadResources( void );
  20. uint32_t createResourceUART( CSTR devName );
  21. uint32_t createResourceVIDEO( CSTR devName );
  22. uint32_t createResourceUDCB( CSTR devName );
  23. uint32_t createResourceNETWORK( CSTR devName );
  24. void enumerateNIFS( void );
  25. void getMAC( CSTR if_name, CSTR buf );
  26. void getGW( CSTR if_name, CSTR buf );
  27. void getTTyDesc( CSTR dev_name, CSTR buf );
  28. /* Linux System Parsers */
  29. PARSE_RESULT_NET_INTERFACES * parse_neconfig( CSTR if_name );
  30. PARSE_RESULT_WIFI_SETTINGS * parse_wifi( CSTR if_name );
  31. void clearAllResources( void );
  32. public:
  33. virtual ~hardwareManager();
  34. static hardwareManager * getInstance( bool cold_start = true );
  35. bool validate( void );
  36. hardwareResource * requestResource( HARDWARE_PROVIDERS type, uint32_t id );
  37. DBC_INT_LIST * requestResourcesByType( HARDWARE_PROVIDERS type );
  38. void enumerateHardware( void );
  39. bool assignResource( hardwareResource *ptr, bool protected_mode = true );
  40. bool resignResource( hardwareResource *ptr, bool protected_mode = true );
  41. bool updateSysInfo( DBC_SYS_LOAD_INFO *ptr );
  42. private:
  43. static hardwareManager * _instance;
  44. explicit hardwareManager( bool cold_start );
  45. };
  46. #endif