Commit Graph
234 Commits
Author SHA1 Message Date
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
Daniel Dakhno f19782ef55 Core: handle null-body notifications 2024-08-22 20:42:17 +02:00
Arjan Schrijver 00298cc5a0 Remove wrongly added return statement 2024-07-15 22:18:37 +02:00
Arjan Schrijver a89b6f0006 Fix emojis converted to ASCII in case of multiple devices
The original code modified the incoming intent in case a device without
unicode emoji support is encountered or a transliterator is enabled for
that device. When multiple devices are connected, this causes later
devices that do support unicode emojis to also receive the
transliterated text instead of the original text.
2024-07-15 11:15:14 +02:00
Arjan SchrijverandJosé Rebelo fad092b6f8 Bump targetSdkVersion to 34 2024-07-08 22:16:15 +00:00
José Rebelo 7cafbc2002 Prevent some bluetooth events from starting Gadgetbridge 2024-06-15 23:26:58 +01:00
Martin.JMandJosé Rebelo 4c4ba623c4 Add camera implementation
This is to support watches with remote shutter applets that do not
act as remote triggers for other apps automatically.
2024-05-13 21:28:43 +00:00
José Rebelo 500e930237 Refactor location service
- Refactor the code from a static global instance to a lifecycle-aware
  service instantiated in the DeviceCommunicationService
- Fix number of devices reported in the notification
- Prevents leaks and properly stops when devices get disconnected
2024-04-25 17:08:53 +01:00
José Rebelo 3799ffb72c Zepp OS: Sync calendar event reminders 2024-04-25 15:58:57 +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 64a0b716f0 Fix crash when connecting on some phones 2024-04-03 21:22:52 +01:00
José Rebelo 9b285f16bf DeviceCommunicationService: Notify device connections right away
As noted in #3676, having a lot of bluetooth classic devices might make
the connection take some time, which would only send all the updates at
the end.

Send the updates right away for each device.
2024-04-02 22:04:12 +01:00
MrYoranimoandJosé Rebelo 28066b9b7d DeviceCommunicationService: fix crash when enabling Bluetooth adapter 2024-04-02 21:02:42 +00: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
Daniel DakhnoandJosé Rebelo 8cf87a418b Added scannable-only devices (#3621)
Co-authored-by: Daniel Dakhno <dakhnod@gmail.com>
Co-committed-by: Daniel Dakhno <dakhnod@gmail.com>
2024-03-28 21:07:05 +00:00
Daniel Dakhno ee1c3e4db9 Device connection: classify more states as reconnecting 2024-03-05 00:11:32 +01:00
Daniel Dakhno 7219bd377b Device connection: consider WAITING_FOR_SCAN as reconnecting state 2024-03-05 00:11:32 +01:00
Daniel Dakhno 3ceba883dd Device connection: allow to disconnect from scanned devices 2024-03-05 00:11:32 +01:00
Daniel Dakhno f5213f39f7 Device connection: dont try to scan for BT classic devices 2024-03-05 00:11:32 +01:00
Daniel Dakhno 00c0a8e897 Device connection: added device scan reconnection logic 2024-03-05 00:11:32 +01:00
Davis MosenkovsandJosé Rebelo cc5078332b TimeChangeReceiver: Ensure the alarm is set
Ensure TimeChangeReceiver alarm is scheduled when enabling
datetime_synconconnect and registering TimeChangeReceiver broadcast
receiver.

It is important to re-schedule the alarm after registering broadcast
receiver, because:
1. if broadcast receiver was unregistered while previous alarm arrived,
there is no alarm scheduled;
2. re-scheduling the alarm resets the periodic time sync timer when
first device is connected (which is desired).

It is important to re-schedule the alarm when datetime_synconconnect
gets enabled, because there might be no alarm scheduled.

Call onSetTime() when enabling datetime_synconconnect.
2024-02-18 19:12:30 +00:00
Davis MosenkovsandJosé Rebelo 31fc266f94 Periodically sync time on all connected devices
Sync time every 43 hours, 53 minutes and 23 seconds.
Interval is a bit smaller than 2 days.
Interval is a prime (in seconds) so time of sync will slide over time.

If next DST change is less than 48 hours in future, wait for it.
2024-02-18 19:12:30 +00:00
Daniel Dakhno 264b6470cd Revert "Device connection: added basic code for scan-reconnect"
This reverts commit adf55fea93.
2024-02-12 23:30:32 +01:00
Daniel Dakhno adf55fea93 Device connection: added basic code for scan-reconnect 2024-02-12 23:28:10 +01:00
FYG_license_bot_ignore_meandDaniele Gobbetti 4c7476845b Update license headers and CONTRIBUTORS file 2024-01-10 19:01:48 +01:00
Davis MosenkovsandJosé Rebelo 5bcebe9590 Disconnect all devices that are not NOT_CONNECTED
Disconnect devices in all states except GBDevice.State.NOT_CONNECTED.
This should fix devices getting stuck in GBDevice.State.CONNECTING state
when Bluetooth is switched off.
2024-01-08 17:11:33 +00:00
Davis MosenkovsandJosé Rebelo 9e10da062e Add "Reconnect only to connected devices" setting
* Add general_reconnectonlytoconnected setting.

* Replace last_device_address shared prefs string with
last_device_addresses shared prefs string set.
Bluetooth address of a device is added to last_device_addresses when
connecting to the device.
Bluetooth address of a device is removed from last_device_addresses only
when deleting the device or explicitly disconnecting from the device
(e.g. by selecting "Disconnect" in the device tile menu).

* Adjust ExternalPebbleJSActivity to better support multiple connected
devices.
2024-01-08 17:11:33 +00:00
Davis MosenkovsandJosé Rebelo 904a7807a8 Automatically connect to all devices
Automatically connect to all devices instead of connecting only to the
last connected device.
2024-01-08 17:11:33 +00:00
José Rebelo 4dbf9bb8ac Huami: Toggle phone silent mode from band 2023-12-11 10:50:31 +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 6984572d33 Xiaomi: Allow notification open on phone 2023-12-08 12:12:35 +00:00
MrYoranimo 561dc16b28 DeviceCommunicationService: catch uncaught exceptions from handleActions
Exceptions raised while handling actions in the device's support class
may result in the DeviceCommunicationService crashing as a whole and not
being started again until the user forces GB to make a connection by
pressing the device from the list.

This change is made, because Xiaomi devices make use of proto2 messages,
where optional fields cannot be set to null values as that will make it
throw NPEs.
2023-12-05 20:19:12 +01:00
Davis MosenkovsandJosé Rebelo 5d15df0751 CallSpec: Add source app for VoIP app calls 2023-10-10 20:03:44 +00:00
Daniel Dakhno b97b26ce3a Device manager: moved device icons and name to Coordinator 2023-09-28 00:11:02 +03:00
José Rebelo a4c79a9395 Attempt to fix DST changes 2023-09-02 10:13:14 +01:00
José Rebelo 5c78488e93 Fix emoji transliteration 2023-07-20 21:54:31 +01:00
José Rebelo fea3bf50a4 Zepp OS: Add loyalty cards integration with Catima 2023-07-03 23:19:19 +01:00
Gordon WilliamsandJosé Rebelo b2aa61e182 Changed NavigationSpec's distance into a String.
Previously we used an integer (in meters) but when using
Google Maps navigation, Google Maps picks units based on locale *and*
the distance - it might report "100m" or "20km". Then we carefully undo
all that work, and for PineTime we just as "m" so you may well have "20000m"
or more displayed, which is not ideal.

I imagine at some point that will change, but we probably want to
be able to handle that in the OSMAnd side of Gadgetbridge so all watches
that implement navigation will benefit (and won't duplicate code).
2023-06-13 07:32:12 +00:00
Gordon Williams 735f27d5bf Add Navigation handling to Bangle.js
Add extra 'ETA' field to NavigationInfoSpec
Allow Local Notifications from Google Maps to be parsed into NavigationInfoSpec by GoogleMapsNotificationHandler

Moved notification handling after blacklist check as per https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/3136#issuecomment-920095

Ensure we don't create a nav message for 'Location Shared with you' messages.
Recognise 'ft' as a distance unit and convert accordingly

Google Maps navigation: Adding new recognised icons, and removing warnings/errors from file
2023-06-09 08:50:40 +01:00
Andreas Shimokawa 55e7f6595b fix build after rebase 2023-05-21 22:50:52 +02:00
Andreas Shimokawa 9ccd898d42 add supportNavigation() to cooridinator 2023-05-21 22:50:52 +02:00
Andreas Shimokawa 4cad3b3837 InfiniTime: support navigation app 2023-05-21 22:50:52 +02:00
Andreas Shimokawa 48dee7486f add onSetNavigationInfo() to device interface 2023-05-21 22:50:52 +02:00
Andreas Shimokawa 0d1a1f8a9f experiment with osmand
add osmand license note to readme
Cleanup unneeded aidl and java
2023-05-21 22:50:52 +02:00
José Rebelo 2b6a79f462 Zepp OS: Manage contacts on watch 2023-05-17 23:43:29 +01:00
Arjan Schrijver b892748b15 Cache notifications while devices are out of range (opt-in) 2023-04-05 11:11:23 +02:00
Arjan Schrijver 845887ddeb Fossil/Skagen Hybrids: Add app/watchface downloading from watch to app manager 2023-01-07 23:07:34 +01:00
José RebeloandGitea 4a0e67cb30 Add Intent API to trigger activity sync and DB export 2022-12-15 14:17:03 +00:00
Gordon WilliamsandGitea e003e0b672 Fix the code that forces a calendar sync on Bangle.js - previously sending "android.intent.action.PROVIDER_CHANGED" didn't work 2022-12-12 07:42:22 +00:00
José RebeloandGitea addf7ff6a6 Amazfit GTR 4: Initial support 2022-10-22 22:03:49 +02:00