Commit Graph

235 Commits (ac07ddc9326f5a3749a77d1d94ba57d7d0d136e2)

Author SHA1 Message Date
cpfeiffer 8ca821ab8a More WIP on db refactoring 2016-05-13 23:47:47 +02:00
cpfeiffer d0c8483d92 More WIP 2016-05-08 23:49:15 +02:00
Andreas Shimokawa 65a95366f4 Mi Band: Allow setting low-latency FW update mode in Mi Band development settings 2016-05-04 13:24:32 +02:00
cpfeiffer e35ce978bd Remove now unused imports + fix one more SharedPreferences usage 2016-04-25 23:43:19 +02:00
cpfeiffer 0704915a88 Move parsing of preference strings to int values to Prefs 2016-04-25 23:39:03 +02:00
cpfeiffer 78bf516897 Disabling sleep measurement for continuous measurement is not necessary
Looks like they don't interfere, after all. #178
2016-04-12 23:25:12 +02:00
cpfeiffer f15a97d994 Initial live heartrate measurement in the live activity tab #178 2016-04-12 23:12:50 +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 59c3970008 Reuse characteristic objects #234 2016-04-03 23:01:58 +02:00
cpfeiffer b129844169 Small fixes to PR 273 #232
- dynamically toggle hr sleep support when preference changes
- check hr support dynaically after device info is available to avoid false error message
2016-04-03 22:38:06 +02:00
cpfeiffer 7cda9f1923 Merge branch 'computerlyrik-heartrate-sleep-support' 2016-04-03 21:46:29 +02:00
cpfeiffer 804a85d31f Small refactoring of BtLE actions 2016-04-03 21:46:24 +02:00
cpfeiffer b54fe53cd5 Merge branch 'heartrate-sleep-support' of https://github.com/computerlyrik/Gadgetbridge into computerlyrik-heartrate-sleep-support 2016-04-03 21:02:45 +02:00
cpfeiffer a4919789ca Add some progress to firmware updating #271 #234
Also: remove the low latency mode for firmware update,
because my Mi1S simply disconnects then.

Still missing in the view: device disconnects
2016-04-03 00:50:45 +02:00
cpfeiffer 2d10c11005 Log the length of the bytes written 2016-04-02 22:35:37 +02:00
cpfeiffer 0e49535966 Fix progress during fw update #234 2016-04-02 22:24:33 +02:00
Christian Fischer f2de21a664 test if heartrate is supported before writing preferences 2016-04-02 16:11:51 +02:00
Christian Fischer 20aa7d9ad9 add preference to set hartrate sleep detection 2016-04-02 16:09:30 +02:00
cpfeiffer ea5c6a0848 Log ignored notifications when updateCoordinator is null 2016-03-31 21:57:36 +02:00
cpfeiffer 6f97b8c1e5 Log the date that we receive from the Mi Band 2016-03-31 21:54:09 +02:00
cpfeiffer 66c1b3f178 Relax check for Mi1S device detection #234 2016-03-31 21:39:51 +02:00
cpfeiffer 4631df67ac Some more logging + add svg launcher again (somehow it was not added again) 2016-03-30 22:53:08 +02:00
cpfeiffer ffc006c21c Fix ordering problem with firmwareInfoSent state variable #234 2016-03-30 21:56:00 +02:00
cpfeiffer cc7f5406ef Use low latency transfer mode for fw update #234 2016-03-30 21:48:42 +02:00
cpfeiffer e931cf47d7 Need to pass '0' as parameter to mi band fw metadata info #234 2016-03-29 22:15:14 +02:00
cpfeiffer 8815f0d134 Small cleanups and fixlets. 2016-03-28 23:02:22 +02:00
Andreas Shimokawa adfef3db42 Prepare code for more music metadata (duration, track count, current track number)
Oh and format code
2016-03-27 17:45:44 +02:00
cpfeiffer 8165751e57 Refactoring to test the double firmware update procedure #234
(while performing the same, known to be working firmware update for Mi1A)

Result: double firmware update procedure works on Mi1A.

