Re: unable to create networkmanager proxy using glib



i found out i can use gdbus. how to get signal strength? there isn't any method like getSignalStrength in NetworkManager gdbus object
nm-applet was able to display signal strength in system tray. so there should be a way to get signal strength form network manager!

nmcli is command line counter part of nm-applet. Can i get signal strength using nmcli? nothing about signal strength is mentioned in its man pages.



On Thu, Jun 20, 2013 at 8:59 PM, Dan Williams <dcbw redhat com> wrote:
On Thu, 2013-06-20 at 14:26 +0530, satya gowtham kudupudi wrote:
> This is c++ code ive written to get Modem capabilities.
>
> DBusGConnection *connection;
>     GError * error;
>     DBusGProxy *proxy;
>     char ** name_list;
>     char ** name_list_ptr;
>     g_type_init();
>     error = NULL;
>     connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error);

DBUS_BUS_SYSTEM here; NM runs as a root service on the system bus, not
the session bus (which is for user-specific processes in your login
session). The error you're seeing below means "NM not running on this
bus".  So try the system bus and I bet you'll get farther.

Dan

>     if (connection == NULL) {
>         g_printerr("Failed to open connection to bus: %s\n",
> error->message);
>         g_error_free(error);
>         return false;
>     }
>     proxy = dbus_g_proxy_new_for_name(connection,
> "org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/Device",
> "org.freedesktop.NetworkManager.Device.Modem");
>     error = NULL;
>     if (!dbus_g_proxy_call(proxy, "ModemCapabilities", &error,
> G_TYPE_INVALID, G_TYPE_STRV, &name_list, G_TYPE_INVALID)) {
>         if (error->domain == DBUS_GERROR && error->code ==
> DBUS_GERROR_REMOTE_EXCEPTION) {
>             g_printerr("Caught remote method exception %s: %s",
>                     dbus_g_error_get_name(error),
>                     error->message);
>         } else {
>             g_printerr("Error: %s\n", error->message);
>         }
>         g_error_free(error);
>         return 0;
>     }
>
> Im getting following error:
> Error: The name org.freedesktop.NetworkManager was not provided by any
> .service files
>
> I want to read modem capabilities. Do some one can help me in doing this?
>
> Thank you,
>
> Regards
> *Gowtham*
> _______________________________________________
> networkmanager-list mailing list
> networkmanager-list gnome org
> https://mail.gnome.org/mailman/listinfo/networkmanager-list





--
- Gowtham


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]