mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-25 17:10:12 +00:00
(apple/iOS/bluetooth/btstack) Cleanups
This commit is contained in:
parent
8bd0253c27
commit
b9ae190e4c
@ -29,15 +29,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* btstack.h
|
||||
*
|
||||
* Created by Matthias Ringwald on 7/1/09.
|
||||
*
|
||||
* BTstack client API
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _BTSTACK_HEADER_H
|
||||
#define _BTSTACK_HEADER_H
|
||||
|
||||
@ -89,6 +80,7 @@ btstack_packet_handler_t bt_register_packet_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);
|
||||
|
||||
#if defined __cplusplus
|
||||
|
@ -29,13 +29,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* hci_cmds.h
|
||||
*
|
||||
* Created by Matthias Ringwald on 7/23/09.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef _BTSTACK_HCI_CMDS_H
|
||||
#define _BTSTACK_HCI_CMDS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -46,221 +41,214 @@ extern "C" {
|
||||
/**
|
||||
* packet types - used in BTstack and over the H4 UART interface
|
||||
*/
|
||||
#define HCI_COMMAND_DATA_PACKET 0x01
|
||||
#define HCI_ACL_DATA_PACKET 0x02
|
||||
#define HCI_SCO_DATA_PACKET 0x03
|
||||
#define HCI_EVENT_PACKET 0x04
|
||||
#define HCI_COMMAND_DATA_PACKET 0x01
|
||||
#define HCI_ACL_DATA_PACKET 0x02
|
||||
#define HCI_SCO_DATA_PACKET 0x03
|
||||
#define HCI_EVENT_PACKET 0x04
|
||||
|
||||
// extension for client/server communication
|
||||
#define DAEMON_EVENT_PACKET 0x05
|
||||
/* extension for client/server communication */
|
||||
#define DAEMON_EVENT_PACKET 0x05
|
||||
|
||||
// L2CAP data
|
||||
#define L2CAP_DATA_PACKET 0x06
|
||||
/* L2CAP data */
|
||||
#define L2CAP_DATA_PACKET 0x06
|
||||
|
||||
// RFCOMM data
|
||||
#define RFCOMM_DATA_PACKET 0x07
|
||||
/* RFCOMM data */
|
||||
#define RFCOMM_DATA_PACKET 0x07
|
||||
|
||||
// Attribute protocol data
|
||||
#define ATT_DATA_PACKET 0x08
|
||||
/* Attribute protocol data */
|
||||
#define ATT_DATA_PACKET 0x08
|
||||
|
||||
// Security Manager protocol data
|
||||
#define SM_DATA_PACKET 0x09
|
||||
/* Security Manager protocol data */
|
||||
#define SM_DATA_PACKET 0x09
|
||||
|
||||
// debug log messages
|
||||
#define LOG_MESSAGE_PACKET 0xfc
|
||||
/* debug log messages */
|
||||
#define LOG_MESSAGE_PACKET 0xFC
|
||||
|
||||
/* Fixed PSM numbers */
|
||||
#define PSM_SDP 0x01
|
||||
#define PSM_RFCOMM 0x03
|
||||
#define PSM_HID_CONTROL 0x11
|
||||
#define PSM_HID_INTERRUPT 0x13
|
||||
|
||||
/* Events from host controller to host */
|
||||
#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
|
||||
|
||||
// Fixed PSM numbers
|
||||
#define PSM_SDP 0x01
|
||||
#define PSM_RFCOMM 0x03
|
||||
#define PSM_HID_CONTROL 0x11
|
||||
#define PSM_HID_INTERRUPT 0x13
|
||||
/* last used HCI_EVENT in 2.1 is 0x3d */
|
||||
|
||||
// Events from host controller to host
|
||||
#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
|
||||
/* events 0x50-0x5f are used internally */
|
||||
|
||||
#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
|
||||
|
||||
// last used HCI_EVENT in 2.1 is 0x3d
|
||||
/* BTSTACK DAEMON EVENTS */
|
||||
|
||||
// events 0x50-0x5f are used internally
|
||||
/* events from BTstack for application/client lib */
|
||||
#define BTSTACK_EVENT_STATE 0x60
|
||||
|
||||
// BTSTACK DAEMON EVENTS
|
||||
/* data: event(8), len(8), nr hci connections */
|
||||
#define BTSTACK_EVENT_NR_CONNECTIONS_CHANGED 0x61
|
||||
|
||||
// events from BTstack for application/client lib
|
||||
#define BTSTACK_EVENT_STATE 0x60
|
||||
/* data: none */
|
||||
#define BTSTACK_EVENT_POWERON_FAILED 0x62
|
||||
|
||||
// data: event(8), len(8), nr hci connections
|
||||
#define BTSTACK_EVENT_NR_CONNECTIONS_CHANGED 0x61
|
||||
/* data: major (8), minor (8), revision(16) */
|
||||
#define BTSTACK_EVENT_VERSION 0x63
|
||||
|
||||
// data: none
|
||||
#define BTSTACK_EVENT_POWERON_FAILED 0x62
|
||||
/* data: system bluetooth on/off (bool) */
|
||||
#define BTSTACK_EVENT_SYSTEM_BLUETOOTH_ENABLED 0x64
|
||||
|
||||
// data: majot (8), minor (8), revision(16)
|
||||
#define BTSTACK_EVENT_VERSION 0x63
|
||||
/* data: event (8), len(8), status (8) == 0, address (48), name (1984 bits = 248 bytes) */
|
||||
#define BTSTACK_EVENT_REMOTE_NAME_CACHED 0x65
|
||||
|
||||
// data: system bluetooth on/off (bool)
|
||||
#define BTSTACK_EVENT_SYSTEM_BLUETOOTH_ENABLED 0x64
|
||||
/* data: discoverable enabled (bool) */
|
||||
#define BTSTACK_EVENT_DISCOVERABLE_ENABLED 0x66
|
||||
|
||||
// data: event (8), len(8), status (8) == 0, address (48), name (1984 bits = 248 bytes)
|
||||
#define BTSTACK_EVENT_REMOTE_NAME_CACHED 0x65
|
||||
|
||||
// data: discoverable enabled (bool)
|
||||
#define BTSTACK_EVENT_DISCOVERABLE_ENABLED 0x66
|
||||
|
||||
// L2CAP EVENTS
|
||||
/* L2CAP EVENTS */
|
||||
|
||||
// data: event (8), len(8), status (8), address(48), handle (16), psm (16), local_cid(16), remote_cid (16), local_mtu(16), remote_mtu(16)
|
||||
#define L2CAP_EVENT_CHANNEL_OPENED 0x70
|
||||
/* data: event (8), len(8), status (8), address(48), handle (16), psm (16), local_cid(16), remote_cid (16), local_mtu(16), remote_mtu(16) */
|
||||
#define L2CAP_EVENT_CHANNEL_OPENED 0x70
|
||||
|
||||
// data: event (8), len(8), channel (16)
|
||||
#define L2CAP_EVENT_CHANNEL_CLOSED 0x71
|
||||
/* data: event (8), len(8), channel (16) */
|
||||
#define L2CAP_EVENT_CHANNEL_CLOSED 0x71
|
||||
|
||||
// data: event (8), len(8), address(48), handle (16), psm (16), local_cid(16), remote_cid (16)
|
||||
#define L2CAP_EVENT_INCOMING_CONNECTION 0x72
|
||||
/* data: event (8), len(8), address(48), handle (16), psm (16), local_cid(16), remote_cid (16) */
|
||||
#define L2CAP_EVENT_INCOMING_CONNECTION 0x72
|
||||
|
||||
// data: event(8), len(8), handle(16)
|
||||
#define L2CAP_EVENT_TIMEOUT_CHECK 0x73
|
||||
/* data: event(8), len(8), handle(16) */
|
||||
#define L2CAP_EVENT_TIMEOUT_CHECK 0x73
|
||||
|
||||
// data: event(8), len(8), local_cid(16), credits(8)
|
||||
#define L2CAP_EVENT_CREDITS 0x74
|
||||
/* data: event(8), len(8), local_cid(16), credits(8) */
|
||||
#define L2CAP_EVENT_CREDITS 0x74
|
||||
|
||||
// data: event(8), len(8), status (8), psm (16)
|
||||
#define L2CAP_EVENT_SERVICE_REGISTERED 0x75
|
||||
/* data: event(8), len(8), status (8), psm (16) */
|
||||
#define L2CAP_EVENT_SERVICE_REGISTERED 0x75
|
||||
|
||||
|
||||
// RFCOMM EVENTS
|
||||
/* RFCOMM EVENTS */
|
||||
|
||||
// data: event(8), len(8), status (8), address (48), handle (16), server channel(8), rfcomm_cid(16), max frame size(16)
|
||||
#define RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE 0x80
|
||||
#define RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE 0x80
|
||||
|
||||
// data: event(8), len(8), rfcomm_cid(16)
|
||||
#define RFCOMM_EVENT_CHANNEL_CLOSED 0x81
|
||||
#define RFCOMM_EVENT_CHANNEL_CLOSED 0x81
|
||||
|
||||
// data: event (8), len(8), address(48), channel (8), rfcomm_cid (16)
|
||||
#define RFCOMM_EVENT_INCOMING_CONNECTION 0x82
|
||||
#define RFCOMM_EVENT_INCOMING_CONNECTION 0x82
|
||||
|
||||
// data: event (8), len(8), rfcommid (16), ...
|
||||
#define RFCOMM_EVENT_REMOTE_LINE_STATUS 0x83
|
||||
#define RFCOMM_EVENT_REMOTE_LINE_STATUS 0x83
|
||||
|
||||
// data: event(8), len(8), rfcomm_cid(16), credits(8)
|
||||
#define RFCOMM_EVENT_CREDITS 0x84
|
||||
/* data: event(8), len(8), rfcomm_cid(16), credits(8) */
|
||||
#define RFCOMM_EVENT_CREDITS 0x84
|
||||
|
||||
// data: event(8), len(8), status (8), rfcomm server channel id (8)
|
||||
#define RFCOMM_EVENT_SERVICE_REGISTERED 0x85
|
||||
/* data: event(8), len(8), status (8), rfcomm server channel id (8) */
|
||||
#define RFCOMM_EVENT_SERVICE_REGISTERED 0x85
|
||||
|
||||
// data: event(8), len(8), status (8), rfcomm server channel id (8)
|
||||
#define RFCOMM_EVENT_PERSISTENT_CHANNEL 0x86
|
||||
/* data: event(8), len(8), status (8), rfcomm server channel id (8) */
|
||||
#define RFCOMM_EVENT_PERSISTENT_CHANNEL 0x86
|
||||
|
||||
|
||||
// data: event(8), len(8), status(8), service_record_handle(32)
|
||||
#define SDP_SERVICE_REGISTERED 0x90
|
||||
|
||||
/* data: event(8), len(8), status(8), service_record_handle(32) */
|
||||
#define SDP_SERVICE_REGISTERED 0x90
|
||||
|
||||
// last error code in 2.1 is 0x38 - we start with 0x50 for BTstack errors
|
||||
/* last error code in 2.1 is 0x38 - we start with 0x50 for BTstack errors */
|
||||
|
||||
#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 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
|
||||
|
||||
// l2cap errors - enumeration by the command that created them
|
||||
#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
|
||||
/* L2CAP errors - enumeration by the command that created them */
|
||||
#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_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 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 RFCOMM_MULTIPLEXER_STOPPED 0x70
|
||||
#define RFCOMM_CHANNEL_ALREADY_REGISTERED 0x71
|
||||
#define RFCOMM_NO_OUTGOING_CREDITS 0x72
|
||||
|
||||
#define SDP_HANDLE_ALREADY_REGISTERED 0x80
|
||||
#define SDP_HANDLE_ALREADY_REGISTERED 0x80
|
||||
|
||||
/**
|
||||
* Default INQ Mode
|
||||
*/
|
||||
#define HCI_INQUIRY_LAP 0x9E8B33L // 0x9E8B33: General/Unlimited Inquiry Access Code (GIAC)
|
||||
/**
|
||||
* Hardware state of Bluetooth controller
|
||||
*/
|
||||
typedef enum {
|
||||
HCI_POWER_OFF = 0,
|
||||
HCI_POWER_ON,
|
||||
HCI_POWER_SLEEP
|
||||
/* Default INQ Mode
|
||||
* 0x9E8B33: General/Unlimited Inquiry Access Code (GIAC)
|
||||
**/
|
||||
#define HCI_INQUIRY_LAP 0x9E8B33L
|
||||
|
||||
/* Hardware state of Bluetooth controller */
|
||||
typedef enum
|
||||
{
|
||||
HCI_POWER_OFF = 0,
|
||||
HCI_POWER_ON,
|
||||
HCI_POWER_SLEEP
|
||||
} HCI_POWER_MODE;
|
||||
|
||||
/**
|
||||
* State of BTstack
|
||||
*/
|
||||
typedef enum {
|
||||
HCI_STATE_OFF = 0,
|
||||
HCI_STATE_INITIALIZING,
|
||||
HCI_STATE_WORKING,
|
||||
HCI_STATE_HALTING,
|
||||
HCI_STATE_SLEEPING,
|
||||
HCI_STATE_FALLING_ASLEEP
|
||||
/* State of BTstack */
|
||||
typedef enum
|
||||
{
|
||||
HCI_STATE_OFF = 0,
|
||||
HCI_STATE_INITIALIZING,
|
||||
HCI_STATE_WORKING,
|
||||
HCI_STATE_HALTING,
|
||||
HCI_STATE_SLEEPING,
|
||||
HCI_STATE_FALLING_ASLEEP
|
||||
} HCI_STATE;
|
||||
|
||||
/**
|
||||
* compact HCI Command packet description
|
||||
*/
|
||||
typedef struct {
|
||||
uint16_t opcode;
|
||||
const char *format;
|
||||
/* compact HCI Command packet description */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t opcode;
|
||||
const char *format;
|
||||
} hci_cmd_t;
|
||||
|
||||
|
||||
// HCI Commands - see hci_cmds.c for info on parameters
|
||||
/* HCI Commands - see hci_cmds.c for info on parameters */
|
||||
extern const hci_cmd_t btstack_get_state;
|
||||
extern const hci_cmd_t btstack_set_power_mode;
|
||||
extern const hci_cmd_t btstack_set_acl_capture_mode;
|
||||
@ -268,7 +256,7 @@ extern const hci_cmd_t btstack_get_version;
|
||||
extern const hci_cmd_t btstack_get_system_bluetooth_enabled;
|
||||
extern const hci_cmd_t btstack_set_system_bluetooth_enabled;
|
||||
extern const hci_cmd_t btstack_set_discoverable;
|
||||
extern const hci_cmd_t btstack_set_bluetooth_enabled; // only used by btstack config
|
||||
extern const hci_cmd_t btstack_set_bluetooth_enabled; /* only used by btstack config */
|
||||
|
||||
extern const hci_cmd_t hci_accept_connection_request;
|
||||
extern const hci_cmd_t hci_authentication_requested;
|
||||
@ -356,25 +344,27 @@ extern const hci_cmd_t l2cap_unregister_service;
|
||||
extern const hci_cmd_t sdp_register_service_record;
|
||||
extern const hci_cmd_t sdp_unregister_service_record;
|
||||
|
||||
// accept connection @param bd_addr(48), rfcomm_cid (16)
|
||||
/* accept connection @param bd_addr(48), rfcomm_cid (16) */
|
||||
extern const hci_cmd_t rfcomm_accept_connection;
|
||||
// create rfcomm channel: @param bd_addr(48), channel (8)
|
||||
/* create rfcomm channel: @param bd_addr(48), channel (8) */
|
||||
extern const hci_cmd_t rfcomm_create_channel;
|
||||
// create rfcomm channel: @param bd_addr(48), channel (8), mtu (16), credits (8)
|
||||
/* create rfcomm channel: @param bd_addr(48), channel (8), mtu (16), credits (8) */
|
||||
extern const hci_cmd_t rfcomm_create_channel_with_initial_credits;
|
||||
// decline rfcomm disconnect,@param bd_addr(48), rfcomm cid (16), reason(8)
|
||||
/* decline rfcomm disconnect,@param bd_addr(48), rfcomm cid (16), reason(8) */
|
||||
extern const hci_cmd_t rfcomm_decline_connection;
|
||||
// disconnect rfcomm disconnect, @param rfcomm_cid(8), reason(8)
|
||||
/* disconnect rfcomm disconnect, @param rfcomm_cid(8), reason(8) */
|
||||
extern const hci_cmd_t rfcomm_disconnect;
|
||||
// register rfcomm service: @param channel(8), mtu (16)
|
||||
/* register rfcomm service: @param channel(8), mtu (16) */
|
||||
extern const hci_cmd_t rfcomm_register_service;
|
||||
// register rfcomm service: @param channel(8), mtu (16), initial credits (8)
|
||||
/* register rfcomm service: @param channel(8), mtu (16), initial credits (8) */
|
||||
extern const hci_cmd_t rfcomm_register_service_with_initial_credits;
|
||||
// unregister rfcomm service, @param service_channel(16)
|
||||
/* unregister rfcomm service, @param service_channel(16) */
|
||||
extern const hci_cmd_t rfcomm_unregister_service;
|
||||
// request persisten rfcomm channel for service name: serive name (char*)
|
||||
/* request persisten rfcomm channel for service name: serive name (char*) */
|
||||
extern const hci_cmd_t rfcomm_persistent_channel_for_service;
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -29,12 +29,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* linked_list.h
|
||||
*
|
||||
* Created by Matthias Ringwald on 7/13/09.
|
||||
*/
|
||||
|
||||
#ifndef _BTSTACK_LINKED_LIST_H
|
||||
#define _BTSTACK_LINKED_LIST_H
|
||||
|
||||
|
@ -35,7 +35,8 @@
|
||||
* Created by Matthias Ringwald on 6/6/09.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef _BTSTACK_RUNLOOP_H
|
||||
#define _BTSTACK_RUNLOOP_H
|
||||
|
||||
#include "linked_list.h"
|
||||
#define HAVE_TIME
|
||||
@ -137,3 +138,4 @@ void embedded_trigger(void);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -29,10 +29,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* sdp_util.h
|
||||
*/
|
||||
|
||||
#ifndef _BTSTACK_SDP_UTIL_H
|
||||
#define _BTSTACK_SDP_UTIL_H
|
||||
|
||||
@ -42,97 +38,123 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
DE_NIL = 0,
|
||||
DE_UINT,
|
||||
DE_INT,
|
||||
DE_UUID,
|
||||
DE_STRING,
|
||||
DE_BOOL,
|
||||
DE_DES,
|
||||
DE_DEA,
|
||||
DE_URL
|
||||
typedef enum
|
||||
{
|
||||
DE_NIL = 0,
|
||||
DE_UINT,
|
||||
DE_INT,
|
||||
DE_UUID,
|
||||
DE_STRING,
|
||||
DE_BOOL,
|
||||
DE_DES,
|
||||
DE_DEA,
|
||||
DE_URL
|
||||
} de_type_t;
|
||||
|
||||
typedef enum {
|
||||
DE_SIZE_8 = 0,
|
||||
DE_SIZE_16,
|
||||
DE_SIZE_32,
|
||||
DE_SIZE_64,
|
||||
DE_SIZE_128,
|
||||
DE_SIZE_VAR_8,
|
||||
DE_SIZE_VAR_16,
|
||||
DE_SIZE_VAR_32
|
||||
typedef enum
|
||||
{
|
||||
DE_SIZE_8 = 0,
|
||||
DE_SIZE_16,
|
||||
DE_SIZE_32,
|
||||
DE_SIZE_64,
|
||||
DE_SIZE_128,
|
||||
DE_SIZE_VAR_8,
|
||||
DE_SIZE_VAR_16,
|
||||
DE_SIZE_VAR_32
|
||||
} de_size_t;
|
||||
|
||||
// UNIVERSAL ATTRIBUTE DEFINITIONS
|
||||
#define SDP_ServiceRecordHandle 0x0000
|
||||
#define SDP_ServiceClassIDList 0x0001
|
||||
#define SDP_ServiceRecordState 0x0002
|
||||
#define SDP_ServiceID 0x0003
|
||||
#define SDP_ProtocolDescriptorList 0x0004
|
||||
#define SDP_BrowseGroupList 0x0005
|
||||
#define SDP_LanguageBaseAttributeIDList 0x0006
|
||||
#define SDP_ServiceInfoTimeToLive 0x0007
|
||||
#define SDP_ServiceAvailability 0x0008
|
||||
#define SDP_BluetoothProfileDescriptorList 0x0009
|
||||
#define SDP_DocumentationURL 0x000a
|
||||
#define SDP_ClientExecutableURL 0x000b
|
||||
#define SDP_IconURL 0x000c
|
||||
/* UNIVERSAL ATTRIBUTE DEFINITIONS */
|
||||
#define SDP_ServiceRecordHandle 0x0000
|
||||
#define SDP_ServiceClassIDList 0x0001
|
||||
#define SDP_ServiceRecordState 0x0002
|
||||
#define SDP_ServiceID 0x0003
|
||||
#define SDP_ProtocolDescriptorList 0x0004
|
||||
#define SDP_BrowseGroupList 0x0005
|
||||
#define SDP_LanguageBaseAttributeIDList 0x0006
|
||||
#define SDP_ServiceInfoTimeToLive 0x0007
|
||||
#define SDP_ServiceAvailability 0x0008
|
||||
#define SDP_BluetoothProfileDescriptorList 0x0009
|
||||
#define SDP_DocumentationURL 0x000a
|
||||
#define SDP_ClientExecutableURL 0x000b
|
||||
#define SDP_IconURL 0x000c
|
||||
#define SDP_AdditionalProtocolDescriptorList 0x000d
|
||||
#define SDP_SupportedFormatsList 0x0303
|
||||
#define SDP_SupportedFormatsList 0x0303
|
||||
|
||||
// SERVICE CLASSES
|
||||
#define SDP_OBEXObjectPush 0x1105
|
||||
#define SDP_OBEXFileTransfer 0x1106
|
||||
#define SDP_PublicBrowseGroup 0x1002
|
||||
/* SERVICE CLASSES */
|
||||
#define SDP_OBEXObjectPush 0x1105
|
||||
#define SDP_OBEXFileTransfer 0x1106
|
||||
#define SDP_PublicBrowseGroup 0x1002
|
||||
|
||||
// PROTOCOLS
|
||||
#define SDP_SDPProtocol 0x0001
|
||||
#define SDP_UDPProtocol 0x0002
|
||||
#define SDP_RFCOMMProtocol 0x0003
|
||||
#define SDP_OBEXProtocol 0x0008
|
||||
#define SDP_L2CAPProtocol 0x0100
|
||||
/* PROTOCOLS */
|
||||
#define SDP_SDPProtocol 0x0001
|
||||
#define SDP_UDPProtocol 0x0002
|
||||
#define SDP_RFCOMMProtocol 0x0003
|
||||
#define SDP_OBEXProtocol 0x0008
|
||||
#define SDP_L2CAPProtocol 0x0100
|
||||
|
||||
// OFFSETS FOR LOCALIZED ATTRIBUTES - SDP_LanguageBaseAttributeIDList
|
||||
#define SDP_Offest_ServiceName 0x0000
|
||||
#define SDP_Offest_ServiceDescription 0x0001
|
||||
#define SDP_Offest_ProviderName 0x0002
|
||||
/* OFFSETS FOR LOCALIZED ATTRIBUTES - SDP_LanguageBaseAttributeIDList */
|
||||
#define SDP_Offest_ServiceName 0x0000
|
||||
#define SDP_Offest_ServiceDescription 0x0001
|
||||
#define SDP_Offest_ProviderName 0x0002
|
||||
|
||||
// OBEX
|
||||
#define SDP_vCard_2_1 0x01
|
||||
#define SDP_vCard_3_0 0x02
|
||||
#define SDP_vCal_1_0 0x03
|
||||
#define SDP_iCal_2_0 0x04
|
||||
#define SDP_vNote 0x05
|
||||
#define SDP_vMessage 0x06
|
||||
#define SDP_OBEXFileTypeAny 0xFF
|
||||
/* OBEX */
|
||||
#define SDP_vCard_2_1 0x01
|
||||
#define SDP_vCard_3_0 0x02
|
||||
#define SDP_vCal_1_0 0x03
|
||||
#define SDP_iCal_2_0 0x04
|
||||
#define SDP_vNote 0x05
|
||||
#define SDP_vMessage 0x06
|
||||
#define SDP_OBEXFileTypeAny 0xFF
|
||||
|
||||
// MARK: DateElement
|
||||
/* MARK: DateElement */
|
||||
void de_dump_data_element(uint8_t * record);
|
||||
|
||||
int de_get_len(uint8_t *header);
|
||||
|
||||
de_size_t de_get_size_type(uint8_t *header);
|
||||
|
||||
de_type_t de_get_element_type(uint8_t *header);
|
||||
|
||||
int de_get_header_size(uint8_t * header);
|
||||
|
||||
void de_create_sequence(uint8_t *header);
|
||||
void de_store_descriptor_with_len(uint8_t * header, de_type_t type, de_size_t size, uint32_t len);
|
||||
uint8_t * de_push_sequence(uint8_t *header);
|
||||
|
||||
void de_store_descriptor_with_len(uint8_t * header,
|
||||
de_type_t type, de_size_t size, uint32_t len);
|
||||
|
||||
uint8_t *de_push_sequence(uint8_t *header);
|
||||
|
||||
void de_pop_sequence(uint8_t * parent, uint8_t * child);
|
||||
|
||||
void de_add_number(uint8_t *seq, de_type_t type, de_size_t size, uint32_t value);
|
||||
|
||||
void de_add_data( uint8_t *seq, de_type_t type, uint16_t size, uint8_t *data);
|
||||
|
||||
int de_get_data_size(uint8_t * header);
|
||||
|
||||
void de_add_uuid128(uint8_t * seq, uint8_t * uuid);
|
||||
|
||||
// MARK: SDP
|
||||
uint16_t sdp_append_attributes_in_attributeIDList(uint8_t *record, uint8_t *attributeIDList, uint16_t startOffset, uint16_t maxBytes, uint8_t *buffer);
|
||||
uint8_t * sdp_get_attribute_value_for_attribute_id(uint8_t * record, uint16_t attributeID);
|
||||
uint8_t sdp_set_attribute_value_for_attribute_id(uint8_t * record, uint16_t attributeID, uint32_t value);
|
||||
int sdp_record_matches_service_search_pattern(uint8_t *record, uint8_t *serviceSearchPattern);
|
||||
int spd_get_filtered_size(uint8_t *record, uint8_t *attributeIDList);
|
||||
int sdp_filter_attributes_in_attributeIDList(uint8_t *record, uint8_t *attributeIDList, uint16_t startOffset, uint16_t maxBytes, uint16_t *usedBytes, uint8_t *buffer);
|
||||
/* MARK: SDP */
|
||||
uint16_t sdp_append_attributes_in_attributeIDList(uint8_t *record,
|
||||
uint8_t *attributeIDList, uint16_t startOffset,
|
||||
uint16_t maxBytes, uint8_t *buffer);
|
||||
|
||||
void sdp_create_spp_service(uint8_t *service, int service_id, const char *name);
|
||||
uint8_t *sdp_get_attribute_value_for_attribute_id(uint8_t * record,
|
||||
uint16_t attributeID);
|
||||
|
||||
uint8_t sdp_set_attribute_value_for_attribute_id(uint8_t * record,
|
||||
uint16_t attributeID, uint32_t value);
|
||||
|
||||
int sdp_record_matches_service_search_pattern(uint8_t *record,
|
||||
uint8_t *serviceSearchPattern);
|
||||
|
||||
int spd_get_filtered_size(uint8_t *record, uint8_t *attributeIDList);
|
||||
|
||||
int sdp_filter_attributes_in_attributeIDList(uint8_t *record,
|
||||
uint8_t *attributeIDList, uint16_t startOffset, uint16_t maxBytes,
|
||||
uint16_t *usedBytes, uint8_t *buffer);
|
||||
|
||||
void sdp_create_spp_service(uint8_t *service, int service_id, const char *name);
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
|
@ -29,14 +29,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* utils.h
|
||||
*
|
||||
* General utility functions
|
||||
*
|
||||
* Created by Matthias Ringwald on 7/23/09.
|
||||
*/
|
||||
|
||||
#ifndef _BT_UTILS_H
|
||||
#define _BT_UTILS_H
|
||||
|
||||
@ -50,17 +42,16 @@ extern "C" {
|
||||
typedef uint16_t hci_con_handle_t;
|
||||
|
||||
/* Length of a Bluetooth device address. */
|
||||
#define BD_ADDR_LEN 6
|
||||
|
||||
typedef uint8_t bd_addr_t[BD_ADDR_LEN];
|
||||
#define BD_ADDR_LEN 6
|
||||
|
||||
/* The link key type. */
|
||||
#define LINK_KEY_LEN 16
|
||||
|
||||
typedef uint8_t link_key_t[LINK_KEY_LEN];
|
||||
#define LINK_KEY_LEN 16
|
||||
|
||||
/* The device name type. */
|
||||
#define DEVICE_NAME_LEN 248
|
||||
#define DEVICE_NAME_LEN 248
|
||||
|
||||
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];
|
||||
|
||||
/* helper for BT little endian format. */
|
||||
@ -92,6 +83,9 @@ typedef uint8_t device_name_t[DEVICE_NAME_LEN+1];
|
||||
#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)
|
||||
|
||||
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);
|
||||
@ -117,9 +111,6 @@ uint8_t crc8_check(uint8_t *data, uint16_t len, uint8_t check_sum);
|
||||
|
||||
uint8_t crc8_calc(uint8_t *data, uint16_t len);
|
||||
|
||||
#define BD_ADDR_CMP(a,b) memcmp(a,b, BD_ADDR_LEN)
|
||||
#define BD_ADDR_COPY(dest,src) memcpy(dest,src,BD_ADDR_LEN)
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user