RetroArch
Classes | Macros | Typedefs | Enumerations | Functions | Variables
btstack_hid.c File Reference
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#include <string.h>
#include <sys/time.h>
#include <boolean.h>
#include <retro_miscellaneous.h>
#include <rthreads/rthreads.h>
#include <string/stdstring.h>
#include "../input_defines.h"
#include "../input_driver.h"
#include "../connect/joypad_connection.h"
Include dependency graph for btstack_hid.c:

Classes

struct  hci_cmd_t
 
struct  linked_item
 
struct  data_source
 
struct  timer
 
struct  btstack_hid
 
struct  btpad_queue_command
 
struct  btstack_hid_adapter
 

Macros

#define BUILDING_BTDYNAMIC
 
#define BD_ADDR_LEN   6
 
#define LINK_KEY_LEN   16
 
#define DEVICE_NAME_LEN   248
 
#define BTDIMPORT
 
#define HCI_COMMAND_DATA_PACKET   0x01
 
#define HCI_ACL_DATA_PACKET   0x02
 
#define HCI_SCO_DATA_PACKET   0x03
 
#define HCI_EVENT_PACKET   0x04
 
#define DAEMON_EVENT_PACKET   0x05
 
#define L2CAP_DATA_PACKET   0x06
 
#define RFCOMM_DATA_PACKET   0x07
 
#define ATT_DATA_PACKET   0x08
 
#define SM_DATA_PACKET   0x09
 
#define LOG_MESSAGE_PACKET   0xFC
 
#define PSM_SDP   0x01
 
#define PSM_RFCOMM   0x03
 
#define PSM_HID_CONTROL   0x11
 
#define PSM_HID_INTERRUPT   0x13
 
#define HCI_EVENT_INQUIRY_COMPLETE   0x01
 
#define HCI_EVENT_INQUIRY_RESULT   0x02
 
#define HCI_EVENT_CONNECTION_COMPLETE   0x03
 
#define HCI_EVENT_CONNECTION_REQUEST   0x04
 
#define HCI_EVENT_DISCONNECTION_COMPLETE   0x05
 
#define HCI_EVENT_AUTHENTICATION_COMPLETE_EVENT   0x06
 
#define HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE   0x07
 
#define HCI_EVENT_ENCRYPTION_CHANGE   0x08
 
#define HCI_EVENT_CHANGE_CONNECTION_LINK_KEY_COMPLETE   0x09
 
#define HCI_EVENT_MASTER_LINK_KEY_COMPLETE   0x0A
 
#define HCI_EVENT_READ_REMOTE_SUPPORTED_FEATURES_COMPLETE   0x0B
 
#define HCI_EVENT_READ_REMOTE_VERSION_INFORMATION_COMPLETE   0x0C
 
#define HCI_EVENT_QOS_SETUP_COMPLETE   0x0D
 
#define HCI_EVENT_COMMAND_COMPLETE   0x0E
 
#define HCI_EVENT_COMMAND_STATUS   0x0F
 
#define HCI_EVENT_HARDWARE_ERROR   0x10
 
#define HCI_EVENT_FLUSH_OCCURED   0x11
 
#define HCI_EVENT_ROLE_CHANGE   0x12
 
#define HCI_EVENT_NUMBER_OF_COMPLETED_PACKETS   0x13
 
#define HCI_EVENT_MODE_CHANGE_EVENT   0x14
 
#define HCI_EVENT_RETURN_LINK_KEYS   0x15
 
#define HCI_EVENT_PIN_CODE_REQUEST   0x16
 
#define HCI_EVENT_LINK_KEY_REQUEST   0x17
 
#define HCI_EVENT_LINK_KEY_NOTIFICATION   0x18
 
#define HCI_EVENT_DATA_BUFFER_OVERFLOW   0x1A
 
#define HCI_EVENT_MAX_SLOTS_CHANGED   0x1B
 
#define HCI_EVENT_READ_CLOCK_OFFSET_COMPLETE   0x1C
 
#define HCI_EVENT_PACKET_TYPE_CHANGED   0x1D
 
#define HCI_EVENT_INQUIRY_RESULT_WITH_RSSI   0x22
 
#define HCI_EVENT_EXTENDED_INQUIRY_RESPONSE   0x2F
 
#define HCI_EVENT_LE_META   0x3E
 
#define HCI_EVENT_VENDOR_SPECIFIC   0xFF
 
#define HCI_SUBEVENT_LE_CONNECTION_COMPLETE   0x01
 
#define HCI_SUBEVENT_LE_ADVERTISING_REPORT   0x02
 
#define HCI_SUBEVENT_LE_CONNECTION_UPDATE_COMPLETE   0x03
 
#define HCI_SUBEVENT_LE_READ_REMOTE_USED_FEATURES_COMPLETE   0x04
 
#define HCI_SUBEVENT_LE_LONG_TERM_KEY_REQUEST   0x05
 
#define BTSTACK_EVENT_STATE   0x60
 
#define BTSTACK_EVENT_NR_CONNECTIONS_CHANGED   0x61
 
#define BTSTACK_EVENT_POWERON_FAILED   0x62
 
#define BTSTACK_EVENT_VERSION   0x63
 
#define BTSTACK_EVENT_SYSTEM_BLUETOOTH_ENABLED   0x64
 
#define BTSTACK_EVENT_REMOTE_NAME_CACHED   0x65
 
#define BTSTACK_EVENT_DISCOVERABLE_ENABLED   0x66
 
#define L2CAP_EVENT_CHANNEL_OPENED   0x70
 
#define L2CAP_EVENT_CHANNEL_CLOSED   0x71
 
#define L2CAP_EVENT_INCOMING_CONNECTION   0x72
 
#define L2CAP_EVENT_TIMEOUT_CHECK   0x73
 
#define L2CAP_EVENT_CREDITS   0x74
 
#define L2CAP_EVENT_SERVICE_REGISTERED   0x75
 
#define RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE   0x80
 
#define RFCOMM_EVENT_CHANNEL_CLOSED   0x81
 
#define RFCOMM_EVENT_INCOMING_CONNECTION   0x82
 
#define RFCOMM_EVENT_REMOTE_LINE_STATUS   0x83
 
#define RFCOMM_EVENT_CREDITS   0x84
 
#define RFCOMM_EVENT_SERVICE_REGISTERED   0x85
 
#define RFCOMM_EVENT_PERSISTENT_CHANNEL   0x86
 
#define SDP_SERVICE_REGISTERED   0x90
 
#define BTSTACK_CONNECTION_TO_BTDAEMON_FAILED   0x50
 
#define BTSTACK_ACTIVATION_FAILED_SYSTEM_BLUETOOTH   0x51
 
#define BTSTACK_ACTIVATION_POWERON_FAILED   0x52
 
#define BTSTACK_ACTIVATION_FAILED_UNKNOWN   0x53
 
#define BTSTACK_NOT_ACTIVATED   0x54
 
#define BTSTACK_BUSY   0x55
 
#define BTSTACK_MEMORY_ALLOC_FAILED   0x56
 
#define BTSTACK_ACL_BUFFERS_FULL   0x57
 
#define L2CAP_COMMAND_REJECT_REASON_COMMAND_NOT_UNDERSTOOD   0x60
 
#define L2CAP_COMMAND_REJECT_REASON_SIGNALING_MTU_EXCEEDED   0x61
 
#define L2CAP_COMMAND_REJECT_REASON_INVALID_CID_IN_REQUEST   0x62
 
#define L2CAP_CONNECTION_RESPONSE_RESULT_SUCCESSFUL   0x63
 
#define L2CAP_CONNECTION_RESPONSE_RESULT_PENDING   0x64
 
#define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_PSM   0x65
 
#define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_SECURITY   0x66
 
#define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_RESOURCES   0x65
 
#define L2CAP_CONFIG_RESPONSE_RESULT_SUCCESSFUL   0x66
 
#define L2CAP_CONFIG_RESPONSE_RESULT_UNACCEPTABLE_PARAMS   0x67
 
#define L2CAP_CONFIG_RESPONSE_RESULT_REJECTED   0x68
 
#define L2CAP_CONFIG_RESPONSE_RESULT_UNKNOWN_OPTIONS   0x69
 
#define L2CAP_SERVICE_ALREADY_REGISTERED   0x6a
 
#define RFCOMM_MULTIPLEXER_STOPPED   0x70
 
#define RFCOMM_CHANNEL_ALREADY_REGISTERED   0x71
 
#define RFCOMM_NO_OUTGOING_CREDITS   0x72
 
#define SDP_HANDLE_ALREADY_REGISTERED   0x80
 
#define HCI_INQUIRY_LAP   0x9E8B33L
 
