![]() |
Dbus method call
Hello,
I'm a noob in D-bus handling, so please, be patient. I'm trying to do as simple thing, namely to write a C program that would invoke a remote method and would handle the response. I would like to implement this call (provided by @qwerty12): Code:
Nokia-N900-42-11:~# dbus-send --system --print-reply --type=method_call --dest='com.nokia.phone.net' /com/nokia/phone/net Phone.Net.get_registration_status Code:
msg = dbus_message_new_method_call("com.nokia.phone.net", Thanks! [edit] This is the function I'm using: Code:
void query(char* param) Code:
Nokia-N900-42-11:/home/user# ./dbus.out query |
Re: Dbus method call
I'm a GLib whore, so I'ma use the DBus-GLib bindings:
http://slexy.org/view/s2HUwWewVX Compile with: "gcc -Wall cellid_example.c -o cellid_example `pkg-config --cflags --libs glib-2.0 dbus-glib-1`" This produces the following output: Quote:
* Save http://slexy.org/view/s2WhO33Yr3 as marshal.list * Run: "glib-genmarshal --prefix=marshal marshal.list --header > marshal.h && glib-genmarshal --prefix=marshal marshal.list --body > marshal.c" * Compile with: "gcc -Wall cellid_example.c -o cellid_example `pkg-config --cflags --libs glib-2.0 dbus-glib-1` -DLISTEN_FOR_CHANGES marshal.c marshal.h" This produces the following output: Quote:
|
Re: Dbus method call
Thanks, you're amazing :D
I have managed to make it kinda-working in low level, I will post the code for future reference when/if I'm done with it. |
Re: Dbus method call
This is a working low-level example of the dbus-method call (without arguments):
http://slexy.org/view/s2rHWulgQW not as elegant as the one by @qwerty12, but it works fairly well. |
Re: Dbus method call
Now, another problem (I'm a very troubled man, I know :) )
WLAN scanning: the request for scanning is sent via method call, the result is obtained via a signal. I have fixed a Python example so now it works with N900: http://slexy.org/view/s25h3to4Rr I however have a problem translating it to C. To get the results of scanning, we first need to request the scan: Code:
dbus-send --system --dest=com.nokia.wlancond --type=method_call --print-reply /com/nokia/wlancond/request com.nokia.wlancond.request.scan int32:4 array:byte:0 int32:2 Code:
com.nokia.wlancond.signal, scan_results |
Re: Dbus method call
Is there a ref for Dbus methods and signals. What I am looking for specifcally is GSM network parameters. ARFCN, BSIC, MCC,MNC,LAC,CID, C1,C2, RSSI, Neighbor list measurements, cell reselect hist, etc...
I'm not even sure if all of these are available through Dbus but I would appreciate if someone could point me in the right direction. |
Re: Dbus method call
Quote:
Anyone have any thoughts? [1] http://wiki.maemo.org/User:Jebba/DBUS |
Re: Dbus method call
with dbus-monitor (below) I get updates for signal strength changes and MCC,MNC,LAC,CID when the phone is on line (the signal strength and operator are diplayed and updated on the desktop) but for the other network parameters like ARFCN, TA, C1, C2 and neighbor lists etc. If they are available I imagine you would need to call a specific method.
Code:
signal sender=:1.18 -> dest=(null destination) serial=1582 path=/com/nokia/phone/net; interface=Phone.Net; member=signal_strength_change |
Re: Dbus method call
Quote:
Is it safe to edit /etc/dbus-1/event.d ? is there a dbus-daemon-launch-helper? how does it work? I've already played with /etc/event.d with relative success. Is it similar to /etc/dbus-1/event.d? where can I find an example of such a config file? I've read that it's not good to play with dbus, but I should use Telepathy. How does it work? how can I use the command line to control the phone without using dbus methods and signals? Thank you for your answers. |
All times are GMT. The time now is 09:23. |
vBulletin® Version 3.8.8