Lines Matching refs:index
554 uint8_t index; member
576 if (preset->index < start_index) { in preset_foreach()
580 if (preset->index > end_index) { in preset_foreach()
604 if (tmp->index > preset->index) { in preset_insert()
619 static struct has_preset *preset_alloc(uint8_t index, enum bt_has_properties properties, in preset_alloc() argument
631 preset->index = index; in preset_alloc()
687 static struct has_preset *preset_lookup_index(uint8_t index) in preset_lookup_index() argument
692 if (preset->index == index) { in preset_lookup_index()
720 if (prev == NULL || prev->index >= preset->index) { in preset_get_prev_index()
724 return prev->index; in preset_get_prev_index()
835 preset->index, preset->properties, preset->name, is_last); in bt_has_cp_read_preset_rsp()
841 rsp->index = preset->index; in bt_has_cp_read_preset_rsp()
860 static int bt_has_cp_generic_update(struct has_client *client, uint8_t prev_index, uint8_t index, in bt_has_cp_generic_update() argument
870 client, prev_index, index, properties, name, is_last); in bt_has_cp_generic_update()
876 generic_update->index = index; in bt_has_cp_generic_update()
961 static void update_last_preset_index_known(struct has_client *client, uint8_t index) in update_last_preset_index_known() argument
964 client->context->last_preset_index_known != index) { in update_last_preset_index_known()
965 client->context->last_preset_index_known = index; in update_last_preset_index_known()
975 client->context->last_preset_index_known != index) { in update_last_preset_index_known()
976 client->context->last_preset_index_known = index; in update_last_preset_index_known()
1000 preset_foreach(preset->index + 1, BT_HAS_PRESET_INDEX_LAST, preset_found, &next); in read_preset_response()
1010 if (preset->index > client->context->last_preset_index_known) { in read_preset_response()
1011 update_last_preset_index_known(client, preset->index); in read_preset_response()
1015 client->read_presets_req.start_index = preset->index + 1; in read_preset_response()
1025 static int bt_has_cp_preset_record_deleted(struct has_client *client, uint8_t index) in bt_has_cp_preset_record_deleted() argument
1030 LOG_DBG("client %p index 0x%02x", client, index); in bt_has_cp_preset_record_deleted()
1033 net_buf_simple_add_u8(&buf, index); in bt_has_cp_preset_record_deleted()
1048 .index = client->context->last_preset_index_known, in preset_list_changed_generic_update_tail()
1065 err = bt_has_cp_generic_update(client, prev ? prev->index : BT_HAS_PRESET_INDEX_NONE, in preset_list_changed_generic_update_tail()
1066 last.index, last.properties, last.name, false); in preset_list_changed_generic_update_tail()
1086 update_last_preset_index_known(client, last ? last->index : BT_HAS_PRESET_INDEX_NONE); in preset_list_changed_record_deleted_last()
1116 preset_foreach(preset->index + 1, BT_HAS_PRESET_INDEX_LAST, preset_found, &next); in preset_list_changed()
1121 is_last = next == NULL && preset->index >= client->context->last_preset_index_known; in preset_list_changed()
1123 err = bt_has_cp_generic_update(client, preset_get_prev_index(preset), preset->index, in preset_list_changed()
1133 update_last_preset_index_known(client, preset->index); in preset_list_changed()
1151 client->preset_changed_index_next = preset->index + 1; in preset_list_changed()
1209 static int set_preset_name(uint8_t index, const char *name, size_t len) in set_preset_name() argument
1213 LOG_DBG("index %d name_len %zu", index, len); in set_preset_name()
1220 preset_foreach(index, BT_HAS_PRESET_INDEX_LAST, preset_found, &preset); in set_preset_name()
1243 preset->ops->name_changed(index, preset->name); in set_preset_name()
1246 return bt_has_cp_generic_update(NULL, preset_get_prev_index(preset), preset->index, in set_preset_name()
1275 err = set_preset_name(req->index, req->name, buf->len); in handle_write_preset_name()
1300 const int err = preset->ops->select(preset->index, sync); in preset_select()
1338 preset = preset_lookup_index(pdu->index); in handle_set_active_preset()
1488 CHECKIF(param->index == BT_HAS_PRESET_INDEX_NONE) { in bt_has_preset_register()
1519 preset = preset_lookup_index(param->index); in bt_has_preset_register()
1530 preset = preset_alloc(param->index, param->properties, param->name, param->ops); in bt_has_preset_register()
1536 update_last_preset_index_known(NULL, preset->index); in bt_has_preset_register()
1539 return bt_has_cp_generic_update(NULL, preset_get_prev_index(preset), preset->index, in bt_has_preset_register()
1543 int bt_has_preset_unregister(uint8_t index) in bt_has_preset_unregister() argument
1548 CHECKIF(index == BT_HAS_PRESET_INDEX_NONE) { in bt_has_preset_unregister()
1553 preset = preset_lookup_index(index); in bt_has_preset_unregister()
1562 err = bt_has_cp_preset_record_deleted(NULL, preset->index); in bt_has_preset_unregister()
1576 static int set_preset_availability(uint8_t index, bool available) in set_preset_availability() argument
1583 CHECKIF(index == BT_HAS_PRESET_INDEX_NONE) { in set_preset_availability()
1588 preset = preset_lookup_index(index); in set_preset_availability()
1607 net_buf_simple_add_u8(&buf, preset->index); in set_preset_availability()
1612 int bt_has_preset_available(uint8_t index) in bt_has_preset_available() argument
1614 return set_preset_availability(index, true); in bt_has_preset_available()
1617 int bt_has_preset_unavailable(uint8_t index) in bt_has_preset_unavailable() argument
1619 return set_preset_availability(index, false); in bt_has_preset_unavailable()
1631 return data->func(preset->index, preset->properties, preset->name, data->user_data); in bt_has_preset_foreach_func()
1634 void bt_has_preset_foreach(uint8_t index, bt_has_preset_func_t func, void *user_data) in bt_has_preset_foreach() argument
1642 if (index == BT_HAS_PRESET_INDEX_NONE) { in bt_has_preset_foreach()
1646 start_index = end_index = index; in bt_has_preset_foreach()
1652 int bt_has_preset_active_set(uint8_t index) in bt_has_preset_active_set() argument
1656 if (index == BT_HAS_PRESET_INDEX_NONE) { in bt_has_preset_active_set()
1661 preset = preset_lookup_index(index); in bt_has_preset_active_set()
1681 return active_preset->index; in bt_has_preset_active_get()
1684 int bt_has_preset_name_change(uint8_t index, const char *name) in bt_has_preset_name_change() argument
1691 return set_preset_name(index, name, strlen(name)); in bt_has_preset_name_change()