Commit Graph
100 Commits
Author SHA1 Message Date
Daniele Gobbetti 11ca07451a Add Lifecycle observer to GBApplication
Support classes can now react to application being in foreground/background.

Also adds support for sending app status to garmin devices.
2026-01-03 08:56:25 +01:00
Daniele Gobbetti a87ddbb66a Garmin: add support for devices not sending ConfigurationMessage
Infer capabilities from the incoming FitData message (as test/workaround, we're not sure if the field we're using is the correct one).
Use the CapabilitiesDeviceEvent instead of the hardcoded ConfigurationMessage instanceof check to call completeInitialization() in GarminSupport.
Also centralize the generation of the capabilities-related DeviceEvent in GarminCapability as they are used both in ConfigurationMessage as in FitLocalMessageHandler now.
2025-12-31 19:10:56 +01:00
Daniele Gobbetti 4ab011dd1e fixup! Garmin: implement messages 5007/Filter and 5037/Synchronization
Remove spurious changes
2025-12-31 19:10:26 +01:00
Daniele Gobbetti ab5999a480 Garmin: implement messages 5007/Filter and 5037/Synchronization
This commit does not override the default fetching of activity data, which is still phone-initiated, but adds support for watch-initiated sync as well (typically upon connecting).

Also change the order of the messages exchanged upon connection to mimic logs of official app.
Also remove some status messages where the outgoing message is already a status.
Also send the status "app in foreground" so that the watch can initiate the synchronization.
2025-12-31 18:54:13 +01:00
Daniele GobbettiandJosé Rebelo 7205318131 Nothing Ear: switch to AbstractHeadphoneBTBRDeviceSupport support class
Refactor Ear1Support to extend AbstractHeadphoneBTBRDeviceSupport instead of AbstractHeadphoneSerialDeviceSupport.

Encapsulate NothingProtocol as inner class to Ear1Support and remove NothingIOThread.

Rename one preference to allow the usage of Enum for audio mode. Beside of this change most of NothingProtocol remained unchanged.

Also remove (unused) import in PixooIOThread.
2025-12-28 19:52:14 +01:00
Daniele GobbettiandJosé Rebelo 4eba10858c Garmin: Register FitLocalMessageHandler on incoming FitDefinitionMessage
Also log the incoming FitDataMessage once it's parsed, without any further processing.
2025-12-21 13:54:21 +00:00
Daniele GobbettiandJosé Rebelo 157c9c2237 Garmin: Initial attempt at supporting incoming FitDefinition/FitData Messages
Add the code to generate outgoing FitDefinition- and FitDataStatusMessage.
Add support for incoming FitDefinitionMessage and register handler via deviceEvent (commented for now to avoid leaking).
Refactor FitLocalMessageHandler to support both outgoing and incoming handling of FitDefinition/FitData.

