ble_gatt_client
|
set of functions to manage queues More...
Go to the source code of this file.
Data Structures | |
struct | queue |
Functions | |
static struct queue * | queue_ref (struct queue *queue) |
static void | queue_unref (struct queue *queue) |
struct queue * | queue_new (void) |
void | queue_destroy (struct queue *queue, queue_destroy_func_t destroy) |
static struct queue_entry * | queue_entry_ref (struct queue_entry *entry) |
static void | queue_entry_unref (struct queue_entry *entry) |
static struct queue_entry * | queue_entry_new (void *data) |
bool | queue_push_tail (struct queue *queue, void *data) |
bool | queue_push_head (struct queue *queue, void *data) |
bool | queue_push_after (struct queue *queue, void *entry, void *data) |
void * | queue_pop_head (struct queue *queue) |
void * | queue_peek_head (struct queue *queue) |
void * | queue_peek_tail (struct queue *queue) |
void | queue_foreach (struct queue *queue, queue_foreach_func_t function, void *user_data) |
static bool | direct_match (const void *a, const void *b) |
void * | queue_find (struct queue *queue, queue_match_func_t function, const void *match_data) |
bool | queue_remove (struct queue *queue, void *data) |
void * | queue_remove_if (struct queue *queue, queue_match_func_t function, void *user_data) |
unsigned int | queue_remove_all (struct queue *queue, queue_match_func_t function, void *user_data, queue_destroy_func_t destroy) |
const struct queue_entry * | queue_get_entries (struct queue *queue) |
unsigned int | queue_length (struct queue *queue) |
bool | queue_isempty (struct queue *queue) |
set of functions to manage queues
Definition in file queue.c.
|
static |
compare a with b
a | first parameter |
b | second parameter |
Definition at line 362 of file queue.c.
Referenced by queue_find().
void queue_destroy | ( | struct queue * | queue, |
queue_destroy_func_t | destroy | ||
) |
destroy all queue structure elements
queue | pointer to the queue structure |
destroy | function making data deallocation |
Definition at line 102 of file queue.c.
References queue_remove_all(), and queue_unref().
Referenced by attribute_destroy(), bt_att_free(), bt_gatt_client_free(), discovery_op_free(), gatt_db_destroy(), gatt_db_new(), and notify_chrc_free().
|
static |
create a new queue, set queue->data to data, increment queue->ref_count
data |
Definition at line 147 of file queue.c.
References queue_entry::data, new0, and queue_entry_ref().
Referenced by queue_push_after(), queue_push_head(), and queue_push_tail().
|
static |
increment &entry->ref_count
entry |
Definition at line 118 of file queue.c.
References queue_entry::ref_count.
Referenced by queue_entry_new(), and queue_foreach().
|
static |
decrement &entry->ref_count and free entry structure if ref_count == 0
entry |
Definition at line 133 of file queue.c.
References queue_entry::ref_count.
Referenced by queue_foreach(), queue_pop_head(), queue_remove(), queue_remove_all(), and queue_remove_if().
void* queue_find | ( | struct queue * | queue, |
queue_match_func_t | function, | ||
const void * | match_data | ||
) |
queue | queue pointer |
function | function call to make comparison |
match_data | data to match with queue entry |
Definition at line 376 of file queue.c.
References queue_entry::data, direct_match(), queue::head, and queue_entry::next.
Referenced by bt_gatt_client_write_execute(), gatt_db_get_attribute(), gatt_db_get_service_with_uuid(), gatt_db_unregister(), get_reliable_request(), and register_notify().
void queue_foreach | ( | struct queue * | queue, |
queue_foreach_func_t | function, | ||
void * | user_data | ||
) |
iterator for the queue
queue | queue pointer |
function | function(void *data, void *user_data) to call for each element |
user_data | user pointer to pass to function |
Definition at line 325 of file queue.c.
References queue_entry::data, queue::head, queue_entry::next, queue_entry_ref(), queue_entry_unref(), queue_ref(), queue_unref(), and queue::ref_count.
Referenced by disconnect_cb(), gatt_db_find_by_type(), gatt_db_find_by_type_value(), gatt_db_find_information(), gatt_db_foreach_service_in_range(), gatt_db_read_by_type(), notify_cb(), and notify_service_changed().
const struct queue_entry* queue_get_entries | ( | struct queue * | queue | ) |
return queue head pointer
queue | queue pointer |
Definition at line 540 of file queue.c.
References queue::head.
Referenced by find_insert_loc(), gatt_db_read_by_group_type(), and handle_notify().
bool queue_isempty | ( | struct queue * | queue | ) |
test if queue is empty
queue | queue pointer |
Definition at line 569 of file queue.c.
References queue::entries.
Referenced by cancel_long_write_cb(), discover_primary_cb(), gatt_db_isempty(), handle_notify(), notify_service_changed(), start_next_long_write(), and wakeup_writer().
unsigned int queue_length | ( | struct queue * | queue | ) |
return queue length
queue | queue pointer |
Definition at line 555 of file queue.c.
References queue::entries.
struct queue* queue_new | ( | void | ) |
create a new queue structure
Definition at line 81 of file queue.c.
References queue::entries, queue::head, new0, queue_ref(), and queue::tail.
Referenced by bt_att_new(), bt_gatt_client_new(), discovery_op_create(), gatt_db_new(), new_attribute(), and notify_chrc_create().
void* queue_peek_head | ( | struct queue * | queue | ) |
peek data from the head of the queue
queue | queue pointer |
Definition at line 297 of file queue.c.
References queue_entry::data, and queue::head.
void* queue_peek_tail | ( | struct queue * | queue | ) |
peek data from the tail of the queue
queue | queue pointer |
Definition at line 310 of file queue.c.
References queue_entry::data, and queue::tail.
void* queue_pop_head | ( | struct queue * | queue | ) |
pop data from the head of queue
queue | queue pointer |
Definition at line 268 of file queue.c.
References queue_entry::data, queue::entries, queue::head, queue_entry::next, queue_entry_unref(), and queue::tail.
Referenced by disable_ccc_callback(), discover_chrcs_cb(), discover_descs(), discover_descs_cb(), discover_incl_cb(), discover_secondary_cb(), enable_ccc_callback(), pick_next_send_op(), service_changed_complete(), and start_next_long_write().
bool queue_push_after | ( | struct queue * | queue, |
void * | entry, | ||
void * | data | ||
) |
push a queue entry allocated with data and set it after the entry
queue | queue pointer where to allocate data |
entry | element queue where to put the data after |
data | data to queue |
Definition at line 229 of file queue.c.
References queue_entry::data, queue::entries, queue::head, queue_entry::next, queue_entry_new(), and queue::tail.
Referenced by gatt_db_insert_service().
bool queue_push_head | ( | struct queue * | queue, |
void * | data | ||
) |
push a queue entry allocated with data and set it at the head of queue
queue | queue pointer where to allocate data |
data | data to queue |
Definition at line 198 of file queue.c.
References queue::entries, queue::head, queue_entry::next, queue_entry_new(), and queue::tail.
Referenced by gatt_db_insert_service(), and handle_error_rsp().
bool queue_push_tail | ( | struct queue * | queue, |
void * | data | ||
) |
push a queue entry allocated with data and set it at the tail of queue
queue | queue pointer where to allocate data |
data | data to queue |
Definition at line 167 of file queue.c.
References queue::entries, queue::head, queue_entry::next, queue_entry_new(), and queue::tail.
Referenced by bt_att_register(), bt_att_register_disconnect(), bt_att_send(), bt_gatt_client_write_long_value(), discover_chrcs_cb(), discover_incl_cb(), discover_primary_cb(), discover_secondary_cb(), find_information(), gatt_db_attribute_read(), gatt_db_attribute_write(), gatt_db_read_by_group_type(), gatt_db_register(), notify_chrc_create(), read_by_type(), register_notify(), request_create(), and service_changed_cb().
increment &queue->ref_count
queue | pointer to the queue structure |
Definition at line 53 of file queue.c.
References queue::ref_count.
Referenced by queue_foreach(), and queue_new().
bool queue_remove | ( | struct queue * | queue, |
void * | data | ||
) |
remove queue element holding data
queue | queue pointer |
data | data pointer |
Definition at line 402 of file queue.c.
References queue_entry::data, queue::entries, queue::head, queue_entry::next, queue_entry_unref(), and queue::tail.
Referenced by cancel_long_write_req(), enable_ccc_callback(), gatt_db_remove_service(), gatt_db_unregister(), read_timeout(), register_notify(), request_unref(), and write_timeout().
unsigned int queue_remove_all | ( | struct queue * | queue, |
queue_match_func_t | function, | ||
void * | user_data, | ||
queue_destroy_func_t | destroy | ||
) |
remove all queue element
queue | queue pointer |
function | function used to match data deallocation |
user_data | data pointer used in deallocation function |
destroy | function for data deallocation |
Definition at line 487 of file queue.c.
References queue_entry::data, queue::entries, queue::head, queue_entry::next, queue_entry_unref(), queue_remove_if(), and queue::tail.
Referenced by bt_att_cancel_all(), bt_att_unregister_all(), bt_gatt_client_cancel_all(), enable_ccc_callback(), gatt_client_remove_all_notify_in_range(), gatt_client_remove_notify_chrcs_in_range(), gatt_db_clear(), gatt_db_clear_range(), and queue_destroy().
void* queue_remove_if | ( | struct queue * | queue, |
queue_match_func_t | function, | ||
void * | user_data | ||
) |
remove element match by function(void *data, void *match_data) where match_data = user_data
queue | queue pointer |
function | function call to make comparison |
user_data | data to match queue element in function |
Definition at line 440 of file queue.c.
References queue_entry::data, queue::entries, queue::head, queue_entry::next, queue_entry_unref(), and queue::tail.
Referenced by bt_att_cancel(), bt_att_unregister(), bt_att_unregister_disconnect(), bt_gatt_client_cancel(), bt_gatt_client_unregister_notify(), gatt_db_attribute_read_result(), gatt_db_attribute_write_result(), and queue_remove_all().
|
static |
decrement &queue->ref_count and free queue structure if ref_count == 0
queue | pointer to the queue structure |
Definition at line 68 of file queue.c.
References queue::ref_count.
Referenced by queue_destroy(), and queue_foreach().