ble_gatt_client
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
hci_lib.h File Reference

Go to the source code of this file.

Data Structures

struct  hci_request
 
struct  hci_version
 

Functions

int hci_open_dev (int dev_id)
 
int hci_close_dev (int dd)
 
int hci_send_cmd (int dd, uint16_t ogf, uint16_t ocf, uint8_t plen, void *param)
 
int hci_send_req (int dd, struct hci_request *req, int timeout)
 
int hci_create_connection (int dd, const bdaddr_t *bdaddr, uint16_t ptype, uint16_t clkoffset, uint8_t rswitch, uint16_t *handle, int to)
 
int hci_disconnect (int dd, uint16_t handle, uint8_t reason, int to)
 
int hci_inquiry (int dev_id, int len, int num_rsp, const uint8_t *lap, inquiry_info **ii, long flags)
 
int hci_devinfo (int dev_id, struct hci_dev_info *di)
 
int hci_devba (int dev_id, bdaddr_t *bdaddr)
 
int hci_devid (const char *str)
 
int hci_read_local_name (int dd, int len, char *name, int to)
 
int hci_write_local_name (int dd, const char *name, int to)
 
int hci_read_remote_name (int dd, const bdaddr_t *bdaddr, int len, char *name, int to)
 
int hci_read_remote_name_with_clock_offset (int dd, const bdaddr_t *bdaddr, uint8_t pscan_rep_mode, uint16_t clkoffset, int len, char *name, int to)
 
int hci_read_remote_name_cancel (int dd, const bdaddr_t *bdaddr, int to)
 
int hci_read_remote_version (int dd, uint16_t handle, struct hci_version *ver, int to)
 
int hci_read_remote_features (int dd, uint16_t handle, uint8_t *features, int to)
 
int hci_read_remote_ext_features (int dd, uint16_t handle, uint8_t page, uint8_t *max_page, uint8_t *features, int to)
 
int hci_read_clock_offset (int dd, uint16_t handle, uint16_t *clkoffset, int to)
 
int hci_read_local_version (int dd, struct hci_version *ver, int to)
 
int hci_read_local_commands (int dd, uint8_t *commands, int to)
 
int hci_read_local_features (int dd, uint8_t *features, int to)
 
int hci_read_local_ext_features (int dd, uint8_t page, uint8_t *max_page, uint8_t *features, int to)
 
int hci_read_bd_addr (int dd, bdaddr_t *bdaddr, int to)
 
int hci_read_class_of_dev (int dd, uint8_t *cls, int to)
 
int hci_write_class_of_dev (int dd, uint32_t cls, int to)
 
int hci_read_voice_setting (int dd, uint16_t *vs, int to)
 
int hci_write_voice_setting (int dd, uint16_t vs, int to)
 
int hci_read_current_iac_lap (int dd, uint8_t *num_iac, uint8_t *lap, int to)
 
int hci_write_current_iac_lap (int dd, uint8_t num_iac, uint8_t *lap, int to)
 
int hci_read_stored_link_key (int dd, bdaddr_t *bdaddr, uint8_t all, int to)
 
int hci_write_stored_link_key (int dd, bdaddr_t *bdaddr, uint8_t *key, int to)
 
int hci_delete_stored_link_key (int dd, bdaddr_t *bdaddr, uint8_t all, int to)
 
int hci_authenticate_link (int dd, uint16_t handle, int to)
 
int hci_encrypt_link (int dd, uint16_t handle, uint8_t encrypt, int to)
 
int hci_change_link_key (int dd, uint16_t handle, int to)
 
int hci_switch_role (int dd, bdaddr_t *bdaddr, uint8_t role, int to)
 
int hci_park_mode (int dd, uint16_t handle, uint16_t max_interval, uint16_t min_interval, int to)
 
int hci_exit_park_mode (int dd, uint16_t handle, int to)
 
int hci_read_inquiry_scan_type (int dd, uint8_t *type, int to)
 
int hci_write_inquiry_scan_type (int dd, uint8_t type, int to)
 
int hci_read_inquiry_mode (int dd, uint8_t *mode, int to)
 
int hci_write_inquiry_mode (int dd, uint8_t mode, int to)
 
int hci_read_afh_mode (int dd, uint8_t *mode, int to)
 
int hci_write_afh_mode (int dd, uint8_t mode, int to)
 
int hci_read_ext_inquiry_response (int dd, uint8_t *fec, uint8_t *data, int to)
 
int hci_write_ext_inquiry_response (int dd, uint8_t fec, uint8_t *data, int to)
 
int hci_read_simple_pairing_mode (int dd, uint8_t *mode, int to)
 