Most of the changes were not tested for the lack of hardware, but at least they show no regressions.
2025-12-21 13:54:21 +00:00
Daniele GobbettiandJosé Rebelo a3d732f11a Garmin: Remove PredefinedLocalMessage class
Refactor FitDataMessage to support a two-step message parsing: at first hold a copy of the incoming bytestream and later parse it according to a list of RecordDefinitions.
This allows to remove PredefinedLocalMessage which was already made obsolete by previous changes.
This should also allow to support incoming FitDefinition/FitData exchanges.
2025-12-21 13:54:21 +00:00
Daniele GobbettiandJosé Rebelo 63e0ecba63 Garmin: Better Local Message Handling
Use a temporary MessageHandler to send Definitions and Data in sequence instead of in parallel.
Add functionality to populate FitLocalMessageBuilder record by record instead of with a List, also add helper to get an unused localMessageType.
Don't use hardcoded localMessageTypes for weather message as they are not required.
2025-12-21 13:54:21 +00:00
Daniele GobbettiandJosé Rebelo fe6def63ee Garmin: Weather message improvements
Add equals() and hashCode() to all classes needed to properly compare RecordDefinition class instances.
Add FitLocalMessageBuilder class to deduplicate the Definitions also recreating the RecordData in case they differ just from previous ones with the same localMessageType (e.g. if they were built specifying the fields in a different order).
Restore a different order in GarminSupport when building weather messages, to test the deduplication.
Add FieldDefinitionWeatherReport as proper enum with explicit Types. Also adapt the code generator and run it (without adding all unrelated changes to generated Messages, only FitWeather).
2025-12-21 13:54:21 +00:00
Daniele Gobbettianddaniele b0d76f8204 Migrate ViewPager usages to ViewPager2
Also migrate from FragmentStatePagerAdapter to FragmentStateAdapter, preserving the getPageTitle method for compatibility.
Layouts needs adjustments since the TabLayout cannot be a child of ViewPager2.
Further no subclassing is possible hence NonSwipeableViewPager has to be deleted, but the functionality is retained.
Custom classes to handle FragmentAdapters are also removed, and lifecycle of activities (using fragments) has been streamlined.
2025-08-28 09:38:08 +02:00
Daniele Gobbetti cfaedb1eba Garmin: fix usage of spurious static variable 2025-08-11 15:04:35 +02:00
Daniele Gobbetti dbb53fbdd5 fixup! Printer: allow printing incoming text shared to Gadgetbridge
Use the correct default for the preference in the support class
2025-07-24 18:48:09 +02:00
Daniele Gobbetti d33054ae54 Printer: allow printing incoming text shared to Gadgetbridge
Add a new NotificationType for received text.
Add device specific settings to the printer coordinator, also add setting to print received text (defaults to on).
2025-07-21 17:46:05 +02:00
Daniele GobbettiandJosé Rebelo f79e47daf2 Pebble: send current weather when opening the native weather app 2025-07-20 11:50:56 +02:00
Daniele GobbettiandJosé Rebelo a9cff502ab Pebble: move the specific method to mimic JSON weather response to local package 2025-07-20 11:50:56 +02:00
Daniele GobbettiandJosé Rebelo 9111676bb2 Add JvmStatic annotations to static kotlin methods of weather classes 2025-07-20 11:50:56 +02:00
Daniele GobbettiandJosé Rebelo 9aaa582331 Move weather model classes to own package 2025-07-20 11:50:56 +02:00
Daniele GobbettiandJosé Rebelo d845a5a1d8 Convert WeatherSpec to kotlin
Also add getters and setters everywhere for compatibility and remove Serializable as it's not needed anymore
2025-07-20 11:50:56 +02:00
Daniele GobbettiandJosé Rebelo 86e53f0e85 Drop support for outdated app weather notification 2025-07-20 11:50:56 +02:00
Daniele GobbettiandJosé Rebelo 34812c02db Use Gson for cache file 2025-07-20 11:50:56 +02:00
Daniele GobbettiandJosé Rebelo 5b35bbba8f Rewrite Weather class in Kotlin and extract cache handling and mapping methods
Cache Handling and static mapping methods are extracted to new classes

Also adds test for weather mapping and moves legacy Weather class there to ensure the conversion to kotlin did not introduce errors
2025-07-20 11:50:56 +02:00
Daniele Gobbetti f78d59d6d4 Deprecate NotificationCollectorMonitorService
Don't start the foreground NotificationCollectorMonitorService unless enabled in the deprecated settings.

The notification service seems to be reliably kept alive by the OS without this workaround, and having a second foreground service is causing a second persistent notification for some users.
2025-07-16 17:22:07 +02:00
Daniele Gobbetti cd651ce140 Refactor Notification classes to remove Pebble-isms
Move pebble icons and color to a new class, keeping the original NotificationType enum
2025-07-11 09:27:02 +02:00
Daniele Gobbetti c4ca8d6b3b Printer: allow alignment of picture
Show the picture on a canvas and allow to swipe it to align left, middle or right.
Also simplify the activity layout by removing the incoming picture and only showing the preview.
2025-07-09 17:14:57 +02:00
Daniele Gobbetti 87d6a677ec Printer: fix device icon colors 2025-07-08 09:16:10 +02:00
Daniele Gobbetti 99a05742ff Start NotificationCollectorMonitorService as foreground service 2025-07-07 08:37:13 +02:00
Daniele Gobbettianddaniele 23f4488852 Printer: add upscale switch and print size in preview 2025-07-06 18:08:46 +02:00
Daniele Gobbettianddaniele 6196be1f3f Printer: unregister BroadcastReceiver on dispose
Also register it when the device is actually initialized
2025-07-06 18:08:46 +02:00
Daniele Gobbettianddaniele 99aec7bd48 Printer: Shutdown executor on activty destroy 2025-07-06 18:08:46 +02:00
Daniele Gobbettianddaniele 744d17b45f Printer: Use external library for dithering, cache file and fix image preview
Use a cache file in the cache directory to hold the bitmap, this way we can avoid passing huge byte arrays around for printing.

