1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-02-06 17:13:36 +01:00

add special hw address FFFFFF to skip hw address check

This commit is contained in:
OliE 2017-06-30 16:53:36 +02:00
parent c97ae5376d
commit 973442a044
3 changed files with 12 additions and 5 deletions

View File

@ -184,6 +184,7 @@ public abstract class BluetoothCommunication {
* Return all hardware addresses of the Bluetooth device.
*
* The format should be the first six hex values of a know Bluetooth hardware address without any colon e.g. 12:AB:65:12:34:52 becomes "12AB65"
* @note add hw address "FFFFFF" to skip check
*
* @return a list of all hardware addresses that are known for this device.
*/
@ -379,8 +380,12 @@ public abstract class BluetoothCommunication {
{
@Override
public void onLeScan(final BluetoothDevice device, int rssi, byte[] scanRecord) {
if (device.getName() == null) {
return;
}
for (int i=0; i<hwAddresses().size(); i++) {
if (device.getAddress().replace(":", "").toUpperCase().startsWith(hwAddresses().get(i)))
if (device.getAddress().replace(":", "").toUpperCase().startsWith(hwAddresses().get(i)) || hwAddresses().get(i) == "FFFFFF")
{
if (isDeviceNameCheck()) {
if (!device.getName().toLowerCase().equals(btDeviceName.toLowerCase())) {
@ -388,7 +393,7 @@ public abstract class BluetoothCommunication {
}
}
Log.d("BluetoothMiScale", "Mi Scale found trying to connect...");
Log.d("BluetoothCommunication", btDeviceName + " found trying to connect...");
bluetoothGatt = device.connectGatt(context, false, gattCallback);

View File

@ -114,9 +114,7 @@ public class BluetoothSanitasSbf70 extends BluetoothCommunication {
@Override
public ArrayList<String> hwAddresses() {
ArrayList hwAddresses = new ArrayList();
hwAddresses.add("C4BE84");
hwAddresses.add("209148");
hwAddresses.add("F4B85E");
hwAddresses.add("FFFFFF");
return hwAddresses;
}

View File

@ -129,6 +129,10 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
@Override
public void updateOnView(ArrayList<ScaleData> scaleDataList)
{
if (scaleDataList.isEmpty()) {
return;
}
final int maxSize = 20;
int subpageCount = (int)Math.ceil(scaleDataList.size() / (double)maxSize);