Commit Graph

332 Commits (18926e6bbdb7e4a65d939f3af192eb9bcc5f6588)

Author SHA1 Message Date
cpfeiffer 4b374e3f7e Implement changeStoredSamplesType() 2016-05-16 23:45:21 +02:00
Andreas Shimokawa 4bd578ebea Pebble: send sunrise/sunset to watch for today and tomorrow, also delete previous timeline pins 2016-05-16 23:37:40 +02:00
cpfeiffer 876bdac918 More WIP: remove now unused code, better use of generics 2016-05-16 23:36:54 +02:00
cpfeiffer 40a376bbd0 Merge branch 'master' into db-refactoring 2016-05-16 23:01:16 +02:00
cpfeiffer 3e0bc16741 More WIP, but we're getting closer
current state:
- storing samples works (tested only mi band)
- charts work
2016-05-16 23:00:04 +02:00
Andreas Shimokawa 017f650b3f Pebble: send sunrine and sunset pins to timeline when setting time in debug menu
This is just a test and it will leak your timeline data, since we never delete it.
Also this adds some rough infrastructure for calendar events.
2016-05-16 17:30:11 +02:00
cpfeiffer 5963843216 Experimental support for #274 (untested yet) 2016-05-15 00:15:31 +02:00
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
cpfeiffer 9532fc879f "Ported" to AbstractSampleProvider 2016-05-08 23:17:05 +02:00
cpfeiffer 21cafa83d8 WIP: some more query work 2016-05-08 22:58:50 +02:00
cpfeiffer cc5941f7eb Merge branch 'master' into db-refactoring 2016-05-05 10:19:19 +02:00
cpfeiffer 808e12d680 A little more WIP 2016-05-05 10:19:01 +02:00
Andreas Shimokawa 045d5119ff Do not update summary for checkbox preference
Was causing summary to get overwritten by "true" or "false" when changing preferences
2016-05-04 13:07:11 +02:00
Andreas Shimokawa 619a17425f Mi Band: Display hint about starting Activity Activity instead of App Manager
TODO: Fix the string, I have no idea how to properly name the Activity Activity
2016-05-04 12:31:29 +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 0c715a2669 Wrap access to SharedPreferences with "Prefs"
(to centralize quirk handling)
2016-04-25 23:18:55 +02:00
Andreas Shimokawa faa6a9d906 use android:summary="%s" for ListPreferences 2016-04-14 16:44:44 +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 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
Christian Fischer 20aa7d9ad9 add preference to set hartrate sleep detection 2016-04-02 16:09:30 +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
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 9d9ef8a6f8 Some cleanup 2016-03-23 22:06:48 +01:00
Andreas Shimokawa df3a06ac9b Reformat code, make getter of @NonNull members also @NonNull 2016-03-22 21:55:15 +01:00
cpfeiffer b0ec74696d Give better feedback when a firmware cannot be installed #234 2016-03-22 16:12:27 +01:00
Andreas Shimokawa dbeded8d04 In Control Center, do not show alarm configuration in context menu if device does not support it 2016-03-20 17:53:55 +01:00
Andreas Shimokawa 4be1926459 reformat code though Android Studio 2016-03-20 15:00:05 +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 c5a887192d Remove/revert some temporary test code 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 a3ee3c15fc Pebble: copy pebble-app-js.js out of the pbw upon installation not upon reading the .pbw
This eliminates the need to copy the whole file into a byte[], and all file size limts are gone.
2016-03-08 11:41:20 +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
Andreas Shimokawa f616e4f571 Pebble: skip .js file if too large instead of breaking installation
(Hotfix)
2016-03-03 17:46:58 +01:00
Andreas Shimokawa bd7b34985b reformat code and optimize imports 2016-03-03 15:47:00 +01:00
Andreas Shimokawa 2a7f9226a0 Pebble: send configuration to watch
TODO: handle booleans
2016-03-03 14:23:17 +01:00
Andreas Shimokawa 63d938559e pass GBDevice down to ExternalPebbleJSActivity to determine the platform version (aplite,basalt,chalk) 2016-03-03 11:52:30 +01:00
Daniele Gobbetti 089a59168e Initial support for using an external browser for configuring pebble apps. This allows existing configuration pages to work without having internet access ourselves.
This is a better approach as initially thought in #191.

