constexpr uint16_t CONNECTION_INTERVAL_20MS_PARAM = 0x0010;
void btif_storage_add_hearing_aid(const HearingDevice& dev_info);
+bool btif_storage_get_hearing_aid_prop(
+ const RawAddress& address, uint8_t* capabilities, uint64_t* hi_sync_id,
+ uint16_t* render_delay, uint16_t* preparation_delay, uint16_t* codecs);
constexpr uint8_t CODEC_G722_16KHZ = 0x01;
constexpr uint8_t CODEC_G722_24KHZ = 0x02;
for (const gatt::Characteristic& charac : service->characteristics) {
if (charac.uuid == READ_ONLY_PROPERTIES_UUID) {
- DVLOG(2) << "Reading read only properties "
- << loghex(charac.value_handle);
- BtaGattQueue::ReadCharacteristic(
- conn_id, charac.value_handle,
- HearingAidImpl::OnReadOnlyPropertiesReadStatic, nullptr);
+ if (!btif_storage_get_hearing_aid_prop(
+ hearingDevice->address, &hearingDevice->capabilities,
+ &hearingDevice->hi_sync_id, &hearingDevice->render_delay,
+ &hearingDevice->preparation_delay, &hearingDevice->codecs)) {
+ VLOG(2) << "Reading read only properties "
+ << loghex(charac.value_handle);
+ BtaGattQueue::ReadCharacteristic(
+ conn_id, charac.value_handle,
+ HearingAidImpl::OnReadOnlyPropertiesReadStatic, nullptr);
+ }
} else if (charac.uuid == AUDIO_CONTROL_POINT_UUID) {
hearingDevice->audio_control_point_handle = charac.value_handle;
// store audio control point!
void btif_storage_set_hearing_aid_white_list(const RawAddress& address,
bool add_to_whitelist);
+/** Get the hearing aid device properties. */
+bool btif_storage_get_hearing_aid_prop(
+ const RawAddress& address, uint8_t* capabilities, uint64_t* hi_sync_id,
+ uint16_t* render_delay, uint16_t* preparation_delay, uint16_t* codecs);
+
/*******************************************************************************
*
* Function btif_storage_is_retricted_device
btif_config_save();
}
+/** Get the hearing aid device properties. */
+bool btif_storage_get_hearing_aid_prop(
+ const RawAddress& address, uint8_t* capabilities, uint64_t* hi_sync_id,
+ uint16_t* render_delay, uint16_t* preparation_delay, uint16_t* codecs) {
+ std::string addrstr = address.ToString();
+
+ int value;
+ if (btif_config_get_int(addrstr, HEARING_AID_CAPABILITIES, &value)) {
+ *capabilities = value;
+ } else {
+ return false;
+ }
+
+ if (btif_config_get_int(addrstr, HEARING_AID_CODECS, &value)) {
+ *codecs = value;
+ } else {
+ return false;
+ }
+
+ if (btif_config_get_int(addrstr, HEARING_AID_RENDER_DELAY, &value)) {
+ *render_delay = value;
+ } else {
+ return false;
+ }
+
+ if (btif_config_get_int(addrstr, HEARING_AID_PREPARATION_DELAY, &value)) {
+ *preparation_delay = value;
+ } else {
+ return false;
+ }
+
+ uint64_t lvalue;
+ if (btif_config_get_uint64(addrstr, HEARING_AID_SYNC_ID, &lvalue)) {
+ *hi_sync_id = lvalue;
+ } else {
+ return false;
+ }
+
+ return true;
+}
+
/*******************************************************************************
*
* Function btif_storage_is_restricted_device