static constexpr PcmParameters kInvalidPcmConfiguration = {
.sampleRate = SampleRate::RATE_UNKNOWN,
+ .channelMode = ChannelMode::UNKNOWN,
.bitsPerSample = BitsPerSample::BITS_UNKNOWN,
- .channelMode = ChannelMode::UNKNOWN};
+ };
private:
// Helper function to connect to an IBluetoothAudioProvider
GATT_WRITE_OP_CB cb, void* cb_data) {
gatt_op_queue[conn_id].push_back({.type = GATT_WRITE_CHAR,
.handle = handle,
- .write_type = write_type,
.write_cb = cb,
.write_cb_data = cb_data,
+ .write_type = write_type,
.value = std::move(value)});
gatt_execute_next_op(conn_id);
}
GATT_WRITE_OP_CB cb, void* cb_data) {
gatt_op_queue[conn_id].push_back({.type = GATT_WRITE_DESC,
.handle = handle,
- .write_type = write_type,
.write_cb = cb,
.write_cb_data = cb_data,
+ .write_type = write_type,
.value = std::move(value)});
gatt_execute_next_op(conn_id);
}
for (; it != nv_attr.cend(); ++it) {
const auto& attr = *it;
if (attr.type != PRIMARY_SERVICE && attr.type != SECONDARY_SERVICE) break;
- result.services.emplace_back(
- Service{.handle = attr.handle,
- .end_handle = attr.value.service.end_handle,
- .is_primary = (attr.type == PRIMARY_SERVICE),
- .uuid = attr.value.service.uuid});
+ result.services.emplace_back(Service{
+ .handle = attr.handle,
+ .uuid = attr.value.service.uuid,
+ .is_primary = (attr.type == PRIMARY_SERVICE),
+ .end_handle = attr.value.service.end_handle,
+ });
}
auto current_service_it = result.services.begin();
.end_handle = attr.value.included_service.end_handle,
});
} else if (attr.type == CHARACTERISTIC) {
- current_service_it->characteristics.emplace_back(
- Characteristic{.declaration_handle = attr.handle,
- .value_handle = attr.value.characteristic.value_handle,
- .properties = attr.value.characteristic.properties,
- .uuid = attr.value.characteristic.uuid});
+ current_service_it->characteristics.emplace_back(Characteristic{
+ .declaration_handle = attr.handle,
+ .uuid = attr.value.characteristic.uuid,
+ .value_handle = attr.value.characteristic.value_handle,
+ .properties = attr.value.characteristic.properties,
+ });
} else {
current_service_it->characteristics.back().descriptors.emplace_back(
// general case optimization - we add services in order
if (database.services.empty() ||
database.services.back().end_handle < handle) {
- database.services.emplace_back(Service{.handle = handle,
- .end_handle = end_handle,
- .is_primary = is_primary,
- .uuid = uuid});
+ database.services.emplace_back(Service{
+ .handle = handle,
+ .uuid = uuid,
+ .is_primary = is_primary,
+ .end_handle = end_handle,
+ });
} else {
auto& vec = database.services;
[](Service s, uint16_t handle) { return s.end_handle < handle; });
// Insert new service just before it
- vec.emplace(it, Service{.handle = handle,
- .end_handle = end_handle,
- .is_primary = is_primary,
- .uuid = uuid});
+ vec.emplace(it, Service{
+ .handle = handle,
+ .uuid = uuid,
+ .is_primary = is_primary,
+ .end_handle = end_handle,
+ });
}
services_to_discover.insert({handle, end_handle});
<< loghex(value_handle) << " is after service end_handle="
<< loghex(service->end_handle);
- service->characteristics.emplace_back(
- Characteristic{.declaration_handle = handle,
- .value_handle = value_handle,
- .properties = properties,
- .uuid = uuid});
+ service->characteristics.emplace_back(Characteristic{
+ .declaration_handle = handle,
+ .uuid = uuid,
+ .value_handle = value_handle,
+ .properties = properties,
+ });
return;
}
static tL2CAP_FIXED_CHNL_REG fcr = {
.pL2CA_FixedConn_Cb = fcchan_conn_chng_cbk,
.pL2CA_FixedData_Cb = fcchan_data_cbk,
- .default_idle_tout = 0xffff,
.fixed_chnl_opts =
{
.mode = L2CAP_FCR_BASIC_MODE,
+ .tx_win_sz = 1,
.max_transmit = 0xFF,
.rtrans_tout = 2000,
.mon_tout = 12000,
.mps = 670,
- .tx_win_sz = 1,
},
+ .default_idle_tout = 0xffff,
};
while (t && t->chan != chan) t = t->next;
BTIF_TRACE_DEBUG("%s: Peer supports absolute volume. newVolume: %d",
__func__, volume);
- tAVRC_COMMAND avrc_cmd = {.volume = {.opcode = AVRC_OP_VENDOR,
- .pdu = AVRC_PDU_SET_ABSOLUTE_VOLUME,
+ tAVRC_COMMAND avrc_cmd = {.volume = {.pdu = AVRC_PDU_SET_ABSOLUTE_VOLUME,
.status = AVRC_STS_NO_ERROR,
+ .opcode = AVRC_OP_VENDOR,
.volume = volume}};
BT_HDR* p_msg = NULL;
std::vector<btgatt_db_element_t> svc;
- svc.push_back({.type = (service.primary() ? BTGATT_DB_PRIMARY_SERVICE
- : BTGATT_DB_SECONDARY_SERVICE),
- .uuid = service.uuid()});
+ svc.push_back({
+ .uuid = service.uuid(),
+ .type = (service.primary() ? BTGATT_DB_PRIMARY_SERVICE
+ : BTGATT_DB_SECONDARY_SERVICE),
+ });
for (const auto& characteristic : service.characteristics()) {
- svc.push_back({.type = BTGATT_DB_CHARACTERISTIC,
- .uuid = characteristic.uuid(),
+ svc.push_back({.uuid = characteristic.uuid(),
+ .type = BTGATT_DB_CHARACTERISTIC,
.properties = characteristic.properties(),
.permissions = characteristic.permissions()});
for (const auto& descriptor : characteristic.descriptors())
- svc.push_back({.type = BTGATT_DB_DESCRIPTOR,
- .uuid = descriptor.uuid(),
+ svc.push_back({.uuid = descriptor.uuid(),
+ .type = BTGATT_DB_DESCRIPTOR,
.permissions = descriptor.permissions()});
}
g_internal->server_if = server_if;
- pending_svc_decl.push_back(
- {.type = BTGATT_DB_PRIMARY_SERVICE, .uuid = app_uuid});
+ pending_svc_decl.push_back({
+ .uuid = app_uuid,
+ .type = BTGATT_DB_PRIMARY_SERVICE,
+ });
}
void ServiceAddedCallback(int status, int server_if,
bt_status_t ServerInternals::AddCharacteristic(const Uuid& uuid,
uint8_t properties,
uint16_t permissions) {
- pending_svc_decl.push_back({.type = BTGATT_DB_CHARACTERISTIC,
- .uuid = uuid,
+ pending_svc_decl.push_back({.uuid = uuid,
+ .type = BTGATT_DB_CHARACTERISTIC,
.properties = properties,
.permissions = permissions});
return BT_STATUS_SUCCESS;
desc_handle_ = 0x0004;
std::vector<btgatt_db_element_t> service_with_handles = {
- {.type = BTGATT_DB_PRIMARY_SERVICE,
- .uuid = uuid0,
+ {.uuid = uuid0,
+ .type = BTGATT_DB_PRIMARY_SERVICE,
.attribute_handle = srvc_handle_},
- {.type = BTGATT_DB_CHARACTERISTIC,
- .uuid = uuid1,
+ {.uuid = uuid1,
+ .type = BTGATT_DB_CHARACTERISTIC,
.attribute_handle = char_handle_},
- {.type = BTGATT_DB_DESCRIPTOR,
- .uuid = uuid2,
+ {.uuid = uuid2,
+ .type = BTGATT_DB_DESCRIPTOR,
.attribute_handle = desc_handle_},
};
Uuid addr_res_uuid = Uuid::From16Bit(GATT_UUID_GAP_CENTRAL_ADDR_RESOL);
btgatt_db_element_t service[] = {
- {.type = BTGATT_DB_PRIMARY_SERVICE, .uuid = svc_uuid},
- {.type = BTGATT_DB_CHARACTERISTIC,
- .uuid = name_uuid,
+ {
+ .uuid = svc_uuid,
+ .type = BTGATT_DB_PRIMARY_SERVICE,
+ },
+ {.uuid = name_uuid,
+ .type = BTGATT_DB_CHARACTERISTIC,
.properties = GATT_CHAR_PROP_BIT_READ,
.permissions = GATT_PERM_READ},
- {.type = BTGATT_DB_CHARACTERISTIC,
- .uuid = icon_uuid,
+ {.uuid = icon_uuid,
+ .type = BTGATT_DB_CHARACTERISTIC,
.properties = GATT_CHAR_PROP_BIT_READ,
.permissions = GATT_PERM_READ},
- {.type = BTGATT_DB_CHARACTERISTIC,
- .uuid = addr_res_uuid,
+ {.uuid = addr_res_uuid,
+ .type = BTGATT_DB_CHARACTERISTIC,
.properties = GATT_CHAR_PROP_BIT_READ,
.permissions = GATT_PERM_READ}
#if (BTM_PERIPHERAL_ENABLED == TRUE) /* Only needed for peripheral testing */
,
- {.type = BTGATT_DB_CHARACTERISTIC,
- .uuid = Uuid::From16Bit(GATT_UUID_GAP_PREF_CONN_PARAM),
+ {.uuid = Uuid::From16Bit(GATT_UUID_GAP_PREF_CONN_PARAM),
+ .type = BTGATT_DB_CHARACTERISTIC,
.properties = GATT_CHAR_PROP_BIT_READ,
.permissions = GATT_PERM_READ}
#endif
Uuid char_uuid = Uuid::From16Bit(GATT_UUID_GATT_SRV_CHGD);
btgatt_db_element_t service[] = {
- {.type = BTGATT_DB_PRIMARY_SERVICE, .uuid = service_uuid},
- {.type = BTGATT_DB_CHARACTERISTIC,
- .uuid = char_uuid,
- .properties = GATT_CHAR_PROP_BIT_INDICATE,
- .permissions = 0}};
+ {
+ .uuid = service_uuid,
+ .type = BTGATT_DB_PRIMARY_SERVICE,
+ },
+ {
+ .uuid = char_uuid,
+ .type = BTGATT_DB_CHARACTERISTIC,
+ .properties = GATT_CHAR_PROP_BIT_INDICATE,
+ .permissions = 0,
+ }};
GATTS_AddService(gatt_cb.gatt_if, service,
sizeof(service) / sizeof(btgatt_db_element_t));
.pL2CA_ConfigCfm_Cb = config_completed_cb,
.pL2CA_DisconnectInd_Cb = disconnect_request_cb,
.pL2CA_DisconnectCfm_Cb = disconnect_completed_cb,
- .pL2CA_CongestionStatus_Cb = congestion_cb,
.pL2CA_DataInd_Cb = read_ready_cb,
+ .pL2CA_CongestionStatus_Cb = congestion_cb,
.pL2CA_TxComplete_Cb = write_completed_cb,
};
int server_if = server_interface_id();
std::vector<btgatt_db_element_t> service = {
- {.type = BTGATT_DB_PRIMARY_SERVICE, .uuid = srvc_uuid},
- {.type = BTGATT_DB_CHARACTERISTIC,
- .uuid = char_uuid,
- .properties = 0x10 /* notification */,
- .permissions = 0x01 /* read only */},
- {.type = BTGATT_DB_DESCRIPTOR, .uuid = desc_uuid, .permissions = 0x01}};
+ {
+ .uuid = srvc_uuid,
+ .type = BTGATT_DB_PRIMARY_SERVICE,
+ },
+ {
+ .uuid = char_uuid,
+ .type = BTGATT_DB_CHARACTERISTIC,
+ .properties = 0x10, /* notification */
+ .permissions = 0x01, /* read only */
+ },
+ {
+ .uuid = desc_uuid,
+ .type = BTGATT_DB_DESCRIPTOR,
+ .permissions = 0x01,
+ }};
gatt_server_interface()->add_service(server_if, service);
semaphore_wait(service_added_callback_sem_);