Commit Graph

151 Commits (962720145e3678f5ffd17ea6c4a9e277a665b144)

Author SHA1 Message Date
Daniele Gobbetti c1abaaa4e0 Add support for hiding the icon in the status bar and the notification on the lockscreen.
This adds proper settings to toggle GB behavior and closes #460.
2017-01-08 15:51:56 +01:00
Yar 5c8f02d054 Set notification to minimal priority
Pebble app is not showing in status bar and on lockscreen. This change is for GadgetBridge to have the same behavior.
2017-01-08 15:31:55 +01:00
cpfeiffer aadde7d1ca Port to UriHelper, fix potential resource leak 2016-12-29 01:41:47 +01:00
cpfeiffer 0646eda646 Fix file potential handle leaks 2016-12-29 01:07:26 +01:00
João Paulo Barraca 5b3ef8999f Add preliminary support for HPlus devices, such as the Zeblaze Zeband (and many others)
Working: Text and call notifications, setting most user data, date and time, heart rate monitoring, sleep monitoring (alfa)
2016-12-21 12:51:25 +00:00
cpfeiffer d12103e95d Merge branch 'master' into new_GUI 2016-12-15 20:31:04 +01:00
cpfeiffer c69889d177 Simplified + fixed ArrayUtils.equals() + added lots of testcases 2016-12-11 23:30:20 +01:00
cpfeiffer 6dfc895303 Mi2: Initial work on firmware update #427 2016-12-11 02:11:58 +01:00
Daniele Gobbetti e0a844b60a Liveview: Initial support for Liveview devices
Working so far: stable connection, setting time and sending notifications.
2016-12-03 16:20:02 +01:00
Uwe Hermann 0746aaa579 app: Random typo and consistency fixes. 2016-12-01 20:22:12 +01:00
Andreas Shimokawa 34ad088b88 Pebble: Experimental support for BLE on all models via dev option in Pebble Settings
HOWTO:
1) Pair you normal Pebble (not necessary if already done), make sure it was connected once
2) Unpair your LE pebble if already paired
3) Switch on "Always prefer BLE" in Pebble Settings
4) Tap on the + in Control Center to add a new device
5) Pair your Pebble-LE XXXX or Pebble Time LE XXXX inside Gadgetbridge's Device Discovery actibity

Now Gadgetbridge will connect to your LE Pebble when tapping on Pebble XXXX if "Always Prefer BLE" option is enabled.
You can easily switch back to classic LE by turning that option off again
2016-11-27 09:49:28 +01:00
cpfeiffer 2f7eb9ef23 Some more improvements to discovery
- pass service uuids to GBDeviceCandaidate so that DeviceCoordinators
  can detect devices by their services.

Note: they should not rely on service uuids being available
2016-11-27 02:46:07 +01:00
cpfeiffer b9ff2cd468 A few improvements to discovery
- display the right icon for found device candidates
- scan for specific LE services
2016-11-27 01:09:20 +01:00
Andreas Shimokawa 4b7f47ba6c Pebble 2: add Workout system app to app manager on P2 and hexdump incoming HRM datalog 2016-11-15 11:56:14 +01:00
cpfeiffer 3cc8d887ca Mi2: Initial support for wear location, hr during sleep and date format #323
- wear location from prefs is sent to the band
- hr measurement during sleep is sent to the band
- date format is sent to the band (date+time or just time)
  (TODO: needs preference option)
2016-11-13 01:44:52 +01:00
Daniele Gobbetti d467b37493 ControlCenterv2: further steps:
Close drawer before launching activities (feels sloow).
Implement device deletion (untested).
Add app-management icon, remove tap-connected-device-for-primary-activity, hidden (not removed) text hint.
Use level-list for device icon.
Use the new control center when tapping GB notifications.
Added icons to the legacy control center context menu, perhaps it can be embedded in the card?
2016-10-25 17:49:21 +02:00
cpfeiffer 5c8525c5d0 Don't rely on File.canWrite() for directories, closes #406 2016-10-10 21:01:41 +02:00
cpfeiffer f57fec25f8 Remove the coordinator instance #323
For now, always iterate over the available coordinators instead.
Should fix MiBandSupport occasionally being used in place of MiBand2Support.
2016-10-10 20:52:40 +02:00
cpfeiffer 2a0d97b39a Improved error handling, display errors when deleting device 2016-09-30 23:07:30 +02:00
cpfeiffer 09502f96c9 AlertDialog.show() is non-modal, so put code into callback. Also added unpairing. 2016-09-30 22:58:28 +02:00
cpfeiffer 0a4eefcf11 Use device information from the database for GBDevices
fixes offline charts not displaying heartrate for Mi1S
2016-09-29 22:40:16 +02:00
Andreas Shimokawa 8ba7bc7353 Add (useless) support for Vibratissimo "massage devices"
Don't take this serious. It will make the "massage device" vibrate when a phone call arrives.
It is inspired by the famous lawsuit[1] which has nothing to do with the Vibratissimo device maker.
After reading this I picked up the cheapest ble massage device just to see if we could support it.
And yes, we can.

[1] http://arstechnica.com/wp-content/uploads/2016/09/vibratorsuit.pdf
2016-09-19 12:37:41 +02:00
JohnnySun 53d4681763 Optimize Imports 2016-09-13 23:53:35 +08: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 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 bcb07ccacd Enable LoggingTest with robolectric 2016-08-29 00:26:29 +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 7a16834482 *return* the created device! 2016-08-18 21:29:26 +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 154b7d28bb Let discovery activity also display device aliases 2016-07-05 23:36:21 +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
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
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
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
cpfeiffer d544509b60 Merge remote-tracking branch 'origin/master' into db-refactoring 2016-06-16 21:55:16 +02:00
Andreas Shimokawa d225743d64 Pebble: some preparations for Pebble 2 2016-06-15 22:53:05 +02:00
cpfeiffer 3b87966fe9 Merge branch 'master' into db-refactoring 2016-06-06 22:16:40 +02:00
cpfeiffer 50b7a02ef2 One more attempt at fixing dynamic logging reconfiguration
- moved out of GBApplication to class Logging
- the main thing is: when start()ing the FileAppender again, it *must*
- be configured to be non-lazy, otherwise it won't open the stream ever again.
2016-05-26 23:46:21 +02:00
cpfeiffer 40a376bbd0 Merge branch 'master' into db-refactoring 2016-05-16 23:01:16 +02:00
cpfeiffer 8ca821ab8a More WIP on db refactoring 2016-05-13 23:47:47 +02:00
cpfeiffer 40837996f8 Fix logback initialization, closes #300 2016-05-08 21:39:23 +02:00
Andreas Shimokawa 5b21895283 try to get BT alias name by reflection. Useful if you have a lot of Mi Bands 2016-05-07 21:46:20 +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 eca5d40efe More javadoc 2016-04-26 00:02:35 +02:00
cpfeiffer 47984dba0a javadoc 2016-04-25 23:45:27 +02:00
cpfeiffer e35ce978bd Remove now unused imports + fix one more SharedPreferences usage 2016-04-25 23:43:19 +02:00
cpfeiffer 0c715a2669 Wrap access to SharedPreferences with "Prefs"
(to centralize quirk handling)
2016-04-25 23:18:55 +02:00
cpfeiffer 98d7237ec3 Display a different notification icon, when disconnected
Better icons welcome :-)
2016-04-15 22:57:13 +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
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 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
Andreas Shimokawa 4be1926459 reformat code though Android Studio 2016-03-20 15:00:05 +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
Daniele Gobbetti 6d4b98719a Implement some further JS methods to make additional watchapps happy 2016-03-04 17:44:42 +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
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 a10c6f3b9f Some initial heartrate support #205
(not visible to user yet)
2016-02-26 00:30:57 +01:00
cpfeiffer defa97b882 Log the toast message immediately, not delayed in the main thread
(this helps understanding logs)
2016-02-24 23:53:30 +01:00
Julien Pivotto dd9864015d Fix #221 - Cast pair.first as integer
This commit fixes the following compilation error:

```
:app:compileDebugJavaWithJavac
/home/bob/dev/Gadgetbridge/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/LimitedQueue.java:26:
error: incomparable types: Object and int
            if (pair.first == id) {
                           ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
:app:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.
```
2016-02-08 06:32:36 +01:00
Andreas Shimokawa 0b53f60b0d Pebble: EXPERIMENTAL support for replying to wearable notifications
Tested with Signal, more could work.
2016-01-09 17:54:17 +01:00
Andreas Shimokawa 46bbab7df0 rename IDSenderLookup to LimitedQueue and store Object instead of String 2016-01-09 16:07:22 +01:00
Andreas Shimokawa de5f30ae97 WIP: Work towards SMS replies / canned replies, round 3
- put random id/phone number pair into limited lookup list (last 16 sms messages) when sms arrives
- lookup the phone number when replying from the a device

THIS STILL DOES NOT DO ANYTHING USEFUL
2015-12-14 23:31:31 +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
cpfeiffer 159c187e5e On Quit, remove all pending notifications
At least the notifications from #141 don't stay there forever, then.
2015-12-08 21:48:56 +01:00
Andreas Shimokawa 8b87e97f51 fix crash in FileUTils.copyURItoFile() if source and destination are the same file.
This allows to install pbw files from the pbw-cache manually though a file manager.
2015-12-08 18:59:37 +01:00
cpfeiffer 7f8ba83aab This might fix the missing progress bar #155
setVisibility(Public) is only available since Lollipop.
2015-12-07 23:09:19 +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
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
cpfeiffer bd0716ba58 Some more lint warnings fixed 2015-11-23 23:04:46 +01:00
cpfeiffer 34e08f6de8 Avoid potential NPE. Check for null first. 2015-11-18 23:21:56 +01:00
cpfeiffer 1e6db708d2 Fix NPE.
Now that is a really crappy API in Android that returns an array with null values.

closes #167
2015-11-18 23:18:01 +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 8920f5e95b Test fixing problem with non-writable getExternalFilesDir() #153 2015-10-29 00:46:52 +01:00
cpfeiffer 1f599c660f Improved file and error handling 2015-10-28 23:54:08 +01:00
cpfeiffer 1e56e540fa Remove hardcoded equals("MI") in favor of DeviceCoordintator #136 2015-10-18 01:01:13 +02:00
Andreas Shimokawa a9186791dc register/unregister receivers at runtime instead of enabling/disabling them via packagemanger 2015-10-16 00:23:16 +09:00
Andreas Shimokawa a4a59f5df4 fix hexdump() when using an offset with -1 as length (= full length) 2015-10-04 22:42:21 +09:00
Andreas Shimokawa e3533a2b18 Pebble: Allow muting (blacklisting) Apps from within generic notifications on the watch
Closes #113
2015-09-25 00:53:40 +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
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 69b64ed4b6 More logging for time/timezone changes
(trying to find an explanation for #91)
2015-09-05 00:14:09 +02:00
Andreas Shimokawa 2da717ea4c set visibility of service notification to public again 2015-08-31 21:29:00 +02:00
cpfeiffer 25ddc20f89 Fix testcases with sdk 23: don't call Notificaton API during local tests 2015-08-29 20:39:34 +02:00
Daniele Gobbetti 6ebc727f97 Merge remote-tracking branch 'origin/master' into low_battery_notification
Conflicts:
	app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/GB.java
2015-08-24 17:48:17 +02:00
cpfeiffer 77cad5c47f Initial support for testing the DeviceCommunicationService
Lots of support classes to enable local testing, without
a device or an emulator.
2015-08-22 01:09:56 +02:00
Andreas Shimokawa 1150ad2b8d Pebble: Support taking Pebble Time screenshots. Closes #97. 2015-08-22 00:14:14 +02:00
Daniele Gobbetti dcc988139f Merge remote-tracking branch 'origin/master' into low_battery_notification 2015-08-21 17:34:11 +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 0d8adeb7f9 Some refinements:
- only show the bigtext notification if the device has set extended battery info
- custom icon for the low battery notification (with license information)
- show device name in the notification
- set the notification to high priority
- the battery threshold is now set in GBDevice
2015-08-19 17:36:53 +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 585a888ecb Improved javadoc 2015-08-18 00:11:51 +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 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
cpfeiffer 910d9ef398 Make firmware reading a bit more failsafe #30 2015-08-04 23:02:36 +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
Andreas Shimokawa dbbcf20bbc reformat code 2015-07-25 21:52:52 +02:00