From 38be2ab36bcbf07cc8c03bf0946d7567f3d7ad62 Mon Sep 17 00:00:00 2001 From: jeon Date: Thu, 29 Aug 2019 12:18:20 +0900 Subject: [PATCH] default_backend: add some animations - easy_setup, emergency, mic_off, normal, sw_update_done, time_out Change-Id: I8b4e7862d0776e3820466a52a845bcfc20bf60e7 --- backends/Makefile.am | 9 +- backends/default_ani_easysetup.c | 206 +++++++++++++++++++++++++++++++++++ backends/default_ani_emergency.c | 32 ++++-- backends/default_ani_micoff.c | 191 ++++++++++++++++++++++++++++++++ backends/default_ani_normal.c | 209 ++++++++++++++++++++++++++++++++++++ backends/default_ani_swupdatedone.c | 208 +++++++++++++++++++++++++++++++++++ backends/default_ani_timeout.c | 208 +++++++++++++++++++++++++++++++++++ backends/default_backend.c | 28 ++++- backends/default_backend.h | 7 +- backends/res/alarm.json | 27 ----- backends/res/easy_setup.json | 40 +++++++ backends/res/emergency.json | 26 ++--- backends/res/mic_off.json | 23 ++++ backends/res/normal.json | 57 ++++++++++ backends/res/sw_update_done.json | 57 ++++++++++ backends/res/timeout.json | 91 ++++++++++++++++ samples/PUI_sample.c | 16 +-- 17 files changed, 1368 insertions(+), 67 deletions(-) create mode 100644 backends/default_ani_easysetup.c create mode 100644 backends/default_ani_micoff.c create mode 100644 backends/default_ani_normal.c create mode 100644 backends/default_ani_swupdatedone.c create mode 100644 backends/default_ani_timeout.c delete mode 100644 backends/res/alarm.json create mode 100644 backends/res/easy_setup.json create mode 100644 backends/res/mic_off.json create mode 100644 backends/res/normal.json create mode 100644 backends/res/sw_update_done.json create mode 100644 backends/res/timeout.json diff --git a/backends/Makefile.am b/backends/Makefile.am index 2a68c52..60f2cb4 100644 --- a/backends/Makefile.am +++ b/backends/Makefile.am @@ -16,6 +16,11 @@ libpui_default_backend_la_SOURCES = \ default_backend.c \ default_ani_listening.c \ default_ani_speaking.c \ - default_ani_emergency.c \ default_ani_processing.c \ - default_ani_streaming.c + default_ani_streaming.c \ + default_ani_timeout.c \ + default_ani_emergency.c \ + default_ani_normal.c \ + default_ani_easysetup.c \ + default_ani_swupdatedone.c \ + default_ani_micoff.c diff --git a/backends/default_ani_easysetup.c b/backends/default_ani_easysetup.c new file mode 100644 index 0000000..c54ae49 --- /dev/null +++ b/backends/default_ani_easysetup.c @@ -0,0 +1,206 @@ +/* + * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include "default_backend.h" + +static void +_ani_backend_easysetup_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b) +{ + if (!frame) return; + if (!r || !g || !b) return; + if (led_idx > frame->num_led) return; + + *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16; + *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8; + *b = (frame->leds[led_idx].color & LED_MASK_BLUE); +} + +static void +_ani_backend_easysetup_free_frame(default_frame_info_t *frame) +{ + if (!frame) return; + + if (frame->leds) free(frame->leds); + free(frame); +} + +static default_frame_info_t * +_ani_backend_easysetup_get_frame(default_ani_info *ani_info) +{ +#define SMOOTH_FRAME 20 + default_frame_info_t *frame, *key_frame, *key_frame2; + int idx, idx2; + unsigned int r, g, b, r2, g2, b2; + int r3, g3, b3; + double div; + + frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1); + if (!frame) return NULL; + + idx = ((int)(ani_info->frame_idx / SMOOTH_FRAME)) % ani_info->num_key_frames; + idx2 = (idx + 1) % ani_info->num_key_frames; + + key_frame = &ani_info->frames[idx]; + key_frame2 = &ani_info->frames[idx2]; + frame->num_led = key_frame->num_led; + frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led); + if (!frame->leds) + { + free(frame); + return NULL; + } + div = (double)(ani_info->frame_idx % SMOOTH_FRAME) / (double)SMOOTH_FRAME; + r = g = b = r2 = g2 = b2 = 0x0; + for (int i = 0; i < key_frame->num_led; i++) + { + _ani_backend_easysetup_get_led_rgb(key_frame, i, &r, &g, &b); + _ani_backend_easysetup_get_led_rgb(key_frame2, i, &r2, &g2, &b2); + r3 = (int)(r2 - r) * div + r; + g3 = (int)(g2 - g) * div + g; + b3 = (int)(b2 - b) * div + b; + + frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3); + } + ani_info->frame_idx++; + if (ani_info->frame_idx >= (ani_info->num_key_frames * SMOOTH_FRAME)) + ani_info->frame_idx = 0; + + return frame; +} + +static pui_bool +_ani_backend_easysetup_frame_cb(void *data, int serial) +{ + pui_int_error e = PUI_INT_ERROR_NONE; + pui_ani_t *ani = (pui_ani_t *)data; + pui_backend_ani_data *ani_data = NULL; + pui_ani_control_buffer *buffer = NULL; + default_frame_info_t *frame; + unsigned int r = 0x0, g = 0x0, b = 0x0; + double now; + + ani_data = pui_backend_ani_get_ani_data(ani); + default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info; + + now = ecore_time_unix_get(); + pui_info("[time:%.3f] serial=%d\n", now, serial); + + /* TODO : make use of ani_info */ + //(void) ani_info; + + buffer = pui_backend_ani_get_buffer(ani); + if (!buffer) { + pui_err("Failed to get buffer for animation\n"); + return (pui_bool)0; + } + + frame = _ani_backend_easysetup_get_frame(ani_info); + for(int i = 0; i<12; i++) + { + _ani_backend_easysetup_get_led_rgb(frame, i, &r, &g, &b); + buffer->ptr[4*i] = 0; + buffer->ptr[4*i + 1] = b; /* BLUE */ + buffer->ptr[4*i + 2] = g; /* GREEN */ + buffer->ptr[4*i + 3] = r; /* RED */ + } + _ani_backend_easysetup_free_frame(frame); + + e = pui_backend_ani_set_buffer(ani, buffer); + + if (e != PUI_INT_ERROR_NONE) + { + pui_err("Failed on setting buffer on animation !(e=%d)\n", e); + return (pui_bool)0; + } + + e = pui_backend_ani_update(ani); + + if (e != PUI_INT_ERROR_NONE) + { + pui_err("Failed on updating animation !(e=%d)\n", e); + return (pui_bool)0; + } + + pui_info("... update (serial=%d)\n", serial); + + return (pui_bool)1; +} + +pui_error +_ani_easysetup_start(pui_ani_t *ani, int repeat) +{ + pui_bool ret = 0; + pui_int_error e = PUI_INT_ERROR_NONE; + pui_backend_ani_data *ani_data = NULL; + + ani_data = pui_backend_ani_get_ani_data(ani); + default_ani_info *info = (default_ani_info *)ani_data->ani_info; + + //TODO + (void) info; + + pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval); + + pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED); + ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_easysetup_frame_cb, info->interval / 1000.0); + + if (!ret) + { + pui_err("Failed to add frame callback !\n"); + e = PUI_INT_ERROR_INVALID_RESOURCES; + } + + return e; +} + +pui_error +_ani_easysetup_stop(pui_ani_t *ani) +{ + pui_int_error e = PUI_INT_ERROR_NONE; + pui_backend_ani_data *ani_data = NULL; + + ani_data = pui_backend_ani_get_ani_data(ani); + default_ani_info *info = (default_ani_info *)ani_data->ani_info; + + //TODO + (void) info; + + pui_info("... info->id: %s\n", info->id); + + pui_backend_ani_remove_frame_cb(ani); + pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED); + + return e; +} + + +void +pui_default_backend_ani_easysetup_func_set(pui_backend_ani_func *func) +{ + if (!func) return; + + func->ani_start = _ani_easysetup_start; + func->ani_stop = _ani_easysetup_stop; +} diff --git a/backends/default_ani_emergency.c b/backends/default_ani_emergency.c index 3693da7..67c09a2 100644 --- a/backends/default_ani_emergency.c +++ b/backends/default_ani_emergency.c @@ -49,12 +49,21 @@ _ani_backend_emergency_free_frame(default_frame_info_t *frame) static default_frame_info_t * _ani_backend_emergency_get_frame(default_ani_info *ani_info) { - default_frame_info_t *frame, *key_frame; +#define SMOOTH_FRAME 15 + default_frame_info_t *frame, *key_frame, *key_frame2; + int idx, idx2; + unsigned int r, g, b, r2, g2, b2; + int r3, g3, b3; + double div; frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1); if (!frame) return NULL; - key_frame = &ani_info->frames[0]; + idx = ((int)(ani_info->frame_idx / SMOOTH_FRAME)) % ani_info->num_key_frames; + idx2 = (idx + 1) % ani_info->num_key_frames; + + key_frame = &ani_info->frames[idx]; + key_frame2 = &ani_info->frames[idx2]; frame->num_led = key_frame->num_led; frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led); if (!frame->leds) @@ -62,18 +71,26 @@ _ani_backend_emergency_get_frame(default_ani_info *ani_info) free(frame); return NULL; } + div = (double)(ani_info->frame_idx % SMOOTH_FRAME) / (double)SMOOTH_FRAME; + r = g = b = r2 = g2 = b2 = 0x0; for (int i = 0; i < key_frame->num_led; i++) { - int idx = (i - ani_info->frame_idx + key_frame->num_led) % key_frame->num_led; - frame->leds[idx] = key_frame->leds[i]; + _ani_backend_emergency_get_led_rgb(key_frame, i, &r, &g, &b); + _ani_backend_emergency_get_led_rgb(key_frame2, i, &r2, &g2, &b2); + r3 = (int)(r2 - r) * div + r; + g3 = (int)(g2 - g) * div + g; + b3 = (int)(b2 - b) * div + b; + + frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3); } ani_info->frame_idx++; - if (ani_info->frame_idx >= key_frame->num_led) + if (ani_info->frame_idx >= (ani_info->num_key_frames * SMOOTH_FRAME)) ani_info->frame_idx = 0; return frame; } + static pui_bool _ani_backend_emergency_frame_cb(void *data, int serial) { @@ -146,11 +163,6 @@ _ani_emergency_start(pui_ani_t *ani, int repeat) (void) info; pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval); - if (info->num_key_frames != 1) - { - pui_err("invalid key frames: %d\n", info->num_key_frames); - return PUI_INT_ERROR_INVALID_RESOURCES; - } pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED); ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_emergency_frame_cb, info->interval / 1000.0); diff --git a/backends/default_ani_micoff.c b/backends/default_ani_micoff.c new file mode 100644 index 0000000..0043b4a --- /dev/null +++ b/backends/default_ani_micoff.c @@ -0,0 +1,191 @@ +/* + * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include "default_backend.h" + +static void +_ani_backend_micoff_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b) +{ + if (!frame) return; + if (!r || !g || !b) return; + if (led_idx > frame->num_led) return; + + *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16; + *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8; + *b = (frame->leds[led_idx].color & LED_MASK_BLUE); +} + +static void +_ani_backend_micoff_free_frame(default_frame_info_t *frame) +{ + if (!frame) return; + + if (frame->leds) free(frame->leds); + free(frame); +} + +static default_frame_info_t * +_ani_backend_micoff_get_frame(default_ani_info *ani_info) +{ +#define SMOOTH_FRAME 15 + default_frame_info_t *frame, *key_frame; + + frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1); + if (!frame) return NULL; + + key_frame = &ani_info->frames[0]; + frame->num_led = key_frame->num_led; + frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led); + if (!frame->leds) + { + free(frame); + return NULL; + } + + for (int i = 0; i < key_frame->num_led; i++) + { + frame->leds[i].color = key_frame->leds[i].color; + } + + return frame; +} + + +static pui_bool +_ani_backend_micoff_frame_cb(void *data, int serial) +{ + pui_int_error e = PUI_INT_ERROR_NONE; + pui_ani_t *ani = (pui_ani_t *)data; + pui_backend_ani_data *ani_data = NULL; + pui_ani_control_buffer *buffer = NULL; + default_frame_info_t *frame; + unsigned int r = 0x0, g = 0x0, b = 0x0; + double now; + + ani_data = pui_backend_ani_get_ani_data(ani); + default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info; + + now = ecore_time_unix_get(); + pui_info("[time:%.3f] serial=%d\n", now, serial); + + /* TODO : make use of ani_info */ + //(void) ani_info; + + buffer = pui_backend_ani_get_buffer(ani); + if (!buffer) { + pui_err("Failed to get buffer for animation\n"); + return (pui_bool)0; + } + + frame = _ani_backend_micoff_get_frame(ani_info); + for(int i = 0; i<12; i++) + { + _ani_backend_micoff_get_led_rgb(frame, i, &r, &g, &b); + buffer->ptr[4*i] = 0; + buffer->ptr[4*i + 1] = b; /* BLUE */ + buffer->ptr[4*i + 2] = g; /* GREEN */ + buffer->ptr[4*i + 3] = r; /* RED */ + } + _ani_backend_micoff_free_frame(frame); + + e = pui_backend_ani_set_buffer(ani, buffer); + + if (e != PUI_INT_ERROR_NONE) + { + pui_err("Failed on setting buffer on animation !(e=%d)\n", e); + return (pui_bool)0; + } + + e = pui_backend_ani_update(ani); + + if (e != PUI_INT_ERROR_NONE) + { + pui_err("Failed on updating animation !(e=%d)\n", e); + return (pui_bool)0; + } + + pui_info("... update (serial=%d)\n", serial); + + return (pui_bool)1; +} + +pui_error +_ani_micoff_start(pui_ani_t *ani, int repeat) +{ + pui_bool ret = 0; + pui_int_error e = PUI_INT_ERROR_NONE; + pui_backend_ani_data *ani_data = NULL; + + ani_data = pui_backend_ani_get_ani_data(ani); + default_ani_info *info = (default_ani_info *)ani_data->ani_info; + + //TODO + (void) info; + + pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval); + + pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED); + ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_micoff_frame_cb, info->interval / 1000.0); + + if (!ret) + { + pui_err("Failed to add frame callback !\n"); + e = PUI_INT_ERROR_INVALID_RESOURCES; + } + + return e; +} + +pui_error +_ani_micoff_stop(pui_ani_t *ani) +{ + pui_int_error e = PUI_INT_ERROR_NONE; + pui_backend_ani_data *ani_data = NULL; + + ani_data = pui_backend_ani_get_ani_data(ani); + default_ani_info *info = (default_ani_info *)ani_data->ani_info; + + //TODO + (void) info; + + pui_info("... info->id: %s\n", info->id); + + pui_backend_ani_remove_frame_cb(ani); + pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED); + + return e; +} + + +void +pui_default_backend_ani_micoff_func_set(pui_backend_ani_func *func) +{ + if (!func) return; + + func->ani_start = _ani_micoff_start; + func->ani_stop = _ani_micoff_stop; +} + + diff --git a/backends/default_ani_normal.c b/backends/default_ani_normal.c new file mode 100644 index 0000000..bc35973 --- /dev/null +++ b/backends/default_ani_normal.c @@ -0,0 +1,209 @@ +/* + * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include "default_backend.h" + +static void +_ani_backend_normal_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b) +{ + if (!frame) return; + if (!r || !g || !b) return; + if (led_idx > frame->num_led) return; + + *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16; + *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8; + *b = (frame->leds[led_idx].color & LED_MASK_BLUE); +} + +static void +_ani_backend_normal_free_frame(default_frame_info_t *frame) +{ + if (!frame) return; + + if (frame->leds) free(frame->leds); + free(frame); +} + +static default_frame_info_t * +_ani_backend_normal_get_frame(default_ani_info *ani_info) +{ +#define SMOOTH_FRAME 15 + default_frame_info_t *frame, *key_frame, *key_frame2; + int idx, idx2; + unsigned int r, g, b, r2, g2, b2; + int r3, g3, b3; + double div; + + frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1); + if (!frame) return NULL; + + idx = ((int)(ani_info->frame_idx / SMOOTH_FRAME)) % ani_info->num_key_frames; + idx2 = (idx + 1) % ani_info->num_key_frames; + + key_frame = &ani_info->frames[idx]; + key_frame2 = &ani_info->frames[idx2]; + frame->num_led = key_frame->num_led; + frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led); + if (!frame->leds) + { + free(frame); + return NULL; + } + div = (double)(ani_info->frame_idx % SMOOTH_FRAME) / (double)SMOOTH_FRAME; + r = g = b = r2 = g2 = b2 = 0x0; + for (int i = 0; i < key_frame->num_led; i++) + { + _ani_backend_normal_get_led_rgb(key_frame, i, &r, &g, &b); + _ani_backend_normal_get_led_rgb(key_frame2, i, &r2, &g2, &b2); + r3 = (int)(r2 - r) * div + r; + g3 = (int)(g2 - g) * div + g; + b3 = (int)(b2 - b) * div + b; + + frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3); + } + ani_info->frame_idx++; + if (ani_info->frame_idx >= (ani_info->num_key_frames * SMOOTH_FRAME)) + ani_info->frame_idx = 0; + + return frame; +} + + +static pui_bool +_ani_backend_normal_frame_cb(void *data, int serial) +{ + pui_int_error e = PUI_INT_ERROR_NONE; + pui_ani_t *ani = (pui_ani_t *)data; + pui_backend_ani_data *ani_data = NULL; + pui_ani_control_buffer *buffer = NULL; + default_frame_info_t *frame; + unsigned int r = 0x0, g = 0x0, b = 0x0; + double now; + + ani_data = pui_backend_ani_get_ani_data(ani); + default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info; + + now = ecore_time_unix_get(); + pui_info("[time:%.3f] serial=%d\n", now, serial); + + /* TODO : make use of ani_info */ + //(void) ani_info; + + buffer = pui_backend_ani_get_buffer(ani); + if (!buffer) { + pui_err("Failed to get buffer for animation\n"); + return (pui_bool)0; + } + + frame = _ani_backend_normal_get_frame(ani_info); + for(int i = 0; i<12; i++) + { + _ani_backend_normal_get_led_rgb(frame, i, &r, &g, &b); + buffer->ptr[4*i] = 0; + buffer->ptr[4*i + 1] = b; /* BLUE */ + buffer->ptr[4*i + 2] = g; /* GREEN */ + buffer->ptr[4*i + 3] = r; /* RED */ + } + _ani_backend_normal_free_frame(frame); + + e = pui_backend_ani_set_buffer(ani, buffer); + + if (e != PUI_INT_ERROR_NONE) + { + pui_err("Failed on setting buffer on animation !(e=%d)\n", e); + return (pui_bool)0; + } + + e = pui_backend_ani_update(ani); + + if (e != PUI_INT_ERROR_NONE) + { + pui_err("Failed on updating animation !(e=%d)\n", e); + return (pui_bool)0; + } + + pui_info("... update (serial=%d)\n", serial); + + return (pui_bool)1; +} + +pui_error +_ani_normal_start(pui_ani_t *ani, int repeat) +{ + pui_bool ret = 0; + pui_int_error e = PUI_INT_ERROR_NONE; + pui_backend_ani_data *ani_data = NULL; + + ani_data = pui_backend_ani_get_ani_data(ani); + default_ani_info *info = (default_ani_info *)ani_data->ani_info; + + //TODO + (void) info; + + pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval); + + pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED); + ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_normal_frame_cb, info->interval / 1000.0); + + if (!ret) + { + pui_err("Failed to add frame callback !\n"); + e = PUI_INT_ERROR_INVALID_RESOURCES; + } + + return e; +} + +pui_error +_ani_normal_stop(pui_ani_t *ani) +{ + pui_int_error e = PUI_INT_ERROR_NONE; + pui_backend_ani_data *ani_data = NULL; + + ani_data = pui_backend_ani_get_ani_data(ani); + default_ani_info *info = (default_ani_info *)ani_data->ani_info; + + //TODO + (void) info; + + pui_info("... info->id: %s\n", info->id); + + pui_backend_ani_remove_frame_cb(ani); + pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED); + + return e; +} + + +void +pui_default_backend_ani_normal_func_set(pui_backend_ani_func *func) +{ + if (!func) return; + + func->ani_start = _ani_normal_start; + func->ani_stop = _ani_normal_stop; +} + + diff --git a/backends/default_ani_swupdatedone.c b/backends/default_ani_swupdatedone.c new file mode 100644 index 0000000..1c77871 --- /dev/null +++ b/backends/default_ani_swupdatedone.c @@ -0,0 +1,208 @@ +/* + * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include "default_backend.h" + +static void +_ani_backend_swupdatedone_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b) +{ + if (!frame) return; + if (!r || !g || !b) return; + if (led_idx > frame->num_led) return; + + *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16; + *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8; + *b = (frame->leds[led_idx].color & LED_MASK_BLUE); +} + +static void +_ani_backend_swupdatedone_free_frame(default_frame_info_t *frame) +{ + if (!frame) return; + + if (frame->leds) free(frame->leds); + free(frame); +} + +static default_frame_info_t * +_ani_backend_swupdatedone_get_frame(default_ani_info *ani_info) +{ +#define SMOOTH_FRAME 20 + default_frame_info_t *frame, *key_frame, *key_frame2; + int idx, idx2; + unsigned int r, g, b, r2, g2, b2; + int r3, g3, b3; + double div; + + frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1); + if (!frame) return NULL; + + idx = ((int)(ani_info->frame_idx / SMOOTH_FRAME)) % ani_info->num_key_frames; + idx2 = (idx + 1) % ani_info->num_key_frames; + + key_frame = &ani_info->frames[idx]; + key_frame2 = &ani_info->frames[idx2]; + frame->num_led = key_frame->num_led; + frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led); + if (!frame->leds) + { + free(frame); + return NULL; + } + div = (double)(ani_info->frame_idx % SMOOTH_FRAME) / (double)SMOOTH_FRAME; + r = g = b = r2 = g2 = b2 = 0x0; + for (int i = 0; i < key_frame->num_led; i++) + { + _ani_backend_swupdatedone_get_led_rgb(key_frame, i, &r, &g, &b); + _ani_backend_swupdatedone_get_led_rgb(key_frame2, i, &r2, &g2, &b2); + r3 = (int)(r2 - r) * div + r; + g3 = (int)(g2 - g) * div + g; + b3 = (int)(b2 - b) * div + b; + + frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3); + } + ani_info->frame_idx++; + if (ani_info->frame_idx >= (ani_info->num_key_frames * SMOOTH_FRAME)) + ani_info->frame_idx = 0; + + return frame; +} + +static pui_bool +_ani_backend_swupdatedone_frame_cb(void *data, int serial) +{ + pui_int_error e = PUI_INT_ERROR_NONE; + pui_ani_t *ani = (pui_ani_t *)data; + pui_backend_ani_data *ani_data = NULL; + pui_ani_control_buffer *buffer = NULL; + default_frame_info_t *frame; + unsigned int r = 0x0, g = 0x0, b = 0x0; + double now; + + ani_data = pui_backend_ani_get_ani_data(ani); + default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info; + + now = ecore_time_unix_get(); + pui_info("[time:%.3f] serial=%d\n", now, serial); + + /* TODO : make use of ani_info */ + //(void) ani_info; + + buffer = pui_backend_ani_get_buffer(ani); + if (!buffer) { + pui_err("Failed to get buffer for animation\n"); + return (pui_bool)0; + } + + frame = _ani_backend_swupdatedone_get_frame(ani_info); + for(int i = 0; i<12; i++) + { + _ani_backend_swupdatedone_get_led_rgb(frame, i, &r, &g, &b); + buffer->ptr[4*i] = 0; + buffer->ptr[4*i + 1] = b; /* BLUE */ + buffer->ptr[4*i + 2] = g; /* GREEN */ + buffer->ptr[4*i + 3] = r; /* RED */ + } + _ani_backend_swupdatedone_free_frame(frame); + + e = pui_backend_ani_set_buffer(ani, buffer); + + if (e != PUI_INT_ERROR_NONE) + { + pui_err("Failed on setting buffer on animation !(e=%d)\n", e); + return (pui_bool)0; + } + + e = pui_backend_ani_update(ani); + + if (e != PUI_INT_ERROR_NONE) + { + pui_err("Failed on updating animation !(e=%d)\n", e); + return (pui_bool)0; + } + + pui_info("... update (serial=%d)\n", serial); + + return (pui_bool)1; +} + +pui_error +_ani_swupdatedone_start(pui_ani_t *ani, int repeat) +{ + pui_bool ret = 0; + pui_int_error e = PUI_INT_ERROR_NONE; + pui_backend_ani_data *ani_data = NULL; + + ani_data = pui_backend_ani_get_ani_data(ani); + default_ani_info *info = (default_ani_info *)ani_data->ani_info; + + //TODO + (void) info; + + pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval); + + pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED); + ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_swupdatedone_frame_cb, info->interval / 1000.0); + + if (!ret) + { + pui_err("Failed to add frame callback !\n"); + e = PUI_INT_ERROR_INVALID_RESOURCES; + } + + return e; +} + +pui_error +_ani_swupdatedone_stop(pui_ani_t *ani) +{ + pui_int_error e = PUI_INT_ERROR_NONE; + pui_backend_ani_data *ani_data = NULL; + + ani_data = pui_backend_ani_get_ani_data(ani); + default_ani_info *info = (default_ani_info *)ani_data->ani_info; + + //TODO + (void) info; + + pui_info("... info->id: %s\n", info->id); + + pui_backend_ani_remove_frame_cb(ani); + pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED); + + return e; +} + + +void +pui_default_backend_ani_swupdatedone_func_set(pui_backend_ani_func *func) +{ + if (!func) return; + + func->ani_start = _ani_swupdatedone_start; + func->ani_stop = _ani_swupdatedone_stop; +} + + diff --git a/backends/default_ani_timeout.c b/backends/default_ani_timeout.c new file mode 100644 index 0000000..da2bc8d --- /dev/null +++ b/backends/default_ani_timeout.c @@ -0,0 +1,208 @@ +/* + * Copyright © 2019 Samsung Electronics co., Ltd. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include "default_backend.h" + +static void +_ani_backend_timeout_get_led_rgb(default_frame_info_t *frame, int led_idx, unsigned int *r, unsigned int *g, unsigned int *b) +{ + if (!frame) return; + if (!r || !g || !b) return; + if (led_idx > frame->num_led) return; + + *r = (frame->leds[led_idx].color & LED_MASK_RED) >> 16; + *g = (frame->leds[led_idx].color & LED_MASK_GREEN) >> 8; + *b = (frame->leds[led_idx].color & LED_MASK_BLUE); +} + +static void +_ani_backend_timeout_free_frame(default_frame_info_t *frame) +{ + if (!frame) return; + + if (frame->leds) free(frame->leds); + free(frame); +} + +static default_frame_info_t * +_ani_backend_timeout_get_frame(default_ani_info *ani_info) +{ +#define SMOOTH_FRAME 15 + default_frame_info_t *frame, *key_frame, *key_frame2; + int idx, idx2; + unsigned int r, g, b, r2, g2, b2; + int r3, g3, b3; + double div; + + frame = (default_frame_info_t *)calloc(sizeof(default_frame_info_t), 1); + if (!frame) return NULL; + + idx = ((int)(ani_info->frame_idx / SMOOTH_FRAME)) % ani_info->num_key_frames; + idx2 = (idx + 1) % ani_info->num_key_frames; + + key_frame = &ani_info->frames[idx]; + key_frame2 = &ani_info->frames[idx2]; + frame->num_led = key_frame->num_led; + frame->leds = (default_led_info_t *)calloc(sizeof(default_led_info_t), frame->num_led); + if (!frame->leds) + { + free(frame); + return NULL; + } + div = (double)(ani_info->frame_idx % SMOOTH_FRAME) / (double)SMOOTH_FRAME; + r = g = b = r2 = g2 = b2 = 0x0; + for (int i = 0; i < key_frame->num_led; i++) + { + _ani_backend_timeout_get_led_rgb(key_frame, i, &r, &g, &b); + _ani_backend_timeout_get_led_rgb(key_frame2, i, &r2, &g2, &b2); + r3 = (int)(r2 - r) * div + r; + g3 = (int)(g2 - g) * div + g; + b3 = (int)(b2 - b) * div + b; + + frame->leds[i].color = (r3 << 16) + (g3 << 8) + (b3); + } + ani_info->frame_idx++; + if (ani_info->frame_idx >= (ani_info->num_key_frames * SMOOTH_FRAME)) + ani_info->frame_idx = 0; + + return frame; +} + +static pui_bool +_ani_backend_timeout_frame_cb(void *data, int serial) +{ + pui_int_error e = PUI_INT_ERROR_NONE; + pui_ani_t *ani = (pui_ani_t *)data; + pui_backend_ani_data *ani_data = NULL; + pui_ani_control_buffer *buffer = NULL; + default_frame_info_t *frame; + unsigned int r = 0x0, g = 0x0, b = 0x0; + double now; + + ani_data = pui_backend_ani_get_ani_data(ani); + default_ani_info *ani_info = (default_ani_info *)ani_data->ani_info; + + now = ecore_time_unix_get(); + pui_info("[time:%.3f] serial=%d\n", now, serial); + + /* TODO : make use of ani_info */ + //(void) ani_info; + + buffer = pui_backend_ani_get_buffer(ani); + if (!buffer) { + pui_err("Failed to get buffer for animation\n"); + return (pui_bool)0; + } + + frame = _ani_backend_timeout_get_frame(ani_info); + for(int i = 0; i<12; i++) + { + _ani_backend_timeout_get_led_rgb(frame, i, &r, &g, &b); + buffer->ptr[4*i] = 0; + buffer->ptr[4*i + 1] = b; /* BLUE */ + buffer->ptr[4*i + 2] = g; /* GREEN */ + buffer->ptr[4*i + 3] = r; /* RED */ + } + _ani_backend_timeout_free_frame(frame); + + e = pui_backend_ani_set_buffer(ani, buffer); + + if (e != PUI_INT_ERROR_NONE) + { + pui_err("Failed on setting buffer on animation !(e=%d)\n", e); + return (pui_bool)0; + } + + e = pui_backend_ani_update(ani); + + if (e != PUI_INT_ERROR_NONE) + { + pui_err("Failed on updating animation !(e=%d)\n", e); + return (pui_bool)0; + } + + pui_info("... update (serial=%d)\n", serial); + + return (pui_bool)1; +} + +pui_error +_ani_timeout_start(pui_ani_t *ani, int repeat) +{ + pui_bool ret = 0; + pui_int_error e = PUI_INT_ERROR_NONE; + pui_backend_ani_data *ani_data = NULL; + + ani_data = pui_backend_ani_get_ani_data(ani); + default_ani_info *info = (default_ani_info *)ani_data->ani_info; + + //TODO + (void) info; + + pui_info("... info->id: %s, repeat : %d, interval: %d\n", info->id, repeat, info->interval); + + pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STARTED); + ret = pui_backend_ani_add_frame_cb(ani, _ani_backend_timeout_frame_cb, info->interval / 1000.0); + + if (!ret) + { + pui_err("Failed to add frame callback !\n"); + e = PUI_INT_ERROR_INVALID_RESOURCES; + } + + return e; +} + +pui_error +_ani_timeout_stop(pui_ani_t *ani) +{ + pui_int_error e = PUI_INT_ERROR_NONE; + pui_backend_ani_data *ani_data = NULL; + + ani_data = pui_backend_ani_get_ani_data(ani); + default_ani_info *info = (default_ani_info *)ani_data->ani_info; + + //TODO + (void) info; + + pui_info("... info->id: %s\n", info->id); + + pui_backend_ani_remove_frame_cb(ani); + pui_backend_ani_status_update(ani, PUI_ANI_STATUS_STOPPED); + + return e; +} + + +void +pui_default_backend_ani_timeout_func_set(pui_backend_ani_func *func) +{ + if (!func) return; + + func->ani_start = _ani_timeout_start; + func->ani_stop = _ani_timeout_stop; +} + + diff --git a/backends/default_backend.c b/backends/default_backend.c index c95082a..94603a3 100644 --- a/backends/default_backend.c +++ b/backends/default_backend.c @@ -443,10 +443,6 @@ _ani_create(pui_id id) { pui_default_backend_ani_processing_func_set(ani_func); } - else if (!strncmp(ani_info->id, "emergency", sizeof("emergency"))) - { - pui_default_backend_ani_emergency_func_set(ani_func); - } else if (!strncmp(ani_info->id, "listening", sizeof("listening"))) { pui_default_backend_ani_listening_func_set(ani_func); @@ -459,6 +455,30 @@ _ani_create(pui_id id) { pui_default_backend_ani_streaming_func_set(ani_func); } + else if (!strncmp(ani_info->id, "time_out", sizeof("time_out"))) + { + pui_default_backend_ani_timeout_func_set(ani_func); + } + else if (!strncmp(ani_info->id, "normal", sizeof("normal"))) + { + pui_default_backend_ani_normal_func_set(ani_func); + } + else if (!strncmp(ani_info->id, "emergency", sizeof("emergency"))) + { + pui_default_backend_ani_emergency_func_set(ani_func); + } + else if (!strncmp(ani_info->id, "easy_setup", sizeof("easy_setup"))) + { + pui_default_backend_ani_easysetup_func_set(ani_func); + } + else if (!strncmp(ani_info->id, "sw_update_done", sizeof("sw_update_done"))) + { + pui_default_backend_ani_swupdatedone_func_set(ani_func); + } + else if (!strncmp(ani_info->id, "mic_off", sizeof("mic_off"))) + { + pui_default_backend_ani_micoff_func_set(ani_func); + } else { pui_info("%s animation has no animation handler, using default handler\n", ani_info->id); diff --git a/backends/default_backend.h b/backends/default_backend.h index e7b0b8d..04ebd7c 100644 --- a/backends/default_backend.h +++ b/backends/default_backend.h @@ -97,7 +97,12 @@ struct _default_led_info_t 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_emergency_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_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); diff --git a/backends/res/alarm.json b/backends/res/alarm.json deleted file mode 100644 index ba12db4..0000000 --- a/backends/res/alarm.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "type": "alarm calm", - "interval": 30, - "frame": [ - { - "frame_id": 1, - "led": [ - {"id": 1, "color": "bbbbbb"}, - {"id": 2, "color": "000000"}, - {"id": 3, "color": "000000"}, - {"id": 4, "color": "bbbbbb"}, - {"id": 5, "color": "bbbbbb"}, - {"id": 6, "color": "000000"}, - {"id": 7, "color": "000000"}, - {"id": 8, "color": "bbbbbb"}, - {"id": 9, "color": "bbbbbb"}, - {"id": 10, "color": "000000"}, - {"id": 11, "color": "000000"}, - {"id": 12, "color": "bbbbbb"}, - {"id": 13, "color": "bbbbbb"}, - {"id": 14, "color": "000000"}, - {"id": 15, "color": "000000"}, - {"id": 16, "color": "bbbbbb"} - ] - } - ] -} diff --git a/backends/res/easy_setup.json b/backends/res/easy_setup.json new file mode 100644 index 0000000..f10e41c --- /dev/null +++ b/backends/res/easy_setup.json @@ -0,0 +1,40 @@ +{ + "type": "easy_setup", + "interval": 30, + "frame": [ + { + "frame_id": 1, + "led": [ + {"id": 1, "color": "000022"}, + {"id": 2, "color": "000022"}, + {"id": 3, "color": "000022"}, + {"id": 4, "color": "000022"}, + {"id": 5, "color": "000022"}, + {"id": 6, "color": "000022"}, + {"id": 7, "color": "000022"}, + {"id": 8, "color": "000022"}, + {"id": 9, "color": "000022"}, + {"id": 10, "color": "000022"}, + {"id": 11, "color": "000022"}, + {"id": 12, "color": "000022"} + ] + }, + { + "frame_id": 2, + "led": [ + {"id": 1, "color": "0000ee"}, + {"id": 2, "color": "0000ee"}, + {"id": 3, "color": "0000ee"}, + {"id": 4, "color": "0000ee"}, + {"id": 5, "color": "0000ee"}, + {"id": 6, "color": "0000ee"}, + {"id": 7, "color": "0000ee"}, + {"id": 8, "color": "0000ee"}, + {"id": 9, "color": "0000ee"}, + {"id": 10, "color": "0000ee"}, + {"id": 11, "color": "0000ee"}, + {"id": 12, "color": "0000ee"} + ] + }, + ] +} diff --git a/backends/res/emergency.json b/backends/res/emergency.json index 8b362a0..e2c393c 100644 --- a/backends/res/emergency.json +++ b/backends/res/emergency.json @@ -1,26 +1,22 @@ { - "type": "blinking", + "type": "emergency", "interval": 30, "frame": [ { "frame_id": 1, "led": [ - {"id": 1, "color": "bbbbbb"}, + {"id": 1, "color": "FF0000"}, {"id": 2, "color": "000000"}, {"id": 3, "color": "000000"}, {"id": 4, "color": "000000"}, - {"id": 5, "color": "bbbbbb"}, + {"id": 5, "color": "FF0000"}, {"id": 6, "color": "000000"}, {"id": 7, "color": "000000"}, {"id": 8, "color": "000000"}, - {"id": 9, "color": "bbbbbb"}, + {"id": 9, "color": "FF0000"}, {"id": 10, "color": "000000"}, {"id": 11, "color": "000000"}, - {"id": 12, "color": "000000"}, - {"id": 13, "color": "bbbbbb"}, - {"id": 14, "color": "000000"}, - {"id": 15, "color": "000000"}, - {"id": 16, "color": "000000"} + {"id": 12, "color": "000000"} ] }, { @@ -28,20 +24,16 @@ "led": [ {"id": 1, "color": "000000"}, {"id": 2, "color": "000000"}, - {"id": 3, "color": "bbbbbb"}, + {"id": 3, "color": "FF0000"}, {"id": 4, "color": "000000"}, {"id": 5, "color": "000000"}, {"id": 6, "color": "000000"}, - {"id": 7, "color": "bbbbbb"}, + {"id": 7, "color": "FF0000"}, {"id": 8, "color": "000000"}, {"id": 9, "color": "000000"}, {"id": 10, "color": "000000"}, - {"id": 11, "color": "bbbbbb"}, - {"id": 12, "color": "000000"}, - {"id": 13, "color": "000000"}, - {"id": 14, "color": "000000"}, - {"id": 15, "color": "bbbbbb"}, - {"id": 16, "color": "000000"} + {"id": 11, "color": "FF0000"}, + {"id": 12, "color": "000000"} ] } ] diff --git a/backends/res/mic_off.json b/backends/res/mic_off.json new file mode 100644 index 0000000..2100636 --- /dev/null +++ b/backends/res/mic_off.json @@ -0,0 +1,23 @@ +{ + "type": "mic_off", + "interval": 100, + "frame": [ + { + "frame_id": 1, + "led": [ + {"id": 1, "color": "FF0000"}, + {"id": 2, "color": "000000"}, + {"id": 3, "color": "000000"}, + {"id": 4, "color": "000000"}, + {"id": 5, "color": "000000"}, + {"id": 6, "color": "000000"}, + {"id": 7, "color": "000000"}, + {"id": 8, "color": "000000"}, + {"id": 9, "color": "000000"}, + {"id": 10, "color": "000000"}, + {"id": 11, "color": "000000"}, + {"id": 12, "color": "000000"} + ] + } + ] +} diff --git a/backends/res/normal.json b/backends/res/normal.json new file mode 100644 index 0000000..ee4aebf --- /dev/null +++ b/backends/res/normal.json @@ -0,0 +1,57 @@ +{ + "type": "normal", + "interval": 50, + "frame": [ + { + "frame_id": 1, + "led": [ + {"id": 1, "color": "000000"}, + {"id": 2, "color": "000000"}, + {"id": 3, "color": "000000"}, + {"id": 4, "color": "000000"}, + {"id": 5, "color": "000000"}, + {"id": 6, "color": "000000"}, + {"id": 7, "color": "FFFFFF"}, + {"id": 8, "color": "000000"}, + {"id": 9, "color": "000000"}, + {"id": 10, "color": "000000"}, + {"id": 11, "color": "000000"}, + {"id": 12, "color": "000000"} + ] + }, + { + "frame_id": 2, + "led": [ + {"id": 1, "color": "000000"}, + {"id": 2, "color": "000000"}, + {"id": 3, "color": "000000"}, + {"id": 4, "color": "000000"}, + {"id": 5, "color": "000000"}, + {"id": 6, "color": "000000"}, + {"id": 7, "color": "000000"}, + {"id": 8, "color": "000000"}, + {"id": 9, "color": "000000"}, + {"id": 10, "color": "000000"}, + {"id": 11, "color": "000000"}, + {"id": 12, "color": "000000"} + ] + }, + { + "frame_id": 3, + "led": [ + {"id": 1, "color": "000000"}, + {"id": 2, "color": "000000"}, + {"id": 3, "color": "000000"}, + {"id": 4, "color": "000000"}, + {"id": 5, "color": "000000"}, + {"id": 6, "color": "000000"}, + {"id": 7, "color": "FFFFFF"}, + {"id": 8, "color": "000000"}, + {"id": 9, "color": "000000"}, + {"id": 10, "color": "000000"}, + {"id": 11, "color": "000000"}, + {"id": 12, "color": "000000"} + ] + } + ] +} diff --git a/backends/res/sw_update_done.json b/backends/res/sw_update_done.json new file mode 100644 index 0000000..3d89f5b --- /dev/null +++ b/backends/res/sw_update_done.json @@ -0,0 +1,57 @@ +{ + "type": "sw_update_done", + "interval": 30, + "frame": [ + { + "frame_id": 1, + "led": [ + {"id": 1, "color": "222222"}, + {"id": 2, "color": "222222"}, + {"id": 3, "color": "222222"}, + {"id": 4, "color": "222222"}, + {"id": 5, "color": "222222"}, + {"id": 6, "color": "222222"}, + {"id": 7, "color": "222222"}, + {"id": 8, "color": "222222"}, + {"id": 9, "color": "222222"}, + {"id": 10, "color": "222222"}, + {"id": 11, "color": "222222"}, + {"id": 12, "color": "222222"} + ] + }, + { + "frame_id": 2, + "led": [ + {"id": 1, "color": "eeeeee"}, + {"id": 2, "color": "eeeeee"}, + {"id": 3, "color": "eeeeee"}, + {"id": 4, "color": "eeeeee"}, + {"id": 5, "color": "eeeeee"}, + {"id": 6, "color": "eeeeee"}, + {"id": 7, "color": "eeeeee"}, + {"id": 8, "color": "eeeeee"}, + {"id": 9, "color": "eeeeee"}, + {"id": 10, "color": "eeeeee"}, + {"id": 11, "color": "eeeeee"}, + {"id": 12, "color": "eeeeee"} + ] + }, + { + "frame_id": 3, + "led": [ + {"id": 1, "color": "000000"}, + {"id": 2, "color": "000000"}, + {"id": 3, "color": "000000"}, + {"id": 4, "color": "000000"}, + {"id": 5, "color": "000000"}, + {"id": 6, "color": "000000"}, + {"id": 7, "color": "000000"}, + {"id": 8, "color": "000000"}, + {"id": 9, "color": "000000"}, + {"id": 10, "color": "000000"}, + {"id": 11, "color": "000000"}, + {"id": 12, "color": "000000"} + ] + }, + ] +} diff --git a/backends/res/timeout.json b/backends/res/timeout.json new file mode 100644 index 0000000..4f28a69 --- /dev/null +++ b/backends/res/timeout.json @@ -0,0 +1,91 @@ +{ + "type": "time_out", + "interval": 30, + "frame": [ + { + "frame_id": 1, + "led": [ + {"id": 1, "color": "ffffff"}, + {"id": 2, "color": "000000"}, + {"id": 3, "color": "000000"}, + {"id": 4, "color": "000000"}, + {"id": 5, "color": "000000"}, + {"id": 6, "color": "000000"}, + {"id": 7, "color": "000000"}, + {"id": 8, "color": "000000"}, + {"id": 9, "color": "000000"}, + {"id": 10, "color": "000000"}, + {"id": 11, "color": "000000"}, + {"id": 12, "color": "ffffff"} + ] + }, + { + "frame_id": 2, + "led": [ + {"id": 1, "color": "444444"}, + {"id": 2, "color": "000000"}, + {"id": 3, "color": "000000"}, + {"id": 4, "color": "000000"}, + {"id": 5, "color": "000000"}, + {"id": 6, "color": "000000"}, + {"id": 7, "color": "000000"}, + {"id": 8, "color": "000000"}, + {"id": 9, "color": "000000"}, + {"id": 10, "color": "000000"}, + {"id": 11, "color": "000000"}, + {"id": 12, "color": "444444"} + ] + }, + { + "frame_id": 3, + "led": [ + {"id": 1, "color": "ffffff"}, + {"id": 2, "color": "000000"}, + {"id": 3, "color": "000000"}, + {"id": 4, "color": "000000"}, + {"id": 5, "color": "000000"}, + {"id": 6, "color": "000000"}, + {"id": 7, "color": "000000"}, + {"id": 8, "color": "000000"}, + {"id": 9, "color": "000000"}, + {"id": 10, "color": "000000"}, + {"id": 11, "color": "000000"}, + {"id": 12, "color": "ffffff"} + ] + }, + { + "frame_id": 4, + "led": [ + {"id": 1, "color": "ffffff"}, + {"id": 2, "color": "000000"}, + {"id": 3, "color": "000000"}, + {"id": 4, "color": "000000"}, + {"id": 5, "color": "000000"}, + {"id": 6, "color": "000000"}, + {"id": 7, "color": "000000"}, + {"id": 8, "color": "000000"}, + {"id": 9, "color": "000000"}, + {"id": 10, "color": "000000"}, + {"id": 11, "color": "000000"}, + {"id": 12, "color": "ffffff"} + ] + }, + { + "frame_id": 5, + "led": [ + {"id": 1, "color": "000000"}, + {"id": 2, "color": "000000"}, + {"id": 3, "color": "000000"}, + {"id": 4, "color": "000000"}, + {"id": 5, "color": "000000"}, + {"id": 6, "color": "000000"}, + {"id": 7, "color": "000000"}, + {"id": 8, "color": "000000"}, + {"id": 9, "color": "000000"}, + {"id": 10, "color": "000000"}, + {"id": 11, "color": "000000"}, + {"id": 12, "color": "000000"} + ] + } + ] +} diff --git a/samples/PUI_sample.c b/samples/PUI_sample.c index 09b5a01..a5c22a7 100644 --- a/samples/PUI_sample.c +++ b/samples/PUI_sample.c @@ -68,12 +68,16 @@ struct app_data static Eina_Array *_ecore_event_hdls = NULL; static animation_t ani_collection[] = { - { "alarm calm", PUI_ANI_CMD_START, 1 }, - { "bixby listening", PUI_ANI_CMD_START, -1 }, - { "bixby speaking", PUI_ANI_CMD_START, -1 }, - { "bixby_error", PUI_ANI_CMD_START, 1 }, - { "blinking", PUI_ANI_CMD_START, -1 }, - { "notification", PUI_ANI_CMD_START, -1 }, + { "processing", PUI_ANI_CMD_START, -1 }, + { "listening", PUI_ANI_CMD_START, -1 }, + { "speaking", PUI_ANI_CMD_START, -1 }, + { "streaming", PUI_ANI_CMD_START, -1 }, + { "emergency", PUI_ANI_CMD_START, -1 }, + { "easy_setup", PUI_ANI_CMD_START, -1 }, + { "sw_update_done", PUI_ANI_CMD_START, -1 }, + { "mic_off", PUI_ANI_CMD_START, -1 }, + { "time_out", PUI_ANI_CMD_START, -1 }, + { "normal", PUI_ANI_CMD_START, -1 } }; pui_ani_h ani_handles[sizeof(ani_collection) / sizeof(animation_t)]; -- 2.7.4