backends: change default animation names following default naming rule 78/220678/1
authorjeon <jhyuni.kang@samsung.com>
Mon, 2 Sep 2019 11:00:59 +0000 (20:00 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Fri, 20 Dec 2019 07:22:27 +0000 (16:22 +0900)
Change-Id: I1f6e8a1f72341cc4f7897551d84f05b352dfb577

68 files changed:
backends/Makefile.am
backends/bt/default_ani_connected.c [new file with mode: 0644]
backends/bt/default_ani_pairing.c [new file with mode: 0644]
backends/default_ani_alarm.c [deleted file]
backends/default_ani_connected.c [deleted file]
backends/default_ani_easysetup.c [deleted file]
backends/default_ani_emergency.c [deleted file]
backends/default_ani_error.c [deleted file]
backends/default_ani_listening.c [deleted file]
backends/default_ani_micoff.c [deleted file]
backends/default_ani_networkerror.c [deleted file]
backends/default_ani_normal.c [deleted file]
backends/default_ani_pairing.c [deleted file]
backends/default_ani_processing.c [deleted file]
backends/default_ani_speaking.c [deleted file]
backends/default_ani_streaming.c [deleted file]
backends/default_ani_swupdatedone.c [deleted file]
backends/default_ani_system_processing.c [deleted file]
backends/default_ani_timeout.c [deleted file]
backends/default_backend.c
backends/notification/default_ani_alarm.c [new file with mode: 0644]
backends/notification/default_ani_emergency.c [new file with mode: 0644]
backends/notification/default_ani_error.c [new file with mode: 0644]
backends/notification/default_ani_networkerror.c [new file with mode: 0644]
backends/notification/default_ani_normal.c [new file with mode: 0644]
backends/res/alarm.json [deleted file]
backends/res/bt/connected.json [new file with mode: 0644]
backends/res/bt/pairing.json [new file with mode: 0644]
backends/res/connected.json [deleted file]
backends/res/easy_setup.json [deleted file]
backends/res/emergency.json [deleted file]
backends/res/error.json [deleted file]
backends/res/listening.json [deleted file]
backends/res/mic_off.json [deleted file]
backends/res/network_error.json [deleted file]
backends/res/normal.json [deleted file]
backends/res/notification/alarm.json [new file with mode: 0644]
backends/res/notification/emergency.json [new file with mode: 0644]
backends/res/notification/error.json [new file with mode: 0644]
backends/res/notification/network_error.json [new file with mode: 0644]
backends/res/notification/normal.json [new file with mode: 0644]
backends/res/pairing.json [deleted file]
backends/res/processing.json [deleted file]
backends/res/speaking.json [deleted file]
backends/res/streaming.json [deleted file]
backends/res/sw_update_done.json [deleted file]
backends/res/system/easy_setup.json [new file with mode: 0644]
backends/res/system/mic_off.json [new file with mode: 0644]
backends/res/system/processing.json [new file with mode: 0644]
backends/res/system/sw_update_done.json [new file with mode: 0644]
backends/res/system_processing.json [deleted file]
backends/res/timeout.json [deleted file]
backends/res/voice/listening.json [new file with mode: 0644]
backends/res/voice/processing.json [new file with mode: 0644]
backends/res/voice/speaking.json [new file with mode: 0644]
backends/res/voice/streaming.json [new file with mode: 0644]
backends/res/voice/timeout.json [new file with mode: 0644]
backends/system/default_ani_easysetup.c [new file with mode: 0644]
backends/system/default_ani_micoff.c [new file with mode: 0644]
backends/system/default_ani_swupdatedone.c [new file with mode: 0644]
backends/system/default_ani_system_processing.c [new file with mode: 0644]
backends/voice/default_ani_listening.c [new file with mode: 0644]
backends/voice/default_ani_processing.c [new file with mode: 0644]
backends/voice/default_ani_speaking.c [new file with mode: 0644]
backends/voice/default_ani_streaming.c [new file with mode: 0644]
backends/voice/default_ani_timeout.c [new file with mode: 0644]
packaging/libpui.spec
samples/PUI_sample.c

index 90e04847977f035a60376bcac60e9b565226076d..9f93b4947a1c7787640f65e14eb7f79b1116a132 100644 (file)
@@ -14,19 +14,19 @@ libpui_default_backend_la_LIBADD = $(DEFAULT_BACKEND_LIBS)
 
 libpui_default_backend_la_SOURCES = \
         default_backend.c \
-        default_ani_listening.c \
-        default_ani_speaking.c \
-        default_ani_processing.c \
-        default_ani_streaming.c \
-        default_ani_timeout.c \
-        default_ani_emergency.c \
-        default_ani_system_processing.c \
-        default_ani_normal.c \
-        default_ani_easysetup.c \
-        default_ani_swupdatedone.c \
-        default_ani_micoff.c \
-        default_ani_networkerror.c \
-        default_ani_error.c \
-        default_ani_alarm.c \
-        default_ani_pairing.c \
-        default_ani_connected.c
+        system/default_ani_easysetup.c \
+        system/default_ani_system_processing.c \
+        system/default_ani_swupdatedone.c \
+        system/default_ani_micoff.c \
+        voice/default_ani_listening.c \
+        voice/default_ani_streaming.c \
+        voice/default_ani_processing.c \
+        voice/default_ani_speaking.c \
+        voice/default_ani_timeout.c \
+        notification/default_ani_normal.c \
+        notification/default_ani_emergency.c \
+        notification/default_ani_networkerror.c \
+        notification/default_ani_error.c \
+        notification/default_ani_alarm.c \
+        bt/default_ani_pairing.c \
+        bt/default_ani_connected.c
diff --git a/backends/bt/default_ani_connected.c b/backends/bt/default_ani_connected.c
new file mode 100644 (file)
index 0000000..ccc9bd1
--- /dev/null
@@ -0,0 +1,205 @@
+/*
+ * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "../default_backend.h"
+
+static void
+_ani_backend_connected_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
+{
+       if (!frame) return;
+       if (!r || !g || !b) return;
+       if (led_idx > frame->num_led) return;
+
+       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
+       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
+       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
+}
+
+static void
+_ani_backend_connected_free_frame(default_frame_info_t *frame)
+{
+       if (!frame) return;
+
+       if (frame->leds) free(frame->leds);
+       free(frame);
+}
+
+static default_frame_info_t *
+_ani_backend_connected_get_frame(default_ani_info *ani_info)
+{
+#define BLINK_FRAME 2
+       default_frame_info_t *frame, *key_frame;
+
+       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
+       if (!frame) return NULL;
+
+       key_frame = &ani_info->frames[0];
+       frame->num_led = key_frame->num_led;
+       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
+       if (!frame->leds)
+       {
+               free(frame);
+               return NULL;
+       }
+
+       if (ani_info->frame_idx % BLINK_FRAME == 0)
+       {
+               for (int i = 0; i < key_frame->num_led; i++)
+               {
+                       frame->leds[i].color = key_frame->leds[i].color;
+               }
+       }
+       else
+       {
+               for (int i = 0; i < key_frame->num_led; i++)
+               {
+                       frame->leds[i].color = 0x000000;
+               }
+       }
+
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= BLINK_FRAME)
+               ani_info->frame_idx = 0;
+
+       return frame;
+}
+
+
+static pui_bool
+_ani_backend_connected_frame_cb(void *data, int serial)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_ani_t *ani = (pui_ani_t *)data;
+       pui_backend_ani_data *ani_data = NULL;
+       pui_ani_control_buffer *buffer = NULL;
+       default_frame_info_t *frame;
+       unsigned int r = 0x0, g = 0x0, b = 0x0;
+       double now;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       now = ecore_time_unix_get();
+       pui_info("[time:%.3f] serial=%d\n", now, serial);
+
+       /* TODO : make use of ani_info */
+       //(void) ani_info;
+
+       buffer = pui_backend_ani_get_buffer(ani);
+       if (!buffer) {
+               pui_err("Failed to get buffer for animation\n");
+               return (pui_bool)0;
+       }
+
+       frame = _ani_backend_connected_get_frame(ani_info);
+       for(int i = 0; i<12; i++)
+       {
+               _ani_backend_connected_get_led_rgb(frame, i, &r, &g, &b);
+               buffer->ptr[4*i] = 0;
+               buffer->ptr[4*i + 1] = b; /* BLUE */
+               buffer->ptr[4*i + 2] = g; /* GREEN */
+               buffer->ptr[4*i + 3] = r; /* RED */
+       }
+       _ani_backend_connected_free_frame(frame);
+
+       e = pui_backend_ani_set_buffer(ani, buffer);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       e = pui_backend_ani_update(ani);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on updating animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       pui_info("... update (serial=%d)\n", serial);
+
+       return (pui_bool)1;
+}
+
+pui_error
+_ani_connected_start(pui_ani_t *ani, int repeat)
+{
+       pui_bool ret = 0;
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
+
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
+       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_connected_frame_cb, info->interval / 1000.0);
+
+       if (!ret)
+       {
+               pui_err("Failed to add frame callback !\n");
+               e = PUI_INT_ERROR_INVALID_RESOURCES;
+       }
+
+       return e;
+}
+
+pui_error
+_ani_connected_stop(pui_ani_t *ani)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s\n", info->id);
+
+       pui_backend_ani_remove_frame_cb(ani);
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       return e;
+}
+
+
+void
+pui_default_backend_ani_connected_func_set(pui_backend_ani_func *func)
+{
+       if (!func) return;
+
+       func->ani_start = _ani_connected_start;
+       func->ani_stop = _ani_connected_stop;
+}
+
+
diff --git a/backends/bt/default_ani_pairing.c b/backends/bt/default_ani_pairing.c
new file mode 100644 (file)
index 0000000..3e59bc7
--- /dev/null
@@ -0,0 +1,197 @@
+/*
+ * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "../default_backend.h"
+
+static void
+_ani_backend_pairing_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
+{
+       if (!frame) return;
+       if (!r || !g || !b) return;
+       if (led_idx > frame->num_led) return;
+
+       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
+       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
+       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
+}
+
+static void
+_ani_backend_pairing_free_frame(default_frame_info_t *frame)
+{
+       if (!frame) return;
+
+       if (frame->leds) free(frame->leds);
+       free(frame);
+}
+
+static default_frame_info_t *
+_ani_backend_pairing_get_frame(default_ani_info *ani_info)
+{
+       default_frame_info_t *frame, *key_frame;
+       int idx;
+
+       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
+       if (!frame) return NULL;
+
+       idx = ani_info->frame_idx;
+
+       key_frame = &ani_info->frames[idx];
+       frame->num_led = key_frame->num_led;
+       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
+       if (!frame->leds)
+       {
+               free(frame);
+               return NULL;
+       }
+
+       for (int i = 0; i < key_frame->num_led; i++)
+       {
+               frame->leds[i].color = key_frame->leds[i].color;
+       }
+
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= ani_info->num_key_frames)
+               ani_info->frame_idx = 0;
+
+       return frame;
+}
+
+
+static pui_bool
+_ani_backend_pairing_frame_cb(void *data, int serial)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_ani_t *ani = (pui_ani_t *)data;
+       pui_backend_ani_data *ani_data = NULL;
+       pui_ani_control_buffer *buffer = NULL;
+       default_frame_info_t *frame;
+       unsigned int r = 0x0, g = 0x0, b = 0x0;
+       double now;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       now = ecore_time_unix_get();
+       pui_info("[time:%.3f] serial=%d\n", now, serial);
+
+       /* TODO : make use of ani_info */
+       //(void) ani_info;
+
+       buffer = pui_backend_ani_get_buffer(ani);
+       if (!buffer) {
+               pui_err("Failed to get buffer for animation\n");
+               return (pui_bool)0;
+       }
+
+       frame = _ani_backend_pairing_get_frame(ani_info);
+       for(int i = 0; i<12; i++)
+       {
+               _ani_backend_pairing_get_led_rgb(frame, i, &r, &g, &b);
+               buffer->ptr[4*i] = 0;
+               buffer->ptr[4*i + 1] = b; /* BLUE */
+               buffer->ptr[4*i + 2] = g; /* GREEN */
+               buffer->ptr[4*i + 3] = r; /* RED */
+       }
+       _ani_backend_pairing_free_frame(frame);
+
+       e = pui_backend_ani_set_buffer(ani, buffer);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       e = pui_backend_ani_update(ani);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on updating animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       pui_info("... update (serial=%d)\n", serial);
+
+       return (pui_bool)1;
+}
+
+pui_error
+_ani_pairing_start(pui_ani_t *ani, int repeat)
+{
+       pui_bool ret = 0;
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
+
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
+       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_pairing_frame_cb, info->interval / 1000.0);
+
+       if (!ret)
+       {
+               pui_err("Failed to add frame callback !\n");
+               e = PUI_INT_ERROR_INVALID_RESOURCES;
+       }
+
+       return e;
+}
+
+pui_error
+_ani_pairing_stop(pui_ani_t *ani)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s\n", info->id);
+
+       pui_backend_ani_remove_frame_cb(ani);
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       return e;
+}
+
+
+void
+pui_default_backend_ani_pairing_func_set(pui_backend_ani_func *func)
+{
+       if (!func) return;
+
+       func->ani_start = _ani_pairing_start;
+       func->ani_stop = _ani_pairing_stop;
+}
+
+
diff --git a/backends/default_ani_alarm.c b/backends/default_ani_alarm.c
deleted file mode 100644 (file)
index 52c6594..0000000
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "default_backend.h"
-
-static void
-_ani_backend_alarm_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
-{
-       if (!frame) return;
-       if (!r || !g || !b) return;
-       if (led_idx > frame->num_led) return;
-
-       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
-       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
-       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
-}
-
-static void
-_ani_backend_alarm_free_frame(default_frame_info_t *frame)
-{
-       if (!frame) return;
-
-       if (frame->leds) free(frame->leds);
-       free(frame);
-}
-
-static default_frame_info_t *
-_ani_backend_alarm_get_frame(default_ani_info *ani_info)
-{
-#define SMOOTH_FRAME 75
-#define ALARM_REPEAT 3
-#define ALARM_FRAME 10
-       default_frame_info_t *frame, *key_frame;
-       int idx;
-       unsigned int r, g, b, r2, g2, b2;
-       int r3, g3, b3;
-       double div;
-       int fade_out_frame;
-
-       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
-       if (!frame) return NULL;
-
-       idx = ((int)(ani_info->frame_idx / ALARM_FRAME)) % ani_info->num_key_frames;
-       key_frame = &ani_info->frames[idx];
-
-       frame->num_led = key_frame->num_led;
-       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
-       if (!frame->leds)
-       {
-               free(frame);
-               return NULL;
-       }
-
-       /* FIXME: calculate this data before animation start. this is not changed value */
-       fade_out_frame = (ALARM_FRAME) * ani_info->num_key_frames * (ALARM_REPEAT);
-
-       if (ani_info->frame_idx < fade_out_frame)
-       {
-               for (int i = 0; i < key_frame->num_led; i++)
-               {
-                       frame->leds[i].color = key_frame->leds[i].color;
-               }
-       }
-       else
-       {
-               key_frame = &ani_info->frames[0];
-               r2 = g2 = b2 = 0x00;
-               for (int i = 0; i < key_frame->num_led; i++)
-               {
-                       div = (double)(ani_info->frame_idx - fade_out_frame) / (double)SMOOTH_FRAME;
-                       _ani_backend_alarm_get_led_rgb(key_frame, i, &r, &g, &b);
-                       r3 = (int)(r2 - r) * div + r;
-                       g3 = (int)(g2 - g) * div + g;
-                       b3 = (int)(b2 - b) * div + b;
-
-                       frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
-               }
-       }
-
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= (fade_out_frame + SMOOTH_FRAME))
-               ani_info->frame_idx = 0;
-
-       return frame;
-}
-
-static pui_bool
-_ani_backend_alarm_frame_cb(void *data, int serial)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_ani_t *ani = (pui_ani_t *)data;
-       pui_backend_ani_data *ani_data = NULL;
-       pui_ani_control_buffer *buffer = NULL;
-       default_frame_info_t *frame;
-       unsigned int r = 0x0, g = 0x0, b = 0x0;
-       double now;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       now = ecore_time_unix_get();
-       pui_info("[time:%.3f] serial=%d\n", now, serial);
-
-       /* TODO : make use of ani_info */
-       //(void) ani_info;
-
-       buffer = pui_backend_ani_get_buffer(ani);
-       if (!buffer) {
-               pui_err("Failed to get buffer for animation\n");
-               return (pui_bool)0;
-       }
-
-       frame = _ani_backend_alarm_get_frame(ani_info);
-       for(int i = 0; i<12; i++)
-       {
-               _ani_backend_alarm_get_led_rgb(frame, i, &r, &g, &b);
-               buffer->ptr[4*i] = 0;
-               buffer->ptr[4*i + 1] = b; /* BLUE */
-               buffer->ptr[4*i + 2] = g; /* GREEN */
-               buffer->ptr[4*i + 3] = r; /* RED */
-       }
-       _ani_backend_alarm_free_frame(frame);
-
-       e = pui_backend_ani_set_buffer(ani, buffer);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       e = pui_backend_ani_update(ani);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on updating animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       pui_info("... update (serial=%d)\n", serial);
-
-       return (pui_bool)1;
-}
-
-pui_error
-_ani_alarm_start(pui_ani_t *ani, int repeat)
-{
-       pui_bool ret = 0;
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
-
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
-       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_alarm_frame_cb, info->interval / 1000.0);
-
-       if (!ret)
-       {
-               pui_err("Failed to add frame callback !\n");
-               e = PUI_INT_ERROR_INVALID_RESOURCES;
-       }
-
-       return e;
-}
-
-pui_error
-_ani_alarm_stop(pui_ani_t *ani)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s\n", info->id);
-
-       pui_backend_ani_remove_frame_cb(ani);
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       return e;
-}
-
-
-void
-pui_default_backend_ani_alarm_func_set(pui_backend_ani_func *func)
-{
-       if (!func) return;
-
-       func->ani_start = _ani_alarm_start;
-       func->ani_stop = _ani_alarm_stop;
-}
-
-
diff --git a/backends/default_ani_connected.c b/backends/default_ani_connected.c
deleted file mode 100644 (file)
index fcba3ad..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "default_backend.h"
-
-static void
-_ani_backend_connected_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
-{
-       if (!frame) return;
-       if (!r || !g || !b) return;
-       if (led_idx > frame->num_led) return;
-
-       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
-       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
-       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
-}
-
-static void
-_ani_backend_connected_free_frame(default_frame_info_t *frame)
-{
-       if (!frame) return;
-
-       if (frame->leds) free(frame->leds);
-       free(frame);
-}
-
-static default_frame_info_t *
-_ani_backend_connected_get_frame(default_ani_info *ani_info)
-{
-#define BLINK_FRAME 2
-       default_frame_info_t *frame, *key_frame;
-
-       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
-       if (!frame) return NULL;
-
-       key_frame = &ani_info->frames[0];
-       frame->num_led = key_frame->num_led;
-       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
-       if (!frame->leds)
-       {
-               free(frame);
-               return NULL;
-       }
-
-       if (ani_info->frame_idx % BLINK_FRAME == 0)
-       {
-               for (int i = 0; i < key_frame->num_led; i++)
-               {
-                       frame->leds[i].color = key_frame->leds[i].color;
-               }
-       }
-       else
-       {
-               for (int i = 0; i < key_frame->num_led; i++)
-               {
-                       frame->leds[i].color = 0x000000;
-               }
-       }
-
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= BLINK_FRAME)
-               ani_info->frame_idx = 0;
-
-       return frame;
-}
-
-
-static pui_bool
-_ani_backend_connected_frame_cb(void *data, int serial)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_ani_t *ani = (pui_ani_t *)data;
-       pui_backend_ani_data *ani_data = NULL;
-       pui_ani_control_buffer *buffer = NULL;
-       default_frame_info_t *frame;
-       unsigned int r = 0x0, g = 0x0, b = 0x0;
-       double now;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       now = ecore_time_unix_get();
-       pui_info("[time:%.3f] serial=%d\n", now, serial);
-
-       /* TODO : make use of ani_info */
-       //(void) ani_info;
-
-       buffer = pui_backend_ani_get_buffer(ani);
-       if (!buffer) {
-               pui_err("Failed to get buffer for animation\n");
-               return (pui_bool)0;
-       }
-
-       frame = _ani_backend_connected_get_frame(ani_info);
-       for(int i = 0; i<12; i++)
-       {
-               _ani_backend_connected_get_led_rgb(frame, i, &r, &g, &b);
-               buffer->ptr[4*i] = 0;
-               buffer->ptr[4*i + 1] = b; /* BLUE */
-               buffer->ptr[4*i + 2] = g; /* GREEN */
-               buffer->ptr[4*i + 3] = r; /* RED */
-       }
-       _ani_backend_connected_free_frame(frame);
-
-       e = pui_backend_ani_set_buffer(ani, buffer);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       e = pui_backend_ani_update(ani);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on updating animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       pui_info("... update (serial=%d)\n", serial);
-
-       return (pui_bool)1;
-}
-
-pui_error
-_ani_connected_start(pui_ani_t *ani, int repeat)
-{
-       pui_bool ret = 0;
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
-
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
-       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_connected_frame_cb, info->interval / 1000.0);
-
-       if (!ret)
-       {
-               pui_err("Failed to add frame callback !\n");
-               e = PUI_INT_ERROR_INVALID_RESOURCES;
-       }
-
-       return e;
-}
-
-pui_error
-_ani_connected_stop(pui_ani_t *ani)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s\n", info->id);
-
-       pui_backend_ani_remove_frame_cb(ani);
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       return e;
-}
-
-
-void
-pui_default_backend_ani_connected_func_set(pui_backend_ani_func *func)
-{
-       if (!func) return;
-
-       func->ani_start = _ani_connected_start;
-       func->ani_stop = _ani_connected_stop;
-}
-
-
diff --git a/backends/default_ani_easysetup.c b/backends/default_ani_easysetup.c
deleted file mode 100644 (file)
index c54ae49..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "default_backend.h"
-
-static void
-_ani_backend_easysetup_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
-{
-       if (!frame) return;
-       if (!r || !g || !b) return;
-       if (led_idx > frame->num_led) return;
-
-       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
-       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
-       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
-}
-
-static void
-_ani_backend_easysetup_free_frame(default_frame_info_t *frame)
-{
-       if (!frame) return;
-
-       if (frame->leds) free(frame->leds);
-       free(frame);
-}
-
-static default_frame_info_t *
-_ani_backend_easysetup_get_frame(default_ani_info *ani_info)
-{
-#define SMOOTH_FRAME 20
-       default_frame_info_t *frame, *key_frame, *key_frame2;
-       int idx, idx2;
-       unsigned int r, g, b, r2, g2, b2;
-       int r3, g3, b3;
-       double div;
-
-       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
-       if (!frame) return NULL;
-
-       idx = ((int)(ani_info->frame_idx / SMOOTH_FRAME)) % ani_info->num_key_frames;
-       idx2 = (idx + 1) % ani_info->num_key_frames;
-
-       key_frame = &ani_info->frames[idx];
-       key_frame2 = &ani_info->frames[idx2];
-       frame->num_led = key_frame->num_led;
-       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
-       if (!frame->leds)
-       {
-               free(frame);
-               return NULL;
-       }
-       div = (double)(ani_info->frame_idx % SMOOTH_FRAME) / (double)SMOOTH_FRAME;
-       r = g = b = r2 = g2 = b2 = 0x0;
-       for (int i = 0; i < key_frame->num_led; i++)
-       {
-               _ani_backend_easysetup_get_led_rgb(key_frame, i, &r, &g, &b);
-               _ani_backend_easysetup_get_led_rgb(key_frame2, i, &r2, &g2, &b2);
-               r3 = (int)(r2 - r) * div + r;
-               g3 = (int)(g2 - g) * div + g;
-               b3 = (int)(b2 - b) * div + b;
-
-               frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
-       }
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= (ani_info->num_key_frames * SMOOTH_FRAME))
-               ani_info->frame_idx = 0;
-
-       return frame;
-}
-
-static pui_bool
-_ani_backend_easysetup_frame_cb(void *data, int serial)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_ani_t *ani = (pui_ani_t *)data;
-       pui_backend_ani_data *ani_data = NULL;
-       pui_ani_control_buffer *buffer = NULL;
-       default_frame_info_t *frame;
-       unsigned int r = 0x0, g = 0x0, b = 0x0;
-       double now;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       now = ecore_time_unix_get();
-       pui_info("[time:%.3f] serial=%d\n", now, serial);
-
-       /* TODO : make use of ani_info */
-       //(void) ani_info;
-
-       buffer = pui_backend_ani_get_buffer(ani);
-       if (!buffer) {
-               pui_err("Failed to get buffer for animation\n");
-               return (pui_bool)0;
-       }
-
-       frame = _ani_backend_easysetup_get_frame(ani_info);
-       for(int i = 0; i<12; i++)
-       {
-               _ani_backend_easysetup_get_led_rgb(frame, i, &r, &g, &b);
-               buffer->ptr[4*i] = 0;
-               buffer->ptr[4*i + 1] = b; /* BLUE */
-               buffer->ptr[4*i + 2] = g; /* GREEN */
-               buffer->ptr[4*i + 3] = r; /* RED */
-       }
-       _ani_backend_easysetup_free_frame(frame);
-
-       e = pui_backend_ani_set_buffer(ani, buffer);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       e = pui_backend_ani_update(ani);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on updating animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       pui_info("... update (serial=%d)\n", serial);
-
-       return (pui_bool)1;
-}
-
-pui_error
-_ani_easysetup_start(pui_ani_t *ani, int repeat)
-{
-       pui_bool ret = 0;
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
-
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
-       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_easysetup_frame_cb, info->interval / 1000.0);
-
-       if (!ret)
-       {
-               pui_err("Failed to add frame callback !\n");
-               e = PUI_INT_ERROR_INVALID_RESOURCES;
-       }
-
-       return e;
-}
-
-pui_error
-_ani_easysetup_stop(pui_ani_t *ani)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s\n", info->id);
-
-       pui_backend_ani_remove_frame_cb(ani);
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       return e;
-}
-
-
-void
-pui_default_backend_ani_easysetup_func_set(pui_backend_ani_func *func)
-{
-       if (!func) return;
-
-       func->ani_start = _ani_easysetup_start;
-       func->ani_stop = _ani_easysetup_stop;
-}
diff --git a/backends/default_ani_emergency.c b/backends/default_ani_emergency.c
deleted file mode 100644 (file)
index 67c09a2..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "default_backend.h"
-
-static void
-_ani_backend_emergency_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
-{
-       if (!frame) return;
-       if (!r || !g || !b) return;
-       if (led_idx > frame->num_led) return;
-
-       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
-       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
-       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
-}
-
-static void
-_ani_backend_emergency_free_frame(default_frame_info_t *frame)
-{
-       if (!frame) return;
-
-       if (frame->leds) free(frame->leds);
-       free(frame);
-}
-
-static default_frame_info_t *
-_ani_backend_emergency_get_frame(default_ani_info *ani_info)
-{
-#define SMOOTH_FRAME 15
-       default_frame_info_t *frame, *key_frame, *key_frame2;
-       int idx, idx2;
-       unsigned int r, g, b, r2, g2, b2;
-       int r3, g3, b3;
-       double div;
-
-       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
-       if (!frame) return NULL;
-
-       idx = ((int)(ani_info->frame_idx / SMOOTH_FRAME)) % ani_info->num_key_frames;
-       idx2 = (idx + 1) % ani_info->num_key_frames;
-
-       key_frame = &ani_info->frames[idx];
-       key_frame2 = &ani_info->frames[idx2];
-       frame->num_led = key_frame->num_led;
-       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
-       if (!frame->leds)
-       {
-               free(frame);
-               return NULL;
-       }
-       div = (double)(ani_info->frame_idx % SMOOTH_FRAME) / (double)SMOOTH_FRAME;
-       r = g = b = r2 = g2 = b2 = 0x0;
-       for (int i = 0; i < key_frame->num_led; i++)
-       {
-               _ani_backend_emergency_get_led_rgb(key_frame, i, &r, &g, &b);
-               _ani_backend_emergency_get_led_rgb(key_frame2, i, &r2, &g2, &b2);
-               r3 = (int)(r2 - r) * div + r;
-               g3 = (int)(g2 - g) * div + g;
-               b3 = (int)(b2 - b) * div + b;
-
-               frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
-       }
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= (ani_info->num_key_frames * SMOOTH_FRAME))
-               ani_info->frame_idx = 0;
-
-       return frame;
-}
-
-
-static pui_bool
-_ani_backend_emergency_frame_cb(void *data, int serial)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_ani_t *ani = (pui_ani_t *)data;
-       pui_backend_ani_data *ani_data = NULL;
-       pui_ani_control_buffer *buffer = NULL;
-       default_frame_info_t *frame;
-       unsigned int r = 0x0, g = 0x0, b = 0x0;
-       double now;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       now = ecore_time_unix_get();
-       pui_info("[time:%.3f] serial=%d\n", now, serial);
-
-       /* TODO : make use of ani_info */
-       //(void) ani_info;
-
-       buffer = pui_backend_ani_get_buffer(ani);
-       if (!buffer) {
-               pui_err("Failed to get buffer for animation\n");
-               return (pui_bool)0;
-       }
-
-       frame = _ani_backend_emergency_get_frame(ani_info);
-       for(int i = 0; i<12; i++)
-       {
-               _ani_backend_emergency_get_led_rgb(frame, i, &r, &g, &b);
-               buffer->ptr[4*i] = 0;
-               buffer->ptr[4*i + 1] = b; /* BLUE */
-               buffer->ptr[4*i + 2] = g; /* GREEN */
-               buffer->ptr[4*i + 3] = r; /* RED */
-       }
-       _ani_backend_emergency_free_frame(frame);
-
-       e = pui_backend_ani_set_buffer(ani, buffer);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       e = pui_backend_ani_update(ani);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on updating animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       pui_info("... update (serial=%d)\n", serial);
-
-       return (pui_bool)1;
-}
-
-pui_error
-_ani_emergency_start(pui_ani_t *ani, int repeat)
-{
-       pui_bool ret = 0;
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
-
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
-       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_emergency_frame_cb, info->interval / 1000.0);
-
-       if (!ret)
-       {
-               pui_err("Failed to add frame callback !\n");
-               e = PUI_INT_ERROR_INVALID_RESOURCES;
-       }
-
-       return e;
-}
-
-pui_error
-_ani_emergency_stop(pui_ani_t *ani)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s\n", info->id);
-
-       pui_backend_ani_remove_frame_cb(ani);
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       return e;
-}
-
-
-void
-pui_default_backend_ani_emergency_func_set(pui_backend_ani_func *func)
-{
-       if (!func) return;
-
-       func->ani_start = _ani_emergency_start;
-       func->ani_stop = _ani_emergency_stop;
-}
-
-
diff --git a/backends/default_ani_error.c b/backends/default_ani_error.c
deleted file mode 100644 (file)
index 355d30e..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "default_backend.h"
-
-static void
-_ani_backend_error_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
-{
-       if (!frame) return;
-       if (!r || !g || !b) return;
-       if (led_idx > frame->num_led) return;
-
-       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
-       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
-       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
-}
-
-static void
-_ani_backend_error_free_frame(default_frame_info_t *frame)
-{
-       if (!frame) return;
-
-       if (frame->leds) free(frame->leds);
-       free(frame);
-}
-
-static default_frame_info_t *
-_ani_backend_error_get_frame(default_ani_info *ani_info)
-{
-#define BLINK_FRAME 2
-       default_frame_info_t *frame, *key_frame;
-
-       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
-       if (!frame) return NULL;
-
-       key_frame = &ani_info->frames[0];
-       frame->num_led = key_frame->num_led;
-       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
-       if (!frame->leds)
-       {
-               free(frame);
-               return NULL;
-       }
-
-       if (ani_info->frame_idx % BLINK_FRAME == 0)
-       {
-               for (int i = 0; i < key_frame->num_led; i++)
-               {
-                       frame->leds[i].color = key_frame->leds[i].color;
-               }
-       }
-       else
-       {
-               for (int i = 0; i < key_frame->num_led; i++)
-               {
-                       frame->leds[i].color = 0x000000;
-               }
-       }
-
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= BLINK_FRAME)
-               ani_info->frame_idx = 0;
-
-       return frame;
-}
-
-
-static pui_bool
-_ani_backend_error_frame_cb(void *data, int serial)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_ani_t *ani = (pui_ani_t *)data;
-       pui_backend_ani_data *ani_data = NULL;
-       pui_ani_control_buffer *buffer = NULL;
-       default_frame_info_t *frame;
-       unsigned int r = 0x0, g = 0x0, b = 0x0;
-       double now;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       now = ecore_time_unix_get();
-       pui_info("[time:%.3f] serial=%d\n", now, serial);
-
-       /* TODO : make use of ani_info */
-       //(void) ani_info;
-
-       buffer = pui_backend_ani_get_buffer(ani);
-       if (!buffer) {
-               pui_err("Failed to get buffer for animation\n");
-               return (pui_bool)0;
-       }
-
-       frame = _ani_backend_error_get_frame(ani_info);
-       for(int i = 0; i<12; i++)
-       {
-               _ani_backend_error_get_led_rgb(frame, i, &r, &g, &b);
-               buffer->ptr[4*i] = 0;
-               buffer->ptr[4*i + 1] = b; /* BLUE */
-               buffer->ptr[4*i + 2] = g; /* GREEN */
-               buffer->ptr[4*i + 3] = r; /* RED */
-       }
-       _ani_backend_error_free_frame(frame);
-
-       e = pui_backend_ani_set_buffer(ani, buffer);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       e = pui_backend_ani_update(ani);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on updating animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       pui_info("... update (serial=%d)\n", serial);
-
-       return (pui_bool)1;
-}
-
-pui_error
-_ani_error_start(pui_ani_t *ani, int repeat)
-{
-       pui_bool ret = 0;
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
-
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
-       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_error_frame_cb, info->interval / 1000.0);
-
-       if (!ret)
-       {
-               pui_err("Failed to add frame callback !\n");
-               e = PUI_INT_ERROR_INVALID_RESOURCES;
-       }
-
-       return e;
-}
-
-pui_error
-_ani_error_stop(pui_ani_t *ani)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s\n", info->id);
-
-       pui_backend_ani_remove_frame_cb(ani);
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       return e;
-}
-
-
-void
-pui_default_backend_ani_error_func_set(pui_backend_ani_func *func)
-{
-       if (!func) return;
-
-       func->ani_start = _ani_error_start;
-       func->ani_stop = _ani_error_stop;
-}
-
-
diff --git a/backends/default_ani_listening.c b/backends/default_ani_listening.c
deleted file mode 100644 (file)
index 8a83894..0000000
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "default_backend.h"
-
-static void
-_ani_backend_listening_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
-{
-       if (!frame) return;
-       if (!r || !g || !b) return;
-       if (led_idx > frame->num_led) return;
-
-       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
-       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
-       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
-}
-
-static void
-_ani_backend_listening_free_frame(default_frame_info_t *frame)
-{
-       if (!frame) return;
-
-       if (frame->leds) free(frame->leds);
-       free(frame);
-}
-
-static default_frame_info_t *
-_ani_backend_listening_get_frame(default_ani_info *ani_info)
-{
-       default_frame_info_t *frame, *key_frame;
-       int division;
-
-       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
-       if (!frame) return NULL;
-
-       key_frame = &ani_info->frames[0];
-       frame->num_led = key_frame->num_led;
-       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
-       if (!frame->leds)
-       {
-               free(frame);
-               return NULL;
-       }
-       division = (int)(frame->num_led / 2);
-       for (int i = 0; i < key_frame->num_led; i++)
-       {
-               int idx;
-               //int idx = (i - ani_info->frame_idx + key_frame->num_led) % key_frame->num_led;
-               if ((ani_info->frame_idx / division) <= 0)
-               {
-                       if (i < division)
-                       {
-                               idx = i - ani_info->frame_idx;
-                               if (idx < 0) continue;
-                       }
-                       else
-                       {
-                               idx = i + ani_info->frame_idx;
-                               if (idx >= key_frame->num_led) continue;
-                       }
-               }
-               else
-               {
-                       if (i < division)
-                       {
-                               idx = i - division + 1 + ani_info->frame_idx - division;
-                               if (idx < 0) continue;
-                       }
-                       else
-                       {
-                               idx = i + division - 1 - ani_info->frame_idx + division;
-                               if (idx >= key_frame->num_led) continue;
-                       }
-               }
-               frame->leds[idx] = key_frame->leds[i];
-       }
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= key_frame->num_led)
-               ani_info->frame_idx = 0;
-
-       return frame;
-}
-
-static pui_bool
-_ani_backend_listening_frame_cb(void *data, int serial)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_ani_t *ani = (pui_ani_t *)data;
-       pui_backend_ani_data *ani_data = NULL;
-       pui_ani_control_buffer *buffer = NULL;
-       default_frame_info_t *frame;
-       unsigned int r = 0x0, g = 0x0, b = 0x0;
-       double now;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       now = ecore_time_unix_get();
-       pui_info("[time:%.3f] serial=%d\n", now, serial);
-
-       /* TODO : make use of ani_info */
-       //(void) ani_info;
-
-       buffer = pui_backend_ani_get_buffer(ani);
-       if (!buffer) {
-               pui_err("Failed to get buffer for animation\n");
-               return (pui_bool)0;
-       }
-
-       frame = _ani_backend_listening_get_frame(ani_info);
-       for(int i = 0; i<12; i++)
-       {
-               _ani_backend_listening_get_led_rgb(frame, i, &r, &g, &b);
-               buffer->ptr[4*i] = 0;
-               buffer->ptr[4*i + 1] = b; /* BLUE */
-               buffer->ptr[4*i + 2] = g; /* GREEN */
-               buffer->ptr[4*i + 3] = r; /* RED */
-       }
-       _ani_backend_listening_free_frame(frame);
-
-       e = pui_backend_ani_set_buffer(ani, buffer);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       e = pui_backend_ani_update(ani);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on updating animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       pui_info("... update (serial=%d)\n", serial);
-
-       return (pui_bool)1;
-}
-
-pui_error
-_ani_listening_start(pui_ani_t *ani, int repeat)
-{
-       pui_bool ret = 0;
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
-
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
-       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_listening_frame_cb, info->interval / 1000.0);
-
-       if (!ret)
-       {
-               pui_err("Failed to add frame callback !\n");
-               e = PUI_INT_ERROR_INVALID_RESOURCES;
-       }
-
-       return e;
-}
-
-pui_error
-_ani_listening_stop(pui_ani_t *ani)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s\n", info->id);
-
-       pui_backend_ani_remove_frame_cb(ani);
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       return e;
-}
-
-
-void
-pui_default_backend_ani_listening_func_set(pui_backend_ani_func *func)
-{
-       if (!func) return;
-
-       func->ani_start = _ani_listening_start;
-       func->ani_stop = _ani_listening_stop;
-}
-
-
diff --git a/backends/default_ani_micoff.c b/backends/default_ani_micoff.c
deleted file mode 100644 (file)
index 0043b4a..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "default_backend.h"
-
-static void
-_ani_backend_micoff_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
-{
-       if (!frame) return;
-       if (!r || !g || !b) return;
-       if (led_idx > frame->num_led) return;
-
-       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
-       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
-       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
-}
-
-static void
-_ani_backend_micoff_free_frame(default_frame_info_t *frame)
-{
-       if (!frame) return;
-
-       if (frame->leds) free(frame->leds);
-       free(frame);
-}
-
-static default_frame_info_t *
-_ani_backend_micoff_get_frame(default_ani_info *ani_info)
-{
-#define SMOOTH_FRAME 15
-       default_frame_info_t *frame, *key_frame;
-
-       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
-       if (!frame) return NULL;
-
-       key_frame = &ani_info->frames[0];
-       frame->num_led = key_frame->num_led;
-       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
-       if (!frame->leds)
-       {
-               free(frame);
-               return NULL;
-       }
-
-       for (int i = 0; i < key_frame->num_led; i++)
-       {
-               frame->leds[i].color = key_frame->leds[i].color;
-       }
-
-       return frame;
-}
-
-
-static pui_bool
-_ani_backend_micoff_frame_cb(void *data, int serial)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_ani_t *ani = (pui_ani_t *)data;
-       pui_backend_ani_data *ani_data = NULL;
-       pui_ani_control_buffer *buffer = NULL;
-       default_frame_info_t *frame;
-       unsigned int r = 0x0, g = 0x0, b = 0x0;
-       double now;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       now = ecore_time_unix_get();
-       pui_info("[time:%.3f] serial=%d\n", now, serial);
-
-       /* TODO : make use of ani_info */
-       //(void) ani_info;
-
-       buffer = pui_backend_ani_get_buffer(ani);
-       if (!buffer) {
-               pui_err("Failed to get buffer for animation\n");
-               return (pui_bool)0;
-       }
-
-       frame = _ani_backend_micoff_get_frame(ani_info);
-       for(int i = 0; i<12; i++)
-       {
-               _ani_backend_micoff_get_led_rgb(frame, i, &r, &g, &b);
-               buffer->ptr[4*i] = 0;
-               buffer->ptr[4*i + 1] = b; /* BLUE */
-               buffer->ptr[4*i + 2] = g; /* GREEN */
-               buffer->ptr[4*i + 3] = r; /* RED */
-       }
-       _ani_backend_micoff_free_frame(frame);
-
-       e = pui_backend_ani_set_buffer(ani, buffer);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       e = pui_backend_ani_update(ani);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on updating animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       pui_info("... update (serial=%d)\n", serial);
-
-       return (pui_bool)1;
-}
-
-pui_error
-_ani_micoff_start(pui_ani_t *ani, int repeat)
-{
-       pui_bool ret = 0;
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
-
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
-       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_micoff_frame_cb, info->interval / 1000.0);
-
-       if (!ret)
-       {
-               pui_err("Failed to add frame callback !\n");
-               e = PUI_INT_ERROR_INVALID_RESOURCES;
-       }
-
-       return e;
-}
-
-pui_error
-_ani_micoff_stop(pui_ani_t *ani)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s\n", info->id);
-
-       pui_backend_ani_remove_frame_cb(ani);
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       return e;
-}
-
-
-void
-pui_default_backend_ani_micoff_func_set(pui_backend_ani_func *func)
-{
-       if (!func) return;
-
-       func->ani_start = _ani_micoff_start;
-       func->ani_stop = _ani_micoff_stop;
-}
-
-
diff --git a/backends/default_ani_networkerror.c b/backends/default_ani_networkerror.c
deleted file mode 100644 (file)
index 95a08bc..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "default_backend.h"
-
-static void
-_ani_backend_networkerror_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
-{
-       if (!frame) return;
-       if (!r || !g || !b) return;
-       if (led_idx > frame->num_led) return;
-
-       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
-       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
-       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
-}
-
-static void
-_ani_backend_networkerror_free_frame(default_frame_info_t *frame)
-{
-       if (!frame) return;
-
-       if (frame->leds) free(frame->leds);
-       free(frame);
-}
-
-static default_frame_info_t *
-_ani_backend_networkerror_get_frame(default_ani_info *ani_info)
-{
-#define BLINK_FRAME 40
-       default_frame_info_t *frame, *key_frame;
-
-       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
-       if (!frame) return NULL;
-
-       key_frame = &ani_info->frames[0];
-       frame->num_led = key_frame->num_led;
-       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
-       if (!frame->leds)
-       {
-               free(frame);
-               return NULL;
-       }
-
-       if (ani_info->frame_idx % BLINK_FRAME == 0)
-       {
-               for (int i = 0; i < key_frame->num_led; i++)
-               {
-                       frame->leds[i].color = key_frame->leds[i].color;
-               }
-       }
-       else
-       {
-               for (int i = 0; i < key_frame->num_led; i++)
-               {
-                       frame->leds[i].color = 0x000000;
-               }
-       }
-
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= BLINK_FRAME)
-               ani_info->frame_idx = 0;
-
-       return frame;
-}
-
-
-static pui_bool
-_ani_backend_networkerror_frame_cb(void *data, int serial)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_ani_t *ani = (pui_ani_t *)data;
-       pui_backend_ani_data *ani_data = NULL;
-       pui_ani_control_buffer *buffer = NULL;
-       default_frame_info_t *frame;
-       unsigned int r = 0x0, g = 0x0, b = 0x0;
-       double now;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       now = ecore_time_unix_get();
-       pui_info("[time:%.3f] serial=%d\n", now, serial);
-
-       /* TODO : make use of ani_info */
-       //(void) ani_info;
-
-       buffer = pui_backend_ani_get_buffer(ani);
-       if (!buffer) {
-               pui_err("Failed to get buffer for animation\n");
-               return (pui_bool)0;
-       }
-
-       frame = _ani_backend_networkerror_get_frame(ani_info);
-       for(int i = 0; i<12; i++)
-       {
-               _ani_backend_networkerror_get_led_rgb(frame, i, &r, &g, &b);
-               buffer->ptr[4*i] = 0;
-               buffer->ptr[4*i + 1] = b; /* BLUE */
-               buffer->ptr[4*i + 2] = g; /* GREEN */
-               buffer->ptr[4*i + 3] = r; /* RED */
-       }
-       _ani_backend_networkerror_free_frame(frame);
-
-       e = pui_backend_ani_set_buffer(ani, buffer);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       e = pui_backend_ani_update(ani);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on updating animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       pui_info("... update (serial=%d)\n", serial);
-
-       return (pui_bool)1;
-}
-
-pui_error
-_ani_networkerror_start(pui_ani_t *ani, int repeat)
-{
-       pui_bool ret = 0;
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
-
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
-       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_networkerror_frame_cb, info->interval / 1000.0);
-
-       if (!ret)
-       {
-               pui_err("Failed to add frame callback !\n");
-               e = PUI_INT_ERROR_INVALID_RESOURCES;
-       }
-
-       return e;
-}
-
-pui_error
-_ani_networkerror_stop(pui_ani_t *ani)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s\n", info->id);
-
-       pui_backend_ani_remove_frame_cb(ani);
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       return e;
-}
-
-
-void
-pui_default_backend_ani_networkerror_func_set(pui_backend_ani_func *func)
-{
-       if (!func) return;
-
-       func->ani_start = _ani_networkerror_start;
-       func->ani_stop = _ani_networkerror_stop;
-}
-
-
diff --git a/backends/default_ani_normal.c b/backends/default_ani_normal.c
deleted file mode 100644 (file)
index bc35973..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "default_backend.h"
-
-static void
-_ani_backend_normal_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
-{
-       if (!frame) return;
-       if (!r || !g || !b) return;
-       if (led_idx > frame->num_led) return;
-
-       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
-       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
-       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
-}
-
-static void
-_ani_backend_normal_free_frame(default_frame_info_t *frame)
-{
-       if (!frame) return;
-
-       if (frame->leds) free(frame->leds);
-       free(frame);
-}
-
-static default_frame_info_t *
-_ani_backend_normal_get_frame(default_ani_info *ani_info)
-{
-#define SMOOTH_FRAME 15
-       default_frame_info_t *frame, *key_frame, *key_frame2;
-       int idx, idx2;
-       unsigned int r, g, b, r2, g2, b2;
-       int r3, g3, b3;
-       double div;
-
-       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
-       if (!frame) return NULL;
-
-       idx = ((int)(ani_info->frame_idx / SMOOTH_FRAME)) % ani_info->num_key_frames;
-       idx2 = (idx + 1) % ani_info->num_key_frames;
-
-       key_frame = &ani_info->frames[idx];
-       key_frame2 = &ani_info->frames[idx2];
-       frame->num_led = key_frame->num_led;
-       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
-       if (!frame->leds)
-       {
-               free(frame);
-               return NULL;
-       }
-       div = (double)(ani_info->frame_idx % SMOOTH_FRAME) / (double)SMOOTH_FRAME;
-       r = g = b = r2 = g2 = b2 = 0x0;
-       for (int i = 0; i < key_frame->num_led; i++)
-       {
-               _ani_backend_normal_get_led_rgb(key_frame, i, &r, &g, &b);
-               _ani_backend_normal_get_led_rgb(key_frame2, i, &r2, &g2, &b2);
-               r3 = (int)(r2 - r) * div + r;
-               g3 = (int)(g2 - g) * div + g;
-               b3 = (int)(b2 - b) * div + b;
-
-               frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
-       }
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= (ani_info->num_key_frames * SMOOTH_FRAME))
-               ani_info->frame_idx = 0;
-
-       return frame;
-}
-
-
-static pui_bool
-_ani_backend_normal_frame_cb(void *data, int serial)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_ani_t *ani = (pui_ani_t *)data;
-       pui_backend_ani_data *ani_data = NULL;
-       pui_ani_control_buffer *buffer = NULL;
-       default_frame_info_t *frame;
-       unsigned int r = 0x0, g = 0x0, b = 0x0;
-       double now;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       now = ecore_time_unix_get();
-       pui_info("[time:%.3f] serial=%d\n", now, serial);
-
-       /* TODO : make use of ani_info */
-       //(void) ani_info;
-
-       buffer = pui_backend_ani_get_buffer(ani);
-       if (!buffer) {
-               pui_err("Failed to get buffer for animation\n");
-               return (pui_bool)0;
-       }
-
-       frame = _ani_backend_normal_get_frame(ani_info);
-       for(int i = 0; i<12; i++)
-       {
-               _ani_backend_normal_get_led_rgb(frame, i, &r, &g, &b);
-               buffer->ptr[4*i] = 0;
-               buffer->ptr[4*i + 1] = b; /* BLUE */
-               buffer->ptr[4*i + 2] = g; /* GREEN */
-               buffer->ptr[4*i + 3] = r; /* RED */
-       }
-       _ani_backend_normal_free_frame(frame);
-
-       e = pui_backend_ani_set_buffer(ani, buffer);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       e = pui_backend_ani_update(ani);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on updating animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       pui_info("... update (serial=%d)\n", serial);
-
-       return (pui_bool)1;
-}
-
-pui_error
-_ani_normal_start(pui_ani_t *ani, int repeat)
-{
-       pui_bool ret = 0;
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
-
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
-       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_normal_frame_cb, info->interval / 1000.0);
-
-       if (!ret)
-       {
-               pui_err("Failed to add frame callback !\n");
-               e = PUI_INT_ERROR_INVALID_RESOURCES;
-       }
-
-       return e;
-}
-
-pui_error
-_ani_normal_stop(pui_ani_t *ani)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s\n", info->id);
-
-       pui_backend_ani_remove_frame_cb(ani);
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       return e;
-}
-
-
-void
-pui_default_backend_ani_normal_func_set(pui_backend_ani_func *func)
-{
-       if (!func) return;
-
-       func->ani_start = _ani_normal_start;
-       func->ani_stop = _ani_normal_stop;
-}
-
-
diff --git a/backends/default_ani_pairing.c b/backends/default_ani_pairing.c
deleted file mode 100644 (file)
index 5f4f626..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "default_backend.h"
-
-static void
-_ani_backend_pairing_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
-{
-       if (!frame) return;
-       if (!r || !g || !b) return;
-       if (led_idx > frame->num_led) return;
-
-       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
-       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
-       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
-}
-
-static void
-_ani_backend_pairing_free_frame(default_frame_info_t *frame)
-{
-       if (!frame) return;
-
-       if (frame->leds) free(frame->leds);
-       free(frame);
-}
-
-static default_frame_info_t *
-_ani_backend_pairing_get_frame(default_ani_info *ani_info)
-{
-       default_frame_info_t *frame, *key_frame;
-       int idx;
-
-       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
-       if (!frame) return NULL;
-
-       idx = ani_info->frame_idx;
-
-       key_frame = &ani_info->frames[idx];
-       frame->num_led = key_frame->num_led;
-       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
-       if (!frame->leds)
-       {
-               free(frame);
-               return NULL;
-       }
-
-       for (int i = 0; i < key_frame->num_led; i++)
-       {
-               frame->leds[i].color = key_frame->leds[i].color;
-       }
-
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= ani_info->num_key_frames)
-               ani_info->frame_idx = 0;
-
-       return frame;
-}
-
-
-static pui_bool
-_ani_backend_pairing_frame_cb(void *data, int serial)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_ani_t *ani = (pui_ani_t *)data;
-       pui_backend_ani_data *ani_data = NULL;
-       pui_ani_control_buffer *buffer = NULL;
-       default_frame_info_t *frame;
-       unsigned int r = 0x0, g = 0x0, b = 0x0;
-       double now;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       now = ecore_time_unix_get();
-       pui_info("[time:%.3f] serial=%d\n", now, serial);
-
-       /* TODO : make use of ani_info */
-       //(void) ani_info;
-
-       buffer = pui_backend_ani_get_buffer(ani);
-       if (!buffer) {
-               pui_err("Failed to get buffer for animation\n");
-               return (pui_bool)0;
-       }
-
-       frame = _ani_backend_pairing_get_frame(ani_info);
-       for(int i = 0; i<12; i++)
-       {
-               _ani_backend_pairing_get_led_rgb(frame, i, &r, &g, &b);
-               buffer->ptr[4*i] = 0;
-               buffer->ptr[4*i + 1] = b; /* BLUE */
-               buffer->ptr[4*i + 2] = g; /* GREEN */
-               buffer->ptr[4*i + 3] = r; /* RED */
-       }
-       _ani_backend_pairing_free_frame(frame);
-
-       e = pui_backend_ani_set_buffer(ani, buffer);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       e = pui_backend_ani_update(ani);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on updating animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       pui_info("... update (serial=%d)\n", serial);
-
-       return (pui_bool)1;
-}
-
-pui_error
-_ani_pairing_start(pui_ani_t *ani, int repeat)
-{
-       pui_bool ret = 0;
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
-
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
-       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_pairing_frame_cb, info->interval / 1000.0);
-
-       if (!ret)
-       {
-               pui_err("Failed to add frame callback !\n");
-               e = PUI_INT_ERROR_INVALID_RESOURCES;
-       }
-
-       return e;
-}
-
-pui_error
-_ani_pairing_stop(pui_ani_t *ani)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s\n", info->id);
-
-       pui_backend_ani_remove_frame_cb(ani);
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       return e;
-}
-
-
-void
-pui_default_backend_ani_pairing_func_set(pui_backend_ani_func *func)
-{
-       if (!func) return;
-
-       func->ani_start = _ani_pairing_start;
-       func->ani_stop = _ani_pairing_stop;
-}
-
-
diff --git a/backends/default_ani_processing.c b/backends/default_ani_processing.c
deleted file mode 100644 (file)
index 628f291..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "default_backend.h"
-
-static void
-_ani_backend_processing_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
-{
-       if (!frame) return;
-       if (!r || !g || !b) return;
-       if (led_idx > frame->num_led) return;
-
-       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
-       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
-       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
-}
-
-static void
-_ani_backend_processing_free_frame(default_frame_info_t *frame)
-{
-       if (!frame) return;
-
-       if (frame->leds) free(frame->leds);
-       free(frame);
-}
-
-static default_frame_info_t *
-_ani_backend_processing_get_frame(default_ani_info *ani_info)
-{
-       default_frame_info_t *frame, *key_frame;
-
-       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
-       if (!frame) return NULL;
-
-       key_frame = &ani_info->frames[0];
-       frame->num_led = key_frame->num_led;
-       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
-       if (!frame->leds)
-       {
-               free(frame);
-               return NULL;
-       }
-       for (int i = 0; i < key_frame->num_led; i++)
-       {
-               int idx = (i - ani_info->frame_idx + key_frame->num_led) % key_frame->num_led;
-               frame->leds[idx] = key_frame->leds[i];
-       }
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= key_frame->num_led)
-               ani_info->frame_idx = 0;
-
-       return frame;
-}
-
-static pui_bool
-_ani_backend_processing_frame_cb(void *data, int serial)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_ani_t *ani = (pui_ani_t *)data;
-       pui_backend_ani_data *ani_data = NULL;
-       pui_ani_control_buffer *buffer = NULL;
-       default_frame_info_t *frame;
-       unsigned int r = 0x0, g = 0x0, b = 0x0;
-       double now;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       now = ecore_time_unix_get();
-       pui_info("[time:%.3f] serial=%d\n", now, serial);
-
-       /* TODO : make use of ani_info */
-       //(void) ani_info;
-
-       buffer = pui_backend_ani_get_buffer(ani);
-       if (!buffer) {
-               pui_err("Failed to get buffer for animation\n");
-               return (pui_bool)0;
-       }
-
-       frame = _ani_backend_processing_get_frame(ani_info);
-       for(int i = 0; i<12; i++)
-       {
-               _ani_backend_processing_get_led_rgb(frame, i, &r, &g, &b);
-               buffer->ptr[4*i] = 0;
-               buffer->ptr[4*i + 1] = b; /* BLUE */
-               buffer->ptr[4*i + 2] = g; /* GREEN */
-               buffer->ptr[4*i + 3] = r; /* RED */
-       }
-       _ani_backend_processing_free_frame(frame);
-
-       e = pui_backend_ani_set_buffer(ani, buffer);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       e = pui_backend_ani_update(ani);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on updating animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       pui_info("... update (serial=%d)\n", serial);
-
-       return (pui_bool)1;
-}
-
-pui_error
-_ani_processing_start(pui_ani_t *ani, int repeat)
-{
-       pui_bool ret = 0;
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
-       if (info->num_key_frames != 1)
-       {
-               pui_err("invalid key frames: %d\n", info->num_key_frames);
-               return PUI_INT_ERROR_INVALID_RESOURCES;
-       }
-
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
-       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_processing_frame_cb, info->interval / 1000.0);
-
-       if (!ret)
-       {
-               pui_err("Failed to add frame callback !\n");
-               e = PUI_INT_ERROR_INVALID_RESOURCES;
-       }
-
-       return e;
-}
-
-pui_error
-_ani_processing_stop(pui_ani_t *ani)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s\n", info->id);
-
-       pui_backend_ani_remove_frame_cb(ani);
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       return e;
-}
-
-
-void
-pui_default_backend_ani_processing_func_set(pui_backend_ani_func *func)
-{
-       if (!func) return;
-
-       func->ani_start = _ani_processing_start;
-       func->ani_stop = _ani_processing_stop;
-}
-
-
diff --git a/backends/default_ani_speaking.c b/backends/default_ani_speaking.c
deleted file mode 100644 (file)
index b627450..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "default_backend.h"
-
-static void
-_ani_backend_speaking_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
-{
-       if (!frame) return;
-       if (!r || !g || !b) return;
-       if (led_idx > frame->num_led) return;
-
-       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
-       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
-       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
-}
-
-static void
-_ani_backend_speaking_free_frame(default_frame_info_t *frame)
-{
-       if (!frame) return;
-
-       if (frame->leds) free(frame->leds);
-       free(frame);
-}
-
-static default_frame_info_t *
-_ani_backend_speaking_get_frame(default_ani_info *ani_info)
-{
-#define SMOOTH_FRAME 20
-       default_frame_info_t *frame, *key_frame, *key_frame2;
-       int idx, idx2;
-       unsigned int r, g, b, r2, g2, b2;
-       int r3, g3, b3;
-       double div;
-
-       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
-       if (!frame) return NULL;
-
-       idx = ((int)(ani_info->frame_idx / SMOOTH_FRAME)) % ani_info->num_key_frames;
-       idx2 = (idx + 1) % ani_info->num_key_frames;
-
-       key_frame = &ani_info->frames[idx];
-       key_frame2 = &ani_info->frames[idx2];
-       frame->num_led = key_frame->num_led;
-       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
-       if (!frame->leds)
-       {
-               free(frame);
-               return NULL;
-       }
-       div = (double)(ani_info->frame_idx % SMOOTH_FRAME) / (double)SMOOTH_FRAME;
-       r = g = b = r2 = g2 = b2 = 0x0;
-       for (int i = 0; i < key_frame->num_led; i++)
-       {
-               _ani_backend_speaking_get_led_rgb(key_frame, i, &r, &g, &b);
-               _ani_backend_speaking_get_led_rgb(key_frame2, i, &r2, &g2, &b2);
-               r3 = (int)(r2 - r) * div + r;
-               g3 = (int)(g2 - g) * div + g;
-               b3 = (int)(b2 - b) * div + b;
-
-               frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
-       }
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= (ani_info->num_key_frames * SMOOTH_FRAME))
-               ani_info->frame_idx = 0;
-
-       return frame;
-}
-
-static pui_bool
-_ani_backend_speaking_frame_cb(void *data, int serial)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_ani_t *ani = (pui_ani_t *)data;
-       pui_backend_ani_data *ani_data = NULL;
-       pui_ani_control_buffer *buffer = NULL;
-       default_frame_info_t *frame;
-       unsigned int r = 0x0, g = 0x0, b = 0x0;
-       double now;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       now = ecore_time_unix_get();
-       pui_info("[time:%.3f] serial=%d\n", now, serial);
-
-       /* TODO : make use of ani_info */
-       //(void) ani_info;
-
-       buffer = pui_backend_ani_get_buffer(ani);
-       if (!buffer) {
-               pui_err("Failed to get buffer for animation\n");
-               return (pui_bool)0;
-       }
-
-       frame = _ani_backend_speaking_get_frame(ani_info);
-       for(int i = 0; i<12; i++)
-       {
-               _ani_backend_speaking_get_led_rgb(frame, i, &r, &g, &b);
-               buffer->ptr[4*i] = 0;
-               buffer->ptr[4*i + 1] = b; /* BLUE */
-               buffer->ptr[4*i + 2] = g; /* GREEN */
-               buffer->ptr[4*i + 3] = r; /* RED */
-       }
-       _ani_backend_speaking_free_frame(frame);
-
-       e = pui_backend_ani_set_buffer(ani, buffer);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       e = pui_backend_ani_update(ani);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on updating animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       pui_info("... update (serial=%d)\n", serial);
-
-       return (pui_bool)1;
-}
-
-pui_error
-_ani_speaking_start(pui_ani_t *ani, int repeat)
-{
-       pui_bool ret = 0;
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
-
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
-       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_speaking_frame_cb, info->interval / 1000.0);
-
-       if (!ret)
-       {
-               pui_err("Failed to add frame callback !\n");
-               e = PUI_INT_ERROR_INVALID_RESOURCES;
-       }
-
-       return e;
-}
-
-pui_error
-_ani_speaking_stop(pui_ani_t *ani)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s\n", info->id);
-
-       pui_backend_ani_remove_frame_cb(ani);
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       return e;
-}
-
-
-void
-pui_default_backend_ani_speaking_func_set(pui_backend_ani_func *func)
-{
-       if (!func) return;
-
-       func->ani_start = _ani_speaking_start;
-       func->ani_stop = _ani_speaking_stop;
-}
-
-
diff --git a/backends/default_ani_streaming.c b/backends/default_ani_streaming.c
deleted file mode 100644 (file)
index 46bfaf7..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "default_backend.h"
-
-static void
-_ani_backend_streaming_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
-{
-       if (!frame) return;
-       if (!r || !g || !b) return;
-       if (led_idx > frame->num_led) return;
-
-       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
-       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
-       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
-}
-
-static void
-_ani_backend_streaming_free_frame(default_frame_info_t *frame)
-{
-       if (!frame) return;
-
-       if (frame->leds) free(frame->leds);
-       free(frame);
-}
-
-static default_frame_info_t *
-_ani_backend_streaming_get_frame(default_ani_info *ani_info)
-{
-#define SMOOTH_FRAME 15
-       default_frame_info_t *frame, *key_frame, *key_frame2;
-       int idx, idx2;
-       unsigned int r, g, b, r2, g2, b2;
-       int r3, g3, b3;
-       double div;
-
-       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
-       if (!frame) return NULL;
-
-       idx = ((int)(ani_info->frame_idx / SMOOTH_FRAME)) % ani_info->num_key_frames;
-       idx2 = (idx + 1) % ani_info->num_key_frames;
-
-       key_frame = &ani_info->frames[idx];
-       key_frame2 = &ani_info->frames[idx2];
-       frame->num_led = key_frame->num_led;
-       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
-       if (!frame->leds)
-       {
-               free(frame);
-               return NULL;
-       }
-       div = (double)(ani_info->frame_idx % SMOOTH_FRAME) / (double)SMOOTH_FRAME;
-       r = g = b = r2 = g2 = b2 = 0x0;
-       for (int i = 0; i < key_frame->num_led; i++)
-       {
-               _ani_backend_streaming_get_led_rgb(key_frame, i, &r, &g, &b);
-               _ani_backend_streaming_get_led_rgb(key_frame2, i, &r2, &g2, &b2);
-               r3 = (int)(r2 - r) * div + r;
-               g3 = (int)(g2 - g) * div + g;
-               b3 = (int)(b2 - b) * div + b;
-
-               frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
-       }
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= (ani_info->num_key_frames * SMOOTH_FRAME))
-               ani_info->frame_idx = 0;
-
-       return frame;
-}
-
-static pui_bool
-_ani_backend_streaming_frame_cb(void *data, int serial)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_ani_t *ani = (pui_ani_t *)data;
-       pui_backend_ani_data *ani_data = NULL;
-       pui_ani_control_buffer *buffer = NULL;
-       default_frame_info_t *frame;
-       unsigned int r = 0x0, g = 0x0, b = 0x0;
-       double now;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       now = ecore_time_unix_get();
-       pui_info("[time:%.3f] serial=%d\n", now, serial);
-
-       /* TODO : make use of ani_info */
-       //(void) ani_info;
-
-       buffer = pui_backend_ani_get_buffer(ani);
-       if (!buffer) {
-               pui_err("Failed to get buffer for animation\n");
-               return (pui_bool)0;
-       }
-
-       frame = _ani_backend_streaming_get_frame(ani_info);
-       for(int i = 0; i<12; i++)
-       {
-               _ani_backend_streaming_get_led_rgb(frame, i, &r, &g, &b);
-               buffer->ptr[4*i] = 0;
-               buffer->ptr[4*i + 1] = b; /* BLUE */
-               buffer->ptr[4*i + 2] = g; /* GREEN */
-               buffer->ptr[4*i + 3] = r; /* RED */
-       }
-       _ani_backend_streaming_free_frame(frame);
-
-       e = pui_backend_ani_set_buffer(ani, buffer);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       e = pui_backend_ani_update(ani);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on updating animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       pui_info("... update (serial=%d)\n", serial);
-
-       return (pui_bool)1;
-}
-
-pui_error
-_ani_streaming_start(pui_ani_t *ani, int repeat)
-{
-       pui_bool ret = 0;
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
-
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
-       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_streaming_frame_cb, info->interval / 1000.0);
-
-       if (!ret)
-       {
-               pui_err("Failed to add frame callback !\n");
-               e = PUI_INT_ERROR_INVALID_RESOURCES;
-       }
-
-       return e;
-}
-
-pui_error
-_ani_streaming_stop(pui_ani_t *ani)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s\n", info->id);
-
-       pui_backend_ani_remove_frame_cb(ani);
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       return e;
-}
-
-
-void
-pui_default_backend_ani_streaming_func_set(pui_backend_ani_func *func)
-{
-       if (!func) return;
-
-       func->ani_start = _ani_streaming_start;
-       func->ani_stop = _ani_streaming_stop;
-}
-
-
diff --git a/backends/default_ani_swupdatedone.c b/backends/default_ani_swupdatedone.c
deleted file mode 100644 (file)
index 1c77871..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "default_backend.h"
-
-static void
-_ani_backend_swupdatedone_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
-{
-       if (!frame) return;
-       if (!r || !g || !b) return;
-       if (led_idx > frame->num_led) return;
-
-       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
-       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
-       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
-}
-
-static void
-_ani_backend_swupdatedone_free_frame(default_frame_info_t *frame)
-{
-       if (!frame) return;
-
-       if (frame->leds) free(frame->leds);
-       free(frame);
-}
-
-static default_frame_info_t *
-_ani_backend_swupdatedone_get_frame(default_ani_info *ani_info)
-{
-#define SMOOTH_FRAME 20
-       default_frame_info_t *frame, *key_frame, *key_frame2;
-       int idx, idx2;
-       unsigned int r, g, b, r2, g2, b2;
-       int r3, g3, b3;
-       double div;
-
-       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
-       if (!frame) return NULL;
-
-       idx = ((int)(ani_info->frame_idx / SMOOTH_FRAME)) % ani_info->num_key_frames;
-       idx2 = (idx + 1) % ani_info->num_key_frames;
-
-       key_frame = &ani_info->frames[idx];
-       key_frame2 = &ani_info->frames[idx2];
-       frame->num_led = key_frame->num_led;
-       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
-       if (!frame->leds)
-       {
-               free(frame);
-               return NULL;
-       }
-       div = (double)(ani_info->frame_idx % SMOOTH_FRAME) / (double)SMOOTH_FRAME;
-       r = g = b = r2 = g2 = b2 = 0x0;
-       for (int i = 0; i < key_frame->num_led; i++)
-       {
-               _ani_backend_swupdatedone_get_led_rgb(key_frame, i, &r, &g, &b);
-               _ani_backend_swupdatedone_get_led_rgb(key_frame2, i, &r2, &g2, &b2);
-               r3 = (int)(r2 - r) * div + r;
-               g3 = (int)(g2 - g) * div + g;
-               b3 = (int)(b2 - b) * div + b;
-
-               frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
-       }
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= (ani_info->num_key_frames * SMOOTH_FRAME))
-               ani_info->frame_idx = 0;
-
-       return frame;
-}
-
-static pui_bool
-_ani_backend_swupdatedone_frame_cb(void *data, int serial)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_ani_t *ani = (pui_ani_t *)data;
-       pui_backend_ani_data *ani_data = NULL;
-       pui_ani_control_buffer *buffer = NULL;
-       default_frame_info_t *frame;
-       unsigned int r = 0x0, g = 0x0, b = 0x0;
-       double now;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       now = ecore_time_unix_get();
-       pui_info("[time:%.3f] serial=%d\n", now, serial);
-
-       /* TODO : make use of ani_info */
-       //(void) ani_info;
-
-       buffer = pui_backend_ani_get_buffer(ani);
-       if (!buffer) {
-               pui_err("Failed to get buffer for animation\n");
-               return (pui_bool)0;
-       }
-
-       frame = _ani_backend_swupdatedone_get_frame(ani_info);
-       for(int i = 0; i<12; i++)
-       {
-               _ani_backend_swupdatedone_get_led_rgb(frame, i, &r, &g, &b);
-               buffer->ptr[4*i] = 0;
-               buffer->ptr[4*i + 1] = b; /* BLUE */
-               buffer->ptr[4*i + 2] = g; /* GREEN */
-               buffer->ptr[4*i + 3] = r; /* RED */
-       }
-       _ani_backend_swupdatedone_free_frame(frame);
-
-       e = pui_backend_ani_set_buffer(ani, buffer);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       e = pui_backend_ani_update(ani);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on updating animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       pui_info("... update (serial=%d)\n", serial);
-
-       return (pui_bool)1;
-}
-
-pui_error
-_ani_swupdatedone_start(pui_ani_t *ani, int repeat)
-{
-       pui_bool ret = 0;
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
-
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
-       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_swupdatedone_frame_cb, info->interval / 1000.0);
-
-       if (!ret)
-       {
-               pui_err("Failed to add frame callback !\n");
-               e = PUI_INT_ERROR_INVALID_RESOURCES;
-       }
-
-       return e;
-}
-
-pui_error
-_ani_swupdatedone_stop(pui_ani_t *ani)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s\n", info->id);
-
-       pui_backend_ani_remove_frame_cb(ani);
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       return e;
-}
-
-
-void
-pui_default_backend_ani_swupdatedone_func_set(pui_backend_ani_func *func)
-{
-       if (!func) return;
-
-       func->ani_start = _ani_swupdatedone_start;
-       func->ani_stop = _ani_swupdatedone_stop;
-}
-
-
diff --git a/backends/default_ani_system_processing.c b/backends/default_ani_system_processing.c
deleted file mode 100644 (file)
index b54e8c0..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "default_backend.h"
-
-static void
-_ani_backend_system_processing_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
-{
-       if (!frame) return;
-       if (!r || !g || !b) return;
-       if (led_idx > frame->num_led) return;
-
-       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
-       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
-       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
-}
-
-static void
-_ani_backend_system_processing_free_frame(default_frame_info_t *frame)
-{
-       if (!frame) return;
-
-       if (frame->leds) free(frame->leds);
-       free(frame);
-}
-
-static default_frame_info_t *
-_ani_backend_system_processing_get_frame(default_ani_info *ani_info)
-{
-       default_frame_info_t *frame, *key_frame;
-
-       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
-       if (!frame) return NULL;
-
-       key_frame = &ani_info->frames[0];
-       frame->num_led = key_frame->num_led;
-       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
-       if (!frame->leds)
-       {
-               free(frame);
-               return NULL;
-       }
-       for (int i = 0; i < key_frame->num_led; i++)
-       {
-               int idx = (i - ani_info->frame_idx + key_frame->num_led) % key_frame->num_led;
-               frame->leds[idx] = key_frame->leds[i];
-       }
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= key_frame->num_led)
-               ani_info->frame_idx = 0;
-
-       return frame;
-}
-
-static pui_bool
-_ani_backend_system_processing_frame_cb(void *data, int serial)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_ani_t *ani = (pui_ani_t *)data;
-       pui_backend_ani_data *ani_data = NULL;
-       pui_ani_control_buffer *buffer = NULL;
-       default_frame_info_t *frame;
-       unsigned int r = 0x0, g = 0x0, b = 0x0;
-       double now;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       now = ecore_time_unix_get();
-       pui_info("[time:%.3f] serial=%d\n", now, serial);
-
-       /* TODO : make use of ani_info */
-       //(void) ani_info;
-
-       buffer = pui_backend_ani_get_buffer(ani);
-       if (!buffer) {
-               pui_err("Failed to get buffer for animation\n");
-               return (pui_bool)0;
-       }
-
-       frame = _ani_backend_system_processing_get_frame(ani_info);
-       for(int i = 0; i<12; i++)
-       {
-               _ani_backend_system_processing_get_led_rgb(frame, i, &r, &g, &b);
-               buffer->ptr[4*i] = 0;
-               buffer->ptr[4*i + 1] = b; /* BLUE */
-               buffer->ptr[4*i + 2] = g; /* GREEN */
-               buffer->ptr[4*i + 3] = r; /* RED */
-       }
-       _ani_backend_system_processing_free_frame(frame);
-
-       e = pui_backend_ani_set_buffer(ani, buffer);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       e = pui_backend_ani_update(ani);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on updating animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       pui_info("... update (serial=%d)\n", serial);
-
-       return (pui_bool)1;
-}
-
-pui_error
-_ani_system_processing_start(pui_ani_t *ani, int repeat)
-{
-       pui_bool ret = 0;
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
-       if (info->num_key_frames != 1)
-       {
-               pui_err("invalid key frames: %d\n", info->num_key_frames);
-               return PUI_INT_ERROR_INVALID_RESOURCES;
-       }
-
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
-       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_system_processing_frame_cb, info->interval / 1000.0);
-
-       if (!ret)
-       {
-               pui_err("Failed to add frame callback !\n");
-               e = PUI_INT_ERROR_INVALID_RESOURCES;
-       }
-
-       return e;
-}
-
-pui_error
-_ani_system_processing_stop(pui_ani_t *ani)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s\n", info->id);
-
-       pui_backend_ani_remove_frame_cb(ani);
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       return e;
-}
-
-
-void
-pui_default_backend_ani_system_processing_func_set(pui_backend_ani_func *func)
-{
-       if (!func) return;
-
-       func->ani_start = _ani_system_processing_start;
-       func->ani_stop = _ani_system_processing_stop;
-}
-
-
diff --git a/backends/default_ani_timeout.c b/backends/default_ani_timeout.c
deleted file mode 100644 (file)
index da2bc8d..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "default_backend.h"
-
-static void
-_ani_backend_timeout_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
-{
-       if (!frame) return;
-       if (!r || !g || !b) return;
-       if (led_idx > frame->num_led) return;
-
-       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
-       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
-       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
-}
-
-static void
-_ani_backend_timeout_free_frame(default_frame_info_t *frame)
-{
-       if (!frame) return;
-
-       if (frame->leds) free(frame->leds);
-       free(frame);
-}
-
-static default_frame_info_t *
-_ani_backend_timeout_get_frame(default_ani_info *ani_info)
-{
-#define SMOOTH_FRAME 15
-       default_frame_info_t *frame, *key_frame, *key_frame2;
-       int idx, idx2;
-       unsigned int r, g, b, r2, g2, b2;
-       int r3, g3, b3;
-       double div;
-
-       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
-       if (!frame) return NULL;
-
-       idx = ((int)(ani_info->frame_idx / SMOOTH_FRAME)) % ani_info->num_key_frames;
-       idx2 = (idx + 1) % ani_info->num_key_frames;
-
-       key_frame = &ani_info->frames[idx];
-       key_frame2 = &ani_info->frames[idx2];
-       frame->num_led = key_frame->num_led;
-       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
-       if (!frame->leds)
-       {
-               free(frame);
-               return NULL;
-       }
-       div = (double)(ani_info->frame_idx % SMOOTH_FRAME) / (double)SMOOTH_FRAME;
-       r = g = b = r2 = g2 = b2 = 0x0;
-       for (int i = 0; i < key_frame->num_led; i++)
-       {
-               _ani_backend_timeout_get_led_rgb(key_frame, i, &r, &g, &b);
-               _ani_backend_timeout_get_led_rgb(key_frame2, i, &r2, &g2, &b2);
-               r3 = (int)(r2 - r) * div + r;
-               g3 = (int)(g2 - g) * div + g;
-               b3 = (int)(b2 - b) * div + b;
-
-               frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
-       }
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= (ani_info->num_key_frames * SMOOTH_FRAME))
-               ani_info->frame_idx = 0;
-
-       return frame;
-}
-
-static pui_bool
-_ani_backend_timeout_frame_cb(void *data, int serial)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_ani_t *ani = (pui_ani_t *)data;
-       pui_backend_ani_data *ani_data = NULL;
-       pui_ani_control_buffer *buffer = NULL;
-       default_frame_info_t *frame;
-       unsigned int r = 0x0, g = 0x0, b = 0x0;
-       double now;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       now = ecore_time_unix_get();
-       pui_info("[time:%.3f] serial=%d\n", now, serial);
-
-       /* TODO : make use of ani_info */
-       //(void) ani_info;
-
-       buffer = pui_backend_ani_get_buffer(ani);
-       if (!buffer) {
-               pui_err("Failed to get buffer for animation\n");
-               return (pui_bool)0;
-       }
-
-       frame = _ani_backend_timeout_get_frame(ani_info);
-       for(int i = 0; i<12; i++)
-       {
-               _ani_backend_timeout_get_led_rgb(frame, i, &r, &g, &b);
-               buffer->ptr[4*i] = 0;
-               buffer->ptr[4*i + 1] = b; /* BLUE */
-               buffer->ptr[4*i + 2] = g; /* GREEN */
-               buffer->ptr[4*i + 3] = r; /* RED */
-       }
-       _ani_backend_timeout_free_frame(frame);
-
-       e = pui_backend_ani_set_buffer(ani, buffer);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       e = pui_backend_ani_update(ani);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on updating animation !(e=%d)\n", e);
-               return (pui_bool)0;
-       }
-
-       pui_info("... update (serial=%d)\n", serial);
-
-       return (pui_bool)1;
-}
-
-pui_error
-_ani_timeout_start(pui_ani_t *ani, int repeat)
-{
-       pui_bool ret = 0;
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
-
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
-       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_timeout_frame_cb, info->interval / 1000.0);
-
-       if (!ret)
-       {
-               pui_err("Failed to add frame callback !\n");
-               e = PUI_INT_ERROR_INVALID_RESOURCES;
-       }
-
-       return e;
-}
-
-pui_error
-_ani_timeout_stop(pui_ani_t *ani)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       pui_backend_ani_data *ani_data = NULL;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
-
-       //TODO
-       (void) info;
-
-       pui_info("... info->id: %s\n", info->id);
-
-       pui_backend_ani_remove_frame_cb(ani);
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       return e;
-}
-
-
-void
-pui_default_backend_ani_timeout_func_set(pui_backend_ani_func *func)
-{
-       if (!func) return;
-
-       func->ani_start = _ani_timeout_start;
-       func->ani_stop = _ani_timeout_stop;
-}
-
-
index afba9fcab218aae1f6b251dacb0b063417f2fd5a..d4015ffca7030a0a34b8b09fd8a1ee986f1c3f04 100644 (file)
@@ -303,16 +303,46 @@ error:
        return NULL;
 }
 
-static int
-_scandir_filter(const struct dirent *dirent)
+int
+_find_directory(const char *path, Eina_List **json_list)
 {
-       if (!strncmp(dirent->d_name, ".", sizeof(".")) ||
-               !strncmp(dirent->d_name, "..", sizeof("..")))
-               return 0;
-       if (!strstr(dirent->d_name, ".json"))
-               return 0;
+       DIR *dir;
+       struct dirent *cur;
+       int count = 0, ret_cnt = 0;
+
+       dir = opendir(path);
+       if (!dir)
+       {
+               pui_err("Failed to open %s.\n", path);
+               return count;
+       }
+
+       while ((cur = readdir(dir)) != NULL)
+       {
+               char next_path[MAX_STR] = {0, };
+               if (cur->d_type == DT_DIR)
+               {
+                       if (!strncmp(cur->d_name, ".", sizeof(".")) ||
+                               !strncmp(cur->d_name, "..", sizeof("..")))
+                               continue;
+
+                       snprintf(next_path, MAX_STR, "%s/%s", path, cur->d_name);
+                       ret_cnt = _find_directory(next_path, json_list);
+                       count += ret_cnt;
+               }
+               else
+               {
+                       if (strstr(cur->d_name, ".json"))
+                       {
+                               snprintf(next_path, MAX_STR, "%s/%s", path, cur->d_name);
+                               *json_list = eina_list_append(*json_list, eina_stringshare_add(next_path));
+                               count++;
+                       }
+               }
+       }
+       closedir(dir);
 
-       return 1;
+       return count;
 }
 
 
@@ -321,33 +351,25 @@ _create_ani_collection(void)
 {
        pui_int_error e = PUI_INT_ERROR_NONE;
        default_ani_info *ani_info;
-       struct dirent **files;
-       int count, i;
-       char file_path[MAX_STR] = {0, };
+       Eina_List *json_list = NULL;
+       Eina_List *l, *l_next;
+       Eina_Stringshare *path;
 
        // load and store all of animation data
 
-       if ((count = scandir(ANI_COLLECTION_DIR, &files, _scandir_filter, alphasort)) == -1) {
-               printf("Failed to get %s directory (%s)\n", ANI_COLLECTION_DIR, strerror(errno));
-               e = PUI_INT_ERROR_INVALID_RESOURCES;
-               return e;
-       }
-
-       for (i = 0; i < count; i++) {
-               snprintf(file_path, sizeof(file_path), "%s%s", ANI_COLLECTION_DIR, files[i]->d_name);
+       _find_directory(ANI_COLLECTION_DIR, &json_list);
 
-               ani_info = _read_json(file_path);
+       EINA_LIST_FOREACH_SAFE(json_list, l, l_next, path)
+       {
+               ani_info = _read_json(path);
                if (ani_info) {
                        eina_hash_add(_animations_hash, ani_info->id, ani_info);
-                       printf("Success to load %s animation\n", files[i]->d_name);
+                       pui_info("Success to load %s animation (id: %s)\n", path, ani_info->id);
                }
+               eina_stringshare_del(path);
+               json_list = eina_list_remove_list(json_list, l);
        }
 
-       for (i = 0; i < count; i++) {
-               free(files[i]);
-       }
-       free(files);
-
        //TODO
 
        return e;
@@ -439,69 +461,69 @@ _ani_create(pui_id id)
        }
 
        /* Assign each function pointer that corresponds to the given id if needed. */
-       if (!strncmp(ani_info->id, "processing", sizeof("processing")))
+       if (!strncmp(ani_info->id, "system/easy_setup", sizeof("system/easy_setup")))
        {
-               pui_default_backend_ani_processing_func_set(ani_func);
+               pui_default_backend_ani_easysetup_func_set(ani_func);
        }
-       else if (!strncmp(ani_info->id, "listening", sizeof("listening")))
+       else if (!strncmp(ani_info->id, "system/processing", sizeof("system/processing")))
        {
-               pui_default_backend_ani_listening_func_set(ani_func);
+               pui_default_backend_ani_system_processing_func_set(ani_func);
        }
-       else if (!strncmp(ani_info->id, "speaking", sizeof("speaking")))
+       else if (!strncmp(ani_info->id, "system/sw_update_done", sizeof("system/sw_update_done")))
        {
-               pui_default_backend_ani_speaking_func_set(ani_func);
+               pui_default_backend_ani_swupdatedone_func_set(ani_func);
        }
-       else if (!strncmp(ani_info->id, "streaming", sizeof("streaming")))
+       else if (!strncmp(ani_info->id, "system/mic_off", sizeof("system/mic_off")))
        {
-               pui_default_backend_ani_streaming_func_set(ani_func);
+               pui_default_backend_ani_micoff_func_set(ani_func);
        }
-       else if (!strncmp(ani_info->id, "time_out", sizeof("time_out")))
+       else if (!strncmp(ani_info->id, "voice/listening", sizeof("voice/listening")))
        {
-               pui_default_backend_ani_timeout_func_set(ani_func);
+               pui_default_backend_ani_listening_func_set(ani_func);
        }
-       else if (!strncmp(ani_info->id, "system_processing", sizeof("system_processing")))
+       else if (!strncmp(ani_info->id, "voice/streaming", sizeof("voice/streaming")))
        {
-               pui_default_backend_ani_system_processing_func_set(ani_func);
+               pui_default_backend_ani_streaming_func_set(ani_func);
        }
-       else if (!strncmp(ani_info->id, "normal", sizeof("normal")))
+       else if (!strncmp(ani_info->id, "voice/processing", sizeof("voice/processing")))
        {
-               pui_default_backend_ani_normal_func_set(ani_func);
+               pui_default_backend_ani_processing_func_set(ani_func);
        }
-       else if (!strncmp(ani_info->id, "emergency", sizeof("emergency")))
+       else if (!strncmp(ani_info->id, "voice/speaking", sizeof("voice/speaking")))
        {
-               pui_default_backend_ani_emergency_func_set(ani_func);
+               pui_default_backend_ani_speaking_func_set(ani_func);
        }
-       else if (!strncmp(ani_info->id, "easy_setup", sizeof("easy_setup")))
+       else if (!strncmp(ani_info->id, "voice/timeout", sizeof("voice/timeout")))
        {
-               pui_default_backend_ani_easysetup_func_set(ani_func);
+               pui_default_backend_ani_timeout_func_set(ani_func);
        }
-       else if (!strncmp(ani_info->id, "sw_update_done", sizeof("sw_update_done")))
+       else if (!strncmp(ani_info->id, "notification/normal", sizeof("notification/normal")))
        {
-               pui_default_backend_ani_swupdatedone_func_set(ani_func);
+               pui_default_backend_ani_normal_func_set(ani_func);
        }
-       else if (!strncmp(ani_info->id, "mic_off", sizeof("mic_off")))
+       else if (!strncmp(ani_info->id, "notification/emergency", sizeof("notification/emergency")))
        {
-               pui_default_backend_ani_micoff_func_set(ani_func);
+               pui_default_backend_ani_emergency_func_set(ani_func);
        }
-       else if (!strncmp(ani_info->id, "network_error", sizeof("network_error")))
+       else if (!strncmp(ani_info->id, "notification/network_error", sizeof("notification/network_error")))
        {
                pui_default_backend_ani_networkerror_func_set(ani_func);
        }
-       else if (!strncmp(ani_info->id, "error", sizeof("error")))
+       else if (!strncmp(ani_info->id, "notification/error", sizeof("notification/error")))
        {
                pui_default_backend_ani_error_func_set(ani_func);
        }
-       else if (!strncmp(ani_info->id, "alarm", sizeof("alarm")))
+       else if (!strncmp(ani_info->id, "notification/alarm", sizeof("notification/alarm")))
        {
                pui_default_backend_ani_alarm_func_set(ani_func);
        }
-       else if (!strncmp(ani_info->id, "connected", sizeof("connected")))
+       else if (!strncmp(ani_info->id, "bt/pairing", sizeof("bt/pairing")))
        {
-               pui_default_backend_ani_connected_func_set(ani_func);
+               pui_default_backend_ani_pairing_func_set(ani_func);
        }
-       else if (!strncmp(ani_info->id, "pairing", sizeof("pairing")))
+       else if (!strncmp(ani_info->id, "bt/connected", sizeof("bt/connected")))
        {
-               pui_default_backend_ani_pairing_func_set(ani_func);
+               pui_default_backend_ani_connected_func_set(ani_func);
        }
        else
        {
diff --git a/backends/notification/default_ani_alarm.c b/backends/notification/default_ani_alarm.c
new file mode 100644 (file)
index 0000000..7017465
--- /dev/null
@@ -0,0 +1,224 @@
+/*
+ * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "../default_backend.h"
+
+static void
+_ani_backend_alarm_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
+{
+       if (!frame) return;
+       if (!r || !g || !b) return;
+       if (led_idx > frame->num_led) return;
+
+       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
+       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
+       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
+}
+
+static void
+_ani_backend_alarm_free_frame(default_frame_info_t *frame)
+{
+       if (!frame) return;
+
+       if (frame->leds) free(frame->leds);
+       free(frame);
+}
+
+static default_frame_info_t *
+_ani_backend_alarm_get_frame(default_ani_info *ani_info)
+{
+#define SMOOTH_FRAME 75
+#define ALARM_REPEAT 3
+#define ALARM_FRAME 10
+       default_frame_info_t *frame, *key_frame;
+       int idx;
+       unsigned int r, g, b, r2, g2, b2;
+       int r3, g3, b3;
+       double div;
+       int fade_out_frame;
+
+       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
+       if (!frame) return NULL;
+
+       idx = ((int)(ani_info->frame_idx / ALARM_FRAME)) % ani_info->num_key_frames;
+       key_frame = &ani_info->frames[idx];
+
+       frame->num_led = key_frame->num_led;
+       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
+       if (!frame->leds)
+       {
+               free(frame);
+               return NULL;
+       }
+
+       /* FIXME: calculate this data before animation start. this is not changed value */
+       fade_out_frame = (ALARM_FRAME) * ani_info->num_key_frames * (ALARM_REPEAT);
+
+       if (ani_info->frame_idx < fade_out_frame)
+       {
+               for (int i = 0; i < key_frame->num_led; i++)
+               {
+                       frame->leds[i].color = key_frame->leds[i].color;
+               }
+       }
+       else
+       {
+               key_frame = &ani_info->frames[0];
+               r2 = g2 = b2 = 0x00;
+               for (int i = 0; i < key_frame->num_led; i++)
+               {
+                       div = (double)(ani_info->frame_idx - fade_out_frame) / (double)SMOOTH_FRAME;
+                       _ani_backend_alarm_get_led_rgb(key_frame, i, &r, &g, &b);
+                       r3 = (int)(r2 - r) * div + r;
+                       g3 = (int)(g2 - g) * div + g;
+                       b3 = (int)(b2 - b) * div + b;
+
+                       frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
+               }
+       }
+
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= (fade_out_frame + SMOOTH_FRAME))
+               ani_info->frame_idx = 0;
+
+       return frame;
+}
+
+static pui_bool
+_ani_backend_alarm_frame_cb(void *data, int serial)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_ani_t *ani = (pui_ani_t *)data;
+       pui_backend_ani_data *ani_data = NULL;
+       pui_ani_control_buffer *buffer = NULL;
+       default_frame_info_t *frame;
+       unsigned int r = 0x0, g = 0x0, b = 0x0;
+       double now;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       now = ecore_time_unix_get();
+       pui_info("[time:%.3f] serial=%d\n", now, serial);
+
+       /* TODO : make use of ani_info */
+       //(void) ani_info;
+
+       buffer = pui_backend_ani_get_buffer(ani);
+       if (!buffer) {
+               pui_err("Failed to get buffer for animation\n");
+               return (pui_bool)0;
+       }
+
+       frame = _ani_backend_alarm_get_frame(ani_info);
+       for(int i = 0; i<12; i++)
+       {
+               _ani_backend_alarm_get_led_rgb(frame, i, &r, &g, &b);
+               buffer->ptr[4*i] = 0;
+               buffer->ptr[4*i + 1] = b; /* BLUE */
+               buffer->ptr[4*i + 2] = g; /* GREEN */
+               buffer->ptr[4*i + 3] = r; /* RED */
+       }
+       _ani_backend_alarm_free_frame(frame);
+
+       e = pui_backend_ani_set_buffer(ani, buffer);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       e = pui_backend_ani_update(ani);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on updating animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       pui_info("... update (serial=%d)\n", serial);
+
+       return (pui_bool)1;
+}
+
+pui_error
+_ani_alarm_start(pui_ani_t *ani, int repeat)
+{
+       pui_bool ret = 0;
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
+
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
+       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_alarm_frame_cb, info->interval / 1000.0);
+
+       if (!ret)
+       {
+               pui_err("Failed to add frame callback !\n");
+               e = PUI_INT_ERROR_INVALID_RESOURCES;
+       }
+
+       return e;
+}
+
+pui_error
+_ani_alarm_stop(pui_ani_t *ani)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s\n", info->id);
+
+       pui_backend_ani_remove_frame_cb(ani);
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       return e;
+}
+
+
+void
+pui_default_backend_ani_alarm_func_set(pui_backend_ani_func *func)
+{
+       if (!func) return;
+
+       func->ani_start = _ani_alarm_start;
+       func->ani_stop = _ani_alarm_stop;
+}
+
+
diff --git a/backends/notification/default_ani_emergency.c b/backends/notification/default_ani_emergency.c
new file mode 100644 (file)
index 0000000..b0fad94
--- /dev/null
@@ -0,0 +1,209 @@
+/*
+ * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "../default_backend.h"
+
+static void
+_ani_backend_emergency_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
+{
+       if (!frame) return;
+       if (!r || !g || !b) return;
+       if (led_idx > frame->num_led) return;
+
+       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
+       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
+       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
+}
+
+static void
+_ani_backend_emergency_free_frame(default_frame_info_t *frame)
+{
+       if (!frame) return;
+
+       if (frame->leds) free(frame->leds);
+       free(frame);
+}
+
+static default_frame_info_t *
+_ani_backend_emergency_get_frame(default_ani_info *ani_info)
+{
+#define SMOOTH_FRAME 15
+       default_frame_info_t *frame, *key_frame, *key_frame2;
+       int idx, idx2;
+       unsigned int r, g, b, r2, g2, b2;
+       int r3, g3, b3;
+       double div;
+
+       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
+       if (!frame) return NULL;
+
+       idx = ((int)(ani_info->frame_idx / SMOOTH_FRAME)) % ani_info->num_key_frames;
+       idx2 = (idx + 1) % ani_info->num_key_frames;
+
+       key_frame = &ani_info->frames[idx];
+       key_frame2 = &ani_info->frames[idx2];
+       frame->num_led = key_frame->num_led;
+       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
+       if (!frame->leds)
+       {
+               free(frame);
+               return NULL;
+       }
+       div = (double)(ani_info->frame_idx % SMOOTH_FRAME) / (double)SMOOTH_FRAME;
+       r = g = b = r2 = g2 = b2 = 0x0;
+       for (int i = 0; i < key_frame->num_led; i++)
+       {
+               _ani_backend_emergency_get_led_rgb(key_frame, i, &r, &g, &b);
+               _ani_backend_emergency_get_led_rgb(key_frame2, i, &r2, &g2, &b2);
+               r3 = (int)(r2 - r) * div + r;
+               g3 = (int)(g2 - g) * div + g;
+               b3 = (int)(b2 - b) * div + b;
+
+               frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
+       }
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= (ani_info->num_key_frames * SMOOTH_FRAME))
+               ani_info->frame_idx = 0;
+
+       return frame;
+}
+
+
+static pui_bool
+_ani_backend_emergency_frame_cb(void *data, int serial)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_ani_t *ani = (pui_ani_t *)data;
+       pui_backend_ani_data *ani_data = NULL;
+       pui_ani_control_buffer *buffer = NULL;
+       default_frame_info_t *frame;
+       unsigned int r = 0x0, g = 0x0, b = 0x0;
+       double now;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       now = ecore_time_unix_get();
+       pui_info("[time:%.3f] serial=%d\n", now, serial);
+
+       /* TODO : make use of ani_info */
+       //(void) ani_info;
+
+       buffer = pui_backend_ani_get_buffer(ani);
+       if (!buffer) {
+               pui_err("Failed to get buffer for animation\n");
+               return (pui_bool)0;
+       }
+
+       frame = _ani_backend_emergency_get_frame(ani_info);
+       for(int i = 0; i<12; i++)
+       {
+               _ani_backend_emergency_get_led_rgb(frame, i, &r, &g, &b);
+               buffer->ptr[4*i] = 0;
+               buffer->ptr[4*i + 1] = b; /* BLUE */
+               buffer->ptr[4*i + 2] = g; /* GREEN */
+               buffer->ptr[4*i + 3] = r; /* RED */
+       }
+       _ani_backend_emergency_free_frame(frame);
+
+       e = pui_backend_ani_set_buffer(ani, buffer);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       e = pui_backend_ani_update(ani);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on updating animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       pui_info("... update (serial=%d)\n", serial);
+
+       return (pui_bool)1;
+}
+
+pui_error
+_ani_emergency_start(pui_ani_t *ani, int repeat)
+{
+       pui_bool ret = 0;
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
+
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
+       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_emergency_frame_cb, info->interval / 1000.0);
+
+       if (!ret)
+       {
+               pui_err("Failed to add frame callback !\n");
+               e = PUI_INT_ERROR_INVALID_RESOURCES;
+       }
+
+       return e;
+}
+
+pui_error
+_ani_emergency_stop(pui_ani_t *ani)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s\n", info->id);
+
+       pui_backend_ani_remove_frame_cb(ani);
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       return e;
+}
+
+
+void
+pui_default_backend_ani_emergency_func_set(pui_backend_ani_func *func)
+{
+       if (!func) return;
+
+       func->ani_start = _ani_emergency_start;
+       func->ani_stop = _ani_emergency_stop;
+}
+
+
diff --git a/backends/notification/default_ani_error.c b/backends/notification/default_ani_error.c
new file mode 100644 (file)
index 0000000..9c4f022
--- /dev/null
@@ -0,0 +1,205 @@
+/*
+ * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "../default_backend.h"
+
+static void
+_ani_backend_error_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
+{
+       if (!frame) return;
+       if (!r || !g || !b) return;
+       if (led_idx > frame->num_led) return;
+
+       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
+       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
+       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
+}
+
+static void
+_ani_backend_error_free_frame(default_frame_info_t *frame)
+{
+       if (!frame) return;
+
+       if (frame->leds) free(frame->leds);
+       free(frame);
+}
+
+static default_frame_info_t *
+_ani_backend_error_get_frame(default_ani_info *ani_info)
+{
+#define BLINK_FRAME 2
+       default_frame_info_t *frame, *key_frame;
+
+       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
+       if (!frame) return NULL;
+
+       key_frame = &ani_info->frames[0];
+       frame->num_led = key_frame->num_led;
+       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
+       if (!frame->leds)
+       {
+               free(frame);
+               return NULL;
+       }
+
+       if (ani_info->frame_idx % BLINK_FRAME == 0)
+       {
+               for (int i = 0; i < key_frame->num_led; i++)
+               {
+                       frame->leds[i].color = key_frame->leds[i].color;
+               }
+       }
+       else
+       {
+               for (int i = 0; i < key_frame->num_led; i++)
+               {
+                       frame->leds[i].color = 0x000000;
+               }
+       }
+
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= BLINK_FRAME)
+               ani_info->frame_idx = 0;
+
+       return frame;
+}
+
+
+static pui_bool
+_ani_backend_error_frame_cb(void *data, int serial)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_ani_t *ani = (pui_ani_t *)data;
+       pui_backend_ani_data *ani_data = NULL;
+       pui_ani_control_buffer *buffer = NULL;
+       default_frame_info_t *frame;
+       unsigned int r = 0x0, g = 0x0, b = 0x0;
+       double now;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       now = ecore_time_unix_get();
+       pui_info("[time:%.3f] serial=%d\n", now, serial);
+
+       /* TODO : make use of ani_info */
+       //(void) ani_info;
+
+       buffer = pui_backend_ani_get_buffer(ani);
+       if (!buffer) {
+               pui_err("Failed to get buffer for animation\n");
+               return (pui_bool)0;
+       }
+
+       frame = _ani_backend_error_get_frame(ani_info);
+       for(int i = 0; i<12; i++)
+       {
+               _ani_backend_error_get_led_rgb(frame, i, &r, &g, &b);
+               buffer->ptr[4*i] = 0;
+               buffer->ptr[4*i + 1] = b; /* BLUE */
+               buffer->ptr[4*i + 2] = g; /* GREEN */
+               buffer->ptr[4*i + 3] = r; /* RED */
+       }
+       _ani_backend_error_free_frame(frame);
+
+       e = pui_backend_ani_set_buffer(ani, buffer);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       e = pui_backend_ani_update(ani);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on updating animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       pui_info("... update (serial=%d)\n", serial);
+
+       return (pui_bool)1;
+}
+
+pui_error
+_ani_error_start(pui_ani_t *ani, int repeat)
+{
+       pui_bool ret = 0;
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
+
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
+       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_error_frame_cb, info->interval / 1000.0);
+
+       if (!ret)
+       {
+               pui_err("Failed to add frame callback !\n");
+               e = PUI_INT_ERROR_INVALID_RESOURCES;
+       }
+
+       return e;
+}
+
+pui_error
+_ani_error_stop(pui_ani_t *ani)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s\n", info->id);
+
+       pui_backend_ani_remove_frame_cb(ani);
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       return e;
+}
+
+
+void
+pui_default_backend_ani_error_func_set(pui_backend_ani_func *func)
+{
+       if (!func) return;
+
+       func->ani_start = _ani_error_start;
+       func->ani_stop = _ani_error_stop;
+}
+
+
diff --git a/backends/notification/default_ani_networkerror.c b/backends/notification/default_ani_networkerror.c
new file mode 100644 (file)
index 0000000..6295946
--- /dev/null
@@ -0,0 +1,205 @@
+/*
+ * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "../default_backend.h"
+
+static void
+_ani_backend_networkerror_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
+{
+       if (!frame) return;
+       if (!r || !g || !b) return;
+       if (led_idx > frame->num_led) return;
+
+       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
+       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
+       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
+}
+
+static void
+_ani_backend_networkerror_free_frame(default_frame_info_t *frame)
+{
+       if (!frame) return;
+
+       if (frame->leds) free(frame->leds);
+       free(frame);
+}
+
+static default_frame_info_t *
+_ani_backend_networkerror_get_frame(default_ani_info *ani_info)
+{
+#define BLINK_FRAME 40
+       default_frame_info_t *frame, *key_frame;
+
+       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
+       if (!frame) return NULL;
+
+       key_frame = &ani_info->frames[0];
+       frame->num_led = key_frame->num_led;
+       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
+       if (!frame->leds)
+       {
+               free(frame);
+               return NULL;
+       }
+
+       if (ani_info->frame_idx % BLINK_FRAME == 0)
+       {
+               for (int i = 0; i < key_frame->num_led; i++)
+               {
+                       frame->leds[i].color = key_frame->leds[i].color;
+               }
+       }
+       else
+       {
+               for (int i = 0; i < key_frame->num_led; i++)
+               {
+                       frame->leds[i].color = 0x000000;
+               }
+       }
+
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= BLINK_FRAME)
+               ani_info->frame_idx = 0;
+
+       return frame;
+}
+
+
+static pui_bool
+_ani_backend_networkerror_frame_cb(void *data, int serial)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_ani_t *ani = (pui_ani_t *)data;
+       pui_backend_ani_data *ani_data = NULL;
+       pui_ani_control_buffer *buffer = NULL;
+       default_frame_info_t *frame;
+       unsigned int r = 0x0, g = 0x0, b = 0x0;
+       double now;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       now = ecore_time_unix_get();
+       pui_info("[time:%.3f] serial=%d\n", now, serial);
+
+       /* TODO : make use of ani_info */
+       //(void) ani_info;
+
+       buffer = pui_backend_ani_get_buffer(ani);
+       if (!buffer) {
+               pui_err("Failed to get buffer for animation\n");
+               return (pui_bool)0;
+       }
+
+       frame = _ani_backend_networkerror_get_frame(ani_info);
+       for(int i = 0; i<12; i++)
+       {
+               _ani_backend_networkerror_get_led_rgb(frame, i, &r, &g, &b);
+               buffer->ptr[4*i] = 0;
+               buffer->ptr[4*i + 1] = b; /* BLUE */
+               buffer->ptr[4*i + 2] = g; /* GREEN */
+               buffer->ptr[4*i + 3] = r; /* RED */
+       }
+       _ani_backend_networkerror_free_frame(frame);
+
+       e = pui_backend_ani_set_buffer(ani, buffer);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       e = pui_backend_ani_update(ani);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on updating animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       pui_info("... update (serial=%d)\n", serial);
+
+       return (pui_bool)1;
+}
+
+pui_error
+_ani_networkerror_start(pui_ani_t *ani, int repeat)
+{
+       pui_bool ret = 0;
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
+
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
+       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_networkerror_frame_cb, info->interval / 1000.0);
+
+       if (!ret)
+       {
+               pui_err("Failed to add frame callback !\n");
+               e = PUI_INT_ERROR_INVALID_RESOURCES;
+       }
+
+       return e;
+}
+
+pui_error
+_ani_networkerror_stop(pui_ani_t *ani)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s\n", info->id);
+
+       pui_backend_ani_remove_frame_cb(ani);
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       return e;
+}
+
+
+void
+pui_default_backend_ani_networkerror_func_set(pui_backend_ani_func *func)
+{
+       if (!func) return;
+
+       func->ani_start = _ani_networkerror_start;
+       func->ani_stop = _ani_networkerror_stop;
+}
+
+
diff --git a/backends/notification/default_ani_normal.c b/backends/notification/default_ani_normal.c
new file mode 100644 (file)
index 0000000..a96d09e
--- /dev/null
@@ -0,0 +1,209 @@
+/*
+ * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "../default_backend.h"
+
+static void
+_ani_backend_normal_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
+{
+       if (!frame) return;
+       if (!r || !g || !b) return;
+       if (led_idx > frame->num_led) return;
+
+       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
+       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
+       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
+}
+
+static void
+_ani_backend_normal_free_frame(default_frame_info_t *frame)
+{
+       if (!frame) return;
+
+       if (frame->leds) free(frame->leds);
+       free(frame);
+}
+
+static default_frame_info_t *
+_ani_backend_normal_get_frame(default_ani_info *ani_info)
+{
+#define SMOOTH_FRAME 15
+       default_frame_info_t *frame, *key_frame, *key_frame2;
+       int idx, idx2;
+       unsigned int r, g, b, r2, g2, b2;
+       int r3, g3, b3;
+       double div;
+
+       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
+       if (!frame) return NULL;
+
+       idx = ((int)(ani_info->frame_idx / SMOOTH_FRAME)) % ani_info->num_key_frames;
+       idx2 = (idx + 1) % ani_info->num_key_frames;
+
+       key_frame = &ani_info->frames[idx];
+       key_frame2 = &ani_info->frames[idx2];
+       frame->num_led = key_frame->num_led;
+       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
+       if (!frame->leds)
+       {
+               free(frame);
+               return NULL;
+       }
+       div = (double)(ani_info->frame_idx % SMOOTH_FRAME) / (double)SMOOTH_FRAME;
+       r = g = b = r2 = g2 = b2 = 0x0;
+       for (int i = 0; i < key_frame->num_led; i++)
+       {
+               _ani_backend_normal_get_led_rgb(key_frame, i, &r, &g, &b);
+               _ani_backend_normal_get_led_rgb(key_frame2, i, &r2, &g2, &b2);
+               r3 = (int)(r2 - r) * div + r;
+               g3 = (int)(g2 - g) * div + g;
+               b3 = (int)(b2 - b) * div + b;
+
+               frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
+       }
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= (ani_info->num_key_frames * SMOOTH_FRAME))
+               ani_info->frame_idx = 0;
+
+       return frame;
+}
+
+
+static pui_bool
+_ani_backend_normal_frame_cb(void *data, int serial)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_ani_t *ani = (pui_ani_t *)data;
+       pui_backend_ani_data *ani_data = NULL;
+       pui_ani_control_buffer *buffer = NULL;
+       default_frame_info_t *frame;
+       unsigned int r = 0x0, g = 0x0, b = 0x0;
+       double now;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       now = ecore_time_unix_get();
+       pui_info("[time:%.3f] serial=%d\n", now, serial);
+
+       /* TODO : make use of ani_info */
+       //(void) ani_info;
+
+       buffer = pui_backend_ani_get_buffer(ani);
+       if (!buffer) {
+               pui_err("Failed to get buffer for animation\n");
+               return (pui_bool)0;
+       }
+
+       frame = _ani_backend_normal_get_frame(ani_info);
+       for(int i = 0; i<12; i++)
+       {
+               _ani_backend_normal_get_led_rgb(frame, i, &r, &g, &b);
+               buffer->ptr[4*i] = 0;
+               buffer->ptr[4*i + 1] = b; /* BLUE */
+               buffer->ptr[4*i + 2] = g; /* GREEN */
+               buffer->ptr[4*i + 3] = r; /* RED */
+       }
+       _ani_backend_normal_free_frame(frame);
+
+       e = pui_backend_ani_set_buffer(ani, buffer);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       e = pui_backend_ani_update(ani);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on updating animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       pui_info("... update (serial=%d)\n", serial);
+
+       return (pui_bool)1;
+}
+
+pui_error
+_ani_normal_start(pui_ani_t *ani, int repeat)
+{
+       pui_bool ret = 0;
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
+
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
+       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_normal_frame_cb, info->interval / 1000.0);
+
+       if (!ret)
+       {
+               pui_err("Failed to add frame callback !\n");
+               e = PUI_INT_ERROR_INVALID_RESOURCES;
+       }
+
+       return e;
+}
+
+pui_error
+_ani_normal_stop(pui_ani_t *ani)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s\n", info->id);
+
+       pui_backend_ani_remove_frame_cb(ani);
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       return e;
+}
+
+
+void
+pui_default_backend_ani_normal_func_set(pui_backend_ani_func *func)
+{
+       if (!func) return;
+
+       func->ani_start = _ani_normal_start;
+       func->ani_stop = _ani_normal_stop;
+}
+
+
diff --git a/backends/res/alarm.json b/backends/res/alarm.json
deleted file mode 100644 (file)
index 75d5ddd..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-{
-       "type": "alarm",
-       "interval": 40,
-       "frame": [
-               {
-                       "frame_id": 1,
-                       "led": [
-                               {"id": 1,  "color": "FFFFFF"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "FFFFFF"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "FFFFFF"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "FFFFFF"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "000000"}
-                       ]
-               },
-               {
-                       "frame_id": 2,
-                       "led": [
-                               {"id": 1,  "color": "000000"},
-                               {"id": 2,  "color": "FFFFFF"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "FFFFFF"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "000000"},
-                               {"id": 8,  "color": "FFFFFF"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "FFFFFF"},
-                               {"id": 12, "color": "000000"}
-                       ]
-               },
-               {
-                       "frame_id": 3,
-                       "led": [
-                               {"id": 1,  "color": "000000"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "000000"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "000000"}
-                       ]
-               },
-               {
-                       "frame_id": 4,
-                       "led": [
-                               {"id": 1,  "color": "000000"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "FFFFFF"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "FFFFFF"},
-                               {"id": 7,  "color": "000000"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "FFFFFF"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "FFFFFF"}
-                       ]
-               },
-               {
-                       "frame_id": 5,
-                       "led": [
-                               {"id": 1,  "color": "FFFFFF"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "FFFFFF"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "FFFFFF"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "FFFFFF"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "000000"}
-                       ]
-               },
-               {
-                       "frame_id": 6,
-                       "led": [
-                               {"id": 1,  "color": "000000"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "000000"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "000000"}
-                       ]
-               }
-       ]
-}
diff --git a/backends/res/bt/connected.json b/backends/res/bt/connected.json
new file mode 100644 (file)
index 0000000..686afa3
--- /dev/null
@@ -0,0 +1,23 @@
+{
+       "type": "bt/connected",
+       "interval": 100,
+       "frame": [
+               {
+                       "frame_id": 1,
+                       "led": [
+                               {"id": 1,  "color": "0000FF"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "000000"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "000000"}
+                       ]
+               }
+       ]
+}
diff --git a/backends/res/bt/pairing.json b/backends/res/bt/pairing.json
new file mode 100644 (file)
index 0000000..c9a75bd
--- /dev/null
@@ -0,0 +1,57 @@
+{
+       "type": "bt/pairing",
+       "interval": 500,
+       "frame": [
+               {
+                       "frame_id": 1,
+                       "led": [
+                               {"id": 1,  "color": "FF0000"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "000000"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "000000"}
+                       ]
+               },
+               {
+                       "frame_id": 2,
+                       "led": [
+                               {"id": 1,  "color": "00FF00"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "000000"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "000000"}
+                       ]
+               },
+               {
+                       "frame_id": 3,
+                       "led": [
+                               {"id": 1,  "color": "0000FF"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "000000"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "000000"}
+                       ]
+               }
+       ]
+}
diff --git a/backends/res/connected.json b/backends/res/connected.json
deleted file mode 100644 (file)
index 9236ea6..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-{
-       "type": "connected",
-       "interval": 100,
-       "frame": [
-               {
-                       "frame_id": 1,
-                       "led": [
-                               {"id": 1,  "color": "0000FF"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "000000"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "000000"}
-                       ]
-               }
-       ]
-}
diff --git a/backends/res/easy_setup.json b/backends/res/easy_setup.json
deleted file mode 100644 (file)
index f10e41c..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-{
-       "type": "easy_setup",
-       "interval": 30,
-       "frame": [
-               {
-                       "frame_id": 1,
-                       "led": [
-                               {"id": 1,  "color": "000022"},
-                               {"id": 2,  "color": "000022"},
-                               {"id": 3,  "color": "000022"},
-                               {"id": 4,  "color": "000022"},
-                               {"id": 5,  "color": "000022"},
-                               {"id": 6,  "color": "000022"},
-                               {"id": 7,  "color": "000022"},
-                               {"id": 8,  "color": "000022"},
-                               {"id": 9,  "color": "000022"},
-                               {"id": 10, "color": "000022"},
-                               {"id": 11, "color": "000022"},
-                               {"id": 12, "color": "000022"}
-                       ]
-               },
-               {
-                       "frame_id": 2,
-                       "led": [
-                               {"id": 1,  "color": "0000ee"},
-                               {"id": 2,  "color": "0000ee"},
-                               {"id": 3,  "color": "0000ee"},
-                               {"id": 4,  "color": "0000ee"},
-                               {"id": 5,  "color": "0000ee"},
-                               {"id": 6,  "color": "0000ee"},
-                               {"id": 7,  "color": "0000ee"},
-                               {"id": 8,  "color": "0000ee"},
-                               {"id": 9,  "color": "0000ee"},
-                               {"id": 10, "color": "0000ee"},
-                               {"id": 11, "color": "0000ee"},
-                               {"id": 12, "color": "0000ee"}
-                       ]
-               },
-       ]
-}
diff --git a/backends/res/emergency.json b/backends/res/emergency.json
deleted file mode 100644 (file)
index e2c393c..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-{
-       "type": "emergency",
-       "interval": 30,
-       "frame": [
-               {
-                       "frame_id": 1,
-                       "led": [
-                               {"id": 1,  "color": "FF0000"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "FF0000"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "000000"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "FF0000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "000000"}
-                       ]
-               },
-               {
-                       "frame_id": 2,
-                       "led": [
-                               {"id": 1,  "color": "000000"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "FF0000"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "FF0000"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "FF0000"},
-                               {"id": 12, "color": "000000"}
-                       ]
-               }
-       ]
-}
diff --git a/backends/res/error.json b/backends/res/error.json
deleted file mode 100644 (file)
index 7170501..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-{
-       "type": "error",
-       "interval": 500,
-       "frame": [
-               {
-                       "frame_id": 1,
-                       "led": [
-                               {"id": 1,  "color": "FF0000"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "000000"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "000000"}
-                       ]
-               }
-       ]
-}
diff --git a/backends/res/listening.json b/backends/res/listening.json
deleted file mode 100644 (file)
index e2343ea..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-{
-       "type": "listening",
-       "interval": 70,
-       "frame": [
-               {
-                       "frame_id": 1,
-                       "led": [
-                               {"id": 1,  "color": "000000"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "ffffff"},
-                               {"id": 7,  "color": "ffffff"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "000000"}
-                       ]
-               },
-               {
-                       "frame_id": 2,
-                       "led": [
-                               {"id": 1,  "color": "ffffff"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "000000"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "ffffff"}
-                       ]
-               },
-       ]
-}
diff --git a/backends/res/mic_off.json b/backends/res/mic_off.json
deleted file mode 100644 (file)
index 2100636..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-{
-       "type": "mic_off",
-       "interval": 100,
-       "frame": [
-               {
-                       "frame_id": 1,
-                       "led": [
-                               {"id": 1,  "color": "FF0000"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "000000"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "000000"}
-                       ]
-               }
-       ]
-}
diff --git a/backends/res/network_error.json b/backends/res/network_error.json
deleted file mode 100644 (file)
index 6869777..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-{
-       "type": "network_error",
-       "interval": 100,
-       "frame": [
-               {
-                       "frame_id": 1,
-                       "led": [
-                               {"id": 1,  "color": "FF0000"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "000000"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "000000"}
-                       ]
-               }
-       ]
-}
diff --git a/backends/res/normal.json b/backends/res/normal.json
deleted file mode 100644 (file)
index ee4aebf..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-{
-       "type": "normal",
-       "interval": 50,
-       "frame": [
-               {
-                       "frame_id": 1,
-                       "led": [
-                               {"id": 1,  "color": "000000"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "FFFFFF"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "000000"}
-                       ]
-               },
-               {
-                       "frame_id": 2,
-                       "led": [
-                               {"id": 1,  "color": "000000"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "000000"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "000000"}
-                       ]
-               },
-               {
-                       "frame_id": 3,
-                       "led": [
-                               {"id": 1,  "color": "000000"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "FFFFFF"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "000000"}
-                       ]
-               }
-       ]
-}
diff --git a/backends/res/notification/alarm.json b/backends/res/notification/alarm.json
new file mode 100644 (file)
index 0000000..46a15b1
--- /dev/null
@@ -0,0 +1,108 @@
+{
+       "type": "notification/alarm",
+       "interval": 40,
+       "frame": [
+               {
+                       "frame_id": 1,
+                       "led": [
+                               {"id": 1,  "color": "FFFFFF"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "FFFFFF"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "FFFFFF"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "FFFFFF"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "000000"}
+                       ]
+               },
+               {
+                       "frame_id": 2,
+                       "led": [
+                               {"id": 1,  "color": "000000"},
+                               {"id": 2,  "color": "FFFFFF"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "FFFFFF"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "000000"},
+                               {"id": 8,  "color": "FFFFFF"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "FFFFFF"},
+                               {"id": 12, "color": "000000"}
+                       ]
+               },
+               {
+                       "frame_id": 3,
+                       "led": [
+                               {"id": 1,  "color": "000000"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "000000"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "000000"}
+                       ]
+               },
+               {
+                       "frame_id": 4,
+                       "led": [
+                               {"id": 1,  "color": "000000"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "FFFFFF"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "FFFFFF"},
+                               {"id": 7,  "color": "000000"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "FFFFFF"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "FFFFFF"}
+                       ]
+               },
+               {
+                       "frame_id": 5,
+                       "led": [
+                               {"id": 1,  "color": "FFFFFF"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "FFFFFF"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "FFFFFF"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "FFFFFF"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "000000"}
+                       ]
+               },
+               {
+                       "frame_id": 6,
+                       "led": [
+                               {"id": 1,  "color": "000000"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "000000"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "000000"}
+                       ]
+               }
+       ]
+}
diff --git a/backends/res/notification/emergency.json b/backends/res/notification/emergency.json
new file mode 100644 (file)
index 0000000..8e8046f
--- /dev/null
@@ -0,0 +1,40 @@
+{
+       "type": "notification/emergency",
+       "interval": 30,
+       "frame": [
+               {
+                       "frame_id": 1,
+                       "led": [
+                               {"id": 1,  "color": "FF0000"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "FF0000"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "000000"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "FF0000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "000000"}
+                       ]
+               },
+               {
+                       "frame_id": 2,
+                       "led": [
+                               {"id": 1,  "color": "000000"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "FF0000"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "FF0000"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "FF0000"},
+                               {"id": 12, "color": "000000"}
+                       ]
+               }
+       ]
+}
diff --git a/backends/res/notification/error.json b/backends/res/notification/error.json
new file mode 100644 (file)
index 0000000..f147b72
--- /dev/null
@@ -0,0 +1,23 @@
+{
+       "type": "notification/error",
+       "interval": 500,
+       "frame": [
+               {
+                       "frame_id": 1,
+                       "led": [
+                               {"id": 1,  "color": "FF0000"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "000000"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "000000"}
+                       ]
+               }
+       ]
+}
diff --git a/backends/res/notification/network_error.json b/backends/res/notification/network_error.json
new file mode 100644 (file)
index 0000000..75304de
--- /dev/null
@@ -0,0 +1,23 @@
+{
+       "type": "notification/network_error",
+       "interval": 100,
+       "frame": [
+               {
+                       "frame_id": 1,
+                       "led": [
+                               {"id": 1,  "color": "FF0000"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "000000"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "000000"}
+                       ]
+               }
+       ]
+}
diff --git a/backends/res/notification/normal.json b/backends/res/notification/normal.json
new file mode 100644 (file)
index 0000000..acad93a
--- /dev/null
@@ -0,0 +1,57 @@
+{
+       "type": "notification/normal",
+       "interval": 50,
+       "frame": [
+               {
+                       "frame_id": 1,
+                       "led": [
+                               {"id": 1,  "color": "000000"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "FFFFFF"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "000000"}
+                       ]
+               },
+               {
+                       "frame_id": 2,
+                       "led": [
+                               {"id": 1,  "color": "000000"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "000000"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "000000"}
+                       ]
+               },
+               {
+                       "frame_id": 3,
+                       "led": [
+                               {"id": 1,  "color": "000000"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "FFFFFF"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "000000"}
+                       ]
+               }
+       ]
+}
diff --git a/backends/res/pairing.json b/backends/res/pairing.json
deleted file mode 100644 (file)
index 4db2bc6..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-{
-       "type": "pairing",
-       "interval": 500,
-       "frame": [
-               {
-                       "frame_id": 1,
-                       "led": [
-                               {"id": 1,  "color": "FF0000"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "000000"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "000000"}
-                       ]
-               },
-               {
-                       "frame_id": 2,
-                       "led": [
-                               {"id": 1,  "color": "00FF00"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "000000"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "000000"}
-                       ]
-               },
-               {
-                       "frame_id": 3,
-                       "led": [
-                               {"id": 1,  "color": "0000FF"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "000000"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "000000"}
-                       ]
-               }
-       ]
-}
diff --git a/backends/res/processing.json b/backends/res/processing.json
deleted file mode 100644 (file)
index a402de9..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-{
-       "type": "processing",
-       "interval": 100,
-       "frame": [
-               {
-                       "frame_id": 1,
-                       "led": [
-                               {"id": 1,  "color": "bbbbbb"},
-                               {"id": 2,  "color": "a0a0a0"},
-                               {"id": 3,  "color": "909090"},
-                               {"id": 4,  "color": "666666"},
-                               {"id": 5,  "color": "454545"},
-                               {"id": 6,  "color": "202020"},
-                               {"id": 7,  "color": "000000"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "000000"},
-                       ]
-               },
-       ]
-}
diff --git a/backends/res/speaking.json b/backends/res/speaking.json
deleted file mode 100644 (file)
index 0071822..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-{
-       "type": "speaking",
-       "interval": 30,
-       "frame": [
-               {
-                       "frame_id": 1,
-                       "led": [
-                               {"id": 1,  "color": "222222"},
-                               {"id": 2,  "color": "222222"},
-                               {"id": 3,  "color": "222222"},
-                               {"id": 4,  "color": "222222"},
-                               {"id": 5,  "color": "222222"},
-                               {"id": 6,  "color": "222222"},
-                               {"id": 7,  "color": "222222"},
-                               {"id": 8,  "color": "222222"},
-                               {"id": 9,  "color": "222222"},
-                               {"id": 10, "color": "222222"},
-                               {"id": 11, "color": "222222"},
-                               {"id": 12, "color": "222222"}
-                       ]
-               },
-               {
-                       "frame_id": 2,
-                       "led": [
-                               {"id": 1,  "color": "eeeeee"},
-                               {"id": 2,  "color": "eeeeee"},
-                               {"id": 3,  "color": "eeeeee"},
-                               {"id": 4,  "color": "eeeeee"},
-                               {"id": 5,  "color": "eeeeee"},
-                               {"id": 6,  "color": "eeeeee"},
-                               {"id": 7,  "color": "eeeeee"},
-                               {"id": 8,  "color": "eeeeee"},
-                               {"id": 9,  "color": "eeeeee"},
-                               {"id": 10, "color": "eeeeee"},
-                               {"id": 11, "color": "eeeeee"},
-                               {"id": 12, "color": "eeeeee"}
-                       ]
-               },
-       ]
-}
diff --git a/backends/res/streaming.json b/backends/res/streaming.json
deleted file mode 100644 (file)
index c1e87f0..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-{
-       "type": "streaming",
-       "interval": 30,
-       "frame": [
-               {
-                       "frame_id": 1,
-                       "led": [
-                               {"id": 1,  "color": "ffffff"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "000000"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "ffffff"}
-                       ]
-               },
-               {
-                       "frame_id": 2,
-                       "led": [
-                               {"id": 1,  "color": "222222"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "000000"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "222222"}
-                       ]
-               },
-       ]
-}
diff --git a/backends/res/sw_update_done.json b/backends/res/sw_update_done.json
deleted file mode 100644 (file)
index 3d89f5b..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-{
-       "type": "sw_update_done",
-       "interval": 30,
-       "frame": [
-               {
-                       "frame_id": 1,
-                       "led": [
-                               {"id": 1,  "color": "222222"},
-                               {"id": 2,  "color": "222222"},
-                               {"id": 3,  "color": "222222"},
-                               {"id": 4,  "color": "222222"},
-                               {"id": 5,  "color": "222222"},
-                               {"id": 6,  "color": "222222"},
-                               {"id": 7,  "color": "222222"},
-                               {"id": 8,  "color": "222222"},
-                               {"id": 9,  "color": "222222"},
-                               {"id": 10, "color": "222222"},
-                               {"id": 11, "color": "222222"},
-                               {"id": 12, "color": "222222"}
-                       ]
-               },
-               {
-                       "frame_id": 2,
-                       "led": [
-                               {"id": 1,  "color": "eeeeee"},
-                               {"id": 2,  "color": "eeeeee"},
-                               {"id": 3,  "color": "eeeeee"},
-                               {"id": 4,  "color": "eeeeee"},
-                               {"id": 5,  "color": "eeeeee"},
-                               {"id": 6,  "color": "eeeeee"},
-                               {"id": 7,  "color": "eeeeee"},
-                               {"id": 8,  "color": "eeeeee"},
-                               {"id": 9,  "color": "eeeeee"},
-                               {"id": 10, "color": "eeeeee"},
-                               {"id": 11, "color": "eeeeee"},
-                               {"id": 12, "color": "eeeeee"}
-                       ]
-               },
-               {
-                       "frame_id": 3,
-                       "led": [
-                               {"id": 1,  "color": "000000"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "000000"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "000000"}
-                       ]
-               },
-       ]
-}
diff --git a/backends/res/system/easy_setup.json b/backends/res/system/easy_setup.json
new file mode 100644 (file)
index 0000000..72b92f2
--- /dev/null
@@ -0,0 +1,40 @@
+{
+       "type": "system/easy_setup",
+       "interval": 30,
+       "frame": [
+               {
+                       "frame_id": 1,
+                       "led": [
+                               {"id": 1,  "color": "000022"},
+                               {"id": 2,  "color": "000022"},
+                               {"id": 3,  "color": "000022"},
+                               {"id": 4,  "color": "000022"},
+                               {"id": 5,  "color": "000022"},
+                               {"id": 6,  "color": "000022"},
+                               {"id": 7,  "color": "000022"},
+                               {"id": 8,  "color": "000022"},
+                               {"id": 9,  "color": "000022"},
+                               {"id": 10, "color": "000022"},
+                               {"id": 11, "color": "000022"},
+                               {"id": 12, "color": "000022"}
+                       ]
+               },
+               {
+                       "frame_id": 2,
+                       "led": [
+                               {"id": 1,  "color": "0000ee"},
+                               {"id": 2,  "color": "0000ee"},
+                               {"id": 3,  "color": "0000ee"},
+                               {"id": 4,  "color": "0000ee"},
+                               {"id": 5,  "color": "0000ee"},
+                               {"id": 6,  "color": "0000ee"},
+                               {"id": 7,  "color": "0000ee"},
+                               {"id": 8,  "color": "0000ee"},
+                               {"id": 9,  "color": "0000ee"},
+                               {"id": 10, "color": "0000ee"},
+                               {"id": 11, "color": "0000ee"},
+                               {"id": 12, "color": "0000ee"}
+                       ]
+               },
+       ]
+}
diff --git a/backends/res/system/mic_off.json b/backends/res/system/mic_off.json
new file mode 100644 (file)
index 0000000..76faba5
--- /dev/null
@@ -0,0 +1,23 @@
+{
+       "type": "system/mic_off",
+       "interval": 100,
+       "frame": [
+               {
+                       "frame_id": 1,
+                       "led": [
+                               {"id": 1,  "color": "FF0000"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "000000"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "000000"}
+                       ]
+               }
+       ]
+}
diff --git a/backends/res/system/processing.json b/backends/res/system/processing.json
new file mode 100644 (file)
index 0000000..540eccf
--- /dev/null
@@ -0,0 +1,23 @@
+{
+       "type": "system/processing",
+       "interval": 100,
+       "frame": [
+               {
+                       "frame_id": 1,
+                       "led": [
+                               {"id": 1,  "color": "bbbbbb"},
+                               {"id": 2,  "color": "a0a0a0"},
+                               {"id": 3,  "color": "909090"},
+                               {"id": 4,  "color": "666666"},
+                               {"id": 5,  "color": "454545"},
+                               {"id": 6,  "color": "202020"},
+                               {"id": 7,  "color": "000000"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "000000"},
+                       ]
+               },
+       ]
+}
diff --git a/backends/res/system/sw_update_done.json b/backends/res/system/sw_update_done.json
new file mode 100644 (file)
index 0000000..a250ce1
--- /dev/null
@@ -0,0 +1,57 @@
+{
+       "type": "system/sw_update_done",
+       "interval": 30,
+       "frame": [
+               {
+                       "frame_id": 1,
+                       "led": [
+                               {"id": 1,  "color": "222222"},
+                               {"id": 2,  "color": "222222"},
+                               {"id": 3,  "color": "222222"},
+                               {"id": 4,  "color": "222222"},
+                               {"id": 5,  "color": "222222"},
+                               {"id": 6,  "color": "222222"},
+                               {"id": 7,  "color": "222222"},
+                               {"id": 8,  "color": "222222"},
+                               {"id": 9,  "color": "222222"},
+                               {"id": 10, "color": "222222"},
+                               {"id": 11, "color": "222222"},
+                               {"id": 12, "color": "222222"}
+                       ]
+               },
+               {
+                       "frame_id": 2,
+                       "led": [
+                               {"id": 1,  "color": "eeeeee"},
+                               {"id": 2,  "color": "eeeeee"},
+                               {"id": 3,  "color": "eeeeee"},
+                               {"id": 4,  "color": "eeeeee"},
+                               {"id": 5,  "color": "eeeeee"},
+                               {"id": 6,  "color": "eeeeee"},
+                               {"id": 7,  "color": "eeeeee"},
+                               {"id": 8,  "color": "eeeeee"},
+                               {"id": 9,  "color": "eeeeee"},
+                               {"id": 10, "color": "eeeeee"},
+                               {"id": 11, "color": "eeeeee"},
+                               {"id": 12, "color": "eeeeee"}
+                       ]
+               },
+               {
+                       "frame_id": 3,
+                       "led": [
+                               {"id": 1,  "color": "000000"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "000000"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "000000"}
+                       ]
+               },
+       ]
+}
diff --git a/backends/res/system_processing.json b/backends/res/system_processing.json
deleted file mode 100644 (file)
index a3a037a..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-{
-       "type": "system_processing",
-       "interval": 100,
-       "frame": [
-               {
-                       "frame_id": 1,
-                       "led": [
-                               {"id": 1,  "color": "bbbbbb"},
-                               {"id": 2,  "color": "a0a0a0"},
-                               {"id": 3,  "color": "909090"},
-                               {"id": 4,  "color": "666666"},
-                               {"id": 5,  "color": "454545"},
-                               {"id": 6,  "color": "202020"},
-                               {"id": 7,  "color": "000000"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "000000"},
-                       ]
-               },
-       ]
-}
diff --git a/backends/res/timeout.json b/backends/res/timeout.json
deleted file mode 100644 (file)
index 4f28a69..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-{
-       "type": "time_out",
-       "interval": 30,
-       "frame": [
-               {
-                       "frame_id": 1,
-                       "led": [
-                               {"id": 1,  "color": "ffffff"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "000000"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "ffffff"}
-                       ]
-               },
-               {
-                       "frame_id": 2,
-                       "led": [
-                               {"id": 1,  "color": "444444"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "000000"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "444444"}
-                       ]
-               },
-               {
-                       "frame_id": 3,
-                       "led": [
-                               {"id": 1,  "color": "ffffff"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "000000"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "ffffff"}
-                       ]
-               },
-               {
-                       "frame_id": 4,
-                       "led": [
-                               {"id": 1,  "color": "ffffff"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "000000"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "ffffff"}
-                       ]
-               },
-               {
-                       "frame_id": 5,
-                       "led": [
-                               {"id": 1,  "color": "000000"},
-                               {"id": 2,  "color": "000000"},
-                               {"id": 3,  "color": "000000"},
-                               {"id": 4,  "color": "000000"},
-                               {"id": 5,  "color": "000000"},
-                               {"id": 6,  "color": "000000"},
-                               {"id": 7,  "color": "000000"},
-                               {"id": 8,  "color": "000000"},
-                               {"id": 9,  "color": "000000"},
-                               {"id": 10, "color": "000000"},
-                               {"id": 11, "color": "000000"},
-                               {"id": 12, "color": "000000"}
-                       ]
-               }
-       ]
-}
diff --git a/backends/res/voice/listening.json b/backends/res/voice/listening.json
new file mode 100644 (file)
index 0000000..f38ad5b
--- /dev/null
@@ -0,0 +1,40 @@
+{
+       "type": "voice/listening",
+       "interval": 70,
+       "frame": [
+               {
+                       "frame_id": 1,
+                       "led": [
+                               {"id": 1,  "color": "000000"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "ffffff"},
+                               {"id": 7,  "color": "ffffff"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "000000"}
+                       ]
+               },
+               {
+                       "frame_id": 2,
+                       "led": [
+                               {"id": 1,  "color": "ffffff"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "000000"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "ffffff"}
+                       ]
+               },
+       ]
+}
diff --git a/backends/res/voice/processing.json b/backends/res/voice/processing.json
new file mode 100644 (file)
index 0000000..a49e2ee
--- /dev/null
@@ -0,0 +1,23 @@
+{
+       "type": "voice/processing",
+       "interval": 100,
+       "frame": [
+               {
+                       "frame_id": 1,
+                       "led": [
+                               {"id": 1,  "color": "bbbbbb"},
+                               {"id": 2,  "color": "a0a0a0"},
+                               {"id": 3,  "color": "909090"},
+                               {"id": 4,  "color": "666666"},
+                               {"id": 5,  "color": "454545"},
+                               {"id": 6,  "color": "202020"},
+                               {"id": 7,  "color": "000000"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "000000"},
+                       ]
+               },
+       ]
+}
diff --git a/backends/res/voice/speaking.json b/backends/res/voice/speaking.json
new file mode 100644 (file)
index 0000000..5f514a1
--- /dev/null
@@ -0,0 +1,40 @@
+{
+       "type": "voice/speaking",
+       "interval": 30,
+       "frame": [
+               {
+                       "frame_id": 1,
+                       "led": [
+                               {"id": 1,  "color": "222222"},
+                               {"id": 2,  "color": "222222"},
+                               {"id": 3,  "color": "222222"},
+                               {"id": 4,  "color": "222222"},
+                               {"id": 5,  "color": "222222"},
+                               {"id": 6,  "color": "222222"},
+                               {"id": 7,  "color": "222222"},
+                               {"id": 8,  "color": "222222"},
+                               {"id": 9,  "color": "222222"},
+                               {"id": 10, "color": "222222"},
+                               {"id": 11, "color": "222222"},
+                               {"id": 12, "color": "222222"}
+                       ]
+               },
+               {
+                       "frame_id": 2,
+                       "led": [
+                               {"id": 1,  "color": "eeeeee"},
+                               {"id": 2,  "color": "eeeeee"},
+                               {"id": 3,  "color": "eeeeee"},
+                               {"id": 4,  "color": "eeeeee"},
+                               {"id": 5,  "color": "eeeeee"},
+                               {"id": 6,  "color": "eeeeee"},
+                               {"id": 7,  "color": "eeeeee"},
+                               {"id": 8,  "color": "eeeeee"},
+                               {"id": 9,  "color": "eeeeee"},
+                               {"id": 10, "color": "eeeeee"},
+                               {"id": 11, "color": "eeeeee"},
+                               {"id": 12, "color": "eeeeee"}
+                       ]
+               },
+       ]
+}
diff --git a/backends/res/voice/streaming.json b/backends/res/voice/streaming.json
new file mode 100644 (file)
index 0000000..6328c51
--- /dev/null
@@ -0,0 +1,40 @@
+{
+       "type": "voice/streaming",
+       "interval": 30,
+       "frame": [
+               {
+                       "frame_id": 1,
+                       "led": [
+                               {"id": 1,  "color": "ffffff"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "000000"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "ffffff"}
+                       ]
+               },
+               {
+                       "frame_id": 2,
+                       "led": [
+                               {"id": 1,  "color": "222222"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "000000"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "222222"}
+                       ]
+               },
+       ]
+}
diff --git a/backends/res/voice/timeout.json b/backends/res/voice/timeout.json
new file mode 100644 (file)
index 0000000..fffbe5b
--- /dev/null
@@ -0,0 +1,91 @@
+{
+       "type": "voice/timeout",
+       "interval": 30,
+       "frame": [
+               {
+                       "frame_id": 1,
+                       "led": [
+                               {"id": 1,  "color": "ffffff"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "000000"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "ffffff"}
+                       ]
+               },
+               {
+                       "frame_id": 2,
+                       "led": [
+                               {"id": 1,  "color": "444444"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "000000"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "444444"}
+                       ]
+               },
+               {
+                       "frame_id": 3,
+                       "led": [
+                               {"id": 1,  "color": "ffffff"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "000000"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "ffffff"}
+                       ]
+               },
+               {
+                       "frame_id": 4,
+                       "led": [
+                               {"id": 1,  "color": "ffffff"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "000000"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "ffffff"}
+                       ]
+               },
+               {
+                       "frame_id": 5,
+                       "led": [
+                               {"id": 1,  "color": "000000"},
+                               {"id": 2,  "color": "000000"},
+                               {"id": 3,  "color": "000000"},
+                               {"id": 4,  "color": "000000"},
+                               {"id": 5,  "color": "000000"},
+                               {"id": 6,  "color": "000000"},
+                               {"id": 7,  "color": "000000"},
+                               {"id": 8,  "color": "000000"},
+                               {"id": 9,  "color": "000000"},
+                               {"id": 10, "color": "000000"},
+                               {"id": 11, "color": "000000"},
+                               {"id": 12, "color": "000000"}
+                       ]
+               }
+       ]
+}
diff --git a/backends/system/default_ani_easysetup.c b/backends/system/default_ani_easysetup.c
new file mode 100644 (file)
index 0000000..f4b611c
--- /dev/null
@@ -0,0 +1,206 @@
+/*
+ * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "../default_backend.h"
+
+static void
+_ani_backend_easysetup_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
+{
+       if (!frame) return;
+       if (!r || !g || !b) return;
+       if (led_idx > frame->num_led) return;
+
+       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
+       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
+       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
+}
+
+static void
+_ani_backend_easysetup_free_frame(default_frame_info_t *frame)
+{
+       if (!frame) return;
+
+       if (frame->leds) free(frame->leds);
+       free(frame);
+}
+
+static default_frame_info_t *
+_ani_backend_easysetup_get_frame(default_ani_info *ani_info)
+{
+#define SMOOTH_FRAME 20
+       default_frame_info_t *frame, *key_frame, *key_frame2;
+       int idx, idx2;
+       unsigned int r, g, b, r2, g2, b2;
+       int r3, g3, b3;
+       double div;
+
+       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
+       if (!frame) return NULL;
+
+       idx = ((int)(ani_info->frame_idx / SMOOTH_FRAME)) % ani_info->num_key_frames;
+       idx2 = (idx + 1) % ani_info->num_key_frames;
+
+       key_frame = &ani_info->frames[idx];
+       key_frame2 = &ani_info->frames[idx2];
+       frame->num_led = key_frame->num_led;
+       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
+       if (!frame->leds)
+       {
+               free(frame);
+               return NULL;
+       }
+       div = (double)(ani_info->frame_idx % SMOOTH_FRAME) / (double)SMOOTH_FRAME;
+       r = g = b = r2 = g2 = b2 = 0x0;
+       for (int i = 0; i < key_frame->num_led; i++)
+       {
+               _ani_backend_easysetup_get_led_rgb(key_frame, i, &r, &g, &b);
+               _ani_backend_easysetup_get_led_rgb(key_frame2, i, &r2, &g2, &b2);
+               r3 = (int)(r2 - r) * div + r;
+               g3 = (int)(g2 - g) * div + g;
+               b3 = (int)(b2 - b) * div + b;
+
+               frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
+       }
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= (ani_info->num_key_frames * SMOOTH_FRAME))
+               ani_info->frame_idx = 0;
+
+       return frame;
+}
+
+static pui_bool
+_ani_backend_easysetup_frame_cb(void *data, int serial)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_ani_t *ani = (pui_ani_t *)data;
+       pui_backend_ani_data *ani_data = NULL;
+       pui_ani_control_buffer *buffer = NULL;
+       default_frame_info_t *frame;
+       unsigned int r = 0x0, g = 0x0, b = 0x0;
+       double now;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       now = ecore_time_unix_get();
+       pui_info("[time:%.3f] serial=%d\n", now, serial);
+
+       /* TODO : make use of ani_info */
+       //(void) ani_info;
+
+       buffer = pui_backend_ani_get_buffer(ani);
+       if (!buffer) {
+               pui_err("Failed to get buffer for animation\n");
+               return (pui_bool)0;
+       }
+
+       frame = _ani_backend_easysetup_get_frame(ani_info);
+       for(int i = 0; i<12; i++)
+       {
+               _ani_backend_easysetup_get_led_rgb(frame, i, &r, &g, &b);
+               buffer->ptr[4*i] = 0;
+               buffer->ptr[4*i + 1] = b; /* BLUE */
+               buffer->ptr[4*i + 2] = g; /* GREEN */
+               buffer->ptr[4*i + 3] = r; /* RED */
+       }
+       _ani_backend_easysetup_free_frame(frame);
+
+       e = pui_backend_ani_set_buffer(ani, buffer);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       e = pui_backend_ani_update(ani);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on updating animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       pui_info("... update (serial=%d)\n", serial);
+
+       return (pui_bool)1;
+}
+
+pui_error
+_ani_easysetup_start(pui_ani_t *ani, int repeat)
+{
+       pui_bool ret = 0;
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
+
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
+       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_easysetup_frame_cb, info->interval / 1000.0);
+
+       if (!ret)
+       {
+               pui_err("Failed to add frame callback !\n");
+               e = PUI_INT_ERROR_INVALID_RESOURCES;
+       }
+
+       return e;
+}
+
+pui_error
+_ani_easysetup_stop(pui_ani_t *ani)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s\n", info->id);
+
+       pui_backend_ani_remove_frame_cb(ani);
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       return e;
+}
+
+
+void
+pui_default_backend_ani_easysetup_func_set(pui_backend_ani_func *func)
+{
+       if (!func) return;
+
+       func->ani_start = _ani_easysetup_start;
+       func->ani_stop = _ani_easysetup_stop;
+}
diff --git a/backends/system/default_ani_micoff.c b/backends/system/default_ani_micoff.c
new file mode 100644 (file)
index 0000000..8ea4583
--- /dev/null
@@ -0,0 +1,191 @@
+/*
+ * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "../default_backend.h"
+
+static void
+_ani_backend_micoff_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
+{
+       if (!frame) return;
+       if (!r || !g || !b) return;
+       if (led_idx > frame->num_led) return;
+
+       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
+       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
+       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
+}
+
+static void
+_ani_backend_micoff_free_frame(default_frame_info_t *frame)
+{
+       if (!frame) return;
+
+       if (frame->leds) free(frame->leds);
+       free(frame);
+}
+
+static default_frame_info_t *
+_ani_backend_micoff_get_frame(default_ani_info *ani_info)
+{
+#define SMOOTH_FRAME 15
+       default_frame_info_t *frame, *key_frame;
+
+       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
+       if (!frame) return NULL;
+
+       key_frame = &ani_info->frames[0];
+       frame->num_led = key_frame->num_led;
+       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
+       if (!frame->leds)
+       {
+               free(frame);
+               return NULL;
+       }
+
+       for (int i = 0; i < key_frame->num_led; i++)
+       {
+               frame->leds[i].color = key_frame->leds[i].color;
+       }
+
+       return frame;
+}
+
+
+static pui_bool
+_ani_backend_micoff_frame_cb(void *data, int serial)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_ani_t *ani = (pui_ani_t *)data;
+       pui_backend_ani_data *ani_data = NULL;
+       pui_ani_control_buffer *buffer = NULL;
+       default_frame_info_t *frame;
+       unsigned int r = 0x0, g = 0x0, b = 0x0;
+       double now;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       now = ecore_time_unix_get();
+       pui_info("[time:%.3f] serial=%d\n", now, serial);
+
+       /* TODO : make use of ani_info */
+       //(void) ani_info;
+
+       buffer = pui_backend_ani_get_buffer(ani);
+       if (!buffer) {
+               pui_err("Failed to get buffer for animation\n");
+               return (pui_bool)0;
+       }
+
+       frame = _ani_backend_micoff_get_frame(ani_info);
+       for(int i = 0; i<12; i++)
+       {
+               _ani_backend_micoff_get_led_rgb(frame, i, &r, &g, &b);
+               buffer->ptr[4*i] = 0;
+               buffer->ptr[4*i + 1] = b; /* BLUE */
+               buffer->ptr[4*i + 2] = g; /* GREEN */
+               buffer->ptr[4*i + 3] = r; /* RED */
+       }
+       _ani_backend_micoff_free_frame(frame);
+
+       e = pui_backend_ani_set_buffer(ani, buffer);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       e = pui_backend_ani_update(ani);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on updating animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       pui_info("... update (serial=%d)\n", serial);
+
+       return (pui_bool)1;
+}
+
+pui_error
+_ani_micoff_start(pui_ani_t *ani, int repeat)
+{
+       pui_bool ret = 0;
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
+
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
+       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_micoff_frame_cb, info->interval / 1000.0);
+
+       if (!ret)
+       {
+               pui_err("Failed to add frame callback !\n");
+               e = PUI_INT_ERROR_INVALID_RESOURCES;
+       }
+
+       return e;
+}
+
+pui_error
+_ani_micoff_stop(pui_ani_t *ani)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s\n", info->id);
+
+       pui_backend_ani_remove_frame_cb(ani);
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       return e;
+}
+
+
+void
+pui_default_backend_ani_micoff_func_set(pui_backend_ani_func *func)
+{
+       if (!func) return;
+
+       func->ani_start = _ani_micoff_start;
+       func->ani_stop = _ani_micoff_stop;
+}
+
+
diff --git a/backends/system/default_ani_swupdatedone.c b/backends/system/default_ani_swupdatedone.c
new file mode 100644 (file)
index 0000000..139bf13
--- /dev/null
@@ -0,0 +1,208 @@
+/*
+ * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "../default_backend.h"
+
+static void
+_ani_backend_swupdatedone_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
+{
+       if (!frame) return;
+       if (!r || !g || !b) return;
+       if (led_idx > frame->num_led) return;
+
+       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
+       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
+       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
+}
+
+static void
+_ani_backend_swupdatedone_free_frame(default_frame_info_t *frame)
+{
+       if (!frame) return;
+
+       if (frame->leds) free(frame->leds);
+       free(frame);
+}
+
+static default_frame_info_t *
+_ani_backend_swupdatedone_get_frame(default_ani_info *ani_info)
+{
+#define SMOOTH_FRAME 20
+       default_frame_info_t *frame, *key_frame, *key_frame2;
+       int idx, idx2;
+       unsigned int r, g, b, r2, g2, b2;
+       int r3, g3, b3;
+       double div;
+
+       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
+       if (!frame) return NULL;
+
+       idx = ((int)(ani_info->frame_idx / SMOOTH_FRAME)) % ani_info->num_key_frames;
+       idx2 = (idx + 1) % ani_info->num_key_frames;
+
+       key_frame = &ani_info->frames[idx];
+       key_frame2 = &ani_info->frames[idx2];
+       frame->num_led = key_frame->num_led;
+       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
+       if (!frame->leds)
+       {
+               free(frame);
+               return NULL;
+       }
+       div = (double)(ani_info->frame_idx % SMOOTH_FRAME) / (double)SMOOTH_FRAME;
+       r = g = b = r2 = g2 = b2 = 0x0;
+       for (int i = 0; i < key_frame->num_led; i++)
+       {
+               _ani_backend_swupdatedone_get_led_rgb(key_frame, i, &r, &g, &b);
+               _ani_backend_swupdatedone_get_led_rgb(key_frame2, i, &r2, &g2, &b2);
+               r3 = (int)(r2 - r) * div + r;
+               g3 = (int)(g2 - g) * div + g;
+               b3 = (int)(b2 - b) * div + b;
+
+               frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
+       }
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= (ani_info->num_key_frames * SMOOTH_FRAME))
+               ani_info->frame_idx = 0;
+
+       return frame;
+}
+
+static pui_bool
+_ani_backend_swupdatedone_frame_cb(void *data, int serial)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_ani_t *ani = (pui_ani_t *)data;
+       pui_backend_ani_data *ani_data = NULL;
+       pui_ani_control_buffer *buffer = NULL;
+       default_frame_info_t *frame;
+       unsigned int r = 0x0, g = 0x0, b = 0x0;
+       double now;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       now = ecore_time_unix_get();
+       pui_info("[time:%.3f] serial=%d\n", now, serial);
+
+       /* TODO : make use of ani_info */
+       //(void) ani_info;
+
+       buffer = pui_backend_ani_get_buffer(ani);
+       if (!buffer) {
+               pui_err("Failed to get buffer for animation\n");
+               return (pui_bool)0;
+       }
+
+       frame = _ani_backend_swupdatedone_get_frame(ani_info);
+       for(int i = 0; i<12; i++)
+       {
+               _ani_backend_swupdatedone_get_led_rgb(frame, i, &r, &g, &b);
+               buffer->ptr[4*i] = 0;
+               buffer->ptr[4*i + 1] = b; /* BLUE */
+               buffer->ptr[4*i + 2] = g; /* GREEN */
+               buffer->ptr[4*i + 3] = r; /* RED */
+       }
+       _ani_backend_swupdatedone_free_frame(frame);
+
+       e = pui_backend_ani_set_buffer(ani, buffer);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       e = pui_backend_ani_update(ani);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on updating animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       pui_info("... update (serial=%d)\n", serial);
+
+       return (pui_bool)1;
+}
+
+pui_error
+_ani_swupdatedone_start(pui_ani_t *ani, int repeat)
+{
+       pui_bool ret = 0;
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
+
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
+       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_swupdatedone_frame_cb, info->interval / 1000.0);
+
+       if (!ret)
+       {
+               pui_err("Failed to add frame callback !\n");
+               e = PUI_INT_ERROR_INVALID_RESOURCES;
+       }
+
+       return e;
+}
+
+pui_error
+_ani_swupdatedone_stop(pui_ani_t *ani)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s\n", info->id);
+
+       pui_backend_ani_remove_frame_cb(ani);
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       return e;
+}
+
+
+void
+pui_default_backend_ani_swupdatedone_func_set(pui_backend_ani_func *func)
+{
+       if (!func) return;
+
+       func->ani_start = _ani_swupdatedone_start;
+       func->ani_stop = _ani_swupdatedone_stop;
+}
+
+
diff --git a/backends/system/default_ani_system_processing.c b/backends/system/default_ani_system_processing.c
new file mode 100644 (file)
index 0000000..6778838
--- /dev/null
@@ -0,0 +1,197 @@
+/*
+ * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "../default_backend.h"
+
+static void
+_ani_backend_system_processing_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
+{
+       if (!frame) return;
+       if (!r || !g || !b) return;
+       if (led_idx > frame->num_led) return;
+
+       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
+       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
+       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
+}
+
+static void
+_ani_backend_system_processing_free_frame(default_frame_info_t *frame)
+{
+       if (!frame) return;
+
+       if (frame->leds) free(frame->leds);
+       free(frame);
+}
+
+static default_frame_info_t *
+_ani_backend_system_processing_get_frame(default_ani_info *ani_info)
+{
+       default_frame_info_t *frame, *key_frame;
+
+       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
+       if (!frame) return NULL;
+
+       key_frame = &ani_info->frames[0];
+       frame->num_led = key_frame->num_led;
+       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
+       if (!frame->leds)
+       {
+               free(frame);
+               return NULL;
+       }
+       for (int i = 0; i < key_frame->num_led; i++)
+       {
+               int idx = (i - ani_info->frame_idx + key_frame->num_led) % key_frame->num_led;
+               frame->leds[idx] = key_frame->leds[i];
+       }
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= key_frame->num_led)
+               ani_info->frame_idx = 0;
+
+       return frame;
+}
+
+static pui_bool
+_ani_backend_system_processing_frame_cb(void *data, int serial)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_ani_t *ani = (pui_ani_t *)data;
+       pui_backend_ani_data *ani_data = NULL;
+       pui_ani_control_buffer *buffer = NULL;
+       default_frame_info_t *frame;
+       unsigned int r = 0x0, g = 0x0, b = 0x0;
+       double now;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       now = ecore_time_unix_get();
+       pui_info("[time:%.3f] serial=%d\n", now, serial);
+
+       /* TODO : make use of ani_info */
+       //(void) ani_info;
+
+       buffer = pui_backend_ani_get_buffer(ani);
+       if (!buffer) {
+               pui_err("Failed to get buffer for animation\n");
+               return (pui_bool)0;
+       }
+
+       frame = _ani_backend_system_processing_get_frame(ani_info);
+       for(int i = 0; i<12; i++)
+       {
+               _ani_backend_system_processing_get_led_rgb(frame, i, &r, &g, &b);
+               buffer->ptr[4*i] = 0;
+               buffer->ptr[4*i + 1] = b; /* BLUE */
+               buffer->ptr[4*i + 2] = g; /* GREEN */
+               buffer->ptr[4*i + 3] = r; /* RED */
+       }
+       _ani_backend_system_processing_free_frame(frame);
+
+       e = pui_backend_ani_set_buffer(ani, buffer);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       e = pui_backend_ani_update(ani);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on updating animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       pui_info("... update (serial=%d)\n", serial);
+
+       return (pui_bool)1;
+}
+
+pui_error
+_ani_system_processing_start(pui_ani_t *ani, int repeat)
+{
+       pui_bool ret = 0;
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
+       if (info->num_key_frames != 1)
+       {
+               pui_err("invalid key frames: %d\n", info->num_key_frames);
+               return PUI_INT_ERROR_INVALID_RESOURCES;
+       }
+
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
+       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_system_processing_frame_cb, info->interval / 1000.0);
+
+       if (!ret)
+       {
+               pui_err("Failed to add frame callback !\n");
+               e = PUI_INT_ERROR_INVALID_RESOURCES;
+       }
+
+       return e;
+}
+
+pui_error
+_ani_system_processing_stop(pui_ani_t *ani)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s\n", info->id);
+
+       pui_backend_ani_remove_frame_cb(ani);
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       return e;
+}
+
+
+void
+pui_default_backend_ani_system_processing_func_set(pui_backend_ani_func *func)
+{
+       if (!func) return;
+
+       func->ani_start = _ani_system_processing_start;
+       func->ani_stop = _ani_system_processing_stop;
+}
+
+
diff --git a/backends/voice/default_ani_listening.c b/backends/voice/default_ani_listening.c
new file mode 100644 (file)
index 0000000..2ff9a84
--- /dev/null
@@ -0,0 +1,221 @@
+/*
+ * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "../default_backend.h"
+
+static void
+_ani_backend_listening_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
+{
+       if (!frame) return;
+       if (!r || !g || !b) return;
+       if (led_idx > frame->num_led) return;
+
+       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
+       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
+       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
+}
+
+static void
+_ani_backend_listening_free_frame(default_frame_info_t *frame)
+{
+       if (!frame) return;
+
+       if (frame->leds) free(frame->leds);
+       free(frame);
+}
+
+static default_frame_info_t *
+_ani_backend_listening_get_frame(default_ani_info *ani_info)
+{
+       default_frame_info_t *frame, *key_frame;
+       int division;
+
+       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
+       if (!frame) return NULL;
+
+       key_frame = &ani_info->frames[0];
+       frame->num_led = key_frame->num_led;
+       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
+       if (!frame->leds)
+       {
+               free(frame);
+               return NULL;
+       }
+       division = (int)(frame->num_led / 2);
+       for (int i = 0; i < key_frame->num_led; i++)
+       {
+               int idx;
+               //int idx = (i - ani_info->frame_idx + key_frame->num_led) % key_frame->num_led;
+               if ((ani_info->frame_idx / division) <= 0)
+               {
+                       if (i < division)
+                       {
+                               idx = i - ani_info->frame_idx;
+                               if (idx < 0) continue;
+                       }
+                       else
+                       {
+                               idx = i + ani_info->frame_idx;
+                               if (idx >= key_frame->num_led) continue;
+                       }
+               }
+               else
+               {
+                       if (i < division)
+                       {
+                               idx = i - division + 1 + ani_info->frame_idx - division;
+                               if (idx < 0) continue;
+                       }
+                       else
+                       {
+                               idx = i + division - 1 - ani_info->frame_idx + division;
+                               if (idx >= key_frame->num_led) continue;
+                       }
+               }
+               frame->leds[idx] = key_frame->leds[i];
+       }
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= key_frame->num_led)
+               ani_info->frame_idx = 0;
+
+       return frame;
+}
+
+static pui_bool
+_ani_backend_listening_frame_cb(void *data, int serial)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_ani_t *ani = (pui_ani_t *)data;
+       pui_backend_ani_data *ani_data = NULL;
+       pui_ani_control_buffer *buffer = NULL;
+       default_frame_info_t *frame;
+       unsigned int r = 0x0, g = 0x0, b = 0x0;
+       double now;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       now = ecore_time_unix_get();
+       pui_info("[time:%.3f] serial=%d\n", now, serial);
+
+       /* TODO : make use of ani_info */
+       //(void) ani_info;
+
+       buffer = pui_backend_ani_get_buffer(ani);
+       if (!buffer) {
+               pui_err("Failed to get buffer for animation\n");
+               return (pui_bool)0;
+       }
+
+       frame = _ani_backend_listening_get_frame(ani_info);
+       for(int i = 0; i<12; i++)
+       {
+               _ani_backend_listening_get_led_rgb(frame, i, &r, &g, &b);
+               buffer->ptr[4*i] = 0;
+               buffer->ptr[4*i + 1] = b; /* BLUE */
+               buffer->ptr[4*i + 2] = g; /* GREEN */
+               buffer->ptr[4*i + 3] = r; /* RED */
+       }
+       _ani_backend_listening_free_frame(frame);
+
+       e = pui_backend_ani_set_buffer(ani, buffer);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       e = pui_backend_ani_update(ani);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on updating animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       pui_info("... update (serial=%d)\n", serial);
+
+       return (pui_bool)1;
+}
+
+pui_error
+_ani_listening_start(pui_ani_t *ani, int repeat)
+{
+       pui_bool ret = 0;
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
+
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
+       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_listening_frame_cb, info->interval / 1000.0);
+
+       if (!ret)
+       {
+               pui_err("Failed to add frame callback !\n");
+               e = PUI_INT_ERROR_INVALID_RESOURCES;
+       }
+
+       return e;
+}
+
+pui_error
+_ani_listening_stop(pui_ani_t *ani)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s\n", info->id);
+
+       pui_backend_ani_remove_frame_cb(ani);
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       return e;
+}
+
+
+void
+pui_default_backend_ani_listening_func_set(pui_backend_ani_func *func)
+{
+       if (!func) return;
+
+       func->ani_start = _ani_listening_start;
+       func->ani_stop = _ani_listening_stop;
+}
+
+
diff --git a/backends/voice/default_ani_processing.c b/backends/voice/default_ani_processing.c
new file mode 100644 (file)
index 0000000..15f4957
--- /dev/null
@@ -0,0 +1,197 @@
+/*
+ * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "../default_backend.h"
+
+static void
+_ani_backend_processing_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
+{
+       if (!frame) return;
+       if (!r || !g || !b) return;
+       if (led_idx > frame->num_led) return;
+
+       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
+       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
+       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
+}
+
+static void
+_ani_backend_processing_free_frame(default_frame_info_t *frame)
+{
+       if (!frame) return;
+
+       if (frame->leds) free(frame->leds);
+       free(frame);
+}
+
+static default_frame_info_t *
+_ani_backend_processing_get_frame(default_ani_info *ani_info)
+{
+       default_frame_info_t *frame, *key_frame;
+
+       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
+       if (!frame) return NULL;
+
+       key_frame = &ani_info->frames[0];
+       frame->num_led = key_frame->num_led;
+       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
+       if (!frame->leds)
+       {
+               free(frame);
+               return NULL;
+       }
+       for (int i = 0; i < key_frame->num_led; i++)
+       {
+               int idx = (i - ani_info->frame_idx + key_frame->num_led) % key_frame->num_led;
+               frame->leds[idx] = key_frame->leds[i];
+       }
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= key_frame->num_led)
+               ani_info->frame_idx = 0;
+
+       return frame;
+}
+
+static pui_bool
+_ani_backend_processing_frame_cb(void *data, int serial)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_ani_t *ani = (pui_ani_t *)data;
+       pui_backend_ani_data *ani_data = NULL;
+       pui_ani_control_buffer *buffer = NULL;
+       default_frame_info_t *frame;
+       unsigned int r = 0x0, g = 0x0, b = 0x0;
+       double now;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       now = ecore_time_unix_get();
+       pui_info("[time:%.3f] serial=%d\n", now, serial);
+
+       /* TODO : make use of ani_info */
+       //(void) ani_info;
+
+       buffer = pui_backend_ani_get_buffer(ani);
+       if (!buffer) {
+               pui_err("Failed to get buffer for animation\n");
+               return (pui_bool)0;
+       }
+
+       frame = _ani_backend_processing_get_frame(ani_info);
+       for(int i = 0; i<12; i++)
+       {
+               _ani_backend_processing_get_led_rgb(frame, i, &r, &g, &b);
+               buffer->ptr[4*i] = 0;
+               buffer->ptr[4*i + 1] = b; /* BLUE */
+               buffer->ptr[4*i + 2] = g; /* GREEN */
+               buffer->ptr[4*i + 3] = r; /* RED */
+       }
+       _ani_backend_processing_free_frame(frame);
+
+       e = pui_backend_ani_set_buffer(ani, buffer);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       e = pui_backend_ani_update(ani);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on updating animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       pui_info("... update (serial=%d)\n", serial);
+
+       return (pui_bool)1;
+}
+
+pui_error
+_ani_processing_start(pui_ani_t *ani, int repeat)
+{
+       pui_bool ret = 0;
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
+       if (info->num_key_frames != 1)
+       {
+               pui_err("invalid key frames: %d\n", info->num_key_frames);
+               return PUI_INT_ERROR_INVALID_RESOURCES;
+       }
+
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
+       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_processing_frame_cb, info->interval / 1000.0);
+
+       if (!ret)
+       {
+               pui_err("Failed to add frame callback !\n");
+               e = PUI_INT_ERROR_INVALID_RESOURCES;
+       }
+
+       return e;
+}
+
+pui_error
+_ani_processing_stop(pui_ani_t *ani)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s\n", info->id);
+
+       pui_backend_ani_remove_frame_cb(ani);
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       return e;
+}
+
+
+void
+pui_default_backend_ani_processing_func_set(pui_backend_ani_func *func)
+{
+       if (!func) return;
+
+       func->ani_start = _ani_processing_start;
+       func->ani_stop = _ani_processing_stop;
+}
+
+
diff --git a/backends/voice/default_ani_speaking.c b/backends/voice/default_ani_speaking.c
new file mode 100644 (file)
index 0000000..af0bb47
--- /dev/null
@@ -0,0 +1,208 @@
+/*
+ * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "../default_backend.h"
+
+static void
+_ani_backend_speaking_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
+{
+       if (!frame) return;
+       if (!r || !g || !b) return;
+       if (led_idx > frame->num_led) return;
+
+       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
+       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
+       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
+}
+
+static void
+_ani_backend_speaking_free_frame(default_frame_info_t *frame)
+{
+       if (!frame) return;
+
+       if (frame->leds) free(frame->leds);
+       free(frame);
+}
+
+static default_frame_info_t *
+_ani_backend_speaking_get_frame(default_ani_info *ani_info)
+{
+#define SMOOTH_FRAME 20
+       default_frame_info_t *frame, *key_frame, *key_frame2;
+       int idx, idx2;
+       unsigned int r, g, b, r2, g2, b2;
+       int r3, g3, b3;
+       double div;
+
+       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
+       if (!frame) return NULL;
+
+       idx = ((int)(ani_info->frame_idx / SMOOTH_FRAME)) % ani_info->num_key_frames;
+       idx2 = (idx + 1) % ani_info->num_key_frames;
+
+       key_frame = &ani_info->frames[idx];
+       key_frame2 = &ani_info->frames[idx2];
+       frame->num_led = key_frame->num_led;
+       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
+       if (!frame->leds)
+       {
+               free(frame);
+               return NULL;
+       }
+       div = (double)(ani_info->frame_idx % SMOOTH_FRAME) / (double)SMOOTH_FRAME;
+       r = g = b = r2 = g2 = b2 = 0x0;
+       for (int i = 0; i < key_frame->num_led; i++)
+       {
+               _ani_backend_speaking_get_led_rgb(key_frame, i, &r, &g, &b);
+               _ani_backend_speaking_get_led_rgb(key_frame2, i, &r2, &g2, &b2);
+               r3 = (int)(r2 - r) * div + r;
+               g3 = (int)(g2 - g) * div + g;
+               b3 = (int)(b2 - b) * div + b;
+
+               frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
+       }
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= (ani_info->num_key_frames * SMOOTH_FRAME))
+               ani_info->frame_idx = 0;
+
+       return frame;
+}
+
+static pui_bool
+_ani_backend_speaking_frame_cb(void *data, int serial)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_ani_t *ani = (pui_ani_t *)data;
+       pui_backend_ani_data *ani_data = NULL;
+       pui_ani_control_buffer *buffer = NULL;
+       default_frame_info_t *frame;
+       unsigned int r = 0x0, g = 0x0, b = 0x0;
+       double now;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       now = ecore_time_unix_get();
+       pui_info("[time:%.3f] serial=%d\n", now, serial);
+
+       /* TODO : make use of ani_info */
+       //(void) ani_info;
+
+       buffer = pui_backend_ani_get_buffer(ani);
+       if (!buffer) {
+               pui_err("Failed to get buffer for animation\n");
+               return (pui_bool)0;
+       }
+
+       frame = _ani_backend_speaking_get_frame(ani_info);
+       for(int i = 0; i<12; i++)
+       {
+               _ani_backend_speaking_get_led_rgb(frame, i, &r, &g, &b);
+               buffer->ptr[4*i] = 0;
+               buffer->ptr[4*i + 1] = b; /* BLUE */
+               buffer->ptr[4*i + 2] = g; /* GREEN */
+               buffer->ptr[4*i + 3] = r; /* RED */
+       }
+       _ani_backend_speaking_free_frame(frame);
+
+       e = pui_backend_ani_set_buffer(ani, buffer);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       e = pui_backend_ani_update(ani);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on updating animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       pui_info("... update (serial=%d)\n", serial);
+
+       return (pui_bool)1;
+}
+
+pui_error
+_ani_speaking_start(pui_ani_t *ani, int repeat)
+{
+       pui_bool ret = 0;
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
+
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
+       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_speaking_frame_cb, info->interval / 1000.0);
+
+       if (!ret)
+       {
+               pui_err("Failed to add frame callback !\n");
+               e = PUI_INT_ERROR_INVALID_RESOURCES;
+       }
+
+       return e;
+}
+
+pui_error
+_ani_speaking_stop(pui_ani_t *ani)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s\n", info->id);
+
+       pui_backend_ani_remove_frame_cb(ani);
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       return e;
+}
+
+
+void
+pui_default_backend_ani_speaking_func_set(pui_backend_ani_func *func)
+{
+       if (!func) return;
+
+       func->ani_start = _ani_speaking_start;
+       func->ani_stop = _ani_speaking_stop;
+}
+
+
diff --git a/backends/voice/default_ani_streaming.c b/backends/voice/default_ani_streaming.c
new file mode 100644 (file)
index 0000000..79b5e14
--- /dev/null
@@ -0,0 +1,208 @@
+/*
+ * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "../default_backend.h"
+
+static void
+_ani_backend_streaming_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
+{
+       if (!frame) return;
+       if (!r || !g || !b) return;
+       if (led_idx > frame->num_led) return;
+
+       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
+       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
+       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
+}
+
+static void
+_ani_backend_streaming_free_frame(default_frame_info_t *frame)
+{
+       if (!frame) return;
+
+       if (frame->leds) free(frame->leds);
+       free(frame);
+}
+
+static default_frame_info_t *
+_ani_backend_streaming_get_frame(default_ani_info *ani_info)
+{
+#define SMOOTH_FRAME 15
+       default_frame_info_t *frame, *key_frame, *key_frame2;
+       int idx, idx2;
+       unsigned int r, g, b, r2, g2, b2;
+       int r3, g3, b3;
+       double div;
+
+       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
+       if (!frame) return NULL;
+
+       idx = ((int)(ani_info->frame_idx / SMOOTH_FRAME)) % ani_info->num_key_frames;
+       idx2 = (idx + 1) % ani_info->num_key_frames;
+
+       key_frame = &ani_info->frames[idx];
+       key_frame2 = &ani_info->frames[idx2];
+       frame->num_led = key_frame->num_led;
+       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
+       if (!frame->leds)
+       {
+               free(frame);
+               return NULL;
+       }
+       div = (double)(ani_info->frame_idx % SMOOTH_FRAME) / (double)SMOOTH_FRAME;
+       r = g = b = r2 = g2 = b2 = 0x0;
+       for (int i = 0; i < key_frame->num_led; i++)
+       {
+               _ani_backend_streaming_get_led_rgb(key_frame, i, &r, &g, &b);
+               _ani_backend_streaming_get_led_rgb(key_frame2, i, &r2, &g2, &b2);
+               r3 = (int)(r2 - r) * div + r;
+               g3 = (int)(g2 - g) * div + g;
+               b3 = (int)(b2 - b) * div + b;
+
+               frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
+       }
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= (ani_info->num_key_frames * SMOOTH_FRAME))
+               ani_info->frame_idx = 0;
+
+       return frame;
+}
+
+static pui_bool
+_ani_backend_streaming_frame_cb(void *data, int serial)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_ani_t *ani = (pui_ani_t *)data;
+       pui_backend_ani_data *ani_data = NULL;
+       pui_ani_control_buffer *buffer = NULL;
+       default_frame_info_t *frame;
+       unsigned int r = 0x0, g = 0x0, b = 0x0;
+       double now;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       now = ecore_time_unix_get();
+       pui_info("[time:%.3f] serial=%d\n", now, serial);
+
+       /* TODO : make use of ani_info */
+       //(void) ani_info;
+
+       buffer = pui_backend_ani_get_buffer(ani);
+       if (!buffer) {
+               pui_err("Failed to get buffer for animation\n");
+               return (pui_bool)0;
+       }
+
+       frame = _ani_backend_streaming_get_frame(ani_info);
+       for(int i = 0; i<12; i++)
+       {
+               _ani_backend_streaming_get_led_rgb(frame, i, &r, &g, &b);
+               buffer->ptr[4*i] = 0;
+               buffer->ptr[4*i + 1] = b; /* BLUE */
+               buffer->ptr[4*i + 2] = g; /* GREEN */
+               buffer->ptr[4*i + 3] = r; /* RED */
+       }
+       _ani_backend_streaming_free_frame(frame);
+
+       e = pui_backend_ani_set_buffer(ani, buffer);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       e = pui_backend_ani_update(ani);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on updating animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       pui_info("... update (serial=%d)\n", serial);
+
+       return (pui_bool)1;
+}
+
+pui_error
+_ani_streaming_start(pui_ani_t *ani, int repeat)
+{
+       pui_bool ret = 0;
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
+
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
+       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_streaming_frame_cb, info->interval / 1000.0);
+
+       if (!ret)
+       {
+               pui_err("Failed to add frame callback !\n");
+               e = PUI_INT_ERROR_INVALID_RESOURCES;
+       }
+
+       return e;
+}
+
+pui_error
+_ani_streaming_stop(pui_ani_t *ani)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s\n", info->id);
+
+       pui_backend_ani_remove_frame_cb(ani);
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       return e;
+}
+
+
+void
+pui_default_backend_ani_streaming_func_set(pui_backend_ani_func *func)
+{
+       if (!func) return;
+
+       func->ani_start = _ani_streaming_start;
+       func->ani_stop = _ani_streaming_stop;
+}
+
+
diff --git a/backends/voice/default_ani_timeout.c b/backends/voice/default_ani_timeout.c
new file mode 100644 (file)
index 0000000..4c0b4d4
--- /dev/null
@@ -0,0 +1,208 @@
+/*
+ * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "../default_backend.h"
+
+static void
+_ani_backend_timeout_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b)
+{
+       if (!frame) return;
+       if (!r || !g || !b) return;
+       if (led_idx > frame->num_led) return;
+
+       *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16;
+       *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8;
+       *b = (frame->leds[led_idx].color & LED_MASK_BLUE);
+}
+
+static void
+_ani_backend_timeout_free_frame(default_frame_info_t *frame)
+{
+       if (!frame) return;
+
+       if (frame->leds) free(frame->leds);
+       free(frame);
+}
+
+static default_frame_info_t *
+_ani_backend_timeout_get_frame(default_ani_info *ani_info)
+{
+#define SMOOTH_FRAME 15
+       default_frame_info_t *frame, *key_frame, *key_frame2;
+       int idx, idx2;
+       unsigned int r, g, b, r2, g2, b2;
+       int r3, g3, b3;
+       double div;
+
+       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
+       if (!frame) return NULL;
+
+       idx = ((int)(ani_info->frame_idx / SMOOTH_FRAME)) % ani_info->num_key_frames;
+       idx2 = (idx + 1) % ani_info->num_key_frames;
+
+       key_frame = &ani_info->frames[idx];
+       key_frame2 = &ani_info->frames[idx2];
+       frame->num_led = key_frame->num_led;
+       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led);
+       if (!frame->leds)
+       {
+               free(frame);
+               return NULL;
+       }
+       div = (double)(ani_info->frame_idx % SMOOTH_FRAME) / (double)SMOOTH_FRAME;
+       r = g = b = r2 = g2 = b2 = 0x0;
+       for (int i = 0; i < key_frame->num_led; i++)
+       {
+               _ani_backend_timeout_get_led_rgb(key_frame, i, &r, &g, &b);
+               _ani_backend_timeout_get_led_rgb(key_frame2, i, &r2, &g2, &b2);
+               r3 = (int)(r2 - r) * div + r;
+               g3 = (int)(g2 - g) * div + g;
+               b3 = (int)(b2 - b) * div + b;
+
+               frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
+       }
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= (ani_info->num_key_frames * SMOOTH_FRAME))
+               ani_info->frame_idx = 0;
+
+       return frame;
+}
+
+static pui_bool
+_ani_backend_timeout_frame_cb(void *data, int serial)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_ani_t *ani = (pui_ani_t *)data;
+       pui_backend_ani_data *ani_data = NULL;
+       pui_ani_control_buffer *buffer = NULL;
+       default_frame_info_t *frame;
+       unsigned int r = 0x0, g = 0x0, b = 0x0;
+       double now;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       now = ecore_time_unix_get();
+       pui_info("[time:%.3f] serial=%d\n", now, serial);
+
+       /* TODO : make use of ani_info */
+       //(void) ani_info;
+
+       buffer = pui_backend_ani_get_buffer(ani);
+       if (!buffer) {
+               pui_err("Failed to get buffer for animation\n");
+               return (pui_bool)0;
+       }
+
+       frame = _ani_backend_timeout_get_frame(ani_info);
+       for(int i = 0; i<12; i++)
+       {
+               _ani_backend_timeout_get_led_rgb(frame, i, &r, &g, &b);
+               buffer->ptr[4*i] = 0;
+               buffer->ptr[4*i + 1] = b; /* BLUE */
+               buffer->ptr[4*i + 2] = g; /* GREEN */
+               buffer->ptr[4*i + 3] = r; /* RED */
+       }
+       _ani_backend_timeout_free_frame(frame);
+
+       e = pui_backend_ani_set_buffer(ani, buffer);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on setting buffer on animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       e = pui_backend_ani_update(ani);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on updating animation !(e=%d)\n", e);
+               return (pui_bool)0;
+       }
+
+       pui_info("... update (serial=%d)\n", serial);
+
+       return (pui_bool)1;
+}
+
+pui_error
+_ani_timeout_start(pui_ani_t *ani, int repeat)
+{
+       pui_bool ret = 0;
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval);
+
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
+       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_timeout_frame_cb, info->interval / 1000.0);
+
+       if (!ret)
+       {
+               pui_err("Failed to add frame callback !\n");
+               e = PUI_INT_ERROR_INVALID_RESOURCES;
+       }
+
+       return e;
+}
+
+pui_error
+_ani_timeout_stop(pui_ani_t *ani)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       pui_backend_ani_data *ani_data = NULL;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *info = (default_ani_info *)ani_data->ani_info;
+
+       //TODO
+       (void) info;
+
+       pui_info("... info->id: %s\n", info->id);
+
+       pui_backend_ani_remove_frame_cb(ani);
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       return e;
+}
+
+
+void
+pui_default_backend_ani_timeout_func_set(pui_backend_ani_func *func)
+{
+       if (!func) return;
+
+       func->ani_start = _ani_timeout_start;
+       func->ani_stop = _ani_timeout_stop;
+}
+
+
index 0d393ac45bab8f00f4d313404a26672269383a56..93fc01b0cdc735924d89a999f18669b782d11eb4 100644 (file)
@@ -66,7 +66,7 @@ make %{?_smp_mflags}
 
 ###### libpui default backend's animation data
 mkdir -p %{buildroot}/%{ANIDATA_DIR}/