#define READ_BT_16(buffer, pos)   ( ((uint16_t) buffer[pos]) | (((uint16_t)buffer[pos+1]) << 8))
 
#define READ_BT_24(buffer, pos)   ( ((uint32_t) buffer[pos]) | (((uint32_t)buffer[pos+1]) << 8) | (((uint32_t)buffer[pos+2]) << 16))
 
#define READ_BT_32(buffer, pos)   ( ((uint32_t) buffer[pos]) | (((uint32_t)buffer[pos+1]) << 8) | (((uint32_t)buffer[pos+2]) << 16) | (((uint32_t) buffer[pos+3])) << 24)
 
#define READ_NET_16(buffer, pos)   ( ((uint16_t) buffer[pos+1]) | (((uint16_t)buffer[pos ]) << 8))
 
#define READ_NET_32(buffer, pos)   ( ((uint32_t) buffer[pos+3]) | (((uint32_t)buffer[pos+2]) << 8) | (((uint32_t)buffer[pos+1]) << 16) | (((uint32_t) buffer[pos])) << 24)
 
#define READ_CMD_OGF(buffer)   (buffer[1] >> 2)
 
#define READ_CMD_OCF(buffer)   ((buffer[1] & 0x03) << 8 | buffer[0])
 
#define COMMAND_COMPLETE_EVENT(event, cmd)   ( event[0] == HCI_EVENT_COMMAND_COMPLETE && READ_BT_16(event,3) == cmd.opcode)
 
#define COMMAND_STATUS_EVENT(event, cmd)   ( event[0] == HCI_EVENT_COMMAND_STATUS && READ_BT_16(event,4) == cmd.opcode)
 
#define OFFSET_OF_DATA_IN_COMMAND_COMPLETE   5
 
#define READ_ACL_CONNECTION_HANDLE(buffer)   ( READ_BT_16(buffer,0) & 0x0fff)
 
#define READ_ACL_FLAGS(buffer)   ( buffer[1] >> 4 )
 
#define READ_ACL_LENGTH(buffer)   (READ_BT_16(buffer, 2))
 
#define READ_L2CAP_LENGTH(buffer)   ( READ_BT_16(buffer, 4))
 
#define READ_L2CAP_CHANNEL_ID(buffer)   ( READ_BT_16(buffer, 6))
 
#define BD_ADDR_CMP(a, b)   memcmp(a,b, BD_ADDR_LEN)
 
#define BD_ADDR_COPY(dest, src)   memcpy(dest,src,BD_ADDR_LEN)
 
#define BTSTACK_PORT   13333
 
#define BTSTACK_UNIX   "/tmp/BTstack"
 
#define GRAB(A)   {#A, (void**)&A##_ptr}
 

Typedefs

typedef uint16_t hci_con_handle_t
 
typedef uint8_t bd_addr_t[BD_ADDR_LEN]
 
typedef uint8_t link_key_t[LINK_KEY_LEN]
 
typedef uint8_t device_name_t[DEVICE_NAME_LEN+1]
 
typedef void(* btstack_packet_handler_t) (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size)
 
typedef struct linked_item linked_item_t
 
typedef linked_item_tlinked_list_t
 
typedef struct data_source data_source_t
 
typedef struct timer timer_source_t
 
typedef struct btstack_hid btstack_hid_t
 

Enumerations

enum  HCI_POWER_MODE { HCI_POWER_OFF = 0, HCI_POWER_ON, HCI_POWER_SLEEP }
 
enum  HCI_STATE {
  HCI_STATE_OFF = 0, HCI_STATE_INITIALIZING, HCI_STATE_WORKING, HCI_STATE_HALTING,
  HCI_STATE_SLEEPING, HCI_STATE_FALLING_ASLEEP
}
 
enum  RUN_LOOP_TYPE { RUN_LOOP_POSIX = 1, RUN_LOOP_COCOA, RUN_LOOP_EMBEDDED }
 
enum  btpad_state { BTPAD_EMPTY = 0, BTPAD_CONNECTING, BTPAD_CONNECTED }
 

Functions

void linked_item_set_user (linked_item_t *item, void *user_data)
 
voidlinked_item_get_user (linked_item_t *item)
 
int linked_list_empty (linked_list_t *list)
 
void linked_list_add (linked_list_t *list, linked_item_t *item)
 
void linked_list_add_tail (linked_list_t *list, linked_item_t *item)
 
int linked_list_remove (linked_list_t *list, linked_item_t *item)
 
linked_item_tlinked_list_get_last_item (linked_list_t *list)
 
void test_linked_list (void)
 
void run_loop_set_timer (timer_source_t *a, uint32_t timeout_in_ms)
 
void run_loop_set_timer_handler (timer_source_t *ts, void(*process)(timer_source_t *_ts))
 
void run_loop_add_timer (timer_source_t *timer)
 
int run_loop_remove_timer (timer_source_t *timer)
 
void run_loop_init (RUN_LOOP_TYPE type)
 
void run_loop_set_data_source_handler (data_source_t *ds, int(*process)(data_source_t *_ds))
 
void run_loop_add_data_source (data_source_t *dataSource)
 
int run_loop_remove_data_source (data_source_t *dataSource)
 
void run_loop_execute (void)
 
void bt_store_16 (uint8_t *buffer, uint16_t pos, uint16_t value)
 
void bt_store_32 (uint8_t *buffer, uint16_t pos, uint32_t value)
 
void bt_flip_addr (bd_addr_t dest, bd_addr_t src)
 
void net_store_16 (uint8_t *buffer, uint16_t pos, uint16_t value)
 
void net_store_32 (uint8_t *buffer, uint16_t pos, uint32_t value)
 
void hexdump (void *data, int size)
 
void printUUID (uint8_t *uuid)
 
void print_bd_addr (bd_addr_t addr)
 
char * bd_addr_to_str (bd_addr_t addr)
 
int sscan_bd_addr (uint8_t *addr_string, bd_addr_t addr)
 
uint8_t crc8_check (uint8_t *data, uint16_t len, uint8_t check_sum)
 
uint8_t crc8_calc (uint8_t *data, uint16_t len)
 
void bt_use_tcp (const char *address, uint16_t port)
 
int bt_open (void)
 
int bt_close (void)
 
int bt_send_cmd (const hci_cmd_t *cmd,...)
 
btstack_packet_handler_t bt_register_packet_handler (btstack_packet_handler_t handler)
 
void bt_send_acl (uint8_t *data, uint16_t len)
 
void bt_send_l2cap (uint16_t local_cid, uint8_t *data, uint16_t len)
 
void bt_send_rfcomm (uint16_t rfcom_cid, uint8_t *data, uint16_t len)
 
static voidbtstack_get_handle (void)
 
static void btpad_increment_position (uint32_t *ptr)
 
static void btpad_connection_send_control (void *data, uint8_t *data_buf, size_t size)
 
static void btpad_queue_process_cmd (struct btpad_queue_command *cmd)
 
static void btpad_queue_process (void)
 
static void btpad_queue_run (uint32_t count)
 
static void btpad_queue_hci_read_bd_addr (struct btpad_queue_command *cmd)
 
static void btpad_queue_hci_disconnect (struct btpad_queue_command *cmd, uint16_t handle, uint8_t reason)
 
static void btpad_queue_hci_inquiry (struct btpad_queue_command *cmd, uint32_t lap, uint8_t length, uint8_t num_responses)
 
static void btpad_queue_hci_remote_name_request (struct btpad_queue_command *cmd, bd_addr_t bd_addr, uint8_t page_scan_repetition_mode, uint8_t reserved, uint16_t clock_offset)
 
static void btpad_queue_hci_pin_code_request_reply (struct btpad_queue_command *cmd, bd_addr_t bd_addr, bd_addr_t pin)
 
static void btpad_close_connection (struct btstack_hid_adapter *connection)
 
static void btpad_close_all_connections (void)
 
static struct btstack_hid_adapterbtpad_find_empty_connection (void)
 
static struct btstack_hid_adapterbtpad_find_connection_for (uint16_t handle, bd_addr_t address)
 
static void btpad_queue_reset (void)
 
static void btpad_queue_btstack_set_power_mode (struct btpad_queue_command *cmd, uint8_t on)
 
static void btpad_set_inquiry_state (bool on)
 
static void btpad_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size)
 
static bool btstack_try_load (void)
 
static void btstack_thread_stop (void *data)
 
static void btstack_thread_func (void *data)
 
static void btstack_set_poweron (bool on)
 
static bool btstack_hid_joypad_query (void *data, unsigned pad)
 
static const char * btstack_hid_joypad_name (void *data, unsigned pad)
 
