FireBLE/Proxr app for android

来自Firefly wiki
跳转至: 导航搜索

Functions Introduction

Major Functions of FireBLE:

  • Manage connection between fireBLE. One FireBLE can connect with several device.That's why it need to manage those connection.
  • Alarm. FireBLE app can send order to FireBLE, and then it will open the reverse alarm
  • Reverse alarm. FireBLE app will monitor the note which sent by FireBLE, then FireBLE will alarm.
  • Anti-lost alarm. When the FireBLE and FireBLE app is out of distance, both of them will alarm.

Connection Management

Connection Management,FireBLEapp need a list to store BluetoothGatt objects for every FireBLE.First, usestartLeScan()andstopLeScan()method to scan BLE device.then useconnectGatt()method to connect BLE device. During this period,it can confirm whether this BLE device and be indentify by Fireapp. If yes.It will be puting BluetoothGattobject into the list of FireBLEapp.Finally, when there is no need for the FireBLE. The FireBLEapp will useclose()method to turn down the connection.


Once we got theBluetoothGattobject of FireBLE,the FireBLE app can usereadCharacteristic()writeCharacteristic()methods to read and write the relevant characteristic of service.So that the FireBLE can respond to these objects,with buzzer alarm.

Reverse Alarm

Once we getBluetoothGattobject of FireBLE, the FireBLE app will use setCharacteristicNotification()method to intercept some characteristic of the FireBLE service, and will get response from onCharacteristicChanged()method of BluetoothGattCallbackobject。The FireBLE will sent out alarm sound to respond according to these date.

Anti-lost Alarm

Once we get BluetoothGattobject of FireBLE,the FireBLE app can use readRemoteRssi() method to read the current RSSI value of the FireBLE. The rssi value is a negative integer,it shows the signal intensive between the FireBLE and FireBLE app. The smaller the RSSI value is, the signal intensive is weaker.According to the RSSI value, FireBLE app will estimate the distance between them. After readRemoteRssi()method was used, it will get response from onReadRemoteRssi() method of BluetoothGattCallback object. And then when the RSSI value of FireBLE is less than a certain value, the FireBLE app will alarm.

Attention in development


  • When implementing alarm,FireBLE should usereadRemoteRssi() method to read RSSI value at set intervals 。
  • Every Android device are different,the signal intensive of BLE connection can not be the same. So the rang of rssi value would be different.
  • As one FireBLE app can connect several FireBLE,these FireBLE should pay more attention to the thread-safety when using readCharacteristic(),writeCharacteristic(),setCharacteristicNotification()andreadRemoteRssi()method. Do not try to use these functions a lot at the same time. Because it will put a large pressure on the Bluetooth functions of Android device and cause exception occurs.