-cp -f backends/res/* %{buildroot}/%{ANIDATA_DIR}/
+cp -fr backends/res/* %{buildroot}/%{ANIDATA_DIR}/
 %make_install
 
 %post -n %{name} -p /sbin/ldconfig
index 10f9f957fdd1f062e81211ad67cdc8cc3321e431..a6b04d5e3e40ae9c39da62397bdc453a9f2d683e 100644 (file)
@@ -68,22 +68,22 @@ struct app_data
 
 static Eina_Array *_ecore_event_hdls = NULL;
 static animation_t ani_collection[] = {
-       { "easy_setup", PUI_ANI_CMD_START, -1 },
-       { "system_processing", PUI_ANI_CMD_START, -1 },
-       { "sw_update_done", PUI_ANI_CMD_START, -1 },
-       { "mic_off", PUI_ANI_CMD_START, -1 },
-       { "listening", PUI_ANI_CMD_START, -1 },
-       { "streaming", PUI_ANI_CMD_START, -1 },
-       { "processing", PUI_ANI_CMD_START, -1 },
-       { "speaking", PUI_ANI_CMD_START, -1 },
-       { "time_out", PUI_ANI_CMD_START, -1 },
-       { "normal", PUI_ANI_CMD_START, -1 },
-       { "emergency", PUI_ANI_CMD_START, -1 },
-       { "network_error", PUI_ANI_CMD_START, -1 },
-       { "error", PUI_ANI_CMD_START, -1 },
-       { "alarm", PUI_ANI_CMD_START, -1 },
-       { "pairing", PUI_ANI_CMD_START, -1 },
-       { "connected", PUI_ANI_CMD_START, -1 }
+       { "system/easy_setup", PUI_ANI_CMD_START, -1 },
+       { "system/processing", PUI_ANI_CMD_START, -1 },
+       { "system/sw_update_done", PUI_ANI_CMD_START, -1 },
+       { "system/mic_off", PUI_ANI_CMD_START, -1 },
+       { "voice/listening", PUI_ANI_CMD_START, -1 },
+       { "voice/streaming", PUI_ANI_CMD_START, -1 },
+       { "voice/processing", PUI_ANI_CMD_START, -1 },
+       { "voice/speaking", PUI_ANI_CMD_START, -1 },
+       { "voice/timeout", PUI_ANI_CMD_START, -1 },
+       { "notification/normal", PUI_ANI_CMD_START, -1 },
+       { "notification/emergency", PUI_ANI_CMD_START, -1 },
+       { "notification/network_error", PUI_ANI_CMD_START, -1 },
+       { "notification/error", PUI_ANI_CMD_START, -1 },
+       { "notification/alarm", PUI_ANI_CMD_START, -1 },
+       { "bt/pairing", PUI_ANI_CMD_START, -1 },
+       { "bt/connected", PUI_ANI_CMD_START, -1 }
 };
 
 pui_ani_h ani_handles[sizeof(ani_collection) / sizeof(animation_t)];