summaryrefslogtreecommitdiff
path: root/plugins/iospm.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-03-11 22:06:06 +0100
committerMarcel Holtmann <marcel@holtmann.org>2009-03-11 22:06:06 +0100
commit18b98a772b0ddad66b79b958b271a20879e4f225 (patch)
tree41a460986e53dc02ced2506c765b8827fc82e7c2 /plugins/iospm.c
parent76ca29341f8c68a7345c0b09f7097debf759d585 (diff)
downloadconnman-18b98a772b0ddad66b79b958b271a20879e4f225.tar.gz
connman-18b98a772b0ddad66b79b958b271a20879e4f225.tar.bz2
connman-18b98a772b0ddad66b79b958b271a20879e4f225.zip
Add support for sending flight mode indication
Diffstat (limited to 'plugins/iospm.c')
-rw-r--r--plugins/iospm.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/plugins/iospm.c b/plugins/iospm.c
index 9d5db44b..b967d4bd 100644
--- a/plugins/iospm.c
+++ b/plugins/iospm.c
@@ -26,8 +26,16 @@
#define CONNMAN_API_SUBJECT_TO_CHANGE
#include <connman/plugin.h>
#include <connman/notifier.h>
+#include <connman/dbus.h>
#include <connman/log.h>
+#define IOSPM_SERVICE "com.intel.mid.ospm"
+#define IOSPM_INTERFACE IOSPM_SERVICE ".MMF"
+
+#define IOSPM_FLIGHT_MODE "/com/intel/mid/ospm/flight_mode"
+
+static DBusConnection *connection;
+
static void iospm_device_enabled(enum connman_device_type type,
connman_bool_t enabled)
{
@@ -36,7 +44,26 @@ static void iospm_device_enabled(enum connman_device_type type,
static void iospm_offline_mode(connman_bool_t enabled)
{
+ DBusMessage *message;
+ const char *method;
+
DBG("enabled %d", enabled);
+
+ if (enabled == TRUE)
+ method = "IndicateStart";
+ else
+ method = "IndicateStop";
+
+ message = dbus_message_new_method_call(IOSPM_SERVICE,
+ IOSPM_FLIGHT_MODE, IOSPM_INTERFACE, method);
+ if (message == NULL)
+ return;
+
+ dbus_message_set_no_reply(message, TRUE);
+
+ dbus_connection_send(connection, message, NULL);
+
+ dbus_message_unref(message);
}
static struct connman_notifier iospm_notifier = {
@@ -48,12 +75,16 @@ static struct connman_notifier iospm_notifier = {
static int iospm_init(void)
{
+ connection = connman_dbus_get_connection();
+
return connman_notifier_register(&iospm_notifier);
}
static void iospm_exit(void)
{
connman_notifier_unregister(&iospm_notifier);
+
+ dbus_connection_unref(connection);
}
CONNMAN_PLUGIN_DEFINE(ospm, "Intel OSPM notification plugin", VERSION,