Hello everyone,
As I mentioned earlier, I've been playing a bit with getting
NetworkManager support to do good stuff in E. This patch updates
e_dbus to use the most accurate NM interface that I could find.
The patch adds all the functionality required, but I am too dumb to
figure out how to get "cvs diff -N" to work like "diff -N" and
actually include the new file. Instead, I've attached the missing
file which will need to go into src/lib/nm/ for e_dbus.
Next email will have a simple sample app that gets information about
network devices from NetworkManager.
? src/lib/nm/e_nm_network.c
Index: src/lib/nm/E_Nm.h
===================================================================
RCS file: /var/cvs/e/e17/proto/e_dbus/src/lib/nm/E_Nm.h,v
retrieving revision 1.1
diff -u -r1.1 E_Nm.h
--- src/lib/nm/E_Nm.h 21 Mar 2007 10:31:16 -0000 1.1
+++ src/lib/nm/E_Nm.h 23 Jul 2007 00:01:55 -0000
@@ -26,4 +26,26 @@
/* org.freedesktop.NetworkManager api */
int e_nm_get_devices(E_NM_Context *ctx, E_NM_Callback_Func cb_func, void
*data);
int e_nm_sleep(E_NM_Context *ctx, E_NM_Callback_Func cb_func, void *data, int
do_sleep);
+
+
+/* org.freedesktop.NetworkManager.Device api */
+int e_nm_device_get_name(E_NM_Context *ctx, const char *device,
+ E_NM_Callback_Func cb_func, void *data);
+int e_nm_device_get_type(E_NM_Context *ctx, const char *device,
+ E_NM_Callback_Func cb_func, void *data);
+int e_nm_device_get_hal_udi(E_NM_Context *ctx, const char *device,
+ E_NM_Callback_Func cb_func, void *data);
+int e_nm_device_get_ip4_address(E_NM_Context *ctx, const char *device,
+ E_NM_Callback_Func cb_func, void *data);
+int e_nm_device_get_link_active(E_NM_Context *ctx, const char *device,
+ E_NM_Callback_Func cb_func, void *data);
+int e_nm_device_wireless_get_strength(E_NM_Context *ctx, const char *device,
+ E_NM_Callback_Func cb_func, void *data);
+int e_nm_device_wireless_get_active_network(E_NM_Context *ctx,
+ const char *device,
+ E_NM_Callback_Func cb_func,
+ void *data);
+int e_nm_device_wireless_get_networks(E_NM_Context *ctx, const char *device,
+ E_NM_Callback_Func cb_func, void *data);
#endif
+
Index: src/lib/nm/Makefile.am
===================================================================
RCS file: /var/cvs/e/e17/proto/e_dbus/src/lib/nm/Makefile.am,v
retrieving revision 1.5
diff -u -r1.5 Makefile.am
--- src/lib/nm/Makefile.am 22 Mar 2007 07:47:37 -0000 1.5
+++ src/lib/nm/Makefile.am 23 Jul 2007 00:01:55 -0000
@@ -12,6 +12,7 @@
e_nm.c \
e_nm_manager.c \
e_nm_device.c \
+e_nm_network.c \
e_nm_util.c
Index: src/lib/nm/e_nm_device.c
===================================================================
RCS file: /var/cvs/e/e17/proto/e_dbus/src/lib/nm/e_nm_device.c,v
retrieving revision 1.2
diff -u -r1.2 e_nm_device.c
--- src/lib/nm/e_nm_device.c 22 Mar 2007 19:52:59 -0000 1.2
+++ src/lib/nm/e_nm_device.c 23 Jul 2007 00:01:55 -0000
@@ -1,72 +1,161 @@
+/*
+ * This file defines functions that query each of the functions provided by
+ * the NetworkManager Device interface.
+ */
+
#include "E_Nm.h"
#include "e_nm_private.h"
#include <Ecore_Data.h>
-#define e_nm_device_call_new(path, member)
dbus_message_new_method_call(E_NM_SERVICE, path, E_NM_INTERFACE_DEVICE, member)
-#define e_nm_device_wired_call_new(path, member)
dbus_message_new_method_call(E_NM_SERVICE, path, E_NM_INTERFACE_DEVICE_WIRED,
member)
-#define e_nm_device_wireless_call_new(path, member)
dbus_message_new_method_call(E_NM_SERVICE, path,
E_NM_INTERFACE_DEVICE_WIRELESS, member)
+/**
+ * Get the system name of a NetworkManager device
+ *
+ * Returns an Ecore_List of dbus object paths for network devices. This list is
+ * of const char *, and is freed automatically after the callback returns.
+ *
+ * @param ctx an e_nm context
+ * @param device a NetworkManager device to communicate with
+ * @param cb a callback, used when the method returns (or an error is received)
+ * @param data user data to pass to the callback function
+ */
+int
+e_nm_device_get_name(E_NM_Context *ctx, const char *device,
+ E_NM_Callback_Func cb_func, void *data)
+{
+ return e_nm_get_from_device (ctx, device, cb_func, data, "getName",
+ DBUS_TYPE_STRING);
+}
+/**
+ * Return the type of a an NM device:
+ *
+ * 0: unknown
+ * 1: wired
+ * 2: wireless
+ *
+ * @param ctx an e_nm context
+ * @param device a NetworkManager device to communicate with
+ * @param cb a callback, used when the method returns (or an error is received)
+ * @param data user data to pass to the callback function
+ */
int
-e_nm_device_deactivate(E_NM_Context *ctx, const char *device,
E_NM_Callback_Func cb_func, void *data)
+e_nm_device_get_type(E_NM_Context *ctx, const char *device,
+ E_NM_Callback_Func cb_func, void *data)
{
- E_NM_Callback *cb;
- DBusMessage *msg;
- int ret;
+ return e_nm_get_from_device (ctx, device, cb_func, data, "getType",
+ DBUS_TYPE_INT32);
+}
- cb = e_nm_callback_new(cb_func, data);
- msg = e_nm_device_call_new(device, "Deactivate");
- ret = e_dbus_message_send(ctx->conn, msg, cb_nm_generic, -1, cb) ? 1 : 0;
- dbus_message_unref(msg);
- return ret;
+
+/**
+ * Get the HAL UDI of a NetworkManager device
+ *
+ * @param ctx an e_nm context
+ * @param device a NetworkManager device to communicate with
+ * @param cb a callback, used when the method returns (or an error is received)
+ * @param data user data to pass to the callback function
+ */
+int
+e_nm_device_get_hal_udi(E_NM_Context *ctx, const char *device,
+ E_NM_Callback_Func cb_func, void *data)
+{
+ return e_nm_get_from_device (ctx, device, cb_func, data, "getHalUdi",
+ DBUS_TYPE_STRING);
}
+
+/**
+ * Get the IPv4 address of a NetworkManager device
+ *
+ * @param ctx an e_nm context
+ * @param device a NetworkManager device to communicate with
+ * @param cb a callback, used when the method returns (or an error is received)
+ * @param data user data to pass to the callback function
+ */
int
-e_nm_device_wired_activate(E_NM_Context *ctx, const char *device,
E_NM_Callback_Func cb_func, void *data, char user_requested)
+e_nm_device_get_ip4_address(E_NM_Context *ctx, const char *device,
+ E_NM_Callback_Func cb_func, void *data)
{
- E_NM_Callback *cb;
- DBusMessage *msg;
- int ret;
- dbus_bool_t val;
+ return e_nm_get_from_device (ctx, device, cb_func, data, "getIP4Address",
+ DBUS_TYPE_UINT32);
+}
- val = user_requested;
- cb = e_nm_callback_new(cb_func, data);
- msg = e_nm_device_wired_call_new(device, "Activate");
- dbus_message_append_args(msg, DBUS_TYPE_BOOLEAN, &val, DBUS_TYPE_INVALID);
- ret = e_dbus_message_send(ctx->conn, msg, cb_nm_generic, -1, cb) ? 1 : 0;
- dbus_message_unref(msg);
- return ret;
+/**
+ * Get the link status of a NetworkManager device
+ *
+ * @param ctx an e_nm context
+ * @param device a NetworkManager device to communicate with
+ * @param cb a callback, used when the method returns (or an error is received)
+ * @param data user data to pass to the callback function
+ */
+int
+e_nm_device_get_link_active(E_NM_Context *ctx, const char *device,
+ E_NM_Callback_Func cb_func, void *data)
+{
+ return e_nm_get_from_device (ctx, device, cb_func, data, "getLinkActive",
+ DBUS_TYPE_BOOLEAN);
}
+
+/**
+ * Get the signal strength of a the wireless network that a NetworkManager
+ * device is connected to.
+ *
+ * @param ctx an e_nm context
+ * @param device a NetworkManager device to communicate with
+ * @param cb a callback, used when the method returns (or an error is received)
+ * @param data user data to pass to the callback function
+ */
int
-e_nm_device_wireless_get_active_networks(E_NM_Context *ctx, const char
*device, E_NM_Callback_Func cb_func, void *data)
+e_nm_device_wireless_get_strength(E_NM_Context *ctx, const char *device,
+ E_NM_Callback_Func cb_func, void *data)
{
- E_NM_Callback *cb;
- DBusMessage *msg;
- int ret;
+ return e_nm_get_from_device (ctx, device, cb_func, data, "getStrength",
+ DBUS_TYPE_INT32);
+}
- cb = e_nm_callback_new(cb_func, data);
- msg = e_nm_device_wireless_call_new(device, "GetActiveNetworks");
- ret = e_dbus_message_send(ctx->conn, msg, cb_nm_string_list, -1, cb) ? 1 : 0;
- dbus_message_unref(msg);
- return ret;
+
+/**
+ * Find the NetworkManager device's currently associated wireless network
+ *
+ * @param ctx an e_nm context
+ * @param device a NetworkManager device to communicate with
+ * @param cb a callback, used when the method returns (or an error is received)
+ * @param data user data to pass to the callback function
+ */
+int
+e_nm_device_wireless_get_active_network(E_NM_Context *ctx, const char *device,
+ E_NM_Callback_Func cb_func, void *data)
+{
+ return e_nm_get_from_device (ctx, device, cb_func, data, "getActiveNetwork",
+ DBUS_TYPE_STRING);
}
+
+/**
+ * Get the list of available wireless networks
+ *
+ * Returns an Ecore_List of wireless network names
+ *
+ * @param ctx an e_nm context
+ * @param device a NetworkManager device to communicate with
+ * @param cb a callback, used when the method returns (or an error is received)
+ * @param data user data to pass to the callback function
+ */
int
-e_nm_device_wireless_activate(E_NM_Context *ctx, const char *device,
E_NM_Callback_Func cb_func, void *data, const char *access_point, char
user_requested)
+e_nm_device_wireless_get_networks(E_NM_Context *ctx, const char *device,
+ E_NM_Callback_Func cb_func, void *data)
{
E_NM_Callback *cb;
DBusMessage *msg;
int ret;
- dbus_bool_t val;
-
- val = user_requested;
cb = e_nm_callback_new(cb_func, data);
- msg = e_nm_device_wireless_call_new(device, "Activate");
- dbus_message_append_args(msg, DBUS_TYPE_STRING, &access_point,
DBUS_TYPE_BOOLEAN, &val, DBUS_TYPE_INVALID);
- ret = e_dbus_message_send(ctx->conn, msg, cb_nm_generic, -1, cb) ? 1 : 0;
+ msg = e_nm_device_call_new(device, "getNetworks");
+ ret = e_dbus_message_send(ctx->conn, msg, cb_nm_string_list, -1, cb) ? 1 : 0;
dbus_message_unref(msg);
return ret;
}
+
Index: src/lib/nm/e_nm_manager.c
===================================================================
RCS file: /var/cvs/e/e17/proto/e_dbus/src/lib/nm/e_nm_manager.c,v
retrieving revision 1.2
diff -u -r1.2 e_nm_manager.c
--- src/lib/nm/e_nm_manager.c 22 Mar 2007 19:52:59 -0000 1.2
+++ src/lib/nm/e_nm_manager.c 23 Jul 2007 00:01:55 -0000
@@ -1,6 +1,6 @@
#include "E_Nm.h"
#include "e_nm_private.h"
-#define e_nm_manager_call_new(member)
dbus_message_new_method_call(E_NM_SERVICE, E_NM_PATH_NETWORK_MANAGER,
E_NM_INTERFACE_NETWORK_MANAGER, member)
+
/**
* Get all network devices.
@@ -9,9 +9,9 @@
* of const char *, and is freed automatically after the callback returns.
*
* @param ctx an e_nm context
- * @param cb a callback to call when the method returns (or an error is
received)
+ * @param cb a callback, used when the method returns (or an error is received)
* @param data user data to pass to the callback function
- */
+ **/
int
e_nm_get_devices(E_NM_Context *ctx, E_NM_Callback_Func cb_func, void *data)
{
@@ -20,35 +20,59 @@
int ret;
cb = e_nm_callback_new(cb_func, data);
- msg = e_nm_manager_call_new("GetDevices");
+ msg = e_nm_manager_call_new("getDevices");
ret = e_dbus_message_send(ctx->conn, msg, cb_nm_string_list, -1, cb) ? 1 : 0;
dbus_message_unref(msg);
return ret;
}
+
/**
- * Sleep or wake up network manager.
- *
- * The return_data of the callback will be NULL.
+ * Find the active device that NM has chosen
+ *
+ * Returns a single string containing the dbus path to the active device
*
* @param ctx an e_nm context
- * @param cb a callback to call when the method returns (or an error is
received)
+ * @param cb a callback, used when the method returns (or an error is received)
* @param data user data to pass to the callback function
- */
+ **/
int
-e_nm_sleep(E_NM_Context *ctx, E_NM_Callback_Func cb_func, void *data, int
do_sleep)
+e_nm_get_active_device(E_NM_Context *ctx, E_NM_Callback_Func cb_func,
+ void *data)
{
- E_NM_Callback *cb;
- DBusMessage *msg;
- int ret;
- dbus_bool_t var = do_sleep;
+ return e_nm_get_from_nm (ctx, cb_func, data,
+ "getActiveDevice", DBUS_TYPE_STRING);
+}
- cb = e_nm_callback_new(cb_func, data);
- msg = e_nm_manager_call_new("Sleep");
- dbus_message_append_args(msg, DBUS_TYPE_BOOLEAN, &var, DBUS_TYPE_INVALID);
- ret = e_dbus_message_send(ctx->conn, msg, cb_nm_generic, -1, cb) ? 1 : 0;
- dbus_message_unref(msg);
- return ret;
+/**
+ * Query the current state of the network
+ *
+ * Returns a single string containing the status:
+ *
+ * "connecting": there is a pending network connection (waiting for a DHCP
+ * request to complete, waiting for an encryption
+ * key/passphrase, waiting for a wireless network, etc)
+ *
+ * "connected": there is an active network connection
+ *
+ * "scanning": there is no active network connection, but NetworkManager
+ * is looking for an access point to associate with
+ *
+ * "disconnected": there is no network connection
+ *
+ *
+ *
+ * @param ctx an e_nm context
+ * @param cb a callback, used when the method returns (or an error is received)
+ * @param data user data to pass to the callback function
+ **/
+int
+e_nm_status(E_NM_Context *ctx, E_NM_Callback_Func cb_func,
+ void *data)
+{
+
+ return e_nm_get_from_nm (ctx, cb_func, data,
+ "status", DBUS_TYPE_STRING);
}
Index: src/lib/nm/e_nm_private.h
===================================================================
RCS file: /var/cvs/e/e17/proto/e_dbus/src/lib/nm/e_nm_private.h,v
retrieving revision 1.2
diff -u -r1.2 e_nm_private.h
--- src/lib/nm/e_nm_private.h 22 Mar 2007 01:44:13 -0000 1.2
+++ src/lib/nm/e_nm_private.h 23 Jul 2007 00:01:55 -0000
@@ -5,8 +5,14 @@
#define E_NM_INTERFACE_NETWORK_MANAGER "org.freedesktop.NetworkManager"
#define E_NM_PATH_NETWORK_MANAGER "/org/freedesktop/NetworkManager"
#define E_NM_INTERFACE_DEVICE "org.freedesktop.NetworkManager.Device"
-#define E_NM_INTERFACE_DEVICE_WIRED
"org.freedesktop.NetworkManager.Device.Wired"
-#define E_NM_INTERFACE_DEVICE_WIRELESS
"org.freedesktop.NetworkManager.Device.Wireless"
+
+
+#define e_nm_manager_call_new(member)
dbus_message_new_method_call(E_NM_SERVICE, E_NM_PATH_NETWORK_MANAGER,
E_NM_INTERFACE_NETWORK_MANAGER, member)
+
+#define e_nm_device_call_new(path, member)
dbus_message_new_method_call(E_NM_SERVICE, path, E_NM_INTERFACE_DEVICE, member)
+
+#define e_nm_network_call_new(member)
dbus_message_new_method_call(E_NM_SERVICE, E_NM_PATH_NETWORK_MANAGER,
E_NM_INTERFACE_NETWORK_MANAGER, member)
+
typedef struct E_NM_Callback E_NM_Callback;
struct E_NM_Callback
@@ -34,6 +40,16 @@
E_NM_Callback * e_nm_callback_new(E_NM_Callback_Func cb_func, void *user_data);
void e_nm_callback_free(E_NM_Callback *callback);
+int e_nm_get_from_nm(E_NM_Context *ctx, E_NM_Callback_Func cb_func, void *data,
+ const char *method, int rettype);
+int e_nm_get_from_device(E_NM_Context *ctx, const char *device,
+ E_NM_Callback_Func cb_func, void *data,
+ const char *method, int rettype);
+
void cb_nm_generic(void *data, DBusMessage *msg, DBusError *err);
+void cb_nm_int32(void *data, DBusMessage *msg, DBusError *err);
+void cb_nm_uint32(void *data, DBusMessage *msg, DBusError *err);
+void cb_nm_string(void *data, DBusMessage *msg, DBusError *err);
+void cb_nm_boolean(void *data, DBusMessage *msg, DBusError *err);
void cb_nm_string_list(void *data, DBusMessage *msg, DBusError *err);
#endif
Index: src/lib/nm/e_nm_util.c
===================================================================
RCS file: /var/cvs/e/e17/proto/e_dbus/src/lib/nm/e_nm_util.c,v
retrieving revision 1.2
diff -u -r1.2 e_nm_util.c
--- src/lib/nm/e_nm_util.c 22 Mar 2007 07:20:04 -0000 1.2
+++ src/lib/nm/e_nm_util.c 23 Jul 2007 00:01:55 -0000
@@ -1,10 +1,91 @@
#include "E_Nm.h"
#include "e_nm_private.h"
+#include "E_DBus.h"
#include <string.h>
#include <Ecore_Data.h>
/**
* @internal
+ * @brief returns an e_dbus callback for a given dbus type
+ * @param rettype the return type we want to find a callback for
+ **/
+E_NM_Callback_Func
+e_nm_callback_by_type (int rettype)
+{
+ switch (rettype)
+ {
+ case DBUS_TYPE_STRING:
+ return (E_NM_Callback_Func) cb_nm_string;
+
+ case DBUS_TYPE_INT32:
+ return (E_NM_Callback_Func) cb_nm_int32;
+
+ case DBUS_TYPE_UINT32:
+ return (E_NM_Callback_Func) cb_nm_uint32;
+
+ case DBUS_TYPE_BOOLEAN:
+ return (E_NM_Callback_Func) cb_nm_boolean;
+
+ default:
+ return (E_NM_Callback_Func) cb_nm_generic;
+ }
+}
+
+/**
+ * @internal
+ * @brief Send "get" messages to NetworkManager via e_dbus
+ * @param ctx an e_nm context
+ * @param cb a callback, used when the method returns (or an error is received)
+ * @param data user data to pass to the callback function
+ * @param method the name of the method that should be called
+ * @param rettype the type of the data that will be returned to the callback
+ **/
+int
+e_nm_get_from_nm(E_NM_Context *ctx, E_NM_Callback_Func cb_func, void *data,
+ const char *method, int rettype)
+{
+ E_NM_Callback *cb;
+ DBusMessage *msg;
+ int ret;
+
+ cb = e_nm_callback_new(cb_func, data);
+ msg = e_nm_manager_call_new(method);
+ ret = e_dbus_message_send(ctx->conn, msg,
+ e_nm_callback_by_type (rettype), -1, cb) ? 1 : 0;
+ dbus_message_unref(msg);
+ return ret;
+}
+
+
+/**
+ * @internal
+ * @brief Send "get" messages to a Device via e_dbus
+ * @param ctx an e_nm context
+ * @param cb a callback, used when the method returns (or an error is received)
+ * @param data user data to pass to the callback function
+ * @param method the name of the method that should be called
+ * @param rettype the type of the data that will be returned to the callback
+ **/
+int
+e_nm_get_from_device(E_NM_Context *ctx, const char *device,
+ E_NM_Callback_Func cb_func, void *data,
+ const char *method, int rettype)
+{
+ E_NM_Callback *cb;
+ DBusMessage *msg;
+ int ret;
+
+ cb = e_nm_callback_new(cb_func, data);
+ msg = e_nm_device_call_new(device, method);
+ ret = e_dbus_message_send(ctx->conn, msg,
+ e_nm_callback_by_type (rettype), -1, cb) ? 1 : 0;
+ dbus_message_unref(msg);
+ return ret;
+}
+
+
+/**
+ * @internal
* @brief Create a callback structure
* @param cb_func the callback function
* @param user_data data to pass to the callback
@@ -54,6 +135,139 @@
/**
* @internal
+ * @brief Callback for methods that return DBUS_TYPE_INT32
+ */
+void
+cb_nm_int32(void *data, DBusMessage *msg, DBusError *err)
+{
+ E_NM_Callback *cb;
+ dbus_int32_t *i;
+
+ i = malloc (sizeof (dbus_int32_t));
+
+ cb = data;
+ if (!cb->func)
+ goto out;
+
+ if (dbus_error_is_set (err))
+ {
+ cb->func (cb->user_data, NULL, err);
+ dbus_error_free (err);
+ goto out;
+ }
+
+ /* Actually emit the integer */
+ dbus_message_get_args (msg, err,
+ DBUS_TYPE_INT32, i,
+ DBUS_TYPE_INVALID);
+ cb->func (cb->user_data, i, err);
+
+out:
+ e_nm_callback_free(cb);
+ return;
+}
+
+/**
+ * @internal
+ * @brief Callback for methods that return DBUS_TYPE_UINT32
+ */
+void
+cb_nm_uint32(void *data, DBusMessage *msg, DBusError *err)
+{
+ E_NM_Callback *cb;
+ dbus_uint32_t *i;
+
+ i = malloc (sizeof (dbus_uint32_t));
+
+ cb = data;
+ if (!cb->func)
+ goto out;
+
+ if (dbus_error_is_set (err))
+ {
+ cb->func (cb->user_data, NULL, err);
+ dbus_error_free (err);
+ goto out;
+ }
+
+ /* Actually emit the unsigned integer */
+ dbus_message_get_args (msg, err,
+ DBUS_TYPE_UINT32, i,
+ DBUS_TYPE_INVALID);
+ cb->func (cb->user_data, i, err);
+
+out:
+ e_nm_callback_free(cb);
+ return;
+}
+
+/**
+ * @internal
+ * @brief Callback for methods that return DBUS_TYPE_BOOLEAN
+ */
+void
+cb_nm_boolean(void *data, DBusMessage *msg, DBusError *err)
+{
+ E_NM_Callback *cb;
+ dbus_bool_t i;
+
+ cb = data;
+ if (!cb->func)
+ goto out;
+
+ if (dbus_error_is_set (err))
+ {
+ cb->func (cb->user_data, NULL, err);
+ dbus_error_free (err);
+ goto out;
+ }
+
+ /* Actually emit the unsigned integer */
+ dbus_message_get_args (msg, err,
+ DBUS_TYPE_BOOLEAN, &i,
+ DBUS_TYPE_INVALID);
+ cb->func (cb->user_data, i, err);
+
+out:
+ e_nm_callback_free(cb);
+ return;
+}
+
+/**
+ * @internal
+ * @brief Callback for methods returning a single string
+ */
+void
+cb_nm_string(void *data, DBusMessage *msg, DBusError *err)
+{
+ E_NM_Callback *cb;
+ char *str;
+
+ cb = data;
+ if (!cb->func)
+ goto out;
+
+ if (dbus_error_is_set (err))
+ {
+ cb->func (cb->user_data, NULL, err);
+ dbus_error_free (err);
+ goto out;
+ }
+
+ /* Actually emit the string */
+ dbus_message_get_args (msg, err,
+ DBUS_TYPE_STRING, &str,
+ DBUS_TYPE_INVALID);
+ cb->func (cb->user_data, str, err);
+
+out:
+ e_nm_callback_free(cb);
+ return;
+}
+
+
+/**
+ * @internal
* @brief Callback for methods returning a list of strings or object paths
*/
void
--
Ross Vandegrift
[EMAIL PROTECTED]
"The good Christian should beware of mathematicians, and all those who
make empty prophecies. The danger already exists that the mathematicians
have made a covenant with the devil to darken the spirit and to confine
man in the bonds of Hell."
--St. Augustine, De Genesi ad Litteram, Book II, xviii, 37
#include "E_Nm.h"
#include "e_nm_private.h"
/**
* Get the ESSID of a wireless network
*
* @param ctx an e_nm context
* @param cb a callback, used when the method returns (or an error is received)
* @param data user data to pass to the callback function
**/
int
e_nm_network_get_name(E_NM_Context *ctx, const char *device,
E_NM_Callback_Func cb_func, void *data)
{
return e_nm_get_from_device (ctx, device, cb_func, data, "getName",
DBUS_TYPE_STRING);
}
/**
* Get the MAC address of a wireless network's AP
*
* @param ctx an e_nm context
* @param cb a callback, used when the method returns (or an error is received)
* @param data user data to pass to the callback function
**/
int
e_nm_network_get_address(E_NM_Context *ctx, const char *device,
E_NM_Callback_Func cb_func, void *data)
{
return e_nm_get_from_device (ctx, device, cb_func, data, "getAddress",
DBUS_TYPE_STRING);
}
/**
* Get the strength of the network; given out of 100
*
* @param ctx an e_nm context
* @param cb a callback, used when the method returns (or an error is received)
* @param data user data to pass to the callback function
**/
int
e_nm_network_get_strength(E_NM_Context *ctx, const char *device,
E_NM_Callback_Func cb_func, void *data)
{
return e_nm_get_from_device (ctx, device, cb_func, data, "getStrength",
DBUS_TYPE_INT32);
}
/**
* Get the frequency of the network; given in GHz
*
* @param ctx an e_nm context
* @param cb a callback, used when the method returns (or an error is received)
* @param data user data to pass to the callback function
**/
int
e_nm_network_get_frequency(E_NM_Context *ctx, const char *device,
E_NM_Callback_Func cb_func, void *data)
{
return e_nm_get_from_device (ctx, device, cb_func, data, "getFrequency",
DBUS_TYPE_DOUBLE);
}
/**
* Get the data rate of the network; given in Mbps
*
* @param ctx an e_nm context
* @param cb a callback, used when the method returns (or an error is received)
* @param data user data to pass to the callback function
**/
int
e_nm_network_get_rate(E_NM_Context *ctx, const char *device,
E_NM_Callback_Func cb_func, void *data)
{
return e_nm_get_from_device (ctx, device, cb_func, data, "getRate",
DBUS_TYPE_INT32);
}
/**
* Return true if the network requires encryption
*
* @param ctx an e_nm context
* @param cb a callback, used when the method returns (or an error is received)
* @param data user data to pass to the callback function
**/
int
e_nm_network_get_encryption(E_NM_Context *ctx, const char *device,
E_NM_Callback_Func cb_func, void *data)
{
return e_nm_get_from_device (ctx, device, cb_func, data, "getEncryption",
DBUS_TYPE_BOOLEAN);
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel