diff options
-rw-r--r-- | src/plugins/wireless/plugin.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/plugins/wireless/plugin.c b/src/plugins/wireless/plugin.c index 74c0ef4..5708372 100644 --- a/src/plugins/wireless/plugin.c +++ b/src/plugins/wireless/plugin.c @@ -61,6 +61,21 @@ static void deinit(plugin_t *plugin, DBusConnection *connection) { close(plugin->fd); } +static void notify_event(DBusConnection *bus, char *event) { + DBusMessage *message; + message = dbus_message_new_signal(WIRELESS_PATH, + WIRELESS_INTERFACE, + "Event"); + + dbus_message_append_args(message, + DBUS_TYPE_STRING, + &event, + DBUS_TYPE_INVALID); + dbus_connection_send(bus, message, NULL); + dbus_connection_flush(bus); + dbus_message_unref(message); +} + static void handle_incoming(plugin_t *plugin, DBusConnection *connection) { struct wpa_ctrl *ctrl_conn = (struct wpa_ctrl *) plugin->priv; char buf[2048]; @@ -68,6 +83,7 @@ static void handle_incoming(plugin_t *plugin, DBusConnection *connection) { wpa_ctrl_recv(ctrl_conn, buf, &len); buf[len] = '\0'; printf("received event: %s\n", buf); + notify_event(connection, buf); } static DBusHandlerResult handle_message(DBusConnection *connection, DBusMessage *message, plugin_t *plugin) { |