123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- #ifndef USER_CONFIG_H__
- #define USER_CONFIG_H__
- #include "define.h"
- #include "param.h"
- #include "user_fsd.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- #ifndef DEV_ADDR_SIZE
- #define DEV_ADDR_SIZE 6
- #endif
-
- typedef enum{
- NET_NULL=0,
- NET_189_TEST=1,
- NET_189_IOT=2,
- NET_189_AEP=3,
- NET_CMCC_ONENET=4,
- NET_CMCC_ANDLINK=5
- }net_type_e;
-
- typedef enum{
- NO_PCBA=0,
- REG_OK=1,
- NO_REG=2,
- UNREG=3,
- NO_TEST=4,
- NO_CHECK=5,
- LOCKED=6,
- REG_NULL=0xFF,
- }dev_reg_stat_e;
- typedef struct{
- dev_reg_stat_e reg_stat;
- uint8_t mac_lic[DEV_ADDR_SIZE];
- uint8_t pcba_setlic[DEV_ADDR_SIZE];
- uint8_t pcba_lic[DEV_ADDR_SIZE];
- uint8_t production_setlic[DEV_ADDR_SIZE];
- uint8_t production_lic[DEV_ADDR_SIZE];
- uint8_t devaddr[DEV_ADDR_SIZE];
- bool mainmacstat;
- uint8_t mainmacaddr[DEV_ADDR_SIZE];
- uint32_t heart_interval;
- uint32_t unixtime;
- net_type_e net_type;
- bool nbstat;
- uint8_t imei[8];
- uint8_t imsi[8];
- uint8_t ccid[10];
- }__attribute__((packed)) user_config_param_s;
- #define USER_CONFIG_STAT_DEFAULT_CONFIG \
- { \
- .reg_stat=NO_TEST, \
- .mac_lic={0}, \
- .pcba_setlic={0}, \
- .pcba_lic={0}, \
- .production_setlic={0}, \
- .production_lic={0}, \
- .devaddr={0}, \
- .mainmacstat=false, \
- .mainmacaddr={0}, \
- .heart_interval=WORK_INTERVAL, \
- .nbstat=false, \
- .imei={0}, \
- .imsi={0}, \
- .ccid={0}, \
- }
- typedef enum{
- USER_CONFIG_NULL,
- USER_CONFIG_READ,
- USER_CONFIG_READ_TIMEOUT,
- USER_CONFIG_READ_OK,
- USER_CONFIG_ERASE,
- USER_CONFIG_ERASE_TIMEOUT,
- USER_CONFIG_ERASE_OK,
- USER_CONFIG_WRITE,
- USER_CONFIG_WRITE_TIMEOUT,
- USER_CONFIG_WRITE_OK,
- }USER_CONFIG_WORK_STAT;
- typedef void (*user_config_write_finish_func)(bool stat);
- typedef void (*user_config_read_finish_func)(bool stat);
- typedef struct{
- USER_CONFIG_WORK_STAT work_stat;
- uint8_t timeout_count;
- user_config_write_finish_func write_finish_func;
- user_config_read_finish_func read_finish_func;
- uint8_t *user_config_data;
- int user_config_data_len;
- }user_config_work_s;
- #define USER_CONFIG_WORK_DEFAULT_CONFIG \
- { \
- .work_stat=USER_CONFIG_NULL, \
- .timeout_count=0, \
- .write_finish_func=NULL, \
- .read_finish_func=NULL, \
- .user_config_data=NULL, \
- }
- typedef enum
- {
- USER_CONFIG_QUEUE_INT=0,
- USER_CONFIG_QUEUE_TIME=1,
- }USER_CONFIG_QUEUE_TYPE;
- void Set_User_Config_Queue(USER_CONFIG_QUEUE_TYPE type);
- void User_Config_Read_Config(void);
- void User_Config_Write_Config(void);
- void Set_user_config_Queue(USER_CONFIG_QUEUE_TYPE type);
- void user_config_timers_init(void);
- void set_user_config_work_finish_func(user_config_write_finish_func func);
- void set_user_config_read_finish_func(user_config_read_finish_func func);
- void set_user_config_param_init(user_config_param_s *param);
- void set_user_config_data(uint8_t *user_config_data,int len);
- extern user_config_param_s user_config_param;
- #ifdef __cplusplus
- }
- #endif
- #endif // USER_CONFIG_H__
- /** @} */
|