mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-26 02:25:50 +01:00
Remove reference to PebbleIOThread from BluetoothCommunicationService
Let PebbleSupport do this instead.
This commit is contained in:
parent
3fe9195d0d
commit
f6d5767276
@ -63,7 +63,6 @@ public class BluetoothCommunicationService extends Service {
|
|||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(BluetoothCommunicationService.class);
|
private static final Logger LOG = LoggerFactory.getLogger(BluetoothCommunicationService.class);
|
||||||
public static final String EXTRA_DEVICE_ADDRESS = "device_address";
|
public static final String EXTRA_DEVICE_ADDRESS = "device_address";
|
||||||
private GBDeviceIoThread mGBDeviceIoThread = null;
|
|
||||||
|
|
||||||
private boolean mStarted = false;
|
private boolean mStarted = false;
|
||||||
|
|
||||||
@ -166,9 +165,6 @@ public class BluetoothCommunicationService extends Service {
|
|||||||
} else {
|
} else {
|
||||||
mDeviceSupport.connect();
|
mDeviceSupport.connect();
|
||||||
}
|
}
|
||||||
if (mDeviceSupport instanceof AbstractBTDeviceSupport) {
|
|
||||||
mGBDeviceIoThread = ((AbstractBTDeviceSupport) mDeviceSupport).getDeviceIOThread();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Toast.makeText(this, R.string.cannot_connect_bt_address_invalid_, Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, R.string.cannot_connect_bt_address_invalid_, Toast.LENGTH_SHORT).show();
|
||||||
@ -246,7 +242,7 @@ public class BluetoothCommunicationService extends Service {
|
|||||||
String uriString = intent.getStringExtra("app_uri");
|
String uriString = intent.getStringExtra("app_uri");
|
||||||
if (uriString != null) {
|
if (uriString != null) {
|
||||||
LOG.info("will try to install app");
|
LOG.info("will try to install app");
|
||||||
((PebbleIoThread) mGBDeviceIoThread).installApp(Uri.parse(uriString));
|
mDeviceSupport.onInstallApp(Uri.parse(uriString));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_START:
|
case ACTION_START:
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package nodomain.freeyourgadget.gadgetbridge;
|
package nodomain.freeyourgadget.gadgetbridge;
|
||||||
|
|
||||||
|
import android.net.Uri;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public interface EventHandler {
|
public interface EventHandler {
|
||||||
@ -19,6 +22,8 @@ public interface EventHandler {
|
|||||||
|
|
||||||
void onBatteryInfoReq();
|
void onBatteryInfoReq();
|
||||||
|
|
||||||
|
void onInstallApp(Uri uri);
|
||||||
|
|
||||||
void onAppInfoReq();
|
void onAppInfoReq();
|
||||||
|
|
||||||
void onAppStart(UUID uuid);
|
void onAppStart(UUID uuid);
|
||||||
@ -30,5 +35,4 @@ public interface EventHandler {
|
|||||||
void onFetchActivityData();
|
void onFetchActivityData();
|
||||||
|
|
||||||
void onReboot();
|
void onReboot();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,14 @@ package nodomain.freeyourgadget.gadgetbridge.miband;
|
|||||||
import android.bluetooth.BluetoothGatt;
|
import android.bluetooth.BluetoothGatt;
|
||||||
import android.bluetooth.BluetoothGattCharacteristic;
|
import android.bluetooth.BluetoothGattCharacteristic;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.net.Uri;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.URI;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
@ -380,6 +382,11 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onInstallApp(Uri uri) {
|
||||||
|
// not supported
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAppInfoReq() {
|
public void onAppInfoReq() {
|
||||||
// not supported
|
// not supported
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package nodomain.freeyourgadget.gadgetbridge.pebble;
|
package nodomain.freeyourgadget.gadgetbridge.pebble;
|
||||||
|
|
||||||
|
import android.net.Uri;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.AbstractBTDeviceSupport;
|
import nodomain.freeyourgadget.gadgetbridge.AbstractBTDeviceSupport;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBDeviceIoThread;
|
import nodomain.freeyourgadget.gadgetbridge.GBDeviceIoThread;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceProtocol;
|
import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceProtocol;
|
||||||
@ -26,4 +30,14 @@ public class PebbleSupport extends AbstractBTDeviceSupport {
|
|||||||
public boolean useAutoConnect() {
|
public boolean useAutoConnect() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onInstallApp(Uri uri) {
|
||||||
|
getDeviceIOThread().installApp(uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public synchronized PebbleIoThread getDeviceIOThread() {
|
||||||
|
return (PebbleIoThread) super.getDeviceIOThread();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user