Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Euc watch proxy connect #356

Merged
merged 7 commits into from Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/src/main/java/com/cooper/wheellog/BluetoothService.kt
Expand Up @@ -141,7 +141,10 @@ class BluetoothService: Service() {
override fun onServicesDiscovered(peripheral: BluetoothPeripheral) {
super.onServicesDiscovered(peripheral)
Timber.i("onServicesDiscovered called")
val recognisedWheel = WheelData.getInstance().detectWheel(wheelAddress)
var recognisedWheel = WheelData.getInstance().detectWheel(wheelAddress, R.raw.bluetooth_services)
if (!recognisedWheel) {
recognisedWheel = WheelData.getInstance().detectWheel(wheelAddress, R.raw.bluetooth_proxy_services)
}
WheelData.getInstance().isConnected = recognisedWheel
if (recognisedWheel) {
sendBroadcast(Intent(Constants.ACTION_WHEEL_TYPE_RECOGNIZED))
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/cooper/wheellog/WheelData.java
Expand Up @@ -1423,7 +1423,7 @@ void reset() {
mWheelIsReady = false;
}

boolean detectWheel(String deviceAddress) {
boolean detectWheel(String deviceAddress, int servicesResId) {
Context mContext = getBluetoothService().getApplicationContext();
WheelLog.AppConfig.setLastMac(deviceAddress);
String advData = WheelLog.AppConfig.getAdvDataForWheel();
Expand All @@ -1436,7 +1436,7 @@ boolean detectWheel(String deviceAddress) {
}
Timber.i("ProtoVer %s, adv: %s", protoVer, advData );
boolean detected_wheel = false;
String text = StringUtil.Companion.getRawTextResource(mContext, R.raw.bluetooth_services);
String text = StringUtil.Companion.getRawTextResource(mContext, servicesResId);
var wheelServices = mBluetoothService.getWheelServices();
if (wheelServices == null) {
return false;
Expand Down
149 changes: 149 additions & 0 deletions app/src/main/res/raw/bluetooth_proxy_services.json
@@ -0,0 +1,149 @@
[
{
"adapter": "gotway",
"00001800-0000-1000-8000-00805f9b34fb": [
"00002a00-0000-1000-8000-00805f9b34fb",
"00002a01-0000-1000-8000-00805f9b34fb",
"00002a04-0000-1000-8000-00805f9b34fb",
"00002aa6-0000-1000-8000-00805f9b34fb"
],
"00001801-0000-1000-8000-00805f9b34fb": [],
"0000ffa0-0000-1000-8000-00805f9b34fb": [
"0000ffa1-0000-1000-8000-00805f9b34fb",
"0000ffa7-0000-1000-8000-00805f9b34fb"
],
"0000ffe0-0000-1000-8000-00805f9b34fb": [
"0000ffe1-0000-1000-8000-00805f9b34fb"
]
},
{
"adapter": "gotway",
"00001800-0000-1000-8000-00805f9b34fb": [
"00002a00-0000-1000-8000-00805f9b34fb",
"00002a01-0000-1000-8000-00805f9b34fb",
"00002a04-0000-1000-8000-00805f9b34fb",
"00002aa6-0000-1000-8000-00805f9b34fb"
],
"00001801-0000-1000-8000-00805f9b34fb": [],
"0000ffa0-0000-1000-8000-00805f9b34fb": [
"0000ffa1-0000-1000-8000-00805f9b34fb",
"0000ffa7-0000-1000-8000-00805f9b34fb"
],
"0000ffe0-0000-1000-8000-00805f9b34fb": [
"0000ffe1-0000-1000-8000-00805f9b34fb"
]
},
{
"adapter": "inmotion",
"00001800-0000-1000-8000-00805f9b34fb": [
"00002a00-0000-1000-8000-00805f9b34fb",
"00002a01-0000-1000-8000-00805f9b34fb",
"00002a04-0000-1000-8000-00805f9b34fb",
"00002aa6-0000-1000-8000-00805f9b34fb"
],
"00001801-0000-1000-8000-00805f9b34fb": [],
"0000ffa0-0000-1000-8000-00805f9b34fb": [
"0000ffa1-0000-1000-8000-00805f9b34fb",
"0000ffa5-0000-1000-8000-00805f9b34fb"
],
"0000fe00-0000-1000-8000-00805f9b34fb": [
"0000fe01-0000-1000-8000-00805f9b34fb",
"0000fe02-0000-1000-8000-00805f9b34fb",
"0000fe03-0000-1000-8000-00805f9b34fb",
"0000fe04-0000-1000-8000-00805f9b34fb",
"0000fe05-0000-1000-8000-00805f9b34fb",
"0000fe06-0000-1000-8000-00805f9b34fb"
]
},
{
"adapter": "inmotion_v2",
"00001800-0000-1000-8000-00805f9b34fb": [
"00002a00-0000-1000-8000-00805f9b34fb",
"00002a01-0000-1000-8000-00805f9b34fb",
"00002a04-0000-1000-8000-00805f9b34fb",
"00002aa6-0000-1000-8000-00805f9b34fb"
],
"00001801-0000-1000-8000-00805f9b34fb": [],
"0000ffa0-0000-1000-8000-00805f9b34fb": [
"0000ffa1-0000-1000-8000-00805f9b34fb",
"0000ffa6-0000-1000-8000-00805f9b34fb"
],
"6e400001-b5a3-f393-e0a9-e50e24dcca9e": [
"6e400002-b5a3-f393-e0a9-e50e24dcca9e",
"6e400003-b5a3-f393-e0a9-e50e24dcca9e"
]
},
{
"adapter": "kingsong",
"00001800-0000-1000-8000-00805f9b34fb": [
"00002a00-0000-1000-8000-00805f9b34fb",
"00002a01-0000-1000-8000-00805f9b34fb",
"00002a04-0000-1000-8000-00805f9b34fb",
"00002aa6-0000-1000-8000-00805f9b34fb"
],
"00001801-0000-1000-8000-00805f9b34fb": [],
"0000ffa0-0000-1000-8000-00805f9b34fb": [
"0000ffa1-0000-1000-8000-00805f9b34fb",
"0000ffa9-0000-1000-8000-00805f9b34fb"
],
"0000ffe0-0000-1000-8000-00805f9b34fb": [
"0000ffe1-0000-1000-8000-00805f9b34fb"
],
"0000fff0-0000-1000-8000-00805f9b34fb": [
"0000fff1-0000-1000-8000-00805f9b34fb"
]
},
{
"adapter": "ninebot",
"00001800-0000-1000-8000-00805f9b34fb": [
"00002a00-0000-1000-8000-00805f9b34fb",
"00002a01-0000-1000-8000-00805f9b34fb",
"00002a04-0000-1000-8000-00805f9b34fb",
"00002aa6-0000-1000-8000-00805f9b34fb"
],
"00001801-0000-1000-8000-00805f9b34fb": [],
"0000ffa0-0000-1000-8000-00805f9b34fb": [
"0000ffa1-0000-1000-8000-00805f9b34fb",
"0000ffa2-0000-1000-8000-00805f9b34fb"
],
"0000ffe0-0000-1000-8000-00805f9b34fb": [
"0000ffe1-0000-1000-8000-00805f9b34fb"
]
},
{
"adapter": "ninebot_z",
"00001800-0000-1000-8000-00805f9b34fb": [
"00002a00-0000-1000-8000-00805f9b34fb",
"00002a01-0000-1000-8000-00805f9b34fb",
"00002a04-0000-1000-8000-00805f9b34fb",
"00002aa6-0000-1000-8000-00805f9b34fb"
],
"00001801-0000-1000-8000-00805f9b34fb": [],
"0000ffa0-0000-1000-8000-00805f9b34fb": [
"0000ffa1-0000-1000-8000-00805f9b34fb",
"0000ffa3-0000-1000-8000-00805f9b34fb"
],
"6e400001-b5a3-f393-e0a9-e50e24dcca9e": [
"6e400003-b5a3-f393-e0a9-e50e24dcca9e",
"6e400002-b5a3-f393-e0a9-e50e24dcca9e"
]
},
{
"adapter": "ninebot_z",
"00001800-0000-1000-8000-00805f9b34fb": [
"00002a00-0000-1000-8000-00805f9b34fb",
"00002a01-0000-1000-8000-00805f9b34fb",
"00002a04-0000-1000-8000-00805f9b34fb",
"00002aa6-0000-1000-8000-00805f9b34fb"
],
"00001801-0000-1000-8000-00805f9b34fb": [],
"0000ffa0-0000-1000-8000-00805f9b34fb": [
"0000ffa1-0000-1000-8000-00805f9b34fb",
"0000ffa4-0000-1000-8000-00805f9b34fb"
],
"6e400001-b5a3-f393-e0a9-e50e24dcca9e": [
"6e400003-b5a3-f393-e0a9-e50e24dcca9e",
"6e400002-b5a3-f393-e0a9-e50e24dcca9e"
]
}
]