miscellaneous_interface.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef __MISCELLANEOUS_INTERFACE_H__
  2. #define __MISCELLANEOUS_INTERFACE_H__
  3. #include <stdbool.h>
  4. #include "esp_err.h"
  5. // 网关存储命名空间
  6. #define YX_NVS_NAME_SPACE "YX_NVS_SPACE"
  7. // 默认空调码库KEY
  8. #define AC_DEFAULT "ac-code"
  9. // 空调码库存储命名空间
  10. #define IR_STORAGE_NAME_SPACE = "ir_data"
  11. #define SDK_VERSION_NAME "version"
  12. #define AC_CODE_NAMESPACE "ac_code"
  13. uint64_t get_sys_time_ms();
  14. // 是否接入网络
  15. bool net_connect_check();
  16. // 获取设备唯一标识-mac
  17. void get_device_serial(char *serial_buf);
  18. // 根据 Key获取本地数据
  19. char *yx_data_get(char *key);
  20. /**
  21. * 清除键值
  22. * @param key
  23. */
  24. void yx_data_clear(char * key);
  25. // 写入数据
  26. void yx_data_set(char *key, char *value);
  27. esp_err_t nvs_set_int8(int8_t code, const char *key);
  28. int8_t *nvs_get_int8(const char *key);
  29. esp_err_t nvs_set_uint8(uint8_t code, const char *key);
  30. uint8_t *nvs_get_uint8(const char *key);
  31. esp_err_t nvs_set_uint16(uint16_t code, const char *key);
  32. esp_err_t nvs_set_uint32(uint32_t code, const char *key);
  33. uint16_t *nvs_get_uint16(const char *key);
  34. uint32_t *nvs_get_uint32(const char *key);
  35. // 网关系统信息参数
  36. typedef struct gateway_sys_info {
  37. char *ip_address; // IP 地址
  38. char mac[21]; // MAC 地址
  39. uint16_t revision; // chip revision number
  40. uint8_t cores; // 内核芯数
  41. char idf_version[32]; // idf 版本号
  42. char version[32]; // 固件版本号
  43. size_t total; // spiffs 总数
  44. size_t used; // spiffs 已使用
  45. } gateway_sys_info;
  46. // 获取网关系统信息
  47. void get_sys_info(gateway_sys_info *info);
  48. #endif