1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-10-20 02:09:36 +02:00
Commit Graph

3118 Commits

Author SHA1 Message Date
kuhy
60066014e0 Garmin protocol: show AGPS data status in settings 2024-05-03 20:28:12 +02:00
kuhy
eeb80d712b Garmin protocol: add AGPS data checks 2024-05-03 20:28:12 +02:00
kuhy
ad44459fc4 Garmin protocol: install AGPS data as firmware 2024-05-03 20:28:12 +02:00
kuhy
c9cb7d788e Garmin protocol: improve detection of successfully sent files (DataTransferHandler) 2024-05-03 20:28:12 +02:00
kuhy
5841058863 Garmin protocol: add support for AGPS data retrieval 2024-05-03 20:28:12 +02:00
Daniele Gobbetti
f3b07694b2 Fixup: Introduce device specific writable directory (MAC address)
Add logic to not fetch again files which had the previously defined name
2024-05-03 20:28:12 +02:00
Daniele Gobbetti
4d06eb7339 Introduce device specific writable directory (MAC address)
Also adds temporary method to move the fetched files from the legacy path to the new one which does not include the device name.
Also moves the FileIndex to the end of the cached files to allow for easier sorting.

Cherry-picked from 525b395c01ce57449ee9a8f74af663595223279e and adapted
2024-05-03 20:28:12 +02:00
José Rebelo
6c79b42130 Garmin: Make fit header crc optional 2024-05-03 20:28:12 +02:00
Daniele Gobbetti
36781e6958 Garmin: fix regression in call handling
Add a fictitious action to the notification to enable reply/hangup/reject from the watch.
Also fixes the behavior on sms reply, which should also reject the incoming call.

Change the log level in case some of the canned messages types are left as default to info, as this is a supported scenario.
2024-05-03 20:28:12 +02:00
Daniele Gobbetti
4faf95a417 Garmin: encode unknown weather codes as invalid 2024-05-03 20:28:12 +02:00
José Rebelo
1328ce13e1 Garmin: Improve fit parsing
* Remove the dependency on PredefinedLocalMessage from generic fit parsing code
* Standardize toString methods, omit types for known fields
* Return null on unknown field number or names, instead of crashing
* Map more Global FIT messages (device info, monitoring, sleep stages, sleep stats, stress level)
* Prioritize "timestamp" over "253_timestamp" if specified explicitly in the global message definition
* Introduce RecordData wrappers for each global message, allowing us to have proper types when getting data. If missing or unknown, the getter returns null. All classes are auto-generated by the FitCodeGen.
* Persist a list of RecordData, instead of a Map from RecordDefinition
* Fix parsing of compressed timestamps - keep them in computedTimestamp on each data record
* Use timestamp16 if available in Monitoring records
2024-05-03 20:28:12 +02:00
José Rebelo
eec88c3dd5 Garmin: Send location to watch 2024-05-03 20:28:12 +02:00
Daniele Gobbetti
7700154b16 Garmin: calendar integration improvements
use the protobuf fields described in the documentation[0]
build the message according to the requested fields

[0] https://gadgetbridge.org/internals/specifics/garmin-protocol/#calendarevent
2024-05-03 20:28:12 +02:00
Daniele Gobbetti
eba72bd40f Garmin: fix notification crashes and handle SMS correctly
It looks like (some) watches really don't like having an empty list of actions, hence enable the legacy "refuse" action in every case, leaving it empty and inactive.
Further display the SMS sender in the notification and enable the correct code path for the reply action to work.
2024-05-03 20:28:12 +02:00
José Rebelo
915d059c1c Garmin: Auto-detect canned messages support 2024-05-03 20:28:12 +02:00
José Rebelo
de9e087e2d Garmin: Fix reply to sms 2024-05-03 20:28:12 +02:00
José Rebelo
27b0a5ce49 Garmin: Add setting to disable notifications 2024-05-03 20:28:12 +02:00
Daniele Gobbetti
b75ecae454 Garmin: use developer device setting for keeping data on device
Make use of the previously added preference to toggle file archival (deletion) on the watch.