static void btstack_hid_joypad_get_buttons (void *data, unsigned port, input_bits_t *state)
 
static bool btstack_hid_joypad_button (void *data, unsigned port, uint16_t joykey)
 
static bool btstack_hid_joypad_rumble (void *data, unsigned pad, enum retro_rumble_effect effect, uint16_t strength)
 
static int16_t btstack_hid_joypad_axis (void *data, unsigned port, uint32_t joyaxis)
 
static void btstack_hid_free (const void *data)
 
static voidbtstack_hid_init (void)
 
static void btstack_hid_poll (void *data)
 

Variables

BTDIMPORT int(* bt_open_ptr )(void)
 
BTDIMPORT void(* bt_close_ptr )(void)
 
BTDIMPORT void(* bt_flip_addr_ptr )(bd_addr_t dest, bd_addr_t src)
 
BTDIMPORT char *(* bd_addr_to_str_ptr )(bd_addr_t addr)
 
BTDIMPORT btstack_packet_handler_t(* bt_register_packet_handler_ptr )(btstack_packet_handler_t handler)
 
BTDIMPORT int(* bt_send_cmd_ptr )(const hci_cmd_t *cmd,...)
 
BTDIMPORT void(* bt_send_l2cap_ptr )(uint16_t local_cid, uint8_t *data, uint16_t len)
 
BTDIMPORT void(* run_loop_init_ptr )(RUN_LOOP_TYPE type)
 
BTDIMPORT void(* run_loop_execute_ptr )(void)
 
BTDIMPORT const hci_cmd_tbtstack_set_power_mode_ptr
 
BTDIMPORT const hci_cmd_thci_delete_stored_link_key_ptr
 
BTDIMPORT const hci_cmd_thci_disconnect_ptr
 
BTDIMPORT const hci_cmd_thci_read_bd_addr_ptr
 
BTDIMPORT const hci_cmd_thci_inquiry_ptr
 
BTDIMPORT const hci_cmd_thci_inquiry_cancel_ptr
 
BTDIMPORT const hci_cmd_thci_pin_code_request_reply_ptr
 
BTDIMPORT const hci_cmd_thci_pin_code_request_negative_reply_ptr
 
BTDIMPORT const hci_cmd_thci_remote_name_request_ptr
 
BTDIMPORT const hci_cmd_thci_remote_name_request_cancel_ptr
 
BTDIMPORT const hci_cmd_thci_write_authentication_enable_ptr
 
BTDIMPORT const hci_cmd_thci_write_inquiry_mode_ptr
 
BTDIMPORT const hci_cmd_tl2cap_create_channel_ptr
 
BTDIMPORT const hci_cmd_tl2cap_register_service_ptr
 
BTDIMPORT const hci_cmd_tl2cap_accept_connection_ptr
 
BTDIMPORT const hci_cmd_tl2cap_decline_connection_ptr
 
const hci_cmd_t btstack_get_state
 
const hci_cmd_t btstack_set_power_mode
 
const hci_cmd_t btstack_set_acl_capture_mode
 
const hci_cmd_t btstack_get_version
 
const hci_cmd_t btstack_get_system_bluetooth_enabled
 
const hci_cmd_t btstack_set_system_bluetooth_enabled
 
const hci_cmd_t btstack_set_discoverable
 
const hci_cmd_t btstack_set_bluetooth_enabled
 
const hci_cmd_t hci_accept_connection_request
 
const hci_cmd_t hci_authentication_requested
 
const hci_cmd_t hci_change_connection_link_key
 
const hci_cmd_t hci_create_connection
 
const hci_cmd_t hci_create_connection_cancel
 
const hci_cmd_t hci_delete_stored_link_key
 
const hci_cmd_t hci_disconnect
 
const hci_cmd_t hci_host_buffer_size
 
const hci_cmd_t hci_inquiry
 
const hci_cmd_t hci_inquiry_cancel
 
const hci_cmd_t hci_link_key_request_negative_reply
 
const hci_cmd_t hci_link_key_request_reply
 
const hci_cmd_t hci_pin_code_request_reply
 
const hci_cmd_t hci_pin_code_request_negative_reply
 
const hci_cmd_t hci_qos_setup
 
const hci_cmd_t hci_read_bd_addr
 
const hci_cmd_t hci_read_buffer_size
 
const hci_cmd_t hci_read_le_host_supported
 
const hci_cmd_t hci_read_link_policy_settings
 
const hci_cmd_t hci_read_link_supervision_timeout
 
const hci_cmd_t hci_read_local_supported_features
 
const hci_cmd_t hci_read_num_broadcast_retransmissions
 
const hci_cmd_t hci_reject_connection_request
 
const hci_cmd_t hci_remote_name_request
 
const hci_cmd_t hci_remote_name_request_cancel
 
const hci_cmd_t hci_reset
 
const hci_cmd_t hci_role_discovery
 
const hci_cmd_t hci_set_event_mask
 
const hci_cmd_t hci_set_connection_encryption
 
const hci_cmd_t hci_sniff_mode
 
const hci_cmd_t hci_switch_role_command
 
const hci_cmd_t hci_write_authentication_enable
 
const hci_cmd_t hci_write_class_of_device
 
const hci_cmd_t hci_write_extended_inquiry_response
 
const hci_cmd_t hci_write_inquiry_mode
 
const hci_cmd_t hci_write_le_host_supported
 
const hci_cmd_t hci_write_link_policy_settings
 
const hci_cmd_t hci_write_link_supervision_timeout
 
const hci_cmd_t hci_write_local_name
 
const hci_cmd_t hci_write_num_broadcast_retransmissions
 
const hci_cmd_t hci_write_page_timeout
 
const hci_cmd_t hci_write_scan_enable
 
const hci_cmd_t hci_write_simple_pairing_mode
 
const hci_cmd_t hci_le_add_device_to_whitelist
 
const hci_cmd_t hci_le_clear_white_list
 
const hci_cmd_t hci_le_connection_update
 
const hci_cmd_t hci_le_create_connection
 
const hci_cmd_t hci_le_create_connection_cancel
 
const hci_cmd_t hci_le_encrypt
 
const hci_cmd_t hci_le_long_term_key_negative_reply
 
const hci_cmd_t hci_le_long_term_key_request_reply
 
const hci_cmd_t hci_le_rand
 
const hci_cmd_t hci_le_read_advertising_channel_tx_power
 
const hci_cmd_t hci_le_read_buffer_size
 
const hci_cmd_t hci_le_read_channel_map
 
const hci_cmd_t hci_le_read_remote_used_features
 
const hci_cmd_t hci_le_read_supported_features
 
const hci_cmd_t hci_le_read_supported_states
 
const hci_cmd_t hci_le_read_white_list_size
 
const hci_cmd_t hci_le_receiver_test
 
const hci_cmd_t hci_le_remove_device_from_whitelist
 
const hci_cmd_t hci_le_set_advertise_enable
 
const hci_cmd_t hci_le_set_advertising_data
 
const hci_cmd_t hci_le_set_advertising_parameters
 
const hci_cmd_t hci_le_set_event_mask
 
const hci_cmd_t hci_le_set_host_channel_classification
 
const hci_cmd_t hci_le_set_random_address
 
const hci_cmd_t hci_le_set_scan_enable
 
const hci_cmd_t hci_le_set_scan_parameters
 
const hci_cmd_t hci_le_set_scan_response_data
 
const hci_cmd_t hci_le_start_encryption
 
const hci_cmd_t hci_le_test_end
 
const hci_cmd_t hci_le_transmitter_test
 
const hci_cmd_t l2cap_accept_connection
 
const hci_cmd_t l2cap_create_channel
 
const hci_cmd_t l2cap_create_channel_mtu
 
const hci_cmd_t l2cap_decline_connection
 
const hci_cmd_t l2cap_disconnect
 
const hci_cmd_t l2cap_register_service
 
const hci_cmd_t l2cap_unregister_service
 
const hci_cmd_t sdp_register_service_record
 
const hci_cmd_t sdp_unregister_service_record
 
const hci_cmd_t rfcomm_accept_connection
 
const hci_cmd_t rfcomm_create_channel
 
const hci_cmd_t rfcomm_create_channel_with_initial_credits
 
const hci_cmd_t rfcomm_decline_connection
 
const hci_cmd_t rfcomm_disconnect
 
const hci_cmd_t rfcomm_register_service
 
const hci_cmd_t rfcomm_register_service_with_initial_credits
 
const hci_cmd_t rfcomm_unregister_service
 
const hci_cmd_t rfcomm_persistent_channel_for_service
 
joypad_connection_tslots
 
struct {
   const char *   name
 
