_E("Failed to add timer");
}
-static GVariant *edbus_playcustom(GDBusConnection *conn,
- const gchar *sender, const gchar *path, const gchar *iface, const gchar *name,
- GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data)
+static GVariant *dbus_playcustom(GDBusConnection *conn,
+ const gchar *sender, const gchar *path, const gchar *iface, const gchar *name,
+ GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data)
{
int ret;
int on, off;
return g_variant_new("(i)", ret);
}
-static GVariant *edbus_stopcustom(GDBusConnection *conn,
- const gchar *sender, const gchar *path, const gchar *iface, const gchar *name,
- GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data)
+static GVariant *dbus_stopcustom(GDBusConnection *conn,
+ const gchar *sender, const gchar *path, const gchar *iface, const gchar *name,
+ GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data)
{
int ret;
pid_t pid;
return g_variant_new("(i)", ret);
}
+static GVariant *dbus_multi_playcustom(GDBusConnection *conn,
+ const gchar *sender, const gchar *path, const gchar *iface, const gchar *name,
+ GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data)
+{
+ int ret = 0;
+ int *led;
+ unsigned int *color;
+ int num_of_leds;
+ struct led_state state;
+ pid_t pid;
+ GVariantIter *iter;
+ int i;
+
+ g_variant_get(param, "(a(bu))", &iter);
+ num_of_leds = g_variant_iter_n_children(iter);
+
+ led = (int*)malloc(sizeof(int) * num_of_leds);
+ color = (unsigned int*)malloc(sizeof(unsigned int) * num_of_leds);
+
+ i = 0;
+ while (g_variant_iter_loop(iter, "(bu)", &led[i], &color[i]))
+ ++i;
+
+ g_variant_iter_free(iter);
+
+ pid = dbus_connection_get_sender_pid(conn, sender);
+
+ /* To be implemented */
+out:
+ free(led);
+ free(color);
+
+ return g_variant_new("(i)", ret);
+}
+
+static GVariant *dbus_multi_stopcustom(GDBusConnection *conn,
+ const gchar *sender, const gchar *path, const gchar *iface, const gchar *name,
+ GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data)
+{
+ pid_t pid;
+ int *led;
+ int ret = 0;
+ int i;
+ int num_of_leds;
+ GVariantIter *iter;
+
+ g_variant_get(param, "(ab)", &iter);
+ num_of_leds = g_variant_iter_n_children(iter);
+
+ led = (int*)malloc(sizeof(int) * num_of_leds);
+ i = 0;
+
+ while (g_variant_iter_loop(iter, "b", &led[i++]))
+ ;
+ g_variant_iter_free(iter);
+
+ pid = dbus_connection_get_sender_pid(conn, sender);
+
+ _I("pid %d led stop custom", pid);
+
+ /* To be implemented */
+out:
+ free(led);
+ return g_variant_new("(i)", ret);
+}
+
static const dbus_method_s dbus_methods[] = {
- { "playcustom", "iiuu", "i", edbus_playcustom },
- { "stopcustom", NULL, "i", edbus_stopcustom },
+ { "playcustom", "iiuu", "i", dbus_playcustom },
+ { "stopcustom", NULL, "i", dbus_stopcustom },
+ { "multi_playcustom", "a(bu)", "i", dbus_multi_playcustom },
+ { "multi_stopcustom", "ab", "i", dbus_multi_stopcustom },
/* Add methods here */
};