3 * BlueZ - Bluetooth protocol stack for Linux
5 * Copyright (C) 2014 Intel Corporation. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #include <hardware/audio.h>
26 #include <hardware/bluetooth.h>
27 #include <hardware/bt_sock.h>
28 #include <hardware/bt_hh.h>
29 #include <hardware/bt_pan.h>
30 #include <hardware/bt_hl.h>
31 #include <hardware/bt_av.h>
32 #include <hardware/bt_rc.h>
33 #include <hardware/bt_gatt.h>
35 #include "emulator/hciemu.h"
36 #include <hardware/bt_mce.h>
43 #define raw_data(args...) ((unsigned char[]) { args })
45 #define raw_pdu(args...) \
47 .iov_base = raw_data(args), \
48 .iov_len = sizeof(raw_data(args)), \
51 #define end_pdu { .iov_base = NULL }
53 #define TEST_CASE_BREDR(text, ...) { \
56 sizeof((struct step[]) {__VA_ARGS__}) / sizeof(struct step), \
57 (struct step[]) {__VA_ARGS__}, \
60 #define TEST_CASE_BREDRLE(text, ...) { \
61 HCIEMU_TYPE_BREDRLE, \
63 sizeof((struct step[]) {__VA_ARGS__}) / sizeof(struct step), \
64 (struct step[]) {__VA_ARGS__}, \
67 #define MODIFY_DATA(status, modif_fun, from, to, len) { \
68 .action_status = status, \
69 .action = modif_fun, \
72 .set_data_len = len, \
75 #define PROCESS_DATA(status, proc_fun, data1, data2, data3) { \
76 .action_status = status, \
79 .set_data_2 = data2, \
80 .set_data_3 = data3, \
83 #define ACTION(status, act_fun, data_set) { \
84 .action_status = status, \
86 .set_data = data_set, \
89 #define ACTION_FAIL(act_fun, data_set) \
90 ACTION(BT_STATUS_FAIL, act_fun, data_set)
92 #define ACTION_SUCCESS(act_fun, data_set) \
93 ACTION(BT_STATUS_SUCCESS, act_fun, data_set)
95 #define CALLBACK(cb) { \
99 #define CALLBACK_STATE(cb, cb_res) { \
101 .callback_result.state = cb_res, \
104 #define CALLBACK_STATUS(cb, cb_res) { \
106 .callback_result.status = cb_res, \
109 #define CALLBACK_ERROR(cb, cb_err) { \
111 .callback_result.error = cb_err, \
114 #define CALLBACK_ADAPTER_PROPS(props, prop_cnt) { \
115 .callback = CB_BT_ADAPTER_PROPERTIES, \
116 .callback_result.properties = props, \
117 .callback_result.num_properties = prop_cnt, \
120 #define CALLBACK_PROPS(cb, props, prop_cnt) { \
122 .callback_result.properties = props, \
123 .callback_result.num_properties = prop_cnt, \
126 #define CALLBACK_HH_MODE(cb, cb_res, cb_mode) { \
128 .callback_result.status = cb_res, \
129 .callback_result.mode = cb_mode, \
132 #define CALLBACK_HHREPORT(cb, cb_res, cb_rep_size) { \
134 .callback_result.status = cb_res, \
135 .callback_result.report_size = cb_rep_size, \
138 #define CLLBACK_GATTC_SCAN_RES(props, prop_cnt, cb_adv_data) {\
139 .callback = CB_GATTC_SCAN_RESULT, \
140 .callback_result.properties = props, \
141 .callback_result.num_properties = prop_cnt, \
142 .callback_result.adv_data = cb_adv_data, \
145 #define CALLBACK_GATTC_CONNECT(cb_res, cb_prop, cb_conn_id, cb_client_id) { \
146 .callback = CB_GATTC_OPEN, \
147 .callback_result.status = cb_res, \
148 .callback_result.properties = cb_prop, \
149 .callback_result.num_properties = 1, \
150 .callback_result.conn_id = cb_conn_id, \
151 .callback_result.gatt_app_id = cb_client_id, \
154 #define CALLBACK_GATTC_SEARCH_RESULT(cb_conn_id, cb_service) { \
155 .callback = CB_GATTC_SEARCH_RESULT, \
156 .callback_result.conn_id = cb_conn_id, \
157 .callback_result.service = cb_service \
160 #define CALLBACK_GATTC_SEARCH_COMPLETE(cb_res, cb_conn_id) { \
161 .callback = CB_GATTC_SEARCH_COMPLETE, \
162 .callback_result.conn_id = cb_conn_id \
164 #define CALLBACK_GATTC_GET_CHARACTERISTIC_CB(cb_res, cb_conn_id, cb_service, \
165 cb_char, cb_char_prop) { \
166 .callback = CB_GATTC_GET_CHARACTERISTIC, \
167 .callback_result.conn_id = cb_conn_id, \
168 .callback_result.status = cb_res, \
169 .callback_result.service = cb_service, \
170 .callback_result.characteristic = cb_char, \
171 .callback_result.char_prop = cb_char_prop \
174 #define CALLBACK_GATTC_GET_DESCRIPTOR(cb_res, cb_conn_id, cb_service, \
175 cb_char, cb_desc) { \
176 .callback = CB_GATTC_GET_DESCRIPTOR, \
177 .callback_result.conn_id = cb_conn_id, \
178 .callback_result.status = cb_res, \
179 .callback_result.service = cb_service, \
180 .callback_result.characteristic = cb_char, \
181 .callback_result.descriptor = cb_desc \
184 #define CALLBACK_GATTC_GET_INCLUDED(cb_res, cb_conn_id, cb_service, \
186 .callback = CB_GATTC_GET_INCLUDED_SERVICE, \
187 .callback_result.conn_id = cb_conn_id, \
188 .callback_result.status = cb_res, \
189 .callback_result.service = cb_service, \
190 .callback_result.included = cb_incl, \
193 #define CALLBACK_GATTC_READ_CHARACTERISTIC(cb_res, cb_conn_id, cb_read_data) { \
194 .callback = CB_GATTC_READ_CHARACTERISTIC, \
195 .callback_result.conn_id = cb_conn_id, \
196 .callback_result.status = cb_res, \
197 .callback_result.read_params = cb_read_data, \
200 #define CALLBACK_GATTC_READ_DESCRIPTOR(cb_res, cb_conn_id, cb_read_data) { \
201 .callback = CB_GATTC_READ_DESCRIPTOR, \
202 .callback_result.conn_id = cb_conn_id, \
203 .callback_result.status = cb_res, \
204 .callback_result.read_params = cb_read_data, \
207 #define CALLBACK_GATTC_WRITE_DESCRIPTOR(cb_res, cb_conn_id, cb_write_data) { \
208 .callback = CB_GATTC_WRITE_DESCRIPTOR, \
209 .callback_result.conn_id = cb_conn_id, \
210 .callback_result.status = cb_res, \
211 .callback_result.write_params = cb_write_data, \
214 #define CALLBACK_GATTC_WRITE_CHARACTERISTIC(cb_res, cb_conn_id, \
216 .callback = CB_GATTC_WRITE_CHARACTERISTIC, \
217 .callback_result.conn_id = cb_conn_id, \
218 .callback_result.status = cb_res, \
219 .callback_result.write_params = cb_write_data, \
222 #define CALLBACK_GATTC_REGISTER_FOR_NOTIF(cb_res, cb_conn_id, cb_char,\
223 cb_service, cb_registered) { \
224 .callback = CB_GATTC_REGISTER_FOR_NOTIFICATION, \
225 .callback_result.conn_id = cb_conn_id, \
226 .callback_result.status = cb_res, \
227 .callback_result.service = cb_service, \
228 .callback_result.characteristic = cb_char, \
229 .callback_result.notification_registered = cb_registered \
232 #define CALLBACK_GATTC_NOTIFY(cb_conn_id, cb_notify) { \
233 .callback = CB_GATTC_NOTIFY, \
234 .callback_result.conn_id = cb_conn_id, \
235 .callback_result.notify_params = cb_notify \
238 #define CALLBACK_GATTC_DISCONNECT(cb_res, cb_prop, cb_conn_id, cb_client_id) { \
239 .callback = CB_GATTC_CLOSE, \
240 .callback_result.status = cb_res, \
241 .callback_result.properties = cb_prop, \
242 .callback_result.num_properties = 1, \
243 .callback_result.conn_id = cb_conn_id, \
244 .callback_result.gatt_app_id = cb_client_id, \
247 #define CALLBACK_GATTS_CONNECTION(cb_res, cb_prop, cb_conn_id, cb_server_id) { \
248 .callback = CB_GATTS_CONNECTION, \
249 .callback_result.connected = cb_res, \
250 .callback_result.properties = cb_prop, \
251 .callback_result.num_properties = 1, \
252 .callback_result.conn_id = cb_conn_id, \
253 .callback_result.gatt_app_id = cb_server_id, \
256 #define CALLBACK_GATTS_NOTIF_CONF(cb_conn_id, cb_status) { \
257 .callback = CB_GATTS_INDICATION_SEND, \
258 .callback_result.conn_id = cb_conn_id, \
259 .callback_result.status = cb_status, \
262 #define CALLBACK_GATTS_SERVICE_ADDED(cb_res, cb_server_id, cb_service, \
264 cb_store_srvc_handle) { \
265 .callback = CB_GATTS_SERVICE_ADDED, \
266 .callback_result.status = cb_res, \
267 .callback_result.gatt_app_id = cb_server_id, \
268 .callback_result.service = cb_service, \
269 .callback_result.srvc_handle = cb_srvc_handle, \
270 .store_srvc_handle = cb_store_srvc_handle, \
273 #define CALLBACK_GATTS_INC_SERVICE_ADDED(cb_res, cb_server_id, cb_srvc_handle, \
274 cb_inc_srvc_handle) { \
275 .callback = CB_GATTS_INCLUDED_SERVICE_ADDED, \
276 .callback_result.status = cb_res, \
277 .callback_result.gatt_app_id = cb_server_id, \
278 .callback_result.srvc_handle = cb_srvc_handle, \
279 .callback_result.inc_srvc_handle = cb_inc_srvc_handle, \
282 #define CALLBACK_GATTS_CHARACTERISTIC_ADDED(cb_res, cb_server_id, cb_uuid, \
285 cb_store_char_handle) { \
286 .callback = CB_GATTS_CHARACTERISTIC_ADDED, \
287 .callback_result.status = cb_res, \
288 .callback_result.gatt_app_id = cb_server_id, \
289 .callback_result.uuid = cb_uuid, \
290 .callback_result.srvc_handle = cb_srvc_handle, \
291 .callback_result.char_handle = cb_char_handle, \
292 .store_char_handle = cb_store_char_handle, \
295 #define CALLBACK_GATTS_DESCRIPTOR_ADDED(cb_res, cb_server_id, cb_uuid, \
296 cb_srvc_handle, cb_desc_handle, \
297 cb_store_desc_handle) { \
298 .callback = CB_GATTS_DESCRIPTOR_ADDED, \
299 .callback_result.status = cb_res, \
300 .callback_result.gatt_app_id = cb_server_id, \
301 .callback_result.uuid = cb_uuid, \
302 .callback_result.srvc_handle = cb_srvc_handle, \
303 .callback_result.desc_handle = cb_desc_handle, \
304 .store_desc_handle = cb_store_desc_handle, \
307 #define CALLBACK_GATTS_SERVICE_STARTED(cb_res, cb_server_id, cb_srvc_handle) { \
308 .callback = CB_GATTS_SERVICE_STARTED, \
309 .callback_result.status = cb_res, \
310 .callback_result.gatt_app_id = cb_server_id, \
311 .callback_result.srvc_handle = cb_srvc_handle, \
314 #define CALLBACK_GATTS_SERVICE_STOPPED(cb_res, cb_server_id, cb_srvc_handle) { \
315 .callback = CB_GATTS_SERVICE_STOPPED, \
316 .callback_result.status = cb_res, \
317 .callback_result.gatt_app_id = cb_server_id, \
318 .callback_result.srvc_handle = cb_srvc_handle, \
321 #define CALLBACK_GATTS_SERVICE_DELETED(cb_res, cb_server_id, cb_srvc_handle) { \
322 .callback = CB_GATTS_SERVICE_DELETED, \
323 .callback_result.status = cb_res, \
324 .callback_result.gatt_app_id = cb_server_id, \
325 .callback_result.srvc_handle = cb_srvc_handle, \
328 #define CALLBACK_GATTS_REQUEST_READ(cb_conn_id, cb_trans_id, cb_prop, \
329 cb_attr_handle, cb_offset, \
331 .callback = CB_GATTS_REQUEST_READ, \
332 .callback_result.conn_id = cb_conn_id, \
333 .callback_result.trans_id = cb_trans_id, \
334 .callback_result.properties = cb_prop, \
335 .callback_result.num_properties = 1, \
336 .callback_result.attr_handle = cb_attr_handle, \
337 .callback_result.offset = cb_offset, \
338 .callback_result.is_long = cb_is_long, \
341 #define CALLBACK_GATTS_REQUEST_WRITE(cb_conn_id, cb_trans_id, cb_prop, \
342 cb_attr_handle, cb_offset, \
343 cb_length, cb_need_rsp, \
344 cb_is_prep, cb_value) { \
345 .callback = CB_GATTS_REQUEST_WRITE, \
346 .callback_result.conn_id = cb_conn_id, \
347 .callback_result.trans_id = cb_trans_id, \
348 .callback_result.properties = cb_prop, \
349 .callback_result.num_properties = 1, \
350 .callback_result.attr_handle = cb_attr_handle, \
351 .callback_result.offset = cb_offset, \
352 .callback_result.length = cb_length, \
353 .callback_result.need_rsp = cb_need_rsp, \
354 .callback_result.is_prep = cb_is_prep, \
355 .callback_result.value = cb_value, \
358 #define CALLBACK_MAP_CLIENT_REMOTE_MAS_INSTANCE(cb_status, cb_prop, \
359 cb_num_inst, cb_instances) { \
360 .callback = CB_MAP_CLIENT_REMOTE_MAS_INSTANCES, \
361 .callback_result.properties = cb_prop, \
362 .callback_result.num_properties = 1, \
363 .callback_result.status = cb_status, \
364 .callback_result.num_mas_instances = cb_num_inst, \
365 .callback_result.mas_instances = cb_instances, \
368 #define CALLBACK_PAN_CTRL_STATE(cb, cb_res, cb_state, cb_local_role) { \
370 .callback_result.status = cb_res, \
371 .callback_result.ctrl_state = cb_state, \
372 .callback_result.local_role = cb_local_role, \
375 #define CALLBACK_PAN_CONN_STATE(cb, cb_res, cb_state, cb_local_role, \
378 .callback_result.status = cb_res, \
379 .callback_result.conn_state = cb_state, \
380 .callback_result.local_role = cb_local_role, \
381 .callback_result.remote_role = cb_remote_role, \
384 #define CALLBACK_HDP_APP_REG_STATE(cb, cb_app_id, cb_state) { \
386 .callback_result.app_id = cb_app_id, \
387 .callback_result.app_state = cb_state, \
390 #define CALLBACK_HDP_CHANNEL_STATE(cb, cb_app_id, cb_channel_id, \
391 cb_mdep_cfg_index, cb_state) { \
393 .callback_result.app_id = cb_app_id, \
394 .callback_result.channel_id = cb_channel_id, \
395 .callback_result.mdep_cfg_index = cb_mdep_cfg_index, \
396 .callback_result.channel_state = cb_state, \
399 #define CALLBACK_AV_CONN_STATE(cb, cb_av_conn_state) { \
401 .callback_result.av_conn_state = cb_av_conn_state, \
404 #define CALLBACK_AV_AUDIO_STATE(cb, cb_av_audio_state) { \
406 .callback_result.av_audio_state = cb_av_audio_state, \
409 #define CALLBACK_RC_PLAY_STATUS(cb, cb_length, cb_position, cb_status) { \
411 .callback_result.song_length = cb_length, \
412 .callback_result.song_position = cb_position, \
413 .callback_result.play_status = cb_status, \
416 #define CALLBACK_RC_REG_NOTIF_TRACK_CHANGED(cb, cb_index) { \
418 .callback_result.rc_index = cb_index, \
421 #define CALLBACK_RC_REG_NOTIF_POSITION_CHANGED(cb, cb_position) { \
423 .callback_result.song_position = cb_position, \
426 #define CALLBACK_RC_REG_NOTIF_STATUS_CHANGED(cb, cb_status) { \
428 .callback_result.play_status = cb_status, \
431 #define CALLBACK_RC_GET_ELEMENT_ATTRIBUTES(cb, cb_num_of_attrs, cb_attrs) { \
433 .callback_result.num_of_attrs = cb_num_of_attrs, \
434 .callback_result.attrs = cb_attrs, \
437 #define CALLBACK_DEVICE_PROPS(props, prop_cnt) \
438 CALLBACK_PROPS(CB_BT_REMOTE_DEVICE_PROPERTIES, props, prop_cnt)
440 #define CALLBACK_DEVICE_FOUND(props, prop_cnt) \
441 CALLBACK_PROPS(CB_BT_DEVICE_FOUND, props, prop_cnt)
443 #define CALLBACK_BOND_STATE(cb_res, props, prop_cnt) { \
444 .callback = CB_BT_BOND_STATE_CHANGED, \
445 .callback_result.state = cb_res, \
446 .callback_result.properties = props, \
447 .callback_result.num_properties = prop_cnt, \
450 #define CALLBACK_BOND_STATE_FAILED(cb_res, props, prop_cnt, reason) { \
451 .callback = CB_BT_BOND_STATE_CHANGED, \
452 .callback_result.state = cb_res, \
453 .callback_result.status = reason, \
454 .callback_result.properties = props, \
455 .callback_result.num_properties = prop_cnt, \
458 #define CALLBACK_SSP_REQ(pair_var, props, prop_cnt) { \
459 .callback = CB_BT_SSP_REQUEST, \
460 .callback_result.pairing_variant = pair_var, \
461 .callback_result.properties = props, \
462 .callback_result.num_properties = prop_cnt, \
465 #define DBG_CB(cb) { cb, #cb }
469 * Callback enum sections should be
470 * updated while adding new HAL to tester.
474 CB_BT_ADAPTER_STATE_CHANGED,
475 CB_BT_ADAPTER_PROPERTIES,
476 CB_BT_REMOTE_DEVICE_PROPERTIES,
478 CB_BT_DISCOVERY_STATE_CHANGED,
481 CB_BT_BOND_STATE_CHANGED,
482 CB_BT_ACL_STATE_CHANGED,
488 CB_HH_CONNECTION_STATE,
493 CB_HH_VIRTUAL_UNPLUG,
496 CB_PAN_CONTROL_STATE,
497 CB_PAN_CONNECTION_STATE,
500 CB_HDP_APP_REG_STATE,
501 CB_HDP_CHANNEL_STATE,
508 CB_AVRCP_PLAY_STATUS_REQ,
509 CB_AVRCP_PLAY_STATUS_RSP,
510 CB_AVRCP_REG_NOTIF_REQ,
511 CB_AVRCP_REG_NOTIF_RSP,
512 CB_AVRCP_GET_ATTR_REQ,
513 CB_AVRCP_GET_ATTR_RSP,
516 CB_GATTC_REGISTER_CLIENT,
517 CB_GATTC_SCAN_RESULT,
520 CB_GATTC_SEARCH_COMPLETE,
521 CB_GATTC_SEARCH_RESULT,
522 CB_GATTC_GET_CHARACTERISTIC,
523 CB_GATTC_GET_DESCRIPTOR,
524 CB_GATTC_GET_INCLUDED_SERVICE,
525 CB_GATTC_REGISTER_FOR_NOTIFICATION,
527 CB_GATTC_READ_CHARACTERISTIC,
528 CB_GATTC_WRITE_CHARACTERISTIC,
529 CB_GATTC_READ_DESCRIPTOR,
530 CB_GATTC_WRITE_DESCRIPTOR,
531 CB_GATTC_EXECUTE_WRITE,
532 CB_GATTC_READ_REMOTE_RSSI,
536 CB_GATTS_REGISTER_SERVER,
538 CB_GATTS_SERVICE_ADDED,
539 CB_GATTS_INCLUDED_SERVICE_ADDED,
540 CB_GATTS_CHARACTERISTIC_ADDED,
541 CB_GATTS_DESCRIPTOR_ADDED,
542 CB_GATTS_SERVICE_STARTED,
543 CB_GATTS_SERVICE_STOPPED,
544 CB_GATTS_SERVICE_DELETED,
545 CB_GATTS_REQUEST_READ,
546 CB_GATTS_REQUEST_WRITE,
547 CB_GATTS_REQUEST_EXEC_WRITE,
548 CB_GATTS_RESPONSE_CONFIRMATION,
549 CB_GATTS_INDICATION_SEND,
552 CB_MAP_CLIENT_REMOTE_MAS_INSTANCES,
554 /* Emulator callbacks */
555 CB_EMU_CONFIRM_SEND_DATA,
556 CB_EMU_ENCRYPTION_ENABLED,
557 CB_EMU_ENCRYPTION_DISABLED,
558 CB_EMU_CONNECTION_REJECTED,
559 CB_EMU_VALUE_INDICATION,
560 CB_EMU_VALUE_NOTIFICATION,
561 CB_EMU_READ_RESPONSE,
562 CB_EMU_WRITE_RESPONSE,
564 } expected_bt_callback_t;
568 audio_hw_device_t *audio;
569 struct hw_device_t *device;
570 struct hciemu *hciemu;
571 enum hciemu_type hciemu_type;
573 const bt_interface_t *if_bluetooth;
574 const btsock_interface_t *if_sock;
575 const bthh_interface_t *if_hid;
576 const btpan_interface_t *if_pan;
577 const bthl_interface_t *if_hdp;
578 const btav_interface_t *if_a2dp;
579 struct audio_stream_out *if_stream;
580 const btrc_interface_t *if_avrcp;
581 const btgatt_interface_t *if_gatt;
582 const btmce_interface_t *if_map_client;
584 const void *test_data;
589 pid_t bluetoothd_pid;
595 * Struct holding bluetooth HAL action parameters
597 struct bt_action_data {
600 /* Remote props action arguments */
602 const bt_property_t *prop;
604 /* Bonding requests parameters */
606 const uint8_t pin_len;
607 const uint8_t ssp_variant;
609 const uint16_t io_cap;
611 /* Socket HAL specific params */
612 const btsock_type_t sock_type;
614 const uint8_t *service_uuid;
615 const char *service_name;
620 const int report_size;
622 /*Connection params*/
623 const uint8_t bearer_type;
624 const uint8_t transport_type;
627 /* bthost's l2cap server setup parameters */
628 struct emu_set_l2cap_data {
630 const bthost_l2cap_connect_cb func;
634 struct emu_l2cap_cid_data {
635 const struct pdu_set *pdu;
642 struct map_inst_data {
651 * Callback data structure should be enhanced with data
652 * returned by callbacks. It's used for test case step
653 * matching with expected step data.
655 struct bt_callback_data {
659 bt_property_t *properties;
662 bt_ssp_variant_t pairing_variant;
664 bthh_protocol_mode_t mode;
675 uint16_t *attr_handle;
676 uint16_t *srvc_handle;
677 uint16_t *inc_srvc_handle;
678 uint16_t *char_handle;
679 uint16_t *desc_handle;
680 btgatt_srvc_id_t *service;
681 btgatt_gatt_id_t *characteristic;
682 btgatt_gatt_id_t *descriptor;
683 btgatt_srvc_id_t *included;
684 btgatt_read_params_t *read_params;
685 btgatt_write_params_t *write_params;
686 btgatt_notify_params_t *notify_params;
687 int notification_registered;
695 btpan_control_state_t ctrl_state;
696 btpan_connection_state_t conn_state;
703 bthl_app_reg_state_t app_state;
704 bthl_channel_state_t channel_state;
706 btav_connection_state_t av_conn_state;
707 btav_audio_state_t av_audio_state;
708 uint32_t song_length;
709 uint32_t song_position;
710 btrc_play_status_t play_status;
712 uint8_t num_of_attrs;
713 btrc_element_attr_val_t *attrs;
715 int num_mas_instances;
716 btmce_mas_instance_t *mas_instances;
720 * Step structure contains expected step data and step
721 * action, which should be performed before step check.
724 void (*action)(void);
727 expected_bt_callback_t callback;
728 struct bt_callback_data callback_result;
735 uint16_t *store_srvc_handle;
736 uint16_t *store_char_handle;
737 uint16_t *store_desc_handle;
741 const uint8_t emu_type;
743 const uint16_t step_num;
744 const struct step *step;
747 void tester_handle_l2cap_data_exchange(struct emu_l2cap_cid_data *cid_data);
748 void tester_generic_connect_cb(uint16_t handle, uint16_t cid, void *user_data);
750 /* Get, remove test cases API */
751 struct queue *get_bluetooth_tests(void);
752 void remove_bluetooth_tests(void);
753 struct queue *get_socket_tests(void);
754 void remove_socket_tests(void);
755 struct queue *get_hidhost_tests(void);
756 void remove_hidhost_tests(void);
757 struct queue *get_pan_tests(void);
758 void remove_pan_tests(void);
759 struct queue *get_hdp_tests(void);
760 void remove_hdp_tests(void);
761 struct queue *get_a2dp_tests(void);
762 void remove_a2dp_tests(void);
763 struct queue *get_avrcp_tests(void);
764 void remove_avrcp_tests(void);
765 struct queue *get_gatt_tests(void);
766 void remove_gatt_tests(void);
767 struct queue *get_map_client_tests(void);
768 void remove_map_client_tests(void);
770 /* Generic tester API */
771 void schedule_action_verification(struct step *step);
772 void schedule_callback_verification(struct step *step);
774 /* Emulator actions */
775 void emu_setup_powered_remote_action(void);
776 void emu_set_pin_code_action(void);
777 void emu_set_ssp_mode_action(void);
778 void emu_set_connect_cb_action(void);
779 void emu_remote_connect_hci_action(void);
780 void emu_remote_disconnect_hci_action(void);
781 void emu_set_io_cap(void);
782 void emu_add_l2cap_server_action(void);
783 void emu_add_rfcomm_server_action(void);
786 void dummy_action(void);
787 void bluetooth_enable_action(void);
788 void bluetooth_disable_action(void);
789 void bt_set_property_action(void);
790 void bt_get_property_action(void);
791 void bt_start_discovery_action(void);
792 void bt_cancel_discovery_action(void);
793 void bt_get_device_props_action(void);
794 void bt_get_device_prop_action(void);
795 void bt_set_device_prop_action(void);
796 void bt_create_bond_action(void);
797 void bt_pin_reply_accept_action(void);
798 void bt_ssp_reply_accept_action(void);
799 void bt_cancel_bond_action(void);
800 void bt_remove_bond_action(void);
801 void set_default_ssp_request_handler(void);