quec_atcmd_general.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. /** @file
  2. quec_atcmd_def.h
  3. @brief
  4. This file is used to define at command 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 QUEC_ATCMD_GENERAL_H
  18. #define QUEC_ATCMD_GENERAL_H
  19. #include "ql_uart_internal.h"
  20. #include "quec_proj_config.h"
  21. #ifdef CONFIG_QUEC_PROJECT_FEATURE_BT
  22. #include "ql_api_bt_common.h"
  23. #endif
  24. #include "quec_at_engine.h"
  25. /*========================================================================
  26. * Macro Definition
  27. *========================================================================*/
  28. #define QUEC_BT_BLE_DEFALT_NAME "quec_bt_def"
  29. #define QUEC_INIT_DONE 0xFFFF
  30. /* 3gpp Release veriosn */
  31. #define RELEASE_VER_10 (10)
  32. #define RELEASE_VER_13 (13)
  33. #define EMOD_NV_RELEASE_VER_DATATYPE (0)
  34. #define EMOD_NV_RELEASE_VER_OFFSET (524)
  35. /*default IMEI*/
  36. #define IMEI0_DEF "864430010001091"
  37. #define IMEI1_DEF "352751019523267"
  38. /*========================================================================
  39. * Enumeration Definition
  40. *========================================================================*/
  41. typedef enum egmr_type_e
  42. {
  43. DSAT_EGMR_BASEBAND_CHIPSET = 0,
  44. DSAT_EGMR_DSP_CODE = 1,
  45. DSAT_EGMR_DSP_PATCH = 2,
  46. DSAT_EGMR_MCU_SW = 3,
  47. DSAT_EGMR_MD_BOARD = 4,
  48. DSAT_EGMR_SN = 5,
  49. DSAT_EGMR_IMEI = 7,
  50. DSAT_EGMR_MEID_GSN = 8,
  51. DSAT_EGMR_IMEISV_SVN = 9,
  52. DSAT_EGMR_IMEI2 = 10,
  53. DSAT_EGMR_XTAL = 15,
  54. DSAT_EGMR_MAX
  55. }dsat_egmr_type_e;
  56. typedef enum
  57. {
  58. QUECTEL_URC_ALL_IND = 0, //use to contol all urc report set true as default
  59. QUECTEL_URC_CSQ_IND, // use to contol CSQ urc report
  60. QUECTEL_URC_ACTCHGRPT_IND, //use to contol network mode change urc report
  61. QUECTEL_URC_SMSFULL_IND, //use to control smsfull urc report
  62. QUECTEL_URC_SMSINCOMING_IND,//use to control sms incoming urc report
  63. QUECTEL_URC_RING_IND,
  64. QUECTEL_URC_PSM_IND, //use to psm sleep/wakeup urc report
  65. QUECTEL_URC_MAX_IND,
  66. }quectel_urc_ind_cfg_e_type;
  67. typedef enum {
  68. AT_AND_C = 0,
  69. AT_AND_D,
  70. AT_AND_F,
  71. AT_AND_W,
  72. AT_E,
  73. AT_Q,
  74. AT_V,
  75. AT_X,
  76. AT_Z,
  77. AT_S_0,
  78. AT_S_3,
  79. AT_S_4,
  80. AT_S_5,
  81. #ifdef CONFIG_QUEC_PROJECT_FEATURE_CALL_AT
  82. AT_S_7,
  83. #endif
  84. AT_CONFIG_MAX_NUM,
  85. }quec_at_config_type_e;
  86. typedef enum
  87. {
  88. QUEC_INIT_PROTOCOL_STACK,
  89. QUEC_INIT_BT,
  90. QUEC_INIT_AUDIO,
  91. QUEC_INIT_WIFI,
  92. QUEC_INIT_SLEEP,
  93. QUEC_INIT_MAX = 16,
  94. //0xFFFF indicates that all function modules have been initialized
  95. }quec_init_bitmap_e;
  96. /*========================================================================
  97. * Type Definition
  98. *========================================================================*/
  99. typedef void (*QCFG_ProcessFunc)(ql_at_cmd_t *);
  100. typedef struct
  101. {
  102. char *pCmdName;
  103. QCFG_ProcessFunc pCmdHandler;
  104. char *test_info;//set test info as "", it will ouput at the cmd handler; set it as null, it will be ignored.
  105. } QCFG_SCmdListStruct;
  106. typedef QCFG_SCmdListStruct quec_cfg_cmdlist_s;
  107. typedef struct
  108. {
  109. uint8_t sim_stat_urc;
  110. uint8_t slot_stat_urc;
  111. } quec_at_setting_s;
  112. #ifdef CONFIG_QUEC_PROJECT_FEATURE_UART
  113. typedef struct
  114. {
  115. uint32_t baudrate;
  116. uint32_t icf_format;
  117. uint32_t icf_parity;
  118. uint32_t ifc_rx;
  119. uint32_t ifc_tx;
  120. } quec_uart_setting_s;
  121. typedef struct
  122. {
  123. uint32_t rxmode;
  124. } quec_uart_custom_nv_s;
  125. #endif
  126. #ifdef __QUEC_OEM_VER_HW__
  127. typedef struct
  128. {
  129. uint32_t quec_dorind_enable; //使能hw定制功能,输出相应电平
  130. int quec_lvl_lock; //配合hw定制功能,上休眠锁,防止瞬间又进入休眠
  131. uint32_t quec_wakeuptime_flag; //hw定制功能,定时器唤醒标志位
  132. uint32_t quec_wakeuptime_value; //hw定制功能,定时器设定时间,单位s
  133. ql_timer_t quec_wakeuptime_timer; //hw定制功能,唤醒定时器
  134. }custom_hw;
  135. #endif
  136. #ifdef __QUEC_OEM_VER_QDMHYT__
  137. typedef struct
  138. {
  139. bool mask;
  140. bool gpio_lvl_low;
  141. uint8_t pin;
  142. uint8_t gpio;
  143. ql_timer_t quec_pwm_virt_timer;
  144. uint32_t high_level_time;
  145. uint32_t low_level_time;
  146. } quec_hytgpio_setting_s;
  147. #endif
  148. typedef struct {
  149. quec_at_config_type_e config_type;
  150. char *config_name;
  151. }quec_at_config_context_s;
  152. typedef enum
  153. {
  154. QUEC_BT_BLE_NO_TRANSTER = 0, //bt/ble no need transfer
  155. QUEC_BT_BLE_NEDD_TRANSTER, //bt/ble need transfer
  156. } quec_bt_ble_name_transfer_type_e;
  157. typedef enum
  158. {
  159. QUEC_CODE_CP936_UTF8 = 0, //from cp936(gbk) to utf8
  160. QUEC_CODE_UTF8_CP936, //from utf8 to cp936(gbk)
  161. }quec_code_transfer_e;
  162. /*========================================================================
  163. * Variable Definition
  164. *========================================================================*/
  165. extern quec_at_setting_s quec_at_current_setting;
  166. /*========================================================================
  167. * function Definition
  168. *========================================================================*/
  169. void quec_cfg_common_handler(ql_at_cmd_t *cmd, quec_cfg_cmdlist_s *cmdlist);
  170. void quec_at_setting_reset_default(void);
  171. void quec_at_setting_read(void);
  172. bool quec_wdt_cfg_read(void);
  173. bool quec_wdt_cfg_save(uint8_t wdt_cfg);
  174. bool quec_at_setting_save(void);
  175. bool quec_uart_setting_save(void);
  176. void quec_creg_emergency_read(void);
  177. void quec_creg_mode_read(void);
  178. uint8_t quectel_read_urc_ind_flag(quectel_urc_ind_cfg_e_type flag);
  179. bool quec_get_3gpp_release_version(uint8_t *version, uint8_t nSim);
  180. bool quec_set_3gpp_release_version(uint8_t version, uint8_t nSim);
  181. void quectel_exec_qcfg_urc_ri_cmd(ql_at_cmd_t *cmd);
  182. void quectel_exec_qcfg_urc_delay_cmd(ql_at_cmd_t *cmd);
  183. void quectel_exec_qcfg_urc_interval_cmd(ql_at_cmd_t *cmd);
  184. void quectel_exec_qcfg_urc_cache_cmd(ql_at_cmd_t *cmd);
  185. void quectel_exec_qcfg_urc_signaltype_cmd(ql_at_cmd_t *cmd);
  186. void quectel_exec_qcfg_fota_cid_cmd(ql_at_cmd_t *cmd);
  187. void quectel_exec_qcfg_fota_http_timeout_cmd(ql_at_cmd_t *cmd);
  188. void quectel_exec_qcfg_pdp_kalive_ip_cmd(ql_at_cmd_t *cmd);
  189. void quec_at_ecc_read();
  190. bool quec_convert_string_to_hex(unsigned char *str_ptr, unsigned short length, unsigned char *hex);
  191. bool quec_convert_hex_to_str(unsigned char *input, unsigned short input_len,unsigned char *output);
  192. #ifdef CONFIG_QUEC_PROJECT_FEATURE_BT
  193. bool quec_bt_ble_set_localname(ql_bt_ble_local_name_s local_name);
  194. bool quec_bt_ble_get_localname(ql_bt_ble_local_name_s *local_name, quec_bt_ble_name_transfer_type_e type);
  195. bool quec_ble_write_ibeacon_cfg(ql_ble_ibeacon_cfg_s cfg);
  196. bool quec_ble_read_ibeacon_cfg(ql_ble_ibeacon_cfg_s *cfg);
  197. bool quec_code_transfer(char *from, int from_size, char *to, int *to_size, quec_code_transfer_e type);
  198. #endif
  199. void quec_init_set_status_bit(quec_init_bitmap_e bit);
  200. bool quec_init_get_status_bit(quec_init_bitmap_e bit);
  201. #endif /* QUEC_ATCMD_GENERAL_H */