1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-06-01 19:06:06 +02:00
Commit Graph

215 Commits

Author SHA1 Message Date
José Rebelo
aacee56f39 Refactor location service 2024-04-24 23:32:48 +01:00
Marcel Alexandru Nitan
2190c82ed7 feature: Sleep as android support
Implement support for Sleep As Android with an usable example for ZeppOs
devices

Sleep as Android documentation:

https://docs.sleep.urbandroid.org/devs/wearable_api.html

Signed-off-by: Marcel Alexandru Nitan <nitan.marcel@protonmail.com>
2024-04-20 12:15:42 +03:00
José Rebelo
81aef0bf35 Add support for multiple weather locations
Introduce the concept of primary and secondary weathers:

* Primary weather keeps the same behavior as previously across all weather providers, so it's non-breaking. This location is not necessarily the current location, just the primary weather location set by the user.
* The GenericWeatherReceiver now has a new extra WeatherSecondaryJson, that receives a json list with secondary weather locations.

It's guaranteed that the primary weather always exists, so the list of WeatherSpecs provided to devices is never empty. Update all support classes accordingly.
2024-03-29 21:10:40 +00:00
José Rebelo
58d4ebf509 Huami: Refactor activity data fetching
Activity data fetching on Huami devices was filled with duplicated code,
and the handleActivityFetchFinish was called from multiple places where
it did not make sense. This made us signal to the band that activity
fetch was finished when it sometimes was not, causing some race
condititions that would make activity fetch fail or get stuck.

This refactor defines a clear "processBufferedData" that is called
upstream, signaling to the fetch operation that we have received all
data and the buffer can be processed. All handling of metadata and ack
messages is also delegated to the upstream class.
2024-02-25 13:10:25 +00:00
José Rebelo
9b0229cdf0 Huami: Split fetch, init and update operations 2024-02-25 13:10:25 +00:00
José Rebelo
dbfb8e5c38 Zepp OS: Improve logging
- Do not log characteristic changes handled by parent class
- Log discovered service names
- Request and log supported config groups
2024-02-01 18:48:15 +00:00
José Rebelo
773132c4e1 Make all Zepp OS classes explicit
There are still some actual "Huami 2021" classes that are used in
non-ZeppOS devices, but this refactor improves the distinction.
2024-01-29 23:30:28 +00:00
FYG_license_bot_ignore_me
4c7476845b Update license headers and CONTRIBUTORS file 2024-01-10 19:01:48 +01:00
José Rebelo
aeec68aeef Huami: Fetch SpO2 on devices that support it 2024-01-09 17:43:43 +00:00
José Rebelo
4dbf9bb8ac Huami: Toggle phone silent mode from band 2023-12-11 10:50:31 +00:00
José Rebelo
4d12ac93e7 Allow multiple device actions to be triggered for the same event 2023-12-09 11:40:28 +00:00
MrYoranimo
435d41aca0 Huami/Xiaomi: centralize handling of device state events
Gadgetbridge can be configured to perform an action when a
Huami device is taken off or the user was detected to fall asleep or
wake up. This functionality was specific to Huami devices, but this
changeset moves this upstream to the AbstractDeviceSupport class in
combination with new GBDeviceEvents.

Now that the ADS has centralized support for this functionality, the
same logic can be used for other devices. In this case, an
implementation is added for supported Xiaomi devices.
2023-12-09 00:20:22 +01:00
José Rebelo
f090898aef Zepp OS: Add statistics fetch operation
We do not know what they are or how to parse them, but syncing them
helps free up space from the band.
2023-10-18 16:17:41 +01:00
José Rebelo
5a65bbf8f4 Zepp OS: Add temperature fetch operation (no DB / UI) 2023-10-18 15:46:58 +01:00
Daniel Dakhno
b97b26ce3a Device manager: moved device icons and name to Coordinator 2023-09-28 00:11:02 +03:00
José Rebelo
564cb1bfcc Introduce WeatherSpec v4
New fields for current weather:

