bt_manager_config.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. * Copyright (c) 2019 Actions Semi Co., Inc.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /**
  7. * @file
  8. * @brief bt manager config.
  9. */
  10. #define SYS_LOG_DOMAIN "bt manager"
  11. #define SYS_LOG_LEVEL 4 /* 4, debug */
  12. #include <os_common_api.h>
  13. #include <zephyr.h>
  14. #include <stdlib.h>
  15. #include <stdio.h>
  16. #include <string.h>
  17. #include <msg_manager.h>
  18. #include <mem_manager.h>
  19. #include <bt_manager.h>
  20. #include "bt_manager_inner.h"
  21. #include <sys_event.h>
  22. #include <btservice_api.h>
  23. static uint8_t default_pre_mac[3] = {0x50, 0xC0, 0xF0};
  24. uint8_t bt_manager_config_get_tws_limit_inquiry(void)
  25. {
  26. return 0;
  27. }
  28. uint8_t bt_manager_config_get_tws_compare_high_mac(void)
  29. {
  30. return 1;
  31. }
  32. uint8_t bt_manager_config_get_tws_compare_device_id(void)
  33. {
  34. return 0;
  35. }
  36. uint8_t bt_manager_config_get_idle_extend_windown(void)
  37. {
  38. return 1;
  39. }
  40. void bt_manager_config_set_pre_bt_mac(uint8_t *mac)
  41. {
  42. memcpy(mac, default_pre_mac, sizeof(default_pre_mac));
  43. }
  44. void bt_manager_updata_pre_bt_mac(uint8_t *mac)
  45. {
  46. memcpy(default_pre_mac, mac, sizeof(default_pre_mac));
  47. }
  48. bool bt_manager_config_enable_tws_sync_event(void)
  49. {
  50. return false;
  51. }
  52. uint8_t bt_manager_config_connect_phone_num(void)
  53. {
  54. #ifdef CONFIG_BT_DOUBLE_PHONE
  55. #ifdef CONFIG_BT_DOUBLE_PHONE_EXT_MODE
  56. return 3;
  57. #else
  58. return 2;
  59. #endif
  60. #else
  61. return 1;
  62. #endif
  63. }
  64. bool bt_manager_config_support_a2dp_aac(void)
  65. {
  66. #ifdef CONFIG_BT_A2DP_AAC
  67. return true;
  68. #else
  69. return false;
  70. #endif
  71. }
  72. bool bt_manager_config_pts_test(void)
  73. {
  74. #ifdef CONFIG_BT_PTS_TEST
  75. return true;
  76. #else
  77. return false;
  78. #endif
  79. }
  80. uint16_t bt_manager_config_volume_sync_delay_ms(void)
  81. {
  82. return 3000;
  83. }
  84. uint32_t bt_manager_config_bt_class(void)
  85. {
  86. /* reference assigned-numbers Baseband of https://www.bluetooth.com/specifications/assigned-numbers/*/
  87. //return 0x240448; /* Rendering,Audio, Audio/Video, Gaming/Toy Device */
  88. return 0x240704; /* Rendering,Audio, Audio/Video, Wearable Headset Device */
  89. }
  90. uint16_t *bt_manager_config_get_device_id(void)
  91. {
  92. static const uint16_t device_id[4] = {0x03E0, 0xFFFF, 0x0001, 0x0001};
  93. return (uint16_t *)device_id;
  94. }
  95. int bt_manager_config_expect_tws_connect_role(void)
  96. {
  97. /* If use expect tws role, Recommend user todo:
  98. * use diff device ID to dicide tws master/slave role,
  99. * and in bt_manager_tws_discover_check_device function check
  100. * disvoer tws device is expect tws role.
  101. */
  102. //return BTSRV_TWS_MASTER; /* Expect as tws master */
  103. //return BTSRV_TWS_SLAVE; /* Expect as tws slave */
  104. return BTSRV_TWS_NONE; /* Decide tws role by bt service */
  105. }