Add event "test new function" for the debug screen
This commit is contained in:
parent
b1dcb997bb
commit
713989ef38
|
@ -66,4 +66,6 @@ public interface EventHandler {
|
|||
void onAddCalendarEvent(CalendarEventSpec calendarEventSpec);
|
||||
|
||||
void onDeleteCalendarEvent(byte type, long id);
|
||||
|
||||
void onTestNewFunction();
|
||||
}
|
||||
|
|
|
@ -280,4 +280,10 @@ public class GBDeviceService implements DeviceService {
|
|||
.putExtra(EXTRA_CALENDAREVENT_ID, id);
|
||||
invokeService(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTestNewFunction() {
|
||||
Intent intent = createIntent().setAction(ACTION_TEST_NEW_FUNCTION);
|
||||
invokeService(intent);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ public interface DeviceService extends EventHandler {
|
|||
String ACTION_HEARTRATE_MEASUREMENT = PREFIX + ".action.hr_measurement";
|
||||
String ACTION_ADD_CALENDAREVENT = PREFIX + ".action.add_calendarevent";
|
||||
String ACTION_DELETE_CALENDAREVENT = PREFIX + ".action.delete_calendarevent";
|
||||
String ACTION_TEST_NEW_FUNCTION = PREFIX + ".action.test_new_function";
|
||||
String EXTRA_DEVICE_ADDRESS = "device_address";
|
||||
String EXTRA_NOTIFICATION_BODY = "notification_body";
|
||||
String EXTRA_NOTIFICATION_FLAGS = "notification_flags";
|
||||
|
|
|
@ -80,6 +80,7 @@ import static nodomain.freeyourgadget.gadgetbridge.model.DeviceService.ACTION_SE
|
|||
import static nodomain.freeyourgadget.gadgetbridge.model.DeviceService.ACTION_SET_CONSTANT_VIBRATION;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.model.DeviceService.ACTION_START;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.model.DeviceService.ACTION_STARTAPP;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.model.DeviceService.ACTION_TEST_NEW_FUNCTION;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.model.DeviceService.EXTRA_ALARMS;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.model.DeviceService.EXTRA_APP_CONFIG;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.model.DeviceService.EXTRA_APP_START;
|
||||
|
@ -484,6 +485,10 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
|
|||
mDeviceSupport.onEnableRealtimeHeartRateMeasurement(enable);
|
||||
break;
|
||||
}
|
||||
case ACTION_TEST_NEW_FUNCTION: {
|
||||
mDeviceSupport.onTestNewFunction();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return START_STICKY;
|
||||
|
|
|
@ -319,4 +319,12 @@ public class ServiceDeviceSupport implements DeviceSupport {
|
|||
}
|
||||
delegate.onDeleteCalendarEvent(type, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTestNewFunction() {
|
||||
if (checkBusy("test new function event")) {
|
||||
return;
|
||||
}
|
||||
delegate.onTestNewFunction();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1206,5 +1206,7 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onTestNewFunction() {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1212,5 +1212,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onTestNewFunction() {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,4 +147,11 @@ public class PebbleSupport extends AbstractSerialDeviceSupport {
|
|||
super.onDeleteCalendarEvent(type, id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTestNewFunction() {
|
||||
if (reconnect()) {
|
||||
super.onTestNewFunction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -269,7 +269,10 @@ public class VibratissimoSupport extends AbstractBTLEDeviceSupport {
|
|||
|
||||
LOG.info("Unhandled characteristic read: " + characteristicUUID);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTestNewFunction() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -214,4 +214,10 @@ public abstract class AbstractSerialDeviceSupport extends AbstractDeviceSupport
|
|||
byte[] bytes = gbDeviceProtocol.encodeDeleteCalendarEvent(type, id);
|
||||
sendToDevice(bytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTestNewFunction() {
|
||||
byte[] bytes = gbDeviceProtocol.encodeTestNewFunction();
|
||||
sendToDevice(bytes);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,6 +94,8 @@ public abstract class GBDeviceProtocol {
|
|||
return null;
|
||||
}
|
||||
|
||||
public byte[] encodeTestNewFunction() { return null; }
|
||||
|
||||
public GBDeviceEvent[] decodeResponse(byte[] responseData) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -167,4 +167,9 @@ public class TestDeviceSupport extends AbstractDeviceSupport {
|
|||
public void onEnableRealtimeHeartRateMeasurement(boolean enable) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTestNewFunction() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue