Package org.robolectric.shadows
Class ShadowBluetoothLeAdvertiser
java.lang.Object
org.robolectric.shadows.ShadowBluetoothLeAdvertiser
@Implements(value=android.bluetooth.le.BluetoothLeAdvertiser.class,
minSdk=26)
public class ShadowBluetoothLeAdvertiser
extends Object
Shadow implementation of
BluetoothLeAdvertiser.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.robolectric.shadows.ShadowBluetoothLeAdvertiser.BluetoothLeAdvertiserReflector -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void__constructor__(BluetoothAdapter bluetoothAdapter) protected void__constructor__(IBluetoothManager bluetoothManager) intReturns the count of current ongoing Bluetooth LE advertising requests.intReturns the count of current ongoing Bluetooth LE advertising set requests.protected voidstartAdvertising(AdvertiseSettings settings, AdvertiseData advertiseData, AdvertiseCallback callback) Start Bluetooth LE Advertising.protected voidstartAdvertising(AdvertiseSettings settings, AdvertiseData advertiseData, AdvertiseData scanResponse, AdvertiseCallback callback) Start Bluetooth LE Advertising.protected voidstartAdvertisingSet(AdvertisingSetParameters parameters, AdvertiseData advertiseData, AdvertiseData scanResponse, PeriodicAdvertisingParameters periodicParameters, AdvertiseData periodicData, int duration, int maxExtendedAdvertisingEvents, BluetoothGattServer gattServer, AdvertisingSetCallback callback, Handler handler) Start Bluetooth LE Advertising Set.protected voidstopAdvertising(AdvertiseCallback callback) Stop Bluetooth LE advertising.protected voidstopAdvertisingSet(AdvertisingSetCallback callback) Used to dispose of aAdvertisingSetobject, obtained withBluetoothLeAdvertiser.startAdvertisingSet(android.bluetooth.le.AdvertisingSetParameters, android.bluetooth.le.AdvertiseData, android.bluetooth.le.AdvertiseData, android.bluetooth.le.PeriodicAdvertisingParameters, android.bluetooth.le.AdvertiseData, android.bluetooth.le.AdvertisingSetCallback).
-
Field Details
-
bluetoothLeAdvertiserReflector
@ReflectorObject protected org.robolectric.shadows.ShadowBluetoothLeAdvertiser.BluetoothLeAdvertiserReflector bluetoothLeAdvertiserReflector
-
-
Constructor Details
-
ShadowBluetoothLeAdvertiser
public ShadowBluetoothLeAdvertiser()
-
-
Method Details
-
__constructor__
-
__constructor__
-
startAdvertising
@Implementation protected void startAdvertising(AdvertiseSettings settings, AdvertiseData advertiseData, AdvertiseCallback callback) Start Bluetooth LE Advertising. This method returns immediately, the operation status is delivered throughcallback.- Parameters:
settings- Settings for Bluetooth LE advertising.advertiseData- Advertisement data to be broadcasted.callback- Callback for advertising status.
-
startAdvertising
@Implementation protected void startAdvertising(AdvertiseSettings settings, AdvertiseData advertiseData, AdvertiseData scanResponse, AdvertiseCallback callback) Start Bluetooth LE Advertising. This method returns immediately, the operation status is delivered throughcallback.- Parameters:
settings- Settings for Bluetooth LE advertising.advertiseData- Advertisement data to be broadcasted.scanResponse- Scan response associated with the advertisement data.callback- Callback for advertising status.- Throws:
IllegalArgumentException- Whencallbackis not present.
-
stopAdvertising
Stop Bluetooth LE advertising. Thecallbackmust be the same one use instartAdvertising(android.bluetooth.le.AdvertiseSettings, android.bluetooth.le.AdvertiseData, android.bluetooth.le.AdvertiseCallback).- Parameters:
callback-AdvertiseCallbackidentifies the advertising instance to stop.- Throws:
IllegalArgumentException- When thecallbackis not a key present inadvertisements.
-
startAdvertisingSet
@Implementation(minSdk=34) protected void startAdvertisingSet(AdvertisingSetParameters parameters, AdvertiseData advertiseData, AdvertiseData scanResponse, PeriodicAdvertisingParameters periodicParameters, AdvertiseData periodicData, int duration, int maxExtendedAdvertisingEvents, BluetoothGattServer gattServer, AdvertisingSetCallback callback, Handler handler) Start Bluetooth LE Advertising Set. This method returns immediately, the operation status is delivered throughcallback.- Parameters:
parameters- Advertising set parameters.advertiseData- Advertisement data to be broadcasted.scanResponse- Scan response associated with the advertisement data.periodicParameters- Periodic advertisng parameters.periodicData- Periodic advertising data.duration- Advertising duration, in 10ms unit.maxExtendedAdvertisingEvents- Maximum number of extended advertising events the controller shall attempt to send prior to terminating the extended advertising, even if the duration has not expired.gattServer- GattServer the GATT server that will "own" connections derived from this advertising.callback- Callback for advertising set.handler- Thread upon which the callbacks will be invoked.- Throws:
IllegalArgumentException- Whencallbackis not present.
-
stopAdvertisingSet
Used to dispose of aAdvertisingSetobject, obtained withBluetoothLeAdvertiser.startAdvertisingSet(android.bluetooth.le.AdvertisingSetParameters, android.bluetooth.le.AdvertiseData, android.bluetooth.le.AdvertiseData, android.bluetooth.le.PeriodicAdvertisingParameters, android.bluetooth.le.AdvertiseData, android.bluetooth.le.AdvertisingSetCallback).- Parameters:
callback- Callback for advertising set.- Throws:
IllegalArgumentException- Whencallbackis not present.
-
getAdvertisementRequestCount
public int getAdvertisementRequestCount()Returns the count of current ongoing Bluetooth LE advertising requests. -
getAdvertisingSetRequestCount
public int getAdvertisingSetRequestCount()Returns the count of current ongoing Bluetooth LE advertising set requests.
-