1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-08-05 13:32:14 +02:00
Commit Graph

182 Commits

Author SHA1 Message Date
cpfeiffer
8fc6dfeca7 Improved AlertNotificationProfile
AlertLevel, AlertCategory, Control Point
2017-03-14 00:45:54 +01:00
License Bot
e392fbfd80 Add license header to all java files. 2017-03-10 14:53:19 +01:00
cpfeiffer
6282597790 Handle BT issues with discovered characteristics
It occurred to me that onServicesDiscovered() was called multiple times
whenever I connected to my Mi Band 2. Either the band actually sent the
characteristics in multiple chunks or Android itself notified multiple
times.

So we gracefully handle this by
- updating the list of characteristics
- *not* initializing the device again when it *is* already initialized
or at least initializing.
2017-03-09 22:49:13 +01:00
cpfeiffer
4419200624 Mi2: Initial support for textual notifications #560 2017-03-03 20:12:43 +01:00
cpfeiffer
6c269aa089 Generic characteristic names from field names 2017-01-08 21:37:43 +01:00
cpfeiffer
6dfc895303 Mi2: Initial work on firmware update #427 2016-12-11 02:11:58 +01:00
Andreas Shimokawa
17b581022b optimize imports 2016-12-09 20:14:17 +01:00
cpfeiffer
44f74270df Mi2: Experimental support for activity recognition 2016-12-02 00:22:06 +01:00
Uwe Hermann
0746aaa579 app: Random typo and consistency fixes. 2016-12-01 20:22:12 +01:00
Uwe Hermann
6dd74d04ac code/docs: Consistently use the "Gadgetbridge" spelling.
"Gadgetbridge" appears to be the common spelling as per most docs,
code comments, wiki, and so on. Thus avoid using "GadgetBridge".
2016-12-01 17:28:51 +01:00
cpfeiffer
09ff95eb34 Support for continuous hr readings (live activity) #323 2016-11-29 23:25:11 +01:00
cpfeiffer
82cd06f4c1 Mi2: WIP: initial support for activity data
(#323)
2016-11-22 00:05:41 +01:00
cpfeiffer
51fa31aa66 Fix BLE type conversions problems 2016-11-18 23:36:22 +01:00
cpfeiffer
ddaf51768d Improved logging 2016-11-13 20:24:25 +01:00
cpfeiffer
b20a9c9ccc Some initial hacky support for hr readings (Debug activity only)
My Mi2 stopped reporting hr values a while ago though, even on-device.
2016-10-23 23:53:48 +02:00
cpfeiffer
839da4f06a Shuffle some logging things around 2016-10-21 00:50:41 +02:00
cpfeiffer
8f36712342 WIP: A little more Alert Notification Profile
I think we should rather focus on a code generator, though.
2016-09-29 20:32:15 +02:00
cpfeiffer
c2f8037f07 WIP: Alert Notification Profile 2016-09-26 22:21:59 +02:00
Andreas Shimokawa
55a1248e8f compile fix 2016-09-26 21:43:10 +02:00
cpfeiffer
d4b134a490 WIP regarding heart rate profile 2016-09-26 11:44:57 +02:00
cpfeiffer
ccdb843b6e Improved Mi Band 2 support #323
- connecting works and is stable
- firmware and hardware version is displayed
- time is set
2016-09-20 23:12:17 +02:00
Andreas Shimokawa
da01a76594 fix BatteryInfoProfile NPE, show battery level for Vibratissimo 2016-09-19 16:37:45 +02:00
JohnnySun
53d4681763 Optimize Imports 2016-09-13 23:53:35 +08:00
cpfeiffer
fbf06c1fe3 Separate coordinator and support instances for Mi1 and Mi2 #323
+ Some more testing stuff for Mi2
2016-08-17 00:53:16 +02:00
cpfeiffer
9b7e8e06d6 Improved time conversion (0x2A0F)
- support for org.bluetooth.characteristic.local_time_information
- support for day of week in 0x2A2B

Unfortunately Mi Band 2 does not support 0x2A0F ;(
2016-08-15 00:40:35 +02:00
cpfeiffer
43d7566c0b some more microsteps #206 2016-08-01 22:18:57 +02:00
cpfeiffer
b43b7948b0 Let GallCallback return boolean values in order to mark an event as "consumed"
(to avoid dispatching the event to further listeners (ble profiles)
2016-07-28 23:04:37 +02:00
cpfeiffer
f5ba09ebe0 Some babysteps towards miband2 support #323
Start to implement standard BLE profiles/services.
2016-07-25 00:00:22 +02:00
cpfeiffer
1997a9b7fa some more service discovery logging 2016-07-18 23:55:44 +02:00
cpfeiffer
8154a887cb When there are cached services, skip service discovery 2016-07-08 22:15:36 +02:00
cpfeiffer
8549031c6f Only attempt to reconnect when we were previously initialized 2016-07-04 23:38:25 +02:00
cpfeiffer
f0da25c49b Fix activity fetching getting stuck when double tapping #333 2016-06-28 23:07:24 +02:00
cpfeiffer
2d49ce505a Set state to "Waiting for reconnect" for BTLE devices 2016-05-26 23:48:05 +02:00
cpfeiffer
6e33c7364a Remove some commented code 2016-05-26 22:21:58 +02:00
cpfeiffer
c360eb3392 This should fix some connection problems #274
Some APIs have become synchronous, it seems, e.g.
connectGatt() -> onConnectionStateChanged() -> discoverServices() -> onServicesDiscovered()
appears to happen synchronously. So connectGatt() will not return before services are discovered!

So now we deal with this situation.
2016-05-26 19:03:38 +02:00
cpfeiffer
5e02724c4c Make automatic reconnect after connection loss configurable #293
Mi Band: automatically reconnect when the device is back in range

Also: #89
2016-04-28 23:17:13 +02:00
cpfeiffer
802e9a8235 OK, revert to connectGatt(false), connect often does not work with true #249 2016-04-09 09:53:03 +02:00
cpfeiffer
1e5dbb6a23 OK, just connect(true) is not sufficient #249
(we again get connection problems. Let's try this.)
2016-04-07 20:53:25 +02:00
Andreas Shimokawa
a15b327ff1 Refactoring: get rid of ServiceCommand, use new CallSpec and MusicSpec to pass Call and Music info 2016-04-04 20:08:34 +02:00
cpfeiffer
3e3cf462a6 Attempt to re-enable automatic reconnect (autosensing) #249
(now that initializing device works again)
2016-04-03 23:32:15 +02:00
cpfeiffer
804a85d31f Small refactoring of BtLE actions 2016-04-03 21:46:24 +02:00
cpfeiffer
cc7f5406ef Use low latency transfer mode for fw update #234 2016-03-30 21:48:42 +02:00
cpfeiffer
8815f0d134 Small cleanups and fixlets. 2016-03-28 23:02:22 +02:00
cpfeiffer
1348bad4d3 Improved log output 2016-03-23 22:17:01 +01:00
Andreas Shimokawa
ed85fd5011 convert byte and short values related to activity tracking to int
This avoids a lot of problems because java
- does not know unsigned values
- jvm and dalvic do not internally support byte and short
- sqlite does not know them either
2016-02-29 20:54:39 +01:00
cpfeiffer
109146c8c1 Attempt at fixing a (re-) connection issue
Sometimes reconnection lead only to "Connected" state, but not "Initialized".
This probably happened when the device got disconnected earlier and then was
automatically reconnected. The reconnection closed the previous connection,
which caused the dispatch-thread to wake up and think the connection is
actually establish. Then, when the first action is invoked, it would fail
with an NPE because mBluetoothGatt passed to the action is actually null.
2016-02-18 23:44:01 +01:00
cpfeiffer
c86365ee2e Some more Mi Band pairing improvements #180
- listen to notifications early -- the band then actually tells us that
  authentication is required
- check for this after sending user info
- add authentication states to GBDevice
- workaround for event problems in pairing activity (delivered although
  already unregistered)
- BtLEQueue now deals with gatt events coming *before* connectGatt()
  actually returned (namely the connection event)
2016-02-13 00:15:16 +01:00
cpfeiffer
ae5417b9cc Avoid NPEs when aborting an erroneous sync #205 2016-01-07 00:33:20 +01:00
cpfeiffer
aa60ce4b56 Disable some notifications also for update-firmware operation
(introduce a common superclass to do that)
2015-12-07 01:13:47 +01:00
cpfeiffer
40d7f3b19f Improved log output for progress actions 2015-11-30 23:42:59 +01:00
cpfeiffer
4b42a9a4f6 Improved log output for abort actions 2015-11-30 23:42:59 +01:00
cpfeiffer
8585572197 Improved log output for plain actions 2015-11-30 23:42:59 +01:00
cpfeiffer
bd0716ba58 Some more lint warnings fixed 2015-11-23 23:04:46 +01:00
cpfeiffer
81c2f657bd Some lint fixes 2015-11-23 22:46:12 +01:00
cpfeiffer
f349846f4a Another small change to BTLE device connection #156 2015-11-13 23:53:48 +01:00
cpfeiffer
58cfd0fef9 For a start, connect with "false" #156
My connection problems went away with this. Let's see how it works out.
2015-11-03 20:23:48 +01:00
cpfeiffer
c27459b6cc It's recommended to cancel discovery before connecting 2015-11-01 23:32:25 +01:00
cpfeiffer
ac120dc7d6 Small improvement to connect() 2015-10-22 00:32:16 +02:00
cpfeiffer
52f3ca5253 Always name things positively. Negating things is bad for comprehension :-) 2015-10-19 23:36:10 +02:00
cpfeiffer
5a3990b9d2 Guard logging with LOG.isDebugEnabled() 2015-10-19 20:56:56 +02:00
Daniele Gobbetti
6460b391d9 Be dump the content of the notification to the debug log 2015-10-19 15:16:21 +02:00
cpfeiffer
dcd776e09a Attempt to fix never finishing activity data fetching #142
(by disabling unrelated notifications)
2015-10-18 22:27:52 +02:00
Sergey Trofimov
7591d4a8af Fix typo 2015-10-18 18:29:41 +03:00
cpfeiffer
9db7d13a94 Log any exceptions during ble callbacks, if any #91 2015-10-04 00:00:53 +02:00
cpfeiffer
5b8bf468f5 Remove some superfluous checks 2015-10-03 23:52:33 +02:00
cpfeiffer
d6f9eac711 Revert to previous BLE connection method:
- first, connectGatt(true) to support automatic (re-) connection
- second, bluetoothGatt.connect() to connect immediately
2015-10-03 00:21:31 +02:00
Daniele Gobbetti
f8edf5c525 Move BLE standard characteristic and services debug names to the right class. 2015-09-28 16:28:08 +02:00
Daniele Gobbetti
deea721090 Add verbatim Official BLE Services, Descriptors and Characteristics.
Move the already defined constants to these new classes.
2015-09-28 12:51:01 +02:00
Daniele Gobbetti
720eaa111d Add generic service for immediate alert and prepare the code to support characteristics from different services 2015-09-25 17:45:06 +02:00
Andreas Shimokawa
1d41f2f8e4 Refactoring
The notfification APIs now use NotificationSpec as their only parameter, which
contains all information (required and optional ones).
We no longer have separate methods and actions for SMS/EMAIL/GENERIC anymore.
The type of notification is important now, not how we received them technically.
2015-09-24 14:45:21 +02:00
cpfeiffer
80d15573af Avoid tiny window where a gatt callback of an operation could be unset 2015-09-10 00:00:52 +02:00
cpfeiffer
c23905070c Some more logging improvelets 2015-09-09 23:39:57 +02:00
cpfeiffer
22a9ff1819 Log when no listener is registered for a characteristic change 2015-09-09 23:23:38 +02:00
cpfeiffer
69b64ed4b6 More logging for time/timezone changes
(trying to find an explanation for #91)
2015-09-05 00:14:09 +02:00
cpfeiffer
dbb92b55bc Make the Operations classes BLE-generic 2015-08-18 00:31:40 +02:00
cpfeiffer
33b598ce5c First part of extracting parts out of MiBandSupport
Extract Activity Data fetching into distinct 'operation' class.

Fix a few small things wrt transaction-local GattCallbacks along the way.
2015-08-18 00:11:53 +02:00
cpfeiffer
eec7fae288 Attempting to fix some connection problems after getting disconnected 2015-08-14 00:23:01 +02:00
Daniele Gobbetti
fd5a620091 re-add support for NO_RESPONSE write characteristic 2015-08-10 09:20:06 +02:00
Daniele Gobbetti
fe11e6d306 Some BTLE cleanup:
- the BASE_UUID is shared between all BTLE devices, not miband specific. So are the UUID DESCRIPTORS. Hence these have been moved to AbstractBTLEDeviceSupport
- the gatt-characteristic-property-constants used previously in MiBandNotifyAction are also general, and exposed by the gatt subsystem, hence the specific action has been dropped moving the logic to the NotifyAction class
 - the logic for checking the gatt-characteristic-property-constants has been extended also to the ReadAction and WriteAction class, this way we won't try to read (or write)  a characteristic that isn't readable (or writeable)
2015-08-07 16:59:52 +02:00
cpfeiffer
b7223c7e86 Initial support for transaction-local GattCallbacks (not used yet)
So that we won't have to mix everything in MiBandSupport
2015-08-05 23:26:09 +02:00
cpfeiffer
bdc9e70e6e Attempt to fix reconnection problems after being away from the Mi Band
*untested*
2015-08-04 22:03:10 +02:00
cpfeiffer
7c597b325a Big refactoring: move classes and packages around to get a better structure
- model package contains mostly shared interfaces (UI+service), not named GB*
- impl package contains implementations of those interfaces, named GB*
  the impl classes should not be used by the service (not completely done)
- the service classes should mostly use classes inside the service and deviceevents
  packages (tbd)

Every device now has two packages:
- devices/[device name] for UI related functionality
- service[device name] for lowlevel communication
2015-08-03 23:09:49 +02:00