Also:
allow to open files from the SendToPrinterActivity if it's launched from the device card
fix the encoding of rows when RLE is not in use
show the previews in full width in the activity
2025-07-06 18:08:46 +02:00
Daniele Gobbettianddaniele b785bda9d1 Printer: use device card actions 2025-07-06 18:08:46 +02:00
Daniele Gobbettianddaniele 12dac9d39f Printer: Print notifications (disabled)
Add method to print incoming notifications (commented out / disabled for now)
2025-07-06 18:08:46 +02:00
Daniele Gobbettianddaniele c03b229563 Printer: Implement flow control
Also make the print activity scrollable for dealing with long images.
2025-07-06 18:08:46 +02:00
Daniele Gobbettianddaniele 0af011c929 Printer: Use theme color for device icon 2025-07-06 18:08:46 +02:00
Daniele Gobbettianddaniele 07d0895c06 Initial support for thermal printers 2025-07-06 18:08:46 +02:00
Daniele Gobbetti b0ec5e73c7 Partially revert "huami+pebble: replace deprecated writeCharacteristic and writeDescriptor"
The reverted change sent the updated descriptor value to the watch, breaking the connection.

It is unclear why the descriptor is set to an unknown value and never sent to the watch, but this restores the previous working behavior.
2025-06-15 17:35:28 +02:00
Daniele Gobbetti 853bdd58ab Add OS battery level to DeviceCoordinator and BluetoothStateChangeReceiver
Add OS Battery Level detection to BluetoothStateChangeReceiver, pass the event to devices only if their coordinator class declares support for it.
Add supportsOSBatteryLevel() to DeviceCoordinator and AbstractDeviceCoordinator defaulting to false.

Change coordinator of GenericHeadphones to return true for supportsOSBatteryLevel() and remove specific BroadcastReceiver from the support class.
2025-04-16 08:49:33 +02:00
Daniele Gobbetti 9b873ada7e fixup! Ignore invalid battery level updates
fix typo: level 100 is a valid battery level
2025-04-14 15:38:32 +02:00
Daniele Gobbetti be1fcfb290 fixup! GenericAudioBT: Add battery level
Add null check on batteryLevelReceiver before unregistering.
2025-04-07 15:27:43 +02:00
Daniele Gobbetti cf18f01f25 GenericAudioBT: Add battery level
Add a listener to get the current battery level of the audio device.

Also prevent the spurious notification about missing firmware and hardware version.
2025-04-07 14:57:32 +02:00
Daniele Gobbettianddaniele 0fefa5de6b Generic Audio BT Device Support
Add support for any Audio Bluetooth Device recognized by the OS. The main aim is to support incoming calls and notifications being read aloud.
The device must be paired with Android OS and be recognized as audio device.

Reviewed-on: https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/4675
Reviewed-by: Arjan Schrijver <arjan5@noreply.codeberg.org>
Co-authored-by: Daniele Gobbetti <daniele+cb@gobbetti.name>
Co-committed-by: Daniele Gobbetti <daniele+cb@gobbetti.name>
2025-03-31 06:53:11 +00:00
Daniele Gobbetti e2dd3fc7c3 Pebble: bring PebblePairingActivity in line with other dedicated activities for targetSdkVersion 34
See also fad092b6f8
2025-02-03 12:27:40 +01:00
Daniele Gobbetti 50fda01a56 Instantiate preview image only if not null
Prevents BitmapDrawable logging spam on android 15
2025-01-27 09:24:11 +01:00
Daniele Gobbetti 7fed89a648 Garmin: prevent double initialization
As it prevents some watches from connecting. The change causing the double initialization is a6de977d50
2024-12-27 17:15:35 +01:00
Daniele GobbettiandJosé Rebelo b70c2af117 Garmin: initial plumbing for notifications' images (blind implementation)
This commit adds the signaling of notifications with images to the watch.
According to https://codeberg.org/Freeyourgadget/Gadgetbridge/issues/3469 the watch should followup with a protobuf request "MediaRequest".
The protobuf is documented in https://gadgetbridge.org/internals/specifics/garmin-protocol/#mediarequest