What is missing is outlined in the (several) TODOs.
2016-03-02 21:07:27 +01:00
Andreas Shimokawa fc464d112d change some more short and byte to int regarding Morpheuz 2016-02-29 23:13:07 +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
Andreas Shimokawa c449181083 Pebble: store appKeys in .json also.
Rumour says someone needs it soon...
2016-02-27 11:40:37 +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
Andreas Shimokawa 70ae5a2a3a Pebble: Allow to select the preferred activity tracker via settings activity (Health, Misfit, Morpheuz) 2016-02-18 20:41:22 +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
Daniele Gobbetti 20c4e49fe1 Refactoring of the Pebble Health steps data receiver.
Added logic to deal with pebble health sleep data.
Added database helper to change the type of a range of samples (needed for sleep data).
Fixes to the Pebble Health sample provider.
2016-02-09 17:52:21 +01:00
danielegobbetti 2f8207abf9 Initial support for reading pebble health steps/activity data. 2016-02-07 09:27:51 +01:00
Daniele Gobbetti baf5eee72f Refactored the User Activity-tracking related preferences.
Created a new device-independent class ActivityUser to hold the data
Moved the constants from the miband constant class to the ActivityUser class
Removed the miband-specific in favor of common-prefixed preferences (with upgrade support for legacy values)
Changed the way the gender is stored to an integer value
Removed the hardcoded default values for user data in favor of static fields of the ActivityUser class
2016-02-02 17:33:24 +01:00
Daniele Gobbetti 94c8633bad Move the generic user info outside the miband preferences activity. They still have to be renamed. 2016-02-02 14:32:19 +01:00
cpfeiffer a6d3c50f94 Fix discovery of Mi Band 1S #196
closes #204
2016-01-06 23:38:17 +01:00
cpfeiffer 41dde9a9c2 Programmatically perform a bonding
(i.e. bluetooth-level pairing). Previously the pairing appeared to
happen automagically, but this doesn't work (anymore). So now we first
pair on the bluetooth-level, then application level.
2016-01-06 00:16:41 +01:00
Andreas Shimokawa 0c805809a5 Pebble: allow pbw installation with appinfo.json files up to 64k (was 8k)
Fixes DIN watchface installation
2015-12-21 22:32:27 +01:00
Daniele Gobbetti 0dda5c214b Add preference for reserved alarm slots (for calendar event notification)
Just this, no logic to support the choice yet.
2015-12-17 16:11:35 +01:00
cpfeiffer f258e62633 Refactoring: centralize GBDevice creation
- created and provided by DeviceHelper
- passed from UI to service
- without UI, service uses DeviceHelper directly

