mirror of https://github.com/ARMmbed/mbed-os.git
BLE: TARGET_NRF - Avoid redefinition of ASSERT macro.
Instead, the BLE code use the macro ASSERT_TRUEpull/2785/head
parent
2af37a6e1e
commit
6cdfb19304
|
@ -234,7 +234,7 @@ static void btle_handler(ble_evt_t *p_ble_evt)
|
|||
/*! @brief Callback when an error occurs inside the SoftDevice */
|
||||
void assert_nrf_callback(uint16_t line_num, const uint8_t *p_file_name)
|
||||
{
|
||||
ASSERT(false, (void) 0);
|
||||
ASSERT_TRUE(false, (void) 0);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
@ -135,7 +135,7 @@ ble_uuid_t custom_convert_to_nordic_uuid(const UUID &uuid)
|
|||
#define CFG_CUSTOM_UUID_BASE "\x6E\x40\x00\x00\xB5\xA3\xF3\x93\xE0\xA9\xE5\x0E\x24\xDC\xCA\x9E"
|
||||
|
||||
uint8_t uuid_type = custom_add_uuid_base(CFG_CUSTOM_UUID_BASE);
|
||||
ASSERT(uuid_type > 0, ERROR_NOT_FOUND);
|
||||
ASSERT_TRUE(uuid_type > 0, ERROR_NOT_FOUND);
|
||||
|
||||
// We can now safely add the primary service and any characteristics
|
||||
// for our custom service ...
|
||||
|
|
|
@ -125,7 +125,6 @@ static inline void debugger_breakpoint(void)
|
|||
//--------------------------------------------------------------------+
|
||||
// Logical Assert
|
||||
//--------------------------------------------------------------------+
|
||||
#define ASSERT(...) ASSERT_TRUE(__VA_ARGS__)
|
||||
#define ASSERT_TRUE(condition , error) ASSERT_DEFINE( , (condition), error, "%s", "evaluated to false")
|
||||
#define ASSERT_FALSE(condition , error) ASSERT_DEFINE( ,!(condition), error, "%s", "evaluated to true")
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ ble_error_t nRF5xGap::setAdvertisingData(const GapAdvertisingData &advData, cons
|
|||
//}
|
||||
|
||||
/* Send advertising data! */
|
||||
ASSERT(ERROR_NONE ==
|
||||
ASSERT_TRUE(ERROR_NONE ==
|
||||
sd_ble_gap_adv_data_set(advData.getPayload(),
|
||||
advData.getPayloadLen(),
|
||||
scanResponse.getPayload(),
|
||||
|
@ -105,7 +105,7 @@ ble_error_t nRF5xGap::setAdvertisingData(const GapAdvertisingData &advData, cons
|
|||
|
||||
/* Make sure the GAP Service appearance value is aligned with the
|
||||
*appearance from GapAdvertisingData */
|
||||
ASSERT(ERROR_NONE == sd_ble_gap_appearance_set(advData.getAppearance()),
|
||||
ASSERT_TRUE(ERROR_NONE == sd_ble_gap_appearance_set(advData.getAppearance()),
|
||||
BLE_ERROR_PARAM_OUT_OF_RANGE);
|
||||
|
||||
/* ToDo: Perform some checks on the payload, for example the Scan Response can't */
|
||||
|
@ -196,7 +196,7 @@ ble_error_t nRF5xGap::startAdvertising(const GapAdvertisingParams ¶ms)
|
|||
adv_para.interval = params.getIntervalInADVUnits(); // advertising interval (in units of 0.625 ms)
|
||||
adv_para.timeout = params.getTimeout();
|
||||
|
||||
ASSERT(ERROR_NONE == sd_ble_gap_adv_start(&adv_para), BLE_ERROR_PARAM_OUT_OF_RANGE);
|
||||
ASSERT_TRUE(ERROR_NONE == sd_ble_gap_adv_start(&adv_para), BLE_ERROR_PARAM_OUT_OF_RANGE);
|
||||
|
||||
return BLE_ERROR_NONE;
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ ble_error_t nRF5xGap::stopScan(void) {
|
|||
ble_error_t nRF5xGap::stopAdvertising(void)
|
||||
{
|
||||
/* Stop Advertising */
|
||||
ASSERT(ERROR_NONE == sd_ble_gap_adv_stop(), BLE_ERROR_PARAM_OUT_OF_RANGE);
|
||||
ASSERT_TRUE(ERROR_NONE == sd_ble_gap_adv_stop(), BLE_ERROR_PARAM_OUT_OF_RANGE);
|
||||
|
||||
state.advertising = 0;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
|
|||
nordicUUID = custom_convert_to_nordic_uuid(service.getUUID());
|
||||
|
||||
uint16_t serviceHandle;
|
||||
ASSERT( ERROR_NONE ==
|
||||
ASSERT_TRUE( ERROR_NONE ==
|
||||
sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,
|
||||
&nordicUUID,
|
||||
&serviceHandle),
|
||||
|
@ -88,7 +88,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
|
|||
}
|
||||
}
|
||||
|
||||
ASSERT ( ERROR_NONE ==
|
||||
ASSERT_TRUE ( ERROR_NONE ==
|
||||
custom_add_in_characteristic(BLE_GATT_HANDLE_INVALID,
|
||||
&nordicUUID,
|
||||
p_char->getProperties(),
|
||||
|
@ -123,7 +123,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
|
|||
|
||||
nordicUUID = custom_convert_to_nordic_uuid(p_desc->getUUID());
|
||||
|
||||
ASSERT(ERROR_NONE ==
|
||||
ASSERT_TRUE(ERROR_NONE ==
|
||||
custom_add_in_descriptor(BLE_GATT_HANDLE_INVALID,
|
||||
&nordicUUID,
|
||||
p_desc->getValuePtr(),
|
||||
|
@ -177,7 +177,7 @@ ble_error_t nRF5xGattServer::read(Gap::Handle_t connectionHandle, GattAttribute:
|
|||
.p_value = buffer,
|
||||
};
|
||||
|
||||
ASSERT( ERROR_NONE ==
|
||||
ASSERT_TRUE( ERROR_NONE ==
|
||||
sd_ble_gatts_value_get(connectionHandle, attributeHandle, &value),
|
||||
BLE_ERROR_PARAM_OUT_OF_RANGE);
|
||||
*lengthP = value.len;
|
||||
|
|
|
@ -292,7 +292,7 @@ static void btle_handler(ble_evt_t *p_ble_evt)
|
|||
/*! @brief Callback when an error occurs inside the SoftDevice */
|
||||
void assert_nrf_callback(uint16_t line_num, const uint8_t *p_file_name)
|
||||
{
|
||||
ASSERT(false, (void) 0);
|
||||
ASSERT_TRUE(false, (void) 0);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
@ -125,7 +125,6 @@ static inline void debugger_breakpoint(void)
|
|||
//--------------------------------------------------------------------+
|
||||
// Logical Assert
|
||||
//--------------------------------------------------------------------+
|
||||
#define ASSERT(...) ASSERT_TRUE(__VA_ARGS__)
|
||||
#define ASSERT_TRUE(condition , error) ASSERT_DEFINE( , (condition), error, "%s", "evaluated to false")
|
||||
#define ASSERT_FALSE(condition , error) ASSERT_DEFINE( ,!(condition), error, "%s", "evaluated to true")
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ ble_error_t nRF5xGap::setAdvertisingData(const GapAdvertisingData &advData, cons
|
|||
//}
|
||||
|
||||
/* Send advertising data! */
|
||||
ASSERT(ERROR_NONE ==
|
||||
ASSERT_TRUE(ERROR_NONE ==
|
||||
sd_ble_gap_adv_data_set(advData.getPayload(),
|
||||
advData.getPayloadLen(),
|
||||
scanResponse.getPayload(),
|
||||
|
@ -105,7 +105,7 @@ ble_error_t nRF5xGap::setAdvertisingData(const GapAdvertisingData &advData, cons
|
|||
|
||||
/* Make sure the GAP Service appearance value is aligned with the
|
||||
*appearance from GapAdvertisingData */
|
||||
ASSERT(ERROR_NONE == sd_ble_gap_appearance_set(advData.getAppearance()),
|
||||
ASSERT_TRUE(ERROR_NONE == sd_ble_gap_appearance_set(advData.getAppearance()),
|
||||
BLE_ERROR_PARAM_OUT_OF_RANGE);
|
||||
|
||||
/* ToDo: Perform some checks on the payload, for example the Scan Response can't */
|
||||
|
@ -273,7 +273,7 @@ ble_error_t nRF5xGap::stopScan(void) {
|
|||
ble_error_t nRF5xGap::stopAdvertising(void)
|
||||
{
|
||||
/* Stop Advertising */
|
||||
ASSERT(ERROR_NONE == sd_ble_gap_adv_stop(), BLE_ERROR_PARAM_OUT_OF_RANGE);
|
||||
ASSERT_TRUE(ERROR_NONE == sd_ble_gap_adv_stop(), BLE_ERROR_PARAM_OUT_OF_RANGE);
|
||||
|
||||
state.advertising = 0;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
|
|||
nordicUUID = custom_convert_to_nordic_uuid(service.getUUID());
|
||||
|
||||
uint16_t serviceHandle;
|
||||
ASSERT( ERROR_NONE ==
|
||||
ASSERT_TRUE( ERROR_NONE ==
|
||||
sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,
|
||||
&nordicUUID,
|
||||
&serviceHandle),
|
||||
|
@ -88,7 +88,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
|
|||
}
|
||||
}
|
||||
|
||||
ASSERT ( ERROR_NONE ==
|
||||
ASSERT_TRUE ( ERROR_NONE ==
|
||||
custom_add_in_characteristic(BLE_GATT_HANDLE_INVALID,
|
||||
&nordicUUID,
|
||||
p_char->getProperties(),
|
||||
|
@ -123,7 +123,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service)
|
|||
|
||||
nordicUUID = custom_convert_to_nordic_uuid(p_desc->getUUID());
|
||||
|
||||
ASSERT(ERROR_NONE ==
|
||||
ASSERT_TRUE(ERROR_NONE ==
|
||||
custom_add_in_descriptor(BLE_GATT_HANDLE_INVALID,
|
||||
&nordicUUID,
|
||||
p_desc->getValuePtr(),
|
||||
|
@ -177,7 +177,7 @@ ble_error_t nRF5xGattServer::read(Gap::Handle_t connectionHandle, GattAttribute:
|
|||
.p_value = buffer,
|
||||
};
|
||||
|
||||
ASSERT( ERROR_NONE ==
|
||||
ASSERT_TRUE( ERROR_NONE ==
|
||||
sd_ble_gatts_value_get(connectionHandle, attributeHandle, &value),
|
||||
BLE_ERROR_PARAM_OUT_OF_RANGE);
|
||||
*lengthP = value.len;
|
||||
|
|
Loading…
Reference in New Issue