As examples and only intended to help further developments, two new methods getNotificationAttachmentPath and getNotificationAttachmentBitmap are added to GarminSupport
2024-11-25 18:16:07 +00:00
Daniele GobbettiandJosé Rebelo 4aa145560a Add support for picture attachments in notifications
Also adds a local cache for pictures which is handled by the NotificationListener itself.

If the picture is hosted in a third party content provider it gets queried.
If the Bitmap is embedded in the notification, the local cache is used.

In any case the NotificationSpec just holds a String to the absolute file path
2024-11-23 21:15:47 +00:00
Daniele Gobbetti 550e6a86f2 Pebble: fix NPE in getPlatformName
The NPE was triggered by recent changes in the HearthRate Charts (503cd31d91)
Since getModel was also affected by the same NPE, the function is now changed as well.
2024-09-25 15:09:01 +02:00
Daniele Gobbetti d4df00ccbf Garmin: send blocks that are smaller than MaxPacketSize
Fixes 4047
2024-08-29 16:52:50 +02:00
Daniele GobbettiandJosé Rebelo 7d9f8704c9 Remove device_specific_settings category from main preferences
All devices are now handled by their device specific preferences
2024-08-25 20:20:52 +00:00
Daniele GobbettiandJosé Rebelo e74f9c2a3d Pebble: migrate legacy global preferences to all pebble devices 2024-08-25 20:20:52 +00:00
Daniele GobbettiandJosé Rebelo bea6c6a00c Pebble: enforce numeric input for mtu_limit preference 2024-08-25 20:20:52 +00:00
Daniele GobbettiandJosé Rebelo 6b38d5b283 Pebble: split the pebble device specific settings in the existing root screens 2024-08-25 20:20:52 +00:00
Daniele GobbettiandJosé Rebelo 13be343392 Pebble: remove last global settings
In order to add an emulated device it is sufficient to use the "Add test device" functionality choosing pebble as device and entering IP:PORT in the mac address field.

The pebble setting to force BLE is moved to discovery_pairing_preferences.xml

Also delete the pebble_preferences file and update general preferences.
2024-08-25 20:20:52 +00:00
Daniele GobbettiandJosé Rebelo 8e876c8a92 Remove preference pebble_reconnect_attempts
Its usage was removed with
c2db30274f
2024-08-25 20:20:52 +00:00
Daniele GobbettiandJosé Rebelo 54cf421295 Bind sunrise/sunset alarm receiver to specific device support
Only register it for Pebble devices which enable the relative setting.

Also move the preference to device specific.
2024-08-25 20:20:52 +00:00
Daniele GobbettiandJosé Rebelo 795ffde0e1 Pebble: move a bunch of preferences to device specific settings 2024-08-25 20:20:52 +00:00
Daniele GobbettiandJosé Rebelo c3d76477ec Pebble: remove pebble_enable_pebblekit global preference.
Use device specific third_party_apps_set_settings preference instead.
2024-08-25 20:20:52 +00:00
Daniele Gobbetti d0b525f420 Garmin: minor fixes to some messages.
Prevent sending double status messages / ACKs if the actual outgoing message is also a status message.
Prevent sending ACKs for incoming ACK messages.
2024-08-20 15:59:32 +02:00
Daniele Gobbetti 1d496b5ce5 Merge branch 'refs/heads/dg-garmin-fit-fixes' 2024-08-18 22:18:35 +02:00
Daniele Gobbetti fd1e81ff66 Garmin: fix basetype handling and truncation
Numeric BaseTypes now return fractional part if a scale is set, the return type for numeric values is unboxed from Number class so that existing comparisons and checks keep working, but values are not truncated at nearest integer value.

The codegen class has been updated and some of the messages are re-generated with the new code, with the exception of Hrv* messages, since updating those needs updating the related sample types.

