default_backend: remove unnecessary module circular dependencies 94/248594/1 submit/tizen/20201201.020507
authorSung-Jin Park <sj76.park@samsung.com>
Mon, 30 Nov 2020 11:18:21 +0000 (20:18 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Mon, 30 Nov 2020 11:18:21 +0000 (20:18 +0900)
Change-Id: I1f8da156cb2826f9caa82f7293b0f5f76f31a23c
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
72 files changed:
backends/Makefile.am
backends/bt/default_ani_connected.c [deleted file]
backends/bt/default_ani_pairing.c [deleted file]
backends/default/bt_ani_connected.c [new file with mode: 0644]
backends/default/bt_ani_pairing.c [new file with mode: 0644]
backends/default/default_ani_clear_fadeout.c
backends/default/default_ani_clear_immediate.c
backends/default/default_backend.c [new file with mode: 0644]
backends/default/default_backend.h [new file with mode: 0644]
backends/default/notification_ani_alarm.c [new file with mode: 0644]
backends/default/notification_ani_emergency.c [new file with mode: 0644]
backends/default/notification_ani_error.c [new file with mode: 0644]
backends/default/notification_ani_networkerror.c [new file with mode: 0644]
backends/default/notification_ani_normal.c [new file with mode: 0644]
backends/default/res/bt/connected.json [new file with mode: 0644]
backends/default/res/bt/pairing.json [new file with mode: 0644]
backends/default/res/notification/alarm.json [new file with mode: 0644]
backends/default/res/notification/emergency.json [new file with mode: 0644]
backends/default/res/notification/error.json [new file with mode: 0644]
backends/default/res/notification/network_error.json [new file with mode: 0644]
backends/default/res/notification/normal.json [new file with mode: 0644]
backends/default/res/system/easy_setup.json [new file with mode: 0644]
backends/default/res/system/mic_off.json [new file with mode: 0644]
backends/default/res/system/processing.json [new file with mode: 0644]
backends/default/res/system/sw_update_done.json [new file with mode: 0644]
backends/default/res/voice/listening.json [new file with mode: 0644]
backends/default/res/voice/processing.json [new file with mode: 0644]
backends/default/res/voice/speaking.json [new file with mode: 0644]
backends/default/res/voice/streaming.json [new file with mode: 0644]
backends/default/res/voice/timeout.json [new file with mode: 0644]
backends/default/system_ani_easysetup.c [new file with mode: 0644]
backends/default/system_ani_micoff.c [new file with mode: 0644]
backends/default/system_ani_swupdatedone.c [new file with mode: 0644]
backends/default/system_ani_system_processing.c [new file with mode: 0644]
backends/default/voice_ani_listening.c [new file with mode: 0644]
backends/default/voice_ani_processing.c [new file with mode: 0644]
backends/default/voice_ani_speaking.c [new file with mode: 0644]
backends/default/voice_ani_streaming.c [new file with mode: 0644]
backends/default/voice_ani_timeout.c [new file with mode: 0644]
backends/default_backend.c [deleted file]
backends/default_backend.h [deleted file]
backends/notification/default_ani_alarm.c [deleted file]
backends/notification/default_ani_emergency.c [deleted file]
backends/notification/default_ani_error.c [deleted file]
backends/notification/default_ani_networkerror.c [deleted file]
backends/notification/default_ani_normal.c [deleted file]
backends/res/bt/connected.json [deleted file]
backends/res/bt/pairing.json [deleted file]
backends/res/notification/alarm.json [deleted file]
backends/res/notification/emergency.json [deleted file]
backends/res/notification/error.json [deleted file]
backends/res/notification/network_error.json [deleted file]
backends/res/notification/normal.json [deleted file]
backends/res/system/easy_setup.json [deleted file]
backends/res/system/mic_off.json [deleted file]
backends/res/system/processing.json [deleted file]
backends/res/system/sw_update_done.json [deleted file]
backends/res/voice/listening.json [deleted file]
backends/res/voice/processing.json [deleted file]
backends/res/voice/speaking.json [deleted file]
backends/res/voice/streaming.json [deleted file]
backends/res/voice/timeout.json [deleted file]
backends/system/default_ani_easysetup.c [deleted file]
backends/system/default_ani_micoff.c [deleted file]
backends/system/default_ani_swupdatedone.c [deleted file]
backends/system/default_ani_system_processing.c [deleted file]
backends/voice/default_ani_listening.c [deleted file]
backends/voice/default_ani_processing.c [deleted file]
backends/voice/default_ani_speaking.c [deleted file]
backends/voice/default_ani_streaming.c [deleted file]
backends/voice/default_ani_timeout.c [deleted file]
packaging/libpui.spec

index 41645b22f76aa62a177ee5564d468a77a26baefd..9b22ab2ad9be04dd421c5594a491e2c97b8a5c46 100644 (file)
@@ -12,23 +12,23 @@ libpui_default_backend_la_CFLAGS = $(AM_CFLAGS) $(DEFAULT_BACKEND_CFLAGS)
 libpui_default_backend_la_LIBADD = $(DEFAULT_BACKEND_LIBS)
 
 libpui_default_backend_la_SOURCES = \
-        default_backend.h \
-        default_backend.c \
+        default/default_backend.h \
+        default/default_backend.c \
         default/default_ani_clear_fadeout.c \
         default/default_ani_clear_immediate.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
+        default/system_ani_easysetup.c \
+        default/system_ani_system_processing.c \
+        default/system_ani_swupdatedone.c \
+        default/system_ani_micoff.c \
+        default/voice_ani_listening.c \
+        default/voice_ani_streaming.c \
+        default/voice_ani_processing.c \
+        default/voice_ani_speaking.c \
+        default/voice_ani_timeout.c \
+        default/notification_ani_normal.c \
+        default/notification_ani_emergency.c \
+        default/notification_ani_networkerror.c \
+        default/notification_ani_error.c \
+        default/notification_ani_alarm.c \
+        default/bt_ani_pairing.c \
+        default/bt_ani_connected.c
diff --git a/backends/bt/default_ani_connected.c b/backends/bt/default_ani_connected.c
deleted file mode 100644 (file)
index b8893fb..0000000
+++ /dev/null
@@ -1,162 +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 default_frame_info_t *ani_frame = NULL;
-
-static default_frame_info_t *
-_ani_backend_connected_get_frame(default_ani_info *ani_info)
-{
-       default_frame_info_t *key_frame;
-       int idx;
-
-       if (ani_info->frame_idx == 0)
-       {
-               ani_info->frame_max = (unsigned int)(ani_info->frames[ani_info->key_frame_cur].frame_duration / ani_info->interval);
-       }
-
-       idx = ani_info->key_frame_cur;
-       key_frame = &ani_info->frames[idx];
-
-       for (int i = 0; i < key_frame->num_led; i++)
-       {
-               ani_frame->leds[i].color = key_frame->leds[i].color;
-       }
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= ani_info->frame_max)
-       {
-               ani_info->frame_idx = 0;
-               ani_info->key_frame_cur = (ani_info->key_frame_cur + 1) % ani_info->num_key_frames;
-               if (ani_info->repeat >= 0 && ani_info->key_frame_cur == 0)
-                       ani_info->repeat_cur++;
-       }
-
-       return ani_frame;
-}
-
-
-static pui_bool
-_ani_backend_connected_frame_cb(void *data, int serial)
-{
-       int ret = 0;
-       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;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       /* 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);
-       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
-
-       return (pui_bool)ret;
-}
-
-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;
-
-       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);
-       if (repeat == 0) info->repeat = 1;
-       else info->repeat = repeat;
-
-       info->key_frame_cur = 0;
-       info->frame_idx = 0;
-       info->repeat_cur = 0;
-
-       if (!ani_frame)
-               ani_frame = backend_util_alloc_frame(info);
-       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
-
-       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_bool force)
-{
-       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, force=%d\n", info->id, force);
-
-       pui_backend_ani_remove_frame_cb(ani);
-
-       if (force)
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
-       else
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       if (ani_frame)
-       {
-               backend_util_free_frame(ani_frame);
-               ani_frame = NULL;
-       }
-
-       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
deleted file mode 100644 (file)
index 82e95e4..0000000
+++ /dev/null
@@ -1,163 +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 default_frame_info_t *ani_frame = NULL;
-
-static default_frame_info_t *
-_ani_backend_pairing_get_frame(default_ani_info *ani_info)
-{
-       default_frame_info_t *key_frame;
-       int idx;
-
-       if (ani_info->frame_idx == 0)
-       {
-               ani_info->frame_max = (unsigned int)(ani_info->frames[ani_info->key_frame_cur].frame_duration / ani_info->interval);
-       }
-
-       idx = ani_info->key_frame_cur;
-       key_frame = &ani_info->frames[idx];
-
-       for (int i = 0; i < key_frame->num_led; i++)
-       {
-               ani_frame->leds[i].color = key_frame->leds[i].color;
-       }
-
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= ani_info->frame_max)
-       {
-               ani_info->frame_idx = 0;
-               ani_info->key_frame_cur = (ani_info->key_frame_cur + 1) % ani_info->num_key_frames;
-               if (ani_info->repeat >= 0 && ani_info->key_frame_cur == 0)
-                       ani_info->repeat_cur++;
-       }
-
-       return ani_frame;
-}
-
-
-static pui_bool
-_ani_backend_pairing_frame_cb(void *data, int serial)
-{
-       int ret = 0;
-       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;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       /* 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);
-       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
-
-       return (pui_bool)ret;
-}
-
-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;
-
-       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);
-       if (repeat == 0) info->repeat = 1;
-       else info->repeat = repeat;
-
-       info->key_frame_cur = 0;
-       info->frame_idx = 0;
-       info->repeat_cur = 0;
-
-       if (!ani_frame)
-               ani_frame = backend_util_alloc_frame(info);
-       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
-
-       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_bool force)
-{
-       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, force=%d\n", info->id, force);
-
-       pui_backend_ani_remove_frame_cb(ani);
-
-       if (force)
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
-       else
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       if (ani_frame)
-       {
-               backend_util_free_frame(ani_frame);
-               ani_frame = NULL;
-       }
-
-       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/bt_ani_connected.c b/backends/default/bt_ani_connected.c
new file mode 100644 (file)
index 0000000..42ba8c0
--- /dev/null
@@ -0,0 +1,162 @@
+/*
+ * 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 default_frame_info_t *ani_frame = NULL;
+
+static default_frame_info_t *
+_ani_backend_connected_get_frame(default_ani_info *ani_info)
+{
+       default_frame_info_t *key_frame;
+       int idx;
+
+       if (ani_info->frame_idx == 0)
+       {
+               ani_info->frame_max = (unsigned int)(ani_info->frames[ani_info->key_frame_cur].frame_duration / ani_info->interval);
+       }
+
+       idx = ani_info->key_frame_cur;
+       key_frame = &ani_info->frames[idx];
+
+       for (int i = 0; i < key_frame->num_led; i++)
+       {
+               ani_frame->leds[i].color = key_frame->leds[i].color;
+       }
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= ani_info->frame_max)
+       {
+               ani_info->frame_idx = 0;
+               ani_info->key_frame_cur = (ani_info->key_frame_cur + 1) % ani_info->num_key_frames;
+               if (ani_info->repeat >= 0 && ani_info->key_frame_cur == 0)
+                       ani_info->repeat_cur++;
+       }
+
+       return ani_frame;
+}
+
+
+static pui_bool
+_ani_backend_connected_frame_cb(void *data, int serial)
+{
+       int ret = 0;
+       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;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       /* 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);
+       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
+
+       return (pui_bool)ret;
+}
+
+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;
+
+       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);
+       if (repeat == 0) info->repeat = 1;
+       else info->repeat = repeat;
+
+       info->key_frame_cur = 0;
+       info->frame_idx = 0;
+       info->repeat_cur = 0;
+
+       if (!ani_frame)
+               ani_frame = backend_util_alloc_frame(info);
+       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
+
+       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_bool force)
+{
+       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, force=%d\n", info->id, force);
+
+       pui_backend_ani_remove_frame_cb(ani);
+
+       if (force)
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
+       else
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       if (ani_frame)
+       {
+               backend_util_free_frame(ani_frame);
+               ani_frame = NULL;
+       }
+
+       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/bt_ani_pairing.c b/backends/default/bt_ani_pairing.c
new file mode 100644 (file)
index 0000000..7cc9b16
--- /dev/null
@@ -0,0 +1,163 @@
+/*
+ * 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 default_frame_info_t *ani_frame = NULL;
+
+static default_frame_info_t *
+_ani_backend_pairing_get_frame(default_ani_info *ani_info)
+{
+       default_frame_info_t *key_frame;
+       int idx;
+
+       if (ani_info->frame_idx == 0)
+       {
+               ani_info->frame_max = (unsigned int)(ani_info->frames[ani_info->key_frame_cur].frame_duration / ani_info->interval);
+       }
+
+       idx = ani_info->key_frame_cur;
+       key_frame = &ani_info->frames[idx];
+
+       for (int i = 0; i < key_frame->num_led; i++)
+       {
+               ani_frame->leds[i].color = key_frame->leds[i].color;
+       }
+
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= ani_info->frame_max)
+       {
+               ani_info->frame_idx = 0;
+               ani_info->key_frame_cur = (ani_info->key_frame_cur + 1) % ani_info->num_key_frames;
+               if (ani_info->repeat >= 0 && ani_info->key_frame_cur == 0)
+                       ani_info->repeat_cur++;
+       }
+
+       return ani_frame;
+}
+
+
+static pui_bool
+_ani_backend_pairing_frame_cb(void *data, int serial)
+{
+       int ret = 0;
+       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;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       /* 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);
+       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
+
+       return (pui_bool)ret;
+}
+
+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;
+
+       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);
+       if (repeat == 0) info->repeat = 1;
+       else info->repeat = repeat;
+
+       info->key_frame_cur = 0;
+       info->frame_idx = 0;
+       info->repeat_cur = 0;
+
+       if (!ani_frame)
+               ani_frame = backend_util_alloc_frame(info);
+       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
+
+       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_bool force)
+{
+       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, force=%d\n", info->id, force);
+
+       pui_backend_ani_remove_frame_cb(ani);
+
+       if (force)
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
+       else
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       if (ani_frame)
+       {
+               backend_util_free_frame(ani_frame);
+               ani_frame = NULL;
+       }
+
+       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;
+}
+
+
index 9ba98195cb0fedc1fddd7ba24c8980a7416df1e3..a44e9324dcbef39978a1236078bf853785bce33b 100644 (file)
@@ -23,7 +23,7 @@
  * SOFTWARE.
  */
 
-#include "../default_backend.h"
+#include "default_backend.h"
 
 static default_frame_info_t *ani_frame = NULL;
 
index 6ba3c9c6fcc975171f5406a68de7e787322119aa..be8813febe9655a14be02183ccb2a734f5e3afd8 100644 (file)
@@ -23,7 +23,7 @@
  * SOFTWARE.
  */
 
-#include "../default_backend.h"
+#include "default_backend.h"
 
 static default_frame_info_t *ani_frame = NULL;
 
diff --git a/backends/default/default_backend.c b/backends/default/default_backend.c
new file mode 100644 (file)
index 0000000..ef6b4e5
--- /dev/null
@@ -0,0 +1,857 @@
+/*
+ * 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"
+#include <limits.h>
+
+pui_backend_ani_func *ani_func = NULL;
+Eina_Hash *_animations_hash = NULL;
+pui_backend_ani_data *g_ani_data = NULL;
+
+#if 0
+static double
+_ani_backend_ease_function_get_intensity(pui_effect_func func, double interval)
+{
+       double intensity = interval;
+       switch (func)
+       {
+               case None:
+                       break;
+               case Linear:
+                       break;
+               case EaseInSine:
+                       intensity = 1 - cos(PI / 2 * interval);
+                       break;
+               case EaseOutSine:
+                       intensity = sin(PI / 2 * interval);
+                       break;
+               case EaseInQuart:
+                       intensity = interval * interval;
+                       break;
+               case EaseOutQuart:
+                       intensity = interval * (2 - interval);
+                       break;
+               default:
+                       break;
+       }
+
+       return intensity;
+}
+
+static unsigned int
+_ani_backend_get_value(unsigned int end_frame, unsigned int start_frame, double interval)
+{
+       double res = 0.0;
+
+       // interval: frame ratio between key frame to key frame
+       // end_frame and start_frame is key frame
+
+       res = (end_frame - start_frame) * interval + start_frame;
+
+       return res;
+}
+#endif
+
+static pui_bool
+_ani_backend_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;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       /* TODO : make use of ani_info */
+       (void) ani_info;
+
+       buffer = pui_backend_ani_get_buffer(ani);
+
+       if (!buffer)
+       {
+               pui_err("Failed to get buffer !\n");
+               return 0;
+       }
+
+       /* test example */
+       for(int i = 0; i<12; i++)
+       {
+               buffer->ptr[4*i] = 0;
+               buffer->ptr[4*i + 1] = (ani_info->frames[ani_info->frame_idx].leds[i].color & LED_MASK_RED) >> 16;//R
+               buffer->ptr[4*i + 2] = (ani_info->frames[ani_info->frame_idx].leds[i].color & LED_MASK_GREEN) >> 8;//G
+               buffer->ptr[4*i + 3] = ani_info->frames[ani_info->frame_idx].leds[i].color & LED_MASK_BLUE;//B
+       }
+
+       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;
+}
+
+default_ani_info *
+get_ani_info_from_ani_collection(pui_id id)
+{
+       default_ani_info *ani_info = NULL;
+
+       if (!_animations_hash)
+               return NULL;
+
+       pui_info("... id: %s\n", id);
+
+       ani_info = eina_hash_find(_animations_hash, id);
+
+       if (!ani_info)
+       {
+               pui_err("ani_info has NOT been found ! (id:%s)\n", id);
+               return NULL;
+       }
+
+       pui_info("ani_info has been found ! (id:%s)\n", id);
+
+       return ani_info;
+}
+
+pui_error
+_ani_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 *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       pui_info("... info->id: %s, repeat : %d\n", ani_info->id, repeat);
+
+       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
+       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_frame_cb, (double)ani_info->interval / 1000);
+
+       if (!ret)
+       {
+               pui_err("Failed to add frame callback !\n");
+               e = PUI_INT_ERROR_INVALID_RESOURCES;
+       }
+
+       return e;
+}
+
+pui_error
+_ani_stop(pui_ani_t *ani, pui_bool force)
+{
+       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, force=%d\n", info->id, force);
+
+       pui_backend_ani_remove_frame_cb(ani);
+
+       if (force)
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
+       else
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       return e;
+}
+
+static char *
+_read_json_file(const char *path, int *data_size)
+{
+       FILE *fp = fopen(path, "rb");
+       int size, ret;
+       char *buffer = NULL;
+       ERROR_CHECK(fp, return NULL, "Failed to open file: %s\n", path);
+
+       ret = fseek(fp, 0, SEEK_END);
+       ERROR_CHECK(ret == 0, goto error, "Failed to seek file. ret: %d\n", ret);
+       size = (long int)ftell(fp);
+       ERROR_CHECK(0 < size && size < INT_MAX, goto error, "Invalid file: %d size\n", size);
+       ret = fseek(fp, 0, SEEK_SET);
+       ERROR_CHECK(ret == 0, goto error, "Failed to seek file. ret: %d\n", ret);
+
+       buffer = (char *)calloc(sizeof(char), size + 1);
+       ERROR_CHECK(buffer, goto error, "Failed to allocate memory for buffer\n");
+
+       if (fread(buffer, size, 1, fp) < 1) {
+               goto error;
+       }
+
+       *data_size = size;
+       fclose(fp);
+       return buffer;
+
+error:
+       *data_size = 0;
+       if (buffer) free(buffer);
+       fclose(fp);
+       return NULL;
+}
+
+static default_ani_info *
+_read_json(const char *path)
+{
+       char *buffer, *type;
+       json_object *root_obj, *data_obj, *frame_obj, *frame_data_obj, *led_obj, *led_data_obj;
+       default_ani_info *ani_info = NULL;
+       int frame_id = 0, frame_len = 0, led_id = 0, led_len = 0;
+       int data_size = 0, i, j;
+
+       buffer = _read_json_file(path, &data_size);
+       ERROR_CHECK(buffer && data_size > 0, goto error, "File %s has no data\n", path);
+       root_obj = json_tokener_parse(buffer);
+       ERROR_CHECK(root_obj, goto error, "Failed to tokenize json object\n");
+
+       ani_info = (default_ani_info *)calloc(1, sizeof(default_ani_info));
+       ERROR_CHECK(ani_info, goto error, "Failed to alloc for animation info\n");
+
+       data_obj = json_object_object_get(root_obj, "type");
+       //printf("type: %s\n", json_object_get_string(data_obj));
+       type = (char *)json_object_get_string(data_obj);
+       ani_info->id = strndup(type, strlen(type));
+
+       data_obj = json_object_object_get(root_obj, "interval");
+       //printf("interval: %d\n", json_object_get_int(data_obj));
+       ani_info->interval = json_object_get_int(data_obj);
+
+       data_obj = json_object_object_get(root_obj, "frame");
+       frame_len = json_object_array_length(data_obj);
+
+       ani_info->num_key_frames = frame_len;
+       ani_info->frames = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), frame_len);
+       ERROR_CHECK(ani_info->frames, goto error, "Failed to alloc for default_frame_info_t\n");
+
+       for (i = 0; i < frame_len; i++) {
+               frame_obj = json_object_array_get_idx(data_obj, i);
+
+               frame_data_obj = json_object_object_get(frame_obj, "frame_id");
+               //printf("\tframe id: %d\n", json_object_get_int(frame_data_obj));
+               frame_id = json_object_get_int(frame_data_obj);
+
+               frame_data_obj = json_object_object_get(frame_obj, "frame_duration");
+               if (frame_data_obj)
+                       ani_info->frames[frame_id - 1].frame_duration = json_object_get_int(frame_data_obj);
+               else
+                       ani_info->frames[frame_id - 1].frame_duration = ani_info->interval;
+
+               frame_data_obj = json_object_object_get(frame_obj, "led");
+               led_len = json_object_array_length(frame_data_obj);
+
+               ani_info->frames[frame_id - 1].num_led = led_len;
+               if (ani_info->max_leds < led_len) ani_info->max_leds = led_len;
+               ani_info->frames[frame_id - 1].leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), led_len);
+               ERROR_CHECK(ani_info->frames[frame_id - 1].leds, goto error, "Failed to alloc for default_led_info_t\n");
+
+               for (j = 0; j < led_len; j++) {
+                       led_obj = json_object_array_get_idx(frame_data_obj, j);
+
+                       led_data_obj = json_object_object_get(led_obj, "id");
+                       //printf("\t\tid: %2d  ", json_object_get_int(led_data_obj));
+                       led_id = json_object_get_int(led_data_obj);
+
+                       led_data_obj = json_object_object_get(led_obj, "color");
+                       //printf("color: %s\n", json_object_get_string(led_data_obj));
+                       ani_info->frames[frame_id - 1].leds[led_id - 1].color =
+                               strtol(json_object_get_string(led_data_obj), NULL, 16);
+               }
+       }
+
+       free(buffer);
+       return ani_info;
+
+error:
+       if (buffer) free(buffer);
+       if (ani_info) {
+               if (ani_info->frames) {
+                       for (i = 0; i < ani_info->num_key_frames; i++) {
+                               if (ani_info->frames[i].leds)
+                                       free(ani_info->frames[i].leds);
+                       }
+                       free(ani_info->frames);
+               }
+               free(ani_info->id);
+               free(ani_info);
+       }
+       return NULL;
+}
+
+int
+_find_directory(const char *path, Eina_List **json_list)
+{
+       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 count;
+}
+
+default_ani_info *
+_create_default_ani_info(char *type)
+{
+       default_ani_info *ani_info = NULL;
+       int frame_len = 1;
+       int led_len = 12;
+
+       ani_info = (default_ani_info *)calloc(1, sizeof(default_ani_info));
+       ERROR_CHECK(ani_info, goto error, "Failed to alloc for animation info\n");
+
+       ani_info->id = strndup(type, strlen(type));
+       ani_info->interval = 50;
+
+       ani_info->num_key_frames = frame_len;
+       ani_info->frames = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), frame_len);
+       ERROR_CHECK(ani_info->frames, goto error, "Failed to alloc for default_frame_info_t\n");
+
+       ani_info->frames[0].frame_duration = 500;
+       ani_info->frames[0].num_led = led_len;
+       ani_info->max_leds = led_len;
+       ani_info->frames[0].leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), led_len);
+       ERROR_CHECK(ani_info->frames[0].leds, goto error, "Failed to alloc for default_led_info_t\n");
+
+       return ani_info;
+
+error:
+       if (ani_info) {
+               if (ani_info->frames) {
+                       for (int i = 0; i < ani_info->num_key_frames; i++) {
+                               if (ani_info->frames[i].leds)
+                                       free(ani_info->frames[i].leds);
+                       }
+                       free(ani_info->frames);
+               }
+               free(ani_info->id);
+               free(ani_info);
+       }
+       return NULL;
+}
+
+
+pui_int_error
+_create_ani_collection(void)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       default_ani_info *ani_info;
+       Eina_List *json_list = NULL;
+       Eina_List *l, *l_next;
+       Eina_Stringshare *path;
+
+       // load and store all of animation data
+
+       _find_directory(ANI_COLLECTION_DIR, &json_list);
+
+       pui_err("Start create ani collect...\n");
+
+       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);
+                       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);
+       }
+
+       //TODO
+       ani_info = _create_default_ani_info("default/clear_fadeout");
+       if (ani_info) {
+               eina_hash_add(_animations_hash, ani_info->id, ani_info);
+               pui_err("Success to load default animation (id: %s)\n", ani_info->id);
+       }
+       ani_info = _create_default_ani_info("default/clear_immediate");
+       if (ani_info) {
+               eina_hash_add(_animations_hash, ani_info->id, ani_info);
+               pui_err("Success to load default animation (id: %s)\n", ani_info->id);
+       }
+
+       pui_err("End create ani collect...\n");
+
+       return e;
+}
+
+pui_bool
+_geometry_get(int *width, int *height)
+{
+       if (!width || !height)
+               return 0;
+
+       if (width)
+               *width = DEFAULT_BACKEND_GEOM_WIDTH;
+       if (height)
+               *height = DEFAULT_BACKEND_GEOM_HEIGHT;
+
+       return 1;
+}
+
+pui_int_error
+_is_ani_supported(pui_id id)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       default_ani_info *ani_info;
+
+       //TODO
+       /* if the given id is not supported, return PUI_INT_ERROR_ID_NOT_SUPPORTED. */
+       if (!id) {
+               e = PUI_INT_ERROR_ID_NOT_SUPPORTED;
+               return e;
+       }
+       ani_info = eina_hash_find(_animations_hash, id);
+
+       if (!ani_info)
+               e = PUI_INT_ERROR_ID_NOT_SUPPORTED;
+
+       return e;
+}
+
+static void
+_ani_info_cleanup(default_ani_info *ani_info)
+{
+       int i;
+
+       if (!ani_info)
+               return;
+
+       if (ani_info->frames)
+       {
+               for (i = 0; i < ani_info->num_key_frames; i++)
+               {
+                       if (ani_info->frames[i].leds)
+                               free(ani_info->frames[i].leds);
+               }
+
+               free(ani_info->frames);
+       }
+
+       free(ani_info->id);
+}
+
+pui_backend_ani_data *
+_ani_create(pui_id id)
+{
+       pui_backend_ani_data *ani_data = NULL;
+       pui_backend_ani_func *ani_func = NULL;
+
+       /* backend's animation specific info */
+       default_ani_info *ani_info = NULL;
+
+       //TODO : return NULL if the animation correspond to the given id dones't exist.
+       if (PUI_INT_ERROR_NONE != _is_ani_supported(id))
+       {
+               pui_err("The animation(%s) doesn't supported !\n", id);
+               return NULL;
+       }
+
+       /* allocation of the structure of function pointers that will be called from pui_ani_control() */
+       ani_func = pui_backend_ani_alloc_ani_func();
+
+       if (!ani_func)
+       {
+               pui_err("Failed to allocate memory ! (pui backend ani func)\n");
+               return NULL;
+       }
+
+       /* get animation info associate with the given id from animation collection */
+       ani_info = get_ani_info_from_ani_collection(id);
+
+       if (!ani_info)
+       {
+               pui_err("Failed to get ani info from animation collection !\n");
+               goto err;
+       }
+
+       /* allocate backend ani_data and return it to pui ani core */
+       ani_data = (pui_backend_ani_data *)calloc(1, sizeof(pui_backend_ani_data));
+
+       if (!ani_data)
+       {
+               pui_err("Failed to allocate memory for pui backend ani data !\n");
+               goto err;
+       }
+
+       /* Assign each function pointer that corresponds to the given id if needed. */
+       if (!strncmp(ani_info->id, "system/easy_setup", sizeof("system/easy_setup")))
+       {
+               pui_default_backend_ani_easysetup_func_set(ani_func);
+       }
+       else if (!strncmp(ani_info->id, "system/processing", sizeof("system/processing")))
+       {
+               pui_default_backend_ani_system_processing_func_set(ani_func);
+       }
+       else if (!strncmp(ani_info->id, "system/sw_update_done", sizeof("system/sw_update_done")))
+       {
+               pui_default_backend_ani_swupdatedone_func_set(ani_func);
+       }
+       else if (!strncmp(ani_info->id, "system/mic_off", sizeof("system/mic_off")))
+       {
+               pui_default_backend_ani_micoff_func_set(ani_func);
+       }
+       else if (!strncmp(ani_info->id, "voice/listening", sizeof("voice/listening")))
+       {
+               pui_default_backend_ani_listening_func_set(ani_func);
+       }
+       else if (!strncmp(ani_info->id, "voice/streaming", sizeof("voice/streaming")))
+       {
+               pui_default_backend_ani_streaming_func_set(ani_func);
+       }
+       else if (!strncmp(ani_info->id, "voice/processing", sizeof("voice/processing")))
+       {
+               pui_default_backend_ani_processing_func_set(ani_func);
+       }
+       else if (!strncmp(ani_info->id, "voice/speaking", sizeof("voice/speaking")))
+       {
+               pui_default_backend_ani_speaking_func_set(ani_func);
+       }
+       else if (!strncmp(ani_info->id, "voice/timeout", sizeof("voice/timeout")))
+       {
+               pui_default_backend_ani_timeout_func_set(ani_func);
+       }
+       else if (!strncmp(ani_info->id, "notification/normal", sizeof("notification/normal")))
+       {
+               pui_default_backend_ani_normal_func_set(ani_func);
+       }
+       else if (!strncmp(ani_info->id, "notification/emergency", sizeof("notification/emergency")))
+       {
+               pui_default_backend_ani_emergency_func_set(ani_func);
+       }
+       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, "notification/error", sizeof("notification/error")))
+       {
+               pui_default_backend_ani_error_func_set(ani_func);
+       }
+       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, "bt/pairing", sizeof("bt/pairing")))
+       {
+               pui_default_backend_ani_pairing_func_set(ani_func);
+       }
+       else if (!strncmp(ani_info->id, "bt/connected", sizeof("bt/connected")))
+       {
+               pui_default_backend_ani_connected_func_set(ani_func);
+       }
+       else if (!strncmp(ani_info->id, "default/clear_fadeout", sizeof("default/clear_fadeout")))
+       {
+               pui_default_backend_ani_clear_fadeout_func_set(ani_func);
+       }
+       else if (!strncmp(ani_info->id, "default/clear_immediate", sizeof("default/clear_immediate")))
+       {
+               pui_default_backend_ani_clear_immediate_func_set(ani_func);
+       }
+       else
+       {
+               pui_info("%s animation has no animation handler, using default handler\n", ani_info->id);
+               /* Assign each function pointer that corresponds to the given id if needed. */
+               ani_func->ani_start = _ani_start;
+               ani_func->ani_stop = _ani_stop;
+       }
+
+       ani_data->ani_func = ani_func;
+       ani_data->ani_info = (pui_backend_ani_info *)ani_info;
+
+       g_ani_data = ani_data;
+
+       return ani_data;
+
+err:
+       if (ani_func)
+       {
+               pui_backend_ani_free_ani_func(ani_func);
+               ani_func = NULL;
+       }
+
+       return NULL;
+}
+
+void
+_ani_destroy(pui_backend_ani_data *ani_data)
+{
+       if (!ani_data)
+               return;
+
+       if (ani_data->ani_func)
+       {
+               pui_backend_ani_free_ani_func(ani_data->ani_func);
+               ani_data->ani_func = NULL;
+       }
+
+       ani_data->ani_info = NULL;
+       g_ani_data = NULL;
+}
+
+static void
+_animation_data_free_cb(void *data)
+{
+       default_ani_info *ani_info = (default_ani_info *)data;
+
+       _ani_info_cleanup(ani_info);
+}
+
+default_frame_info_t *
+backend_util_alloc_frame(default_ani_info *ani_info)
+{
+       default_frame_info_t *frame;
+
+       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
+       ERROR_CHECK(frame, return NULL, "Failed to allocate memory for frame\n");
+
+       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), ani_info->max_leds);
+       ERROR_CHECK(frame->leds, goto error, "Failed to allocate memory for led\n");
+
+       frame->num_led = ani_info->max_leds;
+
+       return frame;
+
+error:
+       free(frame);
+       return NULL;
+}
+
+void
+backend_util_cleanup_frame(default_frame_info_t *frame)
+{
+       ERROR_CHECK(frame, return, "Invalid frame to cleanup\n");
+
+       for (int i = 0; i < frame->num_led; i++)
+       {
+               frame->leds[i].color = 0x0;
+       }
+       frame->frame_duration = 0;
+}
+
+void
+backend_util_free_frame(default_frame_info_t *frame)
+{
+       if (!frame) return;
+
+       if (frame->leds) free(frame->leds);
+       free(frame);
+}
+
+void
+pui_default_backend_ani_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);
+}
+
+int
+pui_default_backend_ani_update_frame(pui_ani_t *ani,
+                                                                                       pui_backend_ani_data *ani_data,
+                                                                                       pui_ani_control_buffer *buffer,
+                                                                                       default_frame_info_t *frame,
+                                                                                        int serial)
+{
+       pui_int_error e = PUI_INT_ERROR_NONE;
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+       unsigned int r = 0x0, g = 0x0, b = 0x0;
+
+       for(int i = 0; i<12; i++)
+       {
+               pui_default_backend_ani_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 */
+       }
+       backend_util_cleanup_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 0;
+       }
+
+       e = pui_backend_ani_update(ani);
+
+       if (e != PUI_INT_ERROR_NONE)
+       {
+               pui_err("Failed on updating animation !(e=%d)\n", e);
+               return 0;
+       }
+
+       pui_info("... update (serial=%d), (repeat| cur: %d, want: %d)\n",
+               serial, ani_info->repeat_cur, ani_info->repeat);
+
+       if (ani_info->repeat >= 0 &&
+               ani_info->repeat_cur >= ani_info->repeat)
+       {
+               ani_data->ani_func->ani_stop(ani, EINA_FALSE);
+       }
+
+       return 1;
+}
+
+static pui_backend_module_data *
+pui_default_backend_init(void)
+{
+       pui_backend_module_data *backend_data = NULL;
+
+       backend_data = (pui_backend_module_data *)calloc(1, sizeof(pui_backend_module_data));
+
+       if (!backend_data)
+       {
+               pui_err("Failed to allocate memory for pui backend module data !\n");
+               return NULL;
+       }
+
+       backend_data->create_ani_collection = _create_ani_collection;
+       backend_data->geometry_get = _geometry_get;
+       backend_data->ani_create = _ani_create;
+       backend_data->ani_destroy = _ani_destroy;
+
+       /* Allocate backend specific data if needed. Now it will be empty. */
+       backend_data->data = NULL;
+       _animations_hash = eina_hash_string_superfast_new(NULL);
+
+       return backend_data;
+}
+
+static void
+pui_default_backend_deinit(pui_backend_module_data *backend_data)
+{
+       Eina_Iterator *it;
+       default_ani_info *ani_info = NULL;
+
+       if (!backend_data)
+               return;
+
+       if (backend_data->data)
+       {
+               //TODO : free variables of backend_data
+
+               free(backend_data->data);
+       }
+
+       if (g_ani_data)
+       {
+               if (g_ani_data->ani_func)
+               {
+                       pui_backend_ani_free_ani_func(g_ani_data->ani_func);
+                       g_ani_data->ani_func = NULL;
+               }
+
+               g_ani_data->ani_info = NULL;
+       }
+
+       if (_animations_hash)
+       {
+               it = eina_hash_iterator_data_new(_animations_hash);
+
+               EINA_ITERATOR_FOREACH(it, ani_info)
+               {
+                       _animation_data_free_cb(ani_info);
+                       free(ani_info);
+               }
+
+               eina_iterator_free(it);
+
+               eina_hash_free(_animations_hash);
+               _animations_hash = NULL;
+       }
+
+       backend_data->create_ani_collection = NULL;
+       backend_data->geometry_get = NULL;
+       backend_data->ani_create = NULL;
+       backend_data->ani_destroy = NULL;
+
+       free(backend_data);
+       backend_data = NULL;
+}
+
+pui_backend_module pui_backend_module_info = {
+       "Tizen Reference Speaker Backend",
+       "Samsung",
+       PUI_BACKEND_SET_ABI_VERSION(1, 0),
+       pui_default_backend_init,
+       pui_default_backend_deinit
+};
+
diff --git a/backends/default/default_backend.h b/backends/default/default_backend.h
new file mode 100644 (file)
index 0000000..446875c
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * 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 <stdio.h>
+#include <stdlib.h>
+#include <PUI_backend.h>
+
+#include <json-c/json.h>
+#include <dirent.h>
+#include <errno.h>
+#include <Eina.h>
+#include <config.h>
+#include <Ecore.h>
+//#include <cmath.h>
+
+#define ANI_COLLECTION_DIR "/usr/share/pui/"
+#define MAX_STR 1024
+
+#define DEFAULT_BACKEND_GEOM_WIDTH 12
+#define DEFAULT_BACKEND_GEOM_HEIGHT 1
+
+#ifndef PI
+#define PI 3.1415926545
+#endif
+
+#define LED_MASK_RED   0xFF0000
+#define LED_MASK_GREEN 0x00FF00
+#define LED_MASK_BLUE  0x0000FF
+
+#define ERROR_CHECK(exp, action, fmt, ...) \
+       do { \
+               if (!(exp)) \
+               { \
+                       printf(fmt, ##__VA_ARGS__);     \
+                       action; \
+               } \
+       } while (0)
+
+typedef enum
+{
+       None,
+       Linear,
+       EaseInSine,
+       EaseOutSine,
+       EaseInQuart,
+       EaseOutQuart
+} pui_effect_func;
+
+typedef struct _default_ani_info default_ani_info;
+typedef struct _default_frame_info_t default_frame_info_t;
+typedef struct _default_led_info_t default_led_info_t;
+
+struct _default_ani_info
+{
+       pui_id id;
+       pui_ani_status status;
+       pui_ani_control_buffer *buffer;
+       int repeat;
+
+       unsigned int num_key_frames;
+       default_frame_info_t *frames;
+       int interval;
+       unsigned int max_leds;
+       pui_effect_func effect_func;
+
+       unsigned int repeat_cur;
+       unsigned int frame_idx;
+       unsigned int frame_max;
+       unsigned int key_frame_cur;
+};
+
+struct _default_frame_info_t
+{
+       default_led_info_t *leds;
+       int num_led;
+       int frame_duration;
+};
+
+struct _default_led_info_t
+{
+       unsigned int color;
+};
+
+default_frame_info_t *backend_util_alloc_frame(default_ani_info *ani_info);
+void backend_util_cleanup_frame(default_frame_info_t *frame);
+void backend_util_free_frame(default_frame_info_t *frame);
+
+void pui_default_backend_ani_listening_func_set(pui_backend_ani_func *func);
+void pui_default_backend_ani_speaking_func_set(pui_backend_ani_func *func);
+void pui_default_backend_ani_processing_func_set(pui_backend_ani_func *func);
+void pui_default_backend_ani_streaming_func_set(pui_backend_ani_func *func);
+void pui_default_backend_ani_timeout_func_set(pui_backend_ani_func *func);
+void pui_default_backend_ani_system_processing_func_set(pui_backend_ani_func *func);
+void pui_default_backend_ani_normal_func_set(pui_backend_ani_func *func);
+void pui_default_backend_ani_emergency_func_set(pui_backend_ani_func *func);
+void pui_default_backend_ani_easysetup_func_set(pui_backend_ani_func *func);
+void pui_default_backend_ani_swupdatedone_func_set(pui_backend_ani_func *func);
+void pui_default_backend_ani_micoff_func_set(pui_backend_ani_func *func);
+void pui_default_backend_ani_networkerror_func_set(pui_backend_ani_func *func);
+void pui_default_backend_ani_error_func_set(pui_backend_ani_func *func);
+void pui_default_backend_ani_alarm_func_set(pui_backend_ani_func *func);
+void pui_default_backend_ani_connected_func_set(pui_backend_ani_func *func);
+void pui_default_backend_ani_pairing_func_set(pui_backend_ani_func *func);
+void pui_default_backend_ani_clear_fadeout_func_set(pui_backend_ani_func *func);
+void pui_default_backend_ani_clear_immediate_func_set(pui_backend_ani_func *func);
+
+void pui_default_backend_ani_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b);
+int pui_default_backend_ani_update_frame(pui_ani_t *ani, pui_backend_ani_data *ani_data, pui_ani_control_buffer *buffer, default_frame_info_t *frame, int serial);
\ No newline at end of file
diff --git a/backends/default/notification_ani_alarm.c b/backends/default/notification_ani_alarm.c
new file mode 100644 (file)
index 0000000..26cfb27
--- /dev/null
@@ -0,0 +1,187 @@
+/*
+ * 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 default_frame_info_t *ani_frame = NULL;
+
+static default_frame_info_t *
+_ani_backend_alarm_get_frame(default_ani_info *ani_info)
+{
+/* FIXME: ALAMR_FRAME need to changed after we imply animation type, suchas ease function */
+#define ALARM_FRAME 18
+       default_frame_info_t *key_frame, *key_frame2;
+       int idx, idx2;
+       unsigned int r, g, b, r2, g2, b2;
+       int r3, g3, b3;
+       double div;
+
+       if (ani_info->frame_idx == 0)
+       {
+               ani_info->frame_max = (unsigned int)(ani_info->frames[ani_info->key_frame_cur].frame_duration / ani_info->interval);
+       }
+
+       idx = ani_info->key_frame_cur;
+       key_frame = &ani_info->frames[idx];
+
+       if (ani_info->key_frame_cur < ALARM_FRAME)
+       {
+               for (int i = 0; i < key_frame->num_led; i++)
+               {
+                       ani_frame->leds[i].color = key_frame->leds[i].color;
+               }
+       }
+       else
+       {
+               idx2 = (idx + 1) % ani_info->num_key_frames;
+               key_frame2 = &ani_info->frames[idx2];
+               div = (double)(ani_info->frame_idx) / (double)ani_info->frame_max;
+               r = g = b = r2 = g2 = b2 = 0x0;
+               for (int i = 0; i < key_frame->num_led; i++)
+               {
+                       pui_default_backend_ani_get_led_rgb(key_frame, i, &r, &g, &b);
+                       pui_default_backend_ani_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;
+
+                       ani_frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
+               }
+       }
+
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= ani_info->frame_max)
+       {
+               ani_info->frame_idx = 0;
+               ani_info->key_frame_cur = (ani_info->key_frame_cur + 1) % ani_info->num_key_frames;
+               if (ani_info->repeat >= 0 && ani_info->key_frame_cur == 0)
+                       ani_info->repeat_cur++;
+       }
+
+       return ani_frame;
+}
+
+static pui_bool
+_ani_backend_alarm_frame_cb(void *data, int serial)
+{
+       int ret = 0;
+       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;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       /* 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);
+       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
+
+       return (pui_bool)ret;
+}
+
+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;
+
+       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);
+       if (repeat == 0) info->repeat = 1;
+       else info->repeat = repeat;
+
+       info->key_frame_cur = 0;
+       info->frame_idx = 0;
+       info->repeat_cur = 0;
+
+       if (!ani_frame)
+               ani_frame = backend_util_alloc_frame(info);
+       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
+
+       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_bool force)
+{
+       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, force=%d\n", info->id, force);
+
+       pui_backend_ani_remove_frame_cb(ani);
+
+       if (force)
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
+       else
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       if (ani_frame)
+       {
+               backend_util_free_frame(ani_frame);
+               ani_frame = NULL;
+       }
+
+       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/notification_ani_emergency.c b/backends/default/notification_ani_emergency.c
new file mode 100644 (file)
index 0000000..aa20378
--- /dev/null
@@ -0,0 +1,177 @@
+/*
+ * 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 default_frame_info_t *ani_frame = NULL;
+
+static default_frame_info_t *
+_ani_backend_emergency_get_frame(default_ani_info *ani_info)
+{
+       default_frame_info_t *key_frame, *key_frame2;
+       int idx, idx2;
+       unsigned int r, g, b, r2, g2, b2;
+       int r3, g3, b3;
+       double div;
+
+       if (ani_info->frame_idx == 0)
+       {
+               ani_info->frame_max = (unsigned int)(ani_info->frames[ani_info->key_frame_cur].frame_duration / ani_info->interval);
+       }
+
+       idx = ani_info->key_frame_cur;
+       idx2 = (idx + 1) % ani_info->num_key_frames;
+
+       key_frame = &ani_info->frames[idx];
+       key_frame2 = &ani_info->frames[idx2];
+
+       div = (double)(ani_info->frame_idx) / (double)ani_info->frame_max;
+       r = g = b = r2 = g2 = b2 = 0x0;
+       for (int i = 0; i < key_frame->num_led; i++)
+       {
+               pui_default_backend_ani_get_led_rgb(key_frame, i, &r, &g, &b);
+               pui_default_backend_ani_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;
+
+               ani_frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
+       }
+
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= ani_info->frame_max)
+       {
+               ani_info->frame_idx = 0;
+               ani_info->key_frame_cur = (ani_info->key_frame_cur + 1) % ani_info->num_key_frames;
+               if (ani_info->repeat >= 0 && ani_info->key_frame_cur == 0)
+                       ani_info->repeat_cur++;
+       }
+
+       return ani_frame;
+}
+
+
+static pui_bool
+_ani_backend_emergency_frame_cb(void *data, int serial)
+{
+       int ret = 0;
+       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;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       /* 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);
+       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
+
+       return (pui_bool)ret;
+}
+
+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;
+
+       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);
+       if (repeat == 0) info->repeat = 1;
+       else info->repeat = repeat;
+
+       info->key_frame_cur = 0;
+       info->frame_idx = 0;
+       info->repeat_cur = 0;
+
+       if (!ani_frame)
+               ani_frame = backend_util_alloc_frame(info);
+       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
+
+       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_bool force)
+{
+       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, force=%d\n", info->id, force);
+
+       pui_backend_ani_remove_frame_cb(ani);
+
+       if (force)
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
+       else
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       if (ani_frame)
+       {
+               backend_util_free_frame(ani_frame);
+               ani_frame = NULL;
+       }
+
+       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/notification_ani_error.c b/backends/default/notification_ani_error.c
new file mode 100644 (file)
index 0000000..30d266b
--- /dev/null
@@ -0,0 +1,167 @@
+/*
+ * 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 default_frame_info_t *ani_frame = NULL;
+
+static default_frame_info_t *
+_ani_backend_error_get_frame(default_ani_info *ani_info)
+{
+/* FIXME: ALAMR_FRAME need to changed after we imply animation type, suchas ease function */
+#define BLINK_FRAME 2
+       default_frame_info_t *key_frame;
+
+       key_frame = &ani_info->frames[0];
+
+       if (ani_info->frame_idx % BLINK_FRAME == 0)
+       {
+               for (int i = 0; i < key_frame->num_led; i++)
+               {
+                       ani_frame->leds[i].color = key_frame->leds[i].color;
+               }
+       }
+       else
+       {
+               for (int i = 0; i < key_frame->num_led; i++)
+               {
+                       ani_frame->leds[i].color = 0x000000;
+               }
+       }
+
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= BLINK_FRAME)
+       {
+               if (ani_info->repeat >= 0)
+                       ani_info->repeat_cur++;
+               ani_info->frame_idx = 0;
+       }
+
+       return ani_frame;
+}
+
+
+static pui_bool
+_ani_backend_error_frame_cb(void *data, int serial)
+{
+       int ret = 0;
+       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;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       /* 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);
+       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
+
+       return (pui_bool)ret;
+}
+
+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;
+
+       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);
+       if (repeat == 0) info->repeat = 1;
+       else info->repeat = repeat;
+
+       info->key_frame_cur = 0;
+       info->frame_idx = 0;
+       info->repeat_cur = 0;
+
+       if (!ani_frame)
+               ani_frame = backend_util_alloc_frame(info);
+       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
+
+       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_bool force)
+{
+       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, force=%d\n", info->id, force);
+
+       pui_backend_ani_remove_frame_cb(ani);
+
+       if (force)
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
+       else
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       if (ani_frame)
+       {
+               backend_util_free_frame(ani_frame);
+               ani_frame = NULL;
+       }
+
+       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/notification_ani_networkerror.c b/backends/default/notification_ani_networkerror.c
new file mode 100644 (file)
index 0000000..c00f8b5
--- /dev/null
@@ -0,0 +1,163 @@
+/*
+ * 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 default_frame_info_t *ani_frame = NULL;
+
+static default_frame_info_t *
+_ani_backend_networkerror_get_frame(default_ani_info *ani_info)
+{
+       default_frame_info_t *key_frame;
+       int idx;
+
+       if (ani_info->frame_idx == 0)
+       {
+               ani_info->frame_max = (unsigned int)(ani_info->frames[ani_info->key_frame_cur].frame_duration / ani_info->interval);
+       }
+
+       idx = ani_info->key_frame_cur;
+       key_frame = &ani_info->frames[idx];
+
+       for (int i = 0; i < key_frame->num_led; i++)
+       {
+               ani_frame->leds[i].color = key_frame->leds[i].color;
+       }
+
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= ani_info->frame_max)
+       {
+               ani_info->frame_idx = 0;
+               ani_info->key_frame_cur = (ani_info->key_frame_cur + 1) % ani_info->num_key_frames;
+               if (ani_info->repeat >= 0 && ani_info->key_frame_cur == 0)
+                       ani_info->repeat_cur++;
+       }
+
+       return ani_frame;
+}
+
+
+static pui_bool
+_ani_backend_networkerror_frame_cb(void *data, int serial)
+{
+       int ret = 0;
+       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;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       /* 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);
+       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
+
+       return (pui_bool)ret;
+}
+
+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;
+
+       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);
+       if (repeat == 0) info->repeat = 1;
+       else info->repeat = repeat;
+
+       info->key_frame_cur = 0;
+       info->frame_idx = 0;
+       info->repeat_cur = 0;
+
+       if (!ani_frame)
+               ani_frame = backend_util_alloc_frame(info);
+       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
+
+       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_bool force)
+{
+       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, force=%d\n", info->id, force);
+
+       pui_backend_ani_remove_frame_cb(ani);
+
+       if (force)
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
+       else
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       if (ani_frame)
+       {
+               backend_util_free_frame(ani_frame);
+               ani_frame = NULL;
+       }
+
+       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/notification_ani_normal.c b/backends/default/notification_ani_normal.c
new file mode 100644 (file)
index 0000000..7aea733
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * 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 default_frame_info_t *ani_frame = NULL;
+
+static default_frame_info_t *
+_ani_backend_normal_get_frame(default_ani_info *ani_info)
+{
+       default_frame_info_t *key_frame, *key_frame2;
+       int idx, idx2;
+       unsigned int r, g, b, r2, g2, b2;
+       int r3, g3, b3;
+       double div;
+
+       if (ani_info->frame_idx == 0)
+       {
+               ani_info->frame_max = (unsigned int)(ani_info->frames[ani_info->key_frame_cur].frame_duration / ani_info->interval);
+       }
+
+       idx = ani_info->key_frame_cur;
+       idx2 = (idx + 1) % ani_info->num_key_frames;
+
+       key_frame = &ani_info->frames[idx];
+       key_frame2 = &ani_info->frames[idx2];
+
+       div = (double)(ani_info->frame_idx) / (double)ani_info->frame_max;
+       r = g = b = r2 = g2 = b2 = 0x0;
+       for (int i = 0; i < key_frame->num_led; i++)
+       {
+               pui_default_backend_ani_get_led_rgb(key_frame, i, &r, &g, &b);
+               pui_default_backend_ani_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;
+
+               ani_frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
+       }
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= ani_info->frame_max)
+       {
+               ani_info->frame_idx = 0;
+               ani_info->key_frame_cur = (ani_info->key_frame_cur + 1) % ani_info->num_key_frames;
+               if (ani_info->repeat >= 0 && ani_info->key_frame_cur == 0)
+                       ani_info->repeat_cur++;
+       }
+
+       return ani_frame;
+}
+
+
+static pui_bool
+_ani_backend_normal_frame_cb(void *data, int serial)
+{
+       int ret = 0;
+       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;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       /* 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);
+       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
+
+       return (pui_bool)ret;
+}
+
+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;
+
+       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);
+       if (repeat == 0) info->repeat = 1;
+       else info->repeat = repeat;
+
+       info->key_frame_cur = 0;
+       info->frame_idx = 0;
+       info->repeat_cur = 0;
+
+       if (!ani_frame)
+               ani_frame = backend_util_alloc_frame(info);
+       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
+
+       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_bool force)
+{
+       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, force=%d\n", info->id, force);
+
+       pui_backend_ani_remove_frame_cb(ani);
+
+       if (force)
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
+       else
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       if (ani_frame)
+       {
+               backend_util_free_frame(ani_frame);
+               ani_frame = NULL;
+       }
+
+       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/res/bt/connected.json b/backends/default/res/bt/connected.json
new file mode 100644 (file)
index 0000000..8a78b34
--- /dev/null
@@ -0,0 +1,40 @@
+{
+       "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"}
+                       ]
+               },
+               {
+                       "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"}
+                       ]
+               }
+       ]
+}
diff --git a/backends/default/res/bt/pairing.json b/backends/default/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/default/res/notification/alarm.json b/backends/default/res/notification/alarm.json
new file mode 100644 (file)
index 0000000..c0f1afe
--- /dev/null
@@ -0,0 +1,366 @@
+{
+       "type": "notification/alarm",
+       "interval": 40,
+       "frame": [
+               {
+                       "frame_id": 1,
+                       "frame_duration": 480,
+                       "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,
+                       "frame_duration": 400,
+                       "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,
+                       "frame_duration": 600,
+                       "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,
+                       "frame_duration": 480,
+                       "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,
+                       "frame_duration": 400,
+                       "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,
+                       "frame_duration": 600,
+                       "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": 7,
+                       "frame_duration": 480,
+                       "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": 8,
+                       "frame_duration": 400,
+                       "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": 9,
+                       "frame_duration": 600,
+                       "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": 10,
+                       "frame_duration": 480,
+                       "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": 11,
+                       "frame_duration": 400,
+                       "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": 12,
+                       "frame_duration": 600,
+                       "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": 13,
+                       "frame_duration": 480,
+                       "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": 14,
+                       "frame_duration": 400,
+                       "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": 15,
+                       "frame_duration": 600,
+                       "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": 16,
+                       "frame_duration": 480,
+                       "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": 17,
+                       "frame_duration": 400,
+                       "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": 18,
+                       "frame_duration": 600,
+                       "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": 19,
+                       "frame_duration": 3200,
+                       "led": [
+                               {"id": 1,  "color": "FFFFFF"},
+                               {"id": 2,  "color": "FFFFFF"},
+                               {"id": 3,  "color": "FFFFFF"},
+                               {"id": 4,  "color": "FFFFFF"},
+                               {"id": 5,  "color": "FFFFFF"},
+                               {"id": 6,  "color": "FFFFFF"},
+                               {"id": 7,  "color": "FFFFFF"},
+                               {"id": 8,  "color": "FFFFFF"},
+                               {"id": 9,  "color": "FFFFFF"},
+                               {"id": 10, "color": "FFFFFF"},
+                               {"id": 11, "color": "FFFFFF"},
+                               {"id": 12, "color": "FFFFFF"}
+                       ]
+               },
+               {
+                       "frame_id": 20,
+                       "frame_duration": 40,
+                       "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/default/res/notification/emergency.json b/backends/default/res/notification/emergency.json
new file mode 100644 (file)
index 0000000..076cb51
--- /dev/null
@@ -0,0 +1,42 @@
+{
+       "type": "notification/emergency",
+       "interval": 400,
+       "frame": [
+               {
+                       "frame_id": 1,
+                       "frame_duration": 1200,
+                       "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,
+                       "frame_duration": 1200,
+                       "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/default/res/notification/error.json b/backends/default/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/default/res/notification/network_error.json b/backends/default/res/notification/network_error.json
new file mode 100644 (file)
index 0000000..6f2041b
--- /dev/null
@@ -0,0 +1,41 @@
+{
+       "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"}
+                       ]
+               },
+               {
+                       "frame_id": 2,
+                       "frame_duration": 500,
+                       "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/default/res/notification/normal.json b/backends/default/res/notification/normal.json
new file mode 100644 (file)
index 0000000..ed8dc88
--- /dev/null
@@ -0,0 +1,59 @@
+{
+       "type": "notification/normal",
+       "interval": 50,
+       "frame": [
+               {
+                       "frame_id": 1,
+                       "frame_duration": 500,
+                       "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,
+                       "frame_duration": 500,
+                       "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/default/res/system/easy_setup.json b/backends/default/res/system/easy_setup.json
new file mode 100644 (file)
index 0000000..cd7bf9f
--- /dev/null
@@ -0,0 +1,60 @@
+{
+       "type": "system/easy_setup",
+       "interval": 30,
+       "frame": [
+               {
+                       "frame_id": 1,
+                       "frame_duration": 270,
+                       "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,
+                       "frame_duration": 420,
+                       "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"}
+                       ]
+               },
+               {
+                       "frame_id": 3,
+                       "frame_duration": 300,
+                       "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"}
+                       ]
+               },
+       ]
+}
diff --git a/backends/default/res/system/mic_off.json b/backends/default/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/default/res/system/processing.json b/backends/default/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/default/res/system/sw_update_done.json b/backends/default/res/system/sw_update_done.json
new file mode 100644 (file)
index 0000000..851b419
--- /dev/null
@@ -0,0 +1,60 @@
+{
+       "type": "system/sw_update_done",
+       "interval": 30,
+       "frame": [
+               {
+                       "frame_id": 1,
+                       "frame_duration": 210,
+                       "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": 2,
+                       "frame_duration": 450,
+                       "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,
+                       "frame_duration": 120,
+                       "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/default/res/voice/listening.json b/backends/default/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/default/res/voice/processing.json b/backends/default/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/default/res/voice/speaking.json b/backends/default/res/voice/speaking.json
new file mode 100644 (file)
index 0000000..fbd98b0
--- /dev/null
@@ -0,0 +1,60 @@
+{
+       "type": "voice/speaking",
+       "interval": 30,
+       "frame": [
+               {
+                       "frame_id": 1,
+                       "frame_duration": 270,
+                       "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,
+                       "frame_duration": 420,
+                       "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,
+                       "frame_duration": 330,
+                       "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"}
+                       ]
+               }
+       ]
+}
diff --git a/backends/default/res/voice/streaming.json b/backends/default/res/voice/streaming.json
new file mode 100644 (file)
index 0000000..5fc1381
--- /dev/null
@@ -0,0 +1,60 @@
+{
+       "type": "voice/streaming",
+       "interval": 30,
+       "frame": [
+               {
+                       "frame_id": 1,
+                       "frame_duration": 210,
+                       "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,
+                       "frame_duration": 210,
+                       "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"}
+                       ]
+               },
+               {
+                       "frame_id": 3,
+                       "frame_duration": 480,
+                       "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/default/res/voice/timeout.json b/backends/default/res/voice/timeout.json
new file mode 100644 (file)
index 0000000..3b7df7b
--- /dev/null
@@ -0,0 +1,96 @@
+{
+       "type": "voice/timeout",
+       "interval": 30,
+       "frame": [
+               {
+                       "frame_id": 1,
+                       "frame_duration": 120,
+                       "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,
+                       "frame_duration": 120,
+                       "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,
+                       "frame_duration": 570,
+                       "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,
+                       "frame_duration": 1200,
+                       "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,
+                       "frame_duration": 30,
+                       "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/default/system_ani_easysetup.c b/backends/default/system_ani_easysetup.c
new file mode 100644 (file)
index 0000000..c884d6b
--- /dev/null
@@ -0,0 +1,173 @@
+/*
+ * 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 default_frame_info_t *ani_frame = NULL;
+
+static default_frame_info_t *
+_ani_backend_easysetup_get_frame(default_ani_info *ani_info)
+{
+       default_frame_info_t *key_frame, *key_frame2;
+       int idx, idx2;
+       unsigned int r, g, b, r2, g2, b2;
+       int r3, g3, b3;
+       double div;
+
+       if (ani_info->frame_idx == 0)
+       {
+               ani_info->frame_max = (unsigned int)(ani_info->frames[ani_info->key_frame_cur].frame_duration / ani_info->interval);
+       }
+
+       idx = ani_info->key_frame_cur;
+       idx2 = (idx + 1) % ani_info->num_key_frames;
+
+       key_frame = &ani_info->frames[idx];
+       key_frame2 = &ani_info->frames[idx2];
+
+       div = (double)(ani_info->frame_idx) / (double)ani_info->frame_max;
+       r = g = b = r2 = g2 = b2 = 0x0;
+       for (int i = 0; i < key_frame->num_led; i++)
+       {
+               pui_default_backend_ani_get_led_rgb(key_frame, i, &r, &g, &b);
+               pui_default_backend_ani_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;
+
+               ani_frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
+       }
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= ani_info->frame_max)
+       {
+               ani_info->frame_idx = 0;
+               ani_info->key_frame_cur = (ani_info->key_frame_cur + 1) % ani_info->num_key_frames;
+               if (ani_info->repeat >= 0 && ani_info->key_frame_cur == 0)
+                       ani_info->repeat_cur++;
+       }
+
+       return ani_frame;
+}
+
+static pui_bool
+_ani_backend_easysetup_frame_cb(void *data, int serial)
+{
+       int ret = 0;
+       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;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       /* 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);
+       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
+
+       return (pui_bool)ret;
+}
+
+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;
+
+       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);
+       if (repeat == 0) info->repeat = 1;
+       else info->repeat = repeat;
+
+       info->key_frame_cur = 0;
+       info->frame_idx = 0;
+       info->repeat_cur = 0;
+
+       if (!ani_frame)
+               ani_frame = backend_util_alloc_frame(info);
+       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
+
+       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_bool force)
+{
+       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, force=%d\n", info->id, force);
+
+       pui_backend_ani_remove_frame_cb(ani);
+
+       if (force)
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
+       else
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       if (ani_frame)
+       {
+               backend_util_free_frame(ani_frame);
+               ani_frame = NULL;
+       }
+
+       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/system_ani_micoff.c b/backends/default/system_ani_micoff.c
new file mode 100644 (file)
index 0000000..1cf98ea
--- /dev/null
@@ -0,0 +1,150 @@
+/*
+ * 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 default_frame_info_t *ani_frame = NULL;
+
+static default_frame_info_t *
+_ani_backend_micoff_get_frame(default_ani_info *ani_info)
+{
+       default_frame_info_t *key_frame;
+
+       key_frame = &ani_info->frames[0];
+
+       for (int i = 0; i < key_frame->num_led; i++)
+       {
+               ani_frame->leds[i].color = key_frame->leds[i].color;
+       }
+
+       if (ani_info->repeat >= 0)
+               ani_info->repeat_cur++;
+
+       return ani_frame;
+}
+
+
+static pui_bool
+_ani_backend_micoff_frame_cb(void *data, int serial)
+{
+       int ret = 0;
+       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;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       /* 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);
+       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
+
+       return (pui_bool)ret;
+}
+
+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;
+
+       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);
+       if (repeat == 0) info->repeat = 1;
+       else info->repeat = repeat;
+
+       info->key_frame_cur = 0;
+       info->frame_idx = 0;
+       info->repeat_cur = 0;
+
+       if (!ani_frame)
+               ani_frame = backend_util_alloc_frame(info);
+       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
+
+       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_bool force)
+{
+       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, force=%d\n", info->id, force);
+
+       pui_backend_ani_remove_frame_cb(ani);
+
+       if (force)
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
+       else
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       if (ani_frame)
+       {
+               backend_util_free_frame(ani_frame);
+               ani_frame = NULL;
+       }
+
+       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/system_ani_swupdatedone.c b/backends/default/system_ani_swupdatedone.c
new file mode 100644 (file)
index 0000000..ba389aa
--- /dev/null
@@ -0,0 +1,177 @@
+/*
+ * 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 default_frame_info_t *ani_frame = NULL;
+
+static default_frame_info_t *
+_ani_backend_swupdatedone_get_frame(default_ani_info *ani_info)
+{
+       default_frame_info_t *key_frame, *key_frame2;
+       int idx, idx2;
+       unsigned int r, g, b, r2, g2, b2;
+       int r3, g3, b3;
+       double div;
+
+       if (ani_info->frame_idx == 0)
+       {
+               ani_info->frame_max = (unsigned int)(ani_info->frames[ani_info->key_frame_cur].frame_duration / ani_info->interval);
+       }
+
+       idx = ani_info->key_frame_cur;
+       idx2 = (idx + 1) % ani_info->num_key_frames;
+
+       key_frame = &ani_info->frames[idx];
+       key_frame2 = &ani_info->frames[idx2];
+
+       div = (double)(ani_info->frame_idx) / (double)ani_info->frame_max;
+       r = g = b = r2 = g2 = b2 = 0x0;
+
+       for (int i = 0; i < key_frame->num_led; i++)
+       {
+               pui_default_backend_ani_get_led_rgb(key_frame, i, &r, &g, &b);
+               pui_default_backend_ani_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;
+
+               ani_frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
+       }
+
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= ani_info->frame_max)
+       {
+               ani_info->frame_idx = 0;
+               ani_info->key_frame_cur = (ani_info->key_frame_cur + 1) % ani_info->num_key_frames;
+               if (ani_info->repeat >= 0 && ani_info->key_frame_cur == 0)
+                       ani_info->repeat_cur++;
+       }
+
+       return ani_frame;
+}
+
+static pui_bool
+_ani_backend_swupdatedone_frame_cb(void *data, int serial)
+{
+       int ret = 0;
+       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;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       /* 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);
+       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
+
+       return (pui_bool)ret;
+}
+
+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;
+
+       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);
+       if (repeat == 0) info->repeat = 1;
+       else info->repeat = repeat;
+
+       info->key_frame_cur = 0;
+       info->frame_idx = 0;
+       info->repeat_cur = 0;
+
+       if (!ani_frame)
+               ani_frame = backend_util_alloc_frame(info);
+       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
+
+       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_bool force)
+{
+       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, force=%d\n", info->id, force);
+
+       pui_backend_ani_remove_frame_cb(ani);
+
+       if (force)
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
+       else
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       if (ani_frame)
+       {
+               backend_util_free_frame(ani_frame);
+               ani_frame = NULL;
+       }
+
+       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/system_ani_system_processing.c b/backends/default/system_ani_system_processing.c
new file mode 100644 (file)
index 0000000..07919a1
--- /dev/null
@@ -0,0 +1,159 @@
+/*
+ * 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 default_frame_info_t *ani_frame = NULL;
+
+static default_frame_info_t *
+_ani_backend_system_processing_get_frame(default_ani_info *ani_info)
+{
+       default_frame_info_t *key_frame;
+
+       key_frame = &ani_info->frames[0];
+
+       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;
+               ani_frame->leds[idx] = key_frame->leds[i];
+       }
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= key_frame->num_led)
+       {
+               if (ani_info->repeat >= 0)
+                       ani_info->repeat_cur++;
+               ani_info->frame_idx = 0;
+       }
+
+       return ani_frame;
+}
+
+static pui_bool
+_ani_backend_system_processing_frame_cb(void *data, int serial)
+{
+       int ret = 0;
+       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;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       /* 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);
+       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
+
+       return (pui_bool)ret;
+}
+
+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;
+
+       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);
+       if (repeat == 0) info->repeat = 1;
+       else info->repeat = repeat;
+
+       info->key_frame_cur = 0;
+       info->frame_idx = 0;
+       info->repeat_cur = 0;
+
+       if (!ani_frame)
+               ani_frame = backend_util_alloc_frame(info);
+       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
+
+       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_bool force)
+{
+       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, force=%d\n", info->id, force);
+
+       pui_backend_ani_remove_frame_cb(ani);
+
+       if (force)
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
+       else
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       if (ani_frame)
+       {
+               backend_util_free_frame(ani_frame);
+               ani_frame = NULL;
+       }
+
+       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/voice_ani_listening.c b/backends/default/voice_ani_listening.c
new file mode 100644 (file)
index 0000000..c6700f6
--- /dev/null
@@ -0,0 +1,183 @@
+/*
+ * 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 default_frame_info_t *ani_frame = NULL;
+
+static default_frame_info_t *
+_ani_backend_listening_get_frame(default_ani_info *ani_info)
+{
+       default_frame_info_t *key_frame;
+       int division;
+
+       key_frame = &ani_info->frames[0];
+
+       division = (int)(key_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;
+                       }
+               }
+               ani_frame->leds[idx] = key_frame->leds[i];
+       }
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= key_frame->num_led)
+       {
+               if (ani_info->repeat >= 0)
+                       ani_info->repeat_cur++;
+               ani_info->frame_idx = 0;
+       }
+
+       return ani_frame;
+}
+
+static pui_bool
+_ani_backend_listening_frame_cb(void *data, int serial)
+{
+       int ret = 0;
+       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;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       /* 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);
+       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
+
+       return (pui_bool)ret;
+}
+
+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;
+
+       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);
+       if (repeat == 0) info->repeat = 1;
+       else info->repeat = repeat;
+
+       info->key_frame_cur = 0;
+       info->frame_idx = 0;
+       info->repeat_cur = 0;
+
+       if (!ani_frame)
+               ani_frame = backend_util_alloc_frame(info);
+       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
+
+       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_bool force)
+{
+       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, force=%d\n", info->id, force);
+
+       pui_backend_ani_remove_frame_cb(ani);
+
+       if (force)
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
+       else
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       if (ani_frame)
+       {
+               backend_util_free_frame(ani_frame);
+               ani_frame = NULL;
+       }
+
+       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/voice_ani_processing.c b/backends/default/voice_ani_processing.c
new file mode 100644 (file)
index 0000000..09e18e4
--- /dev/null
@@ -0,0 +1,159 @@
+/*
+ * 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 default_frame_info_t *ani_frame = NULL;
+
+static default_frame_info_t *
+_ani_backend_processing_get_frame(default_ani_info *ani_info)
+{
+       default_frame_info_t *key_frame;
+
+       key_frame = &ani_info->frames[0];
+
+       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;
+               ani_frame->leds[idx] = key_frame->leds[i];
+       }
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= key_frame->num_led)
+       {
+               if (ani_info->repeat >= 0)
+                       ani_info->repeat_cur++;
+               ani_info->frame_idx = 0;
+       }
+
+       return ani_frame;
+}
+
+static pui_bool
+_ani_backend_processing_frame_cb(void *data, int serial)
+{
+       int ret = 0;
+       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;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       /* 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);
+       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
+
+       return (pui_bool)ret;
+}
+
+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;
+
+       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);
+       if (repeat == 0) info->repeat = 1;
+       else info->repeat = repeat;
+
+       info->key_frame_cur = 0;
+       info->frame_idx = 0;
+       info->repeat_cur = 0;
+
+       if (!ani_frame)
+               ani_frame = backend_util_alloc_frame(info);
+       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
+
+       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_bool force)
+{
+       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, force=%d\n", info->id, force);
+
+       pui_backend_ani_remove_frame_cb(ani);
+
+       if (force)
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
+       else
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       if (ani_frame)
+       {
+               backend_util_free_frame(ani_frame);
+               ani_frame = NULL;
+       }
+
+       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/voice_ani_speaking.c b/backends/default/voice_ani_speaking.c
new file mode 100644 (file)
index 0000000..94dc1a5
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * 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 default_frame_info_t *ani_frame = NULL;
+
+static default_frame_info_t *
+_ani_backend_speaking_get_frame(default_ani_info *ani_info)
+{
+       default_frame_info_t *key_frame, *key_frame2;
+       int idx, idx2;
+       unsigned int r, g, b, r2, g2, b2;
+       int r3, g3, b3;
+       double div;
+
+       if (ani_info->frame_idx == 0)
+       {
+               ani_info->frame_max = (unsigned int)(ani_info->frames[ani_info->key_frame_cur].frame_duration / ani_info->interval);
+       }
+
+       idx = ani_info->key_frame_cur;
+       idx2 = (idx + 1) % ani_info->num_key_frames;
+
+       key_frame = &ani_info->frames[idx];
+       key_frame2 = &ani_info->frames[idx2];
+
+       div = (double)(ani_info->frame_idx) / (double)ani_info->frame_max;
+       r = g = b = r2 = g2 = b2 = 0x0;
+       for (int i = 0; i < key_frame->num_led; i++)
+       {
+               pui_default_backend_ani_get_led_rgb(key_frame, i, &r, &g, &b);
+               pui_default_backend_ani_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;
+
+               ani_frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
+       }
+       ani_info->frame_idx++;
+
+       if (ani_info->frame_idx >= ani_info->frame_max)
+       {
+               ani_info->frame_idx = 0;
+               ani_info->key_frame_cur = (ani_info->key_frame_cur + 1) % ani_info->num_key_frames;
+               if (ani_info->repeat >= 0 && ani_info->key_frame_cur == 0)
+                       ani_info->repeat_cur++;
+       }
+
+       return ani_frame;
+}
+
+static pui_bool
+_ani_backend_speaking_frame_cb(void *data, int serial)
+{
+       int ret = 0;
+       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;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       /* 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);
+       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
+
+       return (pui_bool)ret;
+}
+
+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;
+
+       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);
+       if (repeat == 0) info->repeat = 1;
+       else info->repeat = repeat;
+
+       info->key_frame_cur = 0;
+       info->frame_idx = 0;
+       info->repeat_cur = 0;
+
+       if (!ani_frame)
+               ani_frame = backend_util_alloc_frame(info);
+       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
+
+       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_bool force)
+{
+       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, force=%d\n", info->id, force);
+
+       pui_backend_ani_remove_frame_cb(ani);
+
+       if (force)
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
+       else
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       if (ani_frame)
+       {
+               backend_util_free_frame(ani_frame);
+               ani_frame = NULL;
+       }
+
+       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/voice_ani_streaming.c b/backends/default/voice_ani_streaming.c
new file mode 100644 (file)
index 0000000..d6f41fa
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ * 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 default_frame_info_t *ani_frame = NULL;
+
+static default_frame_info_t *
+_ani_backend_streaming_get_frame(default_ani_info *ani_info)
+{
+       default_frame_info_t *key_frame, *key_frame2;
+       int idx, idx2;
+       unsigned int r, g, b, r2, g2, b2;
+       int r3, g3, b3;
+       double div;
+
+       if (ani_info->frame_idx == 0)
+       {
+               ani_info->frame_max = (unsigned int)(ani_info->frames[ani_info->key_frame_cur].frame_duration / ani_info->interval);
+       }
+
+       idx = ani_info->key_frame_cur;
+       idx2 = (idx + 1) % ani_info->num_key_frames;
+
+       key_frame = &ani_info->frames[idx];
+       key_frame2 = &ani_info->frames[idx2];
+
+       div = (double)(ani_info->frame_idx) / (double)ani_info->frame_max;
+       r = g = b = r2 = g2 = b2 = 0x0;
+       for (int i = 0; i < key_frame->num_led; i++)
+       {
+               pui_default_backend_ani_get_led_rgb(key_frame, i, &r, &g, &b);
+               pui_default_backend_ani_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;
+
+               ani_frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
+       }
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= ani_info->frame_max)
+       {
+               ani_info->frame_idx = 0;
+               ani_info->key_frame_cur = (ani_info->key_frame_cur + 1) % ani_info->num_key_frames;
+               if (ani_info->repeat >= 0 && ani_info->key_frame_cur == 0)
+                       ani_info->repeat_cur++;
+       }
+
+       return ani_frame;
+}
+
+static pui_bool
+_ani_backend_streaming_frame_cb(void *data, int serial)
+{
+       int ret = 0;
+       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;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       /* 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);
+       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
+
+       return (pui_bool)ret;
+}
+
+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;
+
+       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);
+       if (repeat == 0) info->repeat = 1;
+       else info->repeat = repeat;
+
+       info->key_frame_cur = 0;
+       info->frame_idx = 0;
+       info->repeat_cur = 0;
+
+       if (!ani_frame)
+               ani_frame = backend_util_alloc_frame(info);
+       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
+
+       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_bool force)
+{
+       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, force=%d\n", info->id, force);
+
+       pui_backend_ani_remove_frame_cb(ani);
+
+       if (force)
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
+       else
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       if (ani_frame)
+       {
+               backend_util_free_frame(ani_frame);
+               ani_frame = NULL;
+       }
+
+       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/voice_ani_timeout.c b/backends/default/voice_ani_timeout.c
new file mode 100644 (file)
index 0000000..462deb1
--- /dev/null
@@ -0,0 +1,174 @@
+/*
+ * 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 default_frame_info_t *ani_frame = NULL;
+
+static default_frame_info_t *
+_ani_backend_timeout_get_frame(default_ani_info *ani_info)
+{
+       default_frame_info_t *key_frame, *key_frame2;
+       int idx, idx2;
+       unsigned int r, g, b, r2, g2, b2;
+       int r3, g3, b3;
+       double div;
+
+       if (ani_info->frame_idx == 0)
+       {
+               ani_info->frame_max = (unsigned int)(ani_info->frames[ani_info->key_frame_cur].frame_duration / ani_info->interval);
+       }
+
+       idx = ani_info->key_frame_cur;
+       idx2 = (idx + 1) % ani_info->num_key_frames;
+
+       key_frame = &ani_info->frames[idx];
+       key_frame2 = &ani_info->frames[idx2];
+
+       div = (double)(ani_info->frame_idx) / (double)ani_info->frame_max;
+       r = g = b = r2 = g2 = b2 = 0x0;
+       for (int i = 0; i < key_frame->num_led; i++)
+       {
+               pui_default_backend_ani_get_led_rgb(key_frame, i, &r, &g, &b);
+               pui_default_backend_ani_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;
+
+               ani_frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
+       }
+       ani_info->frame_idx++;
+       if (ani_info->frame_idx >= ani_info->frame_max)
+       {
+               ani_info->frame_idx = 0;
+               ani_info->key_frame_cur = (ani_info->key_frame_cur + 1) % ani_info->num_key_frames;
+               if (ani_info->repeat >= 0 && ani_info->key_frame_cur == 0)
+                       ani_info->repeat_cur++;
+       }
+
+       return ani_frame;
+}
+
+static pui_bool
+_ani_backend_timeout_frame_cb(void *data, int serial)
+{
+       int ret = 0;
+       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;
+
+       ani_data = pui_backend_ani_get_ani_data(ani);
+       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
+
+       /* 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);
+       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
+
+       return (pui_bool)ret;
+}
+
+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;
+
+       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);
+       if (repeat == 0) info->repeat = 1;
+       else info->repeat = repeat;
+
+       info->key_frame_cur = 0;
+       info->frame_idx = 0;
+       info->repeat_cur = 0;
+
+       if (!ani_frame)
+               ani_frame = backend_util_alloc_frame(info);
+       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
+
+       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_bool force)
+{
+       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, force=%d\n", info->id, force);
+
+       pui_backend_ani_remove_frame_cb(ani);
+
+       if (force)
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
+       else
+               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
+
+       if (ani_frame)
+       {
+               backend_util_free_frame(ani_frame);
+               ani_frame = NULL;
+       }
+
+       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;
+}
+
diff --git a/backends/default_backend.c b/backends/default_backend.c
deleted file mode 100644 (file)
index ef6b4e5..0000000
+++ /dev/null
@@ -1,857 +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"
-#include <limits.h>
-
-pui_backend_ani_func *ani_func = NULL;
-Eina_Hash *_animations_hash = NULL;
-pui_backend_ani_data *g_ani_data = NULL;
-
-#if 0
-static double
-_ani_backend_ease_function_get_intensity(pui_effect_func func, double interval)
-{
-       double intensity = interval;
-       switch (func)
-       {
-               case None:
-                       break;
-               case Linear:
-                       break;
-               case EaseInSine:
-                       intensity = 1 - cos(PI / 2 * interval);
-                       break;
-               case EaseOutSine:
-                       intensity = sin(PI / 2 * interval);
-                       break;
-               case EaseInQuart:
-                       intensity = interval * interval;
-                       break;
-               case EaseOutQuart:
-                       intensity = interval * (2 - interval);
-                       break;
-               default:
-                       break;
-       }
-
-       return intensity;
-}
-
-static unsigned int
-_ani_backend_get_value(unsigned int end_frame, unsigned int start_frame, double interval)
-{
-       double res = 0.0;
-
-       // interval: frame ratio between key frame to key frame
-       // end_frame and start_frame is key frame
-
-       res = (end_frame - start_frame) * interval + start_frame;
-
-       return res;
-}
-#endif
-
-static pui_bool
-_ani_backend_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;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       /* TODO : make use of ani_info */
-       (void) ani_info;
-
-       buffer = pui_backend_ani_get_buffer(ani);
-
-       if (!buffer)
-       {
-               pui_err("Failed to get buffer !\n");
-               return 0;
-       }
-
-       /* test example */
-       for(int i = 0; i<12; i++)
-       {
-               buffer->ptr[4*i] = 0;
-               buffer->ptr[4*i + 1] = (ani_info->frames[ani_info->frame_idx].leds[i].color & LED_MASK_RED) >> 16;//R
-               buffer->ptr[4*i + 2] = (ani_info->frames[ani_info->frame_idx].leds[i].color & LED_MASK_GREEN) >> 8;//G
-               buffer->ptr[4*i + 3] = ani_info->frames[ani_info->frame_idx].leds[i].color & LED_MASK_BLUE;//B
-       }
-
-       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;
-}
-
-default_ani_info *
-get_ani_info_from_ani_collection(pui_id id)
-{
-       default_ani_info *ani_info = NULL;
-
-       if (!_animations_hash)
-               return NULL;
-
-       pui_info("... id: %s\n", id);
-
-       ani_info = eina_hash_find(_animations_hash, id);
-
-       if (!ani_info)
-       {
-               pui_err("ani_info has NOT been found ! (id:%s)\n", id);
-               return NULL;
-       }
-
-       pui_info("ani_info has been found ! (id:%s)\n", id);
-
-       return ani_info;
-}
-
-pui_error
-_ani_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 *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       pui_info("... info->id: %s, repeat : %d\n", ani_info->id, repeat);
-
-       pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED);
-       ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_frame_cb, (double)ani_info->interval / 1000);
-
-       if (!ret)
-       {
-               pui_err("Failed to add frame callback !\n");
-               e = PUI_INT_ERROR_INVALID_RESOURCES;
-       }
-
-       return e;
-}
-
-pui_error
-_ani_stop(pui_ani_t *ani, pui_bool force)
-{
-       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, force=%d\n", info->id, force);
-
-       pui_backend_ani_remove_frame_cb(ani);
-
-       if (force)
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
-       else
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       return e;
-}
-
-static char *
-_read_json_file(const char *path, int *data_size)
-{
-       FILE *fp = fopen(path, "rb");
-       int size, ret;
-       char *buffer = NULL;
-       ERROR_CHECK(fp, return NULL, "Failed to open file: %s\n", path);
-
-       ret = fseek(fp, 0, SEEK_END);
-       ERROR_CHECK(ret == 0, goto error, "Failed to seek file. ret: %d\n", ret);
-       size = (long int)ftell(fp);
-       ERROR_CHECK(0 < size && size < INT_MAX, goto error, "Invalid file: %d size\n", size);
-       ret = fseek(fp, 0, SEEK_SET);
-       ERROR_CHECK(ret == 0, goto error, "Failed to seek file. ret: %d\n", ret);
-
-       buffer = (char *)calloc(sizeof(char), size + 1);
-       ERROR_CHECK(buffer, goto error, "Failed to allocate memory for buffer\n");
-
-       if (fread(buffer, size, 1, fp) < 1) {
-               goto error;
-       }
-
-       *data_size = size;
-       fclose(fp);
-       return buffer;
-
-error:
-       *data_size = 0;
-       if (buffer) free(buffer);
-       fclose(fp);
-       return NULL;
-}
-
-static default_ani_info *
-_read_json(const char *path)
-{
-       char *buffer, *type;
-       json_object *root_obj, *data_obj, *frame_obj, *frame_data_obj, *led_obj, *led_data_obj;
-       default_ani_info *ani_info = NULL;
-       int frame_id = 0, frame_len = 0, led_id = 0, led_len = 0;
-       int data_size = 0, i, j;
-
-       buffer = _read_json_file(path, &data_size);
-       ERROR_CHECK(buffer && data_size > 0, goto error, "File %s has no data\n", path);
-       root_obj = json_tokener_parse(buffer);
-       ERROR_CHECK(root_obj, goto error, "Failed to tokenize json object\n");
-
-       ani_info = (default_ani_info *)calloc(1, sizeof(default_ani_info));
-       ERROR_CHECK(ani_info, goto error, "Failed to alloc for animation info\n");
-
-       data_obj = json_object_object_get(root_obj, "type");
-       //printf("type: %s\n", json_object_get_string(data_obj));
-       type = (char *)json_object_get_string(data_obj);
-       ani_info->id = strndup(type, strlen(type));
-
-       data_obj = json_object_object_get(root_obj, "interval");
-       //printf("interval: %d\n", json_object_get_int(data_obj));
-       ani_info->interval = json_object_get_int(data_obj);
-
-       data_obj = json_object_object_get(root_obj, "frame");
-       frame_len = json_object_array_length(data_obj);
-
-       ani_info->num_key_frames = frame_len;
-       ani_info->frames = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), frame_len);
-       ERROR_CHECK(ani_info->frames, goto error, "Failed to alloc for default_frame_info_t\n");
-
-       for (i = 0; i < frame_len; i++) {
-               frame_obj = json_object_array_get_idx(data_obj, i);
-
-               frame_data_obj = json_object_object_get(frame_obj, "frame_id");
-               //printf("\tframe id: %d\n", json_object_get_int(frame_data_obj));
-               frame_id = json_object_get_int(frame_data_obj);
-
-               frame_data_obj = json_object_object_get(frame_obj, "frame_duration");
-               if (frame_data_obj)
-                       ani_info->frames[frame_id - 1].frame_duration = json_object_get_int(frame_data_obj);
-               else
-                       ani_info->frames[frame_id - 1].frame_duration = ani_info->interval;
-
-               frame_data_obj = json_object_object_get(frame_obj, "led");
-               led_len = json_object_array_length(frame_data_obj);
-
-               ani_info->frames[frame_id - 1].num_led = led_len;
-               if (ani_info->max_leds < led_len) ani_info->max_leds = led_len;
-               ani_info->frames[frame_id - 1].leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), led_len);
-               ERROR_CHECK(ani_info->frames[frame_id - 1].leds, goto error, "Failed to alloc for default_led_info_t\n");
-
-               for (j = 0; j < led_len; j++) {
-                       led_obj = json_object_array_get_idx(frame_data_obj, j);
-
-                       led_data_obj = json_object_object_get(led_obj, "id");
-                       //printf("\t\tid: %2d  ", json_object_get_int(led_data_obj));
-                       led_id = json_object_get_int(led_data_obj);
-
-                       led_data_obj = json_object_object_get(led_obj, "color");
-                       //printf("color: %s\n", json_object_get_string(led_data_obj));
-                       ani_info->frames[frame_id - 1].leds[led_id - 1].color =
-                               strtol(json_object_get_string(led_data_obj), NULL, 16);
-               }
-       }
-
-       free(buffer);
-       return ani_info;
-
-error:
-       if (buffer) free(buffer);
-       if (ani_info) {
-               if (ani_info->frames) {
-                       for (i = 0; i < ani_info->num_key_frames; i++) {
-                               if (ani_info->frames[i].leds)
-                                       free(ani_info->frames[i].leds);
-                       }
-                       free(ani_info->frames);
-               }
-               free(ani_info->id);
-               free(ani_info);
-       }
-       return NULL;
-}
-
-int
-_find_directory(const char *path, Eina_List **json_list)
-{
-       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 count;
-}
-
-default_ani_info *
-_create_default_ani_info(char *type)
-{
-       default_ani_info *ani_info = NULL;
-       int frame_len = 1;
-       int led_len = 12;
-
-       ani_info = (default_ani_info *)calloc(1, sizeof(default_ani_info));
-       ERROR_CHECK(ani_info, goto error, "Failed to alloc for animation info\n");
-
-       ani_info->id = strndup(type, strlen(type));
-       ani_info->interval = 50;
-
-       ani_info->num_key_frames = frame_len;
-       ani_info->frames = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), frame_len);
-       ERROR_CHECK(ani_info->frames, goto error, "Failed to alloc for default_frame_info_t\n");
-
-       ani_info->frames[0].frame_duration = 500;
-       ani_info->frames[0].num_led = led_len;
-       ani_info->max_leds = led_len;
-       ani_info->frames[0].leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), led_len);
-       ERROR_CHECK(ani_info->frames[0].leds, goto error, "Failed to alloc for default_led_info_t\n");
-
-       return ani_info;
-
-error:
-       if (ani_info) {
-               if (ani_info->frames) {
-                       for (int i = 0; i < ani_info->num_key_frames; i++) {
-                               if (ani_info->frames[i].leds)
-                                       free(ani_info->frames[i].leds);
-                       }
-                       free(ani_info->frames);
-               }
-               free(ani_info->id);
-               free(ani_info);
-       }
-       return NULL;
-}
-
-
-pui_int_error
-_create_ani_collection(void)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       default_ani_info *ani_info;
-       Eina_List *json_list = NULL;
-       Eina_List *l, *l_next;
-       Eina_Stringshare *path;
-
-       // load and store all of animation data
-
-       _find_directory(ANI_COLLECTION_DIR, &json_list);
-
-       pui_err("Start create ani collect...\n");
-
-       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);
-                       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);
-       }
-
-       //TODO
-       ani_info = _create_default_ani_info("default/clear_fadeout");
-       if (ani_info) {
-               eina_hash_add(_animations_hash, ani_info->id, ani_info);
-               pui_err("Success to load default animation (id: %s)\n", ani_info->id);
-       }
-       ani_info = _create_default_ani_info("default/clear_immediate");
-       if (ani_info) {
-               eina_hash_add(_animations_hash, ani_info->id, ani_info);
-               pui_err("Success to load default animation (id: %s)\n", ani_info->id);
-       }
-
-       pui_err("End create ani collect...\n");
-
-       return e;
-}
-
-pui_bool
-_geometry_get(int *width, int *height)
-{
-       if (!width || !height)
-               return 0;
-
-       if (width)
-               *width = DEFAULT_BACKEND_GEOM_WIDTH;
-       if (height)
-               *height = DEFAULT_BACKEND_GEOM_HEIGHT;
-
-       return 1;
-}
-
-pui_int_error
-_is_ani_supported(pui_id id)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       default_ani_info *ani_info;
-
-       //TODO
-       /* if the given id is not supported, return PUI_INT_ERROR_ID_NOT_SUPPORTED. */
-       if (!id) {
-               e = PUI_INT_ERROR_ID_NOT_SUPPORTED;
-               return e;
-       }
-       ani_info = eina_hash_find(_animations_hash, id);
-
-       if (!ani_info)
-               e = PUI_INT_ERROR_ID_NOT_SUPPORTED;
-
-       return e;
-}
-
-static void
-_ani_info_cleanup(default_ani_info *ani_info)
-{
-       int i;
-
-       if (!ani_info)
-               return;
-
-       if (ani_info->frames)
-       {
-               for (i = 0; i < ani_info->num_key_frames; i++)
-               {
-                       if (ani_info->frames[i].leds)
-                               free(ani_info->frames[i].leds);
-               }
-
-               free(ani_info->frames);
-       }
-
-       free(ani_info->id);
-}
-
-pui_backend_ani_data *
-_ani_create(pui_id id)
-{
-       pui_backend_ani_data *ani_data = NULL;
-       pui_backend_ani_func *ani_func = NULL;
-
-       /* backend's animation specific info */
-       default_ani_info *ani_info = NULL;
-
-       //TODO : return NULL if the animation correspond to the given id dones't exist.
-       if (PUI_INT_ERROR_NONE != _is_ani_supported(id))
-       {
-               pui_err("The animation(%s) doesn't supported !\n", id);
-               return NULL;
-       }
-
-       /* allocation of the structure of function pointers that will be called from pui_ani_control() */
-       ani_func = pui_backend_ani_alloc_ani_func();
-
-       if (!ani_func)
-       {
-               pui_err("Failed to allocate memory ! (pui backend ani func)\n");
-               return NULL;
-       }
-
-       /* get animation info associate with the given id from animation collection */
-       ani_info = get_ani_info_from_ani_collection(id);
-
-       if (!ani_info)
-       {
-               pui_err("Failed to get ani info from animation collection !\n");
-               goto err;
-       }
-
-       /* allocate backend ani_data and return it to pui ani core */
-       ani_data = (pui_backend_ani_data *)calloc(1, sizeof(pui_backend_ani_data));
-
-       if (!ani_data)
-       {
-               pui_err("Failed to allocate memory for pui backend ani data !\n");
-               goto err;
-       }
-
-       /* Assign each function pointer that corresponds to the given id if needed. */
-       if (!strncmp(ani_info->id, "system/easy_setup", sizeof("system/easy_setup")))
-       {
-               pui_default_backend_ani_easysetup_func_set(ani_func);
-       }
-       else if (!strncmp(ani_info->id, "system/processing", sizeof("system/processing")))
-       {
-               pui_default_backend_ani_system_processing_func_set(ani_func);
-       }
-       else if (!strncmp(ani_info->id, "system/sw_update_done", sizeof("system/sw_update_done")))
-       {
-               pui_default_backend_ani_swupdatedone_func_set(ani_func);
-       }
-       else if (!strncmp(ani_info->id, "system/mic_off", sizeof("system/mic_off")))
-       {
-               pui_default_backend_ani_micoff_func_set(ani_func);
-       }
-       else if (!strncmp(ani_info->id, "voice/listening", sizeof("voice/listening")))
-       {
-               pui_default_backend_ani_listening_func_set(ani_func);
-       }
-       else if (!strncmp(ani_info->id, "voice/streaming", sizeof("voice/streaming")))
-       {
-               pui_default_backend_ani_streaming_func_set(ani_func);
-       }
-       else if (!strncmp(ani_info->id, "voice/processing", sizeof("voice/processing")))
-       {
-               pui_default_backend_ani_processing_func_set(ani_func);
-       }
-       else if (!strncmp(ani_info->id, "voice/speaking", sizeof("voice/speaking")))
-       {
-               pui_default_backend_ani_speaking_func_set(ani_func);
-       }
-       else if (!strncmp(ani_info->id, "voice/timeout", sizeof("voice/timeout")))
-       {
-               pui_default_backend_ani_timeout_func_set(ani_func);
-       }
-       else if (!strncmp(ani_info->id, "notification/normal", sizeof("notification/normal")))
-       {
-               pui_default_backend_ani_normal_func_set(ani_func);
-       }
-       else if (!strncmp(ani_info->id, "notification/emergency", sizeof("notification/emergency")))
-       {
-               pui_default_backend_ani_emergency_func_set(ani_func);
-       }
-       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, "notification/error", sizeof("notification/error")))
-       {
-               pui_default_backend_ani_error_func_set(ani_func);
-       }
-       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, "bt/pairing", sizeof("bt/pairing")))
-       {
-               pui_default_backend_ani_pairing_func_set(ani_func);
-       }
-       else if (!strncmp(ani_info->id, "bt/connected", sizeof("bt/connected")))
-       {
-               pui_default_backend_ani_connected_func_set(ani_func);
-       }
-       else if (!strncmp(ani_info->id, "default/clear_fadeout", sizeof("default/clear_fadeout")))
-       {
-               pui_default_backend_ani_clear_fadeout_func_set(ani_func);
-       }
-       else if (!strncmp(ani_info->id, "default/clear_immediate", sizeof("default/clear_immediate")))
-       {
-               pui_default_backend_ani_clear_immediate_func_set(ani_func);
-       }
-       else
-       {
-               pui_info("%s animation has no animation handler, using default handler\n", ani_info->id);
-               /* Assign each function pointer that corresponds to the given id if needed. */
-               ani_func->ani_start = _ani_start;
-               ani_func->ani_stop = _ani_stop;
-       }
-
-       ani_data->ani_func = ani_func;
-       ani_data->ani_info = (pui_backend_ani_info *)ani_info;
-
-       g_ani_data = ani_data;
-
-       return ani_data;
-
-err:
-       if (ani_func)
-       {
-               pui_backend_ani_free_ani_func(ani_func);
-               ani_func = NULL;
-       }
-
-       return NULL;
-}
-
-void
-_ani_destroy(pui_backend_ani_data *ani_data)
-{
-       if (!ani_data)
-               return;
-
-       if (ani_data->ani_func)
-       {
-               pui_backend_ani_free_ani_func(ani_data->ani_func);
-               ani_data->ani_func = NULL;
-       }
-
-       ani_data->ani_info = NULL;
-       g_ani_data = NULL;
-}
-
-static void
-_animation_data_free_cb(void *data)
-{
-       default_ani_info *ani_info = (default_ani_info *)data;
-
-       _ani_info_cleanup(ani_info);
-}
-
-default_frame_info_t *
-backend_util_alloc_frame(default_ani_info *ani_info)
-{
-       default_frame_info_t *frame;
-
-       frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1);
-       ERROR_CHECK(frame, return NULL, "Failed to allocate memory for frame\n");
-
-       frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), ani_info->max_leds);
-       ERROR_CHECK(frame->leds, goto error, "Failed to allocate memory for led\n");
-
-       frame->num_led = ani_info->max_leds;
-
-       return frame;
-
-error:
-       free(frame);
-       return NULL;
-}
-
-void
-backend_util_cleanup_frame(default_frame_info_t *frame)
-{
-       ERROR_CHECK(frame, return, "Invalid frame to cleanup\n");
-
-       for (int i = 0; i < frame->num_led; i++)
-       {
-               frame->leds[i].color = 0x0;
-       }
-       frame->frame_duration = 0;
-}
-
-void
-backend_util_free_frame(default_frame_info_t *frame)
-{
-       if (!frame) return;
-
-       if (frame->leds) free(frame->leds);
-       free(frame);
-}
-
-void
-pui_default_backend_ani_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);
-}
-
-int
-pui_default_backend_ani_update_frame(pui_ani_t *ani,
-                                                                                       pui_backend_ani_data *ani_data,
-                                                                                       pui_ani_control_buffer *buffer,
-                                                                                       default_frame_info_t *frame,
-                                                                                        int serial)
-{
-       pui_int_error e = PUI_INT_ERROR_NONE;
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-       unsigned int r = 0x0, g = 0x0, b = 0x0;
-
-       for(int i = 0; i<12; i++)
-       {
-               pui_default_backend_ani_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 */
-       }
-       backend_util_cleanup_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 0;
-       }
-
-       e = pui_backend_ani_update(ani);
-
-       if (e != PUI_INT_ERROR_NONE)
-       {
-               pui_err("Failed on updating animation !(e=%d)\n", e);
-               return 0;
-       }
-
-       pui_info("... update (serial=%d), (repeat| cur: %d, want: %d)\n",
-               serial, ani_info->repeat_cur, ani_info->repeat);
-
-       if (ani_info->repeat >= 0 &&
-               ani_info->repeat_cur >= ani_info->repeat)
-       {
-               ani_data->ani_func->ani_stop(ani, EINA_FALSE);
-       }
-
-       return 1;
-}
-
-static pui_backend_module_data *
-pui_default_backend_init(void)
-{
-       pui_backend_module_data *backend_data = NULL;
-
-       backend_data = (pui_backend_module_data *)calloc(1, sizeof(pui_backend_module_data));
-
-       if (!backend_data)
-       {
-               pui_err("Failed to allocate memory for pui backend module data !\n");
-               return NULL;
-       }
-
-       backend_data->create_ani_collection = _create_ani_collection;
-       backend_data->geometry_get = _geometry_get;
-       backend_data->ani_create = _ani_create;
-       backend_data->ani_destroy = _ani_destroy;
-
-       /* Allocate backend specific data if needed. Now it will be empty. */
-       backend_data->data = NULL;
-       _animations_hash = eina_hash_string_superfast_new(NULL);
-
-       return backend_data;
-}
-
-static void
-pui_default_backend_deinit(pui_backend_module_data *backend_data)
-{
-       Eina_Iterator *it;
-       default_ani_info *ani_info = NULL;
-
-       if (!backend_data)
-               return;
-
-       if (backend_data->data)
-       {
-               //TODO : free variables of backend_data
-
-               free(backend_data->data);
-       }
-
-       if (g_ani_data)
-       {
-               if (g_ani_data->ani_func)
-               {
-                       pui_backend_ani_free_ani_func(g_ani_data->ani_func);
-                       g_ani_data->ani_func = NULL;
-               }
-
-               g_ani_data->ani_info = NULL;
-       }
-
-       if (_animations_hash)
-       {
-               it = eina_hash_iterator_data_new(_animations_hash);
-
-               EINA_ITERATOR_FOREACH(it, ani_info)
-               {
-                       _animation_data_free_cb(ani_info);
-                       free(ani_info);
-               }
-
-               eina_iterator_free(it);
-
-               eina_hash_free(_animations_hash);
-               _animations_hash = NULL;
-       }
-
-       backend_data->create_ani_collection = NULL;
-       backend_data->geometry_get = NULL;
-       backend_data->ani_create = NULL;
-       backend_data->ani_destroy = NULL;
-
-       free(backend_data);
-       backend_data = NULL;
-}
-
-pui_backend_module pui_backend_module_info = {
-       "Tizen Reference Speaker Backend",
-       "Samsung",
-       PUI_BACKEND_SET_ABI_VERSION(1, 0),
-       pui_default_backend_init,
-       pui_default_backend_deinit
-};
-
diff --git a/backends/default_backend.h b/backends/default_backend.h
deleted file mode 100644 (file)
index 446875c..0000000
+++ /dev/null
@@ -1,130 +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 <stdio.h>
-#include <stdlib.h>
-#include <PUI_backend.h>
-
-#include <json-c/json.h>
-#include <dirent.h>
-#include <errno.h>
-#include <Eina.h>
-#include <config.h>
-#include <Ecore.h>
-//#include <cmath.h>
-
-#define ANI_COLLECTION_DIR "/usr/share/pui/"
-#define MAX_STR 1024
-
-#define DEFAULT_BACKEND_GEOM_WIDTH 12
-#define DEFAULT_BACKEND_GEOM_HEIGHT 1
-
-#ifndef PI
-#define PI 3.1415926545
-#endif
-
-#define LED_MASK_RED   0xFF0000
-#define LED_MASK_GREEN 0x00FF00
-#define LED_MASK_BLUE  0x0000FF
-
-#define ERROR_CHECK(exp, action, fmt, ...) \
-       do { \
-               if (!(exp)) \
-               { \
-                       printf(fmt, ##__VA_ARGS__);     \
-                       action; \
-               } \
-       } while (0)
-
-typedef enum
-{
-       None,
-       Linear,
-       EaseInSine,
-       EaseOutSine,
-       EaseInQuart,
-       EaseOutQuart
-} pui_effect_func;
-
-typedef struct _default_ani_info default_ani_info;
-typedef struct _default_frame_info_t default_frame_info_t;
-typedef struct _default_led_info_t default_led_info_t;
-
-struct _default_ani_info
-{
-       pui_id id;
-       pui_ani_status status;
-       pui_ani_control_buffer *buffer;
-       int repeat;
-
-       unsigned int num_key_frames;
-       default_frame_info_t *frames;
-       int interval;
-       unsigned int max_leds;
-       pui_effect_func effect_func;
-
-       unsigned int repeat_cur;
-       unsigned int frame_idx;
-       unsigned int frame_max;
-       unsigned int key_frame_cur;
-};
-
-struct _default_frame_info_t
-{
-       default_led_info_t *leds;
-       int num_led;
-       int frame_duration;
-};
-
-struct _default_led_info_t
-{
-       unsigned int color;
-};
-
-default_frame_info_t *backend_util_alloc_frame(default_ani_info *ani_info);
-void backend_util_cleanup_frame(default_frame_info_t *frame);
-void backend_util_free_frame(default_frame_info_t *frame);
-
-void pui_default_backend_ani_listening_func_set(pui_backend_ani_func *func);
-void pui_default_backend_ani_speaking_func_set(pui_backend_ani_func *func);
-void pui_default_backend_ani_processing_func_set(pui_backend_ani_func *func);
-void pui_default_backend_ani_streaming_func_set(pui_backend_ani_func *func);
-void pui_default_backend_ani_timeout_func_set(pui_backend_ani_func *func);
-void pui_default_backend_ani_system_processing_func_set(pui_backend_ani_func *func);
-void pui_default_backend_ani_normal_func_set(pui_backend_ani_func *func);
-void pui_default_backend_ani_emergency_func_set(pui_backend_ani_func *func);
-void pui_default_backend_ani_easysetup_func_set(pui_backend_ani_func *func);
-void pui_default_backend_ani_swupdatedone_func_set(pui_backend_ani_func *func);
-void pui_default_backend_ani_micoff_func_set(pui_backend_ani_func *func);
-void pui_default_backend_ani_networkerror_func_set(pui_backend_ani_func *func);
-void pui_default_backend_ani_error_func_set(pui_backend_ani_func *func);
-void pui_default_backend_ani_alarm_func_set(pui_backend_ani_func *func);
-void pui_default_backend_ani_connected_func_set(pui_backend_ani_func *func);
-void pui_default_backend_ani_pairing_func_set(pui_backend_ani_func *func);
-void pui_default_backend_ani_clear_fadeout_func_set(pui_backend_ani_func *func);
-void pui_default_backend_ani_clear_immediate_func_set(pui_backend_ani_func *func);
-
-void pui_default_backend_ani_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b);
-int pui_default_backend_ani_update_frame(pui_ani_t *ani, pui_backend_ani_data *ani_data, pui_ani_control_buffer *buffer, default_frame_info_t *frame, int serial);
\ No newline at end of file
diff --git a/backends/notification/default_ani_alarm.c b/backends/notification/default_ani_alarm.c
deleted file mode 100644 (file)
index 880700c..0000000
+++ /dev/null
@@ -1,187 +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 default_frame_info_t *ani_frame = NULL;
-
-static default_frame_info_t *
-_ani_backend_alarm_get_frame(default_ani_info *ani_info)
-{
-/* FIXME: ALAMR_FRAME need to changed after we imply animation type, suchas ease function */
-#define ALARM_FRAME 18
-       default_frame_info_t *key_frame, *key_frame2;
-       int idx, idx2;
-       unsigned int r, g, b, r2, g2, b2;
-       int r3, g3, b3;
-       double div;
-
-       if (ani_info->frame_idx == 0)
-       {
-               ani_info->frame_max = (unsigned int)(ani_info->frames[ani_info->key_frame_cur].frame_duration / ani_info->interval);
-       }
-
-       idx = ani_info->key_frame_cur;
-       key_frame = &ani_info->frames[idx];
-
-       if (ani_info->key_frame_cur < ALARM_FRAME)
-       {
-               for (int i = 0; i < key_frame->num_led; i++)
-               {
-                       ani_frame->leds[i].color = key_frame->leds[i].color;
-               }
-       }
-       else
-       {
-               idx2 = (idx + 1) % ani_info->num_key_frames;
-               key_frame2 = &ani_info->frames[idx2];
-               div = (double)(ani_info->frame_idx) / (double)ani_info->frame_max;
-               r = g = b = r2 = g2 = b2 = 0x0;
-               for (int i = 0; i < key_frame->num_led; i++)
-               {
-                       pui_default_backend_ani_get_led_rgb(key_frame, i, &r, &g, &b);
-                       pui_default_backend_ani_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;
-
-                       ani_frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
-               }
-       }
-
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= ani_info->frame_max)
-       {
-               ani_info->frame_idx = 0;
-               ani_info->key_frame_cur = (ani_info->key_frame_cur + 1) % ani_info->num_key_frames;
-               if (ani_info->repeat >= 0 && ani_info->key_frame_cur == 0)
-                       ani_info->repeat_cur++;
-       }
-
-       return ani_frame;
-}
-
-static pui_bool
-_ani_backend_alarm_frame_cb(void *data, int serial)
-{
-       int ret = 0;
-       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;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       /* 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);
-       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
-
-       return (pui_bool)ret;
-}
-
-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;
-
-       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);
-       if (repeat == 0) info->repeat = 1;
-       else info->repeat = repeat;
-
-       info->key_frame_cur = 0;
-       info->frame_idx = 0;
-       info->repeat_cur = 0;
-
-       if (!ani_frame)
-               ani_frame = backend_util_alloc_frame(info);
-       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
-
-       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_bool force)
-{
-       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, force=%d\n", info->id, force);
-
-       pui_backend_ani_remove_frame_cb(ani);
-
-       if (force)
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
-       else
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       if (ani_frame)
-       {
-               backend_util_free_frame(ani_frame);
-               ani_frame = NULL;
-       }
-
-       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
deleted file mode 100644 (file)
index a1d6056..0000000
+++ /dev/null
@@ -1,177 +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 default_frame_info_t *ani_frame = NULL;
-
-static default_frame_info_t *
-_ani_backend_emergency_get_frame(default_ani_info *ani_info)
-{
-       default_frame_info_t *key_frame, *key_frame2;
-       int idx, idx2;
-       unsigned int r, g, b, r2, g2, b2;
-       int r3, g3, b3;
-       double div;
-
-       if (ani_info->frame_idx == 0)
-       {
-               ani_info->frame_max = (unsigned int)(ani_info->frames[ani_info->key_frame_cur].frame_duration / ani_info->interval);
-       }
-
-       idx = ani_info->key_frame_cur;
-       idx2 = (idx + 1) % ani_info->num_key_frames;
-
-       key_frame = &ani_info->frames[idx];
-       key_frame2 = &ani_info->frames[idx2];
-
-       div = (double)(ani_info->frame_idx) / (double)ani_info->frame_max;
-       r = g = b = r2 = g2 = b2 = 0x0;
-       for (int i = 0; i < key_frame->num_led; i++)
-       {
-               pui_default_backend_ani_get_led_rgb(key_frame, i, &r, &g, &b);
-               pui_default_backend_ani_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;
-
-               ani_frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
-       }
-
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= ani_info->frame_max)
-       {
-               ani_info->frame_idx = 0;
-               ani_info->key_frame_cur = (ani_info->key_frame_cur + 1) % ani_info->num_key_frames;
-               if (ani_info->repeat >= 0 && ani_info->key_frame_cur == 0)
-                       ani_info->repeat_cur++;
-       }
-
-       return ani_frame;
-}
-
-
-static pui_bool
-_ani_backend_emergency_frame_cb(void *data, int serial)
-{
-       int ret = 0;
-       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;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       /* 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);
-       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
-
-       return (pui_bool)ret;
-}
-
-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;
-
-       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);
-       if (repeat == 0) info->repeat = 1;
-       else info->repeat = repeat;
-
-       info->key_frame_cur = 0;
-       info->frame_idx = 0;
-       info->repeat_cur = 0;
-
-       if (!ani_frame)
-               ani_frame = backend_util_alloc_frame(info);
-       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
-
-       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_bool force)
-{
-       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, force=%d\n", info->id, force);
-
-       pui_backend_ani_remove_frame_cb(ani);
-
-       if (force)
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
-       else
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       if (ani_frame)
-       {
-               backend_util_free_frame(ani_frame);
-               ani_frame = NULL;
-       }
-
-       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
deleted file mode 100644 (file)
index 5b49118..0000000
+++ /dev/null
@@ -1,167 +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 default_frame_info_t *ani_frame = NULL;
-
-static default_frame_info_t *
-_ani_backend_error_get_frame(default_ani_info *ani_info)
-{
-/* FIXME: ALAMR_FRAME need to changed after we imply animation type, suchas ease function */
-#define BLINK_FRAME 2
-       default_frame_info_t *key_frame;
-
-       key_frame = &ani_info->frames[0];
-
-       if (ani_info->frame_idx % BLINK_FRAME == 0)
-       {
-               for (int i = 0; i < key_frame->num_led; i++)
-               {
-                       ani_frame->leds[i].color = key_frame->leds[i].color;
-               }
-       }
-       else
-       {
-               for (int i = 0; i < key_frame->num_led; i++)
-               {
-                       ani_frame->leds[i].color = 0x000000;
-               }
-       }
-
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= BLINK_FRAME)
-       {
-               if (ani_info->repeat >= 0)
-                       ani_info->repeat_cur++;
-               ani_info->frame_idx = 0;
-       }
-
-       return ani_frame;
-}
-
-
-static pui_bool
-_ani_backend_error_frame_cb(void *data, int serial)
-{
-       int ret = 0;
-       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;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       /* 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);
-       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
-
-       return (pui_bool)ret;
-}
-
-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;
-
-       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);
-       if (repeat == 0) info->repeat = 1;
-       else info->repeat = repeat;
-
-       info->key_frame_cur = 0;
-       info->frame_idx = 0;
-       info->repeat_cur = 0;
-
-       if (!ani_frame)
-               ani_frame = backend_util_alloc_frame(info);
-       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
-
-       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_bool force)
-{
-       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, force=%d\n", info->id, force);
-
-       pui_backend_ani_remove_frame_cb(ani);
-
-       if (force)
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
-       else
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       if (ani_frame)
-       {
-               backend_util_free_frame(ani_frame);
-               ani_frame = NULL;
-       }
-
-       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
deleted file mode 100644 (file)
index 96f6cc8..0000000
+++ /dev/null
@@ -1,163 +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 default_frame_info_t *ani_frame = NULL;
-
-static default_frame_info_t *
-_ani_backend_networkerror_get_frame(default_ani_info *ani_info)
-{
-       default_frame_info_t *key_frame;
-       int idx;
-
-       if (ani_info->frame_idx == 0)
-       {
-               ani_info->frame_max = (unsigned int)(ani_info->frames[ani_info->key_frame_cur].frame_duration / ani_info->interval);
-       }
-
-       idx = ani_info->key_frame_cur;
-       key_frame = &ani_info->frames[idx];
-
-       for (int i = 0; i < key_frame->num_led; i++)
-       {
-               ani_frame->leds[i].color = key_frame->leds[i].color;
-       }
-
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= ani_info->frame_max)
-       {
-               ani_info->frame_idx = 0;
-               ani_info->key_frame_cur = (ani_info->key_frame_cur + 1) % ani_info->num_key_frames;
-               if (ani_info->repeat >= 0 && ani_info->key_frame_cur == 0)
-                       ani_info->repeat_cur++;
-       }
-
-       return ani_frame;
-}
-
-
-static pui_bool
-_ani_backend_networkerror_frame_cb(void *data, int serial)
-{
-       int ret = 0;
-       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;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       /* 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);
-       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
-
-       return (pui_bool)ret;
-}
-
-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;
-
-       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);
-       if (repeat == 0) info->repeat = 1;
-       else info->repeat = repeat;
-
-       info->key_frame_cur = 0;
-       info->frame_idx = 0;
-       info->repeat_cur = 0;
-
-       if (!ani_frame)
-               ani_frame = backend_util_alloc_frame(info);
-       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
-
-       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_bool force)
-{
-       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, force=%d\n", info->id, force);
-
-       pui_backend_ani_remove_frame_cb(ani);
-
-       if (force)
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
-       else
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       if (ani_frame)
-       {
-               backend_util_free_frame(ani_frame);
-               ani_frame = NULL;
-       }
-
-       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
deleted file mode 100644 (file)
index 82eee8c..0000000
+++ /dev/null
@@ -1,176 +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 default_frame_info_t *ani_frame = NULL;
-
-static default_frame_info_t *
-_ani_backend_normal_get_frame(default_ani_info *ani_info)
-{
-       default_frame_info_t *key_frame, *key_frame2;
-       int idx, idx2;
-       unsigned int r, g, b, r2, g2, b2;
-       int r3, g3, b3;
-       double div;
-
-       if (ani_info->frame_idx == 0)
-       {
-               ani_info->frame_max = (unsigned int)(ani_info->frames[ani_info->key_frame_cur].frame_duration / ani_info->interval);
-       }
-
-       idx = ani_info->key_frame_cur;
-       idx2 = (idx + 1) % ani_info->num_key_frames;
-
-       key_frame = &ani_info->frames[idx];
-       key_frame2 = &ani_info->frames[idx2];
-
-       div = (double)(ani_info->frame_idx) / (double)ani_info->frame_max;
-       r = g = b = r2 = g2 = b2 = 0x0;
-       for (int i = 0; i < key_frame->num_led; i++)
-       {
-               pui_default_backend_ani_get_led_rgb(key_frame, i, &r, &g, &b);
-               pui_default_backend_ani_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;
-
-               ani_frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
-       }
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= ani_info->frame_max)
-       {
-               ani_info->frame_idx = 0;
-               ani_info->key_frame_cur = (ani_info->key_frame_cur + 1) % ani_info->num_key_frames;
-               if (ani_info->repeat >= 0 && ani_info->key_frame_cur == 0)
-                       ani_info->repeat_cur++;
-       }
-
-       return ani_frame;
-}
-
-
-static pui_bool
-_ani_backend_normal_frame_cb(void *data, int serial)
-{
-       int ret = 0;
-       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;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       /* 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);
-       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
-
-       return (pui_bool)ret;
-}
-
-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;
-
-       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);
-       if (repeat == 0) info->repeat = 1;
-       else info->repeat = repeat;
-
-       info->key_frame_cur = 0;
-       info->frame_idx = 0;
-       info->repeat_cur = 0;
-
-       if (!ani_frame)
-               ani_frame = backend_util_alloc_frame(info);
-       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
-
-       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_bool force)
-{
-       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, force=%d\n", info->id, force);
-
-       pui_backend_ani_remove_frame_cb(ani);
-
-       if (force)
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
-       else
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       if (ani_frame)
-       {
-               backend_util_free_frame(ani_frame);
-               ani_frame = NULL;
-       }
-
-       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/bt/connected.json b/backends/res/bt/connected.json
deleted file mode 100644 (file)
index 8a78b34..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-{
-       "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"}
-                       ]
-               },
-               {
-                       "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"}
-                       ]
-               }
-       ]
-}
diff --git a/backends/res/bt/pairing.json b/backends/res/bt/pairing.json
deleted file mode 100644 (file)
index c9a75bd..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-{
-       "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/notification/alarm.json b/backends/res/notification/alarm.json
deleted file mode 100644 (file)
index c0f1afe..0000000
+++ /dev/null
@@ -1,366 +0,0 @@
-{
-       "type": "notification/alarm",
-       "interval": 40,
-       "frame": [
-               {
-                       "frame_id": 1,
-                       "frame_duration": 480,
-                       "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,
-                       "frame_duration": 400,
-                       "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,
-                       "frame_duration": 600,
-                       "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,
-                       "frame_duration": 480,
-                       "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,
-                       "frame_duration": 400,
-                       "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,
-                       "frame_duration": 600,
-                       "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": 7,
-                       "frame_duration": 480,
-                       "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": 8,
-                       "frame_duration": 400,
-                       "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": 9,
-                       "frame_duration": 600,
-                       "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": 10,
-                       "frame_duration": 480,
-                       "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": 11,
-                       "frame_duration": 400,
-                       "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": 12,
-                       "frame_duration": 600,
-                       "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": 13,
-                       "frame_duration": 480,
-                       "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": 14,
-                       "frame_duration": 400,
-                       "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": 15,
-                       "frame_duration": 600,
-                       "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": 16,
-                       "frame_duration": 480,
-                       "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": 17,
-                       "frame_duration": 400,
-                       "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": 18,
-                       "frame_duration": 600,
-                       "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": 19,
-                       "frame_duration": 3200,
-                       "led": [
-                               {"id": 1,  "color": "FFFFFF"},
-                               {"id": 2,  "color": "FFFFFF"},
-                               {"id": 3,  "color": "FFFFFF"},
-                               {"id": 4,  "color": "FFFFFF"},
-                               {"id": 5,  "color": "FFFFFF"},
-                               {"id": 6,  "color": "FFFFFF"},
-                               {"id": 7,  "color": "FFFFFF"},
-                               {"id": 8,  "color": "FFFFFF"},
-                               {"id": 9,  "color": "FFFFFF"},
-                               {"id": 10, "color": "FFFFFF"},
-                               {"id": 11, "color": "FFFFFF"},
-                               {"id": 12, "color": "FFFFFF"}
-                       ]
-               },
-               {
-                       "frame_id": 20,
-                       "frame_duration": 40,
-                       "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
deleted file mode 100644 (file)
index 076cb51..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-{
-       "type": "notification/emergency",
-       "interval": 400,
-       "frame": [
-               {
-                       "frame_id": 1,
-                       "frame_duration": 1200,
-                       "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,
-                       "frame_duration": 1200,
-                       "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
deleted file mode 100644 (file)
index f147b72..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-{
-       "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
deleted file mode 100644 (file)
index 6f2041b..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-{
-       "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"}
-                       ]
-               },
-               {
-                       "frame_id": 2,
-                       "frame_duration": 500,
-                       "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/normal.json b/backends/res/notification/normal.json
deleted file mode 100644 (file)
index ed8dc88..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-{
-       "type": "notification/normal",
-       "interval": 50,
-       "frame": [
-               {
-                       "frame_id": 1,
-                       "frame_duration": 500,
-                       "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,
-                       "frame_duration": 500,
-                       "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/system/easy_setup.json b/backends/res/system/easy_setup.json
deleted file mode 100644 (file)
index cd7bf9f..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-{
-       "type": "system/easy_setup",
-       "interval": 30,
-       "frame": [
-               {
-                       "frame_id": 1,
-                       "frame_duration": 270,
-                       "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,
-                       "frame_duration": 420,
-                       "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"}
-                       ]
-               },
-               {
-                       "frame_id": 3,
-                       "frame_duration": 300,
-                       "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"}
-                       ]
-               },
-       ]
-}
diff --git a/backends/res/system/mic_off.json b/backends/res/system/mic_off.json
deleted file mode 100644 (file)
index 76faba5..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-{
-       "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
deleted file mode 100644 (file)
index 540eccf..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/system/sw_update_done.json b/backends/res/system/sw_update_done.json
deleted file mode 100644 (file)
index 851b419..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-{
-       "type": "system/sw_update_done",
-       "interval": 30,
-       "frame": [
-               {
-                       "frame_id": 1,
-                       "frame_duration": 210,
-                       "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": 2,
-                       "frame_duration": 450,
-                       "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,
-                       "frame_duration": 120,
-                       "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
deleted file mode 100644 (file)
index f38ad5b..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-{
-       "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
deleted file mode 100644 (file)
index a49e2ee..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-{
-       "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
deleted file mode 100644 (file)
index fbd98b0..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-{
-       "type": "voice/speaking",
-       "interval": 30,
-       "frame": [
-               {
-                       "frame_id": 1,
-                       "frame_duration": 270,
-                       "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,
-                       "frame_duration": 420,
-                       "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,
-                       "frame_duration": 330,
-                       "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"}
-                       ]
-               }
-       ]
-}
diff --git a/backends/res/voice/streaming.json b/backends/res/voice/streaming.json
deleted file mode 100644 (file)
index 5fc1381..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-{
-       "type": "voice/streaming",
-       "interval": 30,
-       "frame": [
-               {
-                       "frame_id": 1,
-                       "frame_duration": 210,
-                       "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,
-                       "frame_duration": 210,
-                       "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"}
-                       ]
-               },
-               {
-                       "frame_id": 3,
-                       "frame_duration": 480,
-                       "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/timeout.json b/backends/res/voice/timeout.json
deleted file mode 100644 (file)
index 3b7df7b..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-{
-       "type": "voice/timeout",
-       "interval": 30,
-       "frame": [
-               {
-                       "frame_id": 1,
-                       "frame_duration": 120,
-                       "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,
-                       "frame_duration": 120,
-                       "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,
-                       "frame_duration": 570,
-                       "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,
-                       "frame_duration": 1200,
-                       "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,
-                       "frame_duration": 30,
-                       "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
deleted file mode 100644 (file)
index 117198a..0000000
+++ /dev/null
@@ -1,173 +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 default_frame_info_t *ani_frame = NULL;
-
-static default_frame_info_t *
-_ani_backend_easysetup_get_frame(default_ani_info *ani_info)
-{
-       default_frame_info_t *key_frame, *key_frame2;
-       int idx, idx2;
-       unsigned int r, g, b, r2, g2, b2;
-       int r3, g3, b3;
-       double div;
-
-       if (ani_info->frame_idx == 0)
-       {
-               ani_info->frame_max = (unsigned int)(ani_info->frames[ani_info->key_frame_cur].frame_duration / ani_info->interval);
-       }
-
-       idx = ani_info->key_frame_cur;
-       idx2 = (idx + 1) % ani_info->num_key_frames;
-
-       key_frame = &ani_info->frames[idx];
-       key_frame2 = &ani_info->frames[idx2];
-
-       div = (double)(ani_info->frame_idx) / (double)ani_info->frame_max;
-       r = g = b = r2 = g2 = b2 = 0x0;
-       for (int i = 0; i < key_frame->num_led; i++)
-       {
-               pui_default_backend_ani_get_led_rgb(key_frame, i, &r, &g, &b);
-               pui_default_backend_ani_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;
-
-               ani_frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
-       }
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= ani_info->frame_max)
-       {
-               ani_info->frame_idx = 0;
-               ani_info->key_frame_cur = (ani_info->key_frame_cur + 1) % ani_info->num_key_frames;
-               if (ani_info->repeat >= 0 && ani_info->key_frame_cur == 0)
-                       ani_info->repeat_cur++;
-       }
-
-       return ani_frame;
-}
-
-static pui_bool
-_ani_backend_easysetup_frame_cb(void *data, int serial)
-{
-       int ret = 0;
-       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;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       /* 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);
-       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
-
-       return (pui_bool)ret;
-}
-
-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;
-
-       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);
-       if (repeat == 0) info->repeat = 1;
-       else info->repeat = repeat;
-
-       info->key_frame_cur = 0;
-       info->frame_idx = 0;
-       info->repeat_cur = 0;
-
-       if (!ani_frame)
-               ani_frame = backend_util_alloc_frame(info);
-       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
-
-       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_bool force)
-{
-       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, force=%d\n", info->id, force);
-
-       pui_backend_ani_remove_frame_cb(ani);
-
-       if (force)
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
-       else
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       if (ani_frame)
-       {
-               backend_util_free_frame(ani_frame);
-               ani_frame = NULL;
-       }
-
-       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
deleted file mode 100644 (file)
index e2934be..0000000
+++ /dev/null
@@ -1,150 +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 default_frame_info_t *ani_frame = NULL;
-
-static default_frame_info_t *
-_ani_backend_micoff_get_frame(default_ani_info *ani_info)
-{
-       default_frame_info_t *key_frame;
-
-       key_frame = &ani_info->frames[0];
-
-       for (int i = 0; i < key_frame->num_led; i++)
-       {
-               ani_frame->leds[i].color = key_frame->leds[i].color;
-       }
-
-       if (ani_info->repeat >= 0)
-               ani_info->repeat_cur++;
-
-       return ani_frame;
-}
-
-
-static pui_bool
-_ani_backend_micoff_frame_cb(void *data, int serial)
-{
-       int ret = 0;
-       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;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       /* 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);
-       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
-
-       return (pui_bool)ret;
-}
-
-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;
-
-       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);
-       if (repeat == 0) info->repeat = 1;
-       else info->repeat = repeat;
-
-       info->key_frame_cur = 0;
-       info->frame_idx = 0;
-       info->repeat_cur = 0;
-
-       if (!ani_frame)
-               ani_frame = backend_util_alloc_frame(info);
-       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
-
-       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_bool force)
-{
-       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, force=%d\n", info->id, force);
-
-       pui_backend_ani_remove_frame_cb(ani);
-
-       if (force)
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
-       else
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       if (ani_frame)
-       {
-               backend_util_free_frame(ani_frame);
-               ani_frame = NULL;
-       }
-
-       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
deleted file mode 100644 (file)
index 68a2320..0000000
+++ /dev/null
@@ -1,177 +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 default_frame_info_t *ani_frame = NULL;
-
-static default_frame_info_t *
-_ani_backend_swupdatedone_get_frame(default_ani_info *ani_info)
-{
-       default_frame_info_t *key_frame, *key_frame2;
-       int idx, idx2;
-       unsigned int r, g, b, r2, g2, b2;
-       int r3, g3, b3;
-       double div;
-
-       if (ani_info->frame_idx == 0)
-       {
-               ani_info->frame_max = (unsigned int)(ani_info->frames[ani_info->key_frame_cur].frame_duration / ani_info->interval);
-       }
-
-       idx = ani_info->key_frame_cur;
-       idx2 = (idx + 1) % ani_info->num_key_frames;
-
-       key_frame = &ani_info->frames[idx];
-       key_frame2 = &ani_info->frames[idx2];
-
-       div = (double)(ani_info->frame_idx) / (double)ani_info->frame_max;
-       r = g = b = r2 = g2 = b2 = 0x0;
-
-       for (int i = 0; i < key_frame->num_led; i++)
-       {
-               pui_default_backend_ani_get_led_rgb(key_frame, i, &r, &g, &b);
-               pui_default_backend_ani_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;
-
-               ani_frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
-       }
-
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= ani_info->frame_max)
-       {
-               ani_info->frame_idx = 0;
-               ani_info->key_frame_cur = (ani_info->key_frame_cur + 1) % ani_info->num_key_frames;
-               if (ani_info->repeat >= 0 && ani_info->key_frame_cur == 0)
-                       ani_info->repeat_cur++;
-       }
-
-       return ani_frame;
-}
-
-static pui_bool
-_ani_backend_swupdatedone_frame_cb(void *data, int serial)
-{
-       int ret = 0;
-       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;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       /* 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);
-       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
-
-       return (pui_bool)ret;
-}
-
-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;
-
-       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);
-       if (repeat == 0) info->repeat = 1;
-       else info->repeat = repeat;
-
-       info->key_frame_cur = 0;
-       info->frame_idx = 0;
-       info->repeat_cur = 0;
-
-       if (!ani_frame)
-               ani_frame = backend_util_alloc_frame(info);
-       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
-
-       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_bool force)
-{
-       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, force=%d\n", info->id, force);
-
-       pui_backend_ani_remove_frame_cb(ani);
-
-       if (force)
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
-       else
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       if (ani_frame)
-       {
-               backend_util_free_frame(ani_frame);
-               ani_frame = NULL;
-       }
-
-       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
deleted file mode 100644 (file)
index 704c01c..0000000
+++ /dev/null
@@ -1,159 +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 default_frame_info_t *ani_frame = NULL;
-
-static default_frame_info_t *
-_ani_backend_system_processing_get_frame(default_ani_info *ani_info)
-{
-       default_frame_info_t *key_frame;
-
-       key_frame = &ani_info->frames[0];
-
-       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;
-               ani_frame->leds[idx] = key_frame->leds[i];
-       }
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= key_frame->num_led)
-       {
-               if (ani_info->repeat >= 0)
-                       ani_info->repeat_cur++;
-               ani_info->frame_idx = 0;
-       }
-
-       return ani_frame;
-}
-
-static pui_bool
-_ani_backend_system_processing_frame_cb(void *data, int serial)
-{
-       int ret = 0;
-       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;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       /* 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);
-       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
-
-       return (pui_bool)ret;
-}
-
-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;
-
-       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);
-       if (repeat == 0) info->repeat = 1;
-       else info->repeat = repeat;
-
-       info->key_frame_cur = 0;
-       info->frame_idx = 0;
-       info->repeat_cur = 0;
-
-       if (!ani_frame)
-               ani_frame = backend_util_alloc_frame(info);
-       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
-
-       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_bool force)
-{
-       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, force=%d\n", info->id, force);
-
-       pui_backend_ani_remove_frame_cb(ani);
-
-       if (force)
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
-       else
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       if (ani_frame)
-       {
-               backend_util_free_frame(ani_frame);
-               ani_frame = NULL;
-       }
-
-       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
deleted file mode 100644 (file)
index 5258242..0000000
+++ /dev/null
@@ -1,183 +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 default_frame_info_t *ani_frame = NULL;
-
-static default_frame_info_t *
-_ani_backend_listening_get_frame(default_ani_info *ani_info)
-{
-       default_frame_info_t *key_frame;
-       int division;
-
-       key_frame = &ani_info->frames[0];
-
-       division = (int)(key_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;
-                       }
-               }
-               ani_frame->leds[idx] = key_frame->leds[i];
-       }
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= key_frame->num_led)
-       {
-               if (ani_info->repeat >= 0)
-                       ani_info->repeat_cur++;
-               ani_info->frame_idx = 0;
-       }
-
-       return ani_frame;
-}
-
-static pui_bool
-_ani_backend_listening_frame_cb(void *data, int serial)
-{
-       int ret = 0;
-       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;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       /* 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);
-       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
-
-       return (pui_bool)ret;
-}
-
-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;
-
-       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);
-       if (repeat == 0) info->repeat = 1;
-       else info->repeat = repeat;
-
-       info->key_frame_cur = 0;
-       info->frame_idx = 0;
-       info->repeat_cur = 0;
-
-       if (!ani_frame)
-               ani_frame = backend_util_alloc_frame(info);
-       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
-
-       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_bool force)
-{
-       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, force=%d\n", info->id, force);
-
-       pui_backend_ani_remove_frame_cb(ani);
-
-       if (force)
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
-       else
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       if (ani_frame)
-       {
-               backend_util_free_frame(ani_frame);
-               ani_frame = NULL;
-       }
-
-       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
deleted file mode 100644 (file)
index bd05672..0000000
+++ /dev/null
@@ -1,159 +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 default_frame_info_t *ani_frame = NULL;
-
-static default_frame_info_t *
-_ani_backend_processing_get_frame(default_ani_info *ani_info)
-{
-       default_frame_info_t *key_frame;
-
-       key_frame = &ani_info->frames[0];
-
-       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;
-               ani_frame->leds[idx] = key_frame->leds[i];
-       }
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= key_frame->num_led)
-       {
-               if (ani_info->repeat >= 0)
-                       ani_info->repeat_cur++;
-               ani_info->frame_idx = 0;
-       }
-
-       return ani_frame;
-}
-
-static pui_bool
-_ani_backend_processing_frame_cb(void *data, int serial)
-{
-       int ret = 0;
-       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;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       /* 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);
-       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
-
-       return (pui_bool)ret;
-}
-
-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;
-
-       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);
-       if (repeat == 0) info->repeat = 1;
-       else info->repeat = repeat;
-
-       info->key_frame_cur = 0;
-       info->frame_idx = 0;
-       info->repeat_cur = 0;
-
-       if (!ani_frame)
-               ani_frame = backend_util_alloc_frame(info);
-       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
-
-       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_bool force)
-{
-       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, force=%d\n", info->id, force);
-
-       pui_backend_ani_remove_frame_cb(ani);
-
-       if (force)
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
-       else
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       if (ani_frame)
-       {
-               backend_util_free_frame(ani_frame);
-               ani_frame = NULL;
-       }
-
-       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
deleted file mode 100644 (file)
index 51e160d..0000000
+++ /dev/null
@@ -1,176 +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 default_frame_info_t *ani_frame = NULL;
-
-static default_frame_info_t *
-_ani_backend_speaking_get_frame(default_ani_info *ani_info)
-{
-       default_frame_info_t *key_frame, *key_frame2;
-       int idx, idx2;
-       unsigned int r, g, b, r2, g2, b2;
-       int r3, g3, b3;
-       double div;
-
-       if (ani_info->frame_idx == 0)
-       {
-               ani_info->frame_max = (unsigned int)(ani_info->frames[ani_info->key_frame_cur].frame_duration / ani_info->interval);
-       }
-
-       idx = ani_info->key_frame_cur;
-       idx2 = (idx + 1) % ani_info->num_key_frames;
-
-       key_frame = &ani_info->frames[idx];
-       key_frame2 = &ani_info->frames[idx2];
-
-       div = (double)(ani_info->frame_idx) / (double)ani_info->frame_max;
-       r = g = b = r2 = g2 = b2 = 0x0;
-       for (int i = 0; i < key_frame->num_led; i++)
-       {
-               pui_default_backend_ani_get_led_rgb(key_frame, i, &r, &g, &b);
-               pui_default_backend_ani_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;
-
-               ani_frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
-       }
-       ani_info->frame_idx++;
-
-       if (ani_info->frame_idx >= ani_info->frame_max)
-       {
-               ani_info->frame_idx = 0;
-               ani_info->key_frame_cur = (ani_info->key_frame_cur + 1) % ani_info->num_key_frames;
-               if (ani_info->repeat >= 0 && ani_info->key_frame_cur == 0)
-                       ani_info->repeat_cur++;
-       }
-
-       return ani_frame;
-}
-
-static pui_bool
-_ani_backend_speaking_frame_cb(void *data, int serial)
-{
-       int ret = 0;
-       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;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       /* 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);
-       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
-
-       return (pui_bool)ret;
-}
-
-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;
-
-       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);
-       if (repeat == 0) info->repeat = 1;
-       else info->repeat = repeat;
-
-       info->key_frame_cur = 0;
-       info->frame_idx = 0;
-       info->repeat_cur = 0;
-
-       if (!ani_frame)
-               ani_frame = backend_util_alloc_frame(info);
-       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
-
-       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_bool force)
-{
-       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, force=%d\n", info->id, force);
-
-       pui_backend_ani_remove_frame_cb(ani);
-
-       if (force)
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
-       else
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       if (ani_frame)
-       {
-               backend_util_free_frame(ani_frame);
-               ani_frame = NULL;
-       }
-
-       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
deleted file mode 100644 (file)
index d603fe8..0000000
+++ /dev/null
@@ -1,175 +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 default_frame_info_t *ani_frame = NULL;
-
-static default_frame_info_t *
-_ani_backend_streaming_get_frame(default_ani_info *ani_info)
-{
-       default_frame_info_t *key_frame, *key_frame2;
-       int idx, idx2;
-       unsigned int r, g, b, r2, g2, b2;
-       int r3, g3, b3;
-       double div;
-
-       if (ani_info->frame_idx == 0)
-       {
-               ani_info->frame_max = (unsigned int)(ani_info->frames[ani_info->key_frame_cur].frame_duration / ani_info->interval);
-       }
-
-       idx = ani_info->key_frame_cur;
-       idx2 = (idx + 1) % ani_info->num_key_frames;
-
-       key_frame = &ani_info->frames[idx];
-       key_frame2 = &ani_info->frames[idx2];
-
-       div = (double)(ani_info->frame_idx) / (double)ani_info->frame_max;
-       r = g = b = r2 = g2 = b2 = 0x0;
-       for (int i = 0; i < key_frame->num_led; i++)
-       {
-               pui_default_backend_ani_get_led_rgb(key_frame, i, &r, &g, &b);
-               pui_default_backend_ani_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;
-
-               ani_frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
-       }
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= ani_info->frame_max)
-       {
-               ani_info->frame_idx = 0;
-               ani_info->key_frame_cur = (ani_info->key_frame_cur + 1) % ani_info->num_key_frames;
-               if (ani_info->repeat >= 0 && ani_info->key_frame_cur == 0)
-                       ani_info->repeat_cur++;
-       }
-
-       return ani_frame;
-}
-
-static pui_bool
-_ani_backend_streaming_frame_cb(void *data, int serial)
-{
-       int ret = 0;
-       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;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       /* 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);
-       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
-
-       return (pui_bool)ret;
-}
-
-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;
-
-       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);
-       if (repeat == 0) info->repeat = 1;
-       else info->repeat = repeat;
-
-       info->key_frame_cur = 0;
-       info->frame_idx = 0;
-       info->repeat_cur = 0;
-
-       if (!ani_frame)
-               ani_frame = backend_util_alloc_frame(info);
-       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
-
-       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_bool force)
-{
-       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, force=%d\n", info->id, force);
-
-       pui_backend_ani_remove_frame_cb(ani);
-
-       if (force)
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
-       else
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       if (ani_frame)
-       {
-               backend_util_free_frame(ani_frame);
-               ani_frame = NULL;
-       }
-
-       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
deleted file mode 100644 (file)
index 33ba1fd..0000000
+++ /dev/null
@@ -1,174 +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 default_frame_info_t *ani_frame = NULL;
-
-static default_frame_info_t *
-_ani_backend_timeout_get_frame(default_ani_info *ani_info)
-{
-       default_frame_info_t *key_frame, *key_frame2;
-       int idx, idx2;
-       unsigned int r, g, b, r2, g2, b2;
-       int r3, g3, b3;
-       double div;
-
-       if (ani_info->frame_idx == 0)
-       {
-               ani_info->frame_max = (unsigned int)(ani_info->frames[ani_info->key_frame_cur].frame_duration / ani_info->interval);
-       }
-
-       idx = ani_info->key_frame_cur;
-       idx2 = (idx + 1) % ani_info->num_key_frames;
-
-       key_frame = &ani_info->frames[idx];
-       key_frame2 = &ani_info->frames[idx2];
-
-       div = (double)(ani_info->frame_idx) / (double)ani_info->frame_max;
-       r = g = b = r2 = g2 = b2 = 0x0;
-       for (int i = 0; i < key_frame->num_led; i++)
-       {
-               pui_default_backend_ani_get_led_rgb(key_frame, i, &r, &g, &b);
-               pui_default_backend_ani_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;
-
-               ani_frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3);
-       }
-       ani_info->frame_idx++;
-       if (ani_info->frame_idx >= ani_info->frame_max)
-       {
-               ani_info->frame_idx = 0;
-               ani_info->key_frame_cur = (ani_info->key_frame_cur + 1) % ani_info->num_key_frames;
-               if (ani_info->repeat >= 0 && ani_info->key_frame_cur == 0)
-                       ani_info->repeat_cur++;
-       }
-
-       return ani_frame;
-}
-
-static pui_bool
-_ani_backend_timeout_frame_cb(void *data, int serial)
-{
-       int ret = 0;
-       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;
-
-       ani_data = pui_backend_ani_get_ani_data(ani);
-       default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info;
-
-       /* 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);
-       ret = pui_default_backend_ani_update_frame(ani, ani_data, buffer, frame, serial);
-
-       return (pui_bool)ret;
-}
-
-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;
-
-       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);
-       if (repeat == 0) info->repeat = 1;
-       else info->repeat = repeat;
-
-       info->key_frame_cur = 0;
-       info->frame_idx = 0;
-       info->repeat_cur = 0;
-
-       if (!ani_frame)
-               ani_frame = backend_util_alloc_frame(info);
-       ERROR_CHECK(ani_frame, return PUI_INT_ERROR_INVALID_RESOURCES, "Failed to alloc memory for frame\n");
-
-       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_bool force)
-{
-       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, force=%d\n", info->id, force);
-
-       pui_backend_ani_remove_frame_cb(ani);
-
-       if (force)
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_PAUSED);
-       else
-               pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED);
-
-       if (ani_frame)
-       {
-               backend_util_free_frame(ani_frame);
-               ani_frame = NULL;
-       }
-
-       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 6017a0e0d54127fe87c8433dde084bad679c6103..7ee8afa4a19188ef804c54203694ca3ae625a660 100644 (file)
@@ -58,7 +58,7 @@ make %{?_smp_mflags}
 
 ###### libpui default backend's animation data
 mkdir -p %{buildroot}/%{ANIDATA_DIR}/
-cp -fr backends/res/* %{buildroot}/%{ANIDATA_DIR}/
+cp -fr backends/default/res/* %{buildroot}/%{ANIDATA_DIR}/
 %make_install
 
 %post -n %{name} -p /sbin/ldconfig