mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-11 17:41:57 +01:00
Fossil HR: Implement Find Phone
There is still no acknowledgement, so if the watch gets a timeout it cant stop the phone from ringing anymore. If you stop ringing from the watch during before the timeout hits, stopping works...
This commit is contained in:
parent
23f4752296
commit
0a4d8499fa
@ -26,6 +26,7 @@ import java.util.Iterator;
|
|||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventFindPhone;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventMusicControl;
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventMusicControl;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.qhybrid.HRConfigActivity;
|
import nodomain.freeyourgadget.gadgetbridge.devices.qhybrid.HRConfigActivity;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.qhybrid.NotificationHRConfiguration;
|
import nodomain.freeyourgadget.gadgetbridge.devices.qhybrid.NotificationHRConfiguration;
|
||||||
@ -535,10 +536,26 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
handleMusicRequest(value);
|
handleMusicRequest(value);
|
||||||
} else if (requestType == (byte) 0x01) {
|
} else if (requestType == (byte) 0x01) {
|
||||||
int eventId = value[2];
|
int eventId = value[2];
|
||||||
|
logger.info("got event id " + eventId);
|
||||||
try {
|
try {
|
||||||
JSONObject requestJson = new JSONObject(new String(value, 3, value.length - 3));
|
String jsonString = new String(value, 3, value.length - 3);
|
||||||
|
logger.info(jsonString);
|
||||||
|
JSONObject requestJson = new JSONObject(jsonString);
|
||||||
|
|
||||||
|
if (requestJson.getJSONObject("req").has("ringMyPhone")) {
|
||||||
|
String action = requestJson.getJSONObject("req").getJSONObject("ringMyPhone").getString("action");
|
||||||
|
logger.info("got ringMyPhone request; " + action);
|
||||||
|
GBDeviceEventFindPhone findPhoneEvent = new GBDeviceEventFindPhone();
|
||||||
|
if ("on".equals(action)) {
|
||||||
|
findPhoneEvent.event = GBDeviceEventFindPhone.Event.START;
|
||||||
|
getDeviceSupport().evaluateGBDeviceEvent(findPhoneEvent);
|
||||||
|
}
|
||||||
|
else if ("off".equals(action)) {
|
||||||
|
findPhoneEvent.event = GBDeviceEventFindPhone.Event.STOP;
|
||||||
|
getDeviceSupport().evaluateGBDeviceEvent(findPhoneEvent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
String action = requestJson.getJSONObject("req").getJSONObject("commuteApp._.config.commute_info")
|
String action = requestJson.getJSONObject("req").getJSONObject("commuteApp._.config.commute_info")
|
||||||
.getString("dest");
|
.getString("dest");
|
||||||
|
|
||||||
@ -555,6 +572,7 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
Intent menuIntent = new Intent(QHybridSupport.QHYBRID_EVENT_COMMUTE_MENU);
|
Intent menuIntent = new Intent(QHybridSupport.QHYBRID_EVENT_COMMUTE_MENU);
|
||||||
menuIntent.putExtra("EXTRA_ACTION", action);
|
menuIntent.putExtra("EXTRA_ACTION", action);
|
||||||
getContext().sendBroadcast(menuIntent);
|
getContext().sendBroadcast(menuIntent);
|
||||||
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user