=> Cleaner and less duplicated code
2015-12-13 00:43:07 +01:00
Andreas Shimokawa b1954eec3e make use of some new icons 2015-12-11 21:38:43 +01:00
Andreas Shimokawa 4528aaf22f Pebble: Allow installing apps compiled with SDK 2.x also on the balast platform (pebble time, pebble time steel) 2015-12-11 21:11:55 +01:00
cpfeiffer 0d63e5b770 User Info is probably the same for MI 1A and 1S #178
Can you please test whether this fixes the connection problems?
2015-12-08 21:48:56 +01:00
Andreas Shimokawa f59382e3c8 Pebble: Show correct icon for activity tracker and watchfaces in app installer (language and fw icons still missing) 2015-12-08 18:32:17 +01:00
Andreas Shimokawa 62c196eb1d Pebble: determine pbw type early for correct display in pbw-cache on firmware 3.x 2015-12-08 13:23:07 +01:00
Andreas Shimokawa 3ac00a004f Pebble: Support installing .pbl (language files) on firmware 3.x 2015-12-08 12:07:14 +01:00
Andreas Shimokawa 1c3e0b628b Pebble: store app details in pbw-cache and display them in app manager on firmware 3.x
Improves #93
2015-12-07 18:16:23 +01:00
cpfeiffer 134eeacaea Whitelisted 5.15.7.14 2015-12-07 01:22:27 +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 b056e1b2a0 tiny log addition 2015-12-07 01:13:47 +01:00
Andreas Shimokawa b05cfc6aac Pebble: fix crash on firmware 3.x when pebble requests a pbw that is not in Gadgetbridge's cache 2015-12-06 17:56:46 +01:00
Andreas Shimokawa 79f92b8495 Fix installing pbw files from different URIs than local files on Firmware 3.x. Fixes #183 2015-12-06 17:22:07 +01:00
Andreas Shimokawa 9ebb320e10 fix installing pbz/pbw files from content provides (eg. download manager)
This still does not fix pbw isntallation problems with FW 3.x since the content does not get copied to the pbw cache yet when content providers are involved
2015-12-06 16:48:43 +01:00
Andreas Shimokawa bc108ba095 Pebble: support installing 3.x apps on OG Pebble 2015-12-05 16:06:42 +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 d4f070f0aa Simplify external dir handling again -- prefer the primary dir
The primary external dir is often a user-partition on the internal
storage medium. This one is safe in multi-user environments.

The "removable storage" (sdcard) on the other hand can be read by
everyone. If the former is not available or not writable, use the
latter.

closes #153
2015-11-01 20:49:50 +01:00
cpfeiffer 694b3d897f Some Javadoc 2015-10-26 23:32:03 +01:00
cpfeiffer 4200e77016 Disable activity data fetching when not supported
Closes #149
2015-10-24 23:28:55 +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 3b94a96060 Fix some warnings 2015-10-21 23:29:37 +02:00
Andreas Shimokawa 44a36a5f1d Pebble: First try to receive at least steps from the Misfit pebble watchapp 2015-10-21 23:11:59 +09:00
Sergey Trofimov d57c6166b9 Fix pairing with MI1A 2015-10-18 21:54:22 +03:00
Andreas Shimokawa 262271dbd0 Pebble: calculate CRC for language files (.pbl) since they do not have a manifest
It should fix installation of all .pbl files (tested with Spanish, German, French and the inofficial Japanese language pack)
This also marks the return of the infamous STM32CRC, this time with hopefully fixed tail code.
2015-10-07 22:29:30 +09:00
Andreas Shimokawa 5860c4f4f9 Pebble: WIP support for flashing language files (.pbl)
NOTES:
- YOU SHOULD NOT TRY THIS YET ;)
- This was only tested with the unoffical japansese language pack
- Problably needs proper crc calculation (I just hardcoded the one for the japanese language pack)
2015-10-06 23:56:01 +09:00
cpfeiffer 586d959055 Merge branch 'master' into live-activity-data 2015-10-02 23:49:03 +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
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
Andreas Shimokawa 3bb673d33a Pebble Time Round support ("chalk" platform) 2015-09-23 23:20:49 +02:00
cpfeiffer 3852fcd756 Reuse MiBandDateConverter 2015-09-23 23:16:42 +02:00
Andreas Shimokawa 77b4bb9cf1 Mi Band: Do not whitelist 1.0.10.14 anymore, vibration seems to be broken with Gadgetbridge 2015-09-20 22:13:25 +02:00
Daniele Gobbetti 55341678b3 Add firmwares from the wiki. 2015-09-17 16:56:23 +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 d3dbde6917 Some refactoring:
- Put Pebble icon ID constants in its own class
- remove ICON_ and COLOR_ prefixes from constants
2015-09-13 15:21:07 +02:00
Julien Pivotto 1027336591 Pebble: Support colors in 3.x notifications (Pebble Time)
* Generic notifications are still red
* Colors are in a separated static class

