mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-01-17 13:17:33 +01:00
Fossil Hybrid: send response to app events
This commit is contained in:
parent
2b1fb0e342
commit
f1034f94b3
@ -70,6 +70,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fos
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.file.FileLookupRequest;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.notification.PlayCallNotificationRequest;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.notification.PlayTextNotificationRequest;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.async.ConfirmAppStatusRequest;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.authentication.VerifyPrivateKeyRequest;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.buttons.ButtonConfiguration;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.buttons.ButtonConfigurationPutRequest;
|
||||
@ -1076,6 +1077,8 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
||||
Intent menuIntent = new Intent(QHybridSupport.QHYBRID_EVENT_COMMUTE_MENU);
|
||||
menuIntent.putExtra("EXTRA_ACTION", action);
|
||||
getContext().sendBroadcast(menuIntent);
|
||||
} else if (request.has("master._.config.app_status")) {
|
||||
queueWrite(new ConfirmAppStatusRequest(requestId, this));
|
||||
} else {
|
||||
logger.warn("Unhandled request from watch: " + requestJson.toString());
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.async;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.adapter.fossil_hr.FossilHRWatchAdapter;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.json.JsonPutRequest;
|
||||
|
||||
public class ConfirmAppStatusRequest extends JsonPutRequest {
|
||||
public ConfirmAppStatusRequest(int requestId, FossilHRWatchAdapter adapter) {
|
||||
super(createResponseObject(requestId), adapter);
|
||||
}
|
||||
|
||||
private static JSONObject createResponseObject(int requestId){
|
||||
try {
|
||||
return new JSONObject()
|
||||
.put("res",
|
||||
new JSONObject()
|
||||
.put("id", requestId)
|
||||
.put("set", new JSONObject()
|
||||
.put("master._.config.app_status", new JSONObject()
|
||||
.put("message", "")
|
||||
.put("type", "success")
|
||||
)
|
||||
)
|
||||
);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user