public class AmazonFreeRTOSManager
extends java.lang.Object
| Constructor and Description |
|---|
AmazonFreeRTOSManager(android.content.Context context,
android.bluetooth.BluetoothAdapter bluetoothAdapter)
Construct an AmazonFreeRTOSManager instance.
|
| Modifier and Type | Method and Description |
|---|---|
AmazonFreeRTOSDevice |
connectToDevice(android.bluetooth.BluetoothDevice btDevice,
BleConnectionStatusCallback connectionStatusCallback,
AWSCredentialsProvider cp,
boolean autoReconnect)
Connect to the BLE device, and notify the connection state via BleConnectionStatusCallback.
|
void |
disconnectFromDevice(AmazonFreeRTOSDevice aDevice)
Closing BLE connection for the AmazonFreeRTOSDevice, reset all variables, and disconnect from AWS IoT.
|
AmazonFreeRTOSDevice |
getConnectedDevice(java.lang.String macAddr)
Get the instance of AmazonFreeRTOSDevice given the mac address of the BLE device
|
void |
setScanFilters(java.util.List<android.bluetooth.le.ScanFilter> filters)
Setting the criteria for which exact the BLE devices to scan for.
|
void |
startScanDevices(BleScanResultCallback scanResultCallback)
Start scanning of nearby BLE devices.
|
void |
startScanDevices(BleScanResultCallback scanResultCallback,
long scanDuration)
Start scanning nearby BLE devices for a total duration of scanDuration milliseconds.
|
void |
stopScanDevices()
Stop scanning of nearby BLE devices.
|
public AmazonFreeRTOSManager(android.content.Context context,
android.bluetooth.BluetoothAdapter bluetoothAdapter)
context - The app context. Should be passed in by the app that creates a new instance
of AmazonFreeRTOSManager.bluetoothAdapter - BluetoothAdaptor passed in by the app.public void setScanFilters(java.util.List<android.bluetooth.le.ScanFilter> filters)
filters - The list of ScanFilter for BLE devices.public void startScanDevices(BleScanResultCallback scanResultCallback)
scanResultCallback - The callback to notify the calling app of the scanning result. The
callback will be triggered, every time it finds a BLE device
nearby that meets the ScanFilter criteria.public void startScanDevices(BleScanResultCallback scanResultCallback, long scanDuration)
scanResultCallback - The callback to notify the calling app of the scanning result.scanDuration - The duration of scanning. Keep scanning if 0.public void stopScanDevices()
public AmazonFreeRTOSDevice connectToDevice(android.bluetooth.BluetoothDevice btDevice, BleConnectionStatusCallback connectionStatusCallback, AWSCredentialsProvider cp, boolean autoReconnect)
connectionStatusCallback - The callback to notify app whether the BLE connection is
successful. Must not be null.btDevice - the BLE device to be connected to.cp - the AWSCredential used to connect to AWS IoT.autoReconnect - auto reconnect to device after unexpected disconnectpublic void disconnectFromDevice(AmazonFreeRTOSDevice aDevice)
aDevice - The AmazonFreeRTOSDevice to be disconnected.public AmazonFreeRTOSDevice getConnectedDevice(java.lang.String macAddr)
macAddr - the mac address of the connected BLE device