Commit Graph

1302 Commits (d3571d53b22aaf97b7931e75e40dd5979dcd4de4)

Author SHA1 Message Date
cpfeiffer c31049839a Make DeviceCommunicationServiceTestCase runnable with robolectric
- enables the test for travis
- tests operation when not connected
- tests connecting
- tests operation when connected
2016-09-10 11:12:51 +02:00
cpfeiffer ec0a0db4f6 Make strings translatable in the database management activity 2016-09-06 22:59:08 +02:00
cpfeiffer d011c437a2 This hopefully fixes the recreation of the old activity db
(I cannot reproduce or test it)
2016-09-06 21:54:03 +02:00
cpfeiffer f2b344349f Make some primary and foreign keys not-nullable 2016-09-06 00:00:48 +02:00
cpfeiffer afef50dfab Hide the "merge old activity database" elements when there is no old db 2016-09-05 23:55:00 +02:00
cpfeiffer 411a90326e Fix method name 2016-09-04 22:39:35 +02:00
Daniele Gobbetti 5cbedc782d Pebble health: accept records of firmware 4.0 (nothing changed among the data we parse) 2016-09-04 15:59:19 +02:00
cpfeiffer 8e154ca67d slightly more testing of Device/Attributes 2016-09-03 21:16:45 +02:00
Andreas Shimokawa 5a49f1215e Display known devices from db even if Bluetooth is off or unsupported
This allows to view activity data without turning bt on or connecting to the pebble emulator via tcp/ip (needs modified manifest for internet access)
2016-09-02 10:54:32 +02:00
cpfeiffer 6f02f9e350 Unit-Test and fix *Attributes sort order
When adding e.g. new DeviceAttributes, we cannot simply add them to the
attributes list, because that list is supposed to be ordered. We could
insert it at the beginning, but that would be brittle to changes in the
GBDaoGenerator, so we simply re-fetch them from the db after adding
new attributes.
2016-09-02 00:34:30 +02:00
Daniele Gobbetti 1e6cb67edd UI refactoring of the DB management activity.
Added a method to delete the legacy DB only.
2016-08-31 17:35:28 +02:00
Daniele Gobbetti 6a2043eeb7 Create DB management activity by taking the existing functionalities from the debug activity. 2016-08-31 15:12:26 +02:00
Daniele Gobbetti 84e644fa1a Add preference for save raw pebble health data. 2016-08-31 14:05:02 +02:00
cpfeiffer cd535a0a45 Include known devices from the database in CC
(as long as device-support is still available)
Fixes non-paired devices not being displayed
2016-08-31 00:33:54 +02:00
cpfeiffer 6340bcff15 Small cleanup 2016-08-31 00:03:20 +02:00
Andreas Shimokawa 93b165ee96 onboarding: use the text area not the button itself for displaying the info text ;) 2016-08-29 00:32:36 +02:00
cpfeiffer bcb07ccacd Enable LoggingTest with robolectric 2016-08-29 00:26:29 +02:00
Andreas Shimokawa 07ee860b1c add information to onboarding activity, make strings translatable 2016-08-29 00:17:40 +02:00
Andreas Shimokawa c55369747d launch onboarding (database migration) activity from service when:
- device got initialized
- is not yet in the new device db
- an old database exists
2016-08-28 23:49:05 +02:00
cpfeiffer eb7771c1a9 Support for overlapping ActivityDescriptions + testcases 2016-08-28 00:22:34 +02:00
cpfeiffer 39c7762416 Update the device in case it has changed 2016-08-27 23:25:37 +02:00
cpfeiffer 1a22259b4e Good practice: use the DAO to insert/update instead of the session
(saves a few cycles to look up the correct DAO from the session)
2016-08-27 23:12:48 +02:00
cpfeiffer 840a125c81 Fix compilation 2016-08-27 22:55:00 +02:00
cpfeiffer 8d6e6c8675 Upon request, delete not only the old, but also the new database 2016-08-27 22:51:00 +02:00
cpfeiffer ae2df2580c Remove/document deprecated stuff 2016-08-27 22:45:27 +02:00
cpfeiffer e139840fee More appropriate user handling: update the user instead of creating new 2016-08-27 22:34:30 +02:00
cpfeiffer bfaaed7e5c Detcach samples from the session after querying, to save memory 2016-08-27 21:40:46 +02:00
cpfeiffer 083d752011 Even more documentation/specification 2016-08-27 20:14:42 +02:00
cpfeiffer ec9e999be1 Lots of documentation 2016-08-27 16:44:47 +02:00
cpfeiffer ec0db033b1 Avoid potential NPE when subclasses return null for rawKindSampleProperty 2016-08-27 15:36:42 +02:00
cpfeiffer 350e72d534 Initial support for user-configured activity descriptions
- for a given user and time span, there may be an ActivityDescription
  - with a textual description
  - and a list of tags
- every tag has
  - a name
  - and an optional description
2016-08-27 00:25:45 +02:00
Andreas Shimokawa 5ab40918c0 rename database from test-db5 to Gadgetbridge 2016-08-26 23:48:54 +02:00
Andreas Shimokawa 34aead6c63 remove obsolte stuff 2016-08-26 23:37:17 +02:00
cpfeiffer 69f73467ea Store not only device type, but also the model in the db 2016-08-26 21:16:01 +02:00
cpfeiffer c59553c9c9 Rename GBDevice#hardwareVersion to model
(e.g. while DeviceType is "PEBBLE" in general, the model
might specify a Pebble Time or Time Steel.
2016-08-26 20:57:59 +02:00
Andreas Shimokawa 4363f110fb finish onboarding activity after import 2016-08-25 01:27:09 +02:00
Andreas Shimokawa 063d00cc51 only launch onboarding after device is initialized and write device to database if not in yet. 2016-08-25 01:08:43 +02:00
cpfeiffer 49b8b9ebca More robolectric stuff
- guard against multiple GBApplication.onCreate() invocations
- test DBHelper.getDevice() for a start
2016-08-25 00:00:53 +02:00
cpfeiffer 38c4be4379 Remove isEqual() in favor of Objects.equals() 2016-08-24 23:14:25 +02:00
cpfeiffer bfc0b4faaf Add robolectric dependency and addd a first EntitiesTest
Use KitKat (19) as target sdk since robolectric 3.1.2/sqlite4java
does not understand "WITHOUT ROWID" tables.

Also, add constants for user's gender and document some things.
2016-08-24 22:56:42 +02:00
cpfeiffer 02ac70e2a7 Only dismiss the dialog is the activity is still alive 2016-08-24 22:56:42 +02:00
Andreas Shimokawa ec4469a87b Testing with dummy onboarding activity
crashes
2016-08-24 20:15:26 +02:00
Daniele Gobbetti 2a2ad20aa3 Store raw data in the DB for later interpretation. 2016-08-21 20:24:02 +02:00
Daniele Gobbetti b617ba7264 Fix the logic regarding the last sample of a run. Remove the unneded try-catch block and reuse the current DB session instead. 2016-08-21 17:38:07 +02:00
Andreas Shimokawa 0ae9955a6f Display Toast when trying to import old Misfit data (unsupported)
... and update TODO
2016-08-20 21:38:39 +02:00
Daniele Gobbetti 6119f3501a Import the old samples and map the ranges to overlays for pebble. 2016-08-19 21:09:32 +02:00
Andreas Shimokawa 3fb558c536 db refactoring: add raw data column in health overlay table and make rawType part of the composite key 2016-08-18 22:06:26 +02:00
Daniele Gobbetti 0126b90f20 Store the timestamps as sent by the pebble. Use a strict inequality operator at the end of the period to exclude the last sample. 2016-08-18 21:44:06 +02:00
cpfeiffer 7a16834482 *return* the created device! 2016-08-18 21:29:26 +02:00
cpfeiffer deeaa87df7 Batch the import of old activity samples to save memory during import 2016-08-18 20:51:15 +02:00
Andreas Shimokawa ce8af615d1 Merge branch 'composite-key-dao' 2016-08-18 20:35:56 +02:00
cpfeiffer 6e98defe94 Only import old activity data once per device, not for every provider 2016-08-18 20:29:20 +02: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 26d490ffd6 Store the DeviceType in the Device entity
(so that we can later recreate a GBDevice from a Device)
2016-08-17 00:34:19 +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 6843b5aa8f Add icon for Mi Band 2 2016-08-15 00:39:31 +02:00
cpfeiffer 8766fc5269 Handle MiBand2 device type 2016-08-14 23:25:35 +02:00
cpfeiffer a38bea892a Some logging of found devices/uuids 2016-08-14 23:21:09 +02:00
Andreas Shimokawa 4ddbbfdfb0 change db name to test-db5 2016-08-14 22:36:50 +02:00
Andreas Shimokawa 69933c5e92 db refactoring: depend on latest -fyg patched greendao, change column order again (primary keys first), remove index from pebble health overlay also 2016-08-14 22:33:41 +02:00
Andreas Shimokawa eb962c65f0 work towards composite keys
(builds but does not run because greendao generates wrong table creation code - we need to fix that)
2016-08-13 01:24:43 +02:00
cpfeiffer 7c060506cf Invalidate UserAttributes and DeviceAttributes when new ones are created 2016-08-13 00:52:35 +02:00
cpfeiffer b3984a409c Fix checking for up-to-date User and Device attributes 2016-08-13 00:27:38 +02:00
Andreas Shimokawa 68b303246d db refactoring: change column order for health overlay table also 2016-08-10 23:26:25 +02:00
Andreas Shimokawa 359ed46b06 db refactoring: remove raw activity kind field from pebble health minute data, add a blob column for raw undecoded health minute data.
also:
- change column order for all pebble related minute data tables (mandatory stuff first, then custom columns, for easier addition of new columns)
- remove unused code

TODO:
- fix column order in Mi Band table also
2016-08-10 23:06:07 +02:00
Daniele Gobbetti 23c289ce1a Use the real raw values as received by the device.
Some types were also added, even though they are educated guesses.
2016-08-09 20:22:05 +02:00
Daniele Gobbetti 22d0387f76 Fix the comparison order again ,as it was correct originally.
Partial revert of 5cfddbb7e9
2016-08-09 20:05:42 +02:00
Daniele Gobbetti 4a7a34f461 Use only the overlay table for storing overlay data.
This removes the need to wait to have minute samples to store the overlay data, hence store has been made void instead of boolean.
2016-08-09 18:05:24 +02:00
Daniele Gobbetti 5cfddbb7e9 Use the right properties to build the query and fix the comparison operators.
Performance: iterate first on the smaller dataset.
2016-08-09 17:52:07 +02:00
Andreas Shimokawa fe5ec74ca1 Pebble Health: read overlay data in sample provider and patch in raw kind
completely untested
2016-08-09 11:56:05 +02:00
Andreas Shimokawa 5072d6b959 Pebble: try to write to health activity overlay table 2016-08-08 19:16:53 +02:00
Andreas Shimokawa af58b4600d whoops 2016-08-07 12:15:40 +02:00
Andreas Shimokawa c4f83d68cd refactoring: add generic support for manually filtering samples by acticty kind in AbstractSampleProvider
This allows a lot of simplifications for Morpheuz and Misfit
2016-08-07 11:45:09 +02:00
Andreas Shimokawa 6b2565e4c9 DB refactoring: remove activity type from Morpheuz database, determinate it in PebbleMorpheuzSampleProvider instead 2016-08-07 01:47:15 +02:00
Andreas Shimokawa e05d40dc7e Pebble: Support for latest version of Morpheuz (4.6)
Also a few simplifications and minor fixes.
Morpheuz 3.7 should still work (last version for FW 2.x)
2016-08-06 01:19:38 +02:00
cpfeiffer a7b9ae5596 whitelist fw 4.15.12.10 #369 2016-08-04 00:05:58 +02:00
Andreas Shimokawa 9520e23439 fix negative steps in Charts with Morpheuz 2016-08-02 00:31:29 +02:00
cpfeiffer 43d7566c0b some more microsteps #206 2016-08-01 22:18:57 +02:00
Andreas Shimokawa 4fe498efc2 Pebble: delay 100ms after writing a pebble packet to the output steam
This fixes a problem on newer firmwares, probably from 3.0 on, where sending an
appmessage packet right after acknowledging a previous incoming appmessage
packet results in our outgoing appmessage packet to be NACKed by the pebble
firmware and not even reaching the app running on the pebble.
2016-07-31 23:49:19 +02:00
Andreas Shimokawa 8ba1ae3f3e create extra table for Morpheuz, remove more unused stuff
Pebble activity tracker now do not share a common base anymore.

TODO: consider creating a custom way of querying activity types like in Misfit. The activity kind stored in the database now is solely based on the intensity, so it is redundant.

(#206)
2016-07-31 00:06:26 +02:00
Andreas Shimokawa eabe625c47 rename some classes, remove obsolete ones 2016-07-30 23:22:27 +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 c9a9566dad Minor fixlet 2016-07-28 22:42:16 +02:00
cpfeiffer 493444a2a0 Remove unused stuff 2016-07-28 22:28:29 +02:00
cpfeiffer b22111df9d Fix field ordering of ActivitySample (c'tor!) and improve importer #206 2016-07-28 22:12:20 +02:00
Andreas Shimokawa 8ea29e6e1d Refactor database / sample access (#206)
We now have separate tables for each provider's samples but a common interface.
2016-07-27 23:34:13 +02:00
Andreas Shimokawa dd5c80c2e7 forgot to add file 2016-07-25 22:28:40 +02:00
Andreas Shimokawa 726f767576 work towards a Pebble Misfit raw sample table 2016-07-25 22:19:39 +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 df59ce7b96 Switch light sleep and deep sleep #250
Apparently REM is considered deep sleep and NREM is considered light
sleep even though NREM (non-rapid-eye-movement) phase 3 is actually
defined as deep sleep.
2016-07-19 20:43:28 +02:00
cpfeiffer 1997a9b7fa some more service discovery logging 2016-07-18 23:55:44 +02:00
cpfeiffer 7b26986ab0 Fix for #349
We must not use UUID_CHAR_PAIR anymore. This prevents connecting
without being bonded. Connecting when bonded still works.

As without bonding, ControlCenter would not display the device anymore,
we have to re-install the "remember last connected device" in the
preferences thing.
2016-07-15 00:13:49 +02:00
cpfeiffer ebda3e1535 uncomment some constants 2016-07-14 20:37:20 +02:00
cpfeiffer 367091587f No more 0x8 in the logs
It's the confirmation that setting the latency succeeded.
2016-07-14 20:15:54 +02:00
cpfeiffer aa00d2f93a Avoid NPEs when device-name is null 2016-07-12 00:24:23 +02:00
cpfeiffer 76895aa2b1 Register to device name and alias changes and update accordingly 2016-07-11 00:28:15 +02:00
cpfeiffer 80930ce42a More logging for pairing, destroy pairing activity when bonding failed #349 2016-07-10 00:11:28 +02:00
Andreas Shimokawa 340a0f4a66 Fix coordinators not recognitzing devices by name
Do not ask a device candidate for its name , ask the underlying BluetoothDevice
The candidate uses the device alias - not good for matching
2016-07-09 23:10:21 +02:00
cpfeiffer f54163faeb centralize quit() functionality in GBApplication 2016-07-08 22:35:52 +02:00
cpfeiffer 9215233344 Whitelist 4.16.3.7 Mi1S firmware 2016-07-08 22:17:19 +02:00
cpfeiffer 8154a887cb When there are cached services, skip service discovery 2016-07-08 22:15:36 +02:00
Andreas Shimokawa 4de45787c3 Properly acquire network location if last location is not known
A toast will be shown if the network location provider is disabled.
Location will be automatically acquired after enabling it.

Fixes #346
2016-07-05 23:56:14 +02:00
cpfeiffer 20d8732d10 In GBDevice.toString(), return the correct state instead of the simplified one 2016-07-05 23:36:21 +02:00
cpfeiffer 154b7d28bb Let discovery activity also display device aliases 2016-07-05 23:36:21 +02:00
Andreas Shimokawa 903890067d Settings: properly check the input type flag
Fixes a bug where latitude/longitude could be made empty
2016-07-05 23:14:48 +02:00
cpfeiffer 94cc1a883a Use GBActivity in Pairing Activity for theming 2016-07-05 22:13:11 +02:00
cpfeiffer 3bb1a228ec Fix crash during device discovery 2016-07-05 21:48:33 +02:00
Andreas Shimokawa 43f95aee9c fix NPE 2016-07-05 21:47:51 +02:00
cpfeiffer 9ae69eac55 Avoid NPEs when BluetoothDevice.getName() returns null 2016-07-05 21:03:30 +02:00
cpfeiffer 9881b6c281 Do not display paired devices in the discovery activity 2016-07-05 20:46:47 +02:00
cpfeiffer abeb642972 Don't remember paired Mi device in preferences
(this was just a very old workaround for an even older Mi firmware
that couldn't pair)
2016-07-05 20:27:23 +02:00
cpfeiffer 8549031c6f Only attempt to reconnect when we were previously initialized 2016-07-04 23:38:25 +02:00
cpfeiffer 91d1cea51f Avoid potential NPEs 2016-07-04 22:40:24 +02:00
Andreas Shimokawa 73b2fc357e Pebble: Add some Pebble Time 2 support - NOT WORKING
Not working because these are expected to use BLE.
The Emulator should work though.
2016-07-04 22:09:56 +02:00
Andreas Shimokawa a2c2e48719 fix NPE in settings when last known position is null
This is not a proper fix, we would have to request a location first.
I just had a last known position when testing before. :/

Issue #346
2016-07-03 21:29:02 +02:00
cpfeiffer 8b24e098ea Set sampleProvider to avoid NPEs 2016-07-01 00:22:54 +02:00
cpfeiffer f65afa64d9 log raw activity data from mi band, closes #341
Hopefully aids in deciphering activity kinds.
2016-06-28 23:23:29 +02:00
cpfeiffer f0da25c49b Fix activity fetching getting stuck when double tapping #333 2016-06-28 23:07:24 +02:00
cpfeiffer 7613b62dab Improved discovery mechanism #323
Does not rely solely on mac addresses anymore. Should help when
mac address randomization is used.
2016-06-28 00:35:50 +02:00
cpfeiffer 76a44ad3a4 more logging to detect problems with external dirs: #343 2016-06-27 22:01:52 +02:00
cpfeiffer 56615de1f0 log FileNotFoundException when checking if directory is writable or not: #343 2016-06-27 21:29:39 +02:00
cpfeiffer e70a2290c3 sampleproviders now return device specific data #206 2016-06-27 20:43:48 +02:00
Daniele Gobbetti 1430619c30 Implement watchapp configuration presets.
This is a quick & dirty solution that may be improved by storing multiple presets in the DB in the future.
2016-06-26 11:55:08 +02:00
cpfeiffer 2fa166e381 Fix potential NPE, setup environment earlier 2016-06-25 18:58:54 +02:00
Andreas Shimokawa b5cf2b20be Pebble: In App Manager, enable adding of "Send Text" system app on non-aplite platforms
The App is not functional with Gadgetbridge, but since it is visible on the watch when canned messages for call dismissal is enabled, we support sorting it.
2016-06-25 18:08:53 +02:00
Daniele Gobbetti 20e2846d00 Enable localization of appmanager tab strip 2016-06-25 11:27:56 +02:00
Daniele Gobbetti 0f0a7ea925 Add send sms system app (commented because it only appears on Time series Pebbles after setting up SMS call decline) 2016-06-25 11:19:01 +02:00
Andreas Shimokawa 181df7311a add missing file 2016-06-24 14:57:01 +02:00
Andreas Shimokawa 659165fa4c Pebble: fix new app manager on 2.x
- properly intert apps reported from pebble into the corresponding tab
- disable tracking of installed apps
- disable drag and drop for apps and watchfaces
- ...
2016-06-24 13:39:29 +02:00
Andreas Shimokawa 1de6ee019f Pebble: fix regression. FW 2.x was completely broken
No one noticed, so it seems we can kill 2.x support soon :D
2016-06-24 12:07:44 +02:00
Andreas Shimokawa b77f3ad3bf Pebble: Implement call dismissal with canned messages
This also moved the canned replies setting to pebble settings
(we will change that if we have another device supporting this)
2016-06-24 10:25:08 +02:00
Andreas Shimokawa 67e5bc0434 Pebble: implement decline call with SMS
Based on a proposal by @danielegobbetti, thanks!

This still does not enable the feature since the necessary blobdb is not filled yet
2016-06-21 00:31:53 +02:00
Andreas Shimokawa 72dff2abd2 provide haptic feedback on long press in AppManager 2016-06-20 17:50:19 +02:00
Andreas Shimokawa 1a9c40e790 fix crash when rotating screen in AppManager 2016-06-20 17:42:32 +02:00
cpfeiffer 45fa930ac3 Properly check support for heartrate measurements 2016-06-19 23:22:28 +02:00
cpfeiffer 8772631087 Merge branch 'db-refactoring' 2016-06-19 22:53:09 +02:00
Andreas Shimokawa 4347f134d6 Pebble: add Music, Alarms, Notifications and Watchapps to System Apps
They can be ordered too!
2016-06-19 21:48:07 +02:00
cpfeiffer 9772d8af06 Merge remote-tracking branch 'origin/master' into db-refactoring 2016-06-19 21:14:03 +02:00
Andreas Shimokawa 7597ce337d Pebble: do not move to last position if reinstalling an app, the order seems to be preserved on the pebble 2016-06-19 21:13:47 +02:00
Andreas Shimokawa 24e840e03b Pebble: remove "move to top" feature completely 2016-06-19 21:06:38 +02:00
Andreas Shimokawa 4b5969ef96 Merge branch 'master' into appmanager-fragments 2016-06-19 12:33:05 +02:00
Andreas Shimokawa f42899d910 Pebble: on FW 2.x do not send extended music info and do not send playstate
I don't think they are supported and I cannot test.
2016-06-19 12:17:19 +02:00
Andreas Shimokawa 64182941d0 Pebble: always hide move to top feature in AppManager, it was not working as expected
A proper solution is in appmanager-fragments branch
2016-06-19 11:48:29 +02:00
cpfeiffer 7aa900ce82 Workaround crash in debug activity
(when progress dialog is visible and changing orientation)
2016-06-19 00:53:53 +02:00
cpfeiffer 0596c80381 Some migration fixes
especially: add unique index on samples using timestamp and device id
(since composite primary keys are not fully supported yet)
2016-06-19 00:40:51 +02:00
cpfeiffer 04c8a17d6e Merge remote-tracking branch 'origin/master' into db-refactoring 2016-06-19 00:12:02 +02:00
cpfeiffer 5607b1c892 Working merging of activity data, with (indeterminate) progress dialog 2016-06-19 00:10:47 +02:00
cpfeiffer dc932355b5 Some javadoc re DeviceManager 2016-06-18 23:40:37 +02:00
cpfeiffer 233a6155cc Add class DeviceManager that provides access to the list of managed devices
Basically moved code out of ControlCenter to a separate class. Also provides
change events when the device list has changed, or changes to the device
state have occurred.
2016-06-18 23:35:34 +02:00
Daniele Gobbetti ad3f7e53b3 Try hard to hide the browser activity from the stack. 2016-06-18 21:08:51 +02:00