maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   [SFOS] [Announce] Pebble Watch Connector daemon (https://talk.maemo.org/showthread.php?t=93399)

abranson 2016-02-20 06:41

Re: [Announce] Pebble Watch Connector daemon
 
Hey RobertMe! I was worried you'd jumped ship...

Quote:

Originally Posted by RobertMe (Post 1499245)
I'm just wondering how you're going keep up with RockWork and the other way around. As I've contributed a lot of code (including the Sailfish port) to Kodimote (previously Xbmcremote) which is developed by mzanetti, but we had everything in one repo so a lot of features were already available in both apps without changing any platform specific code. But as you're hosting on GitHub, and thus are using Git, and RockWork is hosted on Launchpad and using Bazaar you can't just pull in changes from one another.

What I have right now is nowhere near ready for integration, but as there's lots of different things to do and a big need for this then I thought it would be better to share it early so we can all get it working. Then I'll merge a minimal set of changes with Rockwork, and we'll be there. This gives me more flexibility to mess around without impacting Rockwork, which is now quite stable.

I've been occasionally updating the Rockwork base already. It's very well separated into platform and generic lib, so it's not difficult. I've got a parallel branch that I keep on vanilla rockwork and merge. These things are a lot less trouble with Git, after all.

Quote:

Originally Posted by RobertMe (Post 1499245)
I might be able to help in this area. As I've got my own small daemon for the Pebble (but didn't do any development on it the last months), and filling the timeline based on the calendar is one of the things I do have working. And the same goes for call handling, which I've got operational too (so I might be able to fix the crasher there).

Ace. I think I'm not far off with the call handling. How have you got the calls working? I tried with TelepathyQt like they had, but it seemed to be empty just like QOrganizer. I brought VoiceCallManager over from pebbled, which is the source of the crashing, but there might be a better way. We might have more libs available than pebbled did - Quazip was previously static, but I switched that to a dependency.

The calendar stuff would be great, thanks!

Quote:

Originally Posted by RobertMe (Post 1499245)
Which is about everything I have working actually :p. Timeline for notifications, email (not using notifications, so I can show a full message preview, which differs from at least Pebbled, haven't check RockWork yet), calendar, phone call handling and the app fetching (but I don't have a UI either, so that also only works by putting the app file in the correct directory).

I connected it up to the notifications, but in a simpler way than pebbled, using the transient property to filter the wrong ones out. Fetching the message individually would be better though, especially to get it in the right place in the timeline. I did notification actions, but I think dismiss should be possible both ways?

RobertMe 2016-02-20 19:06

Re: [Announce] Pebble Watch Connector daemon
 
Quote:

Originally Posted by abranson (Post 1499259)
Hey RobertMe! I was worried you'd jumped ship...

Nope, still alive and kicking :). Although I didn't do any development in my spare time the last couple of months.


Quote:

Ace. I think I'm not far off with the call handling. How have you got the calls working? I tried with TelepathyQt like they had, but it seemed to be empty just like QOrganizer. I brought VoiceCallManager over from pebbled, which is the source of the crashing, but there might be a better way.
I tried two different routes. Both using direct/"low level" DBus calls instead of creating a QDBusInterface or QDBusAbastractAdapter. I tried using both the more low level/generic oFono (which I used in Kodimote) and the Nemo based Nemo VoiceCall DBus API. I tried both because there is an issue were calling "hangup" on an incoming (ringing) call gives odd results (in most cases the phone (and Pebble) start ringing again and when calling "hangup" on the new call the other end gets a message that there was a problem setting up the connection instead of going to voicemail the first time already). But in the end I sticked with the Nemo VoiceCall API as that one allows muting an incoming call (instead of hanging up), although I didn't implement it. But it's most likely some issue in you're code which makes it crash and not in the API you're using.

Quote:

The calendar stuff would be great, thanks!
Most of it actually isn't that hard and I based it on some code made by javispedro, which can be found here (the agendamanager files). But you'll also need to append a line to some permissions file of Sailfish, otherwise you can't open the sqlite database. How to do this can be found in the RPM spec file of the previously linked repo.


Quote:

