reformat code with androidstudio
parent
dbb0d85165
commit
7ad1bfbdb1
|
@ -10,7 +10,7 @@ public abstract class AbstractBTDeviceSupport extends AbstractDeviceSupport {
|
|||
protected abstract GBDeviceProtocol createDeviceProtocol();
|
||||
|
||||
protected abstract GBDeviceIoThread createDeviceIOThread();
|
||||
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
// currently only one thread allowed
|
||||
|
@ -24,27 +24,27 @@ public abstract class AbstractBTDeviceSupport extends AbstractDeviceSupport {
|
|||
gbDeviceIOThread = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public synchronized GBDeviceProtocol getDeviceProtocol() {
|
||||
if (gbDeviceProtocol == null) {
|
||||
gbDeviceProtocol = createDeviceProtocol();
|
||||
}
|
||||
return gbDeviceProtocol;
|
||||
}
|
||||
|
||||
|
||||
public synchronized GBDeviceIoThread getDeviceIOThread() {
|
||||
if (gbDeviceIOThread == null) {
|
||||
gbDeviceIOThread = createDeviceIOThread();
|
||||
}
|
||||
return gbDeviceIOThread;
|
||||
}
|
||||
|
||||
|
||||
protected void sendToDevice(byte[] bytes) {
|
||||
if (bytes != null && gbDeviceIOThread != null) {
|
||||
gbDeviceIOThread.write(bytes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onSMS(String from, String body) {
|
||||
byte[] bytes = gbDeviceProtocol.encodeSMS(from, body);
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package nodomain.freeyourgadget.gadgetbridge;
|
||||
|
||||
|
||||
|
||||
public abstract class AbstractBTLEDeviceSupport extends AbstractDeviceSupport {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -13,17 +13,17 @@ public abstract class AbstractDeviceSupport implements DeviceSupport {
|
|||
this.btAdapter = btAdapter;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public GBDevice getDevice() {
|
||||
return gbDevice;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BluetoothAdapter getBluetoothAdapter() {
|
||||
return btAdapter;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Context getContext() {
|
||||
return context;
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
package nodomain.freeyourgadget.gadgetbridge;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBDevice.State;
|
||||
import nodomain.freeyourgadget.gadgetbridge.miband.MiBandSupport;
|
||||
import nodomain.freeyourgadget.gadgetbridge.pebble.PebbleIoThread;
|
||||
import nodomain.freeyourgadget.gadgetbridge.pebble.PebbleSupport;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.Service;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
|
@ -20,6 +16,11 @@ import android.provider.ContactsContract;
|
|||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBDevice.State;
|
||||
import nodomain.freeyourgadget.gadgetbridge.miband.MiBandSupport;
|
||||
import nodomain.freeyourgadget.gadgetbridge.pebble.PebbleIoThread;
|
||||
import nodomain.freeyourgadget.gadgetbridge.pebble.PebbleSupport;
|
||||
|
||||
public class BluetoothCommunicationService extends Service {
|
||||
public static final String ACTION_START
|
||||
= "nodomain.freeyourgadget.gadgetbride.bluetoothcommunicationservice.action.start";
|
||||
|
|
|
@ -5,13 +5,13 @@ import android.content.Context;
|
|||
|
||||
public interface DeviceSupport extends EventHandler {
|
||||
public void initialize(GBDevice gbDevice, BluetoothAdapter btAdapter, Context context);
|
||||
|
||||
|
||||
public boolean connect();
|
||||
|
||||
public GBDevice getDevice();
|
||||
|
||||
|
||||
public BluetoothAdapter getBluetoothAdapter();
|
||||
|
||||
|
||||
public Context getContext();
|
||||
|
||||
public void dispose();
|
||||
|
|
|
@ -8,7 +8,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
|||
@Override
|
||||
public void dispose() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,8 +5,6 @@ import nodomain.freeyourgadget.gadgetbridge.GBDevice;
|
|||
import nodomain.freeyourgadget.gadgetbridge.GBDeviceIoThread;
|
||||
import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceProtocol;
|
||||
import nodomain.freeyourgadget.gadgetbridge.protocol.PebbleProtocol;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.content.Context;
|
||||
|
||||
public class PebbleSupport extends AbstractBTDeviceSupport {
|
||||
|
||||
|
|
Loading…
Reference in New Issue