xref: /btstack/platform/daemon/src/daemon_cmds.h (revision 6e7533547b03da0aff8f9952b29113dd77a7ef60)
1 /*
2  * Copyright (C) 2014 BlueKitchen GmbH
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  * 4. Any redistribution, use, or modification is done solely for
17  *    personal benefit and not for any commercial purpose or for
18  *    monetary gain.
19  *
20  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BLUEKITCHEN
24  * GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  *
33  * Please inquire about commercial licensing options at
34  * [email protected]
35  *
36  */
37 
38 /*
39  *  daemon_cmds.h
40  */
41 
42 #ifndef DAEMON_CMDS_H
43 #define DAEMON_CMDS_H
44 
45 #include <stdint.h>
46 
47 #include "bluetooth.h"
48 #include "hci_cmd.h"
49 
50 #if defined __cplusplus
51 extern "C" {
52 #endif
53 
54 // calculate daemon (hci) opcode for ocf value
55 #define DAEMON_OPCODE(ocf) ((ocf) | ((OGF_BTSTACK) << 10))
56 
57 typedef enum {
58     DAEMON_OPCODE_BTSTACK_GET_STATE = DAEMON_OPCODE(BTSTACK_GET_STATE),
59     DAEMON_OPCODE_BTSTACK_SET_POWER_MODE = DAEMON_OPCODE(BTSTACK_SET_POWER_MODE),
60     DAEMON_OPCODE_BTSTACK_SET_ACL_CAPTURE_MODE = DAEMON_OPCODE(BTSTACK_SET_ACL_CAPTURE_MODE),
61     DAEMON_OPCODE_BTSTACK_GET_VERSION = DAEMON_OPCODE(BTSTACK_GET_VERSION),
62     DAEMON_OPCODE_BTSTACK_GET_SYSTEM_BLUETOOTH_ENABLED = DAEMON_OPCODE(BTSTACK_GET_SYSTEM_BLUETOOTH_ENABLED),
63     DAEMON_OPCODE_BTSTACK_SET_SYSTEM_BLUETOOTH_ENABLED = DAEMON_OPCODE(BTSTACK_SET_SYSTEM_BLUETOOTH_ENABLED),
64     DAEMON_OPCODE_BTSTACK_SET_DISCOVERABLE = DAEMON_OPCODE(BTSTACK_SET_DISCOVERABLE),
65     DAEMON_OPCODE_BTSTACK_SET_BLUETOOTH_ENABLED = DAEMON_OPCODE(BTSTACK_SET_BLUETOOTH_ENABLED),
66     DAEMON_OPCODE_L2CAP_CREATE_CHANNEL = DAEMON_OPCODE(L2CAP_CREATE_CHANNEL),
67     DAEMON_OPCODE_L2CAP_CREATE_CHANNEL_MTU = DAEMON_OPCODE(L2CAP_CREATE_CHANNEL_MTU),
68     DAEMON_OPCODE_L2CAP_DISCONNECT = DAEMON_OPCODE(L2CAP_DISCONNECT),
69     DAEMON_OPCODE_L2CAP_REGISTER_SERVICE = DAEMON_OPCODE(L2CAP_REGISTER_SERVICE),
70     DAEMON_OPCODE_L2CAP_UNREGISTER_SERVICE = DAEMON_OPCODE(L2CAP_UNREGISTER_SERVICE),
71     DAEMON_OPCODE_L2CAP_ACCEPT_CONNECTION = DAEMON_OPCODE(L2CAP_ACCEPT_CONNECTION),
72     DAEMON_OPCODE_L2CAP_DECLINE_CONNECTION = DAEMON_OPCODE(L2CAP_DECLINE_CONNECTION),
73     DAEMON_OPCODE_L2CAP_REQUEST_CAN_SEND_NOW = DAEMON_OPCODE(L2CAP_REQUEST_CAN_SEND_NOW),
74     DAEMON_OPCODE_SDP_REGISTER_SERVICE_RECORD = DAEMON_OPCODE(SDP_REGISTER_SERVICE_RECORD),
75     DAEMON_OPCODE_SDP_UNREGISTER_SERVICE_RECORD = DAEMON_OPCODE(SDP_UNREGISTER_SERVICE_RECORD),
76     DAEMON_OPCODE_SDP_CLIENT_QUERY_RFCOMM_SERVICES = DAEMON_OPCODE(SDP_CLIENT_QUERY_RFCOMM_SERVICES),
77     DAEMON_OPCODE_SDP_CLIENT_QUERY_SERVICES = DAEMON_OPCODE(SDP_CLIENT_QUERY_SERVICES),
78     DAEMON_OPCODE_RFCOMM_CREATE_CHANNEL = DAEMON_OPCODE(RFCOMM_CREATE_CHANNEL),
79     DAEMON_OPCODE_RFCOMM_CREATE_CHANNEL_WITH_INITIAL_CREDITS = DAEMON_OPCODE(RFCOMM_CREATE_CHANNEL_WITH_CREDITS),
80     DAEMON_OPCODE_RFCOMM_GRANTS_CREDITS = DAEMON_OPCODE(RFCOMM_GRANT_CREDITS),
81     DAEMON_OPCODE_RFCOMM_DISCONNECT = DAEMON_OPCODE(RFCOMM_DISCONNECT),
82     DAEMON_OPCODE_RFCOMM_REGISTER_SERVICE = DAEMON_OPCODE(RFCOMM_REGISTER_SERVICE),
83     DAEMON_OPCODE_RFCOMM_REGISTER_SERVICE_WITH_INITIAL_CREDITS = DAEMON_OPCODE(RFCOMM_REGISTER_SERVICE_WITH_CREDITS),
84     DAEMON_OPCODE_RFCOMM_UNREGISTER_SERVICE = DAEMON_OPCODE(RFCOMM_UNREGISTER_SERVICE),
85     DAEMON_OPCODE_RFCOMM_ACCEPT_CONNECTION = DAEMON_OPCODE(RFCOMM_ACCEPT_CONNECTION),
86     DAEMON_OPCODE_RFCOMM_DECLINE_CONNECTION = DAEMON_OPCODE(RFCOMM_DECLINE_CONNECTION),
87     DAEMON_OPCODE_RFCOMM_PERSISTENT_CHANNEL_FOR_SERVICE = DAEMON_OPCODE(RFCOMM_PERSISTENT_CHANNEL),
88     DAEMON_OPCODE_RFCOMM_REQUEST_CAN_SEND_NOW = DAEMON_OPCODE(RFCOMM_REQUEST_CAN_SEND_NOW),
89     DAEMON_OPCODE_GAP_DISCONNECT = DAEMON_OPCODE(GAP_DISCONNECT),
90     DAEMON_OPCODE_GAP_INQUIRY_START = DAEMON_OPCODE(GAP_INQUIRY_START),
91     DAEMON_OPCODE_GAP_INQUIRY_STOP = DAEMON_OPCODE(GAP_INQUIRY_STOP),
92     DAEMON_OPCODE_GAP_REMOTE_NAME_REQUEST = DAEMON_OPCODE(GAP_REMOTE_NAME_REQUEST),
93     DAEMON_OPCODE_GAP_DROP_LINK_KEY_FOR_BD_ADDR = DAEMON_OPCODE(GAP_DROP_LINK_KEY_FOR_BD_ADDR),
94     DAEMON_OPCODE_GAP_DELETE_ALL_LINK_KEYS = DAEMON_OPCODE(GAP_DELETE_ALL_LINK_KEYS),
95     DAEMON_OPCODE_GAP_PIN_CODE_RESPONSE = DAEMON_OPCODE(GAP_PIN_CODE_RESPONSE),
96     DAEMON_OPCODE_GAP_PIN_CODE_NEGATIVE = DAEMON_OPCODE(GAP_PIN_CODE_NEGATIVE),
97     DAEMON_OPCODE_GAP_LE_SCAN_START = DAEMON_OPCODE(GAP_LE_SCAN_START),
98     DAEMON_OPCODE_GAP_LE_SCAN_STOP = DAEMON_OPCODE(GAP_LE_SCAN_STOP),
99     DAEMON_OPCODE_GAP_LE_SET_SCAN_PARAMETERS = DAEMON_OPCODE(GAP_LE_SET_SCAN_PARAMETERS),
100     DAEMON_OPCODE_GAP_LE_CONNECT = DAEMON_OPCODE(GAP_LE_CONNECT),
101     DAEMON_OPCODE_GAP_LE_CONNECT_CANCEL = DAEMON_OPCODE(GAP_LE_CONNECT_CANCEL),
102     DAEMON_OPCODE_GATT_DISCOVER_PRIMARY_SERVICES = DAEMON_OPCODE(GATT_DISCOVER_ALL_PRIMARY_SERVICES),
103     DAEMON_OPCODE_GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID16 = DAEMON_OPCODE(GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID16),
104     DAEMON_OPCODE_GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID128 = DAEMON_OPCODE(GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID128),
105     DAEMON_OPCODE_GATT_FIND_INCLUDED_SERVICES_FOR_SERVICE = DAEMON_OPCODE(GATT_FIND_INCLUDED_SERVICES_FOR_SERVICE),
106     DAEMON_OPCODE_GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE = DAEMON_OPCODE(GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE),
107     DAEMON_OPCODE_GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE_BY_UUID128 = DAEMON_OPCODE(GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE_BY_UUID128),
108     DAEMON_OPCODE_GATT_DISCOVER_CHARACTERISTIC_DESCRIPTORS = DAEMON_OPCODE(GATT_DISCOVER_CHARACTERISTIC_DESCRIPTORS),
109     DAEMON_OPCODE_GATT_READ_VALUE_OF_CHARACTERISTIC = DAEMON_OPCODE(GATT_READ_VALUE_OF_CHARACTERISTIC),
110     DAEMON_OPCODE_GATT_READ_LONG_VALUE_OF_CHARACTERISTIC = DAEMON_OPCODE(GATT_READ_LONG_VALUE_OF_CHARACTERISTIC),
111     DAEMON_OPCODE_GATT_WRITE_VALUE_OF_CHARACTERISTIC_WITHOUT_RESPONSE = DAEMON_OPCODE(GATT_WRITE_VALUE_OF_CHARACTERISTIC_WITHOUT_RESPONSE),
112     DAEMON_OPCODE_GATT_WRITE_VALUE_OF_CHARACTERISTIC = DAEMON_OPCODE(GATT_WRITE_VALUE_OF_CHARACTERISTIC),
113     DAEMON_OPCODE_GATT_WRITE_LONG_VALUE_OF_CHARACTERISTIC = DAEMON_OPCODE(GATT_WRITE_LONG_VALUE_OF_CHARACTERISTIC),
114     DAEMON_OPCODE_GATT_RELIABLE_WRITE_LONG_VALUE_OF_CHARACTERISTIC = DAEMON_OPCODE(GATT_RELIABLE_WRITE_LONG_VALUE_OF_CHARACTERISTIC),
115     DAEMON_OPCODE_GATT_READ_CHARACTERISTIC_DESCRIPTOR = DAEMON_OPCODE(GATT_READ_CHARACTERISTIC_DESCRIPTOR),
116     DAEMON_OPCODE_GATT_READ_LONG_CHARACTERISTIC_DESCRIPTOR = DAEMON_OPCODE(GATT_READ_LONG_CHARACTERISTIC_DESCRIPTOR),
117     DAEMON_OPCODE_GATT_WRITE_CHARACTERISTIC_DESCRIPTOR = DAEMON_OPCODE(GATT_WRITE_CHARACTERISTIC_DESCRIPTOR),
118     DAEMON_OPCODE_GATT_WRITE_LONG_CHARACTERISTIC_DESCRIPTOR = DAEMON_OPCODE(GATT_WRITE_LONG_CHARACTERISTIC_DESCRIPTOR),
119     DAEMON_OPCODE_GATT_WRITE_CLIENT_CHARACTERISTIC_CONFIGURATION = DAEMON_OPCODE(GATT_WRITE_CLIENT_CHARACTERISTIC_CONFIGURATION),
120     DAEMON_OPCODE_GATT_GET_MTU = DAEMON_OPCODE(GATT_GET_MTU),
121     DAEMON_OPCODE_SM_SET_AUTHENTICATION_REQUIREMENTS = DAEMON_OPCODE(SM_SET_AUTHENTICATION_REQUIREMENTS),
122     DAEMON_OPCODE_SM_SET_IO_CAPABILITIES = DAEMON_OPCODE(SM_SET_IO_CAPABILITIES),
123     DAEMON_OPCODE_SM_BONDING_DECLINE = DAEMON_OPCODE(SM_BONDING_DECLINE),
124     DAEMON_OPCODE_SM_JUST_WORKS_CONFIRM = DAEMON_OPCODE(SM_JUST_WORKS_CONFIRM),
125     DAEMON_OPCODE_SM_NUMERIC_COMPARISON_CONFIRM = DAEMON_OPCODE(SM_NUMERIC_COMPARISON_CONFIRM),
126     DAEMON_OPCODE_SM_PASSKEY_INPUT = DAEMON_OPCODE(SM_PASSKEY_INPUT),
127 } daemon_opcode_t;
128 
129 extern const hci_cmd_t btstack_get_state;
130 extern const hci_cmd_t btstack_set_power_mode;
131 extern const hci_cmd_t btstack_set_acl_capture_mode;
132 extern const hci_cmd_t btstack_get_version;
133 extern const hci_cmd_t btstack_get_system_bluetooth_enabled;
134 extern const hci_cmd_t btstack_set_system_bluetooth_enabled;
135 extern const hci_cmd_t btstack_set_discoverable;
136 extern const hci_cmd_t btstack_set_bluetooth_enabled;    // only used by btstack config
137 
138 extern const hci_cmd_t l2cap_accept_connection_cmd;
139 extern const hci_cmd_t l2cap_create_channel_cmd;
140 extern const hci_cmd_t l2cap_create_channel_mtu_cmd;
141 extern const hci_cmd_t l2cap_decline_connection_cmd;
142 extern const hci_cmd_t l2cap_disconnect_cmd;
143 extern const hci_cmd_t l2cap_register_service_cmd;
144 extern const hci_cmd_t l2cap_unregister_service_cmd;
145 extern const hci_cmd_t l2cap_request_can_send_now_cmd;
146 
147 extern const hci_cmd_t sdp_register_service_record_cmd;
148 extern const hci_cmd_t sdp_unregister_service_record_cmd;
149 extern const hci_cmd_t sdp_client_query_rfcomm_services_cmd;
150 extern const hci_cmd_t sdp_client_query_services_cmd;
151 
152 // accept connection @param bd_addr(48), rfcomm_cid (16)
153 extern const hci_cmd_t rfcomm_accept_connection_cmd;
154 // create rfcomm channel: @param bd_addr(48), channel (8)
155 extern const hci_cmd_t rfcomm_create_channel_cmd;
156 // create rfcomm channel: @param bd_addr(48), channel (8), mtu (16), credits (8)
157 extern const hci_cmd_t rfcomm_create_channel_with_initial_credits_cmd;
158 // decline rfcomm disconnect,@param bd_addr(48), rfcomm cid (16), reason(8)
159 extern const hci_cmd_t rfcomm_decline_connection_cmd;
160 // disconnect rfcomm disconnect, @param rfcomm_cid(8), reason(8)
161 extern const hci_cmd_t rfcomm_disconnect_cmd;
162 // register rfcomm service: @param channel(8), mtu (16)
163 extern const hci_cmd_t rfcomm_register_service_cmd;
164 // register rfcomm service: @param channel(8), mtu (16), initial credits (8)
165 extern const hci_cmd_t rfcomm_register_service_with_initial_credits_cmd;
166 // unregister rfcomm service, @param service_channel(16)
167 extern const hci_cmd_t rfcomm_unregister_service_cmd;
168 // request persisten rfcomm channel for service name: serive name (char*)
169 extern const hci_cmd_t rfcomm_persistent_channel_for_service_cmd;
170 extern const hci_cmd_t rfcomm_grants_credits_cmd;
171 extern const hci_cmd_t rfcomm_request_can_send_now_cmd;
172 
173 extern const hci_cmd_t gap_delete_all_link_keys_cmd;
174 extern const hci_cmd_t gap_disconnect_cmd;
175 extern const hci_cmd_t gap_drop_link_key_for_bd_addr_cmd;
176 extern const hci_cmd_t gap_inquiry_start_cmd;
177 extern const hci_cmd_t gap_inquiry_stop_cmd;
178 extern const hci_cmd_t gap_remote_name_request_cmd;
179 extern const hci_cmd_t gap_pin_code_response_cmd;
180 extern const hci_cmd_t gap_pin_code_response_cmd;
181 
182 extern const hci_cmd_t gap_le_scan_start;
183 extern const hci_cmd_t gap_le_scan_stop;
184 extern const hci_cmd_t gap_le_set_scan_parameters;
185 extern const hci_cmd_t gap_le_connect_cmd;
186 extern const hci_cmd_t gap_le_connect_cancel_cmd;
187 extern const hci_cmd_t gatt_discover_primary_services_cmd;
188 
189 extern const hci_cmd_t gatt_discover_primary_services_by_uuid16_cmd;
190 extern const hci_cmd_t gatt_discover_primary_services_by_uuid128_cmd;
191 extern const hci_cmd_t gatt_find_included_services_for_service_cmd;
192 extern const hci_cmd_t gatt_discover_characteristics_for_service_cmd;
193 extern const hci_cmd_t gatt_discover_characteristics_for_service_by_uuid128_cmd;
194 extern const hci_cmd_t gatt_discover_characteristic_descriptors_cmd;
195 extern const hci_cmd_t gatt_read_value_of_characteristic_cmd;
196 extern const hci_cmd_t gatt_read_long_value_of_characteristic_cmd;
197 extern const hci_cmd_t gatt_write_value_of_characteristic_without_response_cmd;
198 extern const hci_cmd_t gatt_write_value_of_characteristic_cmd;
199 extern const hci_cmd_t gatt_write_long_value_of_characteristic_cmd;
200 extern const hci_cmd_t gatt_reliable_write_long_value_of_characteristic_cmd;
201 extern const hci_cmd_t gatt_read_characteristic_descriptor_cmd;
202 extern const hci_cmd_t gatt_read_long_characteristic_descriptor_cmd;
203 extern const hci_cmd_t gatt_write_characteristic_descriptor_cmd;
204 extern const hci_cmd_t gatt_write_long_characteristic_descriptor_cmd;
205 extern const hci_cmd_t gatt_write_client_characteristic_configuration_cmd;
206 extern const hci_cmd_t gatt_get_mtu;
207 
208 extern const hci_cmd_t sm_set_authentication_requirements_cmd;
209 extern const hci_cmd_t sm_set_io_capabilities_cmd;
210 extern const hci_cmd_t sm_bonding_decline_cmd;
211 extern const hci_cmd_t sm_just_works_confirm_cmd;
212 extern const hci_cmd_t sm_numeric_comparison_confirm_cmd;
213 extern const hci_cmd_t sm_passkey_input_cmd;
214 
215 #if defined __cplusplus
216 }
217 #endif
218 
219 #endif // DAEMON_CMDS_H
220