public class BluetoothLEHelper
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
BluetoothLEHelper.GattInfo |
Constructor and Description |
---|
BluetoothLEHelper(Context context) |
Modifier and Type | Method and Description |
---|---|
boolean |
checkGattServices(java.lang.String hardwareVersion,
java.lang.String firmwareVersion,
java.util.List<BluetoothGattService> gattServiceList) |
boolean |
close()
close gatt connection
|
boolean |
connect(java.lang.String address,
BluetoothGattCallback gattCallback)
Connects to the GATT server hosted on the Bluetooth LE device.
|
boolean |
disconnect()
Disconnects an existing connection or cancel a pending connection.
|
boolean |
enableAliBeacon(byte[] enableAliBeacon) |
boolean |
enableBackgroundEnhancement(byte[] enableBackgroundEnhancement) |
boolean |
enableIBeacon(byte[] workMode) |
boolean |
enableSecondIBeacon(byte[] workMode) |
boolean |
getBaseSettings() |
boolean |
getSecureBroadcastRotation()
read rotation broadcast period.
|
boolean |
getSensoroSettings()
read all parameters in SensorSettings
|
boolean |
initialize()
Initializes a reference to the local Bluetooth adapter.
|
void |
listenAcceleratorCountChar()
listen accelerometer count changing.
|
void |
listenAcceleratorMovingChar()
listen moving state changing.
|
void |
listenBrightnessChar()
listen light changing.
|
void |
listenTemperatureChar()
listen temperature changing.
|
boolean |
onFlashLightWitCommand(byte[] cmdLED) |
void |
readCharacteristic(java.util.UUID uuid) |
boolean |
readSecondBeaconMajorAndMinor() |
boolean |
readSecondBeaconState() |
boolean |
readSecondBeaconUUID() |
boolean |
reloadSensoroData() |
boolean |
requireWritePermission(byte[] password)
check password
|
boolean |
resetAccelerometerCount()
reset accelerometer count.
|
boolean |
resetToFactorySettings()
reset to factory.
|
boolean |
updateWritePassword(byte[] password)
update password.
|
boolean |
writeBaseSettings(byte[] baseSetiings) |
boolean |
writeBroadcastKey(byte[] broadcastKey) |
boolean |
writeMajorMinor(byte[] majorMinor) |
boolean |
writeProximityUUID(byte[] uuid) |
boolean |
writeSecondMajorMinor(byte[] majorMinor) |
boolean |
writeSecondProximityUUID(byte[] uuid) |
boolean |
writeSecureBroadcastInterval(byte[] interval) |
boolean |
writeSensoSettings(byte[] sensoSettings) |
public boolean initialize()
public boolean connect(java.lang.String address, BluetoothGattCallback gattCallback)
address
- The device address of the destination device.BluetoothGattCallback#onConnectionStateChange(android.bluetooth.BluetoothGatt, int, int)
callback.public boolean disconnect()
BluetoothGattCallback#onConnectionStateChange(android.bluetooth.BluetoothGatt, int, int)
callback.public boolean close()
public boolean checkGattServices(java.lang.String hardwareVersion, java.lang.String firmwareVersion, java.util.List<BluetoothGattService> gattServiceList)
public boolean resetToFactorySettings()
public boolean resetAccelerometerCount()
public boolean updateWritePassword(byte[] password)
password
- passwordpublic boolean requireWritePermission(byte[] password)
password
- passwordpublic boolean getBaseSettings()
public boolean getSensoroSettings()
public boolean getSecureBroadcastRotation()
public void listenTemperatureChar()
public void listenBrightnessChar()
public void listenAcceleratorCountChar()
public void listenAcceleratorMovingChar()
public void readCharacteristic(java.util.UUID uuid)
public boolean readSecondBeaconUUID()
public boolean readSecondBeaconMajorAndMinor()
public boolean readSecondBeaconState()
public boolean writeBaseSettings(byte[] baseSetiings)
public boolean writeSensoSettings(byte[] sensoSettings)
public boolean writeProximityUUID(byte[] uuid)
public boolean writeSecondProximityUUID(byte[] uuid)
public boolean writeMajorMinor(byte[] majorMinor)
public boolean writeSecondMajorMinor(byte[] majorMinor)
public boolean reloadSensoroData()
public boolean writeSecureBroadcastInterval(byte[] interval)
public boolean onFlashLightWitCommand(byte[] cmdLED)
public boolean writeBroadcastKey(byte[] broadcastKey)
public boolean enableIBeacon(byte[] workMode)
public boolean enableSecondIBeacon(byte[] workMode)
public boolean enableAliBeacon(byte[] enableAliBeacon)
public boolean enableBackgroundEnhancement(byte[] enableBackgroundEnhancement)