int hci_write_simple_pairing_mode (int dd, uint8_t mode, int to)
 
int hci_read_local_oob_data (int dd, uint8_t *hash, uint8_t *randomizer, int to)
 
int hci_read_inq_response_tx_power_level (int dd, int8_t *level, int to)
 
int hci_read_inquiry_transmit_power_level (int dd, int8_t *level, int to)
 
int hci_write_inquiry_transmit_power_level (int dd, int8_t level, int to)
 
int hci_read_transmit_power_level (int dd, uint16_t handle, uint8_t type, int8_t *level, int to)
 
int hci_read_link_policy (int dd, uint16_t handle, uint16_t *policy, int to)
 
int hci_write_link_policy (int dd, uint16_t handle, uint16_t policy, int to)
 
int hci_read_link_supervision_timeout (int dd, uint16_t handle, uint16_t *timeout, int to)
 
int hci_write_link_supervision_timeout (int dd, uint16_t handle, uint16_t timeout, int to)
 
int hci_set_afh_classification (int dd, uint8_t *map, int to)
 
int hci_read_link_quality (int dd, uint16_t handle, uint8_t *link_quality, int to)
 
int hci_read_rssi (int dd, uint16_t handle, int8_t *rssi, int to)
 
int hci_read_afh_map (int dd, uint16_t handle, uint8_t *mode, uint8_t *map, int to)
 
int hci_read_clock (int dd, uint16_t handle, uint8_t which, uint32_t *clock, uint16_t *accuracy, int to)
 
int hci_le_set_scan_enable (int dev_id, uint8_t enable, uint8_t filter_dup, int to)
 
int hci_le_set_scan_parameters (int dev_id, uint8_t type, uint16_t interval, uint16_t window, uint8_t own_type, uint8_t filter, int to)
 
int hci_le_set_advertise_enable (int dev_id, uint8_t enable, int to)
 
int hci_le_create_conn (int dd, uint16_t interval, uint16_t window, uint8_t initiator_filter, uint8_t peer_bdaddr_type, bdaddr_t peer_bdaddr, uint8_t own_bdaddr_type, uint16_t min_interval, uint16_t max_interval, uint16_t latency, uint16_t supervision_timeout, uint16_t min_ce_length, uint16_t max_ce_length, uint16_t *handle, int to)
 
int hci_le_conn_update (int dd, uint16_t handle, uint16_t min_interval, uint16_t max_interval, uint16_t latency, uint16_t supervision_timeout, int to)
 
int hci_le_add_white_list (int dd, const bdaddr_t *bdaddr, uint8_t type, int to)
 
int hci_le_rm_white_list (int dd, const bdaddr_t *bdaddr, uint8_t type, int to)
 
int hci_le_read_white_list_size (int dd, uint8_t *size, int to)
 
int hci_le_clear_white_list (int dd, int to)
 
int hci_le_add_resolving_list (int dd, const bdaddr_t *bdaddr, uint8_t type, uint8_t *peer_irk, uint8_t *local_irk, int to)
 
int hci_le_rm_resolving_list (int dd, const bdaddr_t *bdaddr, uint8_t type, int to)
 
int hci_le_clear_resolving_list (int dd, int to)
 
int hci_le_read_resolving_list_size (int dd, uint8_t *size, int to)
 
int hci_le_set_address_resolution_enable (int dev_id, uint8_t enable, int to)
 
int hci_le_read_remote_features (int dd, uint16_t handle, uint8_t *features, int to)
 
int hci_for_each_dev (int flag, int(*func)(int dd, int dev_id, long arg), long arg)
 
int hci_get_route (bdaddr_t *bdaddr)
 
char * hci_bustostr (int bus)
 
char * hci_typetostr (int type)
 
char * hci_dtypetostr (int type)
 
char * hci_dflagstostr (uint32_t flags)
 
char * hci_ptypetostr (unsigned int ptype)
 
int hci_strtoptype (char *str, unsigned int *val)
 
char * hci_scoptypetostr (unsigned int ptype)
 
int hci_strtoscoptype (char *str, unsigned int *val)
 
char * hci_lptostr (unsigned int ptype)
 
int hci_strtolp (char *str, unsigned int *val)
 
char * hci_lmtostr (unsigned int ptype)
 
int hci_strtolm (char *str, unsigned int *val)
 
char * hci_cmdtostr (unsigned int cmd)
 
char * hci_commandstostr (uint8_t *commands, char *pref, int width)
 
char * hci_vertostr (unsigned int ver)
 
int hci_strtover (char *str, unsigned int *ver)
 
char * lmp_vertostr (unsigned int ver)
 
int lmp_strtover (char *str, unsigned int *ver)
 
