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.

89 lines
3.6 KiB

6 years ago
​
​
​
5 years ago
6 years ago
​
5 years ago
​
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
​
​
​
​
​
5 years ago
​
​
​
6 years ago
​
​
​
​
​
​
​
​
6 years ago
​
​
​
5 years ago
​
6 years ago
​
6 years ago
​
​
​
​
​
​
  1. #ifndef __ARGOOSE_HARDWARE_MANAGER_HEADER__
  2. #define __ARGOOSE_HARDWARE_MANAGER_HEADER__
  3. #include "../components/base/basicLogCollection.h"
  4. #include "../components/base/basicMutex.h"
  5. #include "rgooseHardwareResource.h"
  6. #define DBC_RESOURCE_DESC_SIZE 64
  7. class argusKernel;
  8. class argusDBC;
  9. typedef struct S_PARSE_RESULT_NET_INTERFACES{
  10. bool enabled;
  11. bool if_static;
  12. bool hot_plug;
  13. char address[INET6_ADDRSTRLEN];
  14. char netmask[INET6_ADDRSTRLEN];
  15. char gateway[INET6_ADDRSTRLEN];
  16. }PARSE_RESULT_NET_INTERFACES;
  17. typedef struct S_PARSE_RESULT_WIFI_SETTINGS{
  18. char SSID[64];
  19. char password[64];
  20. ARGUS_WIFI_ENCRIPTION encryption;
  21. bool access_point;
  22. uint8_t channel;
  23. char country_code[3];
  24. bool hiden_ssid;
  25. /* Router Settings */
  26. bool router_enabled;
  27. char router_outbond[INET6_ADDRSTRLEN];
  28. /* DHCP */
  29. bool dhcp_enabled;
  30. char range_start[INET6_ADDRSTRLEN];
  31. char range_stop[INET6_ADDRSTRLEN];
  32. char netmask[INET6_ADDRSTRLEN];
  33. char lease_period[INET6_ADDRSTRLEN];
  34. }PARSE_RESULT_WIFI_SETTINGS;
  35. class argusHardwareManager{
  36. private:
  37. argusKernel * m_pKernel;
  38. argusDBC * m_pDBC;
  39. basicLogCollection * m_pLog;
  40. VECTOR_HW_RESOURCES m_vResources;
  41. basicMutex m_mVectorProtector;
  42. uint32_t m_nServerNodeID;
  43. uint32_t m_nServerID;
  44. uint32_t m_nSiteID;
  45. size_t m_nMemoryLimitHeapSize;
  46. //bool m_bHardwareEnumerated;
  47. void loadResources( void );
  48. void unloadResources( void );
  49. uint32_t createResourceUART( CSTR devName );
  50. uint32_t createResourceVIDEO( CSTR devName );
  51. uint32_t createResourceUDCB( CSTR devName );
  52. uint32_t createResourceNETWORK( CSTR devName );
  53. void enumerateNIFS( void );
  54. void getMAC( CSTR if_name, CSTR buf );
  55. void getGW( CSTR if_name, CSTR buf );
  56. void getTTyDesc( CSTR dev_name, CSTR buf );
  57. /* Linux System Parsers */
  58. PARSE_RESULT_NET_INTERFACES * parse_neconfig( CSTR if_name );
  59. PARSE_RESULT_WIFI_SETTINGS * parse_wifi( CSTR if_name );
  60. public:
  61. virtual ~argusHardwareManager();
  62. static argusHardwareManager * getInstance( bool cold_start = true );
  63. bool validate( void );
  64. argusHardwareResource * requestResource( ARGUS_HARDWARE_PROVIDERS type, uint32_t id );
  65. DBC_INT_LIST * requestResourcesByType( ARGUS_HARDWARE_PROVIDERS type );
  66. void enumerateHardware( void );
  67. bool assignResource( argusHardwareResource *ptr );
  68. bool resignResource( argusHardwareResource *ptr );
  69. private:
  70. static argusHardwareManager * _instance;
  71. explicit argusHardwareManager( bool cold_start );
  72. };
  73. #endif