mirror of https://github.com/ARMmbed/mbed-os.git
feat(ble): Add preprocessor check to determine enabled roles are valid
A number of BLE roles depend on each other, checking within the target configuration file for a valid configuration is infeasible. Move the validation to the preprocessor and fail to compile if some required roles are not enabled.pull/9790/head
parent
e898d88858
commit
9806f91ecf
|
@ -0,0 +1,44 @@
|
|||
#ifndef MBED_BLE_ROLES_H__
|
||||
#define MBED_BLE_ROLES_H__
|
||||
|
||||
#ifdef BLE_ROLE_PERIPHERAL
|
||||
#ifndef BLE_ROLE_OBSERVER
|
||||
#error "BLE role 'PERIPHERAL' depends on role 'OBSERVER'"
|
||||
#endif // BLE_ROLE_OBSERVER
|
||||
#endif // BLE_ROLE_PERIPHERAL
|
||||
|
||||
#ifdef BLE_ROLE_CENTRAL
|
||||
#ifndef BLE_ROLE_BROADCASTER
|
||||
#error "BLE role 'CENTRAL' depends on role 'BROADCASTER'"
|
||||
#endif // BLE_ROLE_BROADCASTER
|
||||
#endif // BLE_ROLE_CENTRAL
|
||||
|
||||
#ifdef BLE_ROLE_SECURITY
|
||||
#ifndef BLE_ROLE_PERIPHERAL
|
||||
#error "BLE role 'SECURITY' depends on role 'PERIPHERAL'"
|
||||
#endif // BLE_ROLE_PERIPHERAL
|
||||
#endif // BLE_ROLE_SECURITY
|
||||
|
||||
#ifdef BLE_ROLE_PRIVACY
|
||||
#ifndef BLE_ROLE_SECURITY
|
||||
#error "BLE role 'PRIVACY' depends on role 'SECURITY'"
|
||||
#endif // BLE_ROLE_SECURITY
|
||||
#endif // BLE_ROLE_PRIVACY
|
||||
|
||||
#ifdef BLE_ROLE_GATT_CLIENT
|
||||
#ifndef BLE_ROLE_PERIPHERAL
|
||||
#error "BLE role 'GATT CLIENT' depends on role 'PERIPHERAL'"
|
||||
#endif // BLE_ROLE_PERIPHERAL
|
||||
|
||||
#ifndef BLE_ROLE_BROADCASTER
|
||||
#error "BLE role 'GATT CLIENT' depends on role 'BROADCASTER'"
|
||||
#endif // BLE_ROLE_BROADCASTER
|
||||
#endif // BLE_ROLE_GATT_CLIENT
|
||||
|
||||
#ifdef BLE_ROLE_GATT_SERVER
|
||||
#ifndef BLE_ROLE_SECURITY
|
||||
#error "BLE role 'GATT SERVER' depends on role 'SECURITY'"
|
||||
#endif // BLE_ROLE_SECURITY
|
||||
#endif // BLE_ROLE_GATT_SERVER
|
||||
|
||||
#endif // MBED_BLE_ROLES_H__
|
Loading…
Reference in New Issue