char * pal_vertostr (unsigned int ver)
 
int pal_strtover (char *str, unsigned int *ver)
 
char * lmp_featurestostr (uint8_t *features, char *pref, int width)
 
static void hci_set_bit (int nr, void *addr)
 
static void hci_clear_bit (int nr, void *addr)
 
static int hci_test_bit (int nr, void *addr)
 
static void hci_filter_clear (struct hci_filter *f)
 
static void hci_filter_set_ptype (int t, struct hci_filter *f)
 
static void hci_filter_clear_ptype (int t, struct hci_filter *f)
 
static int hci_filter_test_ptype (int t, struct hci_filter *f)
 
static void hci_filter_all_ptypes (struct hci_filter *f)
 
static void hci_filter_set_event (int e, struct hci_filter *f)
 
static void hci_filter_clear_event (int e, struct hci_filter *f)
 
static int hci_filter_test_event (int e, struct hci_filter *f)
 
static void hci_filter_all_events (struct hci_filter *f)
 
static void hci_filter_set_opcode (int opcode, struct hci_filter *f)
 
static void hci_filter_clear_opcode (struct hci_filter *f)
 
static int hci_filter_test_opcode (int opcode, struct hci_filter *f)
 

Function Documentation

int hci_authenticate_link ( int  dd,
uint16_t  handle,
int  to 
)
char* hci_bustostr ( int  bus)

return a string corresponding to the bus code (see HCI bus types in hci.h)

Parameters
busbus code
Returns
string corresponding to the bus code (NULL if error)

Definition at line 189 of file hci.c.

References HCI_PCCARD, HCI_PCI, HCI_RS232, HCI_SDIO, HCI_UART, HCI_USB, and HCI_VIRTUAL.

Referenced by hci_dtypetostr().

static void hci_clear_bit ( int  nr,
void *  addr 
)
inlinestatic

Definition at line 178 of file hci_lib.h.

Referenced by hci_filter_clear_event(), and hci_filter_clear_ptype().

int hci_close_dev ( int  dd)

Close the device

Parameters
ddDevice descriptor returned by hci_open_dev.
Returns
0 if OK or -1 if failure

Definition at line 1326 of file hci.c.

char* hci_cmdtostr ( unsigned int  cmd)

translate a command code into an english sentence

use the commands_map table which is an array of structures { "english sentence", command code }

Parameters
cmdcommand code value
Returns
english sentence corresponding to the command code (NULL if error)

Definition at line 722 of file hci.c.

References hci_uint2str().

char* hci_commandstostr ( uint8_t *  commands,
char *  pref,
int  width 
)

translate a byte array of bit "commands" into a series of corresponding english strings which is returned

Parameters
commandsan array of bytes corresponding to a list of encoded commands
prefprefix to add to str (if pref !=NULL pref will be the first concatenated string)
width
Returns
NULL if error else str which is a string of concatenated commands separated by /0

Definition at line 735 of file hci.c.

References bt_malloc(), commands_map, hci_map::str, and hci_map::val.

int hci_create_connection ( int  dd,
const bdaddr_t *  bdaddr,
uint16_t  ptype,
uint16_t  clkoffset,
uint8_t  rswitch,
uint16_t *  handle,
int  to 
)
int hci_delete_stored_link_key ( int  dd,
bdaddr_t *  bdaddr,
uint8_t  all,
int  to 
)
int hci_devba ( int  dev_id,
bdaddr_t *  bdaddr 
)
Parameters
dev_id
bdaddr
Returns
0 = OK, -1 = Error

Definition at line 1182 of file hci.c.

References bacpy(), hci_dev_info::bdaddr, hci_dev_info::flags, hci_devinfo(), hci_test_bit(), and HCI_UP.

Referenced by hci_devid(), and main().

int hci_devid ( const char *  str)

return the bt device number

Parameters
strstring should be hci<n>
Returns
bt device number (-1 if error)

Definition at line 1130 of file hci.c.

References __same_bdaddr(), hci_devba(), hci_for_each_dev(), HCI_UP, and str2ba().

Referenced by main().

int hci_devinfo ( int  dev_id,
struct hci_dev_info di 
)

get device info given device id

Parameters
dev_iddevice id
didevice info structure if ok
Returns
0 info structure set else error

Definition at line 1155 of file hci.c.

References AF_BLUETOOTH, BTPROTO_HCI, hci_dev_info::dev_id, and HCIGETDEVINFO.

Referenced by hci_devba().

char* hci_dflagstostr ( uint32_t  flags)

return the HCI device flags string given its code

Parameters
flagsHCI device flags code
Returns
HCI device flags string (NULL if error)

