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 #include "btp_tbs.h"
39 #include "btp_tmap.h"
40 #include "btp_ots.h"
41 #include "btp_pbp.h"
42 
43 #define BTP_MTU 1024
44 #define BTP_DATA_MAX_SIZE (BTP_MTU - sizeof(struct btp_hdr))
45 
46 #define BTP_INDEX_NONE		0xff
47 #define BTP_INDEX		0x00
48 
49 #define BTP_SERVICE_ID_CORE     0x00
50 #define BTP_SERVICE_ID_GAP      0x01
51 #define BTP_SERVICE_ID_GATT     0x02
52 #define BTP_SERVICE_ID_L2CAP    0x03
53 #define BTP_SERVICE_ID_MESH     0x04
54 #define BTP_SERVICE_ID_MESH_MDL 0x05
55 #define BTP_SERVICE_GATT_CLIENT 0x06
56 #define BTP_SERVICE_GATT_SERVER 0x07
57 #define BTP_SERVICE_ID_VCS      0x08
58 #define BTP_SERVICE_ID_IAS      0x09
59 #define BTP_SERVICE_ID_AICS     0x0a
60 #define BTP_SERVICE_ID_VOCS     0x0b
61 #define BTP_SERVICE_ID_PACS     0x0c
62 #define BTP_SERVICE_ID_ASCS     0x0d
63 #define BTP_SERVICE_ID_BAP      0x0e
64 #define BTP_SERVICE_ID_HAS      0x0f
65 #define BTP_SERVICE_ID_MICP     0x10
66 #define BTP_SERVICE_ID_CSIS     0x11
67 #define BTP_SERVICE_ID_MICS     0x12
68 #define BTP_SERVICE_ID_CCP      0x13
69 #define BTP_SERVICE_ID_VCP      0x14
70 #define BTP_SERVICE_ID_CAS      0x15
71 #define BTP_SERVICE_ID_MCP      0x16
72 #define BTP_SERVICE_ID_GMCS     0x17
73 #define BTP_SERVICE_ID_HAP      0x18
74 #define BTP_SERVICE_ID_CSIP     0x19
75 #define BTP_SERVICE_ID_CAP      0x1a
76 #define BTP_SERVICE_ID_TBS      0x1b
77 #define BTP_SERVICE_ID_TMAP     0x1c
78 #define BTP_SERVICE_ID_OTS      0x1d
79 #define BTP_SERVICE_ID_PBP      0x1e
80 
81 #define BTP_SERVICE_ID_MAX	BTP_SERVICE_ID_PBP
82 
83 #define BTP_STATUS_SUCCESS	0x00
84 #define BTP_STATUS_FAILED	0x01
85 #define BTP_STATUS_UNKNOWN_CMD	0x02
86 #define BTP_STATUS_NOT_READY	0x03
87 
88 #define BTP_STATUS_VAL(err) (err) ? BTP_STATUS_FAILED : BTP_STATUS_SUCCESS
89 
90 /* TODO indicate delay response, should be removed when all commands are
91  * converted to cmd+status+ev pattern
92  */
93 #define BTP_STATUS_DELAY_REPLY	0xFF
94 
95 struct btp_hdr {
96 	uint8_t  service;
97 	uint8_t  opcode;
98 	uint8_t  index;
99 	uint16_t len;
100 	uint8_t  data[];
101 } __packed;
102 
103 #define BTP_STATUS		0x00
104 struct btp_status {
105 	uint8_t code;
106 } __packed;
107