1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2025-01-17 21:27:31 +01:00

Fossil Hybrid: send response to app events

This commit is contained in:
Daniel Dakhno 2020-10-14 02:00:43 +02:00
parent 2b1fb0e342
commit f1034f94b3
2 changed files with 35 additions and 0 deletions

View File

@ -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.file.FileLookupRequest;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil.notification.PlayCallNotificationRequest; 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.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.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.ButtonConfiguration;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.buttons.ButtonConfigurationPutRequest; 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); 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);
} else if (request.has("master._.config.app_status")) {
queueWrite(new ConfirmAppStatusRequest(requestId, this));
} else { } else {
logger.warn("Unhandled request from watch: " + requestJson.toString()); logger.warn("Unhandled request from watch: " + requestJson.toString());
} }

View File

@ -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;
}
}