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 #include <zephyr/sys/util.h>
11 #include <zephyr/bluetooth/addr.h>
12 
13 #include "bttester.h"
14 #include "btp_core.h"
15 #include "btp_gap.h"
16 #include "btp_gatt.h"
17 #include "btp_l2cap.h"
18 #include "btp_mesh.h"
19 #include "btp_vcs.h"
20 #include "btp_aics.h"
21 #include "btp_vocs.h"
22 #include "btp_ias.h"
23 #include "btp_pacs.h"
24 #include "btp_ascs.h"
25 #include "btp_bap.h"
26 #include "btp_has.h"
27 #include "btp_csis.h"
28 #include "btp_micp.h"
29 #include "btp_mics.h"
30 #include "btp_ccp.h"
31 #include "btp_vcp.h"
32 #include "btp_cas.h"
33 #include "btp_mcp.h"
34 #include "btp_mcs.h"
35 #include "btp_hap.h"
36 #include "btp_csip.h"
37 #include "btp_cap.h"
38 
39 #define BTP_MTU 1024
40 #define BTP_DATA_MAX_SIZE (BTP_MTU - sizeof(struct btp_hdr))
41 
42 #define BTP_INDEX_NONE		0xff
43 #define BTP_INDEX		0x00
44 
45 #define BTP_SERVICE_ID_CORE	0
46 #define BTP_SERVICE_ID_GAP	1
47 #define BTP_SERVICE_ID_GATT	2
48 #define BTP_SERVICE_ID_L2CAP	3
49 #define BTP_SERVICE_ID_MESH	4
50 #define BTP_SERVICE_ID_MESH_MDL	5
51 #define BTP_SERVICE_GATT_CLIENT	6
52 #define BTP_SERVICE_GATT_SERVER	7
53 #define BTP_SERVICE_ID_VCS	8
54 #define BTP_SERVICE_ID_IAS	9
55 #define BTP_SERVICE_ID_AICS	10
56 #define BTP_SERVICE_ID_VOCS	11
57 #define BTP_SERVICE_ID_PACS	12
58 #define BTP_SERVICE_ID_ASCS	13
59 #define BTP_SERVICE_ID_BAP	14
60 #define BTP_SERVICE_ID_HAS	15
61 #define BTP_SERVICE_ID_MICP	16
62 #define BTP_SERVICE_ID_CSIS	17
63 #define BTP_SERVICE_ID_MICS	18
64 #define BTP_SERVICE_ID_CCP	19
65 #define BTP_SERVICE_ID_VCP	20
66 #define BTP_SERVICE_ID_CAS	21
67 #define BTP_SERVICE_ID_MCP	22
68 #define BTP_SERVICE_ID_GMCS	23
69 #define BTP_SERVICE_ID_HAP	24
70 #define BTP_SERVICE_ID_CSIP	25
71 #define BTP_SERVICE_ID_CAP	26
72 
73 #define BTP_SERVICE_ID_MAX	BTP_SERVICE_ID_CAP
74 
75 #define BTP_STATUS_SUCCESS	0x00
76 #define BTP_STATUS_FAILED	0x01
77 #define BTP_STATUS_UNKNOWN_CMD	0x02
78 #define BTP_STATUS_NOT_READY	0x03
79 
80 #define BTP_STATUS_VAL(err) (err) ? BTP_STATUS_FAILED : BTP_STATUS_SUCCESS
81 
82 /* TODO indicate delay response, should be removed when all commands are
83  * converted to cmd+status+ev pattern
84  */
85 #define BTP_STATUS_DELAY_REPLY	0xFF
86 
87 struct btp_hdr {
88 	uint8_t  service;
89 	uint8_t  opcode;
90 	uint8_t  index;
91 	uint16_t len;
92 	uint8_t  data[];
93 } __packed;
94 
95 #define BTP_STATUS		0x00
96 struct btp_status {
97 	uint8_t code;
98 } __packed;
99