Also updated FirmwareTest. Perform all tests not only in the test itself,
but also at runtime before doing the actual update.

Further:
- fix setting of firmwareInfoSent state variable, which prevented installation
  of the section firmware
- make one string translatable
2016-03-25 23:45:27 +01:00
cpfeiffer 3714ec82da Extracted String "HR: ", (= Heart Rate Firmware Version) 2016-03-24 22:23:16 +01:00
cpfeiffer 89eddb13b0 Fixed connection issues by reading the date from the band #249 2016-03-24 22:10:23 +01:00
cpfeiffer e5b0afb916 Enable low latency during activity sync 2016-03-24 21:26:51 +01:00
cpfeiffer 11ac01f0e8 Set low latency mode during initialization #249
This appears to fix the initialization getting stuck sometimes, e.g.
after turning on bluetooth and then connecting.

The band incidentally sends 0x8 when it's stuck (won't accept the UUID_PAIR
request).
2016-03-23 22:50:42 +01:00
cpfeiffer b0ec74696d Give better feedback when a firmware cannot be installed #234 2016-03-22 16:12:27 +01:00
cpfeiffer 424d9cd142 More work on firmware detection, recognition and validation #234
Should be as robust as possible now.
2016-03-21 23:42:34 +01:00
cpfeiffer 275839a7f4 last arg of copyOfRange() is index, not length! 2016-03-21 04:18:45 +01:00
cpfeiffer f7b71c1f96 Add logging to firmware detection #234 2016-03-21 04:17:12 +01:00
Andreas Shimokawa 4be1926459 reformat code though Android Studio 2016-03-20 15:00:05 +01:00
cpfeiffer b3410dcebe Improved testcase #234 2016-03-20 12:18:43 +01:00
cpfeiffer 4f956000c5 Enhanced support for firmware detection, recognition and upgrade #234
Also supports double firmware upgrade for Mi1S.
- so far, only hr firmware upgrade is tested for 1S
- adds junit testcases for firmware recognition and handling
2016-03-20 01:07:57 +01:00
cpfeiffer 6d8d6d5bc8 Testcases for firmware checking 2016-03-20 01:07:57 +01:00
cpfeiffer c5a887192d Remove/revert some temporary test code 2016-03-16 00:27:32 +01:00
cpfeiffer e26e6d7b24 Display HR firmware version
Hide fw,hw,hr versions by default and show them on demand with an info
button.
2016-03-16 00:27:32 +01:00
cpfeiffer 91f02ae920 WIP: Lots of work towards double firmware update for Mi 1S #234 2016-03-16 00:27:08 +01:00
Andreas Shimokawa 88982a6174 Merge pull request #235 from Freeyourgadget/feature-configuration
Use external browser for configuring pebble apps
2016-03-08 10:41:46 +01:00
cpfeiffer 5eb8f57b4c Some more byte -> int conversions 2016-03-07 22:47:34 +01:00
cpfeiffer be012eca8d For Mi Band 1A (fw 5.15.7.14) we get 0xa for auth success #180 2016-03-07 21:43:45 +01:00
cpfeiffer 50dd7f5eba Better check for heartrate support on non-heartrate devices 2016-03-07 21:36:31 +01:00
Andreas Shimokawa 2a7f9226a0 Pebble: send configuration to watch
TODO: handle booleans
2016-03-03 14:23:17 +01:00
cpfeiffer cbe73f71a1 Fix some typos (thanks!) #178 2016-02-29 22:08:34 +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 ddde25e5df Initial firmware update support for Mi1S #234 2016-02-28 02:46:48 +01:00
cpfeiffer d7822d07a6 Show the measured heart rate as a Toast, for now #178 2016-02-27 23:27:15 +01:00
cpfeiffer 3ff31cd73b Disable heartrate in charts fow now, fix notification for manual hr 2016-02-27 23:18:44 +01:00
cpfeiffer ac8d7bee5f Only do heart rate stuff when supported #178 2016-02-27 11:23:55 +01:00
cpfeiffer de6f898fef Some more fixes regarding heart rate measurement #178 2016-02-27 11:18:16 +01:00
Kasha 9e636d66f6 Initial heart rate support by KashaMalaga #178
(removed unrelated Android M fixes and squashed commits)
2016-02-27 00:05:06 +01:00
cpfeiffer 0ef738067d Some work in progress for heart rate graphs #178
Currently we get the heart rate when synchronizing activity data
(i.e. not live) and we write it to the activity database so that we
can show a nice graph. The value is currently always 0 though,
because we can't enable recording hr, yet.
2016-02-26 23:45:17 +01:00
cpfeiffer 0b568df8de Extra byte indeed appears to be heartrate value #205 2016-02-26 00:04:33 +01:00
cpfeiffer 095ef56c14 Initial support for activity data sync with Mi 1S #205
Looks like the activity type is somehow wrong though, or I'm sleeping
all day ;-)
2016-02-25 23:52:34 +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
Daniele Gobbetti f9122bc674 send the calendar events each time the time is sent to miband, until we have a common strategy (e.g. EventHandler). 2015-12-29 10:01:32 +01:00
Daniele Gobbetti 1d9e1d7caf Fix possible race condition when availableSlots == 3
(There are two difficult things...)
2015-12-29 09:18:02 +01:00
danielegobbetti 9fb2e1620e Rename misnamed file. 2015-12-19 14:36:28 +01:00
danielegobbetti 89ef950c62 Add the feature to changelog.
Fix max index for alarms on miband.
2015-12-18 20:30:09 +01:00
danielegobbetti 5fb8c7bed8 Use the right column for sorting upcoming events.
Plus add forgotten getQueue
2015-12-18 18:49:29 +01:00
Daniele Gobbetti 036e92ee64 Implement sending the upcoming events to the miband.
The reserved alarm slots are used for storing the upcoming events.

