Commit Graph

223 Commits

Author SHA1 Message Date
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
MrYoranimo 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 Dakhno 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 Mosenkovs 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 Mosenkovs 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_me 4c7476845b Update license headers and CONTRIBUTORS file 2024-01-10 19:01:48 +01:00
Davis Mosenkovs 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 Mosenkovs 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 Mosenkovs 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 Mosenkovs 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 Williams 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é Rebelo 4a0e67cb30 Add Intent API to trigger activity sync and DB export 2022-12-15 14:17:03 +00:00
Gordon Williams 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é Rebelo addf7ff6a6 Amazfit GTR 4: Initial support 2022-10-22 22:03:49 +02:00
Gordon Williams c425cff759 Removed supportsActivityDataFetching check in FETCH_RECORDED_DATA handler. This
fixes a regression for Bangle.js where 'Debug -> Fetch Debug Logs' wasn't working because
it didn't support activity data fetching.

see https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/2526#issuecomment-648446
2022-10-18 08:25:14 +01:00
Daniel Dakhno ea851b312a Core: fixed typo 2022-10-15 21:57:22 +02:00
Daniel Dakhno ec161be66e Core: added device update reason DEVICE_STATE 2022-10-15 21:57:22 +02:00
Daniel Dakhno dfc1f164b4 Core: added subject to device update intent 2022-10-15 21:57:22 +02:00
TylerWilliamson a86894b052 Added GenericWeatherProvider, shows "Activate" and "Deactivate" regardless of if "Weather Notification" is installed
Using objects instead of primitives, reading from correct JSON

Added unregisterReceiver for GenericWeatherReceiver

Added GenericWeatherReceiver to manifest
2022-10-02 17:58:03 +02:00
José Rebelo 11716c906b Allow 3rd party apps to set device settings 2022-09-25 11:55:48 +02:00
Gabriele Monaco 004355f69f Added calendar color and name to CalendarEventSpec
Tested on banglejs
2022-09-08 18:00:27 +02:00
dakhnod ee207c978f Device FlipperZero: added basic support for the Flipper Zero (#2840)
This PR adds support for the flipper zero device.

It's main purpose currently is to provide an Intent-based API to Tasker and similar apps to play sub-GHz files.

In the future, file management and other features might be useful.

Co-authored-by: Daniel Dakhno <dakhnod@gmail.com>
Reviewed-on: https://codeberg.org/Freeyourgadget/Gadgetbridge/pulls/2840
Co-authored-by: dakhnod <dakhnod@noreply.codeberg.org>
Co-committed-by: dakhnod <dakhnod@noreply.codeberg.org>
2022-09-04 23:05:57 +02:00
NekoBox 72e2475389 getDeviceSupport() add check for deviceSupport being null 2022-08-22 10:35:06 +02:00
Gabriele Monaco 43d637bd1f Calendar sync: added allDay field in intent
Events added through DeviceCommunicationService will have the field too
2022-08-22 10:34:22 +02:00
José Rebelo ba565df088 Xiaomi Smart Band 7: Initial support 2022-08-19 23:13:27 +02:00