ban4jp -
/
BTstack_test
https://mbed.org/forum/ja/topic/4890/
Fork of BTstack by
BTstack/btstack/hci_cmds.h@0:1ed23ab1345f, 2012-06-26 (annotated)
- Committer:
- va009039
- Date:
- Tue Jun 26 14:27:45 2012 +0000
- Revision:
- 0:1ed23ab1345f
fix overflow spp_service_buffer
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
va009039 | 0:1ed23ab1345f | 1 | /* |
va009039 | 0:1ed23ab1345f | 2 | * Copyright (C) 2009 by Matthias Ringwald |
va009039 | 0:1ed23ab1345f | 3 | * |
va009039 | 0:1ed23ab1345f | 4 | * Redistribution and use in source and binary forms, with or without |
va009039 | 0:1ed23ab1345f | 5 | * modification, are permitted provided that the following conditions |
va009039 | 0:1ed23ab1345f | 6 | * are met: |
va009039 | 0:1ed23ab1345f | 7 | * |
va009039 | 0:1ed23ab1345f | 8 | * 1. Redistributions of source code must retain the above copyright |
va009039 | 0:1ed23ab1345f | 9 | * notice, this list of conditions and the following disclaimer. |
va009039 | 0:1ed23ab1345f | 10 | * 2. Redistributions in binary form must reproduce the above copyright |
va009039 | 0:1ed23ab1345f | 11 | * notice, this list of conditions and the following disclaimer in the |
va009039 | 0:1ed23ab1345f | 12 | * documentation and/or other materials provided with the distribution. |
va009039 | 0:1ed23ab1345f | 13 | * 3. Neither the name of the copyright holders nor the names of |
va009039 | 0:1ed23ab1345f | 14 | * contributors may be used to endorse or promote products derived |
va009039 | 0:1ed23ab1345f | 15 | * from this software without specific prior written permission. |
va009039 | 0:1ed23ab1345f | 16 | * |
va009039 | 0:1ed23ab1345f | 17 | * THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD AND CONTRIBUTORS |
va009039 | 0:1ed23ab1345f | 18 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
va009039 | 0:1ed23ab1345f | 19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
va009039 | 0:1ed23ab1345f | 20 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS |
va009039 | 0:1ed23ab1345f | 21 | * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
va009039 | 0:1ed23ab1345f | 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
va009039 | 0:1ed23ab1345f | 23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS |
va009039 | 0:1ed23ab1345f | 24 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
va009039 | 0:1ed23ab1345f | 25 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
va009039 | 0:1ed23ab1345f | 26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF |
va009039 | 0:1ed23ab1345f | 27 | * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
va009039 | 0:1ed23ab1345f | 28 | * SUCH DAMAGE. |
va009039 | 0:1ed23ab1345f | 29 | * |
va009039 | 0:1ed23ab1345f | 30 | */ |
va009039 | 0:1ed23ab1345f | 31 | |
va009039 | 0:1ed23ab1345f | 32 | /* |
va009039 | 0:1ed23ab1345f | 33 | * hci_cmds.h |
va009039 | 0:1ed23ab1345f | 34 | * |
va009039 | 0:1ed23ab1345f | 35 | * Created by Matthias Ringwald on 7/23/09. |
va009039 | 0:1ed23ab1345f | 36 | */ |
va009039 | 0:1ed23ab1345f | 37 | |
va009039 | 0:1ed23ab1345f | 38 | #pragma once |
va009039 | 0:1ed23ab1345f | 39 | |
va009039 | 0:1ed23ab1345f | 40 | #include <stdint.h> |
va009039 | 0:1ed23ab1345f | 41 | |
va009039 | 0:1ed23ab1345f | 42 | #if defined __cplusplus |
va009039 | 0:1ed23ab1345f | 43 | extern "C" { |
va009039 | 0:1ed23ab1345f | 44 | #endif |
va009039 | 0:1ed23ab1345f | 45 | |
va009039 | 0:1ed23ab1345f | 46 | /** |
va009039 | 0:1ed23ab1345f | 47 | * packet types - used in BTstack and over the H4 UART interface |
va009039 | 0:1ed23ab1345f | 48 | */ |
va009039 | 0:1ed23ab1345f | 49 | #define HCI_COMMAND_DATA_PACKET 0x01 |
va009039 | 0:1ed23ab1345f | 50 | #define HCI_ACL_DATA_PACKET 0x02 |
va009039 | 0:1ed23ab1345f | 51 | #define HCI_SCO_DATA_PACKET 0x03 |
va009039 | 0:1ed23ab1345f | 52 | #define HCI_EVENT_PACKET 0x04 |
va009039 | 0:1ed23ab1345f | 53 | |
va009039 | 0:1ed23ab1345f | 54 | // extension for client/server communication |
va009039 | 0:1ed23ab1345f | 55 | #define DAEMON_EVENT_PACKET 0x05 |
va009039 | 0:1ed23ab1345f | 56 | |
va009039 | 0:1ed23ab1345f | 57 | // L2CAP data |
va009039 | 0:1ed23ab1345f | 58 | #define L2CAP_DATA_PACKET 0x06 |
va009039 | 0:1ed23ab1345f | 59 | |
va009039 | 0:1ed23ab1345f | 60 | // RFCOMM data |
va009039 | 0:1ed23ab1345f | 61 | #define RFCOMM_DATA_PACKET 0x07 |
va009039 | 0:1ed23ab1345f | 62 | |
va009039 | 0:1ed23ab1345f | 63 | // Attribute protocol data |
va009039 | 0:1ed23ab1345f | 64 | #define ATT_DATA_PACKET 0x08 |
va009039 | 0:1ed23ab1345f | 65 | |
va009039 | 0:1ed23ab1345f | 66 | // Security Manager protocol data |
va009039 | 0:1ed23ab1345f | 67 | #define SM_DATA_PACKET 0x09 |
va009039 | 0:1ed23ab1345f | 68 | |
va009039 | 0:1ed23ab1345f | 69 | // debug log messages |
va009039 | 0:1ed23ab1345f | 70 | #define LOG_MESSAGE_PACKET 0xfc |
va009039 | 0:1ed23ab1345f | 71 | |
va009039 | 0:1ed23ab1345f | 72 | |
va009039 | 0:1ed23ab1345f | 73 | // Fixed PSM numbers |
va009039 | 0:1ed23ab1345f | 74 | #define PSM_SDP 0x01 |
va009039 | 0:1ed23ab1345f | 75 | #define PSM_RFCOMM 0x03 |
va009039 | 0:1ed23ab1345f | 76 | #define PSM_HID_CONTROL 0x11 |
va009039 | 0:1ed23ab1345f | 77 | #define PSM_HID_INTERRUPT 0x13 |
va009039 | 0:1ed23ab1345f | 78 | |
va009039 | 0:1ed23ab1345f | 79 | // Events from host controller to host |
va009039 | 0:1ed23ab1345f | 80 | #define HCI_EVENT_INQUIRY_COMPLETE 0x01 |
va009039 | 0:1ed23ab1345f | 81 | #define HCI_EVENT_INQUIRY_RESULT 0x02 |
va009039 | 0:1ed23ab1345f | 82 | #define HCI_EVENT_CONNECTION_COMPLETE 0x03 |
va009039 | 0:1ed23ab1345f | 83 | #define HCI_EVENT_CONNECTION_REQUEST 0x04 |
va009039 | 0:1ed23ab1345f | 84 | #define HCI_EVENT_DISCONNECTION_COMPLETE 0x05 |
va009039 | 0:1ed23ab1345f | 85 | #define HCI_EVENT_AUTHENTICATION_COMPLETE_EVENT 0x06 |
va009039 | 0:1ed23ab1345f | 86 | #define HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE 0x07 |
va009039 | 0:1ed23ab1345f | 87 | #define HCI_EVENT_ENCRYPTION_CHANGE 0x08 |
va009039 | 0:1ed23ab1345f | 88 | #define HCI_EVENT_CHANGE_CONNECTION_LINK_KEY_COMPLETE 0x09 |
va009039 | 0:1ed23ab1345f | 89 | #define HCI_EVENT_MASTER_LINK_KEY_COMPLETE 0x0A |
va009039 | 0:1ed23ab1345f | 90 | #define HCI_EVENT_READ_REMOTE_SUPPORTED_FEATURES_COMPLETE 0x0B |
va009039 | 0:1ed23ab1345f | 91 | #define HCI_EVENT_READ_REMOTE_VERSION_INFORMATION_COMPLETE 0x0C |
va009039 | 0:1ed23ab1345f | 92 | #define HCI_EVENT_QOS_SETUP_COMPLETE 0x0D |
va009039 | 0:1ed23ab1345f | 93 | #define HCI_EVENT_COMMAND_COMPLETE 0x0E |
va009039 | 0:1ed23ab1345f | 94 | #define HCI_EVENT_COMMAND_STATUS 0x0F |
va009039 | 0:1ed23ab1345f | 95 | #define HCI_EVENT_HARDWARE_ERROR 0x10 |
va009039 | 0:1ed23ab1345f | 96 | #define HCI_EVENT_FLUSH_OCCURED 0x11 |
va009039 | 0:1ed23ab1345f | 97 | #define HCI_EVENT_ROLE_CHANGE 0x12 |
va009039 | 0:1ed23ab1345f | 98 | #define HCI_EVENT_NUMBER_OF_COMPLETED_PACKETS 0x13 |
va009039 | 0:1ed23ab1345f | 99 | #define HCI_EVENT_MODE_CHANGE_EVENT 0x14 |
va009039 | 0:1ed23ab1345f | 100 | #define HCI_EVENT_RETURN_LINK_KEYS 0x15 |
va009039 | 0:1ed23ab1345f | 101 | #define HCI_EVENT_PIN_CODE_REQUEST 0x16 |
va009039 | 0:1ed23ab1345f | 102 | #define HCI_EVENT_LINK_KEY_REQUEST 0x17 |
va009039 | 0:1ed23ab1345f | 103 | #define HCI_EVENT_LINK_KEY_NOTIFICATION 0x18 |
va009039 | 0:1ed23ab1345f | 104 | #define HCI_EVENT_DATA_BUFFER_OVERFLOW 0x1A |
va009039 | 0:1ed23ab1345f | 105 | #define HCI_EVENT_MAX_SLOTS_CHANGED 0x1B |
va009039 | 0:1ed23ab1345f | 106 | #define HCI_EVENT_READ_CLOCK_OFFSET_COMPLETE 0x1C |
va009039 | 0:1ed23ab1345f | 107 | #define HCI_EVENT_PACKET_TYPE_CHANGED 0x1D |
va009039 | 0:1ed23ab1345f | 108 | #define HCI_EVENT_INQUIRY_RESULT_WITH_RSSI 0x22 |
va009039 | 0:1ed23ab1345f | 109 | #define HCI_EVENT_EXTENDED_INQUIRY_RESPONSE 0x2F |
va009039 | 0:1ed23ab1345f | 110 | #define HCI_EVENT_LE_META 0x3E |
va009039 | 0:1ed23ab1345f | 111 | #define HCI_EVENT_VENDOR_SPECIFIC 0xFF |
va009039 | 0:1ed23ab1345f | 112 | |
va009039 | 0:1ed23ab1345f | 113 | #define HCI_SUBEVENT_LE_CONNECTION_COMPLETE 0x01 |
va009039 | 0:1ed23ab1345f | 114 | #define HCI_SUBEVENT_LE_ADVERTISING_REPORT 0x02 |
va009039 | 0:1ed23ab1345f | 115 | #define HCI_SUBEVENT_LE_CONNECTION_UPDATE_COMPLETE 0x03 |
va009039 | 0:1ed23ab1345f | 116 | #define HCI_SUBEVENT_LE_READ_REMOTE_USED_FEATURES_COMPLETE 0x04 |
va009039 | 0:1ed23ab1345f | 117 | #define HCI_SUBEVENT_LE_LONG_TERM_KEY_REQUEST 0x05 |
va009039 | 0:1ed23ab1345f | 118 | |
va009039 | 0:1ed23ab1345f | 119 | // last used HCI_EVENT in 2.1 is 0x3d |
va009039 | 0:1ed23ab1345f | 120 | |
va009039 | 0:1ed23ab1345f | 121 | // events 0x50-0x5f are used internally |
va009039 | 0:1ed23ab1345f | 122 | |
va009039 | 0:1ed23ab1345f | 123 | // BTSTACK DAEMON EVENTS |
va009039 | 0:1ed23ab1345f | 124 | |
va009039 | 0:1ed23ab1345f | 125 | // events from BTstack for application/client lib |
va009039 | 0:1ed23ab1345f | 126 | #define BTSTACK_EVENT_STATE 0x60 |
va009039 | 0:1ed23ab1345f | 127 | |
va009039 | 0:1ed23ab1345f | 128 | // data: event(8), len(8), nr hci connections |
va009039 | 0:1ed23ab1345f | 129 | #define BTSTACK_EVENT_NR_CONNECTIONS_CHANGED 0x61 |
va009039 | 0:1ed23ab1345f | 130 | |
va009039 | 0:1ed23ab1345f | 131 | // data: none |
va009039 | 0:1ed23ab1345f | 132 | #define BTSTACK_EVENT_POWERON_FAILED 0x62 |
va009039 | 0:1ed23ab1345f | 133 | |
va009039 | 0:1ed23ab1345f | 134 | // data: majot (8), minor (8), revision(16) |
va009039 | 0:1ed23ab1345f | 135 | #define BTSTACK_EVENT_VERSION 0x63 |
va009039 | 0:1ed23ab1345f | 136 | |
va009039 | 0:1ed23ab1345f | 137 | // data: system bluetooth on/off (bool) |
va009039 | 0:1ed23ab1345f | 138 | #define BTSTACK_EVENT_SYSTEM_BLUETOOTH_ENABLED 0x64 |
va009039 | 0:1ed23ab1345f | 139 | |
va009039 | 0:1ed23ab1345f | 140 | // data: event (8), len(8), status (8) == 0, address (48), name (1984 bits = 248 bytes) |
va009039 | 0:1ed23ab1345f | 141 | #define BTSTACK_EVENT_REMOTE_NAME_CACHED 0x65 |
va009039 | 0:1ed23ab1345f | 142 | |
va009039 | 0:1ed23ab1345f | 143 | // data: discoverable enabled (bool) |
va009039 | 0:1ed23ab1345f | 144 | #define BTSTACK_EVENT_DISCOVERABLE_ENABLED 0x66 |
va009039 | 0:1ed23ab1345f | 145 | |
va009039 | 0:1ed23ab1345f | 146 | // L2CAP EVENTS |
va009039 | 0:1ed23ab1345f | 147 | |
va009039 | 0:1ed23ab1345f | 148 | // 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) |
va009039 | 0:1ed23ab1345f | 149 | #define L2CAP_EVENT_CHANNEL_OPENED 0x70 |
va009039 | 0:1ed23ab1345f | 150 | |
va009039 | 0:1ed23ab1345f | 151 | // data: event (8), len(8), channel (16) |
va009039 | 0:1ed23ab1345f | 152 | #define L2CAP_EVENT_CHANNEL_CLOSED 0x71 |
va009039 | 0:1ed23ab1345f | 153 | |
va009039 | 0:1ed23ab1345f | 154 | // data: event (8), len(8), address(48), handle (16), psm (16), local_cid(16), remote_cid (16) |
va009039 | 0:1ed23ab1345f | 155 | #define L2CAP_EVENT_INCOMING_CONNECTION 0x72 |
va009039 | 0:1ed23ab1345f | 156 | |
va009039 | 0:1ed23ab1345f | 157 | // data: event(8), len(8), handle(16) |
va009039 | 0:1ed23ab1345f | 158 | #define L2CAP_EVENT_TIMEOUT_CHECK 0x73 |
va009039 | 0:1ed23ab1345f | 159 | |
va009039 | 0:1ed23ab1345f | 160 | // data: event(8), len(8), local_cid(16), credits(8) |
va009039 | 0:1ed23ab1345f | 161 | #define L2CAP_EVENT_CREDITS 0x74 |
va009039 | 0:1ed23ab1345f | 162 | |
va009039 | 0:1ed23ab1345f | 163 | // data: event(8), len(8), status (8), psm (16) |
va009039 | 0:1ed23ab1345f | 164 | #define L2CAP_EVENT_SERVICE_REGISTERED 0x75 |
va009039 | 0:1ed23ab1345f | 165 | |
va009039 | 0:1ed23ab1345f | 166 | |
va009039 | 0:1ed23ab1345f | 167 | // RFCOMM EVENTS |
va009039 | 0:1ed23ab1345f | 168 | |
va009039 | 0:1ed23ab1345f | 169 | // data: event(8), len(8), status (8), address (48), handle (16), server channel(8), rfcomm_cid(16), max frame size(16) |
va009039 | 0:1ed23ab1345f | 170 | #define RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE 0x80 |
va009039 | 0:1ed23ab1345f | 171 | |
va009039 | 0:1ed23ab1345f | 172 | // data: event(8), len(8), rfcomm_cid(16) |
va009039 | 0:1ed23ab1345f | 173 | #define RFCOMM_EVENT_CHANNEL_CLOSED 0x81 |
va009039 | 0:1ed23ab1345f | 174 | |
va009039 | 0:1ed23ab1345f | 175 | // data: event (8), len(8), address(48), channel (8), rfcomm_cid (16) |
va009039 | 0:1ed23ab1345f | 176 | #define RFCOMM_EVENT_INCOMING_CONNECTION 0x82 |
va009039 | 0:1ed23ab1345f | 177 | |
va009039 | 0:1ed23ab1345f | 178 | // data: event (8), len(8), rfcommid (16), ... |
va009039 | 0:1ed23ab1345f | 179 | #define RFCOMM_EVENT_REMOTE_LINE_STATUS 0x83 |
va009039 | 0:1ed23ab1345f | 180 | |
va009039 | 0:1ed23ab1345f | 181 | // data: event(8), len(8), rfcomm_cid(16), credits(8) |
va009039 | 0:1ed23ab1345f | 182 | #define RFCOMM_EVENT_CREDITS 0x84 |
va009039 | 0:1ed23ab1345f | 183 | |
va009039 | 0:1ed23ab1345f | 184 | // data: event(8), len(8), status (8), rfcomm server channel id (8) |
va009039 | 0:1ed23ab1345f | 185 | #define RFCOMM_EVENT_SERVICE_REGISTERED 0x85 |
va009039 | 0:1ed23ab1345f | 186 | |
va009039 | 0:1ed23ab1345f | 187 | // data: event(8), len(8), status (8), rfcomm server channel id (8) |
va009039 | 0:1ed23ab1345f | 188 | #define RFCOMM_EVENT_PERSISTENT_CHANNEL 0x86 |
va009039 | 0:1ed23ab1345f | 189 | |
va009039 | 0:1ed23ab1345f | 190 | |
va009039 | 0:1ed23ab1345f | 191 | // data: event(8), len(8), status(8), service_record_handle(32) |
va009039 | 0:1ed23ab1345f | 192 | #define SDP_SERVICE_REGISTERED 0x90 |
va009039 | 0:1ed23ab1345f | 193 | |
va009039 | 0:1ed23ab1345f | 194 | |
va009039 | 0:1ed23ab1345f | 195 | // last error code in 2.1 is 0x38 - we start with 0x50 for BTstack errors |
va009039 | 0:1ed23ab1345f | 196 | |
va009039 | 0:1ed23ab1345f | 197 | #define BTSTACK_CONNECTION_TO_BTDAEMON_FAILED 0x50 |
va009039 | 0:1ed23ab1345f | 198 | #define BTSTACK_ACTIVATION_FAILED_SYSTEM_BLUETOOTH 0x51 |
va009039 | 0:1ed23ab1345f | 199 | #define BTSTACK_ACTIVATION_POWERON_FAILED 0x52 |
va009039 | 0:1ed23ab1345f | 200 | #define BTSTACK_ACTIVATION_FAILED_UNKNOWN 0x53 |
va009039 | 0:1ed23ab1345f | 201 | #define BTSTACK_NOT_ACTIVATED 0x54 |
va009039 | 0:1ed23ab1345f | 202 | #define BTSTACK_BUSY 0x55 |
va009039 | 0:1ed23ab1345f | 203 | #define BTSTACK_MEMORY_ALLOC_FAILED 0x56 |
va009039 | 0:1ed23ab1345f | 204 | #define BTSTACK_ACL_BUFFERS_FULL 0x57 |
va009039 | 0:1ed23ab1345f | 205 | |
va009039 | 0:1ed23ab1345f | 206 | // l2cap errors - enumeration by the command that created them |
va009039 | 0:1ed23ab1345f | 207 | #define L2CAP_COMMAND_REJECT_REASON_COMMAND_NOT_UNDERSTOOD 0x60 |
va009039 | 0:1ed23ab1345f | 208 | #define L2CAP_COMMAND_REJECT_REASON_SIGNALING_MTU_EXCEEDED 0x61 |
va009039 | 0:1ed23ab1345f | 209 | #define L2CAP_COMMAND_REJECT_REASON_INVALID_CID_IN_REQUEST 0x62 |
va009039 | 0:1ed23ab1345f | 210 | |
va009039 | 0:1ed23ab1345f | 211 | #define L2CAP_CONNECTION_RESPONSE_RESULT_SUCCESSFUL 0x63 |
va009039 | 0:1ed23ab1345f | 212 | #define L2CAP_CONNECTION_RESPONSE_RESULT_PENDING 0x64 |
va009039 | 0:1ed23ab1345f | 213 | #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_PSM 0x65 |
va009039 | 0:1ed23ab1345f | 214 | #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_SECURITY 0x66 |
va009039 | 0:1ed23ab1345f | 215 | #define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_RESOURCES 0x65 |
va009039 | 0:1ed23ab1345f | 216 | |
va009039 | 0:1ed23ab1345f | 217 | #define L2CAP_CONFIG_RESPONSE_RESULT_SUCCESSFUL 0x66 |
va009039 | 0:1ed23ab1345f | 218 | #define L2CAP_CONFIG_RESPONSE_RESULT_UNACCEPTABLE_PARAMS 0x67 |
va009039 | 0:1ed23ab1345f | 219 | #define L2CAP_CONFIG_RESPONSE_RESULT_REJECTED 0x68 |
va009039 | 0:1ed23ab1345f | 220 | #define L2CAP_CONFIG_RESPONSE_RESULT_UNKNOWN_OPTIONS 0x69 |
va009039 | 0:1ed23ab1345f | 221 | #define L2CAP_SERVICE_ALREADY_REGISTERED 0x6a |
va009039 | 0:1ed23ab1345f | 222 | |
va009039 | 0:1ed23ab1345f | 223 | #define RFCOMM_MULTIPLEXER_STOPPED 0x70 |
va009039 | 0:1ed23ab1345f | 224 | #define RFCOMM_CHANNEL_ALREADY_REGISTERED 0x71 |
va009039 | 0:1ed23ab1345f | 225 | #define RFCOMM_NO_OUTGOING_CREDITS 0x72 |
va009039 | 0:1ed23ab1345f | 226 | |
va009039 | 0:1ed23ab1345f | 227 | #define SDP_HANDLE_ALREADY_REGISTERED 0x80 |
va009039 | 0:1ed23ab1345f | 228 | |
va009039 | 0:1ed23ab1345f | 229 | /** |
va009039 | 0:1ed23ab1345f | 230 | * Default INQ Mode |
va009039 | 0:1ed23ab1345f | 231 | */ |
va009039 | 0:1ed23ab1345f | 232 | #define HCI_INQUIRY_LAP 0x9E8B33L // 0x9E8B33: General/Unlimited Inquiry Access Code (GIAC) |
va009039 | 0:1ed23ab1345f | 233 | /** |
va009039 | 0:1ed23ab1345f | 234 | * Hardware state of Bluetooth controller |
va009039 | 0:1ed23ab1345f | 235 | */ |
va009039 | 0:1ed23ab1345f | 236 | typedef enum { |
va009039 | 0:1ed23ab1345f | 237 | HCI_POWER_OFF = 0, |
va009039 | 0:1ed23ab1345f | 238 | HCI_POWER_ON, |
va009039 | 0:1ed23ab1345f | 239 | HCI_POWER_SLEEP |
va009039 | 0:1ed23ab1345f | 240 | } HCI_POWER_MODE; |
va009039 | 0:1ed23ab1345f | 241 | |
va009039 | 0:1ed23ab1345f | 242 | /** |
va009039 | 0:1ed23ab1345f | 243 | * State of BTstack |
va009039 | 0:1ed23ab1345f | 244 | */ |
va009039 | 0:1ed23ab1345f | 245 | typedef enum { |
va009039 | 0:1ed23ab1345f | 246 | HCI_STATE_OFF = 0, |
va009039 | 0:1ed23ab1345f | 247 | HCI_STATE_INITIALIZING, |
va009039 | 0:1ed23ab1345f | 248 | HCI_STATE_WORKING, |
va009039 | 0:1ed23ab1345f | 249 | HCI_STATE_HALTING, |
va009039 | 0:1ed23ab1345f | 250 | HCI_STATE_SLEEPING, |
va009039 | 0:1ed23ab1345f | 251 | HCI_STATE_FALLING_ASLEEP |
va009039 | 0:1ed23ab1345f | 252 | } HCI_STATE; |
va009039 | 0:1ed23ab1345f | 253 | |
va009039 | 0:1ed23ab1345f | 254 | /** |
va009039 | 0:1ed23ab1345f | 255 | * compact HCI Command packet description |
va009039 | 0:1ed23ab1345f | 256 | */ |
va009039 | 0:1ed23ab1345f | 257 | typedef struct { |
va009039 | 0:1ed23ab1345f | 258 | uint16_t opcode; |
va009039 | 0:1ed23ab1345f | 259 | const char *format; |
va009039 | 0:1ed23ab1345f | 260 | } hci_cmd_t; |
va009039 | 0:1ed23ab1345f | 261 | |
va009039 | 0:1ed23ab1345f | 262 | |
va009039 | 0:1ed23ab1345f | 263 | // HCI Commands - see hci_cmds.c for info on parameters |
va009039 | 0:1ed23ab1345f | 264 | extern const hci_cmd_t btstack_get_state; |
va009039 | 0:1ed23ab1345f | 265 | extern const hci_cmd_t btstack_set_power_mode; |
va009039 | 0:1ed23ab1345f | 266 | extern const hci_cmd_t btstack_set_acl_capture_mode; |
va009039 | 0:1ed23ab1345f | 267 | extern const hci_cmd_t btstack_get_version; |
va009039 | 0:1ed23ab1345f | 268 | extern const hci_cmd_t btstack_get_system_bluetooth_enabled; |
va009039 | 0:1ed23ab1345f | 269 | extern const hci_cmd_t btstack_set_system_bluetooth_enabled; |
va009039 | 0:1ed23ab1345f | 270 | extern const hci_cmd_t btstack_set_discoverable; |
va009039 | 0:1ed23ab1345f | 271 | extern const hci_cmd_t btstack_set_bluetooth_enabled; // only used by btstack config |
va009039 | 0:1ed23ab1345f | 272 | |
va009039 | 0:1ed23ab1345f | 273 | extern const hci_cmd_t hci_accept_connection_request; |
va009039 | 0:1ed23ab1345f | 274 | extern const hci_cmd_t hci_authentication_requested; |
va009039 | 0:1ed23ab1345f | 275 | extern const hci_cmd_t hci_change_connection_link_key; |
va009039 | 0:1ed23ab1345f | 276 | extern const hci_cmd_t hci_create_connection; |
va009039 | 0:1ed23ab1345f | 277 | extern const hci_cmd_t hci_create_connection_cancel; |
va009039 | 0:1ed23ab1345f | 278 | extern const hci_cmd_t hci_delete_stored_link_key; |
va009039 | 0:1ed23ab1345f | 279 | extern const hci_cmd_t hci_disconnect; |
va009039 | 0:1ed23ab1345f | 280 | extern const hci_cmd_t hci_host_buffer_size; |
va009039 | 0:1ed23ab1345f | 281 | extern const hci_cmd_t hci_inquiry; |
va009039 | 0:1ed23ab1345f | 282 | extern const hci_cmd_t hci_inquiry_cancel; |
va009039 | 0:1ed23ab1345f | 283 | extern const hci_cmd_t hci_link_key_request_negative_reply; |
va009039 | 0:1ed23ab1345f | 284 | extern const hci_cmd_t hci_link_key_request_reply; |
va009039 | 0:1ed23ab1345f | 285 | extern const hci_cmd_t hci_pin_code_request_reply; |
va009039 | 0:1ed23ab1345f | 286 | extern const hci_cmd_t hci_pin_code_request_negative_reply; |
va009039 | 0:1ed23ab1345f | 287 | extern const hci_cmd_t hci_qos_setup; |
va009039 | 0:1ed23ab1345f | 288 | extern const hci_cmd_t hci_read_bd_addr; |
va009039 | 0:1ed23ab1345f | 289 | extern const hci_cmd_t hci_read_buffer_size; |
va009039 | 0:1ed23ab1345f | 290 | extern const hci_cmd_t hci_read_le_host_supported; |
va009039 | 0:1ed23ab1345f | 291 | extern const hci_cmd_t hci_read_link_policy_settings; |
va009039 | 0:1ed23ab1345f | 292 | extern const hci_cmd_t hci_read_link_supervision_timeout; |
va009039 | 0:1ed23ab1345f | 293 | extern const hci_cmd_t hci_read_local_supported_features; |
va009039 | 0:1ed23ab1345f | 294 | extern const hci_cmd_t hci_read_num_broadcast_retransmissions; |
va009039 | 0:1ed23ab1345f | 295 | extern const hci_cmd_t hci_reject_connection_request; |
va009039 | 0:1ed23ab1345f | 296 | extern const hci_cmd_t hci_remote_name_request; |
va009039 | 0:1ed23ab1345f | 297 | extern const hci_cmd_t hci_remote_name_request_cancel; |
va009039 | 0:1ed23ab1345f | 298 | extern const hci_cmd_t hci_reset; |
va009039 | 0:1ed23ab1345f | 299 | extern const hci_cmd_t hci_role_discovery; |
va009039 | 0:1ed23ab1345f | 300 | extern const hci_cmd_t hci_set_event_mask; |
va009039 | 0:1ed23ab1345f | 301 | extern const hci_cmd_t hci_set_connection_encryption; |
va009039 | 0:1ed23ab1345f | 302 | extern const hci_cmd_t hci_sniff_mode; |
va009039 | 0:1ed23ab1345f | 303 | extern const hci_cmd_t hci_switch_role_command; |
va009039 | 0:1ed23ab1345f | 304 | extern const hci_cmd_t hci_write_authentication_enable; |
va009039 | 0:1ed23ab1345f | 305 | extern const hci_cmd_t hci_write_class_of_device; |
va009039 | 0:1ed23ab1345f | 306 | extern const hci_cmd_t hci_write_extended_inquiry_response; |
va009039 | 0:1ed23ab1345f | 307 | extern const hci_cmd_t hci_write_inquiry_mode; |
va009039 | 0:1ed23ab1345f | 308 | extern const hci_cmd_t hci_write_le_host_supported; |
va009039 | 0:1ed23ab1345f | 309 | extern const hci_cmd_t hci_write_link_policy_settings; |
va009039 | 0:1ed23ab1345f | 310 | extern const hci_cmd_t hci_write_link_supervision_timeout; |
va009039 | 0:1ed23ab1345f | 311 | extern const hci_cmd_t hci_write_local_name; |
va009039 | 0:1ed23ab1345f | 312 | extern const hci_cmd_t hci_write_num_broadcast_retransmissions; |
va009039 | 0:1ed23ab1345f | 313 | extern const hci_cmd_t hci_write_page_timeout; |
va009039 | 0:1ed23ab1345f | 314 | extern const hci_cmd_t hci_write_scan_enable; |
va009039 | 0:1ed23ab1345f | 315 | extern const hci_cmd_t hci_write_simple_pairing_mode; |
va009039 | 0:1ed23ab1345f | 316 | |
va009039 | 0:1ed23ab1345f | 317 | extern const hci_cmd_t hci_le_add_device_to_whitelist; |
va009039 | 0:1ed23ab1345f | 318 | extern const hci_cmd_t hci_le_clear_white_list; |
va009039 | 0:1ed23ab1345f | 319 | extern const hci_cmd_t hci_le_connection_update; |
va009039 | 0:1ed23ab1345f | 320 | extern const hci_cmd_t hci_le_create_connection; |
va009039 | 0:1ed23ab1345f | 321 | extern const hci_cmd_t hci_le_create_connection_cancel; |
va009039 | 0:1ed23ab1345f | 322 | extern const hci_cmd_t hci_le_encrypt; |
va009039 | 0:1ed23ab1345f | 323 | extern const hci_cmd_t hci_le_long_term_key_negative_reply; |
va009039 | 0:1ed23ab1345f | 324 | extern const hci_cmd_t hci_le_long_term_key_request_reply; |
va009039 | 0:1ed23ab1345f | 325 | extern const hci_cmd_t hci_le_rand; |
va009039 | 0:1ed23ab1345f | 326 | extern const hci_cmd_t hci_le_read_advertising_channel_tx_power; |
va009039 | 0:1ed23ab1345f | 327 | extern const hci_cmd_t hci_le_read_buffer_size ; |
va009039 | 0:1ed23ab1345f | 328 | extern const hci_cmd_t hci_le_read_channel_map; |
va009039 | 0:1ed23ab1345f | 329 | extern const hci_cmd_t hci_le_read_remote_used_features; |
va009039 | 0:1ed23ab1345f | 330 | extern const hci_cmd_t hci_le_read_supported_features; |
va009039 | 0:1ed23ab1345f | 331 | extern const hci_cmd_t hci_le_read_supported_states; |
va009039 | 0:1ed23ab1345f | 332 | extern const hci_cmd_t hci_le_read_white_list_size; |
va009039 | 0:1ed23ab1345f | 333 | extern const hci_cmd_t hci_le_receiver_test; |
va009039 | 0:1ed23ab1345f | 334 | extern const hci_cmd_t hci_le_remove_device_from_whitelist; |
va009039 | 0:1ed23ab1345f | 335 | extern const hci_cmd_t hci_le_set_advertise_enable; |
va009039 | 0:1ed23ab1345f | 336 | extern const hci_cmd_t hci_le_set_advertising_data; |
va009039 | 0:1ed23ab1345f | 337 | extern const hci_cmd_t hci_le_set_advertising_parameters; |
va009039 | 0:1ed23ab1345f | 338 | extern const hci_cmd_t hci_le_set_event_mask; |
va009039 | 0:1ed23ab1345f | 339 | extern const hci_cmd_t hci_le_set_host_channel_classification; |
va009039 | 0:1ed23ab1345f | 340 | extern const hci_cmd_t hci_le_set_random_address; |
va009039 | 0:1ed23ab1345f | 341 | extern const hci_cmd_t hci_le_set_scan_enable; |
va009039 | 0:1ed23ab1345f | 342 | extern const hci_cmd_t hci_le_set_scan_parameters; |
va009039 | 0:1ed23ab1345f | 343 | extern const hci_cmd_t hci_le_set_scan_response_data; |
va009039 | 0:1ed23ab1345f | 344 | extern const hci_cmd_t hci_le_start_encryption; |
va009039 | 0:1ed23ab1345f | 345 | extern const hci_cmd_t hci_le_test_end; |
va009039 | 0:1ed23ab1345f | 346 | extern const hci_cmd_t hci_le_transmitter_test; |
va009039 | 0:1ed23ab1345f | 347 | |
va009039 | 0:1ed23ab1345f | 348 | extern const hci_cmd_t l2cap_accept_connection; |
va009039 | 0:1ed23ab1345f | 349 | extern const hci_cmd_t l2cap_create_channel; |
va009039 | 0:1ed23ab1345f | 350 | extern const hci_cmd_t l2cap_create_channel_mtu; |
va009039 | 0:1ed23ab1345f | 351 | extern const hci_cmd_t l2cap_decline_connection; |
va009039 | 0:1ed23ab1345f | 352 | extern const hci_cmd_t l2cap_disconnect; |
va009039 | 0:1ed23ab1345f | 353 | extern const hci_cmd_t l2cap_register_service; |
va009039 | 0:1ed23ab1345f | 354 | extern const hci_cmd_t l2cap_unregister_service; |
va009039 | 0:1ed23ab1345f | 355 | |
va009039 | 0:1ed23ab1345f | 356 | extern const hci_cmd_t sdp_register_service_record; |
va009039 | 0:1ed23ab1345f | 357 | extern const hci_cmd_t sdp_unregister_service_record; |
va009039 | 0:1ed23ab1345f | 358 | |
va009039 | 0:1ed23ab1345f | 359 | // accept connection @param bd_addr(48), rfcomm_cid (16) |
va009039 | 0:1ed23ab1345f | 360 | extern const hci_cmd_t rfcomm_accept_connection; |
va009039 | 0:1ed23ab1345f | 361 | // create rfcomm channel: @param bd_addr(48), channel (8) |
va009039 | 0:1ed23ab1345f | 362 | extern const hci_cmd_t rfcomm_create_channel; |
va009039 | 0:1ed23ab1345f | 363 | // create rfcomm channel: @param bd_addr(48), channel (8), mtu (16), credits (8) |
va009039 | 0:1ed23ab1345f | 364 | extern const hci_cmd_t rfcomm_create_channel_with_initial_credits; |
va009039 | 0:1ed23ab1345f | 365 | // decline rfcomm disconnect,@param bd_addr(48), rfcomm cid (16), reason(8) |
va009039 | 0:1ed23ab1345f | 366 | extern const hci_cmd_t rfcomm_decline_connection; |
va009039 | 0:1ed23ab1345f | 367 | // disconnect rfcomm disconnect, @param rfcomm_cid(8), reason(8) |
va009039 | 0:1ed23ab1345f | 368 | extern const hci_cmd_t rfcomm_disconnect; |
va009039 | 0:1ed23ab1345f | 369 | // register rfcomm service: @param channel(8), mtu (16) |
va009039 | 0:1ed23ab1345f | 370 | extern const hci_cmd_t rfcomm_register_service; |
va009039 | 0:1ed23ab1345f | 371 | // register rfcomm service: @param channel(8), mtu (16), initial credits (8) |
va009039 | 0:1ed23ab1345f | 372 | extern const hci_cmd_t rfcomm_register_service_with_initial_credits; |
va009039 | 0:1ed23ab1345f | 373 | // unregister rfcomm service, @param service_channel(16) |
va009039 | 0:1ed23ab1345f | 374 | extern const hci_cmd_t rfcomm_unregister_service; |
va009039 | 0:1ed23ab1345f | 375 | // request persisten rfcomm channel for service name: serive name (char*) |
va009039 | 0:1ed23ab1345f | 376 | extern const hci_cmd_t rfcomm_persistent_channel_for_service; |
va009039 | 0:1ed23ab1345f | 377 | |
va009039 | 0:1ed23ab1345f | 378 | #if defined __cplusplus |
va009039 | 0:1ed23ab1345f | 379 | } |
va009039 | 0:1ed23ab1345f | 380 | #endif |