ql_nvitem.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /** @file
  2. ql_nvitem.h
  3. @brief
  4. This file is used to define version information for different Quectel Project.
  5. */
  6. /*================================================================
  7. Copyright (c) 2020 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
  8. Quectel Wireless Solution Proprietary and Confidential.
  9. =================================================================*/
  10. /*=================================================================
  11. EDIT HISTORY FOR MODULE
  12. This section contains comments describing changes made to the module.
  13. Notice that changes are listed in reverse chronological order.
  14. WHEN WHO WHAT, WHERE, WHY
  15. ------------ ------- -------------------------------------------------------------------------------
  16. =================================================================*/
  17. #ifndef QL_NVITEM_H
  18. #define QL_NVITEM_H
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. /*========================================================================
  23. * include
  24. *========================================================================*/
  25. #include "ql_api_common.h"
  26. /*========================================================================
  27. * marco
  28. *========================================================================*/
  29. #define QUEC_ARRARY_SIZE(array) (sizeof(array)/sizeof(array[0]))
  30. #define QUEC_QFG_ITEM_DEF(key,values) {key, &values, sizeof(values)}
  31. /*========================================================================
  32. * enum
  33. *========================================================================*/
  34. /*========================================================================
  35. * struct
  36. *========================================================================*/
  37. typedef struct
  38. {
  39. char *key; //node key
  40. void *value; //node value
  41. uint16_t array_size; //value byte count
  42. }ql_cfg_item_data_t;
  43. typedef struct
  44. {
  45. char *file_path; //cfg json file path,if store nv data to flash,this field is invalid
  46. char *cfg_root_name; //root node name in json
  47. char *item_name; //cfg item node name
  48. uint16_t item_count; //item_data table count
  49. ql_cfg_item_data_t *item_data; //cfg item table
  50. }ql_cfg_json_data_t;
  51. /*========================================================================
  52. * function Definition
  53. *========================================================================*/
  54. //for quec nv data read/write interface
  55. int quec_json_nv_cfg_read(char *name, ql_cfg_item_data_t *item_data, uint16_t item_count);
  56. int quec_json_nv_cfg_write(char *name, ql_cfg_item_data_t *item_data, uint16_t item_count);
  57. int quec_json_nv_cfg_delete(char *name, ql_cfg_item_data_t *item_data, uint16_t item_count);
  58. #ifdef __cplusplus
  59. } /*"C" */
  60. #endif
  61. #endif