Definition at line 260 of file hci.c.

References bt_malloc(), dev_flags_map, hci_test_bit(), HCI_UP, hci_map::str, and hci_map::val.

int hci_disconnect ( int  dd,
uint16_t  handle,
uint8_t  reason,
int  to 
)
char* hci_dtypetostr ( int  type)

return the bus string according to the bus code (type)

Parameters
typebus code
Returns
bus string (NULL if error)

Definition at line 217 of file hci.c.

References hci_bustostr().

int hci_encrypt_link ( int  dd,
uint16_t  handle,
uint8_t  encrypt,
int  to 
)
int hci_exit_park_mode ( int  dd,
uint16_t  handle,
int  to 
)
static void hci_filter_all_events ( struct hci_filter f)
inlinestatic

Definition at line 221 of file hci_lib.h.

References hci_filter::event_mask.

static void hci_filter_all_ptypes ( struct hci_filter f)
inlinestatic

Definition at line 205 of file hci_lib.h.

References hci_filter::type_mask.

static void hci_filter_clear ( struct hci_filter f)
inlinestatic

Definition at line 189 of file hci_lib.h.

Referenced by hci_send_req().

static void hci_filter_clear_event ( int  e,
struct hci_filter f 
)
inlinestatic

Definition at line 213 of file hci_lib.h.

References hci_filter::event_mask, hci_clear_bit(), and HCI_FLT_EVENT_BITS.

static void hci_filter_clear_opcode ( struct hci_filter f)
inlinestatic

Definition at line 229 of file hci_lib.h.

References hci_filter::opcode.

static void hci_filter_clear_ptype ( int  t,
struct hci_filter f 
)
inlinestatic

Definition at line 197 of file hci_lib.h.

References hci_clear_bit(), HCI_FLT_TYPE_BITS, HCI_VENDOR_PKT, and hci_filter::type_mask.

static void hci_filter_set_event ( int  e,
struct hci_filter f 
)
inlinestatic

Definition at line 209 of file hci_lib.h.

References hci_filter::event_mask, HCI_FLT_EVENT_BITS, and hci_set_bit().

Referenced by hci_send_req().

static void hci_filter_set_opcode ( int  opcode,
struct hci_filter f 
)
inlinestatic

Definition at line 225 of file hci_lib.h.

References opcode, and hci_filter::opcode.

Referenced by hci_send_req().

static void hci_filter_set_ptype ( int  t,
struct hci_filter f 
)
inlinestatic

Definition at line 193 of file hci_lib.h.

References HCI_FLT_TYPE_BITS, hci_set_bit(), HCI_VENDOR_PKT, and hci_filter::type_mask.

Referenced by hci_send_req().

static int hci_filter_test_event ( int  e,
struct hci_filter f 
)
inlinestatic

Definition at line 217 of file hci_lib.h.

References hci_filter::event_mask, HCI_FLT_EVENT_BITS, and hci_test_bit().

static int hci_filter_test_opcode ( int  opcode,
struct hci_filter f 
)
inlinestatic

Definition at line 233 of file hci_lib.h.

References hci_filter::opcode.

static int hci_filter_test_ptype ( int  t,
struct hci_filter f 
)
inlinestatic

Definition at line 201 of file hci_lib.h.

References HCI_FLT_TYPE_BITS, hci_test_bit(), HCI_VENDOR_PKT, and hci_filter::type_mask.

int hci_for_each_dev ( int  flag,
int(*)(int dd, int dev_id, long arg)  func,
long  arg 
)

return the bt device number

Parameters
flag
func
arg
Returns

Definition at line 1019 of file hci.c.

References AF_BLUETOOTH, BTPROTO_HCI, hci_dev_req::dev_id, hci_dev_list_req::dev_num, hci_dev_req::dev_opt, hci_dev_list_req::dev_req, func, HCI_MAX_DEV, hci_test_bit(), and HCIGETDEVLIST.

Referenced by hci_devid(), and hci_get_route().

int hci_get_route ( bdaddr_t *  bdaddr)
Parameters
bdaddr
Returns

Definition at line 1111 of file hci.c.

References __other_bdaddr(), __same_bdaddr(), BDADDR_ANY, hci_dev_info::dev_id, hci_for_each_dev(), and HCI_UP.

Referenced by hci_inquiry().

int hci_inquiry ( int  dev_id,
int  len,
int  nrsp,
const uint8_t *  lap,
inquiry_info **  ii,
long  flags 
)
int hci_le_add_resolving_list ( int  dd,
const bdaddr_t *  bdaddr,
uint8_t  type,
uint8_t *  peer_irk,
uint8_t *  local_irk,
int  to 
)
int hci_le_add_white_list ( int  dd,
const bdaddr_t *  bdaddr,
uint8_t  type,
int  to 
)
int hci_le_clear_resolving_list ( int  dd,
int  to 
)
Parameters
dd
to
Returns

