quec_virt_func_modem.c 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. /** @file
  2. quec_virt_func_modem.c
  3. @brief
  4. This file is used to run virt function.
  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. #include "quec_atresp.h"
  18. #include "ql_uart_internal.h"
  19. #include "quec_cust_feature.h"
  20. #include "quec_common.h"
  21. #include "quec_at_param.h"
  22. #include "at_param.h"
  23. #include "ql_api_osi.h"
  24. #include "quec_at_engine.h"
  25. #include "quec_log.h"
  26. //#include "quec_rtos.h"
  27. #include "ql_api_osi.h"
  28. #include "ql_api_usbnet.h"
  29. #include "ql_api_stk.h"
  30. #include "ql_api_vsim_adapt.h"
  31. #include "at_command.h"
  32. #include "ql_api_wifi.h"
  33. #define QUEC_VIRT_MODEM_FUNC_LOG(msg, ...) custom_log("VIRT_MFUNC", msg, ##__VA_ARGS__)
  34. //usbnet
  35. #ifndef CONFIG_QUEC_PROJECT_FEATURE_USBNET
  36. __attribute__((weak)) bool quec_usbnet_sendevent(uint32_t nMsg, uint32_t nParam1, uint8_t nParam2, uint8_t nParam3, uint16_t nParam4)
  37. {
  38. return false;
  39. }
  40. __attribute__((weak)) ql_task_t *quec_get_usbnet_threadID(void)
  41. {
  42. return NULL;
  43. }
  44. __attribute__((weak)) ql_usbnet_errcode_e ql_usbnet_get_type(ql_usbnet_type_e *usbnet_type)
  45. {
  46. return QL_USBNET_EXECUTE_ERR;
  47. }
  48. __attribute__((weak)) ql_usbnet_errcode_e ql_usbnet_set_type(ql_usbnet_type_e usbnet_type)
  49. {
  50. return QL_USBNET_EXECUTE_ERR;
  51. }
  52. __attribute__((weak)) void quec_exec_qnetdevctl_cmd(ql_at_cmd_t *cmd)
  53. {
  54. return;
  55. }
  56. #endif/*CONFIG_QUEC_PROJECT_FEATURE_USBNET*/
  57. #ifndef CONFIG_DUAL_SIM_SUPPORT
  58. __attribute__((weak)) void quec_exec_qdsim_cmd(ql_at_cmd_t *cmd)
  59. {
  60. quec_atResp(cmd->engine, ATCI_RESULT_CODE_CME_ERROR, CMD_RC_NOTSUPPORT, NULL, 1);
  61. return;
  62. }
  63. #endif
  64. //pbk
  65. #ifndef CONFIG_QUEC_PROJECT_FEATURE_PBK
  66. __attribute__((weak)) int quec_pbk_process_output_name(uint8_t *dest, uint8_t destlen, uint8_t cscs_charset, uint8_t *source, uint8_t sourcelen)
  67. {
  68. return 0;
  69. }
  70. __attribute__((weak)) void quec_pbk_init(uint8_t nSim)
  71. {
  72. return;
  73. };
  74. __attribute__((weak)) int quec_pbk_add_lastdialling_phone(uint8_t nSim, const char *phone_num, uint16_t len)
  75. {
  76. return 0;
  77. };
  78. #endif/*CONFIG_QUEC_PROJECT_FEATURE_PBK*/
  79. //stk
  80. #ifndef CONFIG_QUEC_PROJECT_FEATURE_STK
  81. __attribute__((weak)) void quec_stk_sim_lost(uint8_t nSim)
  82. {
  83. return;
  84. }
  85. __attribute__((weak)) void quec_stk_replace_profile(void)
  86. {
  87. return;
  88. }
  89. __attribute__((weak)) bool quec_stk_is_cmd_in_register_table(uint8_t cmd)
  90. {
  91. return false;
  92. }
  93. __attribute__((weak)) void quec_stk_no_proactive(uint8_t nSim)
  94. {
  95. return;
  96. }
  97. __attribute__((weak)) bool quec_stk_sat_plugin_take_over(const osiEvent_t *event)
  98. {
  99. return false;
  100. }
  101. #endif/*CONFIG_QUEC_PROJECT_FEATURE_STK*/
  102. #ifndef CONFIG_QUEC_PROJECT_FEATURE_STK_AT
  103. __attribute__((weak)) void quec_exec_qstk_cmd(atCommand_t *cmd)
  104. {
  105. quec_atResp(cmd->engine, ATCI_RESULT_CODE_CME_ERROR, ERR_AT_CME_INVALID_COMMAND_LINE, NULL, 1);
  106. return;
  107. }
  108. __attribute__((weak)) void quec_exec_qstkpd_cmd(atCommand_t *cmd)
  109. {
  110. quec_atResp(cmd->engine, ATCI_RESULT_CODE_CME_ERROR, ERR_AT_CME_INVALID_COMMAND_LINE, NULL, 1);
  111. return;
  112. }
  113. __attribute__((weak)) void quec_exec_qstkstate_cmd(atCommand_t *cmd)
  114. {
  115. quec_atResp(cmd->engine, ATCI_RESULT_CODE_CME_ERROR, ERR_AT_CME_INVALID_COMMAND_LINE, NULL, 1);
  116. return;
  117. }
  118. __attribute__((weak)) void quec_exec_qstkgi_cmd(atCommand_t *cmd)
  119. {
  120. quec_atResp(cmd->engine, ATCI_RESULT_CODE_CME_ERROR, ERR_AT_CME_INVALID_COMMAND_LINE, NULL, 1);
  121. return;
  122. }
  123. __attribute__((weak)) void quec_exec_qstkrsp_cmd(atCommand_t *cmd)
  124. {
  125. quec_atResp(cmd->engine, ATCI_RESULT_CODE_CME_ERROR, ERR_AT_CME_INVALID_COMMAND_LINE, NULL, 1);
  126. return;
  127. }
  128. #endif /* CONFIG_QUEC_PROJECT_FEATURE_STK_AT */
  129. #ifndef CONFIG_QUEC_PROJECT_FEATURE_BIP
  130. __attribute__((weak)) ql_stk_errcode_e ql_stk_get_bip_config(ql_stk_bip_config_s *config)
  131. {
  132. if (NULL == config)
  133. {
  134. return QL_STK_INVALID_PARAM_ERR;
  135. }
  136. config->mode = QL_STK_BIP_CONFIG_MODE_DISABLE;
  137. config->cid = 1;
  138. config->status_report = false;
  139. return QL_STK_SUCCESS;
  140. }
  141. #endif /*CONFIG_QUEC_PROJECT_FEATURE_BIP*/
  142. //vsim_adapt
  143. #ifndef CONFIG_QUEC_PROJECT_FEATURE_VSIM_ADAPT
  144. bool set_vsim_in_poweron;
  145. ql_vsim_adapt_callback ql_vsim_adapt_cb = NULL;
  146. #endif
  147. //volte
  148. #ifndef CONFIG_QUEC_PROJECT_FEATURE_VOLTE
  149. __attribute__((weak)) void quec_volte_init(void)
  150. {
  151. return;
  152. };
  153. __attribute__((weak)) int ql_volte_user_agent_init(void)
  154. {
  155. return 0;
  156. };
  157. __attribute__((weak)) int ql_volte_usage_set(uint8_t nSim, uint8_t setting)
  158. {
  159. return 0;
  160. };
  161. __attribute__((weak)) int ql_volte_vdp_set(uint8_t nSim, uint8_t setting)
  162. {
  163. return 0;
  164. };
  165. __attribute__((weak)) bool quec_ImsIsSet(uint8_t nSim)
  166. {
  167. return false;
  168. };
  169. #endif/*CONFIG_QUEC_PROJECT_FEATURE_VOLTE*/
  170. //audio voice
  171. #ifndef CONFIG_AUDIO_VOICE_ENABLE
  172. __attribute__((weak)) int vsi_amrnb_enc_state_mem_require()
  173. {
  174. return 0;
  175. }
  176. __attribute__((weak)) int vsi_amrnb_enc_init(void *vsi_amrnb_enc_state, int dtx)
  177. {
  178. return 0;
  179. }
  180. __attribute__((weak)) int vsi_amrnb_enc_process(void *vsi_amrnb_enc_state,short *input_pcm, unsigned char *output, unsigned int type, unsigned int format)
  181. {
  182. return 0;
  183. }
  184. __attribute__((weak)) int vsi_amrnb_enc_close(void *vsi_amrnb_enc_state)
  185. {
  186. return 0;
  187. }
  188. __attribute__((weak)) int vsi_amrnb_dec_process(void *vsi_amrnb_dec_state,unsigned char *input, short *output_pcm,unsigned int type, unsigned int format)
  189. {
  190. return 0;
  191. }
  192. __attribute__((weak)) int vsi_amrnb_dec_init(void *vsi_amrnb_dec_state)
  193. {
  194. return 0;
  195. }
  196. __attribute__((weak)) int vsi_amrnb_dec_state_mem_require()
  197. {
  198. return 0;
  199. }
  200. __attribute__((weak)) int vsi_amrnb_dec_close(void *vsi_amrnb_dec_state)
  201. {
  202. return 0;
  203. }
  204. __attribute__((weak)) int vsi_amrwb_enc_init(void *vsi_amrwb_enc_state, int dtx)
  205. {
  206. return 0;
  207. }
  208. __attribute__((weak)) int vsi_amrwb_enc_process(void *vsi_amrwb_enc_state,unsigned char *input_pcm, unsigned char *output,unsigned int mode,unsigned int format)
  209. {
  210. return 0;
  211. }
  212. __attribute__((weak)) int vsi_amrwb_enc_state_mem_require()
  213. {
  214. return 0;
  215. }
  216. __attribute__((weak)) int vsi_amrwb_enc_close(void *vsi_amrwb_enc_state)
  217. {
  218. return 0;
  219. }
  220. __attribute__((weak)) int vsi_amrwb_dec_init(void *vsi_amrwb_dec_state)
  221. {
  222. return 0;
  223. }
  224. __attribute__((weak)) int vsi_amrwb_dec_state_mem_require()
  225. {
  226. return 0;
  227. }
  228. __attribute__((weak)) int vsi_amrwb_dec_process(void *vsi_amrwb_dec_state,unsigned char *input, short *output_pcm,unsigned int format)
  229. {
  230. return 0;
  231. }
  232. __attribute__((weak)) int vsi_amrwb_dec_close(void *vsi_amrwb_dec_state)
  233. {
  234. return 0;
  235. }
  236. #endif
  237. //sms
  238. #ifndef CONFIG_QUEC_PROJECT_FEATURE_SMS
  239. __attribute__((weak)) int quec_sms_init_me_size(void)
  240. {
  241. return 0;
  242. }
  243. __attribute__((weak)) int ql_sms_get_me_erase_flag(bool *meEraseFlag)
  244. {
  245. return 0;
  246. }
  247. bool quec_trust_num_check(uint8_t nSim, const char *phone_num, bool is_call)
  248. {
  249. return true;
  250. }
  251. #endif
  252. //wifi
  253. #ifndef CONFIG_QUEC_PROJECT_FEATURE_WIFI
  254. __attribute__((weak)) ql_wifi_errcode_e ql_wifi_opt_get(ql_wifi_opt_e opt, void *val, int *val_len)
  255. {
  256. if(opt >= QL_WIFI_OPT_MAX|| !val || !val_len)
  257. {
  258. return QL_WIFI_EXECUTE_ERR;
  259. }
  260. memset(val,0,*val_len);
  261. return QL_WIFI_SUCCESS;
  262. }
  263. #endif