at_response.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef __AT_RESPONSE_H__
  13. #define __AT_RESPONSE_H__
  14. #include <stdint.h>
  15. #include <stdbool.h>
  16. #include "at_engine.h"
  17. #include "osi_compiler.h"
  18. //OSI_EXTERN_C_BEGIN
  19. #include "quec_proj_config.h"
  20. #include "quec_proj_config_at.h"
  21. #ifndef DOXYGEN
  22. #define RETURN_CMS_ERR(engine, err) OSI_DO_WHILE0(atCmdRespCmsError(engine, err); return;)
  23. #define RETURN_CME_ERR(engine, err) OSI_DO_WHILE0(atCmdRespCmeError(engine, err); return;)
  24. #define RETURN_OK(engine) OSI_DO_WHILE0(atCmdRespOK(engine); return;)
  25. #define RETURN_OK_CME_ERR(engine, res) OSI_DO_WHILE0(int _c = (res); atCmdEngine_t *_e = (engine); if (_c == 0) atCmdRespOK(_e); else atCmdRespCmeError(_e, _c); return;)
  26. #define RETURN_FOR_ASYNC() OSI_DO_WHILE0(return;)
  27. //adjusted by kevin.wang 20220126 move it to quec_atc_common.h
  28. #ifdef CONFIG_QUEC_PROJECT_FEATURE_ATC_PARSE
  29. #include "quec_atc_common.h"
  30. #else
  31. // DCE Result code
  32. #define CMD_RC_OK 0 ///< "OK"
  33. #define CMD_RC_CONNECT 1 ///< "CONNECT"
  34. #define CMD_RC_RING 2 ///< "RING/CRING"
  35. #define CMD_RC_NOCARRIER 3 ///< "NO CARRIER"
  36. #define CMD_RC_ERROR 4 ///< "ERROR"
  37. #define CMD_RC_NOTSUPPORT 5 ///< "NOT SUPPORT"
  38. #define CMD_RC_NODIALTONE 6 ///< "NO DIALTONE"
  39. #define CMD_RC_BUSY 7 ///< "BUSY"
  40. #define CMD_RC_NOANSWER 8 ///< "NO ANSWER"
  41. #define CMD_RC_INVCMDLINE 9 ///< "INVALID COMMAND LINE"
  42. #define CMD_RC_CR 10 ///< "\r\n"
  43. #define CMD_RC_SIMDROP 11 ///< "Sim drop"
  44. #define ERR_AT_UNKNOWN ERR_AT_CME_EXE_FAIL
  45. // CME error code define start
  46. #define ERR_AT_CME_PHONE_FAILURE 0
  47. #define ERR_AT_CME_NO_CONNECT_PHONE 1
  48. #define ERR_AT_CME_PHONE_ADAPTER_LINK_RESERVED 2
  49. #define ERR_AT_CME_OPERATION_NOT_ALLOWED 3
  50. #define ERR_AT_CME_OPERATION_NOT_SUPPORTED 4
  51. #define ERR_AT_CME_PHSIM_PIN_REQUIRED 5
  52. #define ERR_AT_CME_PHFSIM_PIN_REQUIRED 6
  53. #define ERR_AT_CME_PHFSIM_PUK_REQUIRED 7
  54. #define ERR_AT_CME_SIM_NOT_INSERTED 10
  55. #define ERR_AT_CME_SIM_PIN_REQUIRED 11
  56. #define ERR_AT_CME_SIM_PUK_REQUIRED 12
  57. #define ERR_AT_CME_SIM_FAILURE 13
  58. #define ERR_AT_CME_SIM_BUSY 14
  59. #define ERR_AT_CME_SIM_WRONG 15
  60. #define ERR_AT_CME_INCORRECT_PASSWORD 16
  61. #define ERR_AT_CME_SIM_PIN2_REQUIRED 17
  62. #define ERR_AT_CME_SIM_PUK2_REQUIRED 18
  63. #define ERR_AT_CME_MEMORY_FULL 20
  64. #define ERR_AT_CME_INVALID_INDEX 21
  65. #define ERR_AT_CME_NOT_FOUND 22
  66. #define ERR_AT_CME_MEMORY_FAILURE 23
  67. #define ERR_AT_CME_TEXT_LONG 24
  68. #define ERR_AT_CME_INVALID_CHAR_INTEXT 25
  69. #define ERR_AT_CME_DAIL_STR_LONG 26
  70. #define ERR_AT_CME_INVALID_CHAR_INDIAL 27
  71. #define ERR_AT_CME_NO_NET_SERVICE 30
  72. #define ERR_AT_CME_NETWORK_TIMOUT 31
  73. #define ERR_AT_CME_NOT_ALLOW_EMERGENCY 32
  74. #define ERR_AT_CME_NET_PER_PIN_REQUIRED 40
  75. #define ERR_AT_CME_NET_PER_PUK_REQUIRED 41
  76. #define ERR_AT_CME_NET_SUB_PER_PIN_REQ 42
  77. #define ERR_AT_CME_NET_SUB_PER_PUK_REQ 43
  78. #define ERR_AT_CME_SERVICE_PROV_PER_PIN_REQ 44
  79. #define ERR_AT_CME_SERVICE_PROV_PER_PUK_REQ 45
  80. #define ERR_AT_CME_CORPORATE_PER_PIN_REQ 46
  81. #define ERR_AT_CME_CORPORATE_PER_PUK_REQ 47
  82. #define ERR_AT_CME_PHSIM_PBK_REQUIRED 48
  83. // extern errocode
  84. #define ERR_AT_CME_EXE_NOT_SURPORT 49
  85. #define ERR_AT_CME_EXE_FAIL 50
  86. #define ERR_AT_CME_NO_MEMORY 51
  87. #define ERR_AT_CME_OPTION_NOT_SURPORT 52
  88. #define ERR_AT_CME_PARAM_INVALID 53
  89. #define ERR_AT_CME_EXT_REG_NOT_EXIT 54
  90. #define ERR_AT_CME_EXT_SMS_NOT_EXIT 55
  91. #define ERR_AT_CME_EXT_PBK_NOT_EXIT 56
  92. #define ERR_AT_CME_EXT_FFS_NOT_EXIT 57
  93. #define ERR_AT_CME_INVALID_COMMAND_LINE 58
  94. #define ERR_AT_CME_ITF_DIFFERENT 59
  95. #define ERR_AT_CME_BURN_FLASH_FAIL 60
  96. #define ERR_AT_CME_TFLASH_NOT_EXIST 61
  97. #define ERR_AT_CME_FILE_NOT_EXIST 62
  98. #define ERR_AT_CME_FILE_TOO_LARGE 63
  99. #define ERR_AT_CME_INVALID_DATE_OR_TIME 96
  100. #define ERR_AT_CME_DIR_CREATE_FAIL 97
  101. #define ERR_AT_CME_DIR_NOT_EXIST 98
  102. #define ERR_AT_CME_NOT_IMPLEMENTED 99
  103. //
  104. // GPRS-related errors.
  105. // Errors related to a failure to perform an Attach.(Values in parentheses are GSM 04.08 cause codes.)
  106. //
  107. #define ERR_AT_CME_GPRS_ILLEGAL_MS_3 103 // Illegal MS (#3)
  108. #define ERR_AT_CME_GPRS_ILLEGAL_MS_6 106 // Illegal ME (#6)
  109. #define ERR_AT_CME_GPRS_SVR_NOT_ALLOWED 107 // GPRS services not allowed (#7)
  110. #define ERR_AT_CME_GPRS_PLMN_NOT_ALLOWED 111 // PLMN not allowed (#11)
  111. #define ERR_AT_CME_GPRS_LOCATION_AREA_NOT_ALLOWED 112 // Location area not allowed (#12)
  112. #define ERR_AT_CME_GPRS_ROAMING_NOT_ALLOWED 113 // Roaming not allowed in this location area (#13)
  113. //
  114. // Errors related to a failure to Activate a Context
  115. //
  116. #define ERR_AT_CME_GPRS_OPTION_NOT_SUPPORTED 132 // service option not supported (#32)
  117. #define ERR_AT_CME_GPRS_OPTION_NOT_SUBSCRIBED 133 // requested service option not subscribed (#33)
  118. #define ERR_AT_CME_GPRS_OPTION_TEMP_ORDER_OUT 134 // service option temporarily out of order (#34)
  119. #define ERR_AT_CME_GPRS_PDP_AUTHENTICATION_FAILURE 149 // PDP authentication failure
  120. //
  121. // Other GPRS errors
  122. // Other values in the range 101 - 150 are reserved for use by GPRS
  123. //
  124. #define ERR_AT_CME_GPRS_INVALID_MOBILE_CLASS 150 // invalid mobile class
  125. #define ERR_AT_CME_GPRS_UNSPECIFIED_GPRS_ERROR 148 // unspecified GPRS error
  126. #define ERR_AT_CME_GPRS_UNSUPPORTED_QCI_VALUE 181
  127. //
  128. // GPRS-related errors end.
  129. //
  130. // AT_20071024_CAOW_B
  131. // updated error code
  132. #define ERR_AT_CME_SIM_VERIFY_FAIL 264
  133. #define ERR_AT_CME_SIM_UNBLOCK_FAIL 265
  134. #define ERR_AT_CME_SIM_CONDITION_NO_FULLFILLED 266
  135. #define ERR_AT_CME_SIM_UNBLOCK_FAIL_NO_LEFT 267
  136. #define ERR_AT_CME_SIM_VERIFY_FAIL_NO_LEFT 268
  137. #define ERR_AT_CME_SIM_INVALID_PARAMETER 269
  138. #define ERR_AT_CME_SIM_UNKNOW_COMMAND 270
  139. #define ERR_AT_CME_SIM_WRONG_CLASS 271
  140. #define ERR_AT_CME_SIM_TECHNICAL_PROBLEM 272
  141. #define ERR_AT_CME_SIM_CHV_NEED_UNBLOCK 273
  142. #define ERR_AT_CME_SIM_NOEF_SELECTED 274
  143. #define ERR_AT_CME_SIM_FILE_UNMATCH_COMMAND 275
  144. #define ERR_AT_CME_SIM_CONTRADICTION_CHV 276
  145. #define ERR_AT_CME_SIM_CONTRADICTION_INVALIDATION 277
  146. #define ERR_AT_CME_SIM_MAXVALUE_REACHED 278
  147. #define ERR_AT_CME_SIM_PATTERN_NOT_FOUND 279
  148. #define ERR_AT_CME_SIM_FILEID_NOT_FOUND 280
  149. #define ERR_AT_CME_SIM_STK_BUSY 281
  150. #define ERR_AT_CME_SIM_UNKNOW 282
  151. #define ERR_AT_CME_SIM_PROFILE_ERROR 283
  152. //add for HTTP AT COMMAND
  153. #define ERR_AT_CME_HTTP_NETIF_NULL 300
  154. #define ERR_AT_CME_HTTP_ACTION_NEED 301
  155. #define ERR_AT_CME_HTTP_INIT_NEED 302
  156. #define ERR_AT_CME_HTTP_PARA_CID_INVALID 303
  157. #define ERR_AT_CME_SNTP_SYNCING 320
  158. //add for MYNET AT COMMAND
  159. #define ERR_AT_CME_NETWORK_REFUSED 900
  160. #define ERR_AT_CME_PDP_DEACTIVED 901
  161. #define ERR_AT_CME_PDP_ACTIVED 902
  162. #define ERR_AT_CME_TCPIP_PEER_REFUSED 910
  163. #define ERR_AT_CME_TCPIP_CONNECT_TIMEOUT 911 //IP OR PORT IS NOT CORRECT
  164. #define ERR_AT_CME_TCPIP_ALREADY_CONNECTED 912
  165. #define ERR_AT_CME_TCPIP_NOT_CONNECTED 913
  166. #define ERR_AT_CME_BUFFER_FULL 914
  167. #define ERR_AT_CME_SEND_TIMEOUT 915
  168. #define ERR_AT_CME_DNS_FAILED 916
  169. #define ERR_AT_CME_DNS_TIMEOUT 917
  170. #define ERR_AT_CME_DNS_UNKNOW_ERROR 918
  171. #define ERR_AT_CME_PARAM_ERROR 980
  172. #define ERR_AT_CME_UNKNOWN_ERROR 981
  173. // AT_20071024_CAOW_E
  174. // CME define end
  175. // CMS error code define start
  176. #define ERR_AT_CMS_UNASSIGNED_NUM 1
  177. #define ERR_AT_CMS_OPER_DETERM_BARR 8
  178. #define ERR_AT_CMS_CALL_BARRED 10
  179. #define ERR_AT_CMS_SM_TRANS_REJE 21
  180. #define ERR_AT_CMS_DEST_OOS 27
  181. #define ERR_AT_CMS_UNINDENT_SUB 28
  182. #define ERR_AT_CMS_FACILIT_REJE 29
  183. #define ERR_AT_CMS_UNKONWN_SUB 30
  184. #define ERR_AT_CMS_NW_OOO 38
  185. #define ERR_AT_CMS_TMEP_FAIL 41
  186. #define ERR_AT_CMS_CONGESTION 42
  187. #define ERR_AT_CMS_RES_UNAVAILABLE 47
  188. #define ERR_AT_CMS_REQ_FAC_NOT_SUB 50
  189. #define ERR_AT_CMS_RFQ_FAC_NOT_IMP 69
  190. #define ERR_AT_CMS_INVALID_SM_TRV 81
  191. #define ERR_AT_CMS_INVALID_MSG 95
  192. #define ERR_AT_CMS_INVALID_MAND_INFO 96
  193. #define ERR_AT_CMS_MSG_TYPE_ERROR 97
  194. #define ERR_AT_CMS_MSG_NOT_COMP 98
  195. #define ERR_AT_CMS_INFO_ELEMENT_ERROR 99
  196. #define ERR_AT_CMS_PROT_ERROR 111
  197. #define ERR_AT_CMS_IW_UNSPEC 127
  198. #define ERR_AT_CMS_TEL_IW_NOT_SUPP 128
  199. #define ERR_AT_CMS_SMS_TYPE0_NOT_SUPP 129
  200. #define ERR_AT_CMS_CANNOT_REP_SMS 130
  201. #define ERR_AT_CMS_UNSPEC_TP_ERROR 143
  202. #define ERR_AT_CMS_DCS_NOT_SUPP 144
  203. #define ERR_AT_CMS_MSG_CLASS_NOT_SUPP 145
  204. #define ERR_AT_CMS_UNSPEC_TD_ERROR 159
  205. #define ERR_AT_CMS_CMD_CANNOT_ACT 160
  206. #define ERR_AT_CMS_CMD_UNSUPP 161
  207. #define ERR_AT_CMS_UNSPEC_TC_ERROR 175
  208. #define ERR_AT_CMS_TPDU_NOT_SUPP 176
  209. #define ERR_AT_CMS_SC_BUSY 192
  210. #define ERR_AT_CMS_NO_SC_SUB 193
  211. #define ERR_AT_CMS_SC_SYS_FAIL 194
  212. #define ERR_AT_CMS_INVALID_SME_ADDR 195
  213. #define ERR_AT_CMS_DEST_SME_BARR 196
  214. #define ERR_AT_CMS_SM_RD_SM 197
  215. #define ERR_AT_CMS_TP_VPF_NOT_SUPP 198
  216. #define ERR_AT_CMS_TP_VP_NOT_SUPP 199
  217. #define ERR_AT_CMS_D0_SIM_SMS_STO_FULL 208
  218. #define ERR_AT_CMS_NO_SMS_STO_IN_SIM 209
  219. #define ERR_AT_CMS_ERR_IN_MS 210
  220. #define ERR_AT_CMS_MEM_CAP_EXCCEEDED 211
  221. #define ERR_AT_CMS_SIM_APP_TK_BUSY 212
  222. #define ERR_AT_CMS_SIM_DATA_DL_ERROR 213
  223. #define ERR_AT_CMS_UNSPEC_ERRO_CAUSE 255
  224. #define ERR_AT_CMS_ME_FAIL 300
  225. #define ERR_AT_CMS_SMS_SERVIEC_RESERVED 301
  226. #define ERR_AT_CMS_OPER_NOT_ALLOWED 302
  227. #define ERR_AT_CMS_OPER_NOT_SUPP 303
  228. #define ERR_AT_CMS_INVALID_PDU_PARAM 304
  229. #define ERR_AT_CMS_INVALID_TXT_PARAM 305
  230. #define ERR_AT_CMS_SIM_NOT_INSERT 310
  231. #define ERR_AT_CMS_SIM_PIN_REQUIRED 311
  232. #define ERR_AT_CMS_PH_SIM_PIN_REQUIRED 312
  233. #define ERR_AT_CMS_SIM_FAIL 313
  234. #define ERR_AT_CMS_SIM_BUSY 314
  235. #define ERR_AT_CMS_SIM_WRONG 315
  236. #define ERR_AT_CMS_SIM_PUK_REQUIRED 316
  237. #define ERR_AT_CMS_SIM_PIN2_REQUIRED 317
  238. #define ERR_AT_CMS_SIM_PUK2_REQUIRED 318
  239. #define ERR_AT_CMS_MEM_FAIL 320
  240. #define ERR_AT_CMS_INVALID_MEM_INDEX 321
  241. #define ERR_AT_CMS_MEM_FULL 322
  242. #define ERR_AT_CMS_SCA_ADDR_UNKNOWN 330
  243. #define ERR_AT_CMS_NO_NW_SERVICE 331
  244. #define ERR_AT_CMS_NW_TIMEOUT 332
  245. #define ERR_AT_CMS_NO_CNMA_ACK_EXPECTED 340
  246. #define ERR_AT_CMS_UNKNOWN_ERROR 500
  247. #define ERR_AT_CMS_USER_ABORT 512
  248. #define ERR_AT_CMS_UNABLE_TO_STORE 513
  249. #define ERR_AT_CMS_INVALID_STATUS 514
  250. #define ERR_AT_CMS_INVALID_ADDR_CHAR 515
  251. #define ERR_AT_CMS_INVALID_LEN 516
  252. #define ERR_AT_CMS_INVALID_PDU_CHAR 517
  253. #define ERR_AT_CMS_INVALID_PARA 518
  254. #define ERR_AT_CMS_INVALID_LEN_OR_CHAR 519
  255. #define ERR_AT_CMS_INVALID_TXT_CHAR 520
  256. #define ERR_AT_CMS_TIMER_EXPIRED 521
  257. #define ERR_AT_CMS_SMS_SEND_FAIL 530
  258. #endif
  259. #endif /* CONFIG_QUEC_PROJECT_FEATURE_ATC_PARSE */
  260. /**
  261. * response info text
  262. *
  263. * Event info text is empty, it will be regarded as one line of info text.
  264. * And then \c \\r\\n will be output still.
  265. *
  266. * @param engine AT command engine, can't be NULL
  267. * @param text info text, can't be NULL
  268. */
  269. void atCmdRespInfoText(atCmdEngine_t *engine, const char *text);
  270. /**
  271. * response info text with length
  272. *
  273. * @param engine AT command engine, can't be NULL
  274. * @param text info text, can't be NULL if length is not zero
  275. * @param length info text length
  276. */
  277. void atCmdRespInfoNText(atCmdEngine_t *engine, const char *text, size_t length);
  278. /**
  279. * response OK
  280. *
  281. * This is final result. When it is called, AT engine will finish current
  282. * command. So, don't access current command pointer after this is called.
  283. *
  284. * @param engine AT command engine, can't be NULL
  285. */
  286. void atCmdRespOK(atCmdEngine_t *engine);
  287. /**
  288. * response ERROR (code 4)
  289. *
  290. * This is final result. When it is called, AT engine will finish current
  291. * command. So, don't access current command pointer after this is called.
  292. *
  293. * @param engine AT command engine, can't be NULL
  294. */
  295. void atCmdRespError(atCmdEngine_t *engine);
  296. /**
  297. * response error with specified code
  298. *
  299. * This is final result. When it is called, AT engine will finish current
  300. * command. So, don't access current command pointer after this is called.
  301. *
  302. * @param engine AT command engine, can't be NULL
  303. * @param code error code
  304. */
  305. void atCmdRespErrorCode(atCmdEngine_t *engine, int code);
  306. /**
  307. * response intermediate code
  308. *
  309. * @param engine AT command engine
  310. * @param code intermediate code
  311. */
  312. void atCmdRespIntermCode(atCmdEngine_t *engine, int code);
  313. /**
  314. * response finish the command without response
  315. *
  316. * @param engine AT command engine
  317. */
  318. void atCmdRespFinish(atCmdEngine_t *engine);
  319. /**
  320. * response URC code
  321. *
  322. * @param engine AT command engine, can't be NULL
  323. * @param code URC code
  324. */
  325. void atCmdRespUrcCode(atCmdEngine_t *engine, int code);
  326. /**
  327. * response CME error
  328. *
  329. * This is final result. When it is called, AT engine will finish current
  330. * command. So, don't access current command pointer after this is called.
  331. *
  332. * @param engine AT command engine, can't be NULL
  333. * @param errcode CME error code
  334. */
  335. void atCmdRespCmeError(atCmdEngine_t *engine, int errcode);
  336. /**
  337. * response CMS error
  338. *
  339. * This is final result. When it is called, AT engine will finish current
  340. * command. So, don't access current command pointer after this is called.
  341. *
  342. * @param engine AT command engine
  343. * @param errcode CMS error code
  344. */
  345. void atCmdRespCmsError(atCmdEngine_t *engine, int errcode);
  346. /**
  347. * response URC text to specified engine
  348. *
  349. * @param engine AT command engine, can't be NULL
  350. * @param text URC text, can't be NULL
  351. */
  352. void atCmdRespUrcText(atCmdEngine_t *engine, const char *text);
  353. /**
  354. * response URC text with length to specified engine
  355. *
  356. * @param engine AT command engine, can't be NULL
  357. * @param text URC text, can't be NULL if length is not zero
  358. * @param length URC text length
  359. */
  360. void atCmdRespUrcNText(atCmdEngine_t *engine, const char *text, size_t length);
  361. /**
  362. * response intermediate text
  363. *
  364. * @param engine AT command engine, can't be NULL
  365. * @param text intermediate text, can't be NULL
  366. */
  367. void atCmdRespIntermText(atCmdEngine_t *engine, const char *text);
  368. /**
  369. * response URC code to default engine(s)
  370. *
  371. * This is called to report event not related to specifed channel.
  372. * And it will be output to all channels in command state.
  373. *
  374. * @param code URC code
  375. */
  376. void atCmdRespDefUrcCode(int code);
  377. /**
  378. * response URC text to default engine(s)
  379. *
  380. * This is called to report event not related to specifed channel.
  381. * And it will be output to all channels in command state.
  382. *
  383. * @param text URC text, can't be NULL
  384. */
  385. void atCmdRespDefUrcText(const char *text);
  386. /**
  387. * response URC text with length to default engine(s)
  388. *
  389. * This is called to report event not related to specifed channel.
  390. * And it will be output to all channels in command state.
  391. *
  392. * @param text URC text, can't be NULL if length is not zero
  393. * @param length URC text length
  394. */
  395. void atCmdRespDefUrcNText(const char *text, size_t length);
  396. /**
  397. * response SIM related URC code
  398. *
  399. * This is called to report event not related to specifed channel,
  400. * but related to SIM. And it will be output to all channels in
  401. * command state, and bind to the SIM.
  402. *
  403. * @param sim SIM number
  404. * @param code URC code
  405. */
  406. #ifdef CONFIG_QUEC_PROJECT_FEATURE_ATC_PARSE
  407. void quec_urc_at_code_send(uint8_t sim, int code);
  408. #else
  409. void atCmdRespSimUrcCode(uint8_t sim, int code);
  410. #endif
  411. /**
  412. * response SIM related URC text
  413. *
  414. * This is called to report event not related to specifed channel,
  415. * but related to SIM. And it will be output to all channels in
  416. * command state, and bind to the SIM.
  417. *
  418. * @param sim SIM number
  419. * @param text URC text, can't be NULL
  420. */
  421. void atCmdRespSimUrcText(uint8_t sim, const char *text);
  422. /**
  423. * response SIM related URC text with length
  424. *
  425. * This is called to report event not related to specifed channel,
  426. * but related to SIM. And it will be output to all channels in
  427. * command state, and bind to the SIM.
  428. *
  429. * @param sim SIM number
  430. * @param text URC text, can't be NULL if length is not zero
  431. * @param length URC text length
  432. * @return
  433. * - if the text send to channels
  434. */
  435. bool atCmdRespSimUrcNText(uint8_t sim, const char *text, size_t length);
  436. /**
  437. * response info text, start of line
  438. *
  439. * When it is hard to combine all data of one info text line, the
  440. * following sequence can be used:
  441. * - \p atCmdRespInfoTextBegin
  442. * - \p atCmdRespOutputText, multiple calls are allowed
  443. * - \p atCmdRespInfoTextEnd
  444. *
  445. * @param engine AT command engine, can't be NULL
  446. * @param text output text, can't be NULL
  447. */
  448. void atCmdRespInfoTextBegin(atCmdEngine_t *engine, const char *text);
  449. /**
  450. * response info text with length, start of line
  451. *
  452. * @param engine AT command engine, can't be NULL
  453. * @param text output text, can't be NULL if length is non zero
  454. * @param length output text length
  455. */
  456. void atCmdRespInfoNTextBegin(atCmdEngine_t *engine, const char *text, size_t length);
  457. /**
  458. * response info text, end of line
  459. *
  460. * When it is hard to combine all data of one info text line, the
  461. * following sequence can be used:
  462. * - \p atCmdRespInfoTextBegin
  463. * - \p atCmdRespOutputText, multiple calls are allowed
  464. * - \p atCmdRespInfoTextEnd
  465. *
  466. * @param engine AT command engine, can't be NULL
  467. * @param text output text, can't be NULL
  468. */
  469. void atCmdRespInfoTextEnd(atCmdEngine_t *engine, const char *text);
  470. /**
  471. * response info text with length, end of line
  472. *
  473. * @param engine AT command engine, can't be NULL
  474. * @param text output text, can't be NULL if length is non zero
  475. * @param length output text length
  476. */
  477. void atCmdRespInfoNTextEnd(atCmdEngine_t *engine, const char *text, size_t length);
  478. /**
  479. * output text
  480. *
  481. * When it is hard to combine all data of one info text line, the
  482. * following sequence can be used:
  483. * - \p atCmdRespInfoTextBegin
  484. * - \p atCmdRespOutputText, multiple calls are allowed
  485. * - \p atCmdRespInfoTextEnd
  486. *
  487. * Though it is possible to output arbitrary text with this function, and
  488. * AT engine won't prepend or append \c \\r\\n, it is not recommended.
  489. * V.250 has detailed requirement for all kinds of response.
  490. *
  491. * @param engine AT command engine, can't be NULL
  492. * @param text output text, can't be NULL
  493. */
  494. void atCmdRespOutputText(atCmdEngine_t *engine, const char *text);
  495. /**
  496. * output text with length
  497. *
  498. * @param engine AT command engine, can't be NULL
  499. * @param text output text, can't be NULL if length is non zero
  500. * @param length output text length
  501. */
  502. void atCmdRespOutputNText(atCmdEngine_t *engine, const char *text, size_t length);
  503. /**
  504. * output prompt
  505. *
  506. * The prompt is <tt>\\r\\n> </tt>.
  507. *
  508. * @param engine AT command engine, can't be NULL
  509. */
  510. void atCmdRespOutputPrompt(atCmdEngine_t *engine);
  511. /**
  512. * response OK with non-standard text
  513. *
  514. * This is final result. When it is called, AT engine will finish current
  515. * command. So, don't access current command pointer after this is called.
  516. *
  517. * @param engine AT command engine, can't be NULL
  518. * @param text non-standard OK text, can't be NULL
  519. */
  520. void atCmdRespOKText(atCmdEngine_t *engine, const char *text);
  521. /**
  522. * response ERROR with non-standard text
  523. *
  524. * This is final result. When it is called, AT engine will finish current
  525. * command. So, don't access current command pointer after this is called.
  526. *
  527. * @param engine AT command engine, can't be NULL
  528. * @param text non-standard OK text, can't be NULL
  529. */
  530. void atCmdRespErrorText(atCmdEngine_t *engine, const char *text);
  531. /**
  532. * ring indicate
  533. *
  534. * It shall be called when there is an incoming call. The detailed output
  535. * is affected by various AT settings.
  536. *
  537. * Due to incoming call is bind to one SIM, the output will be send to all
  538. * channels in command state, and bind with the SIM.
  539. *
  540. * @param sim SIM number
  541. */
  542. void atCmdRingInd(uint8_t sim);
  543. /**
  544. * convert CFW error code to CME error code
  545. *
  546. * @param result CFW error code
  547. * @return
  548. * - CME error code
  549. */
  550. uint32_t atCfwToCmeError(uint32_t result);
  551. /**
  552. * convert CFW error code to CMS error code
  553. *
  554. * @param result CFW error code
  555. * @return
  556. * - CMS error code
  557. */
  558. uint32_t atCfwToCmsError(uint32_t result);
  559. /**
  560. * After release call, it need to save the release code for AT+CEER
  561. * @param code Release code text information
  562. */
  563. const char *_getCCresultCodeText(int code);
  564. //OSI_EXTERN_C_END
  565. #endif