Mbed OS Reference
Loading...
Searching...
No Matches
common/BLERoles.h
1/* mbed Microcontroller Library
2 * Copyright (c) 2006-2020 ARM Limited
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19#ifndef MBED_BLE_ROLES_H__
20#define MBED_BLE_ROLES_H__
21
22/* we provide default values if no configuration is present (e.g. in unittests) */
23#if !defined(BLE_ROLE_OBSERVER)
24#define BLE_ROLE_OBSERVER 1
25#endif
26#if !defined(BLE_ROLE_BROADCASTER)
27#define BLE_ROLE_BROADCASTER 1
28#endif
29#if !defined(BLE_ROLE_CENTRAL)
30#define BLE_ROLE_CENTRAL 1
31#endif
32#if !defined(BLE_ROLE_PERIPHERAL)
33#define BLE_ROLE_PERIPHERAL 1
34#endif
35#if !defined(BLE_FEATURE_GATT_CLIENT)
36#define BLE_FEATURE_GATT_CLIENT 1
37#endif
38#if !defined(BLE_FEATURE_GATT_SERVER)
39#define BLE_FEATURE_GATT_SERVER 1
40#endif
41#if !defined(BLE_FEATURE_SECURITY)
42#define BLE_FEATURE_SECURITY 1
43#endif
44#if !defined(BLE_FEATURE_SECURE_CONNECTIONS)
45#define BLE_FEATURE_SECURE_CONNECTIONS 1
46#endif
47#if !defined(BLE_FEATURE_SIGNING)
48#define BLE_FEATURE_SIGNING 1
49#endif
50#if !defined(BLE_FEATURE_WHITELIST)
51#define BLE_FEATURE_WHITELIST 1
52#endif
53#if !defined(BLE_FEATURE_PRIVACY)
54#define BLE_FEATURE_PRIVACY 1
55#endif
56#if !defined(BLE_FEATURE_PHY_MANAGEMENT)
57#define BLE_FEATURE_PHY_MANAGEMENT 1
58#endif
59#if !defined(BLE_FEATURE_EXTENDED_ADVERTISING)
60#define BLE_FEATURE_EXTENDED_ADVERTISING 1
61#endif
62#if !defined(BLE_FEATURE_PERIODIC_ADVERTISING)
63#define BLE_FEATURE_PERIODIC_ADVERTISING 1
64#endif
65
66#if !(BLE_ROLE_OBSERVER) && !(BLE_ROLE_BROADCASTER)
67 #error "BLE requires at least one role 'BROADCASTER' or 'OBSERVER' to be enabled"
68#endif
69
70#if (BLE_ROLE_PERIPHERAL) || (BLE_ROLE_CENTRAL)
71 #define BLE_FEATURE_CONNECTABLE 1
72#endif
73
74#if (BLE_FEATURE_GATT_CLIENT) || (BLE_FEATURE_GATT_SERVER)
75 #define BLE_FEATURE_ATT 1
76#endif
77
78#if BLE_ROLE_PERIPHERAL
79 #if !(BLE_ROLE_BROADCASTER)
80 #error "BLE role 'PERIPHERAL' depends on role 'BROADCASTER'"
81 #endif
82#endif // BLE_ROLE_PERIPHERAL
83
84#if BLE_ROLE_CENTRAL
85 #if !(BLE_ROLE_OBSERVER)
86 #error "BLE role 'CENTRAL' depends on role 'OBSERVER'"
87 #endif
88#endif // BLE_ROLE_CENTRAL
89
90#if BLE_FEATURE_SECURITY
91 #if !(BLE_ROLE_PERIPHERAL) && !(BLE_ROLE_CENTRAL)
92 #error "BLE feature 'SECURITY' requires 'PERIPHERAL' or 'CENTRAL' role"
93 #endif
94#endif // BLE_FEATURE_SECURITY
95
96#if BLE_FEATURE_SECURE_CONNECTIONS
97 #if !(BLE_FEATURE_SECURITY)
98 #error "BLE feature 'SECURE CONNECTIONS' requires the 'SECURITY' feature"
99 #endif
100#endif // BLE_FEATURE_SECURE_CONNECTIONS
101
102#if BLE_FEATURE_SIGNING
103 #if !(BLE_FEATURE_SECURITY)
104 #error "BLE feature 'SIGNING' requires the 'SECURITY' feature"
105 #endif
106#endif // BLE_FEATURE_SIGNING
107
108#if BLE_FEATURE_WHITELIST
109 #if !(BLE_FEATURE_SECURITY)
110 #error "BLE feature 'WHITELIST' requires the 'SECURITY' feature"
111 #endif
112#endif // BLE_FEATURE_WHITELIST
113
114#if BLE_FEATURE_PRIVACY
115 #if !(BLE_FEATURE_SECURITY)
116 #error "BLE feature 'PRIVACY' requires the 'SECURITY' feature"
117 #endif
118#endif // BLE_FEATURE_PRIVACY
119
120#if BLE_FEATURE_PERIODIC_ADVERTISING
121 #if !(BLE_FEATURE_EXTENDED_ADVERTISING)
122 #error "BLE feature 'PERIODIC ADVERTISING' requires the 'EXTENDED ADVERTISING' feature"
123 #endif
124#endif // BLE_FEATURE_PERIODIC_ADVERTISING
125
126#if BLE_FEATURE_GATT_CLIENT
127 #if !(BLE_FEATURE_CONNECTABLE)
128 #error "BLE feature 'GATT CLIENT' requires 'PERIPHERAL' or 'CENTRAL' role"
129 #endif
130#endif // BLE_FEATURE_GATT_CLIENT
131
132#if BLE_FEATURE_GATT_SERVER
133 #if !(BLE_FEATURE_CONNECTABLE)
134 #error "BLE feature 'GATT SERVER' requires 'PERIPHERAL' or 'CENTRAL' role"
135 #endif
136#endif // BLE_FEATURE_GATT_SERVER
137
138#endif // MBED_BLE_ROLES_H__