Skip to content

Commit 6111378

Browse files
committed
More robust FlySight2 detection
1 parent 9647125 commit 6111378

File tree

5 files changed

+34
-15
lines changed

5 files changed

+34
-15
lines changed

app/build.gradle

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ android {
77

88
defaultConfig {
99
applicationId "com.platypii.baseline"
10-
compileSdk 34
10+
compileSdk 35
1111
minSdkVersion 21
12-
targetSdkVersion 34
12+
targetSdkVersion 35
1313
versionCode 151
1414
versionName "5.15-beta"
1515
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -39,14 +39,14 @@ android {
3939
dependencies {
4040
implementation fileTree(include: ['*.jar'], dir: 'libs')
4141
annotationProcessor 'androidx.annotation:annotation:1.9.1'
42-
implementation 'androidx.appcompat:appcompat:1.7.0'
43-
implementation 'androidx.fragment:fragment:1.8.5'
42+
implementation 'androidx.appcompat:appcompat:1.7.1'
43+
implementation 'androidx.fragment:fragment:1.8.8'
4444
implementation 'com.github.weliem:blessed-android:2.5.0'
45-
implementation 'com.google.android.gms:play-services-auth:21.2.0'
46-
implementation 'com.google.android.gms:play-services-maps:19.0.0'
45+
implementation 'com.google.android.gms:play-services-auth:21.3.0'
46+
implementation 'com.google.android.gms:play-services-maps:19.2.0'
4747
implementation 'com.google.code.gson:gson:2.11.0'
48-
implementation 'com.google.firebase:firebase-analytics:22.1.2'
49-
implementation 'com.google.firebase:firebase-crashlytics:19.2.1'
48+
implementation 'com.google.firebase:firebase-analytics:22.5.0'
49+
implementation 'com.google.firebase:firebase-crashlytics:19.4.4'
5050
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
5151
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
5252
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
mavenCentral()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:8.7.3'
9+
classpath 'com.android.tools.build:gradle:8.10.1'
1010
classpath 'com.google.firebase:firebase-crashlytics-gradle:3.0.2'
1111
classpath 'com.google.gms:google-services:4.4.2'
1212

common/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ dependencies {
2929
implementation fileTree(dir: 'libs', include: ['*.jar'])
3030
annotationProcessor 'androidx.annotation:annotation:1.9.1'
3131
implementation 'com.github.weliem:blessed-android:2.5.0'
32-
implementation 'com.google.android.gms:play-services-auth:21.2.0'
33-
implementation 'com.google.android.gms:play-services-maps:19.0.0'
34-
implementation 'com.google.firebase:firebase-crashlytics:19.2.1'
32+
implementation 'com.google.android.gms:play-services-auth:21.3.0'
33+
implementation 'com.google.android.gms:play-services-maps:19.2.0'
34+
implementation 'com.google.firebase:firebase-crashlytics:19.4.4'
3535
implementation 'org.greenrobot:eventbus:3.3.1'
3636
testImplementation 'junit:junit:4.13.2'
3737
}

common/src/main/java/com/platypii/baseline/bluetooth/Flysight2Protocol.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.platypii.baseline.util.PubSub;
88

99
import android.bluetooth.le.ScanRecord;
10+
import android.os.ParcelUuid;
1011
import android.util.Log;
1112
import androidx.annotation.NonNull;
1213
import androidx.annotation.Nullable;
@@ -16,6 +17,7 @@
1617
import java.nio.ByteBuffer;
1718
import java.nio.ByteOrder;
1819
import java.util.Arrays;
20+
import java.util.List;
1921
import java.util.UUID;
2022

2123
public class Flysight2Protocol extends BleProtocol {
@@ -44,8 +46,25 @@ public Flysight2Protocol(@NonNull PubSub<MLocation> locationUpdates) {
4446

4547
@Override
4648
public boolean canParse(@NonNull BluetoothPeripheral peripheral, @Nullable ScanRecord record) {
47-
// TODO: Check address
48-
return peripheral.getName().equals("FlySight");
49+
if (record != null) {
50+
// Check services
51+
final List<ParcelUuid> services = record.getServiceUuids();
52+
if (services != null) {
53+
for (ParcelUuid parcelUuid : services) {
54+
if (parcelUuid.getUuid().equals(flysightService1)) {
55+
return true;
56+
}
57+
}
58+
}
59+
// Check manufacturer
60+
// final byte[] mfg = record.getManufacturerSpecificData(2523);
61+
// if (mfg != null && mfg.length == 1 && mfg[0] == 0) {
62+
// return true;
63+
// }
64+
}
65+
if (peripheral.getName().startsWith("KFS")) return true;
66+
if (peripheral.getName().startsWith("FlySight")) return true;
67+
return false;
4968
}
5069

5170
@Override

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)