Bluetooth: OTS - Rename client callbacks
Rename client callbacks to be more consistent with common code style. Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
This commit is contained in:
parent
70eefae1d2
commit
c894b63e9e
3 changed files with 23 additions and 23 deletions
|
@ -844,9 +844,9 @@ struct bt_ots_client_cb {
|
||||||
* @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 (*content_cb)(struct bt_conn *conn, uint32_t offset, uint32_t len,
|
int (*obj_content_recv)(struct bt_conn *conn, uint32_t offset,
|
||||||
uint8_t *data_p, bool is_complete,
|
uint32_t len, uint8_t *data_p, bool is_complete,
|
||||||
struct bt_ots_client *ots_inst);
|
struct bt_ots_client *ots_inst);
|
||||||
|
|
||||||
/** @brief Callback function for metadata of the selected object.
|
/** @brief Callback function for metadata of the selected object.
|
||||||
*
|
*
|
||||||
|
@ -860,9 +860,9 @@ struct bt_ots_client_cb {
|
||||||
* @param metadata_read Bitfield of the metadata that was
|
* @param metadata_read Bitfield of the metadata that was
|
||||||
* successfully read.
|
* successfully read.
|
||||||
*/
|
*/
|
||||||
void (*metadata_cb)(struct bt_conn *conn, int err,
|
void (*obj_metadata_recv)(struct bt_conn *conn, int err,
|
||||||
struct bt_ots_client *ots_inst,
|
struct bt_ots_client *ots_inst,
|
||||||
uint8_t metadata_read);
|
uint8_t metadata_read);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Register an Object Transfer Service Instance.
|
/** @brief Register an Object Transfer Service Instance.
|
||||||
|
|
|
@ -1451,13 +1451,13 @@ int bt_mcc_init(struct bt_mcc_cb *cb)
|
||||||
/* TODO: Have one single content callback. */
|
/* TODO: Have one single content callback. */
|
||||||
/* For now: Use the icon callback for content - it is the first, */
|
/* For now: Use the icon callback for content - it is the first, */
|
||||||
/* and this will anyway be reset later. */
|
/* and this will anyway be reset later. */
|
||||||
otc_cb.content_cb = on_icon_content;
|
otc_cb.obj_content_recv = on_icon_content;
|
||||||
otc_cb.obj_selected = on_obj_selected;
|
otc_cb.obj_selected = on_obj_selected;
|
||||||
otc_cb.metadata_cb = on_object_metadata;
|
otc_cb.obj_metadata_recv = on_object_metadata;
|
||||||
|
|
||||||
BT_DBG("Current object selected callback: %p", otc_cb.obj_selected);
|
BT_DBG("Object selected callback: %p", otc_cb.obj_selected);
|
||||||
BT_DBG("Content callback: %p", otc_cb.content_cb);
|
BT_DBG("Object content callback: %p", otc_cb.obj_content_recv);
|
||||||
BT_DBG("Metadata callback: %p", otc_cb.metadata_cb);
|
BT_DBG("Object metadata callback: %p", otc_cb.obj_metadata_recv);
|
||||||
#endif /* CONFIG_BT_MCC_OTS */
|
#endif /* CONFIG_BT_MCC_OTS */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2667,7 +2667,7 @@ int bt_mcc_otc_read_icon_object(struct bt_conn *conn)
|
||||||
int err;
|
int err;
|
||||||
/* TODO: Add handling for busy - either MCS or OTS */
|
/* TODO: Add handling for busy - either MCS or OTS */
|
||||||
|
|
||||||
cur_mcs_inst->otc.cb->content_cb = 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(conn, &cur_mcs_inst->otc);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -2684,7 +2684,7 @@ int bt_mcc_otc_read_track_segments_object(struct bt_conn *conn)
|
||||||
/* TODO: Add handling for busy - either MCS or OTS */
|
/* TODO: Add handling for busy - either MCS or OTS */
|
||||||
|
|
||||||
/* TODO: Assumes object is already selected */
|
/* TODO: Assumes object is already selected */
|
||||||
cur_mcs_inst->otc.cb->content_cb = 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(conn, &cur_mcs_inst->otc);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -2701,7 +2701,7 @@ int bt_mcc_otc_read_current_track_object(struct bt_conn *conn)
|
||||||
/* TODO: Add handling for busy - either MCS or OTS */
|
/* TODO: Add handling for busy - either MCS or OTS */
|
||||||
|
|
||||||
/* TODO: Assumes object is already selected */
|
/* TODO: Assumes object is already selected */
|
||||||
cur_mcs_inst->otc.cb->content_cb = 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(conn, &cur_mcs_inst->otc);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -2718,7 +2718,7 @@ int bt_mcc_otc_read_next_track_object(struct bt_conn *conn)
|
||||||
/* TODO: Add handling for busy - either MCS or OTS */
|
/* TODO: Add handling for busy - either MCS or OTS */
|
||||||
|
|
||||||
/* TODO: Assumes object is already selected */
|
/* TODO: Assumes object is already selected */
|
||||||
cur_mcs_inst->otc.cb->content_cb = 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(conn, &cur_mcs_inst->otc);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -2737,7 +2737,7 @@ int bt_mcc_otc_read_parent_group_object(struct bt_conn *conn)
|
||||||
/* TODO: Assumes object is already selected */
|
/* TODO: Assumes object is already selected */
|
||||||
|
|
||||||
/* Reuse callback for current group */
|
/* Reuse callback for current group */
|
||||||
cur_mcs_inst->otc.cb->content_cb = 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(conn, &cur_mcs_inst->otc);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -2754,7 +2754,7 @@ int bt_mcc_otc_read_current_group_object(struct bt_conn *conn)
|
||||||
/* TODO: Add handling for busy - either MCS or OTS */
|
/* TODO: Add handling for busy - either MCS or OTS */
|
||||||
|
|
||||||
/* TODO: Assumes object is already selected */
|
/* TODO: Assumes object is already selected */
|
||||||
cur_mcs_inst->otc.cb->content_cb = 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(conn, &cur_mcs_inst->otc);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
|
@ -159,9 +159,9 @@ static ssize_t rx_done(struct bt_gatt_ots_l2cap *l2cap_ctx,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cb_ret = cur_inst->otc_inst->cb->content_cb(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, 0);
|
||||||
|
|
||||||
if (is_complete) {
|
if (is_complete) {
|
||||||
const uint32_t rcv_size = cur_object->size.cur;
|
const uint32_t rcv_size = cur_object->size.cur;
|
||||||
|
@ -1222,8 +1222,8 @@ static void read_next_metadata(struct bt_conn *conn,
|
||||||
read_obj_properties_cb);
|
read_obj_properties_cb);
|
||||||
} else {
|
} else {
|
||||||
inst->busy = false;
|
inst->busy = false;
|
||||||
if (inst->otc_inst->cb->metadata_cb) {
|
if (inst->otc_inst->cb->obj_metadata_recv) {
|
||||||
inst->otc_inst->cb->metadata_cb(
|
inst->otc_inst->cb->obj_metadata_recv(
|
||||||
conn, inst->metadata_err, inst->otc_inst,
|
conn, inst->metadata_err, inst->otc_inst,
|
||||||
inst->metadata_read);
|
inst->metadata_read);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue