OSDN Git Service

Hearing Aid: use correct Data Length and MediaType
authorStanley Tng <stng@google.com>
Tue, 25 Sep 2018 18:15:24 +0000 (11:15 -0700)
committerJakub Pawlowski <jpawlowski@google.com>
Tue, 2 Oct 2018 09:15:12 +0000 (09:15 +0000)
Adjusted the requested data length to the BT Controller from 168 to 167.
Also, change the default media type during playback to unknown.

Test: Manual testing with Hearing Aids and verifying with OTA logs
Change-Id: Ic4e934729a98bef5c10ebca64093d8a192e79a01

bta/hearing_aid/hearing_aid.cc

index 63d3ac8..2fd9664 100644 (file)
@@ -67,6 +67,9 @@ constexpr uint8_t CONTROL_POINT_OP_STOP = 0x02;
 constexpr int8_t VOLUME_UNKNOWN = 127;
 constexpr int8_t VOLUME_MIN = -127;
 
+// audio type
+constexpr uint8_t AUDIOTYPE_UNKNOWN = 0x00;
+
 namespace {
 
 // clang-format off
@@ -396,7 +399,7 @@ class HearingAidImpl : public HearingAid {
 
     // Set data length
     // TODO(jpawlowski: for 16khz only 87 is required, optimize
-    BTM_SetBleDataLength(address, 168);
+    BTM_SetBleDataLength(address, 167);
 
     tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(address);
     if (p_dev_rec) {
@@ -826,7 +829,7 @@ class HearingAidImpl : public HearingAid {
 
   void SendStart(const HearingDevice& device) {
     std::vector<uint8_t> start({CONTROL_POINT_OP_START, codec_in_use,
-                                0x02 /* media */, (uint8_t)current_volume});
+                                AUDIOTYPE_UNKNOWN, (uint8_t)current_volume});
 
     if (current_volume == VOLUME_UNKNOWN) start[3] = (uint8_t)VOLUME_MIN;