   void **   target
 
grabbers []
 
static bool btstack_tested
 
static bool btstack_loaded
 
static bool inquiry_off
 
static bool inquiry_running
 
static struct btstack_hid_adapter g_connections [MAX_USERS]
 
struct btpad_queue_command commands [64]
 
static uint32_t insert_position
 
static uint32_t read_position
 
static uint32_t can_run
 
static sthread_tbtstack_thread
 
hid_driver_t btstack_hid
 

Macro Definition Documentation

◆ ATT_DATA_PACKET

#define ATT_DATA_PACKET   0x08

◆ BD_ADDR_CMP

#define BD_ADDR_CMP (   a,
  b 
)    memcmp(a,b, BD_ADDR_LEN)

◆ BD_ADDR_COPY

#define BD_ADDR_COPY (   dest,
  src 
)    memcpy(dest,src,BD_ADDR_LEN)

◆ BD_ADDR_LEN

#define BD_ADDR_LEN   6

◆ BTDIMPORT

#define BTDIMPORT

◆ BTSTACK_ACL_BUFFERS_FULL

#define BTSTACK_ACL_BUFFERS_FULL   0x57

◆ BTSTACK_ACTIVATION_FAILED_SYSTEM_BLUETOOTH

#define BTSTACK_ACTIVATION_FAILED_SYSTEM_BLUETOOTH   0x51

◆ BTSTACK_ACTIVATION_FAILED_UNKNOWN

#define BTSTACK_ACTIVATION_FAILED_UNKNOWN   0x53

◆ BTSTACK_ACTIVATION_POWERON_FAILED

#define BTSTACK_ACTIVATION_POWERON_FAILED   0x52

◆ BTSTACK_BUSY

#define BTSTACK_BUSY   0x55

◆ BTSTACK_CONNECTION_TO_BTDAEMON_FAILED

#define BTSTACK_CONNECTION_TO_BTDAEMON_FAILED   0x50

◆ BTSTACK_EVENT_DISCOVERABLE_ENABLED

#define BTSTACK_EVENT_DISCOVERABLE_ENABLED   0x66

◆ BTSTACK_EVENT_NR_CONNECTIONS_CHANGED

#define BTSTACK_EVENT_NR_CONNECTIONS_CHANGED   0x61

◆ BTSTACK_EVENT_POWERON_FAILED

#define BTSTACK_EVENT_POWERON_FAILED   0x62

◆ BTSTACK_EVENT_REMOTE_NAME_CACHED

#define BTSTACK_EVENT_REMOTE_NAME_CACHED   0x65

◆ BTSTACK_EVENT_STATE

#define BTSTACK_EVENT_STATE   0x60

◆ BTSTACK_EVENT_SYSTEM_BLUETOOTH_ENABLED

#define BTSTACK_EVENT_SYSTEM_BLUETOOTH_ENABLED   0x64

◆ BTSTACK_EVENT_VERSION

#define BTSTACK_EVENT_VERSION   0x63

◆ BTSTACK_MEMORY_ALLOC_FAILED

#define BTSTACK_MEMORY_ALLOC_FAILED   0x56

◆ BTSTACK_NOT_ACTIVATED

#define BTSTACK_NOT_ACTIVATED   0x54

◆ BTSTACK_PORT

#define BTSTACK_PORT   13333

◆ BTSTACK_UNIX

#define BTSTACK_UNIX   "/tmp/BTstack"

◆ BUILDING_BTDYNAMIC

#define BUILDING_BTDYNAMIC

◆ COMMAND_COMPLETE_EVENT

#define COMMAND_COMPLETE_EVENT (   event,
  cmd 
)    ( event[0] == HCI_EVENT_COMMAND_COMPLETE && READ_BT_16(event,3) == cmd.opcode)

◆ COMMAND_STATUS_EVENT

#define COMMAND_STATUS_EVENT (   event,
  cmd 
)    ( event[0] == HCI_EVENT_COMMAND_STATUS && READ_BT_16(event,4) == cmd.opcode)

◆ DAEMON_EVENT_PACKET

#define DAEMON_EVENT_PACKET   0x05

◆ DEVICE_NAME_LEN

#define DEVICE_NAME_LEN   248

◆ GRAB

#define GRAB (   A)    {#A, (void**)&A##_ptr}

◆ HCI_ACL_DATA_PACKET

#define HCI_ACL_DATA_PACKET   0x02

◆ HCI_COMMAND_DATA_PACKET

#define HCI_COMMAND_DATA_PACKET   0x01

packet types - used in BTstack and over the H4 UART interface

◆ HCI_EVENT_AUTHENTICATION_COMPLETE_EVENT

#define HCI_EVENT_AUTHENTICATION_COMPLETE_EVENT   0x06

◆ HCI_EVENT_CHANGE_CONNECTION_LINK_KEY_COMPLETE

#define HCI_EVENT_CHANGE_CONNECTION_LINK_KEY_COMPLETE   0x09

◆ HCI_EVENT_COMMAND_COMPLETE

#define HCI_EVENT_COMMAND_COMPLETE   0x0E

◆ HCI_EVENT_COMMAND_STATUS

#define HCI_EVENT_COMMAND_STATUS   0x0F

◆ HCI_EVENT_CONNECTION_COMPLETE

#define HCI_EVENT_CONNECTION_COMPLETE   0x03

◆ HCI_EVENT_CONNECTION_REQUEST

#define HCI_EVENT_CONNECTION_REQUEST   0x04

◆ HCI_EVENT_DATA_BUFFER_OVERFLOW

#define HCI_EVENT_DATA_BUFFER_OVERFLOW   0x1A

◆ HCI_EVENT_DISCONNECTION_COMPLETE

#define HCI_EVENT_DISCONNECTION_COMPLETE   0x05

◆ HCI_EVENT_ENCRYPTION_CHANGE

#define HCI_EVENT_ENCRYPTION_CHANGE   0x08

◆ HCI_EVENT_EXTENDED_INQUIRY_RESPONSE

#define HCI_EVENT_EXTENDED_INQUIRY_RESPONSE   0x2F

◆ HCI_EVENT_FLUSH_OCCURED

#define HCI_EVENT_FLUSH_OCCURED   0x11

◆ HCI_EVENT_HARDWARE_ERROR

#define HCI_EVENT_HARDWARE_ERROR   0x10

◆ HCI_EVENT_INQUIRY_COMPLETE

#define HCI_EVENT_INQUIRY_COMPLETE   0x01

◆ HCI_EVENT_INQUIRY_RESULT

#define HCI_EVENT_INQUIRY_RESULT   0x02

◆ HCI_EVENT_INQUIRY_RESULT_WITH_RSSI

#define HCI_EVENT_INQUIRY_RESULT_WITH_RSSI   0x22

◆ HCI_EVENT_LE_META

#define HCI_EVENT_LE_META   0x3E

◆ HCI_EVENT_LINK_KEY_NOTIFICATION

#define HCI_EVENT_LINK_KEY_NOTIFICATION   0x18

◆ HCI_EVENT_LINK_KEY_REQUEST

#define HCI_EVENT_LINK_KEY_REQUEST   0x17

◆ HCI_EVENT_MASTER_LINK_KEY_COMPLETE

#define HCI_EVENT_MASTER_LINK_KEY_COMPLETE   0x0A

◆ HCI_EVENT_MAX_SLOTS_CHANGED

#define HCI_EVENT_MAX_SLOTS_CHANGED   0x1B

◆ HCI_EVENT_MODE_CHANGE_EVENT

#define HCI_EVENT_MODE_CHANGE_EVENT   0x14

◆ HCI_EVENT_NUMBER_OF_COMPLETED_PACKETS

#define HCI_EVENT_NUMBER_OF_COMPLETED_PACKETS   0x13

◆ HCI_EVENT_PACKET

#define HCI_EVENT_PACKET   0x04

◆ HCI_EVENT_PACKET_TYPE_CHANGED

#define HCI_EVENT_PACKET_TYPE_CHANGED   0x1D

◆ HCI_EVENT_PIN_CODE_REQUEST

#define HCI_EVENT_PIN_CODE_REQUEST   0x16

◆ HCI_EVENT_QOS_SETUP_COMPLETE

#define HCI_EVENT_QOS_SETUP_COMPLETE   0x0D

◆ HCI_EVENT_READ_CLOCK_OFFSET_COMPLETE

#define HCI_EVENT_READ_CLOCK_OFFSET_COMPLETE   0x1C

◆ HCI_EVENT_READ_REMOTE_SUPPORTED_FEATURES_COMPLETE

#define HCI_EVENT_READ_REMOTE_SUPPORTED_FEATURES_COMPLETE   0x0B

◆ HCI_EVENT_READ_REMOTE_VERSION_INFORMATION_COMPLETE

