1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-06-09 22:57:54 +02:00
Commit Graph

10057 Commits

Author SHA1 Message Date
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
2ff92c73f8 Xiaomi: Re-enable screen on on notifications preference
- Disabled by accident on 2063bc2df
- Move preference to XiaomiNotificationService
- Get preference value on connection
2023-12-08 20:55:58 +00:00
José Rebelo
2063bc2dfd Xiaomi: Remove not-implemented preferences 2023-12-08 18:53:22 +00:00
José Rebelo
961e9f1bf9 Xiaomi: Fix sleep schedule preference 2023-12-08 18:53:11 +00:00
José Rebelo
6984572d33 Xiaomi: Allow notification open on phone 2023-12-08 12:12:35 +00:00
José Rebelo
2b8d8c2cb0 Xiaomi: Fix dismiss multiple notifications from watch 2023-12-08 11:49:47 +00:00
José Rebelo
6479cc3bb0 Xiaomi: Allow disabling app notifications per device 2023-12-08 11:39:53 +00:00
José Rebelo
f29995b571 Zepp OS: Allow disabling app notifications per device 2023-12-08 11:29:20 +00:00
José Rebelo
77329813b9 Use simple summary provider for vibration pattern counts 2023-12-08 10:45:07 +00:00
Andreas Shimokawa
b4aca410b4 Pixoo: implement some protocol for testing 2023-12-07 21:07:52 +01:00
Andreas Shimokawa
b44b0fec7e Divoom Pixoo: Initial experimental support
Works:
- notifications
- call notification
- set time
- setting brightness
- setting 24h/12h format
- sending weather

Note
- this is implemented using using the classic bluetooth serial protocol, the
  device can do BLE, but I don't know how to use it, as I did not have the
  offical app to sniff.
- The information about the protocol comes from here
  https://github.com/jfroehlich/node-p1x3lramen/blob/main/source/devices/pixoo.js

TODO:
- Enable beep? Possible? I heard it beep once at least when switching it on
- Getting out of factory mode? Why does it always play animations even when I
   switch to the clock?
- Implement switching modes (can be done with the button)
- Implement sending own images and animations
- Firmware update?
- ...
2023-12-06 15:56:18 +01:00
José Rebelo
130e2ab85c Xiaomi: Fix heart rate interval and sleep support 2023-12-06 11:51:01 +00:00
José Rebelo
03dbf7533f Xiaomi: Get canned messages from watch 2023-12-06 11:18:13 +00:00
MrYoranimo
b902ee96c3 Xiaomi: improve battery level and charger status processing
Because the reporting of battery state is inconsistent between different
models, the device's battery state was not correctly processed in GB.

For at least the firmware on the Xiaomi Watch S1 Active, the charger
state is broadcast through a separate message from the message
containing the battery level. Even though the battery level was
requested by GB upon receiving this broadcast, the charger state got
discarded as it was expected to also be included in the result of the
subsequent request.

This patch changes the name of the `Charger` message to `DeviceState`
and includes more fields that may be presented by some device models.
Furthemore, the broadcast is cached so that the charger state can be
processed from this cache instead of the battery level response message.
2023-12-06 11:56:13 +01:00
MrYoranimo
405596d960 Xiaomi: check for null values before encoding MusicSpec to proto 2023-12-05 20:27:33 +01: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
José Rebelo
7f7834c620 Xiaomi: Fix reconnect if characteristics are null
If a service was found, but characteristics are null, maybe we're just
connecting too early - set the device to reconnect.
2023-12-05 18:30:33 +00:00
José Rebelo
4de7cb3591 Xiaomi: Improve service auto-detection
Some watches have the encrypted service, even though they're plaintext,
but are missing the characteristics.
2023-12-05 18:28:39 +00:00
José Rebelo
1c68252255 Xiaomi: Fix settings display items code 2023-12-05 18:20:02 +00:00
Andreas Shimokawa
776346d311 Xiaomi: guard against null pointer crash 2023-12-05 18:20:02 +00:00
José Rebelo
9ddbcc0c8a Xiaomi: Use display items labels from watch 2023-12-05 18:20:02 +00:00
José Rebelo
3ab1ac26db Refactor known preference values code to be reusable 2023-12-05 18:20:02 +00:00
José Rebelo
2dacdcface Xiaomi: Log service 2023-12-05 18:17:50 +00:00
José Rebelo
95d3ff81fd Xiaomi: Fetch alarm and reminder slots from watch 2023-12-05 18:16:45 +00:00
MrYoranimo
5f9fda4f07 BtLEQueue: fix typo in onCharacteristicChange 2023-12-04 23:32:23 +01:00
MrYoranimo
b303da4e62 Xiaomi: wrap parsing of activity data in try block
This will prevent uncaught exceptions that occur during the
parsing of activity data from breaking up the activity fetching
chain and causing the task to never get completed.
2023-12-04 23:32:18 +01:00
MrYoranimo
0f83346d65 Xiaomi: check if binary parser result is null
The activity parser may return null pointers in case the version
of the data structure is not supported. Not checking for null here may
result in the activity fetching task may never complete and cause
further communication with the device to grind to a halt.
2023-12-04 22:03:59 +01:00
José Rebelo
376956bbe9 Xiaomi: Improve activity fetch logging 2023-12-04 09:46:49 +00:00
José Rebelo
e6cb15d9eb Mi Watch Color Sport: Experimental support 2023-12-02 11:56:23 +00:00
José Rebelo
ec050d7a4f Xiaomi: Unify encrypted and plaintext logic 2023-12-02 11:25:32 +00:00
José Rebelo
ba0ca1de75 Delegate auth key validation to coordinator 2023-12-02 10:59:34 +00:00
José Rebelo
216dc93986 Mi Band 8: Overlay sleep on activity data 2023-12-02 10:56:36 +00:00
José Rebelo
84692e5432 Mi Band 8: Persist bedtime and wakeup times to database 2023-12-01 21:35:29 +00:00
Andreas Shimokawa
1b2a9ac140 Xiaomi: When sending contacts, use correct command to replace the ones already on the watch 2023-12-01 20:07:32 +01:00
Andreas Shimokawa
81e24e53ed Xiaomi: WIP implementation for sending contacts
This is not useful yet because contacts just get added when sending them, instaed of replacing.
Should be fixed or disabled before the release
2023-12-01 12:40:53 +01:00
Andreas Shimokawa
6e5bedb365 Xiaomi: Implement Screen On on Notification setting
Works on Redmi Watch 3 Active
Does not work on Mi Watch Lite
2023-12-01 07:52:08 +01:00
MrYoranimo
b9b91db06f Xiaomi: implement phonebook service to respond to contact info requests 2023-11-30 22:54:41 +01:00
Gordon Williams
684d976bfc Bangle.js: Ensure SMS messages have src field set to "SMS Message" (it was previously left out) 2023-11-30 09:33:07 +00:00
José Rebelo
34c994759d Update README and changelog 2023-11-29 21:34:57 +00:00
José Rebelo
5be3543fa3 Xiaomi Smart Band 7 Pro: Experimental support 2023-11-29 21:18:52 +00:00
José Rebelo
0c4e2df075 Xiaomi: Fix crash when opening app manager
Regression introduced by e53c67e8bf
2023-11-29 21:11:54 +00:00
MrYoranimo
dd6d9bd271 Add device icon for Mi Watch, Xiaomi Watch S1 Active 2023-11-29 20:27:44 +01:00
MrYoranimo
20cdef5283 Change some required fields to optional in Xiaomi protobuf specs
The Xiaomi Watch S1 Active does not send some fields that have
been declared as `required`, which results in those messages
not being processed at all.
2023-11-29 20:27:44 +01:00
MrYoranimo
6933b8a793 Add device coordinator for Xiaomi Watch S1 Active 2023-11-29 20:27:36 +01:00
Gordon Williams
8ef80a2565 Bangle.js: ensure GPS speed is reported correctly when the phone is providing it 2023-11-29 10:04:33 +00:00
mormegil
ec73b244ee Improve ASCII transliterator
We should use NFKD instead of NFD since we are flattening to US-ASCII
afterwards anyway. This allows various Unicode characters which would
end up as a question mark to be represented by their compatibility
decomposition. This applies to e.g. ligatures (e.g. U+FB01 LATIN SMALL
LIGATURE FI will now be replaced with plain fi instead of a question
mark), and also the U+00A0 NO-BREAK SPACE [NBSP] to be replaced by
a normal space instead of a question mark.

+Add Czech fancy quotes to the Czech transliterator
+Add a unit test for Multitransliterator
2023-11-28 18:24:42 +00:00
José Rebelo
99b3dc3226 Fix crash when pairing current device as companion 2023-11-28 18:12:12 +00:00
José Rebelo
ae75f82a63 Zepp OS: Improve activity fetch logging 2023-11-26 21:14:46 +00:00
José Rebelo
c5757ea478 Mi Band 8: Improve stress charts 2023-11-26 21:01:32 +00:00
José Rebelo
50cdcec846 Xiaomi: Delete device data when deleting device 2023-11-26 21:01:32 +00:00