mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			Merge pull request #10270 from marcemmers/advertising-builder
BLE SimpleAdvertisingBuilder moved functions out of mbed_assert callspull/10291/head
						commit
						1b4f6ae3c4
					
				| 
						 | 
				
			
			@ -78,7 +78,8 @@ public:
 | 
			
		|||
     */
 | 
			
		||||
    AdvertisingDataSimpleBuilder &setAppearance(adv_data_appearance_t appearance)
 | 
			
		||||
    {
 | 
			
		||||
        MBED_ASSERT(_builder.setAppearance(appearance) == BLE_ERROR_NONE);
 | 
			
		||||
        ble_error_t res = _builder.setAppearance(appearance);
 | 
			
		||||
        MBED_ASSERT(res == BLE_ERROR_NONE);
 | 
			
		||||
        return *this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -96,7 +97,8 @@ public:
 | 
			
		|||
        adv_data_flags_t flags = adv_data_flags_t::default_flags
 | 
			
		||||
    )
 | 
			
		||||
    {
 | 
			
		||||
        MBED_ASSERT(_builder.setFlags(flags) == BLE_ERROR_NONE);
 | 
			
		||||
        ble_error_t res = _builder.setFlags(flags);
 | 
			
		||||
        MBED_ASSERT(res == BLE_ERROR_NONE);
 | 
			
		||||
        return *this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -111,7 +113,8 @@ public:
 | 
			
		|||
     */
 | 
			
		||||
    AdvertisingDataSimpleBuilder &setTxPowerAdvertised(advertising_power_t txPower)
 | 
			
		||||
    {
 | 
			
		||||
        MBED_ASSERT(_builder.setTxPowerAdvertised(txPower) == BLE_ERROR_NONE);
 | 
			
		||||
        ble_error_t res = _builder.setTxPowerAdvertised(txPower);
 | 
			
		||||
        MBED_ASSERT(res == BLE_ERROR_NONE);
 | 
			
		||||
        return *this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -129,7 +132,8 @@ public:
 | 
			
		|||
     */
 | 
			
		||||
    AdvertisingDataSimpleBuilder &setName(const char *name, bool complete = true)
 | 
			
		||||
    {
 | 
			
		||||
        MBED_ASSERT(_builder.setName(name, complete) == BLE_ERROR_NONE);
 | 
			
		||||
        ble_error_t res = _builder.setName(name, complete);
 | 
			
		||||
        MBED_ASSERT(res == BLE_ERROR_NONE);
 | 
			
		||||
        return *this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -144,7 +148,8 @@ public:
 | 
			
		|||
     */
 | 
			
		||||
    AdvertisingDataSimpleBuilder &setManufacturerSpecificData(mbed::Span<const uint8_t> data)
 | 
			
		||||
    {
 | 
			
		||||
        MBED_ASSERT(_builder.setManufacturerSpecificData(data) == BLE_ERROR_NONE);
 | 
			
		||||
        ble_error_t res = _builder.setManufacturerSpecificData(data);
 | 
			
		||||
        MBED_ASSERT(res == BLE_ERROR_NONE);
 | 
			
		||||
        return *this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -157,7 +162,8 @@ public:
 | 
			
		|||
     */
 | 
			
		||||
    AdvertisingDataSimpleBuilder &setAdvertisingInterval(adv_interval_t interval)
 | 
			
		||||
    {
 | 
			
		||||
        MBED_ASSERT(_builder.setAdvertisingInterval(interval) == BLE_ERROR_NONE);
 | 
			
		||||
        ble_error_t res = _builder.setAdvertisingInterval(interval);
 | 
			
		||||
        MBED_ASSERT(res == BLE_ERROR_NONE);
 | 
			
		||||
        return *this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -174,7 +180,8 @@ public:
 | 
			
		|||
        conn_interval_t max
 | 
			
		||||
    )
 | 
			
		||||
    {
 | 
			
		||||
        MBED_ASSERT(_builder.setConnectionIntervalPreference(min, max) == BLE_ERROR_NONE);
 | 
			
		||||
        ble_error_t res = _builder.setConnectionIntervalPreference(min, max);
 | 
			
		||||
        MBED_ASSERT(res == BLE_ERROR_NONE);
 | 
			
		||||
        return *this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -190,7 +197,8 @@ public:
 | 
			
		|||
     */
 | 
			
		||||
    AdvertisingDataSimpleBuilder &setServiceData(UUID service, mbed::Span<const uint8_t> data)
 | 
			
		||||
    {
 | 
			
		||||
        MBED_ASSERT(_builder.setServiceData(service, data) == BLE_ERROR_NONE);
 | 
			
		||||
        ble_error_t res = _builder.setServiceData(service, data);
 | 
			
		||||
        MBED_ASSERT(res == BLE_ERROR_NONE);
 | 
			
		||||
        return *this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -210,11 +218,10 @@ public:
 | 
			
		|||
        bool complete = true
 | 
			
		||||
    )
 | 
			
		||||
    {
 | 
			
		||||
        MBED_ASSERT(
 | 
			
		||||
            _builder.setLocalServiceList(
 | 
			
		||||
        ble_error_t res = _builder.setLocalServiceList(
 | 
			
		||||
                mbed::make_Span(&data, 1), complete
 | 
			
		||||
            ) == BLE_ERROR_NONE
 | 
			
		||||
        );
 | 
			
		||||
            );
 | 
			
		||||
        MBED_ASSERT(res == BLE_ERROR_NONE);
 | 
			
		||||
        return *this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -235,7 +242,8 @@ public:
 | 
			
		|||
        bool complete = true
 | 
			
		||||
    )
 | 
			
		||||
    {
 | 
			
		||||
        MBED_ASSERT(_builder.setLocalServiceList(data, complete) == BLE_ERROR_NONE);
 | 
			
		||||
        ble_error_t res = _builder.setLocalServiceList(data, complete);
 | 
			
		||||
        MBED_ASSERT(res == BLE_ERROR_NONE);
 | 
			
		||||
        return *this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -250,9 +258,8 @@ public:
 | 
			
		|||
     */
 | 
			
		||||
    AdvertisingDataSimpleBuilder &setRequestedService(const UUID& data)
 | 
			
		||||
    {
 | 
			
		||||
        MBED_ASSERT(
 | 
			
		||||
            _builder.setRequestedServiceList(mbed::make_Span(&data, 1)) == BLE_ERROR_NONE
 | 
			
		||||
        );
 | 
			
		||||
        ble_error_t res = _builder.setRequestedServiceList(mbed::make_Span(&data, 1));
 | 
			
		||||
        MBED_ASSERT(res == BLE_ERROR_NONE);
 | 
			
		||||
        return *this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -267,7 +274,8 @@ public:
 | 
			
		|||
     */
 | 
			
		||||
    AdvertisingDataSimpleBuilder &setRequestedServiceList(mbed::Span<const UUID> data)
 | 
			
		||||
    {
 | 
			
		||||
        MBED_ASSERT(_builder.setRequestedServiceList(data) == BLE_ERROR_NONE);
 | 
			
		||||
        ble_error_t res = _builder.setRequestedServiceList(data);
 | 
			
		||||
        MBED_ASSERT(res == BLE_ERROR_NONE);
 | 
			
		||||
        return *this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -286,7 +294,8 @@ public:
 | 
			
		|||
        mbed::Span<const uint8_t> fieldData
 | 
			
		||||
    )
 | 
			
		||||
    {
 | 
			
		||||
        MBED_ASSERT(_builder.addData(advDataType, fieldData) == BLE_ERROR_NONE);
 | 
			
		||||
        ble_error_t res = _builder.addData(advDataType, fieldData);
 | 
			
		||||
        MBED_ASSERT(res == BLE_ERROR_NONE);
 | 
			
		||||
        return *this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue