ble_gatt_client
|
#include <stdint.h>
#include <stdlib.h>
#include <alloca.h>
#include <byteswap.h>
#include <string.h>
Go to the source code of this file.
Macros | |
#define | le16_to_cpu(val) (val) |
#define | le32_to_cpu(val) (val) |
#define | le64_to_cpu(val) (val) |
#define | cpu_to_le16(val) (val) |
#define | cpu_to_le32(val) (val) |
#define | cpu_to_le64(val) (val) |
#define | be16_to_cpu(val) bswap_16(val) |
#define | be32_to_cpu(val) bswap_32(val) |
#define | be64_to_cpu(val) bswap_64(val) |
#define | cpu_to_be16(val) bswap_16(val) |
#define | cpu_to_be32(val) bswap_32(val) |
#define | cpu_to_be64(val) bswap_64(val) |
#define | get_unaligned(ptr) |
#define | put_unaligned(val, ptr) |
#define | PTR_TO_UINT(p) ((unsigned int) ((uintptr_t) (p))) |
#define | UINT_TO_PTR(u) ((void *) ((uintptr_t) (u))) |
#define | PTR_TO_INT(p) ((int) ((intptr_t) (p))) |
#define | INT_TO_PTR(u) ((void *) ((intptr_t) (u))) |
#define | new0(t, n) ((t*) calloc((n), sizeof(t))) |
#define | newa(t, n) ((t*) alloca(sizeof(t)*(n))) |
#define | malloc0(n) (calloc((n), 1)) |
Typedefs | |
typedef void(* | util_debug_func_t )(const char *str, void *user_data) |
Functions | |
void | util_debug (util_debug_func_t function, void *user_data, const char *format,...) __attribute__((format(printf |
void void | util_hexdump (const char dir, const unsigned char *buf, size_t len, util_debug_func_t function, void *user_data) |
unsigned char | util_get_dt (const char *parent, const char *name) |
uint8_t | util_get_uid (unsigned int *bitmap, uint8_t max) |
void | util_clear_uid (unsigned int *bitmap, uint8_t id) |
static uint16_t | get_le16 (const void *ptr) |
static uint16_t | get_be16 (const void *ptr) |
static uint32_t | get_le32 (const void *ptr) |
static uint32_t | get_be32 (const void *ptr) |
static uint64_t | get_le64 (const void *ptr) |
static uint64_t | get_be64 (const void *ptr) |
static void | put_le16 (uint16_t val, void *dst) |
static void | put_be16 (uint16_t val, const void *ptr) |
static void | put_le32 (uint32_t val, void *dst) |
static void | put_be32 (uint32_t val, void *dst) |
static void | put_le64 (uint64_t val, void *dst) |
static void | put_be64 (uint64_t val, void *dst) |
#define be16_to_cpu | ( | val | ) | bswap_16(val) |
Definition at line 37 of file util.h.
Referenced by get_be16().
#define be32_to_cpu | ( | val | ) | bswap_32(val) |
Definition at line 38 of file util.h.
Referenced by get_be32().
#define be64_to_cpu | ( | val | ) | bswap_64(val) |
Definition at line 39 of file util.h.
Referenced by get_be64().
#define cpu_to_be16 | ( | val | ) | bswap_16(val) |
Definition at line 40 of file util.h.
Referenced by put_be16().
#define cpu_to_be32 | ( | val | ) | bswap_32(val) |
Definition at line 41 of file util.h.
Referenced by put_be32().
#define cpu_to_be64 | ( | val | ) | bswap_64(val) |
Definition at line 42 of file util.h.
Referenced by put_be64().
#define cpu_to_le16 | ( | val | ) | (val) |
Definition at line 34 of file util.h.
Referenced by put_le16().
#define cpu_to_le32 | ( | val | ) | (val) |
Definition at line 35 of file util.h.
Referenced by put_le32().
#define cpu_to_le64 | ( | val | ) | (val) |
Definition at line 36 of file util.h.
Referenced by put_le64().
#define get_unaligned | ( | ptr | ) |
Definition at line 60 of file util.h.
Referenced by get_be16(), get_be32(), get_be64(), get_le16(), get_le32(), and get_le64().
#define INT_TO_PTR | ( | u | ) | ((void *) ((intptr_t) (u))) |
Definition at line 80 of file util.h.
Referenced by disconnect_cb().
#define le16_to_cpu | ( | val | ) | (val) |
Definition at line 31 of file util.h.
Referenced by get_le16().
#define le32_to_cpu | ( | val | ) | (val) |
Definition at line 32 of file util.h.
Referenced by get_le32().
#define le64_to_cpu | ( | val | ) | (val) |
Definition at line 33 of file util.h.
Referenced by get_le64().
#define malloc0 | ( | n | ) | (calloc((n), 1)) |
Definition at line 84 of file util.h.
Referenced by new_attribute().
#define new0 | ( | t, | |
n | |||
) | ((t*) calloc((n), sizeof(t))) |
Definition at line 82 of file util.h.
Referenced by bt_att_new(), bt_att_register(), bt_att_register_disconnect(), bt_crypto_new(), bt_gatt_client_new(), bt_gatt_client_read_long_value(), bt_gatt_client_read_multiple(), bt_gatt_client_read_value(), bt_gatt_client_write_execute(), bt_gatt_client_write_long_value(), bt_gatt_client_write_value(), bt_gatt_discover_characteristics(), bt_gatt_discover_descriptors(), bt_gatt_discover_included_services(), bt_gatt_exchange_mtu(), bt_gatt_read_by_type(), can_write_data(), client_create(), create_att_send_op(), discover_chrcs_cb(), discover_services(), discovery_op_create(), gatt_db_attribute_read(), gatt_db_attribute_write(), gatt_db_new(), gatt_db_register(), gatt_db_service_create(), get_reliable_request(), io_new(), new_attribute(), new_read_included(), notify_chrc_create(), queue_entry_new(), queue_new(), register_notify(), request_create(), result_create(), service_changed_cb(), and sign_set_key().
#define PTR_TO_INT | ( | p | ) | ((int) ((intptr_t) (p))) |
Definition at line 79 of file util.h.
Referenced by disconn_handler().
#define PTR_TO_UINT | ( | p | ) | ((unsigned int) ((uintptr_t) (p))) |
Definition at line 76 of file util.h.
Referenced by find_pending(), find_service_for_handle(), match_disconn_id(), match_notify_chrc_value_handle(), match_notify_data_id(), match_notify_id(), match_op_id(), and match_req_id().
#define put_unaligned | ( | val, | |
ptr | |||
) |
Definition at line 68 of file util.h.
Referenced by put_be16(), put_be32(), put_be64(), put_le16(), put_le32(), and put_le64().
#define UINT_TO_PTR | ( | u | ) | ((void *) ((uintptr_t) (u))) |
Definition at line 77 of file util.h.
Referenced by bt_att_cancel(), bt_att_unregister(), bt_att_unregister_disconnect(), bt_gatt_client_cancel(), bt_gatt_client_unregister_notify(), bt_gatt_client_write_execute(), gatt_db_attribute_read_result(), gatt_db_attribute_write_result(), gatt_db_get_attribute(), gatt_db_unregister(), get_reliable_request(), and register_notify().
typedef void(* util_debug_func_t)(const char *str, void *user_data) |
|
inlinestatic |
Definition at line 105 of file util.h.
References be16_to_cpu, and get_unaligned.
|
inlinestatic |
Definition at line 115 of file util.h.
References be32_to_cpu, and get_unaligned.
|
inlinestatic |
Definition at line 125 of file util.h.
References be64_to_cpu, and get_unaligned.
|
inlinestatic |
Definition at line 100 of file util.h.
References get_unaligned, and le16_to_cpu.
Referenced by bt_gatt_iter_next_characteristic(), bt_gatt_iter_next_descriptor(), bt_gatt_iter_next_included_service(), bt_gatt_iter_next_read_by_type(), bt_gatt_iter_next_service(), discover_chrcs_cb(), discover_descs_cb(), discover_included_cb(), find_by_type_val_cb(), gatt_db_attribute_get_char_data(), gatt_db_attribute_get_incl_data(), gatt_db_attribute_get_service_uuid(), le_to_uuid(), mtu_cb(), notify_handler(), prepare_write_cb(), read_by_grp_type_cb(), read_by_type_cb(), read_included_cb(), and service_changed_cb().
|
inlinestatic |
Definition at line 110 of file util.h.
References get_unaligned, and le32_to_cpu.
Referenced by bt_crypto_g2(), handle_signed(), and le_to_uuid().
|
inlinestatic |
Definition at line 120 of file util.h.
References get_unaligned, and le64_to_cpu.
|
inlinestatic |
Definition at line 135 of file util.h.
References cpu_to_be16, and put_unaligned.
|
inlinestatic |
Definition at line 145 of file util.h.
References cpu_to_be32, and put_unaligned.
Referenced by bt_crypto_sign_att().
|
inlinestatic |
Definition at line 155 of file util.h.
References cpu_to_be64, and put_unaligned.
|
inlinestatic |
Definition at line 130 of file util.h.
References cpu_to_le16, and put_unaligned.
Referenced by bt_att_send_error_rsp(), bt_gatt_client_prepare_write(), bt_gatt_client_read_long_value(), bt_gatt_client_read_multiple(), bt_gatt_client_read_value(), bt_gatt_client_write_long_value(), bt_gatt_client_write_value(), bt_gatt_client_write_without_response(), bt_gatt_discover_characteristics(), bt_gatt_discover_descriptors(), bt_gatt_discover_included_services(), bt_gatt_exchange_mtu(), bt_gatt_read_by_type(), discover_chrcs_cb(), discover_descs_cb(), discover_included_cb(), discover_services(), find_by_type_val_cb(), gatt_db_service_add_included(), handle_next_prep_write(), notify_data_write_ccc(), read_by_grp_type_cb(), read_by_type_cb(), read_included_cb(), read_long_cb(), service_insert_characteristic(), and uuid_to_le().
|
inlinestatic |
Definition at line 140 of file util.h.
References cpu_to_le32, and put_unaligned.
Referenced by bt_crypto_sign_att().
|
inlinestatic |
Definition at line 150 of file util.h.
References cpu_to_le64, and put_unaligned.
void util_clear_uid | ( | unsigned int * | bitmap, |
uint8_t | id | ||
) |
void util_debug | ( | util_debug_func_t | function, |
void * | user_data, | ||
const char * | format, | ||
... | |||
) |
unsigned char util_get_dt | ( | const char * | parent, |
const char * | name | ||
) |
uint8_t util_get_uid | ( | unsigned int * | bitmap, |
uint8_t | max | ||
) |
void void util_hexdump | ( | const char | dir, |
const unsigned char * | buf, | ||
size_t | len, | ||
util_debug_func_t | function, | ||
void * | user_data | ||
) |
hexadecimal dump utility: create the str hex string and then call function(str,user_data)
dir | first char of str |
buf | buffer to convert to hex (str) |
len | size of buffer (should be less than or equal to 16) |
function | function to call with (str,user_data) |
user_data | pointer to pass to function |
Definition at line 81 of file util.c.
References timeout_data::user_data.
Referenced by can_read_data(), and can_write_data().