- dewPoint
- pressure
- cloudCover
- visibility
- sunRise
- sunSet
- moonRise
- moonSet
- moonPhase
- airQuality
- latitude
- longitude
- feelsLikeTemp
- isCurrentLocation

New fields for daily forecast:

Deprecate the old "Forecast" class, which was not versioned, but keep it for backwards compatibility with old apps. Old WeatherSpec forecasts are de-serialized into the new Daily class. New fields:

- windSpeed
- windDirection
- uvIndex
- precipProbability
- sunRise
- sunSet
- moonRise
- moonSet
- moonPhase
- airQuality

Add hourly values:
- timestamp
- temp
- conditionCode
- humidity
- windSpeed
- windDirection
- uvIndex
- precipProbability

Air Quality:
- aqi (plume)
- co
- no2
- o3
- pm10
- pm25
- so2
- coAqi
- no2Aqi
- o3Aqi
- pm10Aqi
- pm25Aqi
- so2Aqi
2023-08-27 15:13:57 +00:00
José Rebelo
c01a33077e Huami: Enforce a maximum of 16 items on the main screen 2023-08-25 13:58:32 +01:00
José Rebelo
247a954920 Huami/Zepp OS: Improve reconnection
- Remove notification on unneeded characteristics for Zepp OS devices
- Reset MTU before initializing device, since the support class is
  reused when reconnecting, and keeping the previous high MTU before
  renegotiating again can make the initialization fail sometimes
  (band will never reply)
- If any of the chunked characteristics is null during initialization,
  mark the device as waiting for reconnect, which will make it retry the
  connection later with a backoff delay.
2023-07-22 20:31:26 +01:00
José Rebelo
76576af324 Huami 2021: Do not initialize device for chunked ack
Since we now handle chunked acks as of 74dac3f5c, these may happen
during device initialization. We must not use performInitialized, or
initializeDevice will be called twice, since the device will still not
be in INITIALIZING state.
2023-07-22 13:50:54 +01:00
José Rebelo
da5f91f05b Huami/Zepp OS: Improve music info stability 2023-07-09 15:16:37 +01:00
José Rebelo
e95c8a3775 Add PAI charts 2023-07-02 16:05:10 +01:00
José Rebelo
88b7cd5756 Add stress charts 2023-06-17 17:28:11 +01:00
José Rebelo
9d3c480414 Zepp OS: Refactor config, display items, reminders and http to standalone services 2023-06-16 20:43:07 +01:00
José Rebelo
74dac3f5cd Huami 2021: Handle chunked ACKs 2023-06-14 15:45:49 +00:00
Andreas Shimokawa
f80b873866 Prefs: make allow high MTU default to true.
It is 2023, it should work, if not it can be turned off.

