quec_virt_func_bt.c 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /** @file
  2. quec_virt_func_common.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. 02/08/2021 ryan.yi Init version
  17. =================================================================*/
  18. #include "quec_cust_feature.h"
  19. #include "quec_common.h"
  20. #include "quec_log.h"
  21. #include "at_command.h"
  22. #ifndef CONFIG_BLUEU_BT_ENABLE
  23. #define QUEC_VIRT_BTFUNC_LOG(msg, ...) custom_log("VIRT_BTFUNC", msg, ##__VA_ARGS__)
  24. typedef enum
  25. {
  26. BT_TESTMODE_NONE = 0, // Leave Test mode
  27. BT_TESTMODE_SIG = 1, // Enter EUT signal mode
  28. BT_TESTMODE_NONSIG = 2 // Enter Nonsignal mode
  29. } BT_TEST_MODE_T;
  30. typedef struct {
  31. int index;
  32. const char *name;
  33. int (*handler)(char *argv[], int argc, char *rsp, int *rsp_len);
  34. char * help;
  35. } bt_eut_cmd_t;
  36. bt_eut_cmd_t bt_npi_cmds[15];
  37. bt_eut_cmd_t ble_npi_cmds[15];
  38. bt_eut_cmd_t bt_comm_cmds[11];
  39. bt_eut_cmd_t bt_hfp_hf_cmds[1];
  40. bt_eut_cmd_t bt_hfp_ag_cmds[1];
  41. bt_eut_cmd_t bt_a2dp_sink_cmds[1];
  42. bt_eut_cmd_t bt_a2dp_src_cmds[1];
  43. bt_eut_cmd_t bt_spp_cmds[1];
  44. bt_eut_cmd_t ble_comm_cmds[13];
  45. bt_eut_cmd_t ble_adv_cmds[1];
  46. bt_eut_cmd_t ble_smp_cmds[1];
  47. bt_eut_cmd_t ble_scan_cmds[1];
  48. typedef struct {
  49. int (*app_bt_normal_start) (void); //bt normal open
  50. int (*app_bt_normal_stop) (void); //bt normal close
  51. void (*app_bt_start_cp_unsleep) (void); //bt open with CP unsleep, used for NPI/BQB test
  52. void (*app_bt_stop_cp_en_sleep) (void); //bt close and enable cp sleep, used for NPI/BQB test
  53. void (*at_print_data)(char* buff, int len); //it used by AT handle, and async print data to terminal.
  54. }at_platform_cb_t;
  55. __attribute__((weak)) void at_set_platform_callback(at_platform_cb_t *at_cb)
  56. {
  57. return ;
  58. }
  59. __attribute__((weak)) at_platform_cb_t* at_get_platform_callback(void)
  60. {
  61. return NULL;
  62. }
  63. __attribute__((weak)) BT_TEST_MODE_T bt_test_mode_get(void)
  64. {
  65. return BT_TESTMODE_NONE;
  66. }
  67. __attribute__((weak)) void SET_RE_FLAG(int flag)
  68. {
  69. return ;
  70. }
  71. __attribute__((weak)) uint16_t UartDrv_Tx(const uint8_t *buffer, uint16_t length)
  72. {
  73. return 0;
  74. }
  75. __attribute__((weak)) void app_npi_bt_start(void)
  76. {
  77. return ;
  78. }
  79. __attribute__((weak)) void UART_SetControllerBqbMode(BOOLEAN is_ctrlr_bqb_mode)
  80. {
  81. return ;
  82. }
  83. __attribute__((weak)) void app_npi_bt_stop(void)
  84. {
  85. return;
  86. }
  87. void (*BT_UART_FUCTION)(char *, unsigned int);
  88. typedef void (*BT_CALLBACK_STACK)(unsigned int msg_id, char status, void *data_ptr);
  89. bt_eut_cmd_t bt_app_cmds[4];
  90. __attribute__((weak)) void bt_register_at_callback_func(BT_CALLBACK_STACK callback)
  91. {
  92. return ;
  93. }
  94. __attribute__((weak)) int bbat_bt_test(unsigned char bt_cmd, char *rsp)
  95. {
  96. return 0;
  97. }
  98. //根据代码逻辑,需要返回true
  99. __attribute__((weak)) bool bt_chip_poweroff(void)
  100. {
  101. return true;
  102. }
  103. //根据代码逻辑,需要返回最大值
  104. __attribute__((weak)) uint32_t btDeepSleepTime(void)
  105. {
  106. return 0xFFFFFFFF;
  107. }
  108. __attribute__((weak)) void quec_exec_bt_ble_name_cmd(atCommand_t *cmd)
  109. {
  110. quec_atResp(cmd->engine, ATCI_RESULT_CODE_CME_ERROR, CMD_RC_NOTSUPPORT, NULL, 1);
  111. return ;
  112. }
  113. __attribute__((weak)) void quec_exec_bt_ver_cmd(atCommand_t *cmd)
  114. {
  115. quec_atResp(cmd->engine, ATCI_RESULT_CODE_CME_ERROR, CMD_RC_NOTSUPPORT, NULL, 1);
  116. return ;
  117. }
  118. __attribute__((weak)) void quec_exec_bt_bt_passthrough_cmd(atCommand_t *cmd)
  119. {
  120. quec_atResp(cmd->engine, ATCI_RESULT_CODE_CME_ERROR, CMD_RC_NOTSUPPORT, NULL, 1);
  121. return ;
  122. }
  123. __attribute__((weak)) void quec_exec_bt_ibeacon_cfg_cmd(atCommand_t *cmd)
  124. {
  125. quec_atResp(cmd->engine, ATCI_RESULT_CODE_CME_ERROR, CMD_RC_NOTSUPPORT, NULL, 1);
  126. return ;
  127. }
  128. __attribute__((weak)) void quec_exec_bt_backup_ver_cmd(atCommand_t *cmd)
  129. {
  130. quec_atResp(cmd->engine, ATCI_RESULT_CODE_CME_ERROR, CMD_RC_NOTSUPPORT, NULL, 1);
  131. return ;
  132. }
  133. #endif