Bluetooth: OTS - Client APIs to have instance as first parameter

Move the instance as the first parameter of the client function calls
and callbacks, for consistency with the server implementation.

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
This commit is contained in:
Asbjørn Sæbø 2022-02-09 17:01:50 +01:00 committed by Carles Cufí
commit eecd94409c
5 changed files with 105 additions and 106 deletions

View file

@ -822,46 +822,46 @@ struct bt_ots_client_cb {
* have been reset, and metadata should be read again with * have been reset, and metadata should be read again with
* bt_ots_client_read_object_metadata(). * bt_ots_client_read_object_metadata().
* *
* @param ots_inst Pointer to the OTC instance.
* @param conn The connection to the peer device. * @param conn The connection to the peer device.
* @param err Error code (bt_ots_olcp_res_code). * @param err Error code (bt_ots_olcp_res_code).
* @param ots_inst Pointer to the OTC instance.
*/ */
void (*obj_selected)(struct bt_conn *conn, int err, void (*obj_selected)(struct bt_ots_client *ots_inst,
struct bt_ots_client *ots_inst); struct bt_conn *conn, int err);
/** @brief Callback function for content of the selected object. /** @brief Callback function for content of the selected object.
* *
* Called when the object content is received. * Called when the object content is received.
* *
* @param ots_inst Pointer to the OTC instance.
* @param conn The connection to the peer device. * @param conn The connection to the peer device.
* @param offset Offset of the received data. * @param offset Offset of the received data.
* @param len Length of the received data. * @param len Length of the received data.
* @param data_p Pointer to the received data. * @param data_p Pointer to the received data.
* @param is_complete Indicate if the whole object has been received. * @param is_complete Indicate if the whole object has been received.
* @param ots_inst Pointer to the OTC instance.
* *
* @return int BT_OTS_STOP or BT_OTS_CONTINUE. BT_OTS_STOP can * @return int BT_OTS_STOP or BT_OTS_CONTINUE. BT_OTS_STOP can
* be used to stop reading. * be used to stop reading.
*/ */
int (*obj_content_recv)(struct bt_conn *conn, uint32_t offset, int (*obj_content_recv)(struct bt_ots_client *ots_inst,
uint32_t len, uint8_t *data_p, bool is_complete, struct bt_conn *conn, uint32_t offset,
struct bt_ots_client *ots_inst); uint32_t len, uint8_t *data_p, bool is_complete);
/** @brief Callback function for metadata of the selected object. /** @brief Callback function for metadata of the selected object.
* *
* Called when metadata of the selected object are read. Not all of * Called when metadata of the selected object are read. Not all of
* the metadata may have been initialized. * the metadata may have been initialized.
* *
* @param ots_inst Pointer to the OTC instance.
* @param conn The connection to the peer device. * @param conn The connection to the peer device.
* @param err Error value. 0 on success, * @param err Error value. 0 on success,
* GATT error or ERRNO on fail. * GATT error or ERRNO on fail.
* @param ots_inst Pointer to the OTC instance.
* @param metadata_read Bitfield of the metadata that was * @param metadata_read Bitfield of the metadata that was
* successfully read. * successfully read.
*/ */
void (*obj_metadata_recv)(struct bt_conn *conn, int err, void (*obj_metadata_recv)(struct bt_ots_client *ots_inst,
struct bt_ots_client *ots_inst, struct bt_conn *conn, int err,
uint8_t metadata_read); uint8_t metadata_read);
}; };
@ -894,77 +894,77 @@ uint8_t bt_ots_client_indicate_handler(struct bt_conn *conn,
/** @brief Read the OTS feature characteristic. /** @brief Read the OTS feature characteristic.
* *
* @param conn Pointer to the connection object.
* @param otc_inst Pointer to the OTC instance. * @param otc_inst Pointer to the OTC instance.
* @param conn Pointer to the connection object.
* *
* @return int 0 if success, ERRNO on failure. * @return int 0 if success, ERRNO on failure.
*/ */
int bt_ots_client_read_feature(struct bt_conn *conn, int bt_ots_client_read_feature(struct bt_ots_client *otc_inst,
struct bt_ots_client *otc_inst); struct bt_conn *conn);
/** @brief Select an object by its Object ID. /** @brief Select an object by its Object ID.
* *
* @param otc_inst Pointer to the OTC instance.
* @param conn Pointer to the connection object. * @param conn Pointer to the connection object.
* @param obj_id Object's ID. * @param obj_id Object's ID.
* @param otc_inst Pointer to the OTC instance.
* *
* @return int 0 if success, ERRNO on failure. * @return int 0 if success, ERRNO on failure.
*/ */
int bt_ots_client_select_id(struct bt_conn *conn, int bt_ots_client_select_id(struct bt_ots_client *otc_inst,
struct bt_ots_client *otc_inst, struct bt_conn *conn,
uint64_t obj_id); uint64_t obj_id);
/** @brief Select the first object. /** @brief Select the first object.
* *
* @param conn Pointer to the connection object.
* @param otc_inst Pointer to the OTC instance. * @param otc_inst Pointer to the OTC instance.
* @param conn Pointer to the connection object.
* *
* @return int 0 if success, ERRNO on failure. * @return int 0 if success, ERRNO on failure.
*/ */
int bt_ots_client_select_first(struct bt_conn *conn, int bt_ots_client_select_first(struct bt_ots_client *otc_inst,
struct bt_ots_client *otc_inst); struct bt_conn *conn);
/** @brief Select the last object. /** @brief Select the last object.
* *
* @param conn Pointer to the connection object.
* @param otc_inst Pointer to the OTC instance. * @param otc_inst Pointer to the OTC instance.
* @param conn Pointer to the connection object.
* *
* @return int 0 if success, ERRNO on failure. * @return int 0 if success, ERRNO on failure.
*/ */
int bt_ots_client_select_last(struct bt_conn *conn, int bt_ots_client_select_last(struct bt_ots_client *otc_inst,
struct bt_ots_client *otc_inst); struct bt_conn *conn);
/** @brief Select the next object. /** @brief Select the next object.
* *
* @param conn Pointer to the connection object.
* @param otc_inst Pointer to the OTC instance. * @param otc_inst Pointer to the OTC instance.
* @param conn Pointer to the connection object.
* *
* @return int 0 if success, ERRNO on failure. * @return int 0 if success, ERRNO on failure.
*/ */
int bt_ots_client_select_next(struct bt_conn *conn, int bt_ots_client_select_next(struct bt_ots_client *otc_inst,
struct bt_ots_client *otc_inst); struct bt_conn *conn);
/** @brief Select the previous object. /** @brief Select the previous object.
* *
* @param conn Pointer to the connection object.
* @param otc_inst Pointer to the OTC instance. * @param otc_inst Pointer to the OTC instance.
* @param conn Pointer to the connection object.
* *
* @return int 0 if success, ERRNO on failure. * @return int 0 if success, ERRNO on failure.
*/ */
int bt_ots_client_select_prev(struct bt_conn *conn, int bt_ots_client_select_prev(struct bt_ots_client *otc_inst,
struct bt_ots_client *otc_inst); struct bt_conn *conn);
/** @brief Read the metadata of the current object. /** @brief Read the metadata of the current object.
* *
* @param conn Pointer to the connection object.
* @param otc_inst Pointer to the OTC instance. * @param otc_inst Pointer to the OTC instance.
* @param conn Pointer to the connection object.
* @param metadata Bitfield (`BT_OTS_METADATA_REQ_*`) of the metadata * @param metadata Bitfield (`BT_OTS_METADATA_REQ_*`) of the metadata
* to read. * to read.
* *
* @return int 0 if success, ERRNO on failure. * @return int 0 if success, ERRNO on failure.
*/ */
int bt_ots_client_read_object_metadata(struct bt_conn *conn, int bt_ots_client_read_object_metadata(struct bt_ots_client *otc_inst,
struct bt_ots_client *otc_inst, struct bt_conn *conn,
uint8_t metadata); uint8_t metadata);
/** @brief Read the data of the current selected object. /** @brief Read the data of the current selected object.
@ -972,13 +972,13 @@ int bt_ots_client_read_object_metadata(struct bt_conn *conn,
* This will trigger an OACP read operation for the current size of the object * This will trigger an OACP read operation for the current size of the object
* with a 0 offset and then expect receiving the content via the L2CAP CoC. * with a 0 offset and then expect receiving the content via the L2CAP CoC.
* *
* @param conn Pointer to the connection object.
* @param otc_inst Pointer to the OTC instance. * @param otc_inst Pointer to the OTC instance.
* @param conn Pointer to the connection object.
* *
* @return int 0 if success, ERRNO on failure. * @return int 0 if success, ERRNO on failure.
*/ */
int bt_ots_client_read_object_data(struct bt_conn *conn, int bt_ots_client_read_object_data(struct bt_ots_client *otc_inst,
struct bt_ots_client *otc_inst); struct bt_conn *conn);
/** @brief Directory listing object metadata callback /** @brief Directory listing object metadata callback
* *

View file

@ -166,16 +166,16 @@ static struct bt_ots_client_cb otc_cb;
#ifdef CONFIG_BT_MCC_OTS #ifdef CONFIG_BT_MCC_OTS
void on_obj_selected(struct bt_conn *conn, int err, void on_obj_selected(struct bt_ots_client *otc_inst,
struct bt_ots_client *otc_inst); struct bt_conn *conn, int err);
void on_object_metadata(struct bt_conn *conn, int err, void on_object_metadata(struct bt_ots_client *otc_inst,
struct bt_ots_client *otc_inst, struct bt_conn *conn, int err,
uint8_t metadata_read); uint8_t metadata_read);
int on_icon_content(struct bt_conn *conn, uint32_t offset, uint32_t len, int on_icon_content(struct bt_ots_client *otc_inst,
uint8_t *data_p, struct bt_conn *conn, uint32_t offset,
bool is_complete, struct bt_ots_client *otc_inst); uint32_t len, uint8_t *data_p, bool is_complete);
#endif /* CONFIG_BT_MCC_OTS */ #endif /* CONFIG_BT_MCC_OTS */
@ -2299,8 +2299,8 @@ int bt_mcc_read_content_control_id(struct bt_conn *conn)
#ifdef CONFIG_BT_MCC_OTS #ifdef CONFIG_BT_MCC_OTS
void on_obj_selected(struct bt_conn *conn, int result, void on_obj_selected(struct bt_ots_client *otc_inst,
struct bt_ots_client *otc_inst) struct bt_conn *conn, int result)
{ {
BT_DBG("Current object selected"); BT_DBG("Current object selected");
/* TODO: Read metadata here? */ /* TODO: Read metadata here? */
@ -2318,9 +2318,9 @@ void on_obj_selected(struct bt_conn *conn, int result,
/* TODO: Merge the object callback functions into one */ /* TODO: Merge the object callback functions into one */
/* Use a notion of the "active" object, as done in mpl.c, for tracking */ /* Use a notion of the "active" object, as done in mpl.c, for tracking */
int on_icon_content(struct bt_conn *conn, uint32_t offset, uint32_t len, int on_icon_content(struct bt_ots_client *otc_inst, struct bt_conn *conn,
uint8_t *data_p, bool is_complete, uint32_t offset, uint32_t len, uint8_t *data_p,
struct bt_ots_client *otc_inst) bool is_complete)
{ {
int cb_err = 0; int cb_err = 0;
@ -2403,9 +2403,9 @@ static void decode_track_segments(struct net_buf_simple *buff,
} }
#endif /* CONFIG_BT_DEBUG_MCC */ #endif /* CONFIG_BT_DEBUG_MCC */
int on_track_segments_content(struct bt_conn *conn, uint32_t offset, int on_track_segments_content(struct bt_ots_client *otc_inst,
uint32_t len, uint8_t *data_p, bool is_complete, struct bt_conn *conn, uint32_t offset,
struct bt_ots_client *otc_inst) uint32_t len, uint8_t *data_p, bool is_complete)
{ {
int cb_err = 0; int cb_err = 0;
@ -2447,9 +2447,9 @@ int on_track_segments_content(struct bt_conn *conn, uint32_t offset,
return BT_OTS_CONTINUE; return BT_OTS_CONTINUE;
} }
int on_current_track_content(struct bt_conn *conn, uint32_t offset, int on_current_track_content(struct bt_ots_client *otc_inst,
uint32_t len, uint8_t *data_p, bool is_complete, struct bt_conn *conn, uint32_t offset,
struct bt_ots_client *otc_inst) uint32_t len, uint8_t *data_p, bool is_complete)
{ {
int cb_err = 0; int cb_err = 0;
@ -2479,9 +2479,9 @@ int on_current_track_content(struct bt_conn *conn, uint32_t offset,
return BT_OTS_CONTINUE; return BT_OTS_CONTINUE;
} }
int on_next_track_content(struct bt_conn *conn, uint32_t offset, uint32_t len, int on_next_track_content(struct bt_ots_client *otc_inst,
uint8_t *data_p, bool is_complete, struct bt_conn *conn, uint32_t offset, uint32_t len,
struct bt_ots_client *otc_inst) uint8_t *data_p, bool is_complete)
{ {
int cb_err = 0; int cb_err = 0;
@ -2538,9 +2538,9 @@ static void decode_group(struct net_buf_simple *buff,
} }
#endif /* CONFIG_BT_DEBUG_MCC */ #endif /* CONFIG_BT_DEBUG_MCC */
int on_parent_group_content(struct bt_conn *conn, uint32_t offset, int on_parent_group_content(struct bt_ots_client *otc_inst,
uint32_t len, uint8_t *data_p, bool is_complete, struct bt_conn *conn, uint32_t offset,
struct bt_ots_client *otc_inst) uint32_t len, uint8_t *data_p, bool is_complete)
{ {
int cb_err = 0; int cb_err = 0;
@ -2584,9 +2584,9 @@ int on_parent_group_content(struct bt_conn *conn, uint32_t offset,
return BT_OTS_CONTINUE; return BT_OTS_CONTINUE;
} }
int on_current_group_content(struct bt_conn *conn, uint32_t offset, int on_current_group_content(struct bt_ots_client *otc_inst,
uint32_t len, uint8_t *data_p, bool is_complete, struct bt_conn *conn, uint32_t offset,
struct bt_ots_client *otc_inst) uint32_t len, uint8_t *data_p, bool is_complete)
{ {
int cb_err = 0; int cb_err = 0;
@ -2630,8 +2630,8 @@ int on_current_group_content(struct bt_conn *conn, uint32_t offset,
return BT_OTS_CONTINUE; return BT_OTS_CONTINUE;
} }
void on_object_metadata(struct bt_conn *conn, int err, void on_object_metadata(struct bt_ots_client *otc_inst,
struct bt_ots_client *otc_inst, struct bt_conn *conn, int err,
uint8_t metadata_read) uint8_t metadata_read)
{ {
BT_INFO("Object's meta data:"); BT_INFO("Object's meta data:");
@ -2652,7 +2652,7 @@ int bt_mcc_otc_read_object_metadata(struct bt_conn *conn)
{ {
int err; int err;
err = bt_ots_client_read_object_metadata(conn, &cur_mcs_inst->otc, err = bt_ots_client_read_object_metadata(&cur_mcs_inst->otc, conn,
BT_OTS_METADATA_REQ_ALL); BT_OTS_METADATA_REQ_ALL);
if (err) { if (err) {
BT_DBG("Error reading the object: %d", err); BT_DBG("Error reading the object: %d", err);
@ -2669,7 +2669,7 @@ int bt_mcc_otc_read_icon_object(struct bt_conn *conn)
cur_mcs_inst->otc.cb->obj_content_recv = on_icon_content; cur_mcs_inst->otc.cb->obj_content_recv = on_icon_content;
err = bt_ots_client_read_object_data(conn, &cur_mcs_inst->otc); err = bt_ots_client_read_object_data(&cur_mcs_inst->otc, conn);
if (err) { if (err) {
BT_DBG("Error reading the object: %d", err); BT_DBG("Error reading the object: %d", err);
} }
@ -2686,7 +2686,7 @@ int bt_mcc_otc_read_track_segments_object(struct bt_conn *conn)
/* TODO: Assumes object is already selected */ /* TODO: Assumes object is already selected */
cur_mcs_inst->otc.cb->obj_content_recv = on_track_segments_content; cur_mcs_inst->otc.cb->obj_content_recv = on_track_segments_content;
err = bt_ots_client_read_object_data(conn, &cur_mcs_inst->otc); err = bt_ots_client_read_object_data(&cur_mcs_inst->otc, conn);
if (err) { if (err) {
BT_DBG("Error reading the object: %d", err); BT_DBG("Error reading the object: %d", err);
} }
@ -2703,7 +2703,7 @@ int bt_mcc_otc_read_current_track_object(struct bt_conn *conn)
/* TODO: Assumes object is already selected */ /* TODO: Assumes object is already selected */
cur_mcs_inst->otc.cb->obj_content_recv = on_current_track_content; cur_mcs_inst->otc.cb->obj_content_recv = on_current_track_content;
err = bt_ots_client_read_object_data(conn, &cur_mcs_inst->otc); err = bt_ots_client_read_object_data(&cur_mcs_inst->otc, conn);
if (err) { if (err) {
BT_DBG("Error reading the object: %d", err); BT_DBG("Error reading the object: %d", err);
} }
@ -2720,7 +2720,7 @@ int bt_mcc_otc_read_next_track_object(struct bt_conn *conn)
/* TODO: Assumes object is already selected */ /* TODO: Assumes object is already selected */
cur_mcs_inst->otc.cb->obj_content_recv = on_next_track_content; cur_mcs_inst->otc.cb->obj_content_recv = on_next_track_content;
err = bt_ots_client_read_object_data(conn, &cur_mcs_inst->otc); err = bt_ots_client_read_object_data(&cur_mcs_inst->otc, conn);
if (err) { if (err) {
BT_DBG("Error reading the object: %d", err); BT_DBG("Error reading the object: %d", err);
} }
@ -2739,7 +2739,7 @@ int bt_mcc_otc_read_parent_group_object(struct bt_conn *conn)
/* Reuse callback for current group */ /* Reuse callback for current group */
cur_mcs_inst->otc.cb->obj_content_recv = on_parent_group_content; cur_mcs_inst->otc.cb->obj_content_recv = on_parent_group_content;
err = bt_ots_client_read_object_data(conn, &cur_mcs_inst->otc); err = bt_ots_client_read_object_data(&cur_mcs_inst->otc, conn);
if (err) { if (err) {
BT_DBG("Error reading the object: %d", err); BT_DBG("Error reading the object: %d", err);
} }
@ -2756,7 +2756,7 @@ int bt_mcc_otc_read_current_group_object(struct bt_conn *conn)
/* TODO: Assumes object is already selected */ /* TODO: Assumes object is already selected */
cur_mcs_inst->otc.cb->obj_content_recv = on_current_group_content; cur_mcs_inst->otc.cb->obj_content_recv = on_current_group_content;
err = bt_ots_client_read_object_data(conn, &cur_mcs_inst->otc); err = bt_ots_client_read_object_data(&cur_mcs_inst->otc, conn);
if (err) { if (err) {
BT_DBG("Error reading the object: %d", err); BT_DBG("Error reading the object: %d", err);
} }

View file

@ -156,10 +156,9 @@ static ssize_t rx_done(struct bt_gatt_ots_l2cap *l2cap_ctx,
cur_inst->rcvd_size, cur_object->size.cur); cur_inst->rcvd_size, cur_object->size.cur);
} }
cb_ret = cur_inst->otc_inst->cb->obj_content_recv(0, conn, offset,
cb_ret = cur_inst->otc_inst->cb->obj_content_recv(conn, offset,
buf->len, buf->data, buf->len, buf->data,
is_complete, 0); is_complete);
if (is_complete) { if (is_complete) {
const uint32_t rcv_size = cur_object->size.cur; const uint32_t rcv_size = cur_object->size.cur;
@ -248,7 +247,7 @@ static void on_object_selected(struct bt_conn *conn,
otc_inst->cur_object.id = OTS_CLIENT_UNKNOWN_ID; otc_inst->cur_object.id = OTS_CLIENT_UNKNOWN_ID;
if (otc_inst->cb->obj_selected) { if (otc_inst->cb->obj_selected) {
otc_inst->cb->obj_selected(conn, res, otc_inst); otc_inst->cb->obj_selected(otc_inst, conn, res);
} }
BT_DBG("Object selected"); BT_DBG("Object selected");
@ -448,8 +447,8 @@ int bt_ots_client_unregister(uint8_t index)
return 0; return 0;
} }
int bt_ots_client_read_feature(struct bt_conn *conn, int bt_ots_client_read_feature(struct bt_ots_client *otc_inst,
struct bt_ots_client *otc_inst) struct bt_conn *conn)
{ {
if (OTS_CLIENT_INST_COUNT > 0) { if (OTS_CLIENT_INST_COUNT > 0) {
struct bt_otc_internal_instance_t *inst; struct bt_otc_internal_instance_t *inst;
@ -534,8 +533,8 @@ static int write_olcp(struct bt_otc_internal_instance_t *inst,
return err; return err;
} }
int bt_ots_client_select_id(struct bt_conn *conn, int bt_ots_client_select_id(struct bt_ots_client *otc_inst,
struct bt_ots_client *otc_inst, struct bt_conn *conn,
uint64_t obj_id) uint64_t obj_id)
{ {
if (OTS_CLIENT_INST_COUNT > 0) { if (OTS_CLIENT_INST_COUNT > 0) {
@ -574,8 +573,8 @@ int bt_ots_client_select_id(struct bt_conn *conn,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
int bt_ots_client_select_first(struct bt_conn *conn, int bt_ots_client_select_first(struct bt_ots_client *otc_inst,
struct bt_ots_client *otc_inst) struct bt_conn *conn)
{ {
if (OTS_CLIENT_INST_COUNT > 0) { if (OTS_CLIENT_INST_COUNT > 0) {
struct bt_otc_internal_instance_t *inst; struct bt_otc_internal_instance_t *inst;
@ -608,8 +607,8 @@ int bt_ots_client_select_first(struct bt_conn *conn,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
int bt_ots_client_select_last(struct bt_conn *conn, int bt_ots_client_select_last(struct bt_ots_client *otc_inst,
struct bt_ots_client *otc_inst) struct bt_conn *conn)
{ {
if (OTS_CLIENT_INST_COUNT > 0) { if (OTS_CLIENT_INST_COUNT > 0) {
struct bt_otc_internal_instance_t *inst; struct bt_otc_internal_instance_t *inst;
@ -643,8 +642,8 @@ int bt_ots_client_select_last(struct bt_conn *conn,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
int bt_ots_client_select_next(struct bt_conn *conn, int bt_ots_client_select_next(struct bt_ots_client *otc_inst,
struct bt_ots_client *otc_inst) struct bt_conn *conn)
{ {
if (OTS_CLIENT_INST_COUNT > 0) { if (OTS_CLIENT_INST_COUNT > 0) {
struct bt_otc_internal_instance_t *inst; struct bt_otc_internal_instance_t *inst;
@ -677,8 +676,8 @@ int bt_ots_client_select_next(struct bt_conn *conn,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
int bt_ots_client_select_prev(struct bt_conn *conn, int bt_ots_client_select_prev(struct bt_ots_client *otc_inst,
struct bt_ots_client *otc_inst) struct bt_conn *conn)
{ {
if (OTS_CLIENT_INST_COUNT > 0) { if (OTS_CLIENT_INST_COUNT > 0) {
struct bt_otc_internal_instance_t *inst; struct bt_otc_internal_instance_t *inst;
@ -1152,8 +1151,8 @@ static int oacp_read(struct bt_conn *conn,
return err; return err;
} }
int bt_ots_client_read_object_data(struct bt_conn *conn, int bt_ots_client_read_object_data(struct bt_ots_client *otc_inst,
struct bt_ots_client *otc_inst) struct bt_conn *conn)
{ {
struct bt_otc_internal_instance_t *inst; struct bt_otc_internal_instance_t *inst;
@ -1222,7 +1221,7 @@ static void read_next_metadata(struct bt_conn *conn,
inst->busy = false; inst->busy = false;
if (inst->otc_inst->cb->obj_metadata_recv) { if (inst->otc_inst->cb->obj_metadata_recv) {
inst->otc_inst->cb->obj_metadata_recv( inst->otc_inst->cb->obj_metadata_recv(
conn, inst->metadata_err, inst->otc_inst, inst->otc_inst, conn, inst->metadata_err,
inst->metadata_read); inst->metadata_read);
} }
return; return;
@ -1234,8 +1233,8 @@ static void read_next_metadata(struct bt_conn *conn,
} }
} }
int bt_ots_client_read_object_metadata(struct bt_conn *conn, int bt_ots_client_read_object_metadata(struct bt_ots_client *otc_inst,
struct bt_ots_client *otc_inst, struct bt_conn *conn,
uint8_t metadata) uint8_t metadata)
{ {
struct bt_otc_internal_instance_t *inst; struct bt_otc_internal_instance_t *inst;

View file

@ -1164,7 +1164,7 @@ int cmd_mcc_otc_read_features(const struct shell *sh, size_t argc,
{ {
int result; int result;
result = bt_ots_client_read_feature(default_conn, bt_mcc_otc_inst()); result = bt_ots_client_read_feature(bt_mcc_otc_inst(), default_conn);
if (result) { if (result) {
shell_error(sh, "Fail: %d", result); shell_error(sh, "Fail: %d", result);
} }
@ -1175,7 +1175,7 @@ int cmd_mcc_otc_read(const struct shell *sh, size_t argc, char *argv[])
{ {
int result; int result;
result = bt_ots_client_read_object_data(default_conn, bt_mcc_otc_inst()); result = bt_ots_client_read_object_data(bt_mcc_otc_inst(), default_conn);
if (result) { if (result) {
shell_error(sh, "Fail: %d", result); shell_error(sh, "Fail: %d", result);
} }
@ -1187,8 +1187,8 @@ int cmd_mcc_otc_read_metadata(const struct shell *sh, size_t argc,
{ {
int result; int result;
result = bt_ots_client_read_object_metadata(default_conn, result = bt_ots_client_read_object_metadata(bt_mcc_otc_inst(),
bt_mcc_otc_inst(), default_conn,
BT_OTS_METADATA_REQ_ALL); BT_OTS_METADATA_REQ_ALL);
if (result) { if (result) {
shell_error(sh, "Fail: %d", result); shell_error(sh, "Fail: %d", result);
@ -1208,7 +1208,7 @@ int cmd_mcc_otc_select(const struct shell *sh, size_t argc, char *argv[])
return -ENOEXEC; return -ENOEXEC;
} }
result = bt_ots_client_select_id(default_conn, bt_mcc_otc_inst(), id); result = bt_ots_client_select_id(bt_mcc_otc_inst(), default_conn, id);
if (result) { if (result) {
shell_error(sh, "Fail: %d", result); shell_error(sh, "Fail: %d", result);
} }
@ -1220,7 +1220,7 @@ int cmd_mcc_otc_select_first(const struct shell *sh, size_t argc,
{ {
int result; int result;
result = bt_ots_client_select_first(default_conn, bt_mcc_otc_inst()); result = bt_ots_client_select_first(bt_mcc_otc_inst(), default_conn);
if (result) { if (result) {
shell_error(sh, "Fail: %d", result); shell_error(sh, "Fail: %d", result);
} }
@ -1232,7 +1232,7 @@ int cmd_mcc_otc_select_last(const struct shell *sh, size_t argc,
{ {
int result; int result;
result = bt_ots_client_select_last(default_conn, bt_mcc_otc_inst()); result = bt_ots_client_select_last(bt_mcc_otc_inst(), default_conn);
if (result) { if (result) {
shell_error(sh, "Fail: %d", result); shell_error(sh, "Fail: %d", result);
} }
@ -1244,7 +1244,7 @@ int cmd_mcc_otc_select_next(const struct shell *sh, size_t argc,
{ {
int result; int result;
result = bt_ots_client_select_next(default_conn, bt_mcc_otc_inst()); result = bt_ots_client_select_next(bt_mcc_otc_inst(), default_conn);
if (result) { if (result) {
shell_error(sh, "Fail: %d", result); shell_error(sh, "Fail: %d", result);
} }
@ -1256,7 +1256,7 @@ int cmd_mcc_otc_select_prev(const struct shell *sh, size_t argc,
{ {
int result; int result;
result = bt_ots_client_select_prev(default_conn, bt_mcc_otc_inst()); result = bt_ots_client_select_prev(bt_mcc_otc_inst(), default_conn);
if (result) { if (result) {
shell_error(sh, "Fail: %d", result); shell_error(sh, "Fail: %d", result);
} }
@ -1352,7 +1352,7 @@ int cmd_mcc_ots_select_first(const struct shell *sh, size_t argc,
{ {
int result; int result;
result = bt_ots_client_select_first(default_conn, 0); result = bt_ots_client_select_first(0, default_conn);
if (result) { if (result) {
shell_error(sh, "Fail: %d", result); shell_error(sh, "Fail: %d", result);
} }
@ -1364,7 +1364,7 @@ int cmd_mcc_ots_select_last(const struct shell *sh, size_t argc,
{ {
int result; int result;
result = bt_ots_client_select_last(default_conn, 0); result = bt_ots_client_select_last(0, default_conn);
if (result) { if (result) {
shell_error(sh, "Fail: %d", result); shell_error(sh, "Fail: %d", result);
} }
@ -1376,7 +1376,7 @@ int cmd_mcc_ots_select_next(const struct shell *sh, size_t argc,
{ {
int result; int result;
result = bt_ots_client_select_next(default_conn, 0); result = bt_ots_client_select_next(0, default_conn);
if (result) { if (result) {
shell_error(sh, "Fail: %d", result); shell_error(sh, "Fail: %d", result);
} }
@ -1388,7 +1388,7 @@ int cmd_mcc_ots_select_prev(const struct shell *sh, size_t argc,
{ {
int result; int result;
result = bt_ots_client_select_prev(default_conn, 0); result = bt_ots_client_select_prev(0, default_conn);
if (result) { if (result) {
shell_error(sh, "Fail: %d", result); shell_error(sh, "Fail: %d", result);
} }

View file

@ -592,7 +592,7 @@ static void select_read_meta(int64_t id)
/* TODO: Fix the instance pointer - it is neither valid nor used */ /* TODO: Fix the instance pointer - it is neither valid nor used */
UNSET_FLAG(object_selected); UNSET_FLAG(object_selected);
err = bt_ots_client_select_id(default_conn, bt_mcc_otc_inst(), id); err = bt_ots_client_select_id(bt_mcc_otc_inst(), default_conn, id);
if (err) { if (err) {
FAIL("Failed to select object\n"); FAIL("Failed to select object\n");
return; return;
@ -603,7 +603,7 @@ static void select_read_meta(int64_t id)
/* TODO: Fix the instance pointer - it is neither valid nor used */ /* TODO: Fix the instance pointer - it is neither valid nor used */
UNSET_FLAG(metadata_read); UNSET_FLAG(metadata_read);
err = bt_ots_client_read_object_metadata(default_conn, bt_mcc_otc_inst(), err = bt_ots_client_read_object_metadata(bt_mcc_otc_inst(), default_conn,
BT_OTS_METADATA_REQ_ALL); BT_OTS_METADATA_REQ_ALL);
if (err) { if (err) {
FAIL("Failed to read object metadata\n"); FAIL("Failed to read object metadata\n");