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.

94 lines
2.1 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
5 months ago
​
​
5 months ago
​
​
5 months ago
​
​
5 months ago
​
​
5 months ago
​
5 months ago
​
5 months ago
​
​
​
​
  1. #ifndef __DFSL_HARDWARE_RESOURCE_HEADER__
  2. #define __DFSL_HARDWARE_RESOURCE_HEADER__
  3. #include "../components/base/basicLogCollection.h"
  4. #include "../components/base/basicObject.h"
  5. #include "dataBinder.h"
  6. #include <arpa/inet.h>
  7. #include <linux/types.h>
  8. #include <vector>
  9. #define DBC_RESOURCE_DESC_SIZE 64
  10. typedef struct S_PARSE_RESULT_NET_INTERFACES
  11. {
  12. bool enabled;
  13. bool if_static;
  14. bool hot_plug;
  15. char address[INET6_ADDRSTRLEN];
  16. char netmask[INET6_ADDRSTRLEN];
  17. char gateway[INET6_ADDRSTRLEN];
  18. } PARSE_RESULT_NET_INTERFACES;
  19. typedef struct S_PARSE_RESULT_WIFI_SETTINGS
  20. {
  21. char SSID[64];
  22. char password[64];
  23. WIFI_ENCRIPTION encryption;
  24. bool access_point;
  25. uint8_t channel;
  26. char country_code[3];
  27. bool hiden_ssid;
  28. /* Router Settings */
  29. bool router_enabled;
  30. char router_outbond[INET6_ADDRSTRLEN];
  31. /* DHCP */
  32. bool dhcp_enabled;
  33. char range_start[INET6_ADDRSTRLEN];
  34. char range_stop[INET6_ADDRSTRLEN];
  35. char netmask[INET6_ADDRSTRLEN];
  36. char lease_period[INET6_ADDRSTRLEN];
  37. } PARSE_RESULT_WIFI_SETTINGS;
  38. class hardwareResource : public basicObject
  39. {
  40. protected:
  41. HARDWARE_PROVIDERS m_eProviderType;
  42. DBC_RESOURCE_DATA m_sResourceSettings;
  43. dataBinder * m_pDBC;
  44. basicLogCollection * m_pLog;
  45. bool m_bValid;
  46. bool m_bActive;
  47. public:
  48. hardwareResource();
  49. hardwareResource(uint32_t id, HARDWARE_PROVIDERS type = HARDWARE_PROVIDER_UNKNOWN);
  50. virtual ~hardwareResource();
  51. virtual bool create(void){
  52. return false;
  53. }
  54. virtual bool create(uint32_t id, HARDWARE_PROVIDERS type);
  55. virtual bool validate(void){
  56. return m_bValid;
  57. }
  58. bool isValid(void){
  59. return m_bValid;
  60. }
  61. uint32_t getDbId(void){
  62. return m_sResourceSettings.aux_id;
  63. }
  64. RESOURCE_TYPE getHardwareType(void){
  65. return (RESOURCE_TYPE) m_sResourceSettings.type;
  66. }
  67. HARDWARE_PROVIDERS getProviderType(void){
  68. return m_eProviderType;
  69. }
  70. virtual bool activate( void ){
  71. if (!m_bActive) m_bActive = true;
  72. return m_bActive;
  73. }
  74. };
  75. typedef std::vector<hardwareResource *> VECTOR_HW_RESOURCES;
  76. #endif