source: asp3_tinet_ecnl_arm/trunk/btstack/include/btstack/hci_cmds.h@ 387

Last change on this file since 387 was 387, checked in by coas-nagasima, 5 years ago

ファイルディスクリプタ処理を更新

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 26.3 KB
Line 
1/*
2 * Copyright (C) 2009 by Matthias Ringwald
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. Neither the name of the copyright holders nor the names of
14 * contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
21 * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
24 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
27 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
30 */
31
32/*
33 * hci_cmds.h
34 *
35 * Created by Matthias Ringwald on 7/23/09.
36 */
37
38#ifndef __HCI_CMDS_H
39#define __HCI_CMDS_H
40
41#include <stdint.h>
42
43#if defined __cplusplus
44extern "C" {
45#endif
46
47/**
48 * packet types - used in BTstack and over the H4 UART interface
49 */
50#define HCI_COMMAND_DATA_PACKET 0x01
51#define HCI_ACL_DATA_PACKET 0x02
52#define HCI_SCO_DATA_PACKET 0x03
53#define HCI_EVENT_PACKET 0x04
54
55// extension for client/server communication
56#define DAEMON_EVENT_PACKET 0x05
57
58// L2CAP data
59#define L2CAP_DATA_PACKET 0x06
60
61// RFCOMM data
62#define RFCOMM_DATA_PACKET 0x07
63
64// Attribute protocol data
65#define ATT_DATA_PACKET 0x08
66
67// Security Manager protocol data
68#define SM_DATA_PACKET 0x09
69
70// SDP query result
71// format: type (8), record_id (16), attribute_id (16), attribute_length (16), attribute_value (max 1k)
72#define SDP_CLIENT_PACKET 0x0a
73
74// BNEP data
75#define BNEP_DATA_PACKET 0x0b
76
77// debug log messages
78#define LOG_MESSAGE_PACKET 0xfc
79
80
81// Fixed PSM numbers
82#define PSM_SDP 0x01
83#define PSM_RFCOMM 0x03
84#define PSM_HID_CONTROL 0x11
85#define PSM_HID_INTERRUPT 0x13
86#define PSM_BNEP 0x0F
87
88 // Events from host controller to host
89
90/**
91 * @format 1
92 * @param status
93 */
94#define HCI_EVENT_INQUIRY_COMPLETE 0x01
95// no format yet, can contain multiple results
96
97/**
98 * @format 1B11132
99 * @param num_responses
100 * @param bd_addr
101 * @param page_scan_repetition_mode
102 * @param reserved1
103 * @param reserved2
104 * @param class_of_device
105 * @param clock_offset
106 */
107#define HCI_EVENT_INQUIRY_RESULT 0x02
108
109/**
110 * @format 12B11
111 * @param status
112 * @param connection_handle
113 * @param bd_addr
114 * @param link_type
115 * @param encryption_enabled
116 */
117#define HCI_EVENT_CONNECTION_COMPLETE 0x03
118/**
119 * @format B31
120 * @param bd_addr
121 * @param class_of_device
122 * @param link_type
123 */
124#define HCI_EVENT_CONNECTION_REQUEST 0x04
125/**
126 * @format 121
127 * @param status
128 * @param connection_handle
129 * @param reason
130 */
131#define HCI_EVENT_DISCONNECTION_COMPLETE 0x05
132/**
133 * @format 12
134 * @param status
135 * @param connection_handle
136 */
137#define HCI_EVENT_AUTHENTICATION_COMPLETE_EVENT 0x06
138/**
139 * @format 1BN
140 * @param status
141 * @param bd_addr
142 * @param remote_name
143 */
144#define HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE 0x07
145/**
146 * @format 121
147 * @param status
148 * @param connection_handle
149 * @param encryption_enabled
150 */
151#define HCI_EVENT_ENCRYPTION_CHANGE 0x08
152/**
153 * @format 12
154 * @param status
155 * @param connection_handle
156 */
157#define HCI_EVENT_CHANGE_CONNECTION_LINK_KEY_COMPLETE 0x09
158/**
159 * @format 121
160 * @param status
161 * @param connection_handle
162 * @param key_flag
163 */
164#define HCI_EVENT_MASTER_LINK_KEY_COMPLETE 0x0A
165#define HCI_EVENT_READ_REMOTE_SUPPORTED_FEATURES_COMPLETE 0x0B
166#define HCI_EVENT_READ_REMOTE_VERSION_INFORMATION_COMPLETE 0x0C
167#define HCI_EVENT_QOS_SETUP_COMPLETE 0x0D
168
169/**
170 * @format 12R
171 * @param num_hci_command_packets
172 * @param command_opcode
173 * @param return_parameters
174 */
175#define HCI_EVENT_COMMAND_COMPLETE 0x0E
176/**
177 * @format 112
178 * @param status
179 * @param num_hci_command_packets
180 * @param command_opcode
181 */
182#define HCI_EVENT_COMMAND_STATUS 0x0F
183
184/**
185 * @format 121
186 * @param hardware_code
187 */
188#define HCI_EVENT_HARDWARE_ERROR 0x10
189
190#define HCI_EVENT_FLUSH_OCCURED 0x11
191#define HCI_EVENT_ROLE_CHANGE 0x12
192#define HCI_EVENT_NUMBER_OF_COMPLETED_PACKETS 0x13
193#define HCI_EVENT_MODE_CHANGE_EVENT 0x14
194#define HCI_EVENT_RETURN_LINK_KEYS 0x15
195#define HCI_EVENT_PIN_CODE_REQUEST 0x16
196#define HCI_EVENT_LINK_KEY_REQUEST 0x17
197#define HCI_EVENT_LINK_KEY_NOTIFICATION 0x18
198#define HCI_EVENT_DATA_BUFFER_OVERFLOW 0x1A
199#define HCI_EVENT_MAX_SLOTS_CHANGED 0x1B
200#define HCI_EVENT_READ_CLOCK_OFFSET_COMPLETE 0x1C
201#define HCI_EVENT_PACKET_TYPE_CHANGED 0x1D
202
203/**
204 * @format 1B11321
205 * @param num_responses
206 * @param bd_addr
207 * @param page_scan_repetition_mode
208 * @param reserved
209 * @param class_of_device
210 * @param clock_offset
211 * @param rssi
212 */
213#define HCI_EVENT_INQUIRY_RESULT_WITH_RSSI 0x22
214
215// TODO: serialize extended_inquiry_response and provide parser
216/**
217 * @format 1B11321
218 * @param num_responses
219 * @param bd_addr
220 * @param page_scan_repetition_mode
221 * @param reserved
222 * @param class_of_device
223 * @param clock_offset
224 * @param rssi
225 */
226#define HCI_EVENT_EXTENDED_INQUIRY_RESPONSE 0x2F
227
228#define HCI_EVENT_IO_CAPABILITY_REQUEST 0x31
229#define HCI_EVENT_IO_CAPABILITY_RESPONSE 0x32
230#define HCI_EVENT_USER_CONFIRMATION_REQUEST 0x33
231#define HCI_EVENT_USER_PASSKEY_REQUEST 0x34
232#define HCI_EVENT_REMOTE_OOB_DATA_REQUEST 0x35
233#define HCI_EVENT_SIMPLE_PAIRING_COMPLETE 0x36
234#define HCI_EVENT_LE_META 0x3E
235#define HCI_EVENT_VENDOR_SPECIFIC 0xFF
236
237/**
238 * @format 11211B2221
239 * @param subevent_code
240 * @param status
241 * @param connection_handle
242 * @param role
243 * @param peer_address_type
244 * @param peer_address
245 * @param conn_interval
246 * @param conn_latency
247 * @param supervision_timeout
248 * @param master_clock_accuracy
249 */
250#define HCI_SUBEVENT_LE_CONNECTION_COMPLETE 0x01
251#define HCI_SUBEVENT_LE_ADVERTISING_REPORT 0x02
252#define HCI_SUBEVENT_LE_CONNECTION_UPDATE_COMPLETE 0x03
253#define HCI_SUBEVENT_LE_READ_REMOTE_USED_FEATURES_COMPLETE 0x04
254#define HCI_SUBEVENT_LE_LONG_TERM_KEY_REQUEST 0x05
255
256// last used HCI_EVENT in 2.1 is 0x3d
257
258// events 0x50-0x5f are used internally
259
260// BTSTACK DAEMON EVENTS
261
262// events from BTstack for application/client lib
263
264/**
265 * @format 1
266 * @param state
267 */
268#define BTSTACK_EVENT_STATE 0x60
269
270// data: event(8), len(8), nr hci connections
271#define BTSTACK_EVENT_NR_CONNECTIONS_CHANGED 0x61
272
273/**
274 * @format
275 */
276#define BTSTACK_EVENT_POWERON_FAILED 0x62
277
278/**
279 * @format 112
280 * @param major
281 * @param minor
282 @ @param revision
283 */
284#define BTSTACK_EVENT_VERSION 0x63
285
286// data: system bluetooth on/off (bool)
287#define BTSTACK_EVENT_SYSTEM_BLUETOOTH_ENABLED 0x64
288
289// data: event (8), len(8), status (8) == 0, address (48), name (1984 bits = 248 bytes)
290#define BTSTACK_EVENT_REMOTE_NAME_CACHED 0x65
291
292// data: discoverable enabled (bool)
293#define BTSTACK_EVENT_DISCOVERABLE_ENABLED 0x66
294
295// L2CAP EVENTS
296
297// 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), flush_timeout(16)
298#define L2CAP_EVENT_CHANNEL_OPENED 0x70
299
300// data: event (8), len(8), channel (16)
301#define L2CAP_EVENT_CHANNEL_CLOSED 0x71
302
303// data: event (8), len(8), address(48), handle (16), psm (16), local_cid(16), remote_cid (16)
304#define L2CAP_EVENT_INCOMING_CONNECTION 0x72
305
306// data: event(8), len(8), handle(16)
307#define L2CAP_EVENT_TIMEOUT_CHECK 0x73
308
309// data: event(8), len(8), local_cid(16), credits(8)
310#define L2CAP_EVENT_CREDITS 0x74
311
312// data: event(8), len(8), status (8), psm (16)
313#define L2CAP_EVENT_SERVICE_REGISTERED 0x75
314
315// data: event(8), len(8), handle(16), interval min(16), interval max(16), latency(16), timeout multiplier(16)
316#define L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_REQUEST 0x76
317
318// data: event(8), len(8), handle(16), result (16) (0 == ok, 1 == fail)
319#define L2CAP_EVENT_CONNECTION_PARAMETER_UPDATE_RESPONSE 0x77
320
321// RFCOMM EVENTS
322/**
323 * @format 1B2122
324 * @param status
325 * @param bd_addr
326 * @param con_handle
327 * @param server_channel
328 * @param rfcomm_cid
329 * @param max_frame_size
330 */
331#define RFCOMM_EVENT_OPEN_CHANNEL_COMPLETE 0x80
332
333/**
334 * @format 2
335 * @param rfcomm_cid
336 */
337#define RFCOMM_EVENT_CHANNEL_CLOSED 0x81
338
339/**
340 * @format B12
341 * @param bd_addr
342 * @param server_channel
343 * @param rfcomm_cid
344 */
345#define RFCOMM_EVENT_INCOMING_CONNECTION 0x82
346
347/**
348 * @format 21
349 * @param rfcomm_cid
350 * @param line_status
351 */
352#define RFCOMM_EVENT_REMOTE_LINE_STATUS 0x83
353
354/**
355 * @format 21
356 * @param rfcomm_cid
357 * @param credits
358 */
359#define RFCOMM_EVENT_CREDITS 0x84
360
361/**
362 * @format 11
363 * @param status
364 * @param channel_id
365 */
366#define RFCOMM_EVENT_SERVICE_REGISTERED 0x85
367
368/**
369 * @format 11
370 * @param status
371 * @param server_channel_id
372 */
373#define RFCOMM_EVENT_PERSISTENT_CHANNEL 0x86
374
375// data: event (8), len(8), rfcomm_cid (16), modem status (8)
376
377/**
378 * @format 21
379 * @param rfcomm_cid
380 * @param modem_status
381 */
382#define RFCOMM_EVENT_REMOTE_MODEM_STATUS 0x87
383
384// data: event (8), len(8), rfcomm_cid (16), rpn_data_t (67)
385 /**
386 * TODO: format for variable data
387 * @param rfcomm_cid
388 * @param rpn_data
389 */
390#define RFCOMM_EVENT_PORT_CONFIGURATION 0x88
391
392
393// data: event(8), len(8), status(8), service_record_handle(32)
394 /**
395 * @format 14
396 * @param status
397 * @param service_record_handle
398 */
399#define SDP_SERVICE_REGISTERED 0x90
400
401// data: event(8), len(8), status(8)
402/**
403 * @format 1
404 * @param status
405 */
406#define SDP_EVENT_QUERY_COMPLETE 0x91
407
408// data: event(8), len(8), rfcomm channel(8), name(var)
409/**
410 * @format 1T
411 * @param rfcomm_channel
412 * @param name
413 * @brief SDP_QUERY_RFCOMM_SERVICE 0x92
414 */
415#define SDP_QUERY_RFCOMM_SERVICE 0x92
416
417// data: event(8), len(8), record nr(16), attribute id(16), attribute value(var)
418/**
419 * TODO: format for variable data
420 * @param record_nr
421 * @param attribute_id
422 * @param attribute_value
423 */
424#define SDP_EVENT_QUERY_ATTRIBUTE_VALUE 0x93
425
426// not provided by daemon, only used for internal testing
427#define SDP_QUERY_SERVICE_RECORD_HANDLE 0x94
428
429/**
430 * @format H1
431 * @param handle
432 * @param status
433 */
434#define GATT_QUERY_COMPLETE 0xA0
435
436/**
437 * @format HX
438 * @param handle
439 * @param service
440 */
441#define GATT_SERVICE_QUERY_RESULT 0xA1
442
443/**
444 * @format HY
445 * @param handle
446 * @param characteristic
447 */
448#define GATT_CHARACTERISTIC_QUERY_RESULT 0xA2
449
450/**
451 * @format HX
452 * @param handle
453 * @param service
454 */
455#define GATT_INCLUDED_SERVICE_QUERY_RESULT 0xA3
456
457/**
458 * @format HZ
459 * @param handle
460 * @param characteristic_descriptor
461 */
462#define GATT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT 0xA4
463
464/**
465 * @format H2LV
466 * @param handle
467 * @param value_handle
468 * @param value_length
469 * @param value
470 */
471#define GATT_CHARACTERISTIC_VALUE_QUERY_RESULT 0xA5
472
473/**
474 * @format H2LV
475 * @param handle
476 * @param value_handle
477 * @param value_length
478 * @param value
479 */
480#define GATT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT 0xA6
481
482/**
483 * @format H2LV
484 * @param handle
485 * @param value_handle
486 * @param value_length
487 * @param value
488 */
489#define GATT_NOTIFICATION 0xA7
490
491/**
492 * @format H2LV
493 * @param handle
494 * @param value_handle
495 * @param value_length
496 * @param value
497 */
498#define GATT_INDICATION 0xA8
499
500#define GATT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT 0xA9
501#define GATT_LONG_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT 0xAA
502
503// data: event(8), len(8), status (8), hci_handle (16), attribute_handle (16)
504#define ATT_HANDLE_VALUE_INDICATION_COMPLETE 0xB6
505
506
507// data: event(8), len(8), status (8), bnep service uuid (16)
508#define BNEP_EVENT_SERVICE_REGISTERED 0xC0
509
510// data: event(8), len(8), status (8), bnep source uuid (16), bnep destination uuid (16), mtu (16), remote_address (48)
511#define BNEP_EVENT_OPEN_CHANNEL_COMPLETE 0xC1
512
513// data: event(8), len(8), status (8), bnep source uuid (16), bnep destination uuid (16), mtu (16), remote_address (48)
514#define BNEP_EVENT_INCOMING_CONNECTION 0xC2
515
516// data: event(8), len(8), bnep source uuid (16), bnep destination uuid (16), remote_address (48)
517#define BNEP_EVENT_CHANNEL_CLOSED 0xC3
518
519// data: event(8), len(8), bnep source uuid (16), bnep destination uuid (16), remote_address (48), channel state (8)
520#define BNEP_EVENT_CHANNEL_TIMEOUT 0xC4
521
522// data: event(8), len(8)
523#define BNEP_EVENT_READY_TO_SEND 0xC5
524
525// data: event(8), address_type(8), address (48), [number(32)]
526#define SM_JUST_WORKS_REQUEST 0xD0
527#define SM_JUST_WORKS_CANCEL 0xD1
528#define SM_PASSKEY_DISPLAY_NUMBER 0xD2
529#define SM_PASSKEY_DISPLAY_CANCEL 0xD3
530#define SM_PASSKEY_INPUT_NUMBER 0xD4
531#define SM_PASSKEY_INPUT_CANCEL 0xD5
532#define SM_IDENTITY_RESOLVING_STARTED 0xD6
533#define SM_IDENTITY_RESOLVING_FAILED 0xD7
534#define SM_IDENTITY_RESOLVING_SUCCEEDED 0xD8
535#define SM_AUTHORIZATION_REQUEST 0xD9
536#define SM_AUTHORIZATION_RESULT 0xDA
537
538// GAP
539
540// data: event(8), len(8), hci_handle (16), security_level (8)
541#define GAP_SECURITY_LEVEL 0xE0
542
543// data: event(8), len(8), status (8), bd_addr(48)
544#define GAP_DEDICATED_BONDING_COMPLETED 0xE1
545
546/**
547 * @format 11B1JV
548 * @param advertising_event_type
549 * @param address_type
550 * @param address
551 * @param rssi
552 * @param data_length
553 * @param data
554 */
555#define GAP_LE_ADVERTISING_REPORT 0xE2
556
557// ANCS Client
558#define ANCS_CLIENT_CONNECTED 0xF0
559#define ANCS_CLIENT_NOTIFICATION 0xF1
560#define ANCS_CLIENT_DISCONNECTED 0xF2
561//
562// Error Codes
563//
564
565// from Bluetooth Core Specification
566#define ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER 0x02
567#define ERROR_CODE_COMMAND_DISALLOWED 0x0C
568#define ERROR_CODE_PAIRING_NOT_ALLOWED 0x18
569#define ERROR_CODE_INSUFFICIENT_SECURITY 0x2F
570
571// last error code in 2.1 is 0x38 - we start with 0x50 for BTstack errors
572#define BTSTACK_CONNECTION_TO_BTDAEMON_FAILED 0x50
573#define BTSTACK_ACTIVATION_FAILED_SYSTEM_BLUETOOTH 0x51
574#define BTSTACK_ACTIVATION_POWERON_FAILED 0x52
575#define BTSTACK_ACTIVATION_FAILED_UNKNOWN 0x53
576#define BTSTACK_NOT_ACTIVATED 0x54
577#define BTSTACK_BUSY 0x55
578#define BTSTACK_MEMORY_ALLOC_FAILED 0x56
579#define BTSTACK_ACL_BUFFERS_FULL 0x57
580
581// l2cap errors - enumeration by the command that created them
582#define L2CAP_COMMAND_REJECT_REASON_COMMAND_NOT_UNDERSTOOD 0x60
583#define L2CAP_COMMAND_REJECT_REASON_SIGNALING_MTU_EXCEEDED 0x61
584#define L2CAP_COMMAND_REJECT_REASON_INVALID_CID_IN_REQUEST 0x62
585
586#define L2CAP_CONNECTION_RESPONSE_RESULT_SUCCESSFUL 0x63
587#define L2CAP_CONNECTION_RESPONSE_RESULT_PENDING 0x64
588#define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_PSM 0x65
589#define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_SECURITY 0x66
590#define L2CAP_CONNECTION_RESPONSE_RESULT_REFUSED_RESOURCES 0x67
591#define L2CAP_CONNECTION_RESPONSE_RESULT_RTX_TIMEOUT 0x68
592
593#define L2CAP_SERVICE_ALREADY_REGISTERED 0x69
594#define L2CAP_DATA_LEN_EXCEEDS_REMOTE_MTU 0x6A
595
596#define RFCOMM_MULTIPLEXER_STOPPED 0x70
597#define RFCOMM_CHANNEL_ALREADY_REGISTERED 0x71
598#define RFCOMM_NO_OUTGOING_CREDITS 0x72
599#define RFCOMM_AGGREGATE_FLOW_OFF 0x73
600#define RFCOMM_DATA_LEN_EXCEEDS_MTU 0x74
601
602#define SDP_HANDLE_ALREADY_REGISTERED 0x80
603#define SDP_QUERY_INCOMPLETE 0x81
604
605#define ATT_HANDLE_VALUE_INDICATION_IN_PORGRESS 0x90
606#define ATT_HANDLE_VALUE_INDICATION_TIMEOUT 0x91
607
608#define GATT_CLIENT_NOT_CONNECTED 0x93
609#define GATT_CLIENT_BUSY 0x94
610
611#define BNEP_SERVICE_ALREADY_REGISTERED 0xA0
612#define BNEP_CHANNEL_NOT_CONNECTED 0xA1
613#define BNEP_DATA_LEN_EXCEEDS_MTU 0xA2
614
615typedef enum {
616 BLE_PERIPHERAL_OK = 0xA0,
617 BLE_PERIPHERAL_IN_WRONG_STATE,
618 BLE_PERIPHERAL_DIFFERENT_CONTEXT_FOR_ADDRESS_ALREADY_EXISTS,
619 BLE_PERIPHERAL_NOT_CONNECTED,
620 BLE_VALUE_TOO_LONG,
621 BLE_PERIPHERAL_BUSY,
622 BLE_CHARACTERISTIC_NOTIFICATION_NOT_SUPPORTED,
623 BLE_CHARACTERISTIC_INDICATION_NOT_SUPPORTED
624} le_command_status_t;
625
626/**
627 * Default INQ Mode
628 */
629#define HCI_INQUIRY_LAP 0x9E8B33L // 0x9E8B33: General/Unlimited Inquiry Access Code (GIAC)
630
631/**
632 * SSP IO Capabilities - if capability is set, BTstack answers IO Capability Requests
633 */
634#define SSP_IO_CAPABILITY_DISPLAY_ONLY 0
635#define SSP_IO_CAPABILITY_DISPLAY_YES_NO 1
636#define SSP_IO_CAPABILITY_KEYBOARD_ONLY 2
637#define SSP_IO_CAPABILITY_NO_INPUT_NO_OUTPUT 3
638#define SSP_IO_CAPABILITY_UNKNOWN 0xff
639
640/**
641 * SSP Authentication Requirements, see IO Capability Request Reply Commmand
642 */
643
644// Numeric comparison with automatic accept allowed.
645#define SSP_IO_AUTHREQ_MITM_PROTECTION_NOT_REQUIRED_NO_BONDING 0x00
646
647// Use IO Capabilities to deter- mine authentication procedure
648#define SSP_IO_AUTHREQ_MITM_PROTECTION_REQUIRED_NO_BONDING 0x01
649
650// Numeric compar- ison with automatic accept allowed.
651#define SSP_IO_AUTHREQ_MITM_PROTECTION_NOT_REQUIRED_DEDICATED_BONDING 0x02
652
653// Use IO Capabilities to determine authentication procedure
654#define SSP_IO_AUTHREQ_MITM_PROTECTION_REQUIRED_DEDICATED_BONDING 0x03
655
656// Numeric Compari- son with automatic accept allowed.
657#define SSP_IO_AUTHREQ_MITM_PROTECTION_NOT_REQUIRED_GENERAL_BONDING 0x04
658
659// . Use IO capabilities to determine authentication procedure.
660#define SSP_IO_AUTHREQ_MITM_PROTECTION_REQUIRED_GENERAL_BONDING 0x05
661
662/**
663 * Address types
664 * @note: BTstack uses a custom addr type to refer to classic devices
665 */
666 typedef enum {
667 BD_ADDR_TYPE_LE_PUBLIC = 0,
668 BD_ADDR_TYPE_LE_RANDOM = 1,
669 BD_ADDR_TYPE_CLASSIC = 0xff,
670 BD_ADDR_TYPE_UNKNOWN = 0xfe
671 } bd_addr_type_t;
672
673/**
674 * Hardware state of Bluetooth controller
675 */
676typedef enum {
677 HCI_POWER_OFF = 0,
678 HCI_POWER_ON,
679 HCI_POWER_SLEEP
680} HCI_POWER_MODE;
681
682/**
683 * State of BTstack
684 */
685typedef enum {
686 HCI_STATE_OFF = 0,
687 HCI_STATE_INITIALIZING,
688 HCI_STATE_WORKING,
689 HCI_STATE_HALTING,
690 HCI_STATE_SLEEPING,
691 HCI_STATE_FALLING_ASLEEP
692} HCI_STATE;
693
694/**
695 * compact HCI Command packet description
696 */
697 typedef struct {
698 uint16_t opcode;
699 const char *format;
700} hci_cmd_t;
701
702
703// HCI Commands - see hci_cmds.c for info on parameters
704extern const hci_cmd_t btstack_get_state;
705extern const hci_cmd_t btstack_set_power_mode;
706extern const hci_cmd_t btstack_set_acl_capture_mode;
707extern const hci_cmd_t btstack_get_version;
708extern const hci_cmd_t btstack_get_system_bluetooth_enabled;
709extern const hci_cmd_t btstack_set_system_bluetooth_enabled;
710extern const hci_cmd_t btstack_set_discoverable;
711extern const hci_cmd_t btstack_set_bluetooth_enabled; // only used by btstack config
712
713extern const hci_cmd_t hci_accept_connection_request;
714extern const hci_cmd_t hci_authentication_requested;
715extern const hci_cmd_t hci_change_connection_link_key;
716extern const hci_cmd_t hci_change_connection_packet_type;
717extern const hci_cmd_t hci_create_connection;
718extern const hci_cmd_t hci_create_connection_cancel;
719extern const hci_cmd_t hci_delete_stored_link_key;
720extern const hci_cmd_t hci_disconnect;
721extern const hci_cmd_t hci_host_buffer_size;
722extern const hci_cmd_t hci_inquiry;
723extern const hci_cmd_t hci_io_capability_request_reply;
724extern const hci_cmd_t hci_io_capability_request_negative_reply;
725extern const hci_cmd_t hci_inquiry_cancel;
726extern const hci_cmd_t hci_link_key_request_negative_reply;
727extern const hci_cmd_t hci_link_key_request_reply;
728extern const hci_cmd_t hci_pin_code_request_reply;
729extern const hci_cmd_t hci_pin_code_request_negative_reply;
730extern const hci_cmd_t hci_qos_setup;
731extern const hci_cmd_t hci_read_bd_addr;
732extern const hci_cmd_t hci_read_buffer_size;
733extern const hci_cmd_t hci_read_le_host_supported;
734extern const hci_cmd_t hci_read_link_policy_settings;
735extern const hci_cmd_t hci_read_link_supervision_timeout;
736extern const hci_cmd_t hci_read_local_supported_features;
737extern const hci_cmd_t hci_read_num_broadcast_retransmissions;
738extern const hci_cmd_t hci_read_remote_supported_features_command;
739extern const hci_cmd_t hci_read_rssi;
740extern const hci_cmd_t hci_reject_connection_request;
741extern const hci_cmd_t hci_remote_name_request;
742extern const hci_cmd_t hci_remote_name_request_cancel;
743extern const hci_cmd_t hci_remote_oob_data_request_negative_reply;
744extern const hci_cmd_t hci_reset;
745extern const hci_cmd_t hci_role_discovery;
746extern const hci_cmd_t hci_set_event_mask;
747extern const hci_cmd_t hci_set_connection_encryption;
748extern const hci_cmd_t hci_sniff_mode;
749extern const hci_cmd_t hci_switch_role_command;
750extern const hci_cmd_t hci_user_confirmation_request_negative_reply;
751extern const hci_cmd_t hci_user_confirmation_request_reply;
752extern const hci_cmd_t hci_user_passkey_request_negative_reply;
753extern const hci_cmd_t hci_user_passkey_request_reply;
754extern const hci_cmd_t hci_write_authentication_enable;
755extern const hci_cmd_t hci_write_class_of_device;
756extern const hci_cmd_t hci_write_extended_inquiry_response;
757extern const hci_cmd_t hci_write_inquiry_mode;
758extern const hci_cmd_t hci_write_le_host_supported;
759extern const hci_cmd_t hci_write_link_policy_settings;
760extern const hci_cmd_t hci_write_link_supervision_timeout;
761extern const hci_cmd_t hci_write_local_name;
762extern const hci_cmd_t hci_write_num_broadcast_retransmissions;
763extern const hci_cmd_t hci_write_page_timeout;
764extern const hci_cmd_t hci_write_scan_enable;
765extern const hci_cmd_t hci_write_simple_pairing_mode;
766
767extern const hci_cmd_t hci_le_add_device_to_whitelist;
768extern const hci_cmd_t hci_le_clear_white_list;
769extern const hci_cmd_t hci_le_connection_update;
770extern const hci_cmd_t hci_le_create_connection;
771extern const hci_cmd_t hci_le_create_connection_cancel;
772extern const hci_cmd_t hci_le_encrypt;
773extern const hci_cmd_t hci_le_long_term_key_negative_reply;
774extern const hci_cmd_t hci_le_long_term_key_request_reply;
775extern const hci_cmd_t hci_le_rand;
776extern const hci_cmd_t hci_le_read_advertising_channel_tx_power;
777extern const hci_cmd_t hci_le_read_buffer_size ;
778extern const hci_cmd_t hci_le_read_channel_map;
779extern const hci_cmd_t hci_le_read_remote_used_features;
780extern const hci_cmd_t hci_le_read_supported_features;
781extern const hci_cmd_t hci_le_read_supported_states;
782extern const hci_cmd_t hci_le_read_white_list_size;
783extern const hci_cmd_t hci_le_receiver_test;
784extern const hci_cmd_t hci_le_remove_device_from_whitelist;
785extern const hci_cmd_t hci_le_set_advertise_enable;
786extern const hci_cmd_t hci_le_set_advertising_data;
787extern const hci_cmd_t hci_le_set_advertising_parameters;
788extern const hci_cmd_t hci_le_set_event_mask;
789extern const hci_cmd_t hci_le_set_host_channel_classification;
790extern const hci_cmd_t hci_le_set_random_address;
791extern const hci_cmd_t hci_le_set_scan_enable;
792extern const hci_cmd_t hci_le_set_scan_parameters;
793extern const hci_cmd_t hci_le_set_scan_response_data;
794extern const hci_cmd_t hci_le_start_encryption;
795extern const hci_cmd_t hci_le_test_end;
796extern const hci_cmd_t hci_le_transmitter_test;
797
798extern const hci_cmd_t l2cap_accept_connection;
799extern const hci_cmd_t l2cap_create_channel;
800extern const hci_cmd_t l2cap_create_channel_mtu;
801extern const hci_cmd_t l2cap_decline_connection;
802extern const hci_cmd_t l2cap_disconnect;
803extern const hci_cmd_t l2cap_register_service;
804extern const hci_cmd_t l2cap_unregister_service;
805
806extern const hci_cmd_t sdp_register_service_record;
807extern const hci_cmd_t sdp_unregister_service_record;
808extern const hci_cmd_t sdp_client_query_rfcomm_services;
809extern const hci_cmd_t sdp_client_query_services;
810
811
812// accept connection @param bd_addr(48), rfcomm_cid (16)
813extern const hci_cmd_t rfcomm_accept_connection;
814// create rfcomm channel: @param bd_addr(48), channel (8)
815extern const hci_cmd_t rfcomm_create_channel;
816// create rfcomm channel: @param bd_addr(48), channel (8), mtu (16), credits (8)
817extern const hci_cmd_t rfcomm_create_channel_with_initial_credits;
818// decline rfcomm disconnect,@param bd_addr(48), rfcomm cid (16), reason(8)
819extern const hci_cmd_t rfcomm_decline_connection;
820// disconnect rfcomm disconnect, @param rfcomm_cid(8), reason(8)
821extern const hci_cmd_t rfcomm_disconnect;
822// register rfcomm service: @param channel(8), mtu (16)
823extern const hci_cmd_t rfcomm_register_service;
824// register rfcomm service: @param channel(8), mtu (16), initial credits (8)
825extern const hci_cmd_t rfcomm_register_service_with_initial_credits;
826// unregister rfcomm service, @param service_channel(16)
827extern const hci_cmd_t rfcomm_unregister_service;
828// request persisten rfcomm channel for service name: serive name (char*)
829extern const hci_cmd_t rfcomm_persistent_channel_for_service;
830
831extern const hci_cmd_t gap_disconnect_cmd;
832extern const hci_cmd_t gap_le_scan_start;
833extern const hci_cmd_t gap_le_scan_stop;
834extern const hci_cmd_t gap_le_set_scan_parameters;
835extern const hci_cmd_t gap_le_connect_cmd;
836extern const hci_cmd_t gap_le_connect_cancel_cmd;
837extern const hci_cmd_t gatt_discover_primary_services_cmd;
838
839#if defined __cplusplus
840}
841#endif
842
843#endif // __HCI_CMDS_H
Note: See TracBrowser for help on using the repository browser.