Definition at line 1843 of file hci.c.

References hci_send_req(), hci_request::ocf, OCF_LE_CLEAR_RESOLV_LIST, hci_request::ogf, OGF_LE_CTL, hci_request::rlen, and hci_request::rparam.

int hci_le_clear_white_list ( int  dd,
int  to 
)
Parameters
dd
to
Returns

Definition at line 1731 of file hci.c.

References hci_send_req(), hci_request::ocf, OCF_LE_CLEAR_WHITE_LIST, hci_request::ogf, OGF_LE_CTL, hci_request::rlen, and hci_request::rparam.

int hci_le_conn_update ( int  dd,
uint16_t  handle,
uint16_t  min_interval,
uint16_t  max_interval,
uint16_t  latency,
uint16_t  supervision_timeout,
int  to 
)
Parameters
dd
handle
min_interval
max_interval
latency
supervision_timeout
to
Returns

Definition at line 3936 of file hci.c.

References hci_request::clen, hci_request::cparam, hci_request::event, EVT_LE_CONN_UPDATE_COMPLETE, hci_send_req(), htobs, LE_CONN_UPDATE_CP_SIZE, hci_request::ocf, OCF_LE_CONN_UPDATE, hci_request::ogf, OGF_LE_CTL, hci_request::rlen, and hci_request::rparam.

int hci_le_create_conn ( int  dd,
uint16_t  interval,
uint16_t  window,
uint8_t  initiator_filter,
uint8_t  peer_bdaddr_type,
bdaddr_t  peer_bdaddr,
uint8_t  own_bdaddr_type,
uint16_t  min_interval,
uint16_t  max_interval,
uint16_t  latency,
uint16_t  supervision_timeout,
uint16_t  min_ce_length,
uint16_t  max_ce_length,
uint16_t *  handle,
int  to 
)
Parameters
dd
interval
window
initiator_filter
peer_bdaddr_type
peer_bdaddr
own_bdaddr_type
min_interval
max_interval
latency
supervision_timeout
min_ce_length
max_ce_length
handle
to
Returns

Definition at line 3875 of file hci.c.

References hci_request::clen, hci_request::cparam, hci_request::event, EVT_CONN_COMPLETE_SIZE, EVT_LE_CONN_COMPLETE, hci_send_req(), LE_CREATE_CONN_CP_SIZE, hci_request::ocf, OCF_LE_CREATE_CONN, hci_request::ogf, OGF_LE_CTL, hci_request::rlen, and hci_request::rparam.

int hci_le_read_remote_features ( int  dd,
uint16_t  handle,
uint8_t *  features,
int  to 
)
int hci_le_read_resolving_list_size ( int  dd,
uint8_t *  size,
int  to 
)
int hci_le_read_white_list_size ( int  dd,
uint8_t *  size,
int  to 
)
int hci_le_rm_resolving_list ( int  dd,
const bdaddr_t *  bdaddr,
uint8_t  type,
int  to 
)
int hci_le_rm_white_list ( int  dd,
const bdaddr_t *  bdaddr,
uint8_t  type,
int  to 
)
int hci_le_set_address_resolution_enable ( int  dd,
uint8_t  enable,
int  to 
)
int hci_le_set_advertise_enable ( int  dd,
uint8_t  enable,
int  to 
)
int hci_le_set_scan_enable ( int  dd,
uint8_t  enable,
uint8_t  filter_dup,
int  to 
)
int hci_le_set_scan_parameters ( int  dd,
uint8_t  type,
uint16_t  interval,
uint16_t  window,
uint8_t  own_type,
uint8_t  filter,
int  to 
)
char* hci_lmtostr ( unsigned int  lm)

return the Link mode mapping string given the code

Parameters
lmLink mode mapping code
Returns
Link mode mapping string (NULL if error)

Definition at line 415 of file hci.c.

References bt_free(), bt_malloc(), hci_bit2str(), and HCI_LM_MASTER.

char* hci_lptostr ( unsigned int  lp)

return the Link policy mapping string given the code

Parameters
lpLink policy mapping code
Returns
Link policy mapping string (NULL if error)

Definition at line 379 of file hci.c.

References hci_bit2str().

int hci_open_dev ( int  dev_id)

Open HCI device.

Parameters
dev_idinteger device address
Returns
device descriptor (dd): a bluetooth socket

Definition at line 1287 of file hci.c.

