How exactly does SimpleWeatherService get weather data? #2200
-
I was hoping to understand better how the SimpleWeatherService gets the weather data from the companion app. I understand that it basically requests a packet of a certain size and then each chunk corresponds to temp, location, etc. After reading the documentation and #2100 I have a decent idea of what is going on but not quite. For example in #2100 sunset and sunrise are on bytes 49,50 and 51,52 but I don't know why. When I look in gadgetbridge's code the only bytes that are defined are the ones Infinitime requests by default. I can see there is code for other characteristics to be requested but unsure as to how it works. How would I get other weather data like dewpoint or feels like? Do I just pick any byte that isn't being used and ask for "feelsliketemp"? I've also read #353 and #1560 but still scratching my head. Yes, my programming knowledge is very rudimentary. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@ForeskinJim for this you need to look at the matching pull request in Gadgetbridge: https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/4011 For the sunrise data, I just added a few more bytes to accomodate that data, right after what was there. The order doesn't matter much, it just needs to be encoded and decoded correctly by both the sender and receiver. Notice in Gadgetbridge that I just put the data in the next adjacent bytes after the existing weather data. If you wanted to add dewpoint, for example, you could add a new version 2 (so that your encoder/decoder knows what to expect) and put an extra byte or two at the end (so |
Beta Was this translation helpful? Give feedback.
@ForeskinJim for this you need to look at the matching pull request in Gadgetbridge: https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/4011
The current buffer for weather data is 48 bytes (plus a
\0
orNULL
character to end the array). This is the case in both Gadgetbridge and InfiniTime, so sending the data to the watch means filling that array with data data described in the documentation.For the sunrise data, I just added a few more bytes to accomodate that data, right after what was there. The order doesn't matter much, it just needs to be encoded and decoded correctly by both the sender and receiver. Notice in Gadgetbridge that I just put the data in the next adjacent bytes aft…