Introduce a reusable abstract logic for repeated fetch operations.
Add fetch operations for the following:
- Stress (manual and automatic)
- SpO2 (normal and sleep)
- Heart rate (manual and resting)
This affects available features (eg. Alexa). Defaults to the previous
value of "unknown" for now, and no UI. Alexa requires a region where it
is available, such as Germany ("de").
Currently, huami only attempts to fetch activities once.
Since sports activity fetching creates an Operation twice per every fetch, we
need to pass around fetchCount variable to keep track of how many fetches has
occured.
Tested on my Amazfit GTR 4.
Signed-off-by: Oleg Vasilev <me@svin.in>
Mostly copied from the Buds Pro as those earbuds have a similar feature set and mostly the same protocol.
Working:
- Pairing
- Earbud and case battery level
- Finding lost device
- Settings:
- Noise control:
- ANC/ambient/off
- With one earbud
- Voice detect and timeouts
- Ambient sound during calls
- Touch options:
- Touch lock
- Switch noise control, voice assistant, Spotify and volume actions
- Double tap edge
- Equalizer
- Sound balance
- Seamless earbud connection
Can be improved:
- ~~ANC level and ambient sound volume do nothing, and don't seem to be supported on this model as there is no toggle for either in the official app.~~ (fixed: 26a9d274ae)
- Ambient sound customization has more options than on previous models, but I can't implement it properly as I can't really hear any difference between the options (my buds might be the issue though).
- ~~The touch lock toggle is once again inverted, like on the [Buds2](d2c4990c48)~~ (fixed: 21db5390c1).
Untested:
- Settings:
- In-ear detection for calls
- Ambient sound customization
- Game mode
This PR also makes some visual changes to the settings of various Galaxy Buds models.
I'd also like to be added to the wiki's allow list. I want to add the Buds2 and Buds2 Pro to the list of supported devices.
---
And sorry for creating this many pull requests. This is mostly due to Codeberg breaking the reference to the branch.
Co-authored-by: Narek <narek.email@gmail.com>
Reviewed-on: https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/3049
Reviewed-by: José Rebelo <joserebelo@noreply.codeberg.org>
Reviewed-by: Andreas Shimokawa <ashimokawa@noreply.codeberg.org>
Co-authored-by: narektor <narektor@noreply.codeberg.org>
Co-committed-by: narektor <narektor@noreply.codeberg.org>
This tries to use bearing and number of satellites if available. ~~Bangle.js watch currently sets course=NaN in it's implementation of the GPS event handler, so to be of use this needs a small change there as well: [https://github.com/espruino/BangleApps/pull/2504](https://github.com/espruino/BangleApps/pull/2504)~~ Change has been merged.
Please advise on needed changes or oversights, thanks :)
Co-authored-by: Martin Boonk <martin@boonk.info>
Reviewed-on: https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/3026
Co-authored-by: halemmerich <halemmerich@noreply.codeberg.org>
Co-committed-by: halemmerich <halemmerich@noreply.codeberg.org>
Disable manual heart rate measurement - the current implementation in Gadgetbridge seems not really compatible with Bangle.js. There's no way to turn the HRM off when the window is closed, and HRM samples from *any* device would appear to be shown - not just the one that HRM info was requested on
This is done by just comparing the names with already existing devices.
This is only a temporary solution until the discovery of the service
UUID works properly
Removed logging in the DeviceCoordinator, fixed the time setting (day
was off by 1), consolodated many characteristic transactions to one
buidler and queue, and added Find My Device, by just initiating a call.
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.
Switch to only saving 0xCE as sample data, mark additional known data
Remove unused updateSample from testing
Add 0xDD handling
Fix byte comparisons
Add SpO2 parsing, still unused. Cleanup
Clean remaining anomalies
Fix order sign blunder filtering out all data
Remove unproductive/improper debugging prints
The original truncation code caused the null termination of the string
to be dropped, leading to several weird issues on the watch, including
empty notification bodies and firmware crashes.
Since the PR #2961 aswell as #2976, i pushed the changes to this pr.
Original text:
With this PR, the gadgetbridge app sends the current locationd data, obtained from the gps or network provider, to a connected banglejs device as an "gps" event.
The bangle device can use this data instead of the internal gps data. Therefor saving battery energy, since the gps chip is one of the biggest energy consumers.
Furthermore it enables the banglejs device to use the location data, based on the network with which the phone is currently connected. This would be usefull if there is no gps signal.
Updates:
I added a network provider so that it is possible to use the network location. I also overload the start method of GBLocationManager so that it is now possible to select which provider should be used to get the data (currently GPS or Network) and to set a interval to determine how often the update should be run.
For the banglejs device i added a switch to enable the sending of gps data. I also added a setting, to set the interval on how often the gps data is being updated. This allows to throttle the updates of the gps data and therefore saving energy of the smartphone batterie.
To further save energy, the app now requestes the current status of the gps from the banglejs and only sends data, if the gps of the banglejs is turned on.
In the PR #2976 I also moved the settings to the device settings of the banglejs and i moved the logic to the onLocationChanged method of the GBLocationManager.
Co-authored-by: Lukas <lukas.edi@gmx.net>
Reviewed-on: https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/2992
Co-authored-by: LukasEdl <lukasedl@noreply.codeberg.org>
Co-committed-by: LukasEdl <lukasedl@noreply.codeberg.org>
This works by adding the ability to pause the sending of data from the Bluetooth LE queue. While BtLEQueue is modified, unless setPaused(true) is called it behaves exactly as before so shouldn't cause any issues.
- get rid of pre-lollipop BLE discovery (nowadays we support only lollipop and above) and related preference
- get rid of the sequenced BT-then-BLE-scan that wasn't working reliably anyway and was causing a recursion
- add a caching layer for already processed devices (the same device is found multiple times during discovery)
- add a caching layer for device name in GBDeviceCandidate (many coordinators will ask for it, and it's a very expensive operation)
Mostly copied from the Buds Pro as those earbuds have a similar feature set and mostly the same protocol.
Co-authored-by: narektor <narektor@noreply.codeberg.org>
Co-committed-by: narektor <narektor@noreply.codeberg.org>
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.
- 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
Using objects instead of primitives, reading from correct JSON
Added unregisterReceiver for GenericWeatherReceiver
Added GenericWeatherReceiver to manifest
This adds the functionality of long-pressing the launcher icon for directly connecting a device.
The devices are automatically added as shortcuts when they are being connected.
The helper library handles the maximum number of shortcuts automatically.
- use encryption to create data rather then replay captured BLE traffic
- use periodical data sender, as is required by the BLE module
- extract string resources
This has some advantages:
- Less stuff to download for building Gadgetbridge (CI Speedups)
- Shorter build time (no need to build shared library for all supported architectures)
- Easier debugging
- etc :P
What I did:
- remove all curves except B163 to make porting easier
- port to java with brain switched off
- fix the "java has no unsigned" bugs
- add some helpers to convert int[] to byte[] and back because java has no casts
The result is ugly, no one would write such crappy code from scratch, but I tried to
keep it as close to the C code as possible to prevent bugs. Since I did not know what
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.
- adds initial device support
- can control driving forward/back/left/right
- probably could be implemented further:
- battery reading
- device name?
- lights on
- fast/slow speed mode
- Reply with HTTP 404 to unknown weather endpoints
- Add some missing fields to weather responses
The official Zepp app itself gets a 404 when calling a /weather/tide
endpoint, so we don't know what the watch is supposed to receive.
Weather also seems to still not work correctly on the GTS 3, but this at
least fixes the request spam that was coming from the watch on the tide
endpoint.
Add support for (explicit) service intents.
Add support for setting flags for intents.
Add support for setting multiple categories for intents.
Add ability for Gadgetbridge to wake the Android device and leave the
lock screen to start activities when it is sleeping. A new activity
'WakeActivity' is used for this. (Must use 'trusted device' in Android)
Add dismiss-button to 'display over other apps' permission pop up.
Bangle.js can send "gadgetbridge" as package info to accomodate the
different GB build variants/flavours.
Use only getContext() and not getApplicationContext() when executing
the intents.
Fix heartrate notify staying on after manual measurement.
Fix "live measurement" to use "continue" packet instead of restarting measurement every second.