Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4cf8a230 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

leaudio: Reserve GATT handles for GMSC and GTBS

With this patch, GMCS and GTBS will always have same handles. This is to
make sure, that peer does not have to rediscover Android database
because of those services

Bug: 150670922
Tag: #feature
Sponsor: jpawlowski@
Test: Compile
Change-Id: I4b9daee91f45ffb95752f117f7af138fda488696
parent 60bb45bc
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -178,6 +178,10 @@ tGATT_STATUS GATTS_AddService(tGATT_IF gatt_if, btgatt_db_element_t* service,
    s_hdl = gatt_cb.hdl_cfg.gatt_start_hdl;
  } else if (svc_uuid == Uuid::From16Bit(UUID_SERVCLASS_GAP_SERVER)) {
    s_hdl = gatt_cb.hdl_cfg.gap_start_hdl;
  } else if (svc_uuid == Uuid::From16Bit(UUID_SERVCLASS_GMCS_SERVER)) {
    s_hdl = gatt_cb.hdl_cfg.gmcs_start_hdl;
  } else if (svc_uuid == Uuid::From16Bit(UUID_SERVCLASS_GTBS_SERVER)) {
    s_hdl = gatt_cb.hdl_cfg.gtbs_start_hdl;
  } else {
    if (!gatt_cb.hdl_list_info->empty()) {
      s_hdl = gatt_cb.hdl_list_info->front().asgn_range.e_handle + 1;
+5 −1
Original line number Diff line number Diff line
@@ -260,7 +260,9 @@ inline std::string gatt_channel_state_text(const tGATT_CH_STATE& state) {

#define GATT_GATT_START_HANDLE 1
#define GATT_GAP_START_HANDLE 20
#define GATT_APP_START_HANDLE 40
#define GATT_GMCS_START_HANDLE 40
#define GATT_GTBS_START_HANDLE 90
#define GATT_APP_START_HANDLE 130

#ifndef GATT_DEFAULT_START_HANDLE
#define GATT_DEFAULT_START_HANDLE GATT_GATT_START_HANDLE
@@ -273,6 +275,8 @@ inline std::string gatt_channel_state_text(const tGATT_CH_STATE& state) {
typedef struct hdl_cfg {
  uint16_t gatt_start_hdl;
  uint16_t gap_start_hdl;
  uint16_t gmcs_start_hdl;
  uint16_t gtbs_start_hdl;
  uint16_t app_start_hdl;
} tGATT_HDL_CFG;

+2 −0
Original line number Diff line number Diff line
@@ -123,6 +123,8 @@ void gatt_init(void) {

  gatt_cb.hdl_cfg.gatt_start_hdl = GATT_GATT_START_HANDLE;
  gatt_cb.hdl_cfg.gap_start_hdl = GATT_GAP_START_HANDLE;
  gatt_cb.hdl_cfg.gmcs_start_hdl = GATT_GMCS_START_HANDLE;
  gatt_cb.hdl_cfg.gtbs_start_hdl = GATT_GTBS_START_HANDLE;
  gatt_cb.hdl_cfg.app_start_hdl = GATT_APP_START_HANDLE;

  gatt_cb.hdl_list_info = new std::list<tGATT_HDL_LIST_ELEM>();
+3 −0
Original line number Diff line number Diff line
@@ -197,6 +197,9 @@
#define UUID_SERVCLASS_LE_HID 0x1812     /*  HID over LE */
#define UUID_SERVCLASS_SCAN_PARAM 0x1813 /* Scan Parameter service */

#define UUID_SERVCLASS_GMCS_SERVER 0x1849 /* Generic Media Control Service */
#define UUID_SERVCLASS_GTBS_SERVER 0x184c /* Generic Telephony Bearer Service*/

#define UUID_CODEC_CVSD 0x0001 /* CVSD */
#define UUID_CODEC_MSBC 0x0002 /* mSBC */