Commit Graph

179 Commits

Author SHA1 Message Date
Andreas Shimokawa f35e3e460d remove K9 receiver as is works better with generic notifications 2017-02-09 17:35:46 +01:00
cpfeiffer 4f0674d038 Support for alarm clock notifications for Mi1 + Mi2 #538
No support for Pebble and HPlus for now.

Atm relies on the CM deskclock alarm, which nicely broadcasts
events about the current alarm. See
https://github.com/CyanogenMod/android_packages_apps_DeskClock.git
2017-02-07 23:49:10 +01:00
Daniele Gobbetti e08a900978 Refactor the MusicPlaybackReceiver and related files
Add actions to the filter (this should help with #536)
Add "copy" constructors to MusicSpec and MusicStateSpec, and use those when receiving an updated intent, this way partial updates do not disrupt the local information.
Iterate over incoming extra keys, explicitly check the incoming type and use only known type. This could help with #533

Possible problem: this code iterates over every key of the incoming bundle.
2017-02-01 22:55:40 +01:00
ivanovlev 2d3907b0f0 Fix issue #522 : Transliterate Caller Name 2017-01-27 23:16:19 +03:00
Andreas Shimokawa e19ea26478 Merge pull request #513 from ivanovlev/master
Simplification of transliteration integration
2017-01-26 16:13:54 +01:00
cpfeiffer ac68bfe351 Mi Band 1+2: backend implementation of making BT pairing optional
- cleaned up the DeviceService.connect() variants
- discovery: pass the device candidate around instead of the mac address

Attempts to fix #512, #514, #518
2017-01-26 00:16:38 +01:00
ivanovlev 06295abcb6 Simplification of transliteration integration 2017-01-24 21:04:06 +03:00
Andreas Shimokawa c39318af05 CHANGELOG, bump version, improve strings about transliteration 2017-01-22 22:30:40 +01:00
ivanovlev cbc91e7fef Moving transliteration call from module "HPlus" to common support 2017-01-17 23:07:12 +03:00
Andreas Shimokawa 3644d5e7a6 Pebble: remove notifications when dismissed on the phone (#326)
Most of the code is generic, so it could be implemented by other devices.
I dont know what happens if multiple messages arrive in the same notification.
So, this is experimental.
2017-01-09 16:33:00 +01:00
Andreas Shimokawa 266c6b8817 Pebble: send weather to Pebble when we get notified by weather notification 2016-12-31 15:56:05 +01:00
Andreas Shimokawa 440a5e071f Try to support "Subsonic" android app (#474) 2016-12-26 23:53:24 +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 2677dad873 Fix a recent regression that caused the database migration dialog to never pop up 2016-11-27 22:50:21 +01:00
Andreas Shimokawa 723ad53588 Call getDevice always when connected
This fixes a longstanding bug where device attributes where ONLY updated when fetching activity data or when pairing a new device
2016-11-27 10:32:56 +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 d89899557c Mi2: Add config option to configure date/time display
(added a new EventHandler method to set a specific configuration option)
2016-11-13 20:47:24 +01:00
cpfeiffer 713989ef38 Add event "test new function" for the debug screen 2016-10-11 23:06:59 +02:00
Andreas Shimokawa cd195a5969 map more apps to notification types (icons and colors on the pebble) 2016-10-11 11:54:52 +02:00
Andreas Shimokawa 5e63b7ce04 Vibratissimo: do not show database migration activity 2016-09-30 21:43:44 +02:00
Andreas Shimokawa 6a18d90fee Vibratissimo: add simple and buggy activity with a slider for vibration control
Also includes some fixes and "find your device" support ;)
2016-09-20 20:28:52 +02:00
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
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
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 98999993e5 Pebble: In AppManager allow moving apps on the device to the top (context menu) 2016-06-12 01:20:12 +02:00
Steffen Liebergeld e386d6da43 Add onSetMusicState(MusicStateSpec stateSpec)
This commit contains the infrastructure needed for the
NotificationHandler to send music state information to the device. That
is, it introduces a call onSetMusicState(MusicStateSpec stateSpec), that
in turn sets up an intent to the service, which will then call the
encodeSetMusicState() function of the device. encodeSetMusicState is
available for pebble only. There are empty stubs for other devices.
2016-06-08 20:31:48 +02:00
Andreas Shimokawa cb1ec5dccb Make calendar event type byte instead of int
Now the UUID will be constructed like this:

High 64bit 0x4742474200 | type
Low 64bit id
2016-05-24 13:11:57 +02:00
Andreas Shimokawa c9c9b420dc Pebble: Send sunrise and sunset events to the pebble every day using AlarmManager 2016-05-24 11:19:57 +02:00
Andreas Shimokawa 6370fdbebe Merge branch 'master' into feature-sunrise 2016-05-22 01:25:52 +02:00
Andreas Shimokawa 0d7986a5ab Pebble: rework incoming reconnection support
This is now completely generic and should work for other devices also

Fixes #296
2016-05-22 01:19:28 +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
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 10d7274aa1 Fix testcases (all this should be scrapped and redone with e.g. robolectric) 2016-04-29 21:58:08 +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 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 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
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
Andreas Shimokawa 76fc7a2aec always save last device address when connecting, fixes #258 2016-03-20 19:48:54 +01:00
Andreas Shimokawa 4be1926459 reformat code though Android Studio 2016-03-20 15:00:05 +01:00
cpfeiffer 3f39928df5 Some more cursor-related improvements (closing) 2016-03-08 23:48:31 +01:00
cpfeiffer 7e8281e8d4 Improve exception handling logic a bit 2016-03-08 21:33:12 +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
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 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 f387f7c96b increase canned replies from 8 to 16
NOTE:

Total allowed bytes for all replies = 512 - (reply count - 1)

TODO:
- check with Firmware 2.9.1
- remove last reply that exceeds the 512 bytes limit completly (else it will be partly truncated)
2015-12-17 00:05:42 +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
Andreas Shimokawa 53fb63781e WIP: Work towards SMS replies / canned replies
- Implement the PebbleProtocol side (2.x and 3.x)
- Add Preferences for canned replies

This can be tested by enabling untested features in Pebble Settings
It lets you see and select the replies set up in "Canned Repies" on the Pebble
You will get a "NOT IMPLENTED" message on your Pebble.

THIS DOES NOT ACTUALLY DO ANYTHING USEFUL YET.
2015-12-13 12:03:57 +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 39e09946cd fix missing assignment *cough* 2015-12-06 15:39:34 +01:00
Andreas Shimokawa 112dfa184a Catch securtiy exception if contacts can't be read on Android 6.0. Closes #182 2015-12-06 15:32:48 +01:00
cpfeiffer bd0716ba58 Some more lint warnings fixed 2015-11-23 23:04:46 +01:00
cpfeiffer 88fb81f921 Make onStartCommand() synchronized, to be sure
(or does Android take care of not calling this concurrently?)
2015-10-22 00:52:45 +02:00
cpfeiffer 86d17c7792 Pass the exception to GB.toast() 2015-10-18 23:43:27 +02:00
Sergey Trofimov a1fd31c260 Show toast when no valid DeviceSupport found for pairing. 2015-10-18 09:34:51 +03:00
Andreas Shimokawa a9186791dc register/unregister receivers at runtime instead of enabling/disabling them via packagemanger 2015-10-16 00:23:16 +09: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 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 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
cpfeiffer ba670bbb50 More testing work: with a new test for finding the device 2015-08-23 00:54:51 +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
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
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
cpfeiffer 2e3de0cd0f Always send out the current state of GBDevice when asking for version
In a second step, request the version from the device (and send updated
values then)

RequestVersionInfo is either a misnomer or misused, depending on your view.
It is actually used by activities to get the current state of thde device.

We now provide this as quickly as possible, with the drawback of sometimes
sending results twice.
2015-08-14 00:29:05 +02:00
cpfeiffer eec7fae288 Attempting to fix some connection problems after getting disconnected 2015-08-14 00:23:01 +02:00
Andreas Shimokawa 27f88e484d Make ControlCenter only ask for version details after device is initialized
This allows removal of a workaround which allowed ACTION_REQUEST_VERSIONINFO
to be used in connected state (instead of initialized state)
2015-08-07 22:07:48 +02:00
Andreas Shimokawa 6125594703 Various changes related to INITIALZED device state
Due to a bug in DeviceCommunicationService.isConnected(), devices using the
INITIALIZED state only worked when they had useAutoConnect set to true (Mi Band)

Now setting devices to INITIALIZED state to allow any action send to
DeviceCommunicationService is mandatory. As an exception only
REQUEST_VERSIONINFO will be also be allowed for CONNECTED state.

This also fixes a problem when notifications came in on the Pebble with 3.x
FW before we actually knew it was FW 3.x (INITZALIZED state on the Pebble
now implies that we know the FW version)
2015-08-07 13:24:54 +02:00
cpfeiffer 9004a8b0c1 Experimental: ACTION_START is now optional -- ACTION_CONNECT is sufficient 2015-08-06 23:17:41 +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 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