Test cases expected values have been adjusted to keep into account the fractional part of some fields.

Garmin: Fix HRV value and summary types
2024-08-18 22:15:06 +02:00
Daniele Gobbetti 51a0745b06 Garmin: add GENERIC activity and use it for imported GPX files 2024-08-18 12:40:16 +02:00
Daniele Gobbetti 0a51598204 Fixup: Garmin: fix major issue with field encoding/decoding
Temperature offset must have its sign flipped.
2024-08-17 08:00:26 +02:00
Daniele Gobbetti cd46e24819 Garmin: Mimic auth negotiation requested byte and flags.
The previous attempt to send all zeroes (in 7fa5cd1be5) didn't yield actionable progress, hence we try sending back what the watch sent to us.

Blindly implemented based on the legacy vivomoveHR code, not tested against real devices.
2024-08-16 19:26:44 +02:00
Daniele Gobbetti 3f8eeebc5a Garmin: simplify handling canned replies and only send error if no reply is set at all 2024-08-16 19:18:50 +02:00
Daniele Gobbetti 29787d0c9b Garmin: add gpx import functionality for models that support it
Add a Field definition for GPS coordinates and remove the corresponding method from GarminUtils.
Add a new message COURSE and some fields to other known messages.

Also centralize some utility methods in GpxParser and GpxTrack, adapting ZeppOsGpxRouteFile.

