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

Commit d1c2f786 authored by Stanley Tng's avatar Stanley Tng Committed by Jakub Pawlowski
Browse files

Hearing Aid: use correct Data Length and MediaType

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
parent 4b0f544c
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -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;