For newer devices with big firmwares and apps (like Mi Band 7), people just wonder how slow Gadgetbridge installs stuff...
2023-06-14 16:44:51 +02:00
Damien 'Psolyca' Gaignon
a3c0e10330
Add GBDevice argument to getAlarmSlotCount 2023-06-13 23:10:55 +02:00
José Rebelo
d77a32a430 Zepp OS: Add code to toggle raw sensor data 2023-06-10 19:07:00 +01:00
José Rebelo
a3c59b0e0e Zepp OS: Add experimental sync of SpO2, stress, PAI, HR stats and sleep respiratory rate 2023-06-10 17:19:22 +01:00
José Rebelo
e55a35eced Huami: Persist sleep respiratory rate data 2023-05-27 19:03:43 +01:00
José Rebelo
a1e07b5d1b Huami: Persist PAI samples 2023-05-27 19:02:01 +01:00
José Rebelo
24f78655c2 Huami: Persist heart rate max, resting and manual samples 2023-05-27 18:59:12 +01:00
José Rebelo
3f87bfadd4 Huami: Add queued fetch operations 2023-05-22 22:15:35 +00:00
José Rebelo
07357305cb Huami: Unify recorded data fetching in HuamiSupport 2023-05-20 20:44:18 +01:00
José Rebelo
e1cccd6953 Zepp OS: Refactor code for alarms, notifications, calendar, canned messages 2023-05-10 23:33:23 +01:00
José Rebelo
ac002f8db9 Zepp OS: Fix activate display upon lift wrist smart mode 2023-03-19 22:11:39 +00:00
Arjan Schrijver
b1d03e9f7a Clean up duplicated unimplemented methods from device support classes
Moved to AbstractDeviceSupport so each device support class can override them if required. This change helps to keep the code base clean by not requiring every (Device)Support class to implement these methods even when they don't need them.
2023-01-05 22:11:32 +01:00
José Rebelo
b51328e4f2 Huami: Fix payload when setting the time
Fixes #2999
2022-12-15 21:38:06 +00:00
uli
6cf079e55b adapt HuamiSupport to updated BLE Time handling 2022-12-12 15:04:45 +00:00
uli
5097327234 add local time service to PineTime, fixed standard ble format 2022-12-12 15:04:45 +00:00
musover
4386f321a3 Fixed regression undoing PR #2474, notification content preserved for Amazfit GTS 2 Mini 2022-12-12 07:49:26 +00:00
José Rebelo
2a47dc863a Huami: Allow activity fetch timestamps to be sent in seconds 2022-11-07 19:37:28 +01:00
José Rebelo
164c5e52a4 Zepp OS: Add World Clocks 2022-11-07 10:31:41 +01:00
José Rebelo
cd59511aad Zepp OS: Refactor config, fix health on GTR 3 and GTS 3
The config refactor in addf7ff6a broke health settings on GTR3 and GTS3

- GTS 3 and GTR 3 health configs use protocol v1. The only difference
  seems to be that the steps goal is a SHORT instead of an INT.
- It needs a refactoring from the ground up to better handle different
  versions, but this is enough to get the GTR 3 and GTS 3 working.
2022-10-29 14:17:40 +01:00
José Rebelo
6cc3579e9c Zepp OS: Refactor file upload, fix notification icons > 56x56px
- File uploads are split in chunks, with the size dictated by the
  watches. There seem to be 2 protocol versions, without any noticeable
  differences
- Extract the file upload logic to a standalone class. This makes it
  easier to keep track of concurrent requests, each of which have their
  own session id
- Icons larger than 8KB will end up split in multiple chunks - we now
  handle that correctly
- Notification icons are also requested in 2 different formats, but
  the actual encoding seems to be the same, with only a different id
2022-10-28 23:37:22 +01:00
José Rebelo
bc2d5aa16d Zepp OS: Change default fetch operation time unit resolution to minutes
Reverts the default behavior introduced by 1335f0bd8 since it was
causing issues on the GTR 3, but keeps it optional as a developer
option.
2022-10-27 23:51:02 +01:00
José Rebelo
addf7ff6a6 Amazfit GTR 4: Initial support 2022-10-22 22:03:49 +02:00
Andreas Shimokawa
a0ba977cde Revert "remove AndroidThreeTen library, since we have java8 in this branch"
This reverts commit 43eb6bfe0e.

The reason was not only Java8 but this also requires Android 8!
2022-09-28 07:51:10 +02:00
José Rebelo
43b43ab742 Huami: Change default find band vibration pattern
The previous one was too long, now that we loop it.

This one should be a sane default, even for devices that do not support
it (eg. Bip), as the total time is 1.5s.
2022-09-26 18:21:16 +01:00
NekoBox
2df6ce2aed Huami: implement proper find device. 2022-09-26 19:18:41 +02:00
Nathan Philipp Bo Seddig
63b1cffe2a Mi Band 6: Enable adding workout activity types to the "more" section 2022-09-25 19:40:36 +01:00