1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2025-01-15 12:17:33 +01:00

added menu request

This commit is contained in:
dakhnod 2019-12-31 03:13:13 +01:00
parent 6f012c2109
commit 541561e247

View File

@ -0,0 +1,30 @@
package nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.menu;
import org.json.JSONException;
import org.json.JSONObject;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.adapter.fossil.FossilWatchAdapter;
import nodomain.freeyourgadget.gadgetbridge.service.devices.qhybrid.requests.fossil_hr.json.JsonPutRequest;
public class SetCommuteMenuMessage extends JsonPutRequest {
public SetCommuteMenuMessage(String message, boolean finished, FossilWatchAdapter adapter) {
super((short) 0x0500, createObject(message, finished), adapter);
}
private static JSONObject createObject(String message, boolean finished) {
try {
return new JSONObject()
.put("push", new JSONObject()
.put("set", new JSONObject()
.put("commuteApp._.config.commute_info", new JSONObject()
.put("message", message)
.put("type", finished ? "end" : "in_progress")
)
)
);
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
}