Package io.heraldprox.herald.sensor.ble
Class ConcreteBLETransmitter
- java.lang.Object
-
- io.heraldprox.herald.sensor.ble.ConcreteBLETransmitter
-
- All Implemented Interfaces:
BLETransmitter
,BluetoothStateManagerDelegate
,Sensor
public class ConcreteBLETransmitter extends java.lang.Object implements BLETransmitter, BluetoothStateManagerDelegate
-
-
Field Summary
-
Fields inherited from interface io.heraldprox.herald.sensor.ble.BLETransmitter
delegates
-
-
Constructor Summary
Constructors Constructor Description ConcreteBLETransmitter(android.content.Context context, BluetoothStateManager bluetoothStateManager, BLETimer timer, PayloadDataSupplier payloadDataSupplier, BLEDatabase database)
Transmitter starts automatically when Bluetooth is enabled.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(SensorDelegate delegate)
void
bluetoothStateManager(BluetoothState didUpdateState)
boolean
isSupported()
Is transmitter supported.PayloadData
payloadData()
Get current payload.void
start()
void
stop()
-
-
-
Constructor Detail
-
ConcreteBLETransmitter
public ConcreteBLETransmitter(@NonNull android.content.Context context, @NonNull BluetoothStateManager bluetoothStateManager, @NonNull BLETimer timer, @NonNull PayloadDataSupplier payloadDataSupplier, @NonNull BLEDatabase database)
Transmitter starts automatically when Bluetooth is enabled.- Parameters:
context
- The Herald execution environment ContextbluetoothStateManager
- To determine whether Bluetooth is enabledtimer
- Used to register a need for periodic events to occurpayloadDataSupplier
- Source of the payload to transmitdatabase
- BLE Device database to locate nearby device information
-
-
Method Detail
-
add
public void add(@NonNull SensorDelegate delegate)
-
payloadData
@NonNull public PayloadData payloadData()
Description copied from interface:BLETransmitter
Get current payload.- Specified by:
payloadData
in interfaceBLETransmitter
- Returns:
- The current PayloadData for this device.
-
isSupported
public boolean isSupported()
Description copied from interface:BLETransmitter
Is transmitter supported.- Specified by:
isSupported
in interfaceBLETransmitter
- Returns:
- True if BLE advertising is supported.
-
bluetoothStateManager
public void bluetoothStateManager(@NonNull BluetoothState didUpdateState)
- Specified by:
bluetoothStateManager
in interfaceBluetoothStateManagerDelegate
-
-