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
89 lines
3.6 KiB
#ifndef __ARGOOSE_HARDWARE_MANAGER_HEADER__
|
|
#define __ARGOOSE_HARDWARE_MANAGER_HEADER__
|
|
|
|
#include "../components/base/basicLogCollection.h"
|
|
#include "../components/base/basicMutex.h"
|
|
#include "rgooseHardwareResource.h"
|
|
|
|
|
|
#define DBC_RESOURCE_DESC_SIZE 64
|
|
|
|
class argusKernel;
|
|
class argusDBC;
|
|
|
|
|
|
typedef struct S_PARSE_RESULT_NET_INTERFACES{
|
|
bool enabled;
|
|
bool if_static;
|
|
bool hot_plug;
|
|
char address[INET6_ADDRSTRLEN];
|
|
char netmask[INET6_ADDRSTRLEN];
|
|
char gateway[INET6_ADDRSTRLEN];
|
|
}PARSE_RESULT_NET_INTERFACES;
|
|
|
|
typedef struct S_PARSE_RESULT_WIFI_SETTINGS{
|
|
char SSID[64];
|
|
char password[64];
|
|
ARGUS_WIFI_ENCRIPTION encryption;
|
|
bool access_point;
|
|
uint8_t channel;
|
|
char country_code[3];
|
|
bool hiden_ssid;
|
|
/* Router Settings */
|
|
bool router_enabled;
|
|
char router_outbond[INET6_ADDRSTRLEN];
|
|
/* DHCP */
|
|
bool dhcp_enabled;
|
|
char range_start[INET6_ADDRSTRLEN];
|
|
char range_stop[INET6_ADDRSTRLEN];
|
|
char netmask[INET6_ADDRSTRLEN];
|
|
char lease_period[INET6_ADDRSTRLEN];
|
|
}PARSE_RESULT_WIFI_SETTINGS;
|
|
|
|
class argusHardwareManager{
|
|
private:
|
|
argusKernel * m_pKernel;
|
|
argusDBC * m_pDBC;
|
|
basicLogCollection * m_pLog;
|
|
VECTOR_HW_RESOURCES m_vResources;
|
|
basicMutex m_mVectorProtector;
|
|
|
|
uint32_t m_nServerNodeID;
|
|
uint32_t m_nServerID;
|
|
uint32_t m_nSiteID;
|
|
size_t m_nMemoryLimitHeapSize;
|
|
|
|
//bool m_bHardwareEnumerated;
|
|
void loadResources( void );
|
|
void unloadResources( void );
|
|
|
|
uint32_t createResourceUART( CSTR devName );
|
|
uint32_t createResourceVIDEO( CSTR devName );
|
|
uint32_t createResourceUDCB( CSTR devName );
|
|
uint32_t createResourceNETWORK( CSTR devName );
|
|
void enumerateNIFS( void );
|
|
void getMAC( CSTR if_name, CSTR buf );
|
|
void getGW( CSTR if_name, CSTR buf );
|
|
void getTTyDesc( CSTR dev_name, CSTR buf );
|
|
/* Linux System Parsers */
|
|
PARSE_RESULT_NET_INTERFACES * parse_neconfig( CSTR if_name );
|
|
PARSE_RESULT_WIFI_SETTINGS * parse_wifi( CSTR if_name );
|
|
public:
|
|
virtual ~argusHardwareManager();
|
|
static argusHardwareManager * getInstance( bool cold_start = true );
|
|
bool validate( void );
|
|
argusHardwareResource * requestResource( ARGUS_HARDWARE_PROVIDERS type, uint32_t id );
|
|
DBC_INT_LIST * requestResourcesByType( ARGUS_HARDWARE_PROVIDERS type );
|
|
void enumerateHardware( void );
|
|
bool assignResource( argusHardwareResource *ptr );
|
|
bool resignResource( argusHardwareResource *ptr );
|
|
private:
|
|
static argusHardwareManager * _instance;
|
|
explicit argusHardwareManager( bool cold_start );
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|