Default is true (keep data on device) until we are sure of the consequences.
2024-05-03 20:28:12 +02:00
José Rebelo
bcb8f7504d Garmin: Map all known files types 2024-05-03 20:28:12 +02:00
José Rebelo
46ea7d87b1 Garmin: Add support for http weather requests 2024-05-03 20:28:12 +02:00
Daniele Gobbetti
77e64b149b Garmin: Rename LocalMessage to PredefinedLocalMessage and clarify its usage
PredefinedLocalMessage are only useful for FIT messages and should not interfere with FIT files. The only impact of using the local message in fit files was in the textual output, but it was confusing.

Add an explicit constructor to RecordHeader if PredefinedLocalMessage should be taken into account, and use this only in fit messages leaving the default constructor for fit files.

Also adjusts the test case as textual output comparison needs to be fixed.
2024-05-03 20:28:11 +02:00
Daniele Gobbetti
a7d4f3df93 Garmin: Add support for custom replies (notifications and calls)
To enable custom replies an override must be defined in the devices coordinator that actually support custom replies.

The custom preferences allow to:
- enable / disable the default message suffix (Instinct 2 appends "sent from my $vendor device" to each reply by default)
- define custom messages to reply to calls and incoming messages (leaving those lists empty will enable the default messages to be used)

Also adds a new protobuf definition file of mostly unknown values that enable toggling the message suffix on Instinct 2.
2024-05-03 20:28:11 +02:00
Daniele Gobbetti
bdfab59a81 Garmin: Add support for replying to notifications
This uses the (assumed) new method of passing multiple actions, instead of the (assumed) legacy accept/decline approach.
At the moment the preset messages stored on the watch firmware are used for replying, the code supports using custom messages already but those have to be updated to the watch somehow (probably by protobuf) and this is not supported yet. Using custom messages if they are not set will just do nothing.
The NotificationActionIconPosition values have been determined on a vívomove Style and might not work properly on other watches.
The evaluation of GBDeviceEvent have been moved in GarminSupport since the notification actions handling uses device events.

Also adds a method to read null terminated strings to GarminByteBufferReader.
Also adds a warning in NotificationListener if the wrong handle is used for replying to a notification.
2024-05-03 20:28:11 +02:00
Daniele Gobbetti
ce968e1ea8 Garmin: Add FileDownloadedDeviceEvent and (disabled) file deletion
Also adds (disabled) file deletion in case of already downloaded files
2024-05-03 20:28:11 +02:00
Daniele Gobbetti
e6f78bbba4 Garmin: Add DST/Timezone support 2024-05-03 20:28:11 +02:00
Daniele Gobbetti
9d2a42b173 Garmin: Support file archival (deletion) on watch
Also add original timestamp to local cache filename as the file identifier are reused
Also fix imports of Test class
2024-05-03 20:28:11 +02:00
José Rebelo
a21ceb606c Garmin: Fetch activity on demand 2024-05-03 20:28:11 +02:00
José Rebelo
3dab968805 Garmin: Allow high MTU 2024-05-03 20:28:11 +02:00
José Rebelo
9c7aa8c22b Garmin protocol: Simplify FILE_TYPE 2024-05-03 20:28:11 +02:00
José Rebelo
207ab89448 Garmin protocol: Fix linter warnings 2024-05-03 20:28:11 +02:00
José Rebelo
993765b3c6 Garmin protocol: fix crash when stopping find phone 2024-05-03 20:28:11 +02:00
Daniele Gobbetti
554e33adaa Garmin protocol: basic file transfer and notification handling
adds synchronization of supported files from watch to external directory
adds support for Activity and Monitoring files (workouts and activity samples), but those are not integrated yet
adds upload functionality (not used ATM and not tested)
adds notification support without actions
introduces centralized processing of "messageHandlers" (protobuf, file transfer, notifications)

also properly dispose of the music timer when disconnecting
2024-05-03 20:28:11 +02:00
Daniele Gobbetti
951f550b87 Garmin protocol: enable media volume control from watch 2024-05-03 20:28:11 +02:00
Daniele Gobbetti
ed0f8077e7 Garmin protocol: store max packet size from DeviceInformationMessage
also adds messageType to the warnifleftover log message
2024-05-03 20:28:11 +02:00
Daniele Gobbetti
f90b544dc9 Garmin protocol: various changes
- add FitFile class that deals with parsing and generating outgoing files
- consider all field definitions with number 253 as Timestamps [0]
- add support for "compressed timestamps" in fit file parsing. Those are not returned among the other normal fields but are available through a method of RecordData
- adjust the test cases