I connected it up to the notifications, but in a simpler way than pebbled, using the transient property to filter the wrong ones out. Fetching the message individually would be better though, especially to get it in the right place in the timeline. I did notification actions, but I think dismiss should be possible both ways?
Using Pebbleds code for notification handling is IMHO kinda stupid. This because it uses Qts DBus library to monitor the creation of notifications. But it doesn't allow to "sniff" the notification id which is send in response to the app creating the notification. This means you can't monitor which notifications get closed or updated. So you can't remove or update a notification on the Pebble when it gets removed or updated on the phone (especially annoying when using WhatsApp as I had the Pebble crash/reboot multiple times when removing a lot of notifications using Pebbled). So to be able to get the notifications including its id I used some other code from javispedro, which are the notification files found here.

Getting the individual notifications for new emails (as shown on the events screen) is however fairly easy, as the email app actually sends N+1 notifications when N emails are received. IIRC Pebbled currently uses some ".summary" name/hint to get the notification, but that indeed just contains the "N new emails" text. But the other notifications contain both the sender and subject of the individual emails as shown on the events screen. But those notifications use a different name/hint, which you can easily get by running "dbus-monitor" when receiving the mails and reading the output.

But for the email notifications and pins* I'm not using the notifications at all, but I'm actually using the Qt Messaging Framework (QMF). As this allows to get a (plain text) preview of the email which the notification doesn't contain. And using the library/framework would also be the way to go if you want to support the "respond" actions of the Pebble. As it allows you so create new emails and send them, without opening the email app on the phone.

* For email, SMS and missed calls notifications I create both a pin on the timeline and a notification. This using the timeline spec. So I'm able to fully parse any JSON pin that the Android and iOS apps support and which can be used by other services to push pins to the Pebble. This is possible because Pebble actually publishes the description of the layout (all fields, which attribute id they have, and of which type they are) as part of the firmware update endpoint. And this also allows me to for example conditionally add the "createNotification" field to a pin based on whether the email already has been marked as read or not (when it has been read on another device).
But as far as I've seen the implementation in RockWatch is hardcoded to those supported by it (notifications of a specific type or calendar events). So it doesn't allow the fully dynamic usage of the timeline pins.

abranson 2016-02-20 22:29

Re: [Announce] Pebble Watch Connector daemon
 
Thanks for that. The calendar permission thing is exactly the problem I saw, but with no idea how the mechanism worked. After looking at it, I'm thinking a dependency to libwatchfish would be the right way to do this. Might only need a bit of glue between that and Rockwork's platform interface.

I'm away for a week, but I'll play with that when I get back. Thanks again, and glad you're still around :)

abranson 2016-03-02 21:34

Re: [Announce] Pebble Watch Connector daemon
 
Quote:

Originally Posted by RobertMe (Post 1499282)
IIRC Pebbled currently uses some ".summary" name/hint to get the notification, but that indeed just contains the "N new emails" text. But the other notifications contain both the sender and subject of the individual emails as shown on the events screen. But those notifications use a different name/hint, which you can easily get by running "dbus-monitor" when receiving the mails and reading the output.

I looked into these a couple of months ago, and there are actually three notifications for some things, including a separate distinct group one that supplies an integer unread message count. I've noticed that I'm not getting the '2 new messages' notification through to the watch at all now, since I started dropping the transient and hidden notifications, and prioritizing the Notify arguments over the hints for the content. It's quite a clean solution.

Quote:

Originally Posted by RobertMe (Post 1499282)
For email, SMS and missed calls notifications I create both a pin on the timeline and a notification. This using the timeline spec. So I'm able to fully parse any JSON pin that the Android and iOS apps support and which can be used by other services to push pins to the Pebble. This is possible because Pebble actually publishes the description of the layout (all fields, which attribute id they have, and of which type they are) as part of the firmware update endpoint. And this also allows me to for example conditionally add the "createNotification" field to a pin based on whether the email already has been marked as read or not (when it has been read on another device).
But as far as I've seen the implementation in RockWatch is hardcoded to those supported by it (notifications of a specific type or calendar events). So it doesn't allow the fully dynamic usage of the timeline pins.

I've proposed this to the rockwork guys, as I believe it'll be the cleaner solution in the long run. Katherine recommends using looking up the icon names in the firmware's layout.json.auto file, and using that as a guide to structure, which I'm assuming is the same thing.

Right now I'm trying to get the calendar access working. I've mimicked the mapplauncher entry from saltoq, but I'm still getting errors opening the mkcal db. Was that all I have to do? I saw some people were setting the uid and gid of the process, but that seems a bit strange.

javispedro 2016-03-02 22:32

Re: [Announce] Pebble Watch Connector daemon
 
Quote:

Originally Posted by abranson (Post 1500456)
Right now I'm trying to get the calendar access working. I've mimicked the mapplauncher entry from saltoq, but I'm still getting errors opening the mkcal db. Was that all I have to do? I saw some people were setting the uid and gid of the process, but that seems a bit strange.

For the mapplauncher entry to work you also need to launch it via mapplauncher :)

There is a bunch of changes involved (libsailfishapp automatizes a bunch of them, though): add "qt5-boostable" to pkg-config imports list, add Q_DECL_EXPORT to main(), and invoke your program like

/usr/bin/invoker -o --type=qt5 /usr/bin/saltoqd

If it still doesn't work there are some ways to debug it. For example do "devel-sh --privileged" to switch into the privileged user, and then you can gdb/strace your program to see where it fails.

(Alternatively, some people just make the binary setgid, so that it always launches in the privileged group...).

abranson 2016-03-02 23:03

Re: [Announce] Pebble Watch Connector daemon
 
Quote:

Originally Posted by javispedro (Post 1500461)
For the mapplauncher entry to work you also need to launch it via mapplauncher :)

There is a bunch of changes involved (libsailfishapp automatizes a bunch of them, though): add "qt5-boostable" to pkg-config imports list, add Q_DECL_EXPORT to main(), and invoke your program like

/usr/bin/invoker -o --type=qt5 /usr/bin/saltoqd

If it still doesn't work there are some ways to debug it. For example do "devel-sh --privileged" to switch into the privileged user, and then you can gdb/strace your program to see where it fails.

(Alternatively, some people just make the binary setgid, so that it always launches in the privileged group...).

Excellent, thank you. I see calendars!

abranson 2016-03-03 16:11

Re: [Announce] Pebble Watch Connector daemon
 
Latest code on github now pushes calendar events to the timeline! I've also switched to the libwatchfish music monitor, with added Pulseaudio volume controls. Does anyone want to try it in this (gui-less) state?

Feathers McGraw 2016-03-03 18:41

Re: [Announce] Pebble Watch Connector daemon
 
Good work! If you can package it and put it on openrepos, I'd love to try it out.

abranson 2016-03-03 20:53

Re: [Announce] Pebble Watch Connector daemon
 
Quote:

Originally Posted by Feathers McGraw (Post 1500566)
Good work! If you can package it and put it on openrepos, I'd love to try it out.

Done!

https://openrepos.net/content/abranson/rockpool

Feathers McGraw 2016-03-03 22:17

Re: [Announce] Pebble Watch Connector daemon
 
Quote:

Originally Posted by abranson (Post 1500580)

Thank you! :)

This is probably a really stupid question, but I can't seem to enable the rockpoold service, any pointers?

Code:

nemo ~ $ zypper info rockpool
Loading repository data...
Reading installed packages...


Information for package rockpool:

Repository: openrepos-abranson
Name: rockpool
Version: 0.1-2
Arch: armv7hl
Vendor:
Installed: Yes
Status: up-to-date
Installed Size: 1.4 MiB
Summary: Support for Pebble watches in SailfishOS
Description:
Support for Pebble watch on SailfishOS devices.

Code:

nemo ~ $ sudo systemctl status rockpoold
nemo's password:
rockpoold.service
  Loaded: not-found (Reason: No such file or directory)
  Active: inactive (dead)

Code:

nemo ~ $ rpm -ql rockpool                                                                   
/usr/bin                                                                                   
/usr/bin/rockpool                                                                           
/usr/bin/rockpoold                                                                         
/usr/lib/systemd/user/rockpoold.service                                                     
/usr/lib/systemd/user/user-session.target.wants/rockpoold.service                           
/usr/share/applications/rockpool.desktop                                                   
/usr/share/icons/hicolor/86x86/apps/rockpool.png                                           
/usr/share/rockpool/qml                                                                     
/usr/share/rockpool/qml/AppSettingsPage.qml                                                 
/usr/share/rockpool/qml/AppStoreDetailsPage.qml                                             
/usr/share/rockpool/qml/AppStorePage.qml                                                   
/usr/share/rockpool/qml/ContentPeerPickerPage.qml                                           
/usr/share/rockpool/qml/CoverPage.qml                                                       
/usr/share/rockpool/qml/DeveloperToolsPage.qml                                             
/usr/share/rockpool/qml/FirmwareUpgradePage.qml                                             
/usr/share/rockpool/qml/HealthSettingsDialog.qml
/usr/share/rockpool/qml/ImportPackagePage.qml
/usr/share/rockpool/qml/InfoPage.qml
/usr/share/rockpool/qml/InstalledAppDelegate.qml
/usr/share/rockpool/qml/InstalledAppsPage.qml
/usr/share/rockpool/qml/Main.qml
/usr/share/rockpool/qml/MainMenuPage.qml
/usr/share/rockpool/qml/NotificationsPage.qml
/usr/share/rockpool/qml/PebbleModels.qml
/usr/share/rockpool/qml/PebblesPage.qml
/usr/share/rockpool/qml/ScreenshotsPage.qml
/usr/share/rockpool/qml/SettingsPage.qml
/usr/share/rockpool/qml/SystemAppIcon.qml

Code:

nemo ~ $ cat /usr/lib/systemd/user/rockpoold.service
[Unit]
Description=Rockpool daemon for Pebble smartwatches
Requires=dbus.socket bluetooth.target booster-qt5.service
After=pre-user-session.target lipstick.service dbus.socket bluetooth.target booster-qt5.service

[Service]
ExecStart=/usr/bin/invoker -o --type=qt5 /usr/bin/rockpoold
Restart=always

[Install]
WantedBy=user-session.target


billranton 2016-03-03 22:21

Re: [Announce] Pebble Watch Connector daemon
 
Did you try --user in the systemctl command, as root?

Feathers McGraw 2016-03-03 22:30

Re: [Announce] Pebble Watch Connector daemon
 
Quote:

Originally Posted by billranton (Post 1500586)
Did you try --user in the systemctl command, as root?

That was it, thank you!

Code:

nemo ~ $ systemctl --user status rockpoold
rockpoold.service - Rockpool daemon for Pebble smartwatches
  Loaded: loaded (/usr/lib/systemd/user/rockpoold.service; disabled)
  Active: active (running) since Thu 2016-03-03 21:59:20 GMT; 29min ago
 Main PID: 1095 (invoker)
  CGroup: /user.slice/user-100000.slice/user@100000.service/rockpoold.service
          └─1095 /usr/bin/invoker -o --type=qt5 /usr/bin/rockpoold

Now all I need to do is generate some notifications!

abranson 2016-03-03 22:31

Re: [Announce] Pebble Watch Connector daemon
 
Yes sorry, that's on the readme on github but I should have put it on Openrepos too.

Edit: it worked.

Feathers McGraw 2016-03-03 22:56

Re: [Announce] Pebble Watch Connector daemon
 
Victory! Thank you so much for your hard work on this.

http://i.imgur.com/U0eRKvs.jpg

I'm trying to work out if I can send notifications with dbus, but I've not been able to so far. Should this work:

Code:

nemo ~ $ qdbus org.rockwork /org/rockwork/B0_B4_48_C6_10_B1 org.freedesktop.DBus.Peer.Ping
?

HtheB 2016-03-04 05:54

Re: [Announce] Pebble Watch Connector daemon
 
I actually liked that I could control the volume of my phone with Pebbled, even if there was NO music app running in the background. With RockPool, I can't :(
Will you guys please add it as an option when the GUI is ready...?


Edit: If you guys need to access the Pebble Store, just use this link:
https://apps.getpebble.com/en_US/wat..._settings=true

Edit2: Please make a new thread for RockPool, it will keep this thread clean.

abranson 2016-03-04 06:51

Re: [Announce] Pebble Watch Connector daemon
 
Quote:

Originally Posted by HtheB (Post 1500599)
I actually liked that I could control the volume of my phone with Pebbled, even if there was NO music app running in the background. With RockPool, I can't :(
Will you guys please add it as an option when the GUI is ready...?

That should work, and it worked when I just tested it. Are you on v2 or v3 firmware? Do you see anything in the journal? It should say:

watchfish::MusicController::setVolume:277 - Setting volume: 8

The music watch app is a bit annoying on v3 though. It only temporarily switches to the volume buttons, so if you're not quick enough it will flip back to the track control.

Edit: New thread is a good idea, although it's really the same lineage going all the way back to skipping stones...

HtheB 2016-03-04 06:57

Re: [Announce] Pebble Watch Connector daemon
 
Quote:

Originally Posted by abranson (Post 1500601)
That should work, and it worked when I just tested it. Are you on v2 or v3 firmware? Do you see anything in the journal? It should say:

watchfish::MusicController::setVolume:277 - Setting volume: 8

The music watch app is a bit annoying on v3 though. It only temporarily switches to the volume buttons, so if you're not quick enough it will flip back to the track control.

Edit: New thread is a good idea, although it's really the same lineage going all the way back to skipping stones...

Pebble Time Steel, so v3.
Hmm, that's weird, it does seems to work now..

I can confirm the apps and watchfaces can be installed on the watch. Too bad the watch has no internet connection yet.

Edit: A feature that not everyone is familiar with: To avoid the annoying skipping thing when you just want to change volume: Just hold down the Next/Previous Track button. It will automatically change into Volume buttons :)
This way, you don't accidentally change tracks

abranson 2016-03-04 08:04

Re: [Announce] Pebble Watch Connector daemon
 
Quote:

Originally Posted by HtheB (Post 1500602)
Pebble Time Steel, so v3.
Hmm, that's weird, it does seems to work now..

I copied the volume control code I wrote for pebbled over, which involved connecting to the pulse bus specifically for this. If it's possible that this connection could be broken or something while the daemon is running, then the volume would stop working. Did you ever see that happen in pebbled?

Quote:

Originally Posted by HtheB (Post 1500602)
I can confirm the apps and watchfaces can be installed on the watch. Too bad the watch has no internet connection yet.

That should work. Which apps don't?

Quote:

Originally Posted by HtheB (Post 1500602)
Edit: A feature that not everyone is familiar with: To avoid the annoying skipping thing when you just want to change volume: Just hold down the Next/Previous Track button. It will automatically change into Volume buttons :)
This way, you don't accidentally change tracks

Oh that's much easier. Ta!

abranson 2016-03-12 15:53

Re: [Announce] Pebble Watch Connector daemon
 
Quote:

Originally Posted by Feathers McGraw (Post 1500591)

I'm trying to work out if I can send notifications with dbus, but I've not been able to so far. Should this work:

Code:

nemo ~ $ qdbus org.rockwork /org/rockwork/B0_B4_48_C6_10_B1 org.freedesktop.DBus.Peer.Ping
?

Missed this sorry. I just managed to upgrade my firmware with:

Code:

qdbus org.rockwork /org/rockwork/B0_B4_48_80_B9_87 org.rockwork.Pebble.PerformFirmwareUpgrade
I don't think ping does anything, this one is a good test:

Code:

qdbus org.rockwork /org/rockwork/B0_B4_48_80_B9_87 org.rockwork.Pebble.RequestScreenshot
:D

abranson 2016-03-15 21:41

Re: [Announce] Pebble Watch Connector daemon
 
Quote:

Originally Posted by RobertMe (Post 1499282)
Most of it actually isn't that hard and I based it on some code made by javispedro, which can be found here (the agendamanager files). But you'll also need to append a line to some permissions file of Sailfish, otherwise you can't open the sqlite database. How to do this can be found in the RPM spec file of the previously linked repo.

So I got everything working nicely, except that I was seeing events from all calendars, even disabled ones. I couldn't find anything in mKCal or the sqlite database to indicate which calendars were disabled. I decided to have a dig inside the Jolla calendar app to see how that did it, and found nemo-qml-plugin-calendar, which stores that and the calendar colours in a separate QSettings file in .config. I've added that directly to what I already had so I can now filter the evenrs, but should I have been using this plugin the whole time? mKCal is a little unpleasant, but at least it is available in the standard system, while it looks like it'll have to submodule the plugin if I want to use it.

Has anyone used it? Is it worth migrating over to it?

asa 2016-03-16 08:41

Re: [Announce] Pebble Watch Connector daemon
 
Hi,

Does Time Round work with Sailfish? I'd like upgrade my Pebble Classic to it.

t3sserakt 2016-09-21 21:46

Re: [Announce] Pebble Watch Connector daemon
 
After a reset to factory setting of my Pebble I like to sync again with my Jolla. Pebbled displays me "Your firmware is too old to support SDKv2 applications".

My Jolla is running 2.0.2.51, Pebbled app v1.6-1, Watch Firmware 2.9.1.
The Jolla is connected to my Pebble Steel. I did a factory
reset on the watch, with the watch waiting to be bind to
a Pebble app.

Hope anyone can help.

MrBlueSky 2016-09-22 05:57

Re: [Announce] Pebble Watch Connector daemon
 
I don't think Pebbled is activly developed anymore.

I would advise you to use Rockpool, works like charm for me, including latest FIrmware updates.


All times are GMT. The time now is 08:16.

vBulletin® Version 3.8.8