References AF_BLUETOOTH, BTPROTO_HCI, sockaddr_hci::hci_dev, and sockaddr_hci::hci_family.

int hci_park_mode ( int  dd,
uint16_t  handle,
uint16_t  max_interval,
uint16_t  min_interval,
int  to 
)
char* hci_ptypetostr ( unsigned int  ptype)

return the HCI packet type string given the code

Parameters
ptypeHCI packet type
Returns
HCI packet type string (NULL if error)

Definition at line 323 of file hci.c.

References hci_bit2str().

int hci_read_afh_map ( int  dd,
uint16_t  handle,
uint8_t *  mode,
uint8_t *  map,
int  to 
)
int hci_read_afh_mode ( int  dd,
uint8_t *  mode,
int  to 
)
int hci_read_bd_addr ( int  dd,
bdaddr_t *  bdaddr,
int  to 
)
int hci_read_class_of_dev ( int  dd,
uint8_t *  cls,
int  to 
)
int hci_read_clock ( int  dd,
uint16_t  handle,
uint8_t  which,
uint32_t *  clock,
uint16_t *  accuracy,
int  to 
)
int hci_read_clock_offset ( int  dd,
uint16_t  handle,
uint16_t *  clkoffset,
int  to 
)
int hci_read_current_iac_lap ( int  dd,
uint8_t *  num_iac,
uint8_t *  lap,
int  to 
)
int hci_read_ext_inquiry_response ( int  dd,
uint8_t *  fec,
uint8_t *  data,
int  to 
)
int hci_read_inq_response_tx_power_level ( int  dd,
int8_t *  level,
int  to 
)
int hci_read_inquiry_mode ( int  dd,
uint8_t *  mode,
int  to 
)
int hci_read_inquiry_scan_type ( int  dd,
uint8_t *  type,
int  to 
)
int hci_read_inquiry_transmit_power_level ( int  dd,
int8_t *  level,
int  to 
)
Parameters
dd
level
to
Returns

Definition at line 3322 of file hci.c.

References hci_read_inq_response_tx_power_level().

int hci_read_link_policy ( int  dd,
uint16_t  handle,
uint16_t *  policy,
int  to 
)
int hci_read_link_quality ( int  dd,
uint16_t  handle,
uint8_t *  link_quality,
int  to 
)
int hci_read_link_supervision_timeout ( int  dd,
uint16_t  handle,
uint16_t *  timeout,
int  to 
)
int hci_read_local_commands ( int  dd,
uint8_t *  commands,
int  to 
)
int hci_read_local_ext_features ( int  dd,
uint8_t  page,
uint8_t *  max_page,
uint8_t *  features,
int  to 
)
int hci_read_local_features ( int  dd,
uint8_t *  features,
int  to 
)
int hci_read_local_name ( int  dd,
int  len,
char *  name,
int  to 
)
int hci_read_local_oob_data ( int  dd,
uint8_t *  hash,
uint8_t *  randomizer,
int  to 
)
Parameters
dd
hash
randomizer
to
Returns

Definition at line 3259 of file hci.c.

References hci_send_req(), hci_request::ocf, OCF_READ_LOCAL_OOB_DATA, hci_request::ogf, OGF_HOST_CTL, READ_LOCAL_OOB_DATA_RP_SIZE, hci_request::rlen, and hci_request::rparam.

int hci_read_remote_ext_features ( int  dd,
uint16_t  handle,
uint8_t  page,
uint8_t *  max_page,
uint8_t *  features,
int  to 
)
int hci_read_remote_features ( int  dd,
uint16_t  handle,
uint8_t *  features,
int  to 
)
int hci_read_remote_name ( int  dd,
const bdaddr_t *  bdaddr,
int  len,
char *  name,
int  to 
)
Parameters
dd
bdaddr
len
name
to
Returns

Definition at line 2053 of file hci.c.

References hci_read_remote_name_with_clock_offset().

int hci_read_remote_name_cancel ( int  dd,
const bdaddr_t *  bdaddr,
int  to 
)
int hci_read_remote_name_with_clock_offset ( int  dd,
const bdaddr_t *  bdaddr,
uint8_t  pscan_rep_mode,
uint16_t  clkoffset,
int  len,
char *  name,
int  to 
)
int hci_read_rssi ( int  dd,
uint16_t  handle,
int8_t *  rssi,
int  to 
)
int hci_read_simple_pairing_mode ( int  dd,
uint8_t *  mode,
int  to 
)
int hci_read_stored_link_key ( int  dd,
bdaddr_t *  bdaddr,
uint8_t  all,
int  to 
)
int hci_read_transmit_power_level ( int  dd,
uint16_t  handle,
uint8_t  type,
int8_t *  level,
int  to 
)
int hci_read_voice_setting ( int  dd,
uint16_t *  vs,
int  to 
)
char* hci_scoptypetostr ( unsigned int  ptype)