Closes #120.
2015-09-13 14:54:43 +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 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 ab8982e7f2 WIP: support for live display of activity data 2015-09-02 08:02:26 +02:00
Andreas Shimokawa 46171e4ab8 Some preparations for interactive notifications 2015-08-31 22:27:25 +02:00
Daniele Gobbetti ee3ca5998e Fail early when opening a pebble file.
Fixes #102

We could also use a whitelist approach instead, but we can't be sure that the user installs a file with .fw extension, hence i preferred to only avoid loading files which are known to be of the wrong type.
2015-08-31 17:41:09 +02:00
cpfeiffer 41d8bcf634 Make firmware and app installation a bit more user friendly #30 2015-08-30 00:21:51 +02:00
Daniele Gobbetti 26792717d4 Add showing when the device wasn't worn by the user 2015-08-28 14:58:30 +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 df417e5c6c Fix bug regarding setting wear location.
Closes #95
2015-08-21 15:23:48 +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
Andreas Shimokawa faaa04b670 App Installation: various improvements
- make FwAppInstallerActivity wait for a completely initialized device
- check basalt/aplite compatibility with pbw to be installed and report intead of crashing
- fix crash when trying to install pbw with all app slots full
2015-08-20 18:55:22 +02:00
cpfeiffer e6a0c35f73 Extract checksum implementations into separate class CheckSums 2015-08-17 22:43:42 +02:00
Andreas Shimokawa 6fede31bdf Pebble: make watchapp installation available on FW 3.x without the need for setting an option 2015-08-17 18:07:47 +02:00
cpfeiffer 964994972b Fix for pebble sample provider switching without quitting gb) 2015-08-16 23:30:16 +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
Andreas Shimokawa f659e34efc Pebble: do not use platform dir for pbz(firmware) files, even basalt has its files in / for fw files 2015-08-14 17:32:06 +02:00
Andreas Shimokawa e28d6fa7cb Pebble: try to install app metadata on FW 3.x (untested) 2015-08-14 12:51:30 +02:00
Andreas Shimokawa 151f5b8e12 Pebble: Choose binaries from basalt/ inside .pbw files for Pebble Time
PBW installation is still unsupported on FW 3.x, these are just preparations
2015-08-11 12:47:23 +02:00
Andreas Shimokawa 5a8c9a9180 Pebble: cache installed pbw files on sdcard if force untested option is set
This will be needed for FW 3.x on demand installations.
2015-08-11 12:04:45 +02:00
Andreas Shimokawa 0be251e83d Pebble: if untested features option is enabled use Gadgetbridge sample provider insted of Morpheuz 2015-08-11 11:21:10 +02:00
Andreas Shimokawa 5884684cad Pebble: add option to enable untested features.
Bad things incoming ;)
2015-08-11 11:15:44 +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 9004a8b0c1 Experimental: ACTION_START is now optional -- ACTION_CONNECT is sufficient 2015-08-06 23:17:41 +02:00
cpfeiffer 64298fc9af Small improvements for the install activity #30
Now starts the service if not already running
2015-08-06 21:35:00 +02:00
cpfeiffer 2a2eae068a Improvements to the install activity #30
- made it independent of Mi fw and Pebble fw + app classes
- automatically connect to the last used device
- some other small fixes/improvements
2015-08-06 02:17:38 +02:00
Daniele Gobbetti 495a8cc650 Reorder the lines in the MiBandService class.
No functional changes, just clarity enhanchement.
2015-08-05 17:32:02 +02:00
cpfeiffer e92c9dbbb5 Better check for fw version major (#30) 2015-08-04 23:08:40 +02:00
cpfeiffer 910d9ef398 Make firmware reading a bit more failsafe #30 2015-08-04 23:02:36 +02:00
cpfeiffer c407ed1a76 Last refactoring for now: BluetoothCommunicationService
- rename to DeviceCommunicationService
- move all bluetooth related bits into separate DeviceSupportFactory
  class
2015-08-04 01:01:14 +02:00
cpfeiffer db4261e02b More refactoring: new service/devices package and service/bt package 2015-08-03 23:51:53 +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