#define HCI_EVENT_READ_REMOTE_VERSION_INFORMATION_COMPLETE   0x0C

◆ HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE

#define HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE   0x07

◆ HCI_EVENT_RETURN_LINK_KEYS

#define HCI_EVENT_RETURN_LINK_KEYS   0x15

◆ HCI_EVENT_ROLE_CHANGE

#define HCI_EVENT_ROLE_CHANGE   0x12

◆ HCI_EVENT_VENDOR_SPECIFIC

#define HCI_EVENT_VENDOR_SPECIFIC   0xFF

◆ HCI_INQUIRY_LAP

#define HCI_INQUIRY_LAP   0x9E8B33L

◆ HCI_SCO_DATA_PACKET

#define HCI_SCO_DATA_PACKET   0x03

◆ HCI_SUBEVENT_LE_ADVERTISING_REPORT

#define HCI_SUBEVENT_LE_ADVERTISING_REPORT   0x02

◆ HCI_SUBEVENT_LE_CONNECTION_COMPLETE

#define HCI_SUBEVENT_LE_CONNECTION_COMPLETE   0x01

◆ HCI_SUBEVENT_LE_CONNECTION_UPDATE_COMPLETE

#define HCI_SUBEVENT_LE_CONNECTION_UPDATE_COMPLETE   0x03

◆ HCI_SUBEVENT_LE_LONG_TERM_KEY_REQUEST

#define HCI_SUBEVENT_LE_LONG_TERM_KEY_REQUEST   0x05

◆ HCI_SUBEVENT_LE_READ_REMOTE_USED_FEATURES_COMPLETE

#define HCI_SUBEVENT_LE_READ_REMOTE_USED_FEATURES_COMPLETE   0x04

◆ L2CAP_COMMAND_REJECT_REASON_COMMAND_NOT_UNDERSTOOD

#define L2CAP_COMMAND_REJECT_REASON_COMMAND_NOT_UNDERSTOOD   0x60

◆ L2CAP_COMMAND_REJECT_REASON_INVALID_CID_IN_REQUEST

#define L2CAP_COMMAND_REJECT_REASON_INVALID_CID_IN_REQUEST   0x62

◆ L2CAP_COMMAND_REJECT_REASON_SIGNALING_MTU_EXCEEDED

#define L2CAP_COMMAND_REJECT_REASON_SIGNALING_MTU_EXCEEDED   0x61

◆ L2CAP_CONFIG_RESPONSE_RESULT_REJECTED

#define L2CAP_CONFIG_RESPONSE_RESULT_REJECTED   0x68

◆ L2CAP_CONFIG_RESPONSE_RESULT_SUCCESSFUL

#define L2CAP_CONFIG_RESPONSE_RESULT_SUCCESSFUL   0x66

◆ L2CAP_CONFIG_RESPONSE_RESULT_UNACCEPTABLE_PARAMS

#define L2CAP_CONFIG_RESPONSE_RESULT_UNACCEPTABLE_PARAMS   0x67

◆ L2CAP_CONFIG_RESPONSE_RESULT_UNKNOWN_OPTIONS

#define L2CAP_CONFIG_RESPONSE_RESULT_UNKNOWN_OPTIONS   0x69

◆ L2CAP_CONNECTION_RESPONSE_RESULT_PENDING

#define L2CAP_CONNECTION_RESPONSE_RESULT_PENDING   0x64

◆ L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_PSM

#define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_PSM   0x65

◆ L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_RESOURCES

#define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_RESOURCES   0x65

◆ L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_SECURITY

#define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_SECURITY   0x66

◆ L2CAP_CONNECTION_RESPONSE_RESULT_SUCCESSFUL

#define L2CAP_CONNECTION_RESPONSE_RESULT_SUCCESSFUL   0x63

◆ L2CAP_DATA_PACKET

#define L2CAP_DATA_PACKET   0x06

◆ L2CAP_EVENT_CHANNEL_CLOSED

#define L2CAP_EVENT_CHANNEL_CLOSED   0x71

◆ L2CAP_EVENT_CHANNEL_OPENED

#define L2CAP_EVENT_CHANNEL_OPENED   0x70

◆ L2CAP_EVENT_CREDITS

#define L2CAP_EVENT_CREDITS   0x74

◆ L2CAP_EVENT_INCOMING_CONNECTION

#define L2CAP_EVENT_INCOMING_CONNECTION   0x72

◆ L2CAP_EVENT_SERVICE_REGISTERED

#define L2CAP_EVENT_SERVICE_REGISTERED   0x75

◆ L2CAP_EVENT_TIMEOUT_CHECK

#define L2CAP_EVENT_TIMEOUT_CHECK   0x73

◆ L2CAP_SERVICE_ALREADY_REGISTERED

#define L2CAP_SERVICE_ALREADY_REGISTERED   0x6a

◆ LINK_KEY_LEN

#define LINK_KEY_LEN   16

◆ LOG_MESSAGE_PACKET

#define LOG_MESSAGE_PACKET   0xFC

◆ OFFSET_OF_DATA_IN_COMMAND_COMPLETE

#define OFFSET_OF_DATA_IN_COMMAND_COMPLETE   5

◆ PSM_HID_CONTROL

#define PSM_HID_CONTROL   0x11

◆ PSM_HID_INTERRUPT

#define PSM_HID_INTERRUPT   0x13

◆ PSM_RFCOMM

#define PSM_RFCOMM   0x03

◆ PSM_SDP

#define PSM_SDP   0x01

◆ READ_ACL_CONNECTION_HANDLE

#define READ_ACL_CONNECTION_HANDLE (   buffer)    ( READ_BT_16(buffer,0) & 0x0fff)

◆ READ_ACL_FLAGS

#define READ_ACL_FLAGS (   buffer)    ( buffer[1] >> 4 )

◆ READ_ACL_LENGTH

#define READ_ACL_LENGTH (   buffer)    (READ_BT_16(buffer, 2))

◆ READ_BT_16

#define READ_BT_16 (   buffer,
  pos 
)    ( ((uint16_t) buffer[pos]) | (((uint16_t)buffer[pos+1]) << 8))

◆ READ_BT_24

#define READ_BT_24 (   buffer,
  pos 
)    ( ((uint32_t) buffer[pos]) | (((uint32_t)buffer[pos+1]) << 8) | (((uint32_t)buffer[pos+2]) << 16))

◆ READ_BT_32

#define READ_BT_32 (   buffer,
  pos 
)    ( ((uint32_t) buffer[pos]) | (((uint32_t)buffer[pos+1]) << 8) | (((uint32_t)buffer[pos+2]) << 16) | (((uint32_t) buffer[pos+3])) << 24)

◆ READ_CMD_OCF

#define READ_CMD_OCF (   buffer)    ((buffer[1] & 0x03) << 8 | buffer[0])

◆ READ_CMD_OGF

#define READ_CMD_OGF (   buffer)    (buffer[1] >> 2)

◆ READ_L2CAP_CHANNEL_ID

#define READ_L2CAP_CHANNEL_ID (   buffer)    ( READ_BT_16(buffer, 6))

◆ READ_L2CAP_LENGTH

#define READ_L2CAP_LENGTH (   buffer)    ( READ_BT_16(buffer, 4))

◆ READ_NET_16

#define READ_NET_16 (   buffer,
  pos 
)    ( ((uint16_t) buffer[pos+1]) | (((uint16_t)buffer[pos ]) << 8))

◆ READ_NET_32

#define READ_NET_32 (   buffer,
  pos 
)    ( ((uint32_t) buffer[pos+3]) | (((uint32_t)buffer[pos+2]) << 8) | (((uint32_t)buffer[pos+1]) << 16) | (((uint32_t) buffer[pos])) << 24)

◆ RFCOMM_CHANNEL_ALREADY_REGISTERED

#define RFCOMM_CHANNEL_ALREADY_REGISTERED   0x71

◆ RFCOMM_DATA_PACKET

#define RFCOMM_DATA_PACKET   0x07

◆ RFCOMM_EVENT_CHANNEL_CLOSED

#define RFCOMM_EVENT_CHANNEL_CLOSED   0x81

◆ RFCOMM_EVENT_CREDITS

#define RFCOMM_EVENT_CREDITS   0x84

◆ RFCOMM_EVENT_INCOMING_CONNECTION

#define RFCOMM_EVENT_INCOMING_CONNECTION   0x82

◆ RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE

#define RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE   0x80

◆ RFCOMM_EVENT_PERSISTENT_CHANNEL

#define RFCOMM_EVENT_PERSISTENT_CHANNEL   0x86

◆ RFCOMM_EVENT_REMOTE_LINE_STATUS

