mirror of
https://github.com/oliexdev/openScale.git
synced 2025-02-07 01:21:09 +01:00
add special hw address FFFFFF to skip hw address check
This commit is contained in:
parent
c97ae5376d
commit
973442a044
@ -184,6 +184,7 @@ public abstract class BluetoothCommunication {
|
|||||||
* Return all hardware addresses of the Bluetooth device.
|
* 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"
|
* 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.
|
* @return a list of all hardware addresses that are known for this device.
|
||||||
*/
|
*/
|
||||||
@ -379,8 +380,12 @@ public abstract class BluetoothCommunication {
|
|||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onLeScan(final BluetoothDevice device, int rssi, byte[] scanRecord) {
|
public void onLeScan(final BluetoothDevice device, int rssi, byte[] scanRecord) {
|
||||||
|
if (device.getName() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i=0; i<hwAddresses().size(); i++) {
|
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 (isDeviceNameCheck()) {
|
||||||
if (!device.getName().toLowerCase().equals(btDeviceName.toLowerCase())) {
|
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);
|
bluetoothGatt = device.connectGatt(context, false, gattCallback);
|
||||||
|
|
||||||
|
@ -114,9 +114,7 @@ public class BluetoothSanitasSbf70 extends BluetoothCommunication {
|
|||||||
@Override
|
@Override
|
||||||
public ArrayList<String> hwAddresses() {
|
public ArrayList<String> hwAddresses() {
|
||||||
ArrayList hwAddresses = new ArrayList();
|
ArrayList hwAddresses = new ArrayList();
|
||||||
hwAddresses.add("C4BE84");
|
hwAddresses.add("FFFFFF");
|
||||||
hwAddresses.add("209148");
|
|
||||||
hwAddresses.add("F4B85E");
|
|
||||||
|
|
||||||
return hwAddresses;
|
return hwAddresses;
|
||||||
}
|
}
|
||||||
|
@ -129,6 +129,10 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
@Override
|
@Override
|
||||||
public void updateOnView(ArrayList<ScaleData> scaleDataList)
|
public void updateOnView(ArrayList<ScaleData> scaleDataList)
|
||||||
{
|
{
|
||||||
|
if (scaleDataList.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final int maxSize = 20;
|
final int maxSize = 20;
|
||||||
|
|
||||||
int subpageCount = (int)Math.ceil(scaleDataList.size() / (double)maxSize);
|
int subpageCount = (int)Math.ceil(scaleDataList.size() / (double)maxSize);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user