Be aware that the capability used to identify the supported watches might be the wrong one.
2024-08-16 18:52:13 +02:00
Daniele Gobbetti f2f6536ea8 Garmin: fix major issue with field encoding/decoding
Our implementation of scale and offset was backwards: we were adding offset and then dividing by scale when decoding fields, but the publicly available protocol description dictates otherwise ( http://web.archive.org/web/20240519102659/https://developer.garmin.com/fit/protocol/#scaleoffset ):  "the binary quantity is divided by the scale factor and then the offset is subtracted".
For this reason the sign of GARMIN_TIME_EPOCH in Timestamp field definition must be flipped as well.
2024-08-16 13:57:00 +02:00
Daniele Gobbetti 7fa5cd1be5 Garmin: further work for auth negotiation
Add status message parsing and change the reply logic for watch-initiated Auth (in attempt to fix #3986): before this changeset the phone would reply with a generic ACK and then send a request to the watch for setting the auth (with all zeroes);
after this changeset the phone replies with a specific auth ack/status message but it ignores what the watch requested and acknowledges back all zeroes.

Blindly implemented based on the legacy vivomoveHR code, not tested against real devices.
2024-08-14 10:04:32 +02:00
Daniele Gobbetti 1d4c85b732 Garmin: implement (some kind of) auth negotiation message
Blindly implemented based on the legacy vivomoveHR code, not tested against real devices.
2024-08-07 14:58:26 +02:00
Daniele Gobbetti 74fbadf553 Pebble: fix webview crash (on android 14)
Older android version also possibly impacted
2024-06-13 16:26:39 +02:00
Daniele Gobbetti fc8b959fea Garmin: only add the cache-control header when updating the AGPS file
Prevents it being stale for too long if the user forgets to fetch an updated file.
If the file has to be updated on the watch the response (http status 200) is sent and cached for 14400 seconds, for this period the watch will not request the file again.
Subsequent requests (http status 304) are very small and should not impact battery life negatively, hence they are sent without adding caching directives.
2024-06-08 16:29:52 +02:00
Daniele Gobbetti 537b0580b5 Garmin: fix for watch staying in synchronizing state on first connection
Reported in issue 3269, https://codeberg.org/Freeyourgadget/Gadgetbridge/issues/3269#issuecomment-1845355

Also run refactor code on the whole file
2024-05-28 12:35:55 +02:00
Daniele Gobbetti ba9e5c8a77 Garmin: various minor changes
remove message placeholders referring to legacy code,
remove try-catch from the weather data message building method
lower the frequency of music control messages
2024-05-24 22:24:09 +02:00
Daniele Gobbetti 9c4da444cf Garmin: fix protobuf chunked fragments handling
remove chunk from the map once it is complete if it is incoming, fix the removal of outgoing chunks
also return a warn log message if the protobuf status is not OK.
2024-05-24 22:24:09 +02:00
Daniele Gobbetti ea1c1c808c Change java package of garmin protobuf files 2024-05-24 22:24:09 +02:00
Daniele Gobbetti 0cf73a2120 Remove all the legacy vivomove HR code.
Also replaces support for device through the new garmin code path.
The Entities are preserved to enable on-demand database migration in case some user had previously synchronized data.
2024-05-24 22:24:09 +02:00
Daniele Gobbetti 709afc5df7 Garmin: fix spurious protobuf messages 2024-05-24 22:24:09 +02:00
Daniele Gobbetti 2a9a01e40b Garmin: improve weather information
Add Aqi Field Definition and field to today weather and daily forecast, as both are available in WeatherSpec.
Add Feels like temperature to hourly forecast but populate with the forecasted temperature as the field is not available in Weatherspec for hourly.
Use temperature Field Definition for dew point and add it to today's weather.

Fields dew point and air quality could have been removed from the hourly weather definition but are kept in to test compatibility of these changes with watches.
2024-05-24 22:24:09 +02:00
Daniele Gobbetti ebe371de3c Garmin: Remove handling of legacy cache directory 2024-05-24 22:24:09 +02:00
Daniele Gobbetti c3a6db3309 Garmin: adjust test after adding distance field 2024-05-24 22:24:09 +02:00
Daniele Gobbetti 906ad0c68f Garmin: enable AGPS update for all Instinct 2 devices 2024-05-24 22:24:08 +02:00
Daniele Gobbetti 457ff8b88f Fixup: Introduce device specific writable directory (MAC address)
Add logic to not fetch again files which had the previously defined name
2024-05-24 22:24:08 +02:00
Daniele Gobbetti 8c88cc992a 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-24 22:24:08 +02:00
Daniele Gobbetti 3abf78d8c2 Garmin: enable unicode Emoji for all devices
This seems to be widely supported by garmin devices, hence enable it in the base coordinator. Specific devices not supporting Unicode Emojis can override this method and return false.
2024-05-24 22:24:08 +02:00
Daniele Gobbetti f1f77abe18 Garmin: harmonize device names
All device name strings start with manufacturer name.
Normalized the usage of accented i.
2024-05-24 22:24:08 +02:00
Daniele Gobbetti a5dbb7fea7 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-24 22:24:08 +02:00
Daniele Gobbetti 179f8a3a9e Garmin: encode unknown weather codes as invalid 2024-05-24 22:24:08 +02:00
Daniele Gobbetti 9e1bf07cd2 Garmin: add coordinator for Instinct 2 Solar Tactical
confirmed working in https://codeberg.org/Freeyourgadget/Gadgetbridge/issues/3063#issuecomment-1787762
2024-05-24 22:24:08 +02:00
Daniele Gobbetti e46ea03693 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-24 22:24:08 +02:00
Daniele Gobbetti 416b7b075c 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-24 22:24:08 +02:00
Daniele Gobbetti dbc270ad9f 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-24 22:24:08 +02:00
Daniele Gobbetti 01d48cde91 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-24 22:24:08 +02:00
Daniele Gobbetti 698908a589 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-24 22:24:08 +02:00
Daniele Gobbetti 45c13675e0 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-24 22:24:08 +02:00
Daniele Gobbetti 54070b2652 Garmin: Add FileDownloadedDeviceEvent and (disabled) file deletion
Also adds (disabled) file deletion in case of already downloaded files
2024-05-24 22:24:08 +02:00
Daniele Gobbetti 2c70f1a616 Garmin: Add DST/Timezone support 2024-05-24 22:24:08 +02:00
Daniele Gobbetti 42e44de1ac 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-24 22:24:07 +02:00
Daniele Gobbetti e6365638d4 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-24 22:24:07 +02:00
Daniele Gobbetti 9dee71df6f Garmin protocol: enable media volume control from watch 2024-05-24 22:24:07 +02:00
Daniele Gobbetti 14c6ce1a3a Garmin protocol: store max packet size from DeviceInformationMessage
also adds messageType to the warnifleftover log message
2024-05-24 22:24:07 +02:00