Reply
Thread Tools
Posts: 15 | Thanked: 17 times | Joined on Sep 2019
#1
I am trying to use the DBus QML interface
https://nemo-qml-plugin-dbus.readthedocs.io/en/latest/

to monitor the cellular signal levels etc, using these apis:
https://github.com/rilmodem/ofono/bl...etwork-api.txt
https://git.sailfishos.org/mer-core/...onitor-api.txt


I can get signals from ofono.NetworkRegistration OK, but I can't work out how to use "getProperty" and "call" .
In the example below in "function xx" they both return "undefined"


or how to connect to "servingCellInformationChanged" of the ofono.NetworkMonitorAgent, (which doesn't seem to have any signals.)

In this case


Code:
import QtQuick 2.0
import org.nemomobile.dbus 2.0

Item {
    id: dBusX
    property string cellName:""
    property string cellStatus: ""
    property int dBmStrength: 0
    property int rawStrength: 0
    property string technology: ""
    property int cellStrength: 0

    function xx(){
        var R=ooNR.getProperty('Status')
        console.log(R)
        R=ooNR.call('GetProperties',[])
        console.log(R)
        R=ooNM.call('GetServingCellInformation',[])
                console.log(R)

    }

    DBusInterface {
        id: ooNR
        bus:DBus.SystemBus
        service: 'org.ofono'
        path: '/ril_0'
        iface: 'org.ofono.NetworkRegistration'
        signalsEnabled: true

        function propertyChanged(name, value) {  //on signal...
            //console.log("NR Property Changed "+ name + "  " + value)
            switch (name) {
                case "Strength":
                    rawStrength = value
                    dBmStrength = (value-113)/2 //2 * value - 113;
                break;
                case "Name" : cellName = value; break;
                case "Technology" : technology = value; break;
                case "Status" : cellStatus = value; break;

                default: console.log("NR Property Changed "+ name + "  " + value)
            }
        }
    }
//----------
    DBusInterface {
        id: ooNM
        bus:DBus.SystemBus
        service: 'org.ofono'
        path: '/ril_0'
        iface: 'org.ofono.NetworkMonitor'
        signalsEnabled: true
    }
//--------------
    DBusInterface {
        id: ooNMA
        bus:DBus.SystemBus
        service: 'org.ofono'
        path: '/ril_0'
        iface: 'org.ofono.NetworkMonitorAgent'
        signalsEnabled: true

//        function servingCellInformationChanged(a) {
//            console.log(a)
//    }

// Error message when below runs is:
// TypeError: Property 'typedCallWithReturn' of object DeclarativeDBusInterface(0x10548530) is not a function
        Component.onCompleted: {
            ooNMA.typedCallWithReturn('ServingCellInformationChanged', [], function (result) {
                // This will be called when the result is available
                console.log('ServingCellInformationChanged: ' + result);
            });
        }
    }

}
 

The Following User Says Thank You to crun For This Useful Post:
Posts: 15 | Thanked: 17 times | Joined on Sep 2019
#2
I realised that TypedCallWithReturn has been replaced by TypedCall.

So now I get error message:
[W] unknown:60 - file:///usr/share/CellMon/qml/components/DBus.qml:60:5: QML DBusInterface: QDBusError("org.freedesktop.DBus.Error.UnknownMeth od", "Method \"ServingCellInformationChanged\" with signature \"\" on interface \"org.ofono.NetworkMonitorAgent\" doesn't exist\n")
Code:
Component.onCompleted: {
            ooNMA.typedCall('ServingCellInformationChanged',[],
               function (result) {                  console.log('ServingCellInformationChanged: ' + result);                    }             );
        }
I still don't know if "ServingCellInformationChanged" is to setup a callback , as above. OR is it supposed to be signal type function that will just be called if it is provided?
 

The Following User Says Thank You to crun For This Useful Post:
coderus's Avatar
Posts: 6,436 | Thanked: 12,699 times | Joined on Nov 2011 @ Ängelholm, Sweden
#3
for ofono you can use corresponding qml bindings insead of direct dbus calls
__________________
Telegram | Openrepos | GitHub | Revolut donations
 

The Following User Says Thank You to coderus For This Useful Post:
Posts: 15 | Thanked: 17 times | Joined on Sep 2019
#4
Originally Posted by coderus View Post
for ofono you can use corresponding qml bindings insead of direct dbus calls
I found this: https://git.sailfishos.org/mer-core/...ugins.qmltypes

Do you have any idea if this is just calling the dbus, or does it directly access the ofono libs some other way?

I see NetworkMonitor doesn't appear to be in there, which I am using.

I have typedcalls working now, but I have not worked out a way to get callbacks/events/signals from NetworkMonitor, and I am left doing timer polling of getServingNetworkProperties.

There is a NetworkMonitorAgent , but does not seem to be in dbus on sfos. There is a call to RegisterAgent in NetworkMonitor, but I cannot see what to do with it.

Last edited by crun; 2021-06-22 at 06:02.
 

The Following User Says Thank You to crun For This Useful Post:
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 22:15.