Bluetooth: Audio: MICS use bt_mics struct instead of bt_mics_server Change the type of the mics_inst in mics.c to bt_mics instead of bt_mics_server to align better with the future API change. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
diff --git a/subsys/bluetooth/audio/mics.c b/subsys/bluetooth/audio/mics.c index 45c25f3..a6ac983 100644 --- a/subsys/bluetooth/audio/mics.c +++ b/subsys/bluetooth/audio/mics.c
@@ -27,7 +27,7 @@ #if defined(CONFIG_BT_MICS) -static struct bt_mics_server mics_inst; +static struct bt_mics mics_inst; static void mute_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value) { @@ -38,10 +38,10 @@ const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset) { - BT_DBG("Mute %u", mics_inst.mute); + BT_DBG("Mute %u", mics_inst.srv.mute); return bt_gatt_attr_read(conn, attr, buf, len, offset, - &mics_inst.mute, sizeof(mics_inst.mute)); + &mics_inst.srv.mute, sizeof(mics_inst.srv.mute)); } static ssize_t write_mute(struct bt_conn *conn, const struct bt_gatt_attr *attr, @@ -54,7 +54,7 @@ return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET); } - if (len != sizeof(mics_inst.mute)) { + if (len != sizeof(mics_inst.srv.mute)) { return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN); } @@ -63,21 +63,21 @@ return BT_GATT_ERR(BT_MICS_ERR_VAL_OUT_OF_RANGE); } - if (conn != NULL && mics_inst.mute == BT_MICS_MUTE_DISABLED) { + if (conn != NULL && mics_inst.srv.mute == BT_MICS_MUTE_DISABLED) { return BT_GATT_ERR(BT_MICS_ERR_MUTE_DISABLED); } BT_DBG("%u", *val); - if (*val != mics_inst.mute) { - mics_inst.mute = *val; + if (*val != mics_inst.srv.mute) { + mics_inst.srv.mute = *val; bt_gatt_notify_uuid(NULL, BT_UUID_MICS_MUTE, - mics_inst.service_p->attrs, - &mics_inst.mute, sizeof(mics_inst.mute)); + mics_inst.srv.service_p->attrs, + &mics_inst.srv.mute, sizeof(mics_inst.srv.mute)); - if (mics_inst.cb != NULL && mics_inst.cb->mute != NULL) { - mics_inst.cb->mute(NULL, 0, mics_inst.mute); + if (mics_inst.srv.cb != NULL && mics_inst.srv.cb->mute != NULL) { + mics_inst.srv.cb->mute(NULL, 0, mics_inst.srv.mute); } } @@ -113,20 +113,20 @@ for (j = 0, i = 0; i < ARRAY_SIZE(mics_attrs); i++) { if (bt_uuid_cmp(mics_attrs[i].uuid, BT_UUID_GATT_INCLUDE) == 0) { - mics_inst.aics_insts[j] = bt_aics_free_instance_get(); - if (mics_inst.aics_insts[j] == NULL) { + mics_inst.srv.aics_insts[j] = bt_aics_free_instance_get(); + if (mics_inst.srv.aics_insts[j] == NULL) { BT_DBG("Could not get free AICS instances[%u]", j); return -ENOMEM; } - err = bt_aics_register(mics_inst.aics_insts[j], + err = bt_aics_register(mics_inst.srv.aics_insts[j], ¶m->aics_param[j]); if (err != 0) { BT_DBG("Could not register AICS instance[%u]: %d", j, err); return err; } - mics_attrs[i].user_data = bt_aics_svc_decl_get(mics_inst.aics_insts[j]); + mics_attrs[i].user_data = bt_aics_svc_decl_get(mics_inst.srv.aics_insts[j]); j++; if (j == CONFIG_BT_MICS_AICS_INSTANCE_COUNT) { @@ -154,14 +154,14 @@ } mics_svc = (struct bt_gatt_service)BT_GATT_SERVICE(mics_attrs); - mics_inst.service_p = &mics_svc; + mics_inst.srv.service_p = &mics_svc; err = bt_gatt_service_register(&mics_svc); if (err != 0) { BT_ERR("MICS service register failed: %d", err); } - mics_inst.cb = param->cb; + mics_inst.srv.cb = param->cb; *mics = (struct bt_mics *)&mics_inst; @@ -211,8 +211,8 @@ } #if defined(CONFIG_BT_MICS) - for (int i = 0; i < ARRAY_SIZE(mics_inst.aics_insts); i++) { - if (mics_inst.aics_insts[i] == aics) { + for (int i = 0; i < ARRAY_SIZE(mics_inst.srv.aics_insts); i++) { + if (mics_inst.srv.aics_insts[i] == aics) { return true; } } @@ -236,8 +236,8 @@ #if defined(CONFIG_BT_MICS) if (conn == NULL) { - included->aics_cnt = ARRAY_SIZE(mics_inst.aics_insts); - included->aics = mics_inst.aics_insts; + included->aics_cnt = ARRAY_SIZE(mics_inst.srv.aics_insts); + included->aics = mics_inst.srv.aics_insts; return 0; } @@ -295,8 +295,8 @@ } #if defined(CONFIG_BT_MICS) - if (mics_inst.cb && mics_inst.cb->mute) { - mics_inst.cb->mute(NULL, 0, mics_inst.mute); + if (mics_inst.srv.cb && mics_inst.srv.cb->mute) { + mics_inst.srv.cb->mute(NULL, 0, mics_inst.srv.mute); } return 0;