2 * Copyright (C) 2014 Intel Corporation
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 #include "emulator/bthost.h"
21 #include "lib/bluetooth.h"
22 #include "src/shared/util.h"
23 #include "src/shared/tester.h"
24 #include "src/shared/queue.h"
25 #include "tester-main.h"
27 #define ATT_HANDLE_SIZE 2
29 #define L2CAP_ATT_ERROR 0x01
30 #define L2CAP_ATT_EXCHANGE_MTU_REQ 0x02
31 #define L2CAP_ATT_EXCHANGE_MTU_RSP 0x03
32 #define L2CAP_ATT_FIND_BY_TYPE_REQ 0x06
33 #define L2CAP_ATT_READ_REQ 0x0a
34 #define L2CAP_ATT_READ_RSP 0x0b
35 #define L2CAP_ATT_WRITE_REQ 0x12
36 #define L2CAP_ATT_WRITE_RSP 0x13
37 #define L2CAP_ATT_HANDLE_VALUE_NOTIFY 0x1b
38 #define L2CAP_ATT_HANDLE_VALUE_IND 0x1d
40 #define GATT_STATUS_SUCCESS 0x00000000
41 #define GATT_STATUS_FAILURE 0x00000101
42 #define GATT_STATUS_INS_AUTH 0x08
44 #define GATT_ERR_INVAL_ATTR_VALUE_LEN 0x0D
46 #define GATT_SERVER_DISCONNECTED 0
47 #define GATT_SERVER_CONNECTED 1
57 #define BT_TRANSPORT_UNKNOWN 0x00
59 #define GATT_SERVER_TRANSPORT_LE 0x01
60 #define GATT_SERVER_TRANSPORT_BREDR 0x02
61 #define GATT_SERVER_TRANSPORT_LE_BREDR (0x01 | 0x02)
63 #define GATT_WRITE_TYPE_NO_RESPONSE 0x01
64 #define GATT_WRITE_TYPE_DEFAULT 0x02
65 #define GATT_WRITE_TYPE_PREPARE 0x03
66 #define GATT_WRITE_TYPE_SIGNED 0x04
68 #define CHAR_PROP_BROADCAST 0x01
69 #define CHAR_PROP_READ 0x02
70 #define CHAR_PROP_WRITE_WITHOUT_RESPONSE 0x04
71 #define CHAR_PROP_WRITE 0x08
72 #define CHAR_PROP_NOTIFY 0x10
73 #define CHAR_PROP_INDICATE 0x20
74 #define CHAR_PROP_AUTHENTICATED_SIGNED_WRITES 0x40
75 #define CHAR_PROP_EXTENDED_PROPERTIES 0x80
77 #define CHAR_PERM_READ 0x0001
78 #define CHAR_PERM_READ_ENCRYPTED 0x0002
79 #define CHAR_PERM_READ_ENCRYPTED_MITM 0x0004
80 #define CHAR_PERM_WRITE 0x0010
81 #define CHAR_PERM_WRITE_ENCRYPTED 0x0020
82 #define CHAR_PERM_WRITE_ENCRYPTED_MITM 0x0040
83 #define CHAR_PERM_WRITE_SIGNED 0x0080
84 #define CHAR_PERM_WRITE_SIGNED_MITM 0x0100
86 static struct queue *list; /* List of gatt test cases */
88 static uint16_t srvc1_handle;
89 static uint16_t inc_srvc1_handle;
90 static uint16_t char1_handle;
92 static struct iovec char1_handle_v = {
93 .iov_base = &char1_handle,
94 .iov_len = sizeof(char1_handle),
103 struct att_write_req_data {
104 uint16_t *attr_handle;
108 static bt_uuid_t app1_uuid = {
109 .uu = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
110 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 },
113 static bt_uuid_t app2_uuid = {
114 .uu = { 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
115 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 },
118 static uint8_t value_1[] = {0x01};
120 static uint8_t att_write_req_value_1[] = {0x00, 0x01, 0x02, 0x03};
121 static struct iovec att_write_req_value_1_v = {
122 .iov_base = att_write_req_value_1,
123 .iov_len = sizeof(att_write_req_value_1),
126 struct gatt_connect_data {
131 struct gatt_search_service_data {
133 bt_uuid_t *filter_uuid;
136 struct get_char_data {
138 btgatt_srvc_id_t *service;
141 struct get_desc_data {
143 btgatt_srvc_id_t *service;
144 btgatt_gatt_id_t *characteristic;
145 btgatt_gatt_id_t *desc;
148 struct get_incl_data {
150 btgatt_srvc_id_t *service;
151 btgatt_srvc_id_t *start_service;
154 struct read_char_data {
156 btgatt_srvc_id_t *service;
157 btgatt_gatt_id_t *characteristic;
161 struct read_desc_data {
163 btgatt_srvc_id_t *service;
164 btgatt_gatt_id_t *characteristic;
165 btgatt_gatt_id_t *descriptor;
169 struct write_char_data {
171 btgatt_srvc_id_t *service;
172 btgatt_gatt_id_t *characteristic;
179 struct write_desc_data {
181 btgatt_srvc_id_t *service;
182 btgatt_gatt_id_t *characteristic;
183 btgatt_gatt_id_t *descriptor;
192 const bt_bdaddr_t *bdaddr;
193 btgatt_srvc_id_t *service;
194 btgatt_gatt_id_t *charac;
197 struct add_service_data {
199 btgatt_srvc_id_t *service;
203 struct add_included_service_data {
205 uint16_t *inc_srvc_handle;
206 uint16_t *srvc_handle;
208 struct add_char_data {
210 uint16_t *srvc_handle;
216 struct add_desc_data {
218 uint16_t *srvc_handle;
223 struct start_srvc_data {
225 uint16_t *srvc_handle;
229 struct stop_srvc_data {
231 uint16_t *srvc_handle;
234 struct delete_srvc_data {
236 uint16_t *srvc_handle;
239 struct send_indication_data {
241 uint16_t *attr_handle;
248 struct send_resp_data {
252 btgatt_response_t *response;
255 static bt_bdaddr_t emu_remote_bdaddr_val = {
256 .address = { 0x00, 0xaa, 0x01, 0x01, 0x00, 0x00 },
258 static bt_device_type_t emu_remote_ble_device_type = BT_DEVICE_DEVTYPE_BLE;
260 static bt_property_t prop_emu_remotes_default_set[] = {
261 { BT_PROPERTY_BDADDR, sizeof(emu_remote_bdaddr_val),
262 &emu_remote_bdaddr_val },
264 static bt_property_t prop_emu_remotes_default_le_set[] = {
265 { BT_PROPERTY_BDADDR, sizeof(emu_remote_bdaddr_val),
266 &emu_remote_bdaddr_val },
267 { BT_PROPERTY_TYPE_OF_DEVICE, sizeof(bt_device_type_t),
268 &emu_remote_ble_device_type },
271 static struct bt_action_data prop_test_remote_ble_bdaddr_req = {
272 .addr = &emu_remote_bdaddr_val,
273 .prop_type = BT_PROPERTY_BDADDR,
274 .prop = &prop_emu_remotes_default_set[0],
277 static bt_scan_mode_t setprop_scan_mode_conn_val =
278 BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE;
280 static bt_property_t prop_test_scan_mode_conn = {
281 .type = BT_PROPERTY_ADAPTER_SCAN_MODE,
282 .val = &setprop_scan_mode_conn_val,
283 .len = sizeof(setprop_scan_mode_conn_val),
286 static struct emu_l2cap_cid_data cid_data;
288 static struct gatt_connect_data app1_conn_req = {
293 static struct gatt_connect_data app1_conn2_req = {
298 static struct gatt_connect_data app2_conn_req = {
303 static struct gatt_search_service_data search_services_1 = {
308 static const struct iovec exchange_mtu_req_pdu = raw_pdu(0x02, 0xa0, 0x02);
309 static const struct iovec exchange_mtu_resp_pdu = raw_pdu(0x03, 0xa0, 0x02);
311 static struct bt_action_data bearer_type = {
312 .bearer_type = BDADDR_LE_PUBLIC,
315 static btgatt_srvc_id_t service_1 = {
319 .uuid.uu = {0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
320 0x00, 0x10, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00}
324 static btgatt_srvc_id_t service_2 = {
328 .uuid.uu = {0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
329 0x00, 0x10, 0x00, 0x00, 0x01, 0x18, 0x00, 0x00},
333 static btgatt_srvc_id_t service_add_1 = {
337 .uuid.uu = {0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
338 0x00, 0x10, 0x00, 0x00, 0xFF, 0xEF, 0x00, 0x00},
342 static btgatt_srvc_id_t service_add_2 = {
346 .uuid.uu = {0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
347 0x00, 0x10, 0x00, 0x00, 0xFF, 0xDF, 0x00, 0x00},
351 static btgatt_srvc_id_t service_add_3 = {
355 .uuid.uu = {0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
356 0x00, 0x10, 0x00, 0x00, 0xFF, 0xCF, 0x00, 0x00},
360 static btgatt_srvc_id_t included_1 = {
364 .uuid.uu = {0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
365 0x00, 0x10, 0x00, 0x00, 0xff, 0xfe, 0x00, 0x00},
369 static btgatt_srvc_id_t included_2 = {
373 .uuid.uu = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
374 0x08, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10},
378 static btgatt_gatt_id_t characteristic_1 = {
380 .uuid.uu = {0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
381 0x00, 0x10, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00}
384 static btgatt_gatt_id_t desc_1 = {
386 .uuid.uu = {0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
387 0x00, 0x10, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00}
390 static btgatt_gatt_id_t desc_2 = {
392 .uuid.uu = {0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
393 0x00, 0x10, 0x00, 0x00, 0x01, 0x29, 0x00, 0x00}
396 static btgatt_read_params_t read_params_1;
397 static btgatt_write_params_t write_params_1;
398 static btgatt_notify_params_t notify_params_1;
400 static struct get_char_data get_char_data_1 = {
402 .service = &service_1
405 static struct get_char_data get_char_data_2 = {
407 .service = &service_2
410 static struct get_desc_data get_desc_data_1 = {
412 .service = &service_1,
413 .characteristic = &characteristic_1,
416 static struct get_desc_data get_desc_data_2 = {
418 .service = &service_1,
419 .characteristic = &characteristic_1,
423 static struct read_char_data read_char_data_1 = {
425 .service = &service_1,
426 .characteristic = &characteristic_1,
429 static struct read_char_data read_char_data_2 = {
431 .service = &service_2,
432 .characteristic = &characteristic_1,
435 static struct read_desc_data read_desc_data_1 = {
437 .service = &service_1,
438 .characteristic = &characteristic_1,
439 .descriptor = &desc_1,
442 static struct read_desc_data read_desc_data_2 = {
444 .service = &service_1,
445 .characteristic = &characteristic_1,
446 .descriptor = &desc_2,
449 static struct get_incl_data get_incl_data_1 = {
451 .service = &service_1
454 static char value_2[] = {0x00, 0x01, 0x02, 0x03};
456 static struct write_char_data write_char_data_1 = {
458 .service = &service_1,
459 .characteristic = &characteristic_1,
460 .write_type = GATT_WRITE_TYPE_NO_RESPONSE,
461 .len = sizeof(value_2),
466 static struct write_char_data write_char_data_2 = {
468 .service = &service_1,
469 .characteristic = &characteristic_1,
470 .write_type = GATT_WRITE_TYPE_DEFAULT,
471 .len = sizeof(value_2),
476 static struct write_desc_data write_desc_data_1 = {
478 .service = &service_1,
479 .characteristic = &characteristic_1,
480 .descriptor = &desc_1,
482 .len = sizeof(value_2),
487 static struct write_desc_data write_desc_data_2 = {
489 .service = &service_1,
490 .characteristic = &characteristic_1,
491 .descriptor = &desc_2,
493 .len = sizeof(value_2),
498 static struct notif_data notif_data_1 = {
500 .service = &service_1,
501 .charac = &characteristic_1,
502 .bdaddr = &emu_remote_bdaddr_val,
505 static struct add_service_data add_service_data_1 = {
507 .service = &service_add_1,
511 static struct add_service_data add_service_data_2 = {
513 .service = &service_add_2,
517 static struct add_service_data add_service_data_3 = {
519 .service = &service_add_3,
523 static struct add_service_data add_service_data_4 = {
525 .service = &service_add_1,
529 static struct add_service_data add_service_data_5 = {
531 .service = &service_add_1,
535 static struct add_service_data add_service_data_6 = {
537 .service = &service_add_1,
541 static struct add_service_data add_bad_service_data_1 = {
543 .service = &service_add_1,
547 static struct add_service_data add_sec_service_data_1 = {
549 .service = &included_1,
553 static uint16_t srvc_bad_handle = 0xffff;
555 static struct add_included_service_data add_inc_service_data_1 = {
557 .inc_srvc_handle = &inc_srvc1_handle,
558 .srvc_handle = &srvc1_handle
561 static struct add_included_service_data add_bad_inc_service_data_1 = {
563 .inc_srvc_handle = &srvc_bad_handle,
564 .srvc_handle = &srvc1_handle
567 static struct add_char_data add_char_data_1 = {
569 .srvc_handle = &srvc1_handle,
575 static struct add_char_data add_char_data_2 = {
577 .srvc_handle = &srvc1_handle,
579 .properties = CHAR_PROP_WRITE,
580 .permissions = CHAR_PERM_WRITE
583 static struct add_char_data add_bad_char_data_1 = {
585 .srvc_handle = &srvc_bad_handle,
591 static struct add_desc_data add_bad_desc_data_1 = {
593 .srvc_handle = &srvc_bad_handle,
598 static struct add_desc_data add_bad_desc_data_2 = {
600 .srvc_handle = &srvc1_handle,
605 static struct add_desc_data add_desc_data_1 = {
607 .srvc_handle = &srvc1_handle,
612 static struct start_srvc_data start_srvc_data_1 = {
614 .srvc_handle = &srvc1_handle,
615 .transport = GATT_SERVER_TRANSPORT_LE_BREDR
618 static struct start_srvc_data start_srvc_data_2 = {
620 .srvc_handle = &srvc1_handle,
621 .transport = GATT_SERVER_TRANSPORT_LE
624 static struct start_srvc_data start_bad_srvc_data_1 = {
626 .srvc_handle = &srvc_bad_handle,
627 .transport = GATT_SERVER_TRANSPORT_LE
630 static struct start_srvc_data start_bad_srvc_data_2 = {
632 .srvc_handle = &srvc1_handle,
636 static struct stop_srvc_data stop_srvc_data_1 = {
638 .srvc_handle = &srvc1_handle
641 static struct stop_srvc_data stop_bad_srvc_data_1 = {
643 .srvc_handle = &srvc_bad_handle
646 static struct delete_srvc_data delete_srvc_data_1 = {
648 .srvc_handle = &srvc1_handle
651 static struct delete_srvc_data delete_bad_srvc_data_1 = {
653 .srvc_handle = &srvc_bad_handle
656 static uint16_t srvc_indication_handle_1 = 0x01;
658 static struct send_indication_data send_indication_data_1 = {
660 .attr_handle = &srvc_indication_handle_1,
662 .len = sizeof(value_2),
667 static struct send_indication_data send_indication_data_2 = {
669 .attr_handle = &srvc_indication_handle_1,
671 .len = sizeof(value_2),
676 static struct send_indication_data send_bad_indication_data_1 = {
678 .attr_handle = &srvc_indication_handle_1,
680 .len = sizeof(value_2),
685 struct set_read_params {
686 btgatt_read_params_t *params;
687 btgatt_srvc_id_t *srvc_id;
688 btgatt_gatt_id_t *char_id;
689 btgatt_gatt_id_t *descr_id;
696 struct set_write_params {
697 btgatt_write_params_t *params;
698 btgatt_srvc_id_t *srvc_id;
699 btgatt_gatt_id_t *char_id;
700 btgatt_gatt_id_t *descr_id;
704 struct set_notify_params {
705 btgatt_notify_params_t *params;
709 btgatt_srvc_id_t *srvc_id;
710 btgatt_gatt_id_t *char_id;
714 static struct set_read_params set_read_param_1 = {
715 .params = &read_params_1,
716 .srvc_id = &service_1,
717 .char_id = &characteristic_1,
719 .len = sizeof(value_1),
720 .status = BT_STATUS_SUCCESS
723 static struct set_read_params set_read_param_2 = {
724 .params = &read_params_1,
725 .srvc_id = &service_1,
726 .char_id = &characteristic_1,
727 .status = GATT_STATUS_INS_AUTH
730 static struct set_read_params set_read_param_3 = {
731 .params = &read_params_1,
732 .srvc_id = &service_2,
733 .char_id = &characteristic_1,
734 .status = BT_STATUS_FAIL
737 static struct set_read_params set_read_param_4 = {
738 .params = &read_params_1,
739 .srvc_id = &service_1,
740 .char_id = &characteristic_1,
743 .len = sizeof(value_1),
744 .status = BT_STATUS_SUCCESS
747 static struct set_read_params set_read_param_5 = {
748 .params = &read_params_1,
749 .srvc_id = &service_1,
750 .char_id = &characteristic_1,
752 .status = GATT_STATUS_INS_AUTH
755 static struct set_read_params set_read_param_6 = {
756 .params = &read_params_1,
757 .srvc_id = &service_1,
758 .char_id = &characteristic_1,
760 .status = BT_STATUS_FAIL
763 static struct set_write_params set_write_param_1 = {
764 .params = &write_params_1,
765 .srvc_id = &service_1,
766 .char_id = &characteristic_1,
767 .status = BT_STATUS_SUCCESS
770 static struct set_write_params set_write_param_2 = {
771 .params = &write_params_1,
772 .srvc_id = &service_1,
773 .char_id = &characteristic_1,
774 .status = GATT_STATUS_INS_AUTH
777 static struct set_write_params set_write_param_3 = {
778 .params = &write_params_1,
779 .srvc_id = &service_1,
780 .char_id = &characteristic_1,
781 .status = BT_STATUS_FAIL
784 static struct set_write_params set_write_param_4 = {
785 .params = &write_params_1,
786 .srvc_id = &service_1,
787 .char_id = &characteristic_1,
789 .status = BT_STATUS_SUCCESS
792 static struct set_write_params set_write_param_5 = {
793 .params = &write_params_1,
794 .srvc_id = &service_1,
795 .char_id = &characteristic_1,
797 .status = BT_STATUS_FAIL
800 static struct set_write_params set_write_param_6 = {
801 .params = &write_params_1,
802 .srvc_id = &service_1,
803 .char_id = &characteristic_1,
805 .status = GATT_STATUS_INS_AUTH
808 static struct set_notify_params set_notify_param_1 = {
809 .params = ¬ify_params_1,
811 .len = sizeof(value_1),
813 .srvc_id = &service_1,
814 .char_id = &characteristic_1,
815 .bdaddr = &emu_remote_bdaddr_val
818 static struct set_notify_params set_notify_param_2 = {
819 .params = ¬ify_params_1,
821 .len = sizeof(value_1),
823 .srvc_id = &service_1,
824 .char_id = &characteristic_1,
825 .bdaddr = &emu_remote_bdaddr_val
828 static btgatt_response_t response_1 = {
830 .attr_value.auth_req = 0,
831 .attr_value.handle = 0x1d,
833 .attr_value.offset = 0,
836 static btgatt_response_t response_2 = {
838 .attr_value.auth_req = 0,
839 .attr_value.handle = 0x1d,
840 .attr_value.len = sizeof(att_write_req_value_1),
841 .attr_value.offset = 0,
844 static struct send_resp_data send_resp_data_1 = {
846 .trans_id = TRANS1_ID,
847 .status = BT_STATUS_SUCCESS,
848 .response = &response_1,
851 static struct send_resp_data send_resp_data_2 = {
853 .trans_id = TRANS1_ID,
854 .status = BT_STATUS_SUCCESS,
855 .response = &response_2,
858 static struct send_resp_data send_resp_data_2_error = {
860 .trans_id = TRANS1_ID,
861 .status = GATT_ERR_INVAL_ATTR_VALUE_LEN,
862 .response = &response_2,
865 #define SEARCH_SERVICE_SINGLE_SUCCESS_PDUS \
866 raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28), \
867 raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18), \
868 raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28), \
869 raw_pdu(0x01, 0x10, 0x11, 0x00, 0x0a)
871 #define READ_BY_TYPE_SINGLE_CHARACTERISTIC_PDUS \
872 raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28), \
873 raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x00, 0x00, 0x19, 0x00), \
874 raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28), \
875 raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a)
877 static struct iovec search_service[] = {
878 SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
882 static struct iovec search_service_2[] = {
883 raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
884 raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
885 raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
886 raw_pdu(0x11, 0x06, 0x11, 0x00, 0x20, 0x00, 0x01, 0x18),
887 raw_pdu(0x10, 0x21, 0x00, 0xff, 0xff, 0x00, 0x28),
888 raw_pdu(0x01, 0x10, 0x21, 0x00, 0x0a),
892 static struct iovec search_service_3[] = {
893 raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
894 raw_pdu(0x01, 0x08, 0x01, 0x00, 0x0a),
898 static struct iovec search_service_4[] = {
899 raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
900 raw_pdu(0x11, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x18),
904 static struct iovec get_characteristic_1[] = {
905 SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
906 READ_BY_TYPE_SINGLE_CHARACTERISTIC_PDUS,
910 static struct iovec get_characteristic_2[] = {
911 SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
912 raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
913 raw_pdu(0x09, 0x07, 0x00, 0x00, 0x04, 0x00, 0x00, 0x19, 0x00),
917 static struct iovec get_descriptor_0[] = {
918 SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
919 READ_BY_TYPE_SINGLE_CHARACTERISTIC_PDUS,
920 raw_pdu(0x04, 0x01, 0x00, 0x10, 0x00),
921 raw_pdu(0x05, 0x01, 0x00, 0x00, 0x00, 0x29),
925 static struct iovec get_descriptor_1[] = {
926 SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
927 READ_BY_TYPE_SINGLE_CHARACTERISTIC_PDUS,
928 raw_pdu(0x04, 0x01, 0x00, 0x10, 0x00),
929 raw_pdu(0x05, 0x01, 0x04, 0x00, 0x00, 0x29),
930 raw_pdu(0x04, 0x05, 0x00, 0x10, 0x00),
931 raw_pdu(0x01, 0x04, 0x05, 0x00, 0x0a),
935 static struct iovec get_descriptor_2[] = {
936 SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
937 READ_BY_TYPE_SINGLE_CHARACTERISTIC_PDUS,
938 raw_pdu(0x04, 0x01, 0x00, 0x10, 0x00),
939 raw_pdu(0x05, 0x01, 0x04, 0x00, 0x00, 0x29, 0x05, 0x00, 0x01, 0x29),
940 raw_pdu(0x04, 0x06, 0x00, 0x10, 0x00),
941 raw_pdu(0x01, 0x04, 0x06, 0x00, 0x0a),
945 static struct iovec get_descriptor_3[] = {
946 SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
947 READ_BY_TYPE_SINGLE_CHARACTERISTIC_PDUS,
948 raw_pdu(0x04, 0x01, 0x00, 0x10, 0x00),
949 raw_pdu(0x01, 0x04, 0x01, 0x00, 0x0a),
953 static struct iovec get_included_0[] = {
954 SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
955 raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x02, 0x28),
956 raw_pdu(0x09, 0x08, 0x00, 0x00, 0x15, 0x00, 0x19, 0x00, 0xff, 0xfe),
960 static struct iovec get_included_1[] = {
961 SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
962 raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x02, 0x28),
963 raw_pdu(0x09, 0x08, 0x02, 0x00, 0x15, 0x00, 0x19, 0x00, 0xff, 0xfe),
964 raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x02, 0x28),
965 raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a),
969 static struct iovec get_included_2[] = {
970 SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
971 raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x02, 0x28),
972 raw_pdu(0x09, 0x06, 0x02, 0x00, 0x15, 0x00, 0x19, 0x00),
973 raw_pdu(0x0a, 0x15, 0x00),
974 raw_pdu(0x0b, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
975 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10),
976 raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x02, 0x28),
977 raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a),
981 static struct iovec get_included_3[] = {
982 SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
983 raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x02, 0x28),
984 raw_pdu(0x01, 0x08, 0x01, 0x00, 0x0a),
988 static struct iovec read_characteristic_1[] = {
989 SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
990 raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
991 raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x03, 0x00, 0x19, 0x00),
992 raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
993 raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a),
994 raw_pdu(0x0a, 0x03, 0x00),
999 static struct iovec read_characteristic_2[] = {
1000 SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
1001 raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
1002 raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x03, 0x00, 0x19, 0x00),
1003 raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
1004 raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a),
1005 raw_pdu(0x0a, 0x03, 0x00),
1006 raw_pdu(0x01, 0x0a, 0x03, 0x00, 0x08),
1010 static struct iovec read_descriptor_1[] = {
1011 SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
1012 READ_BY_TYPE_SINGLE_CHARACTERISTIC_PDUS,
1013 raw_pdu(0x04, 0x01, 0x00, 0x10, 0x00),
1014 raw_pdu(0x05, 0x01, 0x04, 0x00, 0x00, 0x29),
1015 raw_pdu(0x04, 0x05, 0x00, 0x10, 0x00),
1016 raw_pdu(0x01, 0x04, 0x05, 0x00, 0x0a),
1017 raw_pdu(0x0a, 0x04, 0x00),
1018 raw_pdu(0x0b, 0x01),
1022 static struct iovec read_descriptor_2[] = {
1023 SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
1024 READ_BY_TYPE_SINGLE_CHARACTERISTIC_PDUS,
1025 raw_pdu(0x04, 0x01, 0x00, 0x10, 0x00),
1026 raw_pdu(0x05, 0x01, 0x04, 0x00, 0x00, 0x29),
1027 raw_pdu(0x04, 0x05, 0x00, 0x10, 0x00),
1028 raw_pdu(0x01, 0x04, 0x05, 0x00, 0x0a),
1029 raw_pdu(0x0a, 0x04, 0x00),
1030 raw_pdu(0x01, 0x0a, 0x04, 0x00, 0x08),
1034 static struct iovec write_characteristic_1[] = {
1035 SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
1036 raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
1037 raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x03, 0x00, 0x19, 0x00),
1038 raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
1039 raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a),
1040 raw_pdu(0x52, 0x03, 0x00, 0x00, 0x01, 0x02, 0x03),
1044 static struct iovec write_characteristic_2[] = {
1045 SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
1046 raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
1047 raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x03, 0x00, 0x19, 0x00),
1048 raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
1049 raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a),
1050 raw_pdu(0x12, 0x03, 0x00, 0x00, 0x01, 0x02, 0x03),
1055 static struct iovec write_characteristic_3[] = {
1056 SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
1057 raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
1058 raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x03, 0x00, 0x19, 0x00),
1059 raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
1060 raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a),
1061 raw_pdu(0x12, 0x03, 0x00, 0x00, 0x01, 0x02, 0x03),
1062 raw_pdu(0x01, 0x12, 0x03, 0x00, 0x08),
1066 static struct iovec write_descriptor_1[] = {
1067 SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
1068 READ_BY_TYPE_SINGLE_CHARACTERISTIC_PDUS,
1069 raw_pdu(0x04, 0x01, 0x00, 0x10, 0x00),
1070 raw_pdu(0x05, 0x01, 0x04, 0x00, 0x00, 0x29),
1071 raw_pdu(0x04, 0x05, 0x00, 0x10, 0x00),
1072 raw_pdu(0x01, 0x04, 0x05, 0x00, 0x0a),
1073 raw_pdu(0x12, 0x04, 0x00, 0x00, 0x01, 0x02, 0x03),
1078 static struct iovec write_descriptor_2[] = {
1079 SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
1080 READ_BY_TYPE_SINGLE_CHARACTERISTIC_PDUS,
1081 raw_pdu(0x04, 0x01, 0x00, 0x10, 0x00),
1082 raw_pdu(0x05, 0x01, 0x04, 0x00, 0x00, 0x29),
1083 raw_pdu(0x04, 0x05, 0x00, 0x10, 0x00),
1084 raw_pdu(0x01, 0x04, 0x05, 0x00, 0x0a),
1085 raw_pdu(0x12, 0x04, 0x00, 0x00, 0x01, 0x02, 0x03),
1086 raw_pdu(0x01, 0x12, 0x04, 0x00, 0x08),
1090 static struct iovec notification_1[] = {
1091 SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
1092 READ_BY_TYPE_SINGLE_CHARACTERISTIC_PDUS,
1096 static struct iovec notification_2[] = {
1097 SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
1098 READ_BY_TYPE_SINGLE_CHARACTERISTIC_PDUS,
1099 raw_pdu(0x1d, 0x03, 0x00, 0x01),
1104 static struct iovec notification_3[] = {
1105 SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
1106 READ_BY_TYPE_SINGLE_CHARACTERISTIC_PDUS,
1107 raw_pdu(0x1b, 0x03, 0x00, 0x01),
1111 static struct iovec send_indication_1[] = {
1112 raw_pdu(0x1d, 0x01, 0x00, 0x00, 0x01, 0x02, 0x03),
1117 static struct iovec send_notification_1[] = {
1118 raw_pdu(0x1b, 0x01, 0x00, 0x00, 0x01, 0x02, 0x03),
1122 static struct iovec search_range_1[] = {
1123 raw_pdu(0x01, 0xff, 0xff, 0xff),
1127 static struct iovec primary_type = raw_pdu(0x00, 0x28);
1129 /* att commands define raw pdus */
1130 static struct iovec att_read_req_op_v = raw_pdu(L2CAP_ATT_READ_REQ);
1131 static struct iovec att_write_req_op_v = raw_pdu(L2CAP_ATT_WRITE_REQ);
1132 static struct iovec att_find_by_type_req_op_v =
1133 raw_pdu(L2CAP_ATT_FIND_BY_TYPE_REQ);
1135 static struct iovec svc_change_ccc_handle_v = raw_pdu(0x1c, 0x00);
1136 static struct iovec svc_change_ccc_value_v = raw_pdu(0x00, 0x01);
1138 static void gatt_client_register_action(void)
1140 struct test_data *data = tester_get_data();
1141 struct step *current_data_step = queue_peek_head(data->steps);
1142 bt_uuid_t *app_uuid = current_data_step->set_data;
1143 struct step *step = g_new0(struct step, 1);
1146 tester_warn("No app uuid provided for register action.");
1150 step->action_status = data->if_gatt->client->register_client(app_uuid);
1152 schedule_action_verification(step);
1155 static void gatt_client_unregister_action(void)
1157 struct test_data *data = tester_get_data();
1158 struct step *current_data_step = queue_peek_head(data->steps);
1159 int32_t cl_id = PTR_TO_INT(current_data_step->set_data);
1160 struct step *step = g_new0(struct step, 1);
1162 step->action_status = data->if_gatt->client->unregister_client(cl_id);
1164 schedule_action_verification(step);
1167 static void gatt_client_start_scan_action(void)
1169 struct test_data *data = tester_get_data();
1170 struct step *step = g_new0(struct step, 1);
1172 step->action_status = data->if_gatt->client->scan(TRUE);
1174 schedule_action_verification(step);
1177 static void gatt_client_stop_scan_action(void)
1179 struct test_data *data = tester_get_data();
1180 struct step *step = g_new0(struct step, 1);
1182 step->action_status = data->if_gatt->client->scan(FALSE);
1184 schedule_action_verification(step);
1187 static void gatt_client_connect_action(void)
1189 struct test_data *data = tester_get_data();
1190 struct step *current_data_step = queue_peek_head(data->steps);
1191 struct gatt_connect_data *conn_data = current_data_step->set_data;
1192 struct step *step = g_new0(struct step, 1);
1194 step->action_status = data->if_gatt->client->connect(
1196 &emu_remote_bdaddr_val, 0,
1197 BT_TRANSPORT_UNKNOWN);
1199 schedule_action_verification(step);
1202 static void gatt_client_disconnect_action(void)
1204 struct test_data *data = tester_get_data();
1205 struct step *current_data_step = queue_peek_head(data->steps);
1206 struct gatt_connect_data *conn_data = current_data_step->set_data;
1207 struct step *step = g_new0(struct step, 1);
1209 step->action_status = data->if_gatt->client->disconnect(
1211 &emu_remote_bdaddr_val,
1212 conn_data->conn_id);
1214 schedule_action_verification(step);
1217 static void gatt_client_do_listen_action(void)
1219 struct test_data *data = tester_get_data();
1220 struct step *current_data_step = queue_peek_head(data->steps);
1221 struct gatt_connect_data *conn_data = current_data_step->set_data;
1222 struct step *step = g_new0(struct step, 1);
1224 step->action_status = data->if_gatt->client->listen(
1228 schedule_action_verification(step);
1231 static void gatt_client_stop_listen_action(void)
1233 struct test_data *data = tester_get_data();
1234 struct step *current_data_step = queue_peek_head(data->steps);
1235 struct gatt_connect_data *conn_data = current_data_step->set_data;
1236 struct step *step = g_new0(struct step, 1);
1238 step->action_status = data->if_gatt->client->listen(
1242 schedule_action_verification(step);
1245 static void gatt_client_get_characteristic_action(void)
1247 struct test_data *data = tester_get_data();
1248 struct step *current_data_step = queue_peek_head(data->steps);
1249 struct get_char_data *get_char = current_data_step->set_data;
1250 const btgatt_client_interface_t *client = data->if_gatt->client;
1251 struct step *step = g_new0(struct step, 1);
1254 status = client->get_characteristic(get_char->conn_id,
1255 get_char->service, NULL);
1256 step->action_status = status;
1258 schedule_action_verification(step);
1261 static void gatt_client_get_descriptor_action(void)
1263 struct test_data *data = tester_get_data();
1264 struct step *current_data_step = queue_peek_head(data->steps);
1265 struct get_desc_data *get_desc = current_data_step->set_data;
1266 const btgatt_client_interface_t *client = data->if_gatt->client;
1267 struct step *step = g_new0(struct step, 1);
1270 status = client->get_descriptor(get_desc->conn_id, get_desc->service,
1271 get_desc->characteristic,
1273 step->action_status = status;
1275 schedule_action_verification(step);
1278 static void gatt_client_get_included_action(void)
1280 struct test_data *data = tester_get_data();
1281 struct step *current_data_step = queue_peek_head(data->steps);
1282 struct get_incl_data *get_incl = current_data_step->set_data;
1283 const btgatt_client_interface_t *client = data->if_gatt->client;
1284 struct step *step = g_new0(struct step, 1);
1287 status = client->get_included_service(get_incl->conn_id,
1288 get_incl->service, get_incl->start_service);
1290 step->action_status = status;
1292 schedule_action_verification(step);
1295 static void gatt_client_read_characteristic_action(void)
1297 struct test_data *data = tester_get_data();
1298 struct step *current_data_step = queue_peek_head(data->steps);
1299 struct read_char_data *read_char_data = current_data_step->set_data;
1300 const btgatt_client_interface_t *client = data->if_gatt->client;
1301 struct step *step = g_new0(struct step, 1);
1304 status = client->read_characteristic(read_char_data->conn_id,
1305 read_char_data->service, read_char_data->characteristic,
1306 read_char_data->auth_req);
1308 step->action_status = status;
1310 schedule_action_verification(step);
1313 static void gatt_client_read_descriptor_action(void)
1315 struct test_data *data = tester_get_data();
1316 struct step *current_data_step = queue_peek_head(data->steps);
1317 struct read_desc_data *read_desc_data = current_data_step->set_data;
1318 const btgatt_client_interface_t *client = data->if_gatt->client;
1319 struct step *step = g_new0(struct step, 1);
1322 status = client->read_descriptor(read_desc_data->conn_id,
1323 read_desc_data->service, read_desc_data->characteristic,
1324 read_desc_data->descriptor,
1325 read_desc_data->auth_req);
1327 step->action_status = status;
1329 schedule_action_verification(step);
1332 static void gatt_client_write_characteristic_action(void)
1334 struct test_data *data = tester_get_data();
1335 struct step *current_data_step = queue_peek_head(data->steps);
1336 struct write_char_data *write_char_data = current_data_step->set_data;
1337 const btgatt_client_interface_t *client = data->if_gatt->client;
1338 struct step *step = g_new0(struct step, 1);
1341 status = client->write_characteristic(write_char_data->conn_id,
1342 write_char_data->service,
1343 write_char_data->characteristic,
1344 write_char_data->write_type,
1345 write_char_data->len,
1346 write_char_data->auth_req,
1347 write_char_data->p_value);
1349 step->action_status = status;
1351 schedule_action_verification(step);
1354 static void gatt_client_register_for_notification_action(void)
1356 struct test_data *data = tester_get_data();
1357 struct step *current_data_step = queue_peek_head(data->steps);
1358 struct notif_data *notif_data = current_data_step->set_data;
1359 const btgatt_client_interface_t *client = data->if_gatt->client;
1360 struct step *step = g_new0(struct step, 1);
1363 status = client->register_for_notification(notif_data->conn_id,
1365 notif_data->service,
1366 notif_data->charac);
1367 step->action_status = status;
1369 schedule_action_verification(step);
1372 static void gatt_client_deregister_for_notification_action(void)
1374 struct test_data *data = tester_get_data();
1375 struct step *current_data_step = queue_peek_head(data->steps);
1376 struct notif_data *notif_data = current_data_step->set_data;
1377 const btgatt_client_interface_t *client = data->if_gatt->client;
1378 struct step *step = g_new0(struct step, 1);
1381 status = client->deregister_for_notification(notif_data->conn_id,
1383 notif_data->service,
1384 notif_data->charac);
1385 step->action_status = status;
1387 schedule_action_verification(step);
1390 static void gatt_server_register_action(void)
1392 struct test_data *data = tester_get_data();
1393 struct step *current_data_step = queue_peek_head(data->steps);
1394 bt_uuid_t *app_uuid = current_data_step->set_data;
1395 struct step *step = g_new0(struct step, 1);
1398 tester_warn("No app uuid provided for register action.");
1402 step->action_status = data->if_gatt->server->register_server(app_uuid);
1404 schedule_action_verification(step);
1407 static void gatt_server_unregister_action(void)
1409 struct test_data *data = tester_get_data();
1410 struct step *current_data_step = queue_peek_head(data->steps);
1411 int32_t sr_id = PTR_TO_INT(current_data_step->set_data);
1412 struct step *step = g_new0(struct step, 1);
1414 step->action_status = data->if_gatt->server->unregister_server(sr_id);
1416 schedule_action_verification(step);
1419 static void gatt_server_connect_action(void)
1421 struct test_data *data = tester_get_data();
1422 struct step *current_data_step = queue_peek_head(data->steps);
1423 struct gatt_connect_data *conn_data = current_data_step->set_data;
1424 struct step *step = g_new0(struct step, 1);
1426 step->action_status = data->if_gatt->server->connect(
1428 &emu_remote_bdaddr_val, 0,
1429 BT_TRANSPORT_UNKNOWN);
1431 schedule_action_verification(step);
1434 static void gatt_server_disconnect_action(void)
1436 struct test_data *data = tester_get_data();
1437 struct step *current_data_step = queue_peek_head(data->steps);
1438 struct gatt_connect_data *conn_data = current_data_step->set_data;
1439 struct step *step = g_new0(struct step, 1);
1441 step->action_status = data->if_gatt->server->disconnect(
1443 &emu_remote_bdaddr_val,
1444 conn_data->conn_id);
1446 schedule_action_verification(step);
1449 static void gatt_server_add_service_action(void)
1451 struct test_data *data = tester_get_data();
1452 struct step *current_data_step = queue_peek_head(data->steps);
1453 struct add_service_data *add_srvc_data = current_data_step->set_data;
1454 struct step *step = g_new0(struct step, 1);
1456 step->action_status = data->if_gatt->server->add_service(
1457 add_srvc_data->app_id,
1458 add_srvc_data->service,
1459 add_srvc_data->num_handles);
1461 schedule_action_verification(step);
1464 static void gatt_server_add_inc_service_action(void)
1466 struct test_data *data = tester_get_data();
1467 struct step *current_data_step = queue_peek_head(data->steps);
1468 struct add_included_service_data *add_inc_srvc_data =
1469 current_data_step->set_data;
1470 struct step *step = g_new0(struct step, 1);
1472 step->action_status = data->if_gatt->server->add_included_service(
1473 add_inc_srvc_data->app_id,
1474 *add_inc_srvc_data->srvc_handle,
1475 *add_inc_srvc_data->inc_srvc_handle);
1477 schedule_action_verification(step);
1480 static void gatt_server_add_char_action(void)
1482 struct test_data *data = tester_get_data();
1483 struct step *current_data_step = queue_peek_head(data->steps);
1484 struct add_char_data *add_char_data = current_data_step->set_data;
1485 struct step *step = g_new0(struct step, 1);
1487 step->action_status = data->if_gatt->server->add_characteristic(
1488 add_char_data->app_id,
1489 *add_char_data->srvc_handle,
1490 add_char_data->uuid,
1491 add_char_data->properties,
1492 add_char_data->permissions);
1494 schedule_action_verification(step);
1497 static void gatt_server_add_desc_action(void)
1499 struct test_data *data = tester_get_data();
1500 struct step *current_data_step = queue_peek_head(data->steps);
1501 struct add_desc_data *add_desc_data = current_data_step->set_data;
1502 struct step *step = g_new0(struct step, 1);
1504 step->action_status = data->if_gatt->server->add_descriptor(
1505 add_desc_data->app_id,
1506 *add_desc_data->srvc_handle,
1507 add_desc_data->uuid,
1508 add_desc_data->permissions);
1510 schedule_action_verification(step);
1513 static void gatt_client_write_descriptor_action(void)
1515 struct test_data *data = tester_get_data();
1516 struct step *current_data_step = queue_peek_head(data->steps);
1517 struct write_desc_data *write_desc_data = current_data_step->set_data;
1518 const btgatt_client_interface_t *client = data->if_gatt->client;
1519 struct step *step = g_new0(struct step, 1);
1522 status = client->write_descriptor(write_desc_data->conn_id,
1523 write_desc_data->service,
1524 write_desc_data->characteristic,
1525 write_desc_data->descriptor,
1526 write_desc_data->write_type,
1527 write_desc_data->len,
1528 write_desc_data->auth_req,
1529 write_desc_data->p_value);
1531 step->action_status = status;
1533 schedule_action_verification(step);
1536 static void gatt_server_start_srvc_action(void)
1538 struct test_data *data = tester_get_data();
1539 struct step *current_data_step = queue_peek_head(data->steps);
1540 struct start_srvc_data *start_srvc_data = current_data_step->set_data;
1541 struct step *step = g_new0(struct step, 1);
1543 step->action_status = data->if_gatt->server->start_service(
1544 start_srvc_data->app_id,
1545 *start_srvc_data->srvc_handle,
1546 start_srvc_data->transport);
1548 schedule_action_verification(step);
1551 static void gatt_server_stop_srvc_action(void)
1553 struct test_data *data = tester_get_data();
1554 struct step *current_data_step = queue_peek_head(data->steps);
1555 struct stop_srvc_data *stop_srvc_data = current_data_step->set_data;
1556 struct step *step = g_new0(struct step, 1);
1558 step->action_status = data->if_gatt->server->stop_service(
1559 stop_srvc_data->app_id,
1560 *stop_srvc_data->srvc_handle);
1562 schedule_action_verification(step);
1565 static void gatt_server_delete_srvc_action(void)
1567 struct test_data *data = tester_get_data();
1568 struct step *current_data_step = queue_peek_head(data->steps);
1569 struct delete_srvc_data *delete_srvc_data = current_data_step->set_data;
1570 struct step *step = g_new0(struct step, 1);
1572 step->action_status = data->if_gatt->server->delete_service(
1573 delete_srvc_data->app_id,
1574 *delete_srvc_data->srvc_handle);
1576 schedule_action_verification(step);
1579 static void gatt_server_send_indication_action(void)
1581 struct test_data *data = tester_get_data();
1582 struct step *current_data_step = queue_peek_head(data->steps);
1583 struct send_indication_data *send_indication_data =
1584 current_data_step->set_data;
1585 struct step *step = g_new0(struct step, 1);
1587 step->action_status = data->if_gatt->server->send_indication(
1588 send_indication_data->app_id,
1589 *send_indication_data->attr_handle,
1590 send_indication_data->conn_id,
1591 send_indication_data->len,
1592 send_indication_data->confirm,
1593 send_indication_data->p_value);
1595 schedule_action_verification(step);
1598 static void gatt_server_send_response_action(void)
1600 struct test_data *data = tester_get_data();
1601 struct step *current_data_step = queue_peek_head(data->steps);
1602 struct send_resp_data *send_resp_data = current_data_step->set_data;
1603 struct step *step = g_new0(struct step, 1);
1605 step->action_status = data->if_gatt->server->send_response(
1606 send_resp_data->conn_id,
1607 send_resp_data->trans_id,
1608 send_resp_data->status,
1609 send_resp_data->response);
1611 schedule_action_verification(step);
1614 static void gatt_cid_hook_cb(const void *data, uint16_t len, void *user_data)
1616 struct test_data *t_data = tester_get_data();
1617 struct bthost *bthost = hciemu_client_get_host(t_data->hciemu);
1618 struct emu_l2cap_cid_data *cid_data = user_data;
1619 const uint8_t *pdu = data;
1620 struct iovec *gatt_pdu = queue_peek_head(t_data->pdus);
1623 tester_debug("Received att pdu with opcode 0x%02x", pdu[0]);
1626 case L2CAP_ATT_ERROR:
1627 step = g_new0(struct step, 1);
1629 step->callback = CB_EMU_ATT_ERROR;
1630 step->callback_result.error = pdu[4];
1632 schedule_callback_verification(step);
1634 case L2CAP_ATT_EXCHANGE_MTU_REQ:
1635 tester_print("Exchange MTU request received.");
1637 if (!memcmp(exchange_mtu_req_pdu.iov_base, pdu, len))
1638 bthost_send_cid_v(bthost, cid_data->handle,
1640 &exchange_mtu_resp_pdu, 1);
1643 case L2CAP_ATT_EXCHANGE_MTU_RSP:
1644 tester_print("Exchange MTU response received.");
1647 case L2CAP_ATT_HANDLE_VALUE_IND:
1648 step = g_new0(struct step, 1);
1650 step->callback = CB_EMU_VALUE_INDICATION;
1652 schedule_callback_verification(step);
1654 case L2CAP_ATT_HANDLE_VALUE_NOTIFY:
1655 step = g_new0(struct step, 1);
1657 step->callback = CB_EMU_VALUE_NOTIFICATION;
1659 schedule_callback_verification(step);
1661 case L2CAP_ATT_READ_RSP:
1662 /* TODO - More complicated cases should also verify pdu data */
1663 step = g_new0(struct step, 1);
1665 step->callback = CB_EMU_READ_RESPONSE;
1667 schedule_callback_verification(step);
1669 case L2CAP_ATT_WRITE_RSP:
1670 /* TODO - More complicated cases should also verify pdu data */
1671 step = g_new0(struct step, 1);
1673 step->callback = CB_EMU_WRITE_RESPONSE;
1675 schedule_callback_verification(step);
1678 if (!gatt_pdu || !gatt_pdu->iov_base) {
1679 tester_print("Unknown ATT packet.");
1683 if (gatt_pdu->iov_len != len) {
1684 tester_print("Size of incoming frame is not valid");
1685 tester_print("Expected size = %zd incoming size = %d",
1686 gatt_pdu->iov_len, len);
1691 if (memcmp(gatt_pdu->iov_base, data, len)) {
1692 tester_print("Incoming data mismatch");
1695 queue_pop_head(t_data->pdus);
1696 gatt_pdu = queue_pop_head(t_data->pdus);
1697 if (!gatt_pdu || !gatt_pdu->iov_base)
1700 bthost_send_cid_v(bthost, cid_data->handle, cid_data->cid,
1707 static void gatt_remote_send_frame_action(void)
1709 struct test_data *t_data = tester_get_data();
1710 struct bthost *bthost = hciemu_client_get_host(t_data->hciemu);
1711 struct iovec *gatt_pdu = queue_pop_head(t_data->pdus);
1712 struct step *step = g_new0(struct step, 1);
1715 tester_print("No frame to send");
1716 step->action_status = BT_STATUS_FAIL;
1718 bthost_send_cid_v(bthost, cid_data.handle, cid_data.cid,
1720 step->action_status = BT_STATUS_SUCCESS;
1723 schedule_action_verification(step);
1726 static void gatt_remote_send_raw_pdu_action(void)
1728 struct test_data *data = tester_get_data();
1729 struct bthost *bthost = hciemu_client_get_host(data->hciemu);
1730 struct step *current_data_step = queue_peek_head(data->steps);
1731 struct iovec *pdu = current_data_step->set_data;
1732 struct iovec *pdu2 = current_data_step->set_data_2;
1733 struct iovec *pdu3 = current_data_step->set_data_3;
1734 struct step *step = g_new0(struct step, 1);
1736 if (cid_data.handle && cid_data.cid) {
1737 struct iovec rsp[3];
1741 step->action_status = BT_STATUS_FAIL;
1745 rsp[0].iov_base = pdu->iov_base;
1746 rsp[0].iov_len = pdu->iov_len;
1750 rsp[1].iov_base = pdu2->iov_base;
1751 rsp[1].iov_len = pdu2->iov_len;
1756 rsp[2].iov_base = pdu3->iov_base;
1757 rsp[2].iov_len = pdu3->iov_len;
1761 bthost_send_cid_v(bthost, cid_data.handle, cid_data.cid, rsp,
1763 step->action_status = BT_STATUS_SUCCESS;
1765 tester_debug("No connection set up");
1766 step->action_status = BT_STATUS_FAIL;
1770 schedule_action_verification(step);
1773 static void gatt_conn_cb(uint16_t handle, void *user_data)
1775 struct test_data *data = tester_get_data();
1776 struct bthost *bthost = hciemu_client_get_host(data->hciemu);
1778 tester_print("New connection with handle 0x%04x", handle);
1780 if (data->hciemu_type == HCIEMU_TYPE_BREDR) {
1781 tester_warn("Not handled device type.");
1785 cid_data.cid = 0x0004;
1786 cid_data.handle = handle;
1788 bthost_add_cid_hook(bthost, handle, cid_data.cid, gatt_cid_hook_cb,
1792 static void gatt_client_search_services(void)
1794 struct test_data *data = tester_get_data();
1795 struct step *current_data_step = queue_peek_head(data->steps);
1796 struct step *step = g_new0(struct step, 1);
1797 struct gatt_search_service_data *search_data;
1800 search_data = current_data_step->set_data;
1802 status = data->if_gatt->client->search_service(search_data->conn_id,
1803 search_data->filter_uuid);
1804 step->action_status = status;
1806 schedule_action_verification(step);
1809 static void init_pdus(void)
1811 struct test_data *data = tester_get_data();
1812 struct step *current_data_step = queue_peek_head(data->steps);
1813 struct step *step = g_new0(struct step, 1);
1814 struct iovec *pdu = current_data_step->set_data;
1816 while (pdu->iov_base) {
1817 queue_push_tail(data->pdus, pdu);
1821 step->action_status = BT_STATUS_SUCCESS;
1823 schedule_action_verification(step);
1826 static void init_read_params_action(void)
1828 struct test_data *data = tester_get_data();
1829 struct step *current_data_step = queue_peek_head(data->steps);
1830 struct step *step = g_new0(struct step, 1);
1831 struct set_read_params *set_param_data = current_data_step->set_data;
1832 btgatt_read_params_t *param = set_param_data->params;
1834 memset(param, 0, sizeof(*param));
1836 if (set_param_data->srvc_id)
1837 memcpy(¶m->srvc_id, set_param_data->srvc_id,
1838 sizeof(btgatt_srvc_id_t));
1840 if (set_param_data->char_id)
1841 memcpy(¶m->char_id, set_param_data->char_id,
1842 sizeof(btgatt_gatt_id_t));
1844 if (set_param_data->descr_id)
1845 memcpy(¶m->descr_id, set_param_data->descr_id,
1846 sizeof(btgatt_gatt_id_t));
1848 param->value_type = set_param_data->value_type;
1849 param->status = set_param_data->status;
1850 param->value.len = set_param_data->len;
1852 if (param->value.len != 0)
1853 memcpy(¶m->value.value, set_param_data->value,
1856 step->action_status = BT_STATUS_SUCCESS;
1858 schedule_action_verification(step);
1861 static void init_write_params_action(void)
1863 struct test_data *data = tester_get_data();
1864 struct step *current_data_step = queue_peek_head(data->steps);
1865 struct step *step = g_new0(struct step, 1);
1866 struct set_write_params *set_param_data = current_data_step->set_data;
1867 btgatt_write_params_t *param = set_param_data->params;
1869 memset(param, 0, sizeof(*param));
1871 if (set_param_data->srvc_id)
1872 memcpy(¶m->srvc_id, set_param_data->srvc_id,
1873 sizeof(btgatt_srvc_id_t));
1875 if (set_param_data->char_id)
1876 memcpy(¶m->char_id, set_param_data->char_id,
1877 sizeof(btgatt_gatt_id_t));
1879 if (set_param_data->descr_id)
1880 memcpy(¶m->descr_id, set_param_data->descr_id,
1881 sizeof(btgatt_gatt_id_t));
1883 param->status = set_param_data->status;
1885 step->action_status = BT_STATUS_SUCCESS;
1887 schedule_action_verification(step);
1890 static void init_notify_params_action(void)
1892 struct test_data *data = tester_get_data();
1893 struct step *current_data_step = queue_peek_head(data->steps);
1894 struct step *step = g_new0(struct step, 1);
1895 struct set_notify_params *set_param_data = current_data_step->set_data;
1896 btgatt_notify_params_t *param = set_param_data->params;
1898 memset(param, 0, sizeof(*param));
1900 if (set_param_data->srvc_id)
1901 memcpy(¶m->srvc_id, set_param_data->srvc_id,
1902 sizeof(btgatt_srvc_id_t));
1904 if (set_param_data->char_id)
1905 memcpy(¶m->char_id, set_param_data->char_id,
1906 sizeof(btgatt_gatt_id_t));
1908 param->len = set_param_data->len;
1909 param->is_notify = set_param_data->is_notify;
1911 memcpy(¶m->bda, set_param_data->bdaddr, sizeof(bt_bdaddr_t));
1912 if (param->len != 0)
1913 memcpy(¶m->value, set_param_data->value, param->len);
1915 step->action_status = BT_STATUS_SUCCESS;
1917 schedule_action_verification(step);
1920 static struct test_case test_cases[] = {
1921 TEST_CASE_BREDRLE("Gatt Init",
1922 ACTION_SUCCESS(dummy_action, NULL),
1924 TEST_CASE_BREDRLE("Gatt Client - Register",
1925 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
1926 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
1928 TEST_CASE_BREDRLE("Gatt Client - Unregister",
1929 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
1930 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
1931 ACTION_SUCCESS(gatt_client_unregister_action,
1932 INT_TO_PTR(APP1_ID)),
1933 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
1934 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
1936 TEST_CASE_BREDRLE("Gatt Client - Scan",
1937 ACTION_SUCCESS(bluetooth_enable_action, NULL),
1938 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
1939 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
1940 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
1941 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
1942 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
1943 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
1944 CALLBACK_DEVICE_FOUND(prop_emu_remotes_default_le_set, 2),
1945 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
1946 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
1947 ACTION_SUCCESS(bluetooth_disable_action, NULL),
1948 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
1950 TEST_CASE_BREDRLE("Gatt Client - LE Connect",
1951 ACTION_SUCCESS(bluetooth_enable_action, NULL),
1952 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
1953 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
1954 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
1955 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
1956 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
1957 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
1958 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
1959 CALLBACK_DEVICE_FOUND(prop_emu_remotes_default_le_set, 2),
1960 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
1961 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
1962 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
1963 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
1964 prop_emu_remotes_default_set,
1966 ACTION_SUCCESS(bluetooth_disable_action, NULL),
1967 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
1969 TEST_CASE_BREDRLE("Gatt Client - LE Disconnect",
1970 ACTION_SUCCESS(bluetooth_enable_action, NULL),
1971 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
1972 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
1973 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
1974 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
1975 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
1976 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
1977 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
1978 CALLBACK_DEVICE_FOUND(prop_emu_remotes_default_le_set, 2),
1979 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
1980 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
1981 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
1982 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
1983 prop_emu_remotes_default_set,
1985 ACTION_SUCCESS(gatt_client_disconnect_action,
1987 CALLBACK_GATTC_DISCONNECT(GATT_STATUS_SUCCESS,
1988 prop_emu_remotes_default_set,
1990 ACTION_SUCCESS(bluetooth_disable_action, NULL),
1991 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
1993 TEST_CASE_BREDRLE("Gatt Client - LE Multiple Client Conn./Disc.",
1994 ACTION_SUCCESS(bluetooth_enable_action, NULL),
1995 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
1996 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
1997 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
1998 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
1999 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2000 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2001 ACTION_SUCCESS(gatt_client_register_action, &app2_uuid),
2002 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2003 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2004 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2005 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2006 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2007 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2008 prop_emu_remotes_default_set,
2010 ACTION_SUCCESS(gatt_client_connect_action, &app2_conn_req),
2011 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2012 prop_emu_remotes_default_set,
2014 ACTION_SUCCESS(gatt_client_disconnect_action,
2016 CALLBACK_GATTC_DISCONNECT(GATT_STATUS_SUCCESS,
2017 prop_emu_remotes_default_set,
2019 ACTION_SUCCESS(gatt_client_disconnect_action,
2021 CALLBACK_GATTC_DISCONNECT(GATT_STATUS_SUCCESS,
2022 prop_emu_remotes_default_set,
2024 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2025 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2027 TEST_CASE_BREDRLE("Gatt Client - Listen and Disconnect",
2028 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2029 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2030 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2031 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2032 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2033 ACTION_SUCCESS(bt_set_property_action,
2034 &prop_test_scan_mode_conn),
2035 CALLBACK_ADAPTER_PROPS(&prop_test_scan_mode_conn, 1),
2036 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2037 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2038 ACTION_SUCCESS(gatt_client_do_listen_action, &app1_conn_req),
2039 CALLBACK_STATUS(CB_GATTC_LISTEN, GATT_STATUS_SUCCESS),
2040 ACTION_SUCCESS(emu_remote_connect_hci_action, &bearer_type),
2041 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2042 prop_emu_remotes_default_set,
2044 ACTION_SUCCESS(gatt_client_stop_listen_action,
2046 CALLBACK_STATUS(CB_GATTC_LISTEN, GATT_STATUS_SUCCESS),
2047 ACTION_SUCCESS(gatt_client_disconnect_action,
2049 CALLBACK_GATTC_DISCONNECT(GATT_STATUS_SUCCESS,
2050 prop_emu_remotes_default_set,
2052 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2053 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2055 TEST_CASE_BREDRLE("Gatt Client - Double Listen",
2056 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2057 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2058 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2059 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2060 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2061 ACTION_SUCCESS(bt_set_property_action,
2062 &prop_test_scan_mode_conn),
2063 CALLBACK_ADAPTER_PROPS(&prop_test_scan_mode_conn, 1),
2064 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2065 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2066 ACTION_SUCCESS(gatt_client_do_listen_action, &app1_conn_req),
2067 CALLBACK_STATUS(CB_GATTC_LISTEN, GATT_STATUS_SUCCESS),
2068 ACTION_SUCCESS(emu_remote_connect_hci_action, &bearer_type),
2069 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2070 prop_emu_remotes_default_set,
2072 ACTION_SUCCESS(gatt_client_stop_listen_action,
2074 CALLBACK_STATUS(CB_GATTC_LISTEN, GATT_STATUS_SUCCESS),
2075 ACTION_SUCCESS(gatt_client_disconnect_action,
2077 CALLBACK_GATTC_DISCONNECT(GATT_STATUS_SUCCESS,
2078 prop_emu_remotes_default_set,
2080 /* Close ACL on emulated remotes side so it can reconnect */
2081 ACTION_SUCCESS(emu_remote_disconnect_hci_action,
2083 CALLBACK_STATE(CB_BT_ACL_STATE_CHANGED,
2084 BT_ACL_STATE_DISCONNECTED),
2085 ACTION_SUCCESS(gatt_client_do_listen_action, &app1_conn_req),
2086 CALLBACK_STATUS(CB_GATTC_LISTEN, GATT_STATUS_SUCCESS),
2087 ACTION_SUCCESS(emu_remote_connect_hci_action, &bearer_type),
2088 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2089 prop_emu_remotes_default_set,
2091 ACTION_SUCCESS(gatt_client_disconnect_action,
2093 CALLBACK_GATTC_DISCONNECT(GATT_STATUS_SUCCESS,
2094 prop_emu_remotes_default_set,
2096 ACTION_SUCCESS(gatt_client_stop_listen_action,
2098 CALLBACK_STATUS(CB_GATTC_LISTEN, GATT_STATUS_SUCCESS),
2099 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2100 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2102 TEST_CASE_BREDRLE("Gatt Client - Search Service - Single",
2103 ACTION_SUCCESS(init_pdus, search_service),
2104 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2105 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2106 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2107 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2108 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2109 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2110 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2111 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2112 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2113 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2114 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2115 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2116 prop_emu_remotes_default_set,
2118 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2119 CALLBACK_GATTC_SEARCH_RESULT(CONN1_ID, &service_1),
2120 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2121 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2122 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2124 TEST_CASE_BREDRLE("Gatt Client - Search Service - Multiple",
2125 ACTION_SUCCESS(init_pdus, search_service_2),
2126 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2127 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2128 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2129 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2130 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2131 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2132 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2133 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2134 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2135 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2136 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2137 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2138 prop_emu_remotes_default_set,
2140 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2141 CALLBACK_GATTC_SEARCH_RESULT(CONN1_ID, &service_1),
2142 CALLBACK_GATTC_SEARCH_RESULT(CONN1_ID, &service_2),
2143 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2144 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2145 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2147 TEST_CASE_BREDRLE("Gatt Client - Search Service - None",
2148 ACTION_SUCCESS(init_pdus, search_service_3),
2149 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2150 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2151 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2152 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2153 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2154 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2155 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2156 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2157 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2158 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2159 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2160 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2161 prop_emu_remotes_default_set,
2163 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2164 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2165 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2166 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2168 TEST_CASE_BREDRLE("Gatt Client - Search Service - Incorrect rsp",
2169 ACTION_SUCCESS(init_pdus, search_service_4),
2170 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2171 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2172 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2173 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2174 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2175 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2176 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2177 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2178 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2179 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2180 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2181 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2182 prop_emu_remotes_default_set,
2184 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2185 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2186 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2187 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2189 TEST_CASE_BREDRLE("Gatt Client - Get Characteristic - Single",
2190 ACTION_SUCCESS(init_pdus, get_characteristic_1),
2191 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2192 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2193 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2194 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2195 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2196 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2197 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2198 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2199 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2200 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2201 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2202 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2203 prop_emu_remotes_default_set,
2205 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2206 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2207 ACTION_SUCCESS(gatt_client_get_characteristic_action,
2209 CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_SUCCESS,
2210 CONN1_ID, &service_1, &characteristic_1, 4),
2211 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2212 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2214 TEST_CASE_BREDRLE("Gatt Client - Get Characteristic - Incorrect rsp",
2215 ACTION_SUCCESS(init_pdus, get_characteristic_2),
2216 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2217 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2218 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2219 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2220 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2221 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2222 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2223 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2224 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2225 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2226 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2227 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2228 prop_emu_remotes_default_set,
2230 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2231 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2232 ACTION_SUCCESS(gatt_client_get_characteristic_action,
2234 CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_FAILURE,
2235 CONN1_ID, &service_1, NULL, 0),
2236 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2237 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2239 TEST_CASE_BREDRLE("Gatt Client - Get Characteristic - None",
2240 ACTION_SUCCESS(init_pdus, get_characteristic_1),
2241 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2242 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2243 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2244 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2245 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2246 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2247 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2248 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2249 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2250 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2251 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2252 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2253 prop_emu_remotes_default_set,
2255 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2256 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2257 ACTION_FAIL(gatt_client_get_characteristic_action,
2259 CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_FAILURE,
2260 CONN1_ID, &service_2,
2262 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2263 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2265 TEST_CASE_BREDRLE("Gatt Client - Get Descriptor - Incorrect rsp",
2266 ACTION_SUCCESS(init_pdus, get_descriptor_0),
2267 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2268 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2269 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2270 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2271 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2272 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2273 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2274 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2275 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2276 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2277 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2278 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2279 prop_emu_remotes_default_set,
2281 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2282 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2283 ACTION_SUCCESS(gatt_client_get_characteristic_action,
2285 CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_SUCCESS,
2286 CONN1_ID, &service_1, &characteristic_1, 4),
2287 ACTION_SUCCESS(gatt_client_get_descriptor_action,
2289 CALLBACK_GATTC_GET_DESCRIPTOR(GATT_STATUS_FAILURE, CONN1_ID,
2290 &service_1, &characteristic_1, NULL),
2291 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2292 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2294 TEST_CASE_BREDRLE("Gatt Client - Get Descriptor - Single",
2295 ACTION_SUCCESS(init_pdus, get_descriptor_1),
2296 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2297 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2298 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2299 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2300 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2301 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2302 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2303 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2304 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2305 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2306 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2307 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2308 prop_emu_remotes_default_set,
2310 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2311 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2312 ACTION_SUCCESS(gatt_client_get_characteristic_action,
2314 CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_SUCCESS,
2315 CONN1_ID, &service_1, &characteristic_1, 4),
2316 ACTION_SUCCESS(gatt_client_get_descriptor_action,
2318 CALLBACK_GATTC_GET_DESCRIPTOR(GATT_STATUS_SUCCESS, CONN1_ID,
2319 &service_1, &characteristic_1, &desc_1),
2320 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2321 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2323 TEST_CASE_BREDRLE("Gatt Client - Get Descriptor - Multiple",
2324 ACTION_SUCCESS(init_pdus, get_descriptor_2),
2325 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2326 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2327 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2328 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2329 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2330 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2331 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2332 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2333 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2334 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2335 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2336 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2337 prop_emu_remotes_default_set,
2339 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2340 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2341 ACTION_SUCCESS(gatt_client_get_characteristic_action,
2343 CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_SUCCESS,
2344 CONN1_ID, &service_1,
2345 &characteristic_1, 4),
2346 ACTION_SUCCESS(gatt_client_get_descriptor_action,
2348 CALLBACK_GATTC_GET_DESCRIPTOR(GATT_STATUS_SUCCESS, CONN1_ID,
2349 &service_1, &characteristic_1,
2351 ACTION_SUCCESS(gatt_client_get_descriptor_action,
2353 CALLBACK_GATTC_GET_DESCRIPTOR(GATT_STATUS_SUCCESS, CONN1_ID,
2354 &service_1, &characteristic_1,
2356 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2357 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2359 TEST_CASE_BREDRLE("Gatt Client - Get Descriptor - None",
2360 ACTION_SUCCESS(init_pdus, get_descriptor_3),
2361 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2362 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2363 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2364 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2365 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2366 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2367 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2368 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2369 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2370 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2371 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2372 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2373 prop_emu_remotes_default_set,
2375 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2376 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2377 ACTION_SUCCESS(gatt_client_get_characteristic_action,
2379 CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_SUCCESS,
2380 CONN1_ID, &service_1, &characteristic_1, 4),
2381 ACTION_SUCCESS(gatt_client_get_descriptor_action,
2383 CALLBACK_GATTC_GET_DESCRIPTOR(GATT_STATUS_FAILURE, CONN1_ID,
2384 &service_1, &characteristic_1, NULL),
2385 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2386 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2388 TEST_CASE_BREDRLE("Gatt Client - Get Included Services - Incorrect rsp",
2389 ACTION_SUCCESS(init_pdus, get_included_0),
2390 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2391 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2392 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2393 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2394 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2395 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2396 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2397 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2398 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2399 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2400 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2401 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2402 prop_emu_remotes_default_set,
2404 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2405 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2406 ACTION_SUCCESS(gatt_client_get_included_action,
2408 CALLBACK_GATTC_GET_INCLUDED(GATT_STATUS_FAILURE, CONN1_ID,
2410 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2411 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2413 TEST_CASE_BREDRLE("Gatt Client - Get Included Service - 16 UUID",
2414 ACTION_SUCCESS(init_pdus, get_included_1),
2415 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2416 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2417 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2418 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2419 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2420 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2421 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2422 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2423 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2424 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2425 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2426 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2427 prop_emu_remotes_default_set,
2429 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2430 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2431 ACTION_SUCCESS(gatt_client_get_included_action,
2433 CALLBACK_GATTC_GET_INCLUDED(GATT_STATUS_SUCCESS, CONN1_ID,
2434 &service_1, &included_1),
2435 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2436 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2438 TEST_CASE_BREDRLE("Gatt Client - Get Included Service - 128 UUID",
2439 ACTION_SUCCESS(init_pdus, get_included_2),
2440 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2441 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2442 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2443 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2444 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2445 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2446 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2447 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2448 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2449 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2450 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2451 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2452 prop_emu_remotes_default_set,
2454 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2455 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2456 ACTION_SUCCESS(gatt_client_get_included_action,
2458 CALLBACK_GATTC_GET_INCLUDED(GATT_STATUS_SUCCESS, CONN1_ID,
2459 &service_1, &included_2),
2460 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2461 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2463 TEST_CASE_BREDRLE("Gatt Client - Get Included Service - None",
2464 ACTION_SUCCESS(init_pdus, get_included_3),
2465 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2466 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2467 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2468 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2469 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2470 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2471 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2472 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2473 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2474 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2475 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2476 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2477 prop_emu_remotes_default_set,
2479 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2480 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2481 ACTION_SUCCESS(gatt_client_get_included_action,
2483 CALLBACK_GATTC_GET_INCLUDED(GATT_STATUS_FAILURE, CONN1_ID,
2485 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2486 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2488 TEST_CASE_BREDRLE("Gatt Client - Read Characteristic - Success",
2489 ACTION_SUCCESS(init_pdus, read_characteristic_1),
2490 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2491 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2492 ACTION_SUCCESS(init_read_params_action, &set_read_param_1),
2493 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2494 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2495 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2496 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2497 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2498 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2499 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2500 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2501 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2502 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2503 prop_emu_remotes_default_set,
2505 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2506 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2507 ACTION_SUCCESS(gatt_client_get_characteristic_action,
2509 CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_SUCCESS,
2510 CONN1_ID, &service_1, &characteristic_1, 4),
2511 ACTION_SUCCESS(gatt_client_read_characteristic_action,
2513 CALLBACK_GATTC_READ_CHARACTERISTIC(GATT_STATUS_SUCCESS,
2514 CONN1_ID, &read_params_1),
2515 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2516 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2519 TEST_CASE_BREDRLE("Gatt Client - Read Characteristic - Insuf. Auth.",
2520 ACTION_SUCCESS(init_pdus, read_characteristic_2),
2521 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2522 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2523 ACTION_SUCCESS(init_read_params_action, &set_read_param_2),
2524 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2525 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2526 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2527 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2528 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2529 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2530 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2531 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2532 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2533 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2534 prop_emu_remotes_default_set,
2536 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2537 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2538 ACTION_SUCCESS(gatt_client_get_characteristic_action,
2540 CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_SUCCESS,
2541 CONN1_ID, &service_1, &characteristic_1, 4),
2542 ACTION_SUCCESS(gatt_client_read_characteristic_action,
2544 CALLBACK_GATTC_READ_CHARACTERISTIC(GATT_STATUS_INS_AUTH,
2545 CONN1_ID, &read_params_1),
2546 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2547 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2549 TEST_CASE_BREDRLE("Gatt Client - Read Characteristic - Wrong params",
2550 ACTION_SUCCESS(init_pdus, read_characteristic_2),
2551 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2552 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2553 ACTION_SUCCESS(init_read_params_action, &set_read_param_3),
2554 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2555 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2556 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2557 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2558 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2559 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2560 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2561 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2562 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2563 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2564 prop_emu_remotes_default_set,
2566 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2567 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2568 ACTION_SUCCESS(gatt_client_get_characteristic_action,
2570 CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_SUCCESS,
2571 CONN1_ID, &service_1, &characteristic_1, 4),
2572 ACTION_FAIL(gatt_client_read_characteristic_action,
2574 CALLBACK_GATTC_READ_CHARACTERISTIC(GATT_STATUS_FAILURE,
2575 CONN1_ID, &read_params_1),
2576 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2577 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2579 TEST_CASE_BREDRLE("Gatt Client - Read Descriptor - Success",
2580 ACTION_SUCCESS(init_pdus, read_descriptor_1),
2581 ACTION_SUCCESS(init_read_params_action, &set_read_param_4),
2582 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2583 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2584 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2585 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2586 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2587 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2588 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2589 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2590 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2591 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2592 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2593 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2594 prop_emu_remotes_default_set,
2596 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2597 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2598 ACTION_SUCCESS(gatt_client_get_characteristic_action,
2600 CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_SUCCESS,
2601 CONN1_ID, &service_1, &characteristic_1, 4),
2602 ACTION_SUCCESS(gatt_client_get_descriptor_action,
2604 CALLBACK_GATTC_GET_DESCRIPTOR(GATT_STATUS_SUCCESS, CONN1_ID,
2605 &service_1, &characteristic_1, &desc_1),
2606 ACTION_SUCCESS(gatt_client_read_descriptor_action,
2608 CALLBACK_GATTC_READ_DESCRIPTOR(GATT_STATUS_SUCCESS,
2609 CONN1_ID, &read_params_1),
2610 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2611 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2613 TEST_CASE_BREDRLE("Gatt Client - Read Descriptor - Insuf. Auth.",
2614 ACTION_SUCCESS(init_pdus, read_descriptor_2),
2615 ACTION_SUCCESS(init_read_params_action, &set_read_param_5),
2616 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2617 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2618 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2619 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2620 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2621 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2622 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2623 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2624 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2625 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2626 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2627 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2628 prop_emu_remotes_default_set,
2630 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2631 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2632 ACTION_SUCCESS(gatt_client_get_characteristic_action,
2634 CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_SUCCESS,
2635 CONN1_ID, &service_1, &characteristic_1, 4),
2636 ACTION_SUCCESS(gatt_client_get_descriptor_action,
2638 CALLBACK_GATTC_GET_DESCRIPTOR(GATT_STATUS_SUCCESS, CONN1_ID,
2639 &service_1, &characteristic_1, &desc_1),
2640 ACTION_SUCCESS(gatt_client_read_descriptor_action,
2642 CALLBACK_GATTC_READ_DESCRIPTOR(GATT_STATUS_INS_AUTH,
2643 CONN1_ID, &read_params_1),
2644 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2645 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2647 TEST_CASE_BREDRLE("Gatt Client - Read Descriptor - Wrong params",
2648 ACTION_SUCCESS(init_pdus, read_descriptor_2),
2649 ACTION_SUCCESS(init_read_params_action, &set_read_param_6),
2650 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2651 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2652 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2653 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2654 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2655 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2656 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2657 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2658 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2659 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2660 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2661 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2662 prop_emu_remotes_default_set,
2664 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2665 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2666 ACTION_SUCCESS(gatt_client_get_characteristic_action,
2668 CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_SUCCESS,
2669 CONN1_ID, &service_1, &characteristic_1, 4),
2670 ACTION_SUCCESS(gatt_client_get_descriptor_action,
2672 CALLBACK_GATTC_GET_DESCRIPTOR(GATT_STATUS_SUCCESS, CONN1_ID,
2673 &service_1, &characteristic_1, &desc_1),
2674 ACTION_FAIL(gatt_client_read_descriptor_action,
2676 CALLBACK_GATTC_READ_DESCRIPTOR(GATT_STATUS_FAILURE,
2677 CONN1_ID, &read_params_1),
2678 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2679 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2681 TEST_CASE_BREDRLE("Gatt Client - Write Characteristic Cmd - Success",
2682 ACTION_SUCCESS(init_pdus, write_characteristic_1),
2683 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2684 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2685 ACTION_SUCCESS(init_write_params_action, &set_write_param_1),
2686 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2687 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2688 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2689 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2690 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2691 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2692 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2693 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2694 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2695 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2696 prop_emu_remotes_default_set,
2698 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2699 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2700 ACTION_SUCCESS(gatt_client_get_characteristic_action,
2702 CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_SUCCESS,
2703 CONN1_ID, &service_1, &characteristic_1, 4),
2704 ACTION_SUCCESS(gatt_client_write_characteristic_action,
2705 &write_char_data_1),
2706 CALLBACK_GATTC_WRITE_CHARACTERISTIC(GATT_STATUS_SUCCESS,
2707 CONN1_ID, &write_params_1),
2708 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2709 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2711 TEST_CASE_BREDRLE("Gatt Client - Write Characteristic Req - Success",
2712 ACTION_SUCCESS(init_pdus, write_characteristic_2),
2713 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2714 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2715 ACTION_SUCCESS(init_write_params_action, &set_write_param_1),
2716 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2717 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2718 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2719 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2720 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2721 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2722 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2723 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2724 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2725 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2726 prop_emu_remotes_default_set,
2728 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2729 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2730 ACTION_SUCCESS(gatt_client_get_characteristic_action,
2732 CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_SUCCESS,
2733 CONN1_ID, &service_1, &characteristic_1, 4),
2734 ACTION_SUCCESS(gatt_client_write_characteristic_action,
2735 &write_char_data_2),
2736 CALLBACK_GATTC_WRITE_CHARACTERISTIC(GATT_STATUS_SUCCESS,
2737 CONN1_ID, &write_params_1),
2738 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2739 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2741 TEST_CASE_BREDRLE("Gatt Client - Write Characteristic - Insuf. Auth.",
2742 ACTION_SUCCESS(init_pdus, write_characteristic_3),
2743 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2744 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2745 ACTION_SUCCESS(init_write_params_action, &set_write_param_2),
2746 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2747 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2748 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2749 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2750 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2751 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2752 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2753 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2754 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2755 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2756 prop_emu_remotes_default_set,
2758 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2759 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2760 ACTION_SUCCESS(gatt_client_get_characteristic_action,
2762 CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_SUCCESS,
2763 CONN1_ID, &service_1, &characteristic_1, 4),
2764 ACTION_SUCCESS(gatt_client_write_characteristic_action,
2765 &write_char_data_2),
2766 CALLBACK_GATTC_WRITE_CHARACTERISTIC(GATT_STATUS_INS_AUTH,
2767 CONN1_ID, &write_params_1),
2768 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2769 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2771 TEST_CASE_BREDRLE("Gatt Client - Write Characteristic - Wrong Params",
2772 ACTION_SUCCESS(init_pdus, write_characteristic_3),
2773 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2774 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2775 ACTION_SUCCESS(init_write_params_action, &set_write_param_3),
2776 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2777 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2778 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2779 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2780 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2781 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2782 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2783 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2784 ACTION_FAIL(gatt_client_write_characteristic_action,
2785 &write_char_data_2),
2786 CALLBACK_GATTC_WRITE_CHARACTERISTIC(GATT_STATUS_FAILURE,
2787 CONN1_ID, &write_params_1),
2788 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2789 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2791 TEST_CASE_BREDRLE("Gatt Client - Register For Notification - Success",
2792 ACTION_SUCCESS(init_pdus, notification_1),
2793 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2794 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2795 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2796 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2797 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2798 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2799 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2800 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2801 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2802 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2803 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2804 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2805 prop_emu_remotes_default_set,
2807 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2808 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2809 ACTION_SUCCESS(gatt_client_get_characteristic_action,
2811 CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_SUCCESS,
2812 CONN1_ID, &service_1, &characteristic_1, 4),
2813 ACTION_SUCCESS(gatt_client_register_for_notification_action,
2815 CALLBACK_GATTC_REGISTER_FOR_NOTIF(GATT_STATUS_SUCCESS, CONN1_ID,
2818 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2819 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2821 TEST_CASE_BREDRLE("Gatt Client - Deregister For Notification - Success",
2822 ACTION_SUCCESS(init_pdus, notification_1),
2823 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2824 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2825 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2826 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2827 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2828 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2829 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2830 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2831 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2832 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2833 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2834 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2835 prop_emu_remotes_default_set,
2837 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2838 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2839 ACTION_SUCCESS(gatt_client_get_characteristic_action,
2841 CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_SUCCESS,
2842 CONN1_ID, &service_1, &characteristic_1, 4),
2843 ACTION_SUCCESS(gatt_client_register_for_notification_action,
2845 CALLBACK_GATTC_REGISTER_FOR_NOTIF(GATT_STATUS_SUCCESS, CONN1_ID,
2848 ACTION_SUCCESS(gatt_client_deregister_for_notification_action,
2850 CALLBACK_GATTC_REGISTER_FOR_NOTIF(GATT_STATUS_SUCCESS, CONN1_ID,
2853 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2854 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2856 TEST_CASE_BREDRLE("Gatt Client - Register For Notification - Indicate",
2857 ACTION_SUCCESS(init_pdus, notification_2),
2858 ACTION_SUCCESS(init_notify_params_action, &set_notify_param_1),
2859 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2860 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2861 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2862 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2863 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2864 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2865 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2866 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2867 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2868 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2869 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2870 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2871 prop_emu_remotes_default_set,
2873 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2874 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2875 ACTION_SUCCESS(gatt_client_get_characteristic_action,
2877 CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_SUCCESS,
2878 CONN1_ID, &service_1, &characteristic_1, 4),
2879 ACTION_SUCCESS(gatt_client_register_for_notification_action,
2881 CALLBACK_GATTC_REGISTER_FOR_NOTIF(GATT_STATUS_SUCCESS, CONN1_ID,
2884 ACTION_SUCCESS(gatt_remote_send_frame_action, NULL),
2885 CALLBACK_GATTC_NOTIFY(CONN1_ID, ¬ify_params_1),
2886 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2887 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2889 TEST_CASE_BREDRLE("Gatt Client - Register For Notification - Notify",
2890 ACTION_SUCCESS(init_pdus, notification_3),
2891 ACTION_SUCCESS(init_notify_params_action, &set_notify_param_2),
2892 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2893 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2894 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2895 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2896 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2897 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2898 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2899 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2900 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2901 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2902 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2903 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2904 prop_emu_remotes_default_set,
2906 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2907 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2908 ACTION_SUCCESS(gatt_client_get_characteristic_action,
2910 CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_SUCCESS,
2911 CONN1_ID, &service_1, &characteristic_1, 4),
2912 ACTION_SUCCESS(gatt_client_register_for_notification_action,
2914 CALLBACK_GATTC_REGISTER_FOR_NOTIF(GATT_STATUS_SUCCESS, CONN1_ID,
2917 ACTION_SUCCESS(gatt_remote_send_frame_action, NULL),
2918 CALLBACK_GATTC_NOTIFY(CONN1_ID, ¬ify_params_1),
2919 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2920 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2922 TEST_CASE_BREDRLE("Gatt Client - Write Descriptor - Success",
2923 ACTION_SUCCESS(init_pdus, write_descriptor_1),
2924 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2925 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2926 ACTION_SUCCESS(init_write_params_action, &set_write_param_4),
2927 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2928 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2929 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2930 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2931 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2932 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2933 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2934 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2935 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2936 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2937 prop_emu_remotes_default_set,
2939 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2940 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2941 ACTION_SUCCESS(gatt_client_get_characteristic_action,
2943 CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_SUCCESS,
2944 CONN1_ID, &service_1, &characteristic_1, 4),
2945 ACTION_SUCCESS(gatt_client_get_descriptor_action,
2947 CALLBACK_GATTC_GET_DESCRIPTOR(GATT_STATUS_SUCCESS, CONN1_ID,
2948 &service_1, &characteristic_1, &desc_1),
2949 ACTION_SUCCESS(gatt_client_write_descriptor_action,
2950 &write_desc_data_1),
2951 CALLBACK_GATTC_WRITE_DESCRIPTOR(GATT_STATUS_SUCCESS,
2952 CONN1_ID, &write_params_1),
2953 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2954 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2956 TEST_CASE_BREDRLE("Gatt Client - Write Descriptor - Insuf. Auth.",
2957 ACTION_SUCCESS(init_pdus, write_descriptor_2),
2958 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2959 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2960 ACTION_SUCCESS(init_write_params_action, &set_write_param_6),
2961 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2962 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2963 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2964 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2965 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
2966 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
2967 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
2968 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
2969 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
2970 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
2971 prop_emu_remotes_default_set,
2973 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
2974 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
2975 ACTION_SUCCESS(gatt_client_get_characteristic_action,
2977 CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_SUCCESS,
2978 CONN1_ID, &service_1, &characteristic_1, 4),
2979 ACTION_SUCCESS(gatt_client_get_descriptor_action,
2981 CALLBACK_GATTC_GET_DESCRIPTOR(GATT_STATUS_SUCCESS, CONN1_ID,
2982 &service_1, &characteristic_1, &desc_1),
2983 ACTION_SUCCESS(gatt_client_write_descriptor_action,
2984 &write_desc_data_1),
2985 CALLBACK_GATTC_WRITE_DESCRIPTOR(GATT_STATUS_INS_AUTH,
2986 CONN1_ID, &write_params_1),
2987 ACTION_SUCCESS(bluetooth_disable_action, NULL),
2988 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
2990 TEST_CASE_BREDRLE("Gatt Client - Write Descriptor - Wrong Param",
2991 ACTION_SUCCESS(init_pdus, write_descriptor_1),
2992 ACTION_SUCCESS(bluetooth_enable_action, NULL),
2993 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
2994 ACTION_SUCCESS(init_write_params_action, &set_write_param_5),
2995 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
2996 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
2997 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
2998 ACTION_SUCCESS(gatt_client_register_action, &app1_uuid),
2999 CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
3000 ACTION_SUCCESS(gatt_client_start_scan_action, NULL),
3001 CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
3002 ACTION_SUCCESS(gatt_client_stop_scan_action, NULL),
3003 ACTION_SUCCESS(gatt_client_connect_action, &app1_conn_req),
3004 CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
3005 prop_emu_remotes_default_set,
3007 ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
3008 CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
3009 ACTION_SUCCESS(gatt_client_get_characteristic_action,
3011 CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_SUCCESS,
3012 CONN1_ID, &service_1, &characteristic_1, 4),
3013 ACTION_SUCCESS(gatt_client_get_descriptor_action,
3015 CALLBACK_GATTC_GET_DESCRIPTOR(GATT_STATUS_SUCCESS, CONN1_ID,
3016 &service_1, &characteristic_1, &desc_1),
3017 ACTION_FAIL(gatt_client_write_descriptor_action,
3018 &write_desc_data_2),
3019 CALLBACK_GATTC_WRITE_DESCRIPTOR(GATT_STATUS_FAILURE,
3020 CONN1_ID, &write_params_1),
3021 ACTION_SUCCESS(bluetooth_disable_action, NULL),
3022 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
3024 TEST_CASE_BREDRLE("Gatt Server - Register",
3025 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3026 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3028 TEST_CASE_BREDRLE("Gatt Server - Unregister",
3029 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3030 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3031 ACTION_SUCCESS(gatt_server_unregister_action,
3032 INT_TO_PTR(APP1_ID)),
3033 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3034 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3036 TEST_CASE_BREDRLE("Gatt Server - LE Connect",
3037 ACTION_SUCCESS(bluetooth_enable_action, NULL),
3038 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
3039 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
3040 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
3041 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
3042 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3043 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3044 ACTION_SUCCESS(bt_start_discovery_action, NULL),
3045 CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
3046 BT_DISCOVERY_STARTED),
3047 CALLBACK_DEVICE_FOUND(prop_emu_remotes_default_le_set, 2),
3048 ACTION_SUCCESS(bt_cancel_discovery_action, NULL),
3049 ACTION_SUCCESS(gatt_server_connect_action, &app1_conn_req),
3050 CALLBACK_GATTS_CONNECTION(GATT_SERVER_CONNECTED,
3051 prop_emu_remotes_default_set,
3053 ACTION_SUCCESS(bluetooth_disable_action, NULL),
3054 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
3056 TEST_CASE_BREDRLE("Gatt Server - LE Disconnect",
3057 ACTION_SUCCESS(bluetooth_enable_action, NULL),
3058 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
3059 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
3060 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
3061 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
3062 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3063 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3064 ACTION_SUCCESS(bt_start_discovery_action, NULL),
3065 CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
3066 BT_DISCOVERY_STARTED),
3067 CALLBACK_DEVICE_FOUND(prop_emu_remotes_default_le_set, 2),
3068 ACTION_SUCCESS(bt_cancel_discovery_action, NULL),
3069 ACTION_SUCCESS(gatt_server_connect_action, &app1_conn_req),
3070 CALLBACK_GATTS_CONNECTION(GATT_SERVER_CONNECTED,
3071 prop_emu_remotes_default_set,
3073 ACTION_SUCCESS(gatt_server_disconnect_action,
3075 CALLBACK_GATTS_CONNECTION(GATT_SERVER_DISCONNECTED,
3076 prop_emu_remotes_default_set,
3078 ACTION_SUCCESS(bluetooth_disable_action, NULL),
3079 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
3081 TEST_CASE_BREDRLE("Gatt Server - LE Multiple Server Conn./Disc",
3082 ACTION_SUCCESS(bluetooth_enable_action, NULL),
3083 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
3084 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
3085 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
3086 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
3087 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3088 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3089 ACTION_SUCCESS(gatt_server_register_action, &app2_uuid),
3090 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3091 ACTION_SUCCESS(bt_start_discovery_action, NULL),
3092 CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
3093 BT_DISCOVERY_STARTED),
3094 CALLBACK_DEVICE_FOUND(prop_emu_remotes_default_le_set, 2),
3095 ACTION_SUCCESS(bt_cancel_discovery_action, NULL),
3096 ACTION_SUCCESS(gatt_server_connect_action, &app1_conn_req),
3097 CALLBACK_GATTS_CONNECTION(GATT_SERVER_CONNECTED,
3098 prop_emu_remotes_default_set,
3100 ACTION_SUCCESS(gatt_server_connect_action, &app2_conn_req),
3101 CALLBACK_GATTS_CONNECTION(GATT_SERVER_CONNECTED,
3102 prop_emu_remotes_default_set,
3104 ACTION_SUCCESS(gatt_server_disconnect_action, &app2_conn_req),
3105 CALLBACK_GATTS_CONNECTION(GATT_SERVER_DISCONNECTED,
3106 prop_emu_remotes_default_set,
3108 ACTION_SUCCESS(gatt_server_disconnect_action, &app1_conn_req),
3109 CALLBACK_GATTS_CONNECTION(GATT_SERVER_DISCONNECTED,
3110 prop_emu_remotes_default_set,
3112 ACTION_SUCCESS(bluetooth_disable_action, NULL),
3113 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
3115 TEST_CASE_BREDRLE("Gatt Server - Add Single Service Successful",
3116 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3117 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3118 ACTION_SUCCESS(gatt_server_add_service_action,
3119 &add_service_data_1),
3120 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3121 &service_add_1, NULL, NULL),
3123 TEST_CASE_BREDRLE("Gatt Server - Add Multiple Services Successful",
3124 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3125 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3126 ACTION_SUCCESS(gatt_server_add_service_action,
3127 &add_service_data_1),
3128 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3129 &service_add_1, NULL, NULL),
3130 ACTION_SUCCESS(gatt_server_add_service_action,
3131 &add_service_data_2),
3132 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3133 &service_add_2, NULL, NULL),
3134 ACTION_SUCCESS(gatt_server_add_service_action,
3135 &add_service_data_3),
3136 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3137 &service_add_3, NULL, NULL),
3139 TEST_CASE_BREDRLE("Gatt Server - Add Service with 0 handles",
3140 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3141 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3142 ACTION_FAIL(gatt_server_add_service_action,
3143 &add_bad_service_data_1),
3144 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_FAILURE, APP1_ID,
3145 &service_add_1, NULL, NULL),
3147 TEST_CASE_BREDRLE("Gatt Server - Add Secondary Service",
3148 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3149 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3150 ACTION_SUCCESS(gatt_server_add_service_action,
3151 &add_sec_service_data_1),
3152 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3153 &included_1, NULL, NULL),
3155 TEST_CASE_BREDRLE("Gatt Server - Add Included Service Successful",
3156 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3157 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3158 ACTION_SUCCESS(gatt_server_add_service_action,
3159 &add_service_data_4),
3160 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3161 &service_add_1, NULL,
3163 ACTION_SUCCESS(gatt_server_add_service_action,
3164 &add_service_data_4),
3165 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3166 &service_add_1, NULL,
3168 ACTION_SUCCESS(gatt_server_add_inc_service_action,
3169 &add_inc_service_data_1),
3170 CALLBACK_GATTS_INC_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3171 &srvc1_handle, NULL),
3173 TEST_CASE_BREDRLE("Gatt Server - Add Inc. Service with wrong handle",
3174 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3175 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3176 ACTION_SUCCESS(gatt_server_add_service_action,
3177 &add_service_data_4),
3178 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3179 &service_add_1, NULL,
3181 ACTION_SUCCESS(gatt_server_add_service_action,
3182 &add_service_data_4),
3183 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3184 &service_add_1, NULL, NULL),
3185 ACTION_FAIL(gatt_server_add_inc_service_action,
3186 &add_bad_inc_service_data_1),
3187 CALLBACK_GATTS_INC_SERVICE_ADDED(GATT_STATUS_FAILURE, APP1_ID,
3188 &srvc1_handle, NULL),
3190 TEST_CASE_BREDRLE("Gatt Server - Add Single Characteristic Successful",
3191 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3192 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3193 ACTION_SUCCESS(gatt_server_add_service_action,
3194 &add_service_data_5),
3195 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3196 &service_add_1, NULL,
3198 ACTION_SUCCESS(gatt_server_add_char_action, &add_char_data_1),
3199 CALLBACK_GATTS_CHARACTERISTIC_ADDED(GATT_STATUS_SUCCESS,
3200 APP1_ID, &app1_uuid,
3201 &srvc1_handle, NULL,
3204 TEST_CASE_BREDRLE("Gatt Server - Add Char. wrong service handle",
3205 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3206 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3207 ACTION_SUCCESS(gatt_server_add_service_action,
3208 &add_service_data_5),
3209 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3210 &service_add_1, NULL,
3212 ACTION_FAIL(gatt_server_add_char_action, &add_bad_char_data_1),
3213 CALLBACK_GATTS_CHARACTERISTIC_ADDED(GATT_STATUS_FAILURE,
3214 APP1_ID, &app1_uuid,
3217 TEST_CASE_BREDRLE("Gatt Server - Add Single Descriptor Successful",
3218 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3219 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3220 ACTION_SUCCESS(gatt_server_add_service_action,
3221 &add_service_data_6),
3222 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3223 &service_add_1, NULL,
3225 ACTION_SUCCESS(gatt_server_add_char_action, &add_char_data_1),
3226 CALLBACK_GATTS_CHARACTERISTIC_ADDED(GATT_STATUS_SUCCESS,
3227 APP1_ID, &app1_uuid,
3228 &srvc1_handle, NULL,
3230 ACTION_SUCCESS(gatt_server_add_desc_action, &add_desc_data_1),
3231 CALLBACK_GATTS_DESCRIPTOR_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3232 &app2_uuid, &srvc1_handle,
3235 TEST_CASE_BREDRLE("Gatt Server - Add Desc. wrong service handle",
3236 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3237 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3238 ACTION_SUCCESS(gatt_server_add_service_action,
3239 &add_service_data_6),
3240 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3241 &service_add_1, NULL,
3243 ACTION_SUCCESS(gatt_server_add_char_action, &add_char_data_1),
3244 CALLBACK_GATTS_CHARACTERISTIC_ADDED(GATT_STATUS_SUCCESS,
3245 APP1_ID, &app1_uuid,
3246 &srvc1_handle, NULL,
3248 ACTION_FAIL(gatt_server_add_desc_action, &add_bad_desc_data_1),
3249 CALLBACK_GATTS_DESCRIPTOR_ADDED(GATT_STATUS_FAILURE, APP1_ID,
3250 &app2_uuid, NULL, NULL, NULL),
3252 TEST_CASE_BREDRLE("Gatt Server - Add Desc. wrong app ID",
3253 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3254 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3255 ACTION_SUCCESS(gatt_server_add_service_action,
3256 &add_service_data_6),
3257 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3258 &service_add_1, NULL,
3260 ACTION_SUCCESS(gatt_server_add_char_action, &add_char_data_1),
3261 CALLBACK_GATTS_CHARACTERISTIC_ADDED(GATT_STATUS_SUCCESS,
3262 APP1_ID, &app1_uuid,
3263 &srvc1_handle, NULL,
3265 ACTION_FAIL(gatt_server_add_desc_action, &add_bad_desc_data_2),
3266 CALLBACK_GATTS_DESCRIPTOR_ADDED(GATT_STATUS_FAILURE, APP2_ID,
3267 &app2_uuid, NULL, NULL, NULL),
3269 TEST_CASE_BREDRLE("Gatt Server - Start Service Successful BREDRLE",
3270 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3271 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3272 ACTION_SUCCESS(gatt_server_add_service_action,
3273 &add_service_data_1),
3274 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3275 &service_add_1, NULL,
3277 ACTION_SUCCESS(gatt_server_start_srvc_action,
3278 &start_srvc_data_1),
3279 CALLBACK_GATTS_SERVICE_STARTED(GATT_STATUS_SUCCESS, APP1_ID,
3282 TEST_CASE_BREDRLE("Gatt Server - Start Service Successful LE",
3283 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3284 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3285 ACTION_SUCCESS(gatt_server_add_service_action,
3286 &add_service_data_1),
3287 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3288 &service_add_1, NULL,
3290 ACTION_SUCCESS(gatt_server_start_srvc_action,
3291 &start_srvc_data_2),
3292 CALLBACK_GATTS_SERVICE_STARTED(GATT_STATUS_SUCCESS, APP1_ID,
3295 TEST_CASE_BREDRLE("Gatt Server - Start Service wrong service handle",
3296 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3297 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3298 ACTION_SUCCESS(gatt_server_add_service_action,
3299 &add_service_data_1),
3300 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3301 &service_add_1, NULL, NULL),
3302 ACTION_FAIL(gatt_server_start_srvc_action,
3303 &start_bad_srvc_data_1),
3304 CALLBACK_GATTS_SERVICE_STARTED(GATT_STATUS_FAILURE, APP1_ID,
3307 TEST_CASE_BREDRLE("Gatt Server - Start Service wrong server transport",
3308 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3309 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3310 ACTION_SUCCESS(gatt_server_add_service_action,
3311 &add_service_data_1),
3312 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3313 &service_add_1, NULL,
3315 ACTION_FAIL(gatt_server_start_srvc_action,
3316 &start_bad_srvc_data_2),
3317 CALLBACK_GATTS_SERVICE_STARTED(GATT_STATUS_FAILURE, APP1_ID,
3320 TEST_CASE_BREDRLE("Gatt Server - Stop Service Successful",
3321 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3322 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3323 ACTION_SUCCESS(gatt_server_add_service_action,
3324 &add_service_data_1),
3325 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3326 &service_add_1, NULL,
3328 ACTION_SUCCESS(gatt_server_start_srvc_action,
3329 &start_srvc_data_1),
3330 CALLBACK_GATTS_SERVICE_STARTED(GATT_STATUS_SUCCESS, APP1_ID,
3332 ACTION_SUCCESS(gatt_server_stop_srvc_action, &stop_srvc_data_1),
3333 CALLBACK_GATTS_SERVICE_STOPPED(GATT_STATUS_SUCCESS, APP1_ID,
3336 TEST_CASE_BREDRLE("Gatt Server - Stop Service wrong service handle",
3337 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3338 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3339 ACTION_SUCCESS(gatt_server_add_service_action,
3340 &add_service_data_1),
3341 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3342 &service_add_1, NULL,
3344 ACTION_SUCCESS(gatt_server_start_srvc_action,
3345 &start_srvc_data_1),
3346 CALLBACK_GATTS_SERVICE_STARTED(GATT_STATUS_SUCCESS, APP1_ID,
3348 ACTION_FAIL(gatt_server_stop_srvc_action,
3349 &stop_bad_srvc_data_1),
3350 CALLBACK_GATTS_SERVICE_STOPPED(GATT_STATUS_FAILURE, APP1_ID,
3353 TEST_CASE_BREDRLE("Gatt Server - Delete Service Successful",
3354 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3355 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3356 ACTION_SUCCESS(gatt_server_add_service_action,
3357 &add_service_data_1),
3358 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3359 &service_add_1, NULL,
3361 ACTION_SUCCESS(gatt_server_delete_srvc_action,
3362 &delete_srvc_data_1),
3363 CALLBACK_GATTS_SERVICE_DELETED(GATT_STATUS_SUCCESS, APP1_ID,
3366 TEST_CASE_BREDRLE("Gatt Server - Delete Service wrong handle",
3367 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3368 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3369 ACTION_SUCCESS(gatt_server_add_service_action,
3370 &add_service_data_1),
3371 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3372 &service_add_1, NULL,
3374 ACTION_FAIL(gatt_server_delete_srvc_action,
3375 &delete_bad_srvc_data_1),
3376 CALLBACK_GATTS_SERVICE_DELETED(GATT_STATUS_FAILURE, APP1_ID,
3379 TEST_CASE_BREDRLE("Gatt Server - Send Indication",
3380 ACTION_SUCCESS(init_pdus, send_indication_1),
3381 ACTION_SUCCESS(bluetooth_enable_action, NULL),
3382 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
3383 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
3384 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
3385 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
3386 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3387 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3388 ACTION_SUCCESS(bt_start_discovery_action, NULL),
3389 CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
3390 BT_DISCOVERY_STARTED),
3391 CALLBACK_DEVICE_FOUND(prop_emu_remotes_default_le_set, 2),
3392 ACTION_SUCCESS(bt_cancel_discovery_action, NULL),
3393 ACTION_SUCCESS(gatt_server_connect_action, &app1_conn_req),
3394 CALLBACK_GATTS_CONNECTION(GATT_SERVER_CONNECTED,
3395 prop_emu_remotes_default_set,
3397 ACTION_SUCCESS(gatt_server_send_indication_action,
3398 &send_indication_data_1),
3399 CALLBACK(CB_EMU_VALUE_INDICATION),
3400 CALLBACK_GATTS_NOTIF_CONF(CONN1_ID, GATT_STATUS_SUCCESS),
3401 ACTION_SUCCESS(bluetooth_disable_action, NULL),
3402 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
3404 TEST_CASE_BREDRLE("Gatt Server - Send Notification",
3405 ACTION_SUCCESS(init_pdus, send_notification_1),
3406 ACTION_SUCCESS(bluetooth_enable_action, NULL),
3407 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
3408 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
3409 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
3410 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
3411 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3412 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3413 ACTION_SUCCESS(bt_start_discovery_action, NULL),
3414 CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
3415 BT_DISCOVERY_STARTED),
3416 CALLBACK_DEVICE_FOUND(prop_emu_remotes_default_le_set, 2),
3417 ACTION_SUCCESS(bt_cancel_discovery_action, NULL),
3418 ACTION_SUCCESS(gatt_server_connect_action, &app1_conn_req),
3419 CALLBACK_GATTS_CONNECTION(GATT_SERVER_CONNECTED,
3420 prop_emu_remotes_default_set,
3422 ACTION_SUCCESS(gatt_server_send_indication_action,
3423 &send_indication_data_2),
3424 CALLBACK_GATTS_NOTIF_CONF(CONN1_ID, GATT_STATUS_SUCCESS),
3425 CALLBACK(CB_EMU_VALUE_NOTIFICATION),
3426 ACTION_SUCCESS(bluetooth_disable_action, NULL),
3427 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
3429 TEST_CASE_BREDRLE("Gatt Server - Send Notification, wrong conn id",
3430 ACTION_SUCCESS(bluetooth_enable_action, NULL),
3431 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
3432 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
3433 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
3434 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
3435 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3436 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3437 ACTION_SUCCESS(bt_start_discovery_action, NULL),
3438 CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
3439 BT_DISCOVERY_STARTED),
3440 CALLBACK_DEVICE_FOUND(prop_emu_remotes_default_le_set, 2),
3441 ACTION_SUCCESS(bt_cancel_discovery_action, NULL),
3442 ACTION_SUCCESS(gatt_server_connect_action, &app1_conn_req),
3443 CALLBACK_GATTS_CONNECTION(GATT_SERVER_CONNECTED,
3444 prop_emu_remotes_default_set,
3446 ACTION_FAIL(gatt_server_send_indication_action,
3447 &send_bad_indication_data_1),
3448 ACTION_SUCCESS(bluetooth_disable_action, NULL),
3449 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
3451 TEST_CASE_BREDRLE("Gatt Server - Send response to read char request",
3452 ACTION_SUCCESS(bluetooth_enable_action, NULL),
3453 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
3454 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
3455 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
3456 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
3457 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3458 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3459 ACTION_SUCCESS(gatt_server_add_service_action,
3460 &add_service_data_5),
3461 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3462 &service_add_1, NULL,
3464 ACTION_SUCCESS(gatt_server_add_char_action, &add_char_data_1),
3465 CALLBACK_GATTS_CHARACTERISTIC_ADDED(GATT_STATUS_SUCCESS,
3466 APP1_ID, &app1_uuid,
3467 &srvc1_handle, NULL,
3469 ACTION_SUCCESS(gatt_server_start_srvc_action,
3470 &start_srvc_data_2),
3471 CALLBACK_GATTS_SERVICE_STARTED(GATT_STATUS_SUCCESS, APP1_ID,
3473 ACTION_SUCCESS(bt_start_discovery_action, NULL),
3474 CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
3475 BT_DISCOVERY_STARTED),
3476 CALLBACK_DEVICE_FOUND(prop_emu_remotes_default_le_set, 2),
3477 ACTION_SUCCESS(bt_cancel_discovery_action, NULL),
3478 ACTION_SUCCESS(gatt_server_connect_action, &app1_conn_req),
3479 CALLBACK_GATTS_CONNECTION(GATT_SERVER_CONNECTED,
3480 prop_emu_remotes_default_set,
3482 PROCESS_DATA(GATT_STATUS_SUCCESS,
3483 gatt_remote_send_raw_pdu_action,
3484 &att_read_req_op_v, &char1_handle_v, NULL),
3485 CALLBACK_GATTS_REQUEST_READ(CONN1_ID, TRANS1_ID,
3486 prop_emu_remotes_default_set,
3487 &char1_handle, 0, false),
3488 ACTION_SUCCESS(gatt_server_send_response_action,
3490 CALLBACK(CB_EMU_READ_RESPONSE),
3491 ACTION_SUCCESS(bluetooth_disable_action, NULL),
3492 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
3494 TEST_CASE_BREDRLE("Gatt Server - Send response to write char request",
3495 ACTION_SUCCESS(bluetooth_enable_action, NULL),
3496 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
3497 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
3498 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
3499 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
3500 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3501 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3502 ACTION_SUCCESS(gatt_server_add_service_action,
3503 &add_service_data_5),
3504 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3505 &service_add_1, NULL,
3507 ACTION_SUCCESS(gatt_server_add_char_action, &add_char_data_2),
3508 CALLBACK_GATTS_CHARACTERISTIC_ADDED(GATT_STATUS_SUCCESS,
3509 APP1_ID, &app1_uuid,
3510 &srvc1_handle, NULL,
3512 ACTION_SUCCESS(gatt_server_start_srvc_action,
3513 &start_srvc_data_2),
3514 CALLBACK_GATTS_SERVICE_STARTED(GATT_STATUS_SUCCESS, APP1_ID,
3516 ACTION_SUCCESS(bt_start_discovery_action, NULL),
3517 CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
3518 BT_DISCOVERY_STARTED),
3519 CALLBACK_DEVICE_FOUND(prop_emu_remotes_default_le_set, 2),
3520 ACTION_SUCCESS(bt_cancel_discovery_action, NULL),
3521 ACTION_SUCCESS(gatt_server_connect_action, &app1_conn_req),
3522 CALLBACK_GATTS_CONNECTION(GATT_SERVER_CONNECTED,
3523 prop_emu_remotes_default_set,
3525 PROCESS_DATA(GATT_STATUS_SUCCESS,
3526 gatt_remote_send_raw_pdu_action,
3527 &att_write_req_op_v, &char1_handle_v,
3528 &att_write_req_value_1_v),
3529 CALLBACK_GATTS_REQUEST_WRITE(CONN1_ID, TRANS1_ID,
3530 prop_emu_remotes_default_set,
3532 sizeof(att_write_req_value_1),
3534 att_write_req_value_1),
3535 ACTION_SUCCESS(gatt_server_send_response_action,
3537 CALLBACK(CB_EMU_WRITE_RESPONSE),
3538 ACTION_SUCCESS(bluetooth_disable_action, NULL),
3539 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
3541 TEST_CASE_BREDRLE("Gatt Server - Find By Type - Attribute not found",
3542 ACTION_SUCCESS(bluetooth_enable_action, NULL),
3543 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
3544 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
3545 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
3546 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
3547 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3548 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3549 ACTION_SUCCESS(gatt_server_add_service_action,
3550 &add_service_data_5),
3551 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3552 &service_add_1, NULL,
3554 ACTION_SUCCESS(gatt_server_add_char_action, &add_char_data_2),
3555 CALLBACK_GATTS_CHARACTERISTIC_ADDED(GATT_STATUS_SUCCESS,
3556 APP1_ID, &app1_uuid,
3557 &srvc1_handle, NULL,
3559 ACTION_SUCCESS(gatt_server_start_srvc_action,
3560 &start_srvc_data_2),
3561 CALLBACK_GATTS_SERVICE_STARTED(GATT_STATUS_SUCCESS, APP1_ID,
3563 ACTION_SUCCESS(bt_start_discovery_action, NULL),
3564 CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
3565 BT_DISCOVERY_STARTED),
3566 CALLBACK_DEVICE_FOUND(prop_emu_remotes_default_le_set, 2),
3567 ACTION_SUCCESS(bt_cancel_discovery_action, NULL),
3568 ACTION_SUCCESS(gatt_server_connect_action, &app1_conn_req),
3569 CALLBACK_GATTS_CONNECTION(GATT_SERVER_CONNECTED,
3570 prop_emu_remotes_default_set,
3572 PROCESS_DATA(GATT_STATUS_SUCCESS,
3573 gatt_remote_send_raw_pdu_action,
3574 &att_find_by_type_req_op_v,
3577 CALLBACK_ERROR(CB_EMU_ATT_ERROR, 0x0a),
3578 ACTION_SUCCESS(bluetooth_disable_action, NULL),
3579 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
3581 /* This tests embeded ccc */
3582 TEST_CASE_BREDRLE("Gatt Server - Srvc change write req. success",
3583 ACTION_SUCCESS(bluetooth_enable_action, NULL),
3584 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
3585 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
3586 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
3587 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
3588 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3589 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3590 ACTION_SUCCESS(bt_start_discovery_action, NULL),
3591 CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
3592 BT_DISCOVERY_STARTED),
3593 CALLBACK_DEVICE_FOUND(prop_emu_remotes_default_le_set, 2),
3594 ACTION_SUCCESS(bt_cancel_discovery_action, NULL),
3595 ACTION_SUCCESS(gatt_server_connect_action, &app1_conn_req),
3596 CALLBACK_GATTS_CONNECTION(GATT_SERVER_CONNECTED,
3597 prop_emu_remotes_default_set,
3599 /* For CCC we need to be bonded */
3600 ACTION_SUCCESS(bt_create_bond_action,
3601 &prop_test_remote_ble_bdaddr_req),
3602 CALLBACK_BOND_STATE(BT_BOND_STATE_BONDED,
3603 &prop_emu_remotes_default_set[0], 1),
3604 /* Write and receive confirmation */
3605 PROCESS_DATA(GATT_STATUS_SUCCESS,
3606 gatt_remote_send_raw_pdu_action,
3607 &att_write_req_op_v, &svc_change_ccc_handle_v,
3608 &svc_change_ccc_value_v),
3609 CALLBACK(CB_EMU_WRITE_RESPONSE),
3611 ACTION_SUCCESS(bluetooth_disable_action, NULL),
3612 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
3614 TEST_CASE_BREDRLE("Gatt Server - Send error resp to write char request",
3615 ACTION_SUCCESS(bluetooth_enable_action, NULL),
3616 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
3617 ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
3618 ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
3619 ACTION_SUCCESS(emu_set_connect_cb_action, gatt_conn_cb),
3620 ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
3621 CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
3622 ACTION_SUCCESS(gatt_server_add_service_action,
3623 &add_service_data_5),
3624 CALLBACK_GATTS_SERVICE_ADDED(GATT_STATUS_SUCCESS, APP1_ID,
3625 &service_add_1, NULL,
3627 ACTION_SUCCESS(gatt_server_add_char_action, &add_char_data_2),
3628 CALLBACK_GATTS_CHARACTERISTIC_ADDED(GATT_STATUS_SUCCESS,
3629 APP1_ID, &app1_uuid,
3630 &srvc1_handle, NULL,
3632 ACTION_SUCCESS(gatt_server_start_srvc_action,
3633 &start_srvc_data_2),
3634 CALLBACK_GATTS_SERVICE_STARTED(GATT_STATUS_SUCCESS, APP1_ID,
3636 ACTION_SUCCESS(bt_start_discovery_action, NULL),
3637 CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
3638 BT_DISCOVERY_STARTED),
3639 CALLBACK_DEVICE_FOUND(prop_emu_remotes_default_le_set, 2),
3640 ACTION_SUCCESS(bt_cancel_discovery_action, NULL),
3641 ACTION_SUCCESS(gatt_server_connect_action, &app1_conn_req),
3642 CALLBACK_GATTS_CONNECTION(GATT_SERVER_CONNECTED,
3643 prop_emu_remotes_default_set,
3645 PROCESS_DATA(GATT_STATUS_SUCCESS,
3646 gatt_remote_send_raw_pdu_action,
3647 &att_write_req_op_v, &char1_handle_v,
3648 &att_write_req_value_1_v),
3649 CALLBACK_GATTS_REQUEST_WRITE(CONN1_ID, TRANS1_ID,
3650 prop_emu_remotes_default_set,
3652 sizeof(att_write_req_value_1),
3654 att_write_req_value_1),
3655 ACTION_SUCCESS(gatt_server_send_response_action,
3656 &send_resp_data_2_error),
3657 CALLBACK_ERROR(CB_EMU_ATT_ERROR, GATT_ERR_INVAL_ATTR_VALUE_LEN),
3658 ACTION_SUCCESS(bluetooth_disable_action, NULL),
3659 CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
3663 struct queue *get_gatt_tests(void)
3669 for (; i < sizeof(test_cases) / sizeof(test_cases[0]); ++i)
3670 queue_push_tail(list, &test_cases[i]);
3675 void remove_gatt_tests(void)
3677 queue_destroy(list, NULL);