return the SCO (synchronous connection orientated) links string given the code

Parameters
ptypeSCO type code
Returns
SCO string (NULL if error)

Definition at line 346 of file hci.c.

References hci_bit2str().

int hci_send_cmd ( int  dd,
uint16_t  ogf,
uint16_t  ocf,
uint8_t  plen,
void *  param 
)
Parameters
ddDevice descriptor returned by hci_open_dev.
ogf
ocf
plen
param
Returns

Definition at line 1343 of file hci.c.

References cmd_opcode_pack, HCI_COMMAND_HDR_SIZE, HCI_COMMAND_PKT, htobs, and type.

Referenced by hci_send_req().

int hci_send_req ( int  dd,
struct hci_request r,
int  to 
)
Parameters
dd
r
to
Returns

Definition at line 1381 of file hci.c.

References bacmp(), hci_request::clen, cmd_opcode_pack, hci_request::cparam, hci_request::event, EVT_CMD_COMPLETE, EVT_CMD_COMPLETE_SIZE, EVT_CMD_STATUS, EVT_LE_META_EVENT, EVT_REMOTE_NAME_REQ_COMPLETE, HCI_EVENT_HDR_SIZE, HCI_EVENT_PKT, HCI_FILTER, hci_filter_clear(), hci_filter_set_event(), hci_filter_set_opcode(), hci_filter_set_ptype(), HCI_MAX_EVENT_SIZE, hci_send_cmd(), htobs, MIN, hci_request::ocf, hci_request::ogf, opcode, hci_request::rlen, hci_request::rparam, and SOL_HCI.

Referenced by hci_authenticate_link(), hci_change_link_key(), hci_create_connection(), hci_delete_stored_link_key(), hci_disconnect(), hci_encrypt_link(), hci_exit_park_mode(), hci_le_add_resolving_list(), hci_le_add_white_list(), hci_le_clear_resolving_list(), hci_le_clear_white_list(), hci_le_conn_update(), hci_le_create_conn(), hci_le_read_remote_features(), hci_le_read_resolving_list_size(), hci_le_read_white_list_size(), hci_le_rm_resolving_list(), hci_le_rm_white_list(), hci_le_set_address_resolution_enable(), hci_le_set_advertise_enable(), hci_le_set_scan_enable(), hci_le_set_scan_parameters(), hci_park_mode(), hci_read_afh_map(), hci_read_afh_mode(), hci_read_bd_addr(), hci_read_class_of_dev(), hci_read_clock(), hci_read_clock_offset(), hci_read_current_iac_lap(), hci_read_ext_inquiry_response(), hci_read_inq_response_tx_power_level(), hci_read_inquiry_mode(), hci_read_inquiry_scan_type(), hci_read_link_policy(), hci_read_link_quality(), hci_read_link_supervision_timeout(), hci_read_local_commands(), hci_read_local_ext_features(), hci_read_local_features(), hci_read_local_name(), hci_read_local_oob_data(), hci_read_local_version(), hci_read_remote_ext_features(), hci_read_remote_features(), hci_read_remote_name_cancel(), hci_read_remote_name_with_clock_offset(), hci_read_remote_version(), hci_read_rssi(), hci_read_simple_pairing_mode(), hci_read_stored_link_key(), hci_read_transmit_power_level(), hci_read_voice_setting(), hci_set_afh_classification(), hci_switch_role(), hci_write_afh_mode(), hci_write_class_of_dev(), hci_write_current_iac_lap(), hci_write_ext_inquiry_response(), hci_write_inquiry_mode(), hci_write_inquiry_scan_type(), hci_write_inquiry_transmit_power_level(), hci_write_link_policy(), hci_write_link_supervision_timeout(), hci_write_local_name(), hci_write_simple_pairing_mode(), hci_write_stored_link_key(), and hci_write_voice_setting().

int hci_set_afh_classification ( int  dd,
uint8_t *  map,
int  to 
)
static void hci_set_bit ( int  nr,
void *  addr 
)
inlinestatic

Definition at line 173 of file hci_lib.h.

Referenced by hci_filter_set_event(), and hci_filter_set_ptype().

int hci_strtolm ( char *  str,
unsigned int *  val 
)

retrun Link mode mapping code given the tring

Parameters
strLink mode mapping string
valLink mode mapping code
Returns
1 match found, 0 error

Definition at line 443 of file hci.c.

References hci_str2bit().

int hci_strtolp ( char *  str,
unsigned int *  val 
)

return Link policy mapping code given the string