The method is not yet called anywhere.
2015-12-17 18:02:21 +01:00
cpfeiffer 854a7ee1ac Avoid NPE when DeviceInfo is null
(when a notification comes in while we're connected, but not initialized yet)
2015-12-09 17:55:46 +01:00
cpfeiffer 794ae6d800 Well, we better return something usefull instead of just false :-]
Please try again #178
2015-12-09 17:54:54 +01:00
cpfeiffer 365ce61cb6 Support for firmware upgrade/downgrade on Mi 1A.
I hope I didn't break firmware upgrades on some Mi 1 models
other than mine (my hardware revision is 2).

Upgrades for Mi 1S are currently disabled, we need some brave
souls who can help us test this.

Closes #173
Also see: #169
2015-12-07 01:14:06 +01:00
cpfeiffer 6b053c4240 Make method protected, for future use 2015-12-07 01:13:47 +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 8cd6bf09a4 Fix NPE when an error occurs during activity synchronization
(activityDataStruct is null after handleActivityFetchFinish())

Also remove superfluous log statement -- toasts are logged as well.
2015-12-07 01:13:47 +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 a53f1c21eb Simplification 2015-11-23 21:39:08 +01:00
cpfeiffer 952a383856 Use batched database commits for Mi Band activity samples 2015-11-01 21:41:36 +01:00
cpfeiffer 54c316778b Add exception to GB.toast() to get it logged 2015-10-25 00:13:32 +02:00
cpfeiffer c350f04fa9 Make "Locate device" work with newer firmware and MI1A. (#136)
Separate the different notification logic into distinct strategy classes.
2015-10-22 00:53:27 +02:00
cpfeiffer aa5749cd40 Some improvements to live activity.
Still rather inaccurate due to missing timing information.
2015-10-21 00:36:18 +02:00
Carsten Pfeiffer 4096e50681 Merge pull request #146 from sarg/master
Fix DeviceInfo checksum function.
2015-10-19 20:56:49 +02:00
Daniele Gobbetti cee03debbb - add code to send the confirmation of the activity data transfer after a timeout.
==> This is currently commented out because it was done to solve #141 but while doing this #143 popped out.
- send a stop_sync message to the band if the data doesn't fit the buffer. This way the data remains on the band.
2015-10-19 16:17:03 +02:00
Sergey Trofimov 94cbf2f301 Fix DeviceInfo checksum function. 2015-10-19 15:02:56 +03:00
cpfeiffer 4e0fed8857 Improvements to how and when alarms are sent to the device
They are now sent whenever the Alarms activity is finished.
Display "All alarms disabled" when no alarm is enabled.

Unrelated: pass exceptions to GB.toast() where applicable.
2015-10-18 23:52:59 +02:00
cpfeiffer ef15bf8ce8 Prevent firmware update for Mi Band 1A for now #136 2015-10-18 22:57:04 +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
cpfeiffer 7a44ea9596 Small comment 2015-10-18 21:33:07 +02:00
Sergey Trofimov d57c6166b9 Fix pairing with MI1A 2015-10-18 21:54:22 +03:00
cpfeiffer 321c0ff125 Log when we get bogus timestamps #91 2015-10-03 23:42:22 +02:00
cpfeiffer 586d959055 Merge branch 'master' into live-activity-data 2015-10-02 23:49:03 +02:00
cpfeiffer baa2d0b27a Displaying live activity data works well enough 2015-10-02 23:38:07 +02:00
Daniele Gobbetti d14ccf1c5c Get device name from the BLE Standard Characteristic.
Always log read and notify characteristics, even if unhandled.
Changed Log statements for write action to make them clearer.
2015-09-28 16:47:43 +02:00
Daniele Gobbetti 18f952250a First working code for vibrations on firmware version 1.0.10.14 2015-09-28 12:53:42 +02:00
cpfeiffer 4250a002b4 Merge branch 'master' into live-activity-data 2015-09-27 00:16:04 +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
Daniele Gobbetti e1ea8270ca Add a progress notification for the activity data transfer. 2015-09-24 14:03:01 +02:00
Daniele Gobbetti 5578691321 Fix progress bar 2015-09-24 14:02:33 +02:00
cpfeiffer d9b4bbe550 Move activity data and progress manipulation into dedicated methods
I did this in trying to understand the code better and to easier allow
for error handling/transaction rollback to be added.
2015-09-23 23:16:42 +02:00
cpfeiffer 3852fcd756 Reuse MiBandDateConverter 2015-09-23 23:16:42 +02:00
Daniele Gobbetti b73ff49681 Use data type constant instead of hardcoded value 2015-09-17 16:56:23 +02:00
Andreas Shimokawa 95e22a4e32 Pebble: Allow stopping apps though PebbleKit messages (also in the API) 2015-09-13 21:44:26 +02:00
Andreas Shimokawa 4f80844016 noficicaion_kind -> notificationKind 2015-09-13 13:38:11 +02:00
Julien Pivotto d50a82d495 Pebble: Set application icons for generic notifications
Closes #116.
2015-09-13 00:39:53 +02:00
cpfeiffer c23905070c Some more logging improvelets 2015-09-09 23:39:57 +02:00
cpfeiffer e80a3cc591 Log the number of samples being flushed #91 2015-09-09 22:33:06 +02:00
cpfeiffer e0ccb6bf84 Log the date/time that we sync to the Mi Band #91 2015-09-09 21:53:28 +02:00
cpfeiffer 518b1ee6f4 Merge branch 'master' into live-activity-data 2015-09-07 21:41:02 +02:00
Daniele Gobbetti 6c28b50f52 allow the transfer of activity data without clearing MiBand's memory 2015-09-07 12:06:56 +02:00
cpfeiffer 42420e676b More WIP: displays live activity data 2015-09-02 23:49:06 +02:00
Daniele Gobbetti b6cbb5d6be read initial value of live steps data when enabling notification 2015-09-02 16:36:20 +02:00
cpfeiffer ab8982e7f2 WIP: support for live display of activity data 2015-09-02 08:02:26 +02:00
cpfeiffer 5c2bd1e8df Avoid code duplication by reusing logMessageContent() 2015-09-01 21:26:51 +02:00
Andreas Shimokawa 46171e4ab8 Some preparations for interactive notifications 2015-08-31 22:27:25 +02:00
cpfeiffer 50960277dd Localized some firmware update texts and added some toasts on finish 2015-08-30 21:56:45 +02:00
cpfeiffer 41d8bcf634 Make firmware and app installation a bit more user friendly #30 2015-08-30 00:21:51 +02:00
cpfeiffer 530116976c Only call super.onCharacteristicChanged() when not handling it here 2015-08-29 20:48:33 +02:00
Daniele Gobbetti cbea0feb9e Centralize the calendar conversion to/from byte array take 2.
Move to an independent class.
2015-08-28 10:40:25 +02:00
Daniele Gobbetti 677e0808bf Centralize the calendar conversion to/from byte array. 2015-08-27 13:12:09 +02:00
Daniele Gobbetti 7923e153e6 Moved the enum to standalone in the model package. 2015-08-27 11:50:31 +02:00
Daniele Gobbetti dcc988139f Merge remote-tracking branch 'origin/master' into low_battery_notification 2015-08-21 17:34:11 +02:00
Daniele Gobbetti eb39ce9367 Further improvements:
- append a string on the control center when the device is charging
- battery status string is no more, welcome battery state enum
- the notification will not be shown when the device is charging, even if the level is below threshold
2015-08-21 08:41:57 +02:00
cpfeiffer a1cb246e27 Add and use a "client interface" for the actions of the service
Previously, the DeviceCommunicationService was invoked directly,
via
Intent intent = new Intent(foo, bar);
intent.setExtra(EXTRA_BAZ, baz);
startService(...);

and this was scattered throughout GadgetBridge.
Now there is a "frontend" available, so that you can call
the service more easily, like
GBApplication.deviceService().connect();

For a start, this client interface (DeviceService) actually
implements the same interface (EventHandler) as the receiving side
(DeviceSupport). This may change in the future.

This will also make testing much easier, because we can use
this client interface to invoke the test service as well.
2015-08-21 01:03:57 +02:00
Daniele Gobbetti c3e395818f Adding support for battery events using GBDeviceEvent.
- show notification on low battery (closes #40)
- Miband specific: add date of last charge and number of charges
2015-08-18 17:37:51 +02:00
cpfeiffer 99293d4ee5 Also extracted firmware update to separate operation 2015-08-18 00:52:02 +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 e6a0c35f73 Extract checksum implementations into separate class CheckSums 2015-08-17 22:43:42 +02:00
cpfeiffer bcf42f8022 Finally, the prev and next buttons do something (#79)
Far from perfect, but a start.
2015-08-17 02:22:16 +02:00
cpfeiffer 0bd65e050c Make intensity also always positive #91
I never experienced such values, but others apparently do...
2015-08-16 23:18:32 +02:00
cpfeiffer a66a3a15c2 Fix remaining byte parameter in the API for steps.
Maybe this was the reason for #91 (negative steps)

This could happen making at least 3 steps per second.
2015-08-15 00:23:13 +02:00
cpfeiffer ecc483f027 Remove now unused class 2015-08-14 23:50:21 +02:00
cpfeiffer d0229847e7 onFirmwareVersionReq() is no more
- version information is now provided implicitly by device initialization
- ACTION_REQUEST_VERSIONINFO is now ACTION_REQUEST_DEVICEINFO and it will
  return the current device state of the service without asking any DeviceSupport
  instance.
- ACTION_CONNECT now implicitly answers with a device update intent if it
  IS already connected.
2015-08-14 23:37:47 +02:00
Daniele Gobbetti b6d3317b2d First step for GBDeviceEvents support:
- change fw handling to GBDeviceEvent
- misuse the hw version for showing the MiBand device name (there is still no option to set a custom name)
2015-08-10 10:35:55 +02:00
cpfeiffer 910d9ef398 Make firmware reading a bit more failsafe #30 2015-08-04 23:02:36 +02:00
cpfeiffer db4261e02b More refactoring: new service/devices package and service/bt package 2015-08-03 23:51:53 +02:00