[0]48b6554d8a/fitdecode/reader.py (L719)
2024-05-03 20:28:11 +02:00
Daniele Gobbetti
a5bf32b9f1 Garmin protocol: change naming and logic of several FIT classes
- refactor the logic of Global and Local messages
- add some Global messages with naming taken from [1]
- Global messages are not enum because there are too many
- introduce the concept of FieldDefinitionPrimitive
- add new Field Definitions
- add support for developer fields and array fields
- add test case for FIT files taken from [0]

[0] https://github.com/polyvertex/fitdecode/
[1] https://www.fitfileviewer.com/
2024-05-03 20:28:11 +02:00
Daniele Gobbetti
e18d7df513 Garmin protocol: create helper class GarminByteBufferReader
separate the logic specific for GFDI messages from the generally useful logic.
Also centralize the logging in case of leftover bytes while parsing GFDI messages.
2024-05-03 20:28:11 +02:00
Daniele Gobbetti
e1bfd05523 Garmin protocol: create custom GBDeviceEvent for weather request 2024-05-03 20:28:11 +02:00
Daniele Gobbetti
3ea737d89c Garmin protocol: use message enum instead of id in GFDI Messages 2024-05-03 20:28:11 +02:00
Daniele Gobbetti
6b7db3d92d Garmin protocol: refactoring and fixes of BaseTypes
The boundaries are enforced on the stored value when decoding, before applying the adjustments for scale and offset.
Also add some tests for the BaseTypes
Introduce new FieldDefinition for Temperature and WeatherCondition (removing the static class)
Add accessors for field data in the containing RecordData, thus keeping the FieldData private
2024-05-03 20:28:11 +02:00
Daniele Gobbetti
74facd4505 Garmin protocol: create specific field definition for day of week 2024-05-03 20:28:11 +02:00
Daniele Gobbetti
9152a5c3da Garmin protocol: move field encode/decode interface to the FieldDefinition
This allows for semantic subclassing the FieldDefinition.
A FieldDefinitionTimestamp subclass is introduced as example
2024-05-03 20:28:11 +02:00
Daniele Gobbetti
07d4dd9dcb Garmin protocol: fix invalid signed int base type value 2024-05-03 20:28:11 +02:00
Daniele Gobbetti
ae347bed98 Garmin protocol: add initial support for FIT messages
note: only weather message definition and data tested so far
also enable weather support for Instinct 2S and vivomove style
also cleanup some unused constants that have been migrated to new enums in GFDIMessage
additionally switch to new local implementation of GarminTimeUtils with needed methods
2024-05-03 20:28:11 +02:00
Daniele Gobbetti
4a38b7aee8 Garmin protocol: fixes
- fix DEVICE_SETTINGS message ID
- put all status messages in own package
- allow protobuf handler to change the returned status message to signal unsupported requests
- fix various bugs
2024-05-03 20:28:11 +02:00
Daniele Gobbetti
135073585e Garmin protocol: initial refactoring and basic functionalities
This commit takes aims to bring many new garmin devices up to a working status, with basic functionalities such as:
- garmin protocol initialization
- basic message exchange
- support for some messages in Garmin own format
- support for some messages in protobuf format
2024-05-03 20:28:11 +02:00
Martin.JM
83fd09939f [Huawei] Fix PR #3742, add workout frequency and altitude 2024-05-01 16:32:27 +00:00
José Rebelo
18e08d13da Fix tests and linter 2024-04-30 20:43:23 +01:00
Martin.JM
1c2c1f710e [Huawei] Add support for workout calories and cycling power 2024-04-30 21:08:23 +02:00
Vitaliy Tomin
4d0d9e298e huawei: feature: File upload and watchface management (#3671)
Co-authored-by: Vitaliy Tomin <highwaystar.ru@gmail.com>
Co-committed-by: Vitaliy Tomin <highwaystar.ru@gmail.com>
2024-04-27 21:37:15 +00:00