Parameters
strLink policy mapping string
valLink policy mapping code
Returns
1 match found 0 error

Definition at line 391 of file hci.c.

References hci_str2bit().

int hci_strtoptype ( char *  str,
unsigned int *  val 
)

return the HCI packet type code given the string

Parameters
strHCI packet type string
valHCI packet type code
Returns
1 if found 0 error

Definition at line 335 of file hci.c.

References hci_str2bit().

int hci_strtoscoptype ( char *  str,
unsigned int *  val 
)

return the SCO (synchronous connection orientated) links code given the string

Parameters
strSCO (synchronous connection orientated) links string
valSCO (synchronous connection orientated) links code
Returns
1 match found 0 error

Definition at line 358 of file hci.c.

References hci_str2bit().

int hci_strtover ( char *  str,
unsigned int *  ver 
)

return the version code given the string

Parameters
strversion string
verversion code
Returns
1 of match found, 0 error

Definition at line 809 of file hci.c.

References hci_str2uint().

int hci_switch_role ( int  dd,
bdaddr_t *  bdaddr,
uint8_t  role,
int  to 
)
static int hci_test_bit ( int  nr,
void *  addr 
)
inlinestatic
char* hci_typetostr ( int  type)

return the bluetooth type string give the code (see HCI controller types in hci.h)

Parameters
typeHCI controller types
Returns
corresponding string (NULL if error)

Definition at line 228 of file hci.c.

References HCI_AMP, and HCI_BREDR.

char* hci_vertostr ( unsigned int  ver)

translate a version code into a mapping string

Parameters
verversion code
Returns
mapping string (NULL if error)

Definition at line 797 of file hci.c.

References hci_uint2str().

int hci_write_afh_mode ( int  dd,
uint8_t  mode,
int  to 
)
int hci_write_class_of_dev ( int  dd,
uint32_t  cls,
int  to 
)
int hci_write_current_iac_lap ( int  dd,
uint8_t  num_iac,
uint8_t *  lap,
int  to 
)
Parameters
dd
num_iac
lap
to
Returns

Definition at line 2588 of file hci.c.

References hci_request::clen, hci_request::cparam, hci_send_req(), hci_request::ocf, OCF_WRITE_CURRENT_IAC_LAP, hci_request::ogf, and OGF_HOST_CTL.

int hci_write_ext_inquiry_response ( int  dd,
uint8_t  fec,
uint8_t *  data,
int  to 
)
int hci_write_inquiry_mode ( int  dd,
uint8_t  mode,
int  to 
)
int hci_write_inquiry_scan_type ( int  dd,
uint8_t  type,
int  to 
)
int hci_write_inquiry_transmit_power_level ( int  dd,
int8_t  level,
int  to 
)
int hci_write_link_policy ( int  dd,
uint16_t  handle,
uint16_t  policy,
int  to 
)
int hci_write_link_supervision_timeout ( int  dd,
uint16_t  handle,
uint16_t  timeout,
int  to 
)
int hci_write_local_name ( int  dd,
const char *  name,
int  to 
)
int hci_write_simple_pairing_mode ( int  dd,
uint8_t  mode,
int  to 
)
int hci_write_stored_link_key ( int  dd,
bdaddr_t *  bdaddr,
uint8_t *  key,
int  to 
)
int hci_write_voice_setting ( int  dd,
uint16_t  vs,
int  to 
)
char* lmp_featurestostr ( uint8_t *  features,
char *  pref,
int  width 
)

Link Manager Protocol feature string given code

Parameters
featuresLink Manager Protocol feature code
prefprefix
width
Returns
Link Manager Protocol string or NULL if error

Definition at line 962 of file hci.c.

References bt_malloc(), hci_map::str, and hci_map::val.

int lmp_strtover ( char *  str,
unsigned int *  ver 
)

Link Manager Protocol code given the string

Parameters
strversion string
verversion code
Returns
1 of match found, 0 error

Definition at line 832 of file hci.c.

References hci_str2uint().

char* lmp_vertostr ( unsigned int  ver)

Link Manager Protocol version (same as hci) string given the code

Parameters
verversion code
Returns
mapping string (NULL if error)

Definition at line 820 of file hci.c.

References hci_uint2str().

int pal_strtover ( char *  str,
unsigned int *  ver 
)

pal version code given string

Parameters
strpal version string
verpal version code
Returns
1 pal version code is set 0 error

Definition at line 860 of file hci.c.

References hci_str2uint().

char* pal_vertostr ( unsigned int  ver)

pal version string given code

Parameters
verpal version code
Returns
pal version string or NULL if error

Definition at line 848 of file hci.c.

References hci_uint2str().