mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-26 02:25:50 +01:00
Initial support for rebooting the device
(via the Debug activity) Attention: no safety-confirmation dialog yet!
This commit is contained in:
parent
9819819b92
commit
14a05c3383
@ -116,4 +116,9 @@ public abstract class AbstractBTDeviceSupport extends AbstractDeviceSupport {
|
||||
byte[] bytes = gbDeviceProtocol.encodePhoneVersion(os);
|
||||
sendToDevice(bytes);
|
||||
}
|
||||
|
||||
public void onReboot() {
|
||||
byte[] bytes = gbDeviceProtocol.encodeReboot();
|
||||
sendToDevice(bytes);
|
||||
}
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ public class BluetoothCommunicationService extends Service {
|
||||
= "nodomain.freeyourgadget.gadgetbride.bluetoothcommunicationservice.action.deleteapp";
|
||||
public static final String ACTION_INSTALL_PEBBLEAPP
|
||||
= "nodomain.freeyourgadget.gadgetbride.bluetoothcommunicationservice.action.install_pebbbleapp";
|
||||
public static final String ACTION_REBOOT = "nodomain.freeyourgadget.gadgetbride.bluetoothcommunicationservice.action.reboot";
|
||||
public static final String EXTRA_PERFORM_PAIR = "perform_pair";
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(BluetoothCommunicationService.class);
|
||||
@ -191,6 +192,10 @@ public class BluetoothCommunicationService extends Service {
|
||||
mDeviceSupport.onEmail(sender, subject, body);
|
||||
break;
|
||||
}
|
||||
case ACTION_REBOOT: {
|
||||
mDeviceSupport.onReboot();
|
||||
break;
|
||||
}
|
||||
case ACTION_CALLSTATE:
|
||||
GBCommand command = GBCommand.values()[intent.getIntExtra("call_command", 0)]; // UGLY
|
||||
|
||||
|
@ -25,6 +25,7 @@ public class DebugActivity extends Activity {
|
||||
Button testNotificationButton;
|
||||
Button setMusicInfoButton;
|
||||
Button setTimeButton;
|
||||
Button rebootButton;
|
||||
EditText editContent;
|
||||
|
||||
private BroadcastReceiver mReceiver = new BroadcastReceiver() {
|
||||
@ -113,6 +114,16 @@ public class DebugActivity extends Activity {
|
||||
}
|
||||
});
|
||||
|
||||
rebootButton = (Button) findViewById(R.id.rebootButton);
|
||||
rebootButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent startIntent = new Intent(DebugActivity.this, BluetoothCommunicationService.class);
|
||||
startIntent.setAction(BluetoothCommunicationService.ACTION_REBOOT);
|
||||
startService(startIntent);
|
||||
}
|
||||
});
|
||||
|
||||
setMusicInfoButton = (Button) findViewById(R.id.setMusicInfoButton);
|
||||
setMusicInfoButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -22,4 +22,6 @@ public interface EventHandler {
|
||||
void onAppDelete(int id, int index);
|
||||
|
||||
void onPhoneVersion(byte os);
|
||||
|
||||
void onReboot();
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public abstract class GBDeviceProtocol {
|
||||
return null;
|
||||
}
|
||||
|
||||
public GBDeviceCommand decodeResponse(byte[] responseData) {
|
||||
return null;
|
||||
}
|
||||
public byte[] encodeReboot() { return null; }
|
||||
|
||||
public GBDeviceCommand decodeResponse(byte[] responseData) { return null; }
|
||||
}
|
@ -100,4 +100,13 @@
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignEnd="@+id/endCallButton" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="reboot"
|
||||
android:id="@+id/rebootButton"
|
||||
android:layout_above="@+id/setTimeButton"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignEnd="@+id/endCallButton" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
Loading…
Reference in New Issue
Block a user