mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			Set extended advertising parameters upon first use of API v2
Previously, extended advertising parameters failed to be set during BLE initialisation when the stack was not ready. To work around this, we delay it to the first use of useVersionTwoAPI.pull/10772/head
							parent
							
								
									2b354a40b0
								
							
						
					
					
						commit
						f78364cb5a
					
				| 
						 | 
				
			
			@ -457,17 +457,6 @@ GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandler>::
 | 
			
		|||
    _random_static_identity_address = _pal_gap.get_random_address();
 | 
			
		||||
 | 
			
		||||
    _pal_gap.set_event_handler(this);
 | 
			
		||||
 | 
			
		||||
#if BLE_FEATURE_EXTENDED_ADVERTISING
 | 
			
		||||
    if (is_extended_advertising_available()) {
 | 
			
		||||
        setExtendedAdvertisingParameters(
 | 
			
		||||
            LEGACY_ADVERTISING_HANDLE,
 | 
			
		||||
            AdvertisingParameters()
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    _existing_sets.set(LEGACY_ADVERTISING_HANDLE);
 | 
			
		||||
#endif // BLE_FEATURE_EXTENDED_ADVERTISING
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
 | 
			
		||||
| 
						 | 
				
			
			@ -3470,7 +3459,19 @@ void GenericGap<PalGapImpl, PalSecurityManager, ConnectionEventMonitorEventHandl
 | 
			
		|||
    if (_deprecated_scan_api_used) {
 | 
			
		||||
        MBED_ERROR(mixed_scan_api_error, "Use of up to date scan API with deprecated API");
 | 
			
		||||
    }
 | 
			
		||||
    _non_deprecated_scan_api_used = true;
 | 
			
		||||
    if (!_non_deprecated_scan_api_used) {
 | 
			
		||||
        _non_deprecated_scan_api_used = true;
 | 
			
		||||
#if BLE_FEATURE_EXTENDED_ADVERTISING
 | 
			
		||||
        if (const_cast<GenericGap*>(this)->is_extended_advertising_available()) {
 | 
			
		||||
            const_cast<GenericGap*>(this)->setExtendedAdvertisingParameters(
 | 
			
		||||
                LEGACY_ADVERTISING_HANDLE,
 | 
			
		||||
                AdvertisingParameters()
 | 
			
		||||
            );
 | 
			
		||||
        }
 | 
			
		||||
        const_cast<BitArray<MAX_ADVERTISING_SETS>*>(&_existing_sets)->set(LEGACY_ADVERTISING_HANDLE);
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <template<class> class PalGapImpl, class PalSecurityManager, class ConnectionEventMonitorEventHandler>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue