maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   No notification when new voicemail ? Here come the patch ! (https://talk.maemo.org/showthread.php?t=94498)

coderus 2015-01-27 23:04

Re: No notification when new voicemail ? Here come the patch !
 
Sorry, i have no voicemails option on my operator, i can't test it. But if you give me information about dbus names to fetch status i can make proper daemon.

Schturman 2015-01-27 23:40

Re: No notification when new voicemail ? Here come the patch !
 
Quote:

Originally Posted by coderus (Post 1458469)
Sorry, i have no voicemails option on my operator, i can't test it. But if you give me information about dbus names to fetch status i can make proper daemon.

Sorry, I don't know all this terminology, what you mean "dbus names"? Maybe Zeta can provide needed information...

You can use
Code:

dbus-send --system --type=method_call --print-reply --dest=org.ofono /ril_0  org.ofono.MessageWaiting.GetProperties
or this:
Code:

/usr/lib/qt5/bin/qdbus --system org.ofono /ril_0  org.ofono.MessageWaiting.GetProperties
to check if voicemail "true" that mean have voicemail message. But you say your operator not have voicemail option...

coderus 2015-01-27 23:43

Re: No notification when new voicemail ? Here come the patch !
 
I can build fully working application without trying it, don't worry. This info is enough, thanks. Will return here after building application.

Zeta 2015-01-27 23:49

Re: No notification when new voicemail ? Here come the patch !
 
Schturman,

Thanks for the code.

I said I wouldn't work on this today, but you made me think a lot about it, and I got back to it... ;)

I took my work back were I left it before switching to QML. I was doing a trigger in phonebot (which I had running, so only a question of easy way of doing it for me at the time). Making some changes in the notification plugin to add the category, I got (almost) the same results as you, but using only signals, no polling.

Here is the core of the Qt C++ part that does it, using the qofono object of nemo (who does all the work as in the QML patch) :
Code:

// There may be some includes missing, I cleaned this list manually when pasting it here...
#include "qofonomanager.h"
#include "qofonomodem.h"
#include "qofonomessagewaiting.h"


// In the class constructor:
  _ofonoMessageWaiting = new QOfonoMessageWaiting(this);

    QOfonoManager* manager = new QOfonoManager(this);
    QStringList modems = manager->modems();

    if (modems.size() == 0)
    {
        qDebug() << "No modem found";
        return;
    }

    _ofonoMessageWaiting->setModemPath(modems.at(0));

    if (! _ofonoMessageWaiting->isValid())
    {
        qDebug() << "QOfonoMessageWaiting object invalid" << _ofonoMessageWaiting;
        return;
    }

    // This does the work : connecting to a slot in the class, from the signal that qofono sends when there is a change.
    connect(_ofonoMessageWaiting,SIGNAL(voicemailWaitingChanged(bool)), this, SLOT(voicemailWaitingChanged(bool)));

        // To avoid loosing message, the content is checked at init, and not only when changing:
    voicemailWaitingChanged(_ofonoMessageWaiting->voicemailWaiting());


About the way to launch something from a notifications, it goes through DBus, using the following arguments to the notification item:
Code:

                remoteDBusCallServiceName: "org.nemomobile.example"
                remoteDBusCallObjectPath: "/example"
                remoteDBusCallInterface: "org.nemomobile.example"
                remoteDBusCallMethodName: "doSomething"
                remoteDBusCallArguments: [ "argument", 1 ]

This comes from this thread: http://talk.maemo.org/showpost.php?p...1&postcount=43

I have to sniff around DBus to retrieve the DBus service and method that launch the voice call ui, but here is a direction to search (found in /usr/share/lipstick-jolla-home-qt5/lockscreen/OngoingCall.qml) :
Code:

    DBusInterface {
        id: voicecallIf
        destination: "com.jolla.voicecall.ui"
        path: "/"
        iface: "com.jolla.voicecall.ui"
    }


Zeta 2015-01-27 23:56

Re: No notification when new voicemail ? Here come the patch !
 
Quote:

Originally Posted by Schturman (Post 1458474)
You can use
Code:

dbus-send --system --type=method_call --print-reply --dest=org.ofono /ril_0  org.ofono.MessageWaiting.GetProperties
or this:
Code:

/usr/lib/qt5/bin/qdbus --system org.ofono /ril_0  org.ofono.MessageWaiting.GetProperties
to check if voicemail "true" that mean have voicemail message.

That's good, but you can even directly connect to the single boolean that we want with this signal (dump from dbus-monitor):
Code:

signal sender=:1.14 -> dest=(null destination) serial=15125 path=/ril_0; interface=org.ofono.MessageWaiting; member=PropertyChanged
  string "VoicemailWaiting"
  variant      boolean true

That way, you don't have to decipher the whole structure.

This is hidden inside QOfono when you use it from C++ or QML, but it can be directly connected to from python or even C++ if you want to do it with DBus.

coderus 2015-01-28 04:03

Re: No notification when new voicemail ? Here come the patch !
 
Okay, install and test this package: https://dl.dropboxusercontent.com/u/...-1.armv7hl.rpm

After starting icon from launcher should appear notificatoin about launcing watcher
You can enable autostart, start or exit watcher

Check if notifications about new voicemails appearing :)

Schturman 2015-01-28 06:06

Re: No notification when new voicemail ? Here come the patch !
 
Coderus, "force start" or start from cover not work.

Schturman 2015-01-28 06:27

Re: No notification when new voicemail ? Here come the patch !
 
Zeta, like I said I'm not programmer and still not understand from what you wrote hot to implement it to my python script :D
Can you explain it ? Or write example with my script ?

Also we can use direct link to call to voicemail by pressing on the notification (if we will succeed to implement it) :
Code:

gdbus call -e -d com.jolla.voicecall.ui -o / -m com.jolla.voicecall.ui.dial '+97215154003200'
Where is "+97215154003200" - number of voicemail

coderus 2015-01-28 06:46

Re: No notification when new voicemail ? Here come the patch !
 
Quote:

Originally Posted by Schturman (Post 1458486)
Coderus, "force start" or start from cover not work.

how did you checked it? and cover is dummy and does NOTHING.

coderus 2015-01-28 06:50

Re: No notification when new voicemail ? Here come the patch !
 
Sources here: https://github.com/CODeRUS/voicemail-notifications
feel free to do pull requests


All times are GMT. The time now is 18:26.

vBulletin® Version 3.8.8