jakkra / ZSWatch

ZSWatch - the Open Source Zephyrâ„¢ based Smartwatch, including both HW and FW.
https://forms.gle/G48Sm5zDe9aCaYtT9
GNU General Public License v3.0
2.26k stars 191 forks source link

API for HTTP requests to Gadgetbridge #169

Closed jakkra closed 3 months ago

jakkra commented 8 months ago

Abstract away the packet formatting and GB response parsing. Maybe add re-try mechanisms in case GadgetBridge is unreliable.

For example:

For the id see https://www.espruino.com/Gadgetbridge#messages-from-bangle-js-to-phone

rsp_cb(id, return_code, data); // return code OK, ERROR, Timoeut for example.
zsw_ble_http_get(patch, id, rsp_cb);
zsw_ble_http_abort(id); // Not sure if needed if an app is closed. Probably can just ignore the response