#define RFCOMM_EVENT_REMOTE_LINE_STATUS   0x83

◆ RFCOMM_EVENT_SERVICE_REGISTERED

#define RFCOMM_EVENT_SERVICE_REGISTERED   0x85

◆ RFCOMM_MULTIPLEXER_STOPPED

#define RFCOMM_MULTIPLEXER_STOPPED   0x70

◆ RFCOMM_NO_OUTGOING_CREDITS

#define RFCOMM_NO_OUTGOING_CREDITS   0x72

◆ SDP_HANDLE_ALREADY_REGISTERED

#define SDP_HANDLE_ALREADY_REGISTERED   0x80

◆ SDP_SERVICE_REGISTERED

#define SDP_SERVICE_REGISTERED   0x90

◆ SM_DATA_PACKET

#define SM_DATA_PACKET   0x09

Typedef Documentation

◆ bd_addr_t

typedef uint8_t bd_addr_t[BD_ADDR_LEN]

◆ btstack_hid_t

typedef struct btstack_hid btstack_hid_t

◆ btstack_packet_handler_t

typedef void(* btstack_packet_handler_t) (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size)

◆ data_source_t

typedef struct data_source data_source_t

◆ device_name_t

typedef uint8_t device_name_t[DEVICE_NAME_LEN+1]

◆ hci_con_handle_t

◆ link_key_t

typedef uint8_t link_key_t[LINK_KEY_LEN]

◆ linked_item_t

typedef struct linked_item linked_item_t

◆ linked_list_t

◆ timer_source_t

typedef struct timer timer_source_t

Enumeration Type Documentation

◆ btpad_state

Enumerator
BTPAD_EMPTY 
BTPAD_CONNECTING 
BTPAD_CONNECTED 

◆ HCI_POWER_MODE

Enumerator
HCI_POWER_OFF 
HCI_POWER_ON 
HCI_POWER_SLEEP 

◆ HCI_STATE

enum HCI_STATE
Enumerator
HCI_STATE_OFF 
HCI_STATE_INITIALIZING 
HCI_STATE_WORKING 
HCI_STATE_HALTING 
HCI_STATE_SLEEPING 
HCI_STATE_FALLING_ASLEEP 

◆ RUN_LOOP_TYPE

Enumerator
RUN_LOOP_POSIX 
RUN_LOOP_COCOA 
RUN_LOOP_EMBEDDED 

Function Documentation

◆ bd_addr_to_str()

char* bd_addr_to_str ( bd_addr_t  addr)

◆ bt_close()

int bt_close ( void  )

◆ bt_flip_addr()

void bt_flip_addr ( bd_addr_t  dest,
bd_addr_t  src 
)

◆ bt_open()

int bt_open ( void  )

◆ bt_register_packet_handler()

btstack_packet_handler_t bt_register_packet_handler ( btstack_packet_handler_t  handler)

◆ bt_send_acl()

void bt_send_acl ( uint8_t data,
uint16_t  len 
)

◆ bt_send_cmd()

int bt_send_cmd ( const hci_cmd_t cmd,
  ... 
)

◆ bt_send_l2cap()

void bt_send_l2cap ( uint16_t  local_cid,
uint8_t data,
uint16_t  len 
)

◆ bt_send_rfcomm()

void bt_send_rfcomm ( uint16_t  rfcom_cid,
uint8_t data,
uint16_t  len 
)

◆ bt_store_16()

void bt_store_16 ( uint8_t buffer,
uint16_t  pos,
uint16_t  value 
)

◆ bt_store_32()

void bt_store_32 ( uint8_t buffer,
uint16_t  pos,
uint32_t  value 
)

◆ bt_use_tcp()

void bt_use_tcp ( const char *  address,
uint16_t  port 
)

◆ btpad_close_all_connections()

static void btpad_close_all_connections ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ btpad_close_connection()

static void btpad_close_connection ( struct btstack_hid_adapter connection)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ btpad_connection_send_control()

static void btpad_connection_send_control ( void data,
uint8_t data_buf,
size_t  size 
)
static

◆ btpad_find_connection_for()

static struct btstack_hid_adapter* btpad_find_connection_for ( uint16_t  handle,
bd_addr_t  address 
)
static
Here is the caller graph for this function:

◆ btpad_find_empty_connection()

static struct btstack_hid_adapter* btpad_find_empty_connection ( void  )
static
Here is the caller graph for this function:

◆ btpad_increment_position()

static void btpad_increment_position ( uint32_t ptr)
static
Here is the caller graph for this function:

◆ btpad_packet_handler()

static void btpad_packet_handler ( uint8_t  packet_type,
uint16_t  channel,
uint8_t packet,
uint16_t  size 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ btpad_queue_btstack_set_power_mode()

static void btpad_queue_btstack_set_power_mode ( struct btpad_queue_command cmd,
uint8_t  on 
)
static
Here is the call graph for this function:

◆ btpad_queue_hci_disconnect()

static void btpad_queue_hci_disconnect ( struct btpad_queue_command cmd,
uint16_t  handle,
uint8_t  reason 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ btpad_queue_hci_inquiry()

static void btpad_queue_hci_inquiry ( struct btpad_queue_command cmd,
uint32_t  lap,
uint8_t  length,
uint8_t  num_responses 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ btpad_queue_hci_pin_code_request_reply()

static void btpad_queue_hci_pin_code_request_reply ( struct btpad_queue_command cmd,
bd_addr_t  bd_addr,
bd_addr_t  pin 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ btpad_queue_hci_read_bd_addr()

static void btpad_queue_hci_read_bd_addr ( struct btpad_queue_command cmd)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ btpad_queue_hci_remote_name_request()

static void btpad_queue_hci_remote_name_request ( struct btpad_queue_command cmd,
bd_addr_t  bd_addr,
uint8_t  page_scan_repetition_mode,
uint8_t  reserved,
uint16_t  clock_offset 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ btpad_queue_process()

static void btpad_queue_process ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ btpad_queue_process_cmd()

static void btpad_queue_process_cmd ( struct btpad_queue_command cmd)
static
Here is the caller graph for this function:

◆ btpad_queue_reset()

static void btpad_queue_reset ( void  )
static
Here is the caller graph for this function:

◆ btpad_queue_run()

static void btpad_queue_run ( uint32_t  count)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ btpad_set_inquiry_state()

static void btpad_set_inquiry_state ( bool  on)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ btstack_get_handle()

static void* btstack_get_handle ( void  )
static
Here is the caller graph for this function:

◆ btstack_hid_free()

static void btstack_hid_free ( const void data)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ btstack_hid_init()

static void* btstack_hid_init ( void  )
static
Here is the call graph for this function:

◆ btstack_hid_joypad_axis()

static int16_t btstack_hid_joypad_axis ( void data,
unsigned  port,
uint32_t  joyaxis 
)
static
Here is the call graph for this function:

◆ btstack_hid_joypad_button()

static bool btstack_hid_joypad_button ( void data,
unsigned  port,
uint16_t  joykey 
)
static
Here is the call graph for this function:

◆ btstack_hid_joypad_get_buttons()

static void btstack_hid_joypad_get_buttons ( void data,
unsigned  port,
input_bits_t state 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ btstack_hid_joypad_name()

static const char* btstack_hid_joypad_name ( void data,
unsigned  pad 
)
static

◆ btstack_hid_joypad_query()

static bool btstack_hid_joypad_query ( void data,
unsigned  pad 
)
static

◆ btstack_hid_joypad_rumble()

static bool btstack_hid_joypad_rumble ( void data,
unsigned  pad,
enum retro_rumble_effect  effect,
uint16_t  strength 
)
static
Here is the call graph for this function:

◆ btstack_hid_poll()

static void btstack_hid_poll ( void data)
static
Here is the call graph for this function:

◆ btstack_set_poweron()

static void btstack_set_poweron ( bool  on)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ btstack_thread_func()

static void btstack_thread_func ( void data)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ btstack_thread_stop()

static void btstack_thread_stop ( void data)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ btstack_try_load()

static bool btstack_try_load ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ crc8_calc()

uint8_t crc8_calc ( uint8_t data,
uint16_t  len 
)

◆ crc8_check()

uint8_t crc8_check ( uint8_t data,
uint16_t  len,
uint8_t  check_sum 
)

◆ hexdump()

void hexdump ( void data,
int  size 
)

◆ linked_item_get_user()

void* linked_item_get_user ( linked_item_t item)

◆ linked_item_set_user()

void linked_item_set_user ( linked_item_t item,
void user_data 
)

◆ linked_list_add()

void linked_list_add ( linked_list_t list,
linked_item_t item 
)

◆ linked_list_add_tail()

void linked_list_add_tail ( linked_list_t list,
linked_item_t item 
)

◆ linked_list_empty()

int linked_list_empty ( linked_list_t list)

◆ linked_list_get_last_item()

linked_item_t* linked_list_get_last_item ( linked_list_t list)

◆ linked_list_remove()

int linked_list_remove ( linked_list_t list,
linked_item_t item 
)

◆ net_store_16()

void net_store_16 ( uint8_t buffer,
uint16_t  pos,
uint16_t  value 
)

◆ net_store_32()

void net_store_32 ( uint8_t buffer,
uint16_t  pos,
uint32_t  value 
)

◆ print_bd_addr()

void print_bd_addr ( bd_addr_t  addr)

◆ printUUID()

void printUUID ( uint8_t uuid)

◆ run_loop_add_data_source()

void run_loop_add_data_source ( data_source_t dataSource)

◆ run_loop_add_timer()

void run_loop_add_timer ( timer_source_t timer)

◆ run_loop_execute()

void run_loop_execute ( void  )

◆ run_loop_init()

void run_loop_init ( RUN_LOOP_TYPE  type)

◆ run_loop_remove_data_source()

int run_loop_remove_data_source ( data_source_t dataSource)

◆ run_loop_remove_timer()

int run_loop_remove_timer ( timer_source_t timer)

◆ run_loop_set_data_source_handler()

void run_loop_set_data_source_handler ( data_source_t ds,
int(*)(data_source_t *_ds)  process 
)

◆ run_loop_set_timer()

void run_loop_set_timer ( timer_source_t a,
uint32_t  timeout_in_ms 
)

◆ run_loop_set_timer_handler()

void run_loop_set_timer_handler ( timer_source_t ts,
void(*)(timer_source_t *_ts)  process 
)

◆ sscan_bd_addr()

int sscan_bd_addr ( uint8_t addr_string,
bd_addr_t  addr 
)

◆ test_linked_list()

void test_linked_list ( void  )

Variable Documentation

◆ bd_addr_to_str_ptr

BTDIMPORT char*(* bd_addr_to_str_ptr) (bd_addr_t addr)

◆ bt_close_ptr

BTDIMPORT void(* bt_close_ptr) (void)

◆ bt_flip_addr_ptr

BTDIMPORT void(* bt_flip_addr_ptr) (bd_addr_t dest, bd_addr_t src)

◆ bt_open_ptr

BTDIMPORT int(* bt_open_ptr) (void)

◆ bt_register_packet_handler_ptr

◆ bt_send_cmd_ptr

BTDIMPORT int(* bt_send_cmd_ptr) (const hci_cmd_t *cmd,...)

◆ bt_send_l2cap_ptr

BTDIMPORT void(* bt_send_l2cap_ptr) (uint16_t local_cid, uint8_t *data, uint16_t len)

◆ btstack_get_state

const hci_cmd_t btstack_get_state

◆ btstack_get_system_bluetooth_enabled

const hci_cmd_t btstack_get_system_bluetooth_enabled

◆ btstack_get_version

const hci_cmd_t btstack_get_version

◆ btstack_hid

Initial value:
= {
"btstack",
}
static const char * btstack_hid_joypad_name(void *data, unsigned pad)
Definition: btstack_hid.c:1358
static void btstack_hid_free(const void *data)
Definition: btstack_hid.c:1429
static bool btstack_hid_joypad_rumble(void *data, unsigned pad, enum retro_rumble_effect effect, uint16_t strength)
Definition: btstack_hid.c:1394
static int16_t btstack_hid_joypad_axis(void *data, unsigned port, uint32_t joyaxis)
Definition: btstack_hid.c:1403
static bool btstack_hid_joypad_button(void *data, unsigned port, uint16_t joykey)
Definition: btstack_hid.c:1377
static void btpad_connection_send_control(void *data, uint8_t *data_buf, size_t size)
Definition: btstack_hid.c:774
static void btstack_hid_joypad_get_buttons(void *data, unsigned port, input_bits_t *state)
Definition: btstack_hid.c:1367
static void btstack_hid_poll(void *data)
Definition: btstack_hid.c:1466
static void * btstack_hid_init(void)
Definition: btstack_hid.c:1444
static bool btstack_hid_joypad_query(void *data, unsigned pad)
Definition: btstack_hid.c:1353

◆ btstack_loaded

bool btstack_loaded
static

◆ btstack_set_acl_capture_mode

const hci_cmd_t btstack_set_acl_capture_mode

◆ btstack_set_bluetooth_enabled

const hci_cmd_t btstack_set_bluetooth_enabled

◆ btstack_set_discoverable

const hci_cmd_t btstack_set_discoverable

◆ btstack_set_power_mode

const hci_cmd_t btstack_set_power_mode

◆ btstack_set_power_mode_ptr

BTDIMPORT const hci_cmd_t* btstack_set_power_mode_ptr

◆ btstack_set_system_bluetooth_enabled

const hci_cmd_t btstack_set_system_bluetooth_enabled

◆ btstack_tested

bool btstack_tested
static

◆ btstack_thread

sthread_t* btstack_thread
static

◆ can_run

uint32_t can_run
static

◆ commands

◆ g_connections

struct btstack_hid_adapter g_connections[MAX_USERS]
static

◆ grabbers

struct { ... } grabbers[]
Initial value:
=
{
{0, 0}
}
const hci_cmd_t hci_write_authentication_enable
const hci_cmd_t hci_inquiry_cancel
int bt_send_cmd(const hci_cmd_t *cmd,...)
void bt_flip_addr(bd_addr_t dest, bd_addr_t src)
const hci_cmd_t l2cap_accept_connection
const hci_cmd_t l2cap_decline_connection
void bt_send_l2cap(uint16_t local_cid, uint8_t *data, uint16_t len)
int bt_close(void)
const hci_cmd_t hci_pin_code_request_negative_reply
char * bd_addr_to_str(bd_addr_t addr)
const hci_cmd_t hci_remote_name_request
const hci_cmd_t hci_pin_code_request_reply
const hci_cmd_t hci_write_inquiry_mode
int bt_open(void)
const hci_cmd_t hci_read_bd_addr
const hci_cmd_t hci_remote_name_request_cancel
const hci_cmd_t hci_delete_stored_link_key
const hci_cmd_t btstack_set_power_mode
const hci_cmd_t hci_disconnect
#define GRAB(A)
Definition: btstack_hid.c:702
void run_loop_execute(void)
const hci_cmd_t hci_inquiry
btstack_packet_handler_t bt_register_packet_handler(btstack_packet_handler_t handler)
const hci_cmd_t l2cap_register_service
const hci_cmd_t l2cap_create_channel
void run_loop_init(RUN_LOOP_TYPE type)

◆ hci_accept_connection_request

const hci_cmd_t hci_accept_connection_request

◆ hci_authentication_requested

const hci_cmd_t hci_authentication_requested

◆ hci_change_connection_link_key

const hci_cmd_t hci_change_connection_link_key

◆ hci_create_connection

const hci_cmd_t hci_create_connection

◆ hci_create_connection_cancel

const hci_cmd_t hci_create_connection_cancel

◆ hci_delete_stored_link_key

const hci_cmd_t hci_delete_stored_link_key

◆ hci_delete_stored_link_key_ptr

BTDIMPORT const hci_cmd_t* hci_delete_stored_link_key_ptr

◆ hci_disconnect

const hci_cmd_t hci_disconnect

◆ hci_disconnect_ptr

BTDIMPORT const hci_cmd_t* hci_disconnect_ptr

◆ hci_host_buffer_size

const hci_cmd_t hci_host_buffer_size

◆ hci_inquiry

const hci_cmd_t hci_inquiry

◆ hci_inquiry_cancel

const hci_cmd_t hci_inquiry_cancel

◆ hci_inquiry_cancel_ptr

BTDIMPORT const hci_cmd_t* hci_inquiry_cancel_ptr

◆ hci_inquiry_ptr

BTDIMPORT const hci_cmd_t* hci_inquiry_ptr

◆ hci_le_add_device_to_whitelist

const hci_cmd_t hci_le_add_device_to_whitelist

◆ hci_le_clear_white_list

const hci_cmd_t hci_le_clear_white_list

◆ hci_le_connection_update

const hci_cmd_t hci_le_connection_update

◆ hci_le_create_connection

const hci_cmd_t hci_le_create_connection

◆ hci_le_create_connection_cancel

const hci_cmd_t hci_le_create_connection_cancel

◆ hci_le_encrypt

const hci_cmd_t hci_le_encrypt

◆ hci_le_long_term_key_negative_reply

const hci_cmd_t hci_le_long_term_key_negative_reply

◆ hci_le_long_term_key_request_reply

const hci_cmd_t hci_le_long_term_key_request_reply

◆ hci_le_rand

const hci_cmd_t hci_le_rand

◆ hci_le_read_advertising_channel_tx_power

const hci_cmd_t hci_le_read_advertising_channel_tx_power

◆ hci_le_read_buffer_size

const hci_cmd_t hci_le_read_buffer_size

◆ hci_le_read_channel_map

const hci_cmd_t hci_le_read_channel_map

◆ hci_le_read_remote_used_features

const hci_cmd_t hci_le_read_remote_used_features

◆ hci_le_read_supported_features

const hci_cmd_t hci_le_read_supported_features

◆ hci_le_read_supported_states

const hci_cmd_t hci_le_read_supported_states

◆ hci_le_read_white_list_size

const hci_cmd_t hci_le_read_white_list_size

◆ hci_le_receiver_test

const hci_cmd_t hci_le_receiver_test

◆ hci_le_remove_device_from_whitelist

const hci_cmd_t hci_le_remove_device_from_whitelist

◆ hci_le_set_advertise_enable

const hci_cmd_t hci_le_set_advertise_enable

◆ hci_le_set_advertising_data

const hci_cmd_t hci_le_set_advertising_data

◆ hci_le_set_advertising_parameters

const hci_cmd_t hci_le_set_advertising_parameters

◆ hci_le_set_event_mask

const hci_cmd_t hci_le_set_event_mask

◆ hci_le_set_host_channel_classification

const hci_cmd_t hci_le_set_host_channel_classification

◆ hci_le_set_random_address

const hci_cmd_t hci_le_set_random_address

◆ hci_le_set_scan_enable

const hci_cmd_t hci_le_set_scan_enable

◆ hci_le_set_scan_parameters

const hci_cmd_t hci_le_set_scan_parameters

◆ hci_le_set_scan_response_data

const hci_cmd_t hci_le_set_scan_response_data

◆ hci_le_start_encryption

const hci_cmd_t hci_le_start_encryption

◆ hci_le_test_end

const hci_cmd_t hci_le_test_end

◆ hci_le_transmitter_test

const hci_cmd_t hci_le_transmitter_test

◆ hci_link_key_request_negative_reply

const hci_cmd_t hci_link_key_request_negative_reply

◆ hci_link_key_request_reply

const hci_cmd_t hci_link_key_request_reply

◆ hci_pin_code_request_negative_reply

const hci_cmd_t hci_pin_code_request_negative_reply

◆ hci_pin_code_request_negative_reply_ptr

BTDIMPORT const hci_cmd_t* hci_pin_code_request_negative_reply_ptr

◆ hci_pin_code_request_reply

const hci_cmd_t hci_pin_code_request_reply

◆ hci_pin_code_request_reply_ptr

BTDIMPORT const hci_cmd_t* hci_pin_code_request_reply_ptr

◆ hci_qos_setup

const hci_cmd_t hci_qos_setup

◆ hci_read_bd_addr

const hci_cmd_t hci_read_bd_addr

◆ hci_read_bd_addr_ptr

BTDIMPORT const hci_cmd_t* hci_read_bd_addr_ptr

◆ hci_read_buffer_size

const hci_cmd_t hci_read_buffer_size

◆ hci_read_le_host_supported

const hci_cmd_t hci_read_le_host_supported

◆ hci_read_link_policy_settings

const hci_cmd_t hci_read_link_policy_settings

◆ hci_read_link_supervision_timeout

const hci_cmd_t hci_read_link_supervision_timeout

◆ hci_read_local_supported_features

const hci_cmd_t hci_read_local_supported_features

◆ hci_read_num_broadcast_retransmissions

const hci_cmd_t hci_read_num_broadcast_retransmissions

◆ hci_reject_connection_request

const hci_cmd_t hci_reject_connection_request

◆ hci_remote_name_request

const hci_cmd_t hci_remote_name_request

◆ hci_remote_name_request_cancel

const hci_cmd_t hci_remote_name_request_cancel

◆ hci_remote_name_request_cancel_ptr

BTDIMPORT const hci_cmd_t* hci_remote_name_request_cancel_ptr

◆ hci_remote_name_request_ptr

BTDIMPORT const hci_cmd_t* hci_remote_name_request_ptr

◆ hci_reset

const hci_cmd_t hci_reset

◆ hci_role_discovery

const hci_cmd_t hci_role_discovery

◆ hci_set_connection_encryption

const hci_cmd_t hci_set_connection_encryption

◆ hci_set_event_mask

const hci_cmd_t hci_set_event_mask

◆ hci_sniff_mode

const hci_cmd_t hci_sniff_mode

◆ hci_switch_role_command

const hci_cmd_t hci_switch_role_command

◆ hci_write_authentication_enable

const hci_cmd_t hci_write_authentication_enable

◆ hci_write_authentication_enable_ptr

BTDIMPORT const hci_cmd_t* hci_write_authentication_enable_ptr

◆ hci_write_class_of_device

const hci_cmd_t hci_write_class_of_device

◆ hci_write_extended_inquiry_response

const hci_cmd_t hci_write_extended_inquiry_response

◆ hci_write_inquiry_mode

const hci_cmd_t hci_write_inquiry_mode

◆ hci_write_inquiry_mode_ptr

BTDIMPORT const hci_cmd_t* hci_write_inquiry_mode_ptr

◆ hci_write_le_host_supported

const hci_cmd_t hci_write_le_host_supported

◆ hci_write_link_policy_settings

const hci_cmd_t hci_write_link_policy_settings

◆ hci_write_link_supervision_timeout

const hci_cmd_t hci_write_link_supervision_timeout

◆ hci_write_local_name

const hci_cmd_t hci_write_local_name

◆ hci_write_num_broadcast_retransmissions

const hci_cmd_t hci_write_num_broadcast_retransmissions

◆ hci_write_page_timeout

const hci_cmd_t hci_write_page_timeout

◆ hci_write_scan_enable

const hci_cmd_t hci_write_scan_enable

◆ hci_write_simple_pairing_mode

const hci_cmd_t hci_write_simple_pairing_mode

◆ inquiry_off

bool inquiry_off
static

◆ inquiry_running

bool inquiry_running
static

◆ insert_position

uint32_t insert_position
static

◆ l2cap_accept_connection

const hci_cmd_t l2cap_accept_connection

◆ l2cap_accept_connection_ptr

BTDIMPORT const hci_cmd_t* l2cap_accept_connection_ptr

◆ l2cap_create_channel

const hci_cmd_t l2cap_create_channel

◆ l2cap_create_channel_mtu

const hci_cmd_t l2cap_create_channel_mtu

◆ l2cap_create_channel_ptr

BTDIMPORT const hci_cmd_t* l2cap_create_channel_ptr

◆ l2cap_decline_connection

const hci_cmd_t l2cap_decline_connection

◆ l2cap_decline_connection_ptr

BTDIMPORT const hci_cmd_t* l2cap_decline_connection_ptr

◆ l2cap_disconnect

const hci_cmd_t l2cap_disconnect

◆ l2cap_register_service

const hci_cmd_t l2cap_register_service

◆ l2cap_register_service_ptr

BTDIMPORT const hci_cmd_t* l2cap_register_service_ptr

◆ l2cap_unregister_service

const hci_cmd_t l2cap_unregister_service

◆ name

const char* name

◆ read_position

uint32_t read_position
static

◆ rfcomm_accept_connection

const hci_cmd_t rfcomm_accept_connection

◆ rfcomm_create_channel

const hci_cmd_t rfcomm_create_channel

◆ rfcomm_create_channel_with_initial_credits

const hci_cmd_t rfcomm_create_channel_with_initial_credits

◆ rfcomm_decline_connection

const hci_cmd_t rfcomm_decline_connection

◆ rfcomm_disconnect

const hci_cmd_t rfcomm_disconnect

◆ rfcomm_persistent_channel_for_service

const hci_cmd_t rfcomm_persistent_channel_for_service

◆ rfcomm_register_service

const hci_cmd_t rfcomm_register_service

◆ rfcomm_register_service_with_initial_credits

const hci_cmd_t rfcomm_register_service_with_initial_credits

◆ rfcomm_unregister_service

const hci_cmd_t rfcomm_unregister_service

◆ run_loop_execute_ptr

BTDIMPORT void(* run_loop_execute_ptr) (void)

◆ run_loop_init_ptr

BTDIMPORT void(* run_loop_init_ptr) (RUN_LOOP_TYPE type)

◆ sdp_register_service_record

const hci_cmd_t sdp_register_service_record

◆ sdp_unregister_service_record

const hci_cmd_t sdp_unregister_service_record

◆ slots

◆ target