1 /* bttester.h - Bluetooth tester headers */
2 
3 /*
4  * Copyright (c) 2015-2016 Intel Corporation
5  * Copyright (c) 2022 Codecoup
6  *
7  * SPDX-License-Identifier: Apache-2.0
8  */
9 
10 #ifndef TESTS_BLUETOOTH_TESTER_SRC_BTP_
11 #define TESTS_BLUETOOTH_TESTER_SRC_BTP_
12 
13 #include <stdint.h>
14 
15 #include "bttester.h"
16 #include "btp_core.h"
17 #include "btp_gap.h"
18 #include "btp_gatt.h"
19 #include "btp_l2cap.h"
20 #include "btp_mesh.h"
21 #include "btp_vcs.h"
22 #include "btp_aics.h"
23 #include "btp_vocs.h"
24 #include "btp_ias.h"
25 #include "btp_pacs.h"
26 #include "btp_ascs.h"
27 #include "btp_bap.h"
28 #include "btp_has.h"
29 #include "btp_csis.h"
30 #include "btp_micp.h"
31 #include "btp_mics.h"
32 #include "btp_ccp.h"
33 #include "btp_vcp.h"
34 #include "btp_cas.h"
35 #include "btp_mcp.h"
36 #include "btp_mcs.h"
37 #include "btp_hap.h"
38 #include "btp_csip.h"
39 #include "btp_cap.h"
40 #include "btp_tbs.h"
41 #include "btp_tmap.h"
42 #include "btp_ots.h"
43 #include "btp_pbp.h"
44 
45 #define BTP_MTU 1024
46 #define BTP_DATA_MAX_SIZE (BTP_MTU - sizeof(struct btp_hdr))
47 
48 #define BTP_BR_ADDRESS_TYPE 0xe0
49 
50 #define BTP_INDEX_NONE		0xff
51 #define BTP_INDEX		0x00
52 
53 #define BTP_SERVICE_ID_CORE     0x00
54 #define BTP_SERVICE_ID_GAP      0x01
55 #define BTP_SERVICE_ID_GATT     0x02
56 #define BTP_SERVICE_ID_L2CAP    0x03
57 #define BTP_SERVICE_ID_MESH     0x04
58 #define BTP_SERVICE_ID_MESH_MDL 0x05
59 #define BTP_SERVICE_GATT_CLIENT 0x06
60 #define BTP_SERVICE_GATT_SERVER 0x07
61 #define BTP_SERVICE_ID_VCS      0x08
62 #define BTP_SERVICE_ID_IAS      0x09
63 #define BTP_SERVICE_ID_AICS     0x0a
64 #define BTP_SERVICE_ID_VOCS     0x0b
65 #define BTP_SERVICE_ID_PACS     0x0c
66 #define BTP_SERVICE_ID_ASCS     0x0d
67 #define BTP_SERVICE_ID_BAP      0x0e
68 #define BTP_SERVICE_ID_HAS      0x0f
69 #define BTP_SERVICE_ID_MICP     0x10
70 #define BTP_SERVICE_ID_CSIS     0x11
71 #define BTP_SERVICE_ID_MICS     0x12
72 #define BTP_SERVICE_ID_CCP      0x13
73 #define BTP_SERVICE_ID_VCP      0x14
74 #define BTP_SERVICE_ID_CAS      0x15
75 #define BTP_SERVICE_ID_MCP      0x16
76 #define BTP_SERVICE_ID_GMCS     0x17
77 #define BTP_SERVICE_ID_HAP      0x18
78 #define BTP_SERVICE_ID_CSIP     0x19
79 #define BTP_SERVICE_ID_CAP      0x1a
80 #define BTP_SERVICE_ID_TBS      0x1b
81 #define BTP_SERVICE_ID_TMAP     0x1c
82 #define BTP_SERVICE_ID_OTS      0x1d
83 #define BTP_SERVICE_ID_PBP      0x1e
84 
85 #define BTP_SERVICE_ID_MAX	BTP_SERVICE_ID_PBP
86 
87 #define BTP_STATUS_SUCCESS	0x00
88 #define BTP_STATUS_FAILED	0x01
89 #define BTP_STATUS_UNKNOWN_CMD	0x02
90 #define BTP_STATUS_NOT_READY	0x03
91 
92 #define BTP_STATUS_VAL(err) (err) ? BTP_STATUS_FAILED : BTP_STATUS_SUCCESS
93 
94 #define BTP_EVENT_OPCODE 0x80
95 
96 /* TODO indicate delay response, should be removed when all commands are
97  * converted to cmd+status+ev pattern
98  */
99 #define BTP_STATUS_DELAY_REPLY	0xFF
100 
101 struct btp_hdr {
102 	uint8_t  service;
103 	uint8_t  opcode;
104 	uint8_t  index;
105 	uint16_t len;
106 	uint8_t  data[];
107 } __packed;
108 
109 #define BTP_STATUS		0x00
110 struct btp_status {
111 	uint8_t code;
112 } __packed;
113 
114 #endif /* TESTS_BLUETOOTH_TESTER_SRC_BTP_ */
115