reformat code with androidstudio

live-sensor-data
Andreas Shimokawa 2015-04-14 10:29:09 +02:00
parent dbb0d85165
commit 7ad1bfbdb1
7 changed files with 17 additions and 20 deletions

View File

@ -10,7 +10,7 @@ public abstract class AbstractBTDeviceSupport extends AbstractDeviceSupport {
protected abstract GBDeviceProtocol createDeviceProtocol(); protected abstract GBDeviceProtocol createDeviceProtocol();
protected abstract GBDeviceIoThread createDeviceIOThread(); protected abstract GBDeviceIoThread createDeviceIOThread();
@Override @Override
public void dispose() { public void dispose() {
// currently only one thread allowed // currently only one thread allowed
@ -24,27 +24,27 @@ public abstract class AbstractBTDeviceSupport extends AbstractDeviceSupport {
gbDeviceIOThread = null; gbDeviceIOThread = null;
} }
} }
public synchronized GBDeviceProtocol getDeviceProtocol() { public synchronized GBDeviceProtocol getDeviceProtocol() {
if (gbDeviceProtocol == null) { if (gbDeviceProtocol == null) {
gbDeviceProtocol = createDeviceProtocol(); gbDeviceProtocol = createDeviceProtocol();
} }
return gbDeviceProtocol; return gbDeviceProtocol;
} }
public synchronized GBDeviceIoThread getDeviceIOThread() { public synchronized GBDeviceIoThread getDeviceIOThread() {
if (gbDeviceIOThread == null) { if (gbDeviceIOThread == null) {
gbDeviceIOThread = createDeviceIOThread(); gbDeviceIOThread = createDeviceIOThread();
} }
return gbDeviceIOThread; return gbDeviceIOThread;
} }
protected void sendToDevice(byte[] bytes) { protected void sendToDevice(byte[] bytes) {
if (bytes != null && gbDeviceIOThread != null) { if (bytes != null && gbDeviceIOThread != null) {
gbDeviceIOThread.write(bytes); gbDeviceIOThread.write(bytes);
} }
} }
@Override @Override
public void onSMS(String from, String body) { public void onSMS(String from, String body) {
byte[] bytes = gbDeviceProtocol.encodeSMS(from, body); byte[] bytes = gbDeviceProtocol.encodeSMS(from, body);

View File

@ -1,9 +1,7 @@
package nodomain.freeyourgadget.gadgetbridge; package nodomain.freeyourgadget.gadgetbridge;
public abstract class AbstractBTLEDeviceSupport extends AbstractDeviceSupport { public abstract class AbstractBTLEDeviceSupport extends AbstractDeviceSupport {
} }

View File

@ -13,17 +13,17 @@ public abstract class AbstractDeviceSupport implements DeviceSupport {
this.btAdapter = btAdapter; this.btAdapter = btAdapter;
this.context = context; this.context = context;
} }
@Override @Override
public GBDevice getDevice() { public GBDevice getDevice() {
return gbDevice; return gbDevice;
} }
@Override @Override
public BluetoothAdapter getBluetoothAdapter() { public BluetoothAdapter getBluetoothAdapter() {
return btAdapter; return btAdapter;
} }
@Override @Override
public Context getContext() { public Context getContext() {
return context; return context;

View File

@ -1,9 +1,5 @@
package nodomain.freeyourgadget.gadgetbridge; 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.NotificationManager;
import android.app.Service; import android.app.Service;
import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter;
@ -20,6 +16,11 @@ import android.provider.ContactsContract;
import android.util.Log; import android.util.Log;
import android.widget.Toast; 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 class BluetoothCommunicationService extends Service {
public static final String ACTION_START public static final String ACTION_START
= "nodomain.freeyourgadget.gadgetbride.bluetoothcommunicationservice.action.start"; = "nodomain.freeyourgadget.gadgetbride.bluetoothcommunicationservice.action.start";

View File

@ -5,13 +5,13 @@ import android.content.Context;
public interface DeviceSupport extends EventHandler { public interface DeviceSupport extends EventHandler {
public void initialize(GBDevice gbDevice, BluetoothAdapter btAdapter, Context context); public void initialize(GBDevice gbDevice, BluetoothAdapter btAdapter, Context context);
public boolean connect(); public boolean connect();
public GBDevice getDevice(); public GBDevice getDevice();
public BluetoothAdapter getBluetoothAdapter(); public BluetoothAdapter getBluetoothAdapter();
public Context getContext(); public Context getContext();
public void dispose(); public void dispose();

View File

@ -8,7 +8,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
@Override @Override
public void dispose() { public void dispose() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
@Override @Override

View File

@ -5,8 +5,6 @@ import nodomain.freeyourgadget.gadgetbridge.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.GBDeviceIoThread; import nodomain.freeyourgadget.gadgetbridge.GBDeviceIoThread;
import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceProtocol; import nodomain.freeyourgadget.gadgetbridge.protocol.GBDeviceProtocol;
import nodomain.freeyourgadget.gadgetbridge.protocol.PebbleProtocol; import nodomain.freeyourgadget.gadgetbridge.protocol.PebbleProtocol;
import android.bluetooth.BluetoothAdapter;
import android.content.Context;
public class PebbleSupport extends AbstractBTDeviceSupport { public class PebbleSupport extends AbstractBTDeviceSupport {