Commit Graph

39 Commits (273c2ddbfd9c2c655d5fae76c1ce1598b72d66ea)

Author SHA1 Message Date
cpfeiffer 696dc1f08d Attempt to fix reconnection not happening in some cases
Fixes #530
2017-04-20 23:01:32 +02:00
License Bot e392fbfd80 Add license header to all java files. 2017-03-10 14:53:19 +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 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
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 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
cpfeiffer 3e3cf462a6 Attempt to re-enable automatic reconnect (autosensing) #249
(now that initializing device works again)
2016-04-03 23:32:15 +02: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 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 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
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 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
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