2 * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
4 * This program is licensed under the terms and conditions of the
5 * Apache License, version 2.0. The full text of the Apache License is at
6 * http://www.apache.org/licenses/LICENSE-2.0
10 * @brief Window Control API
11 * for privilege applications
18 #include "ico_syc_msg_cmd_def.h"
19 #include "ico_syc_msg.h"
20 #include "ico_syc_private.h"
21 #include "ico_syc_privilege.h"
23 /*============================================================================*/
25 /*============================================================================*/
26 #define _CMD_SHOW_WIN 0
27 #define _CMD_HIDE_WIN 1
28 #define _CMD_SHOW_LAYER 10
29 #define _CMD_HIDE_LAYER 11
30 #define _CMD_SET_LAYER_ATTR 12
32 /*============================================================================*/
33 /* define static function prototype */
34 /*============================================================================*/
35 static msg_t _create_win_msg(const char *appid, int surface,
36 const ico_syc_animation_t *animation,
38 static msg_t _create_win_move_msg(const char *appid, int surface,
39 const ico_syc_win_move_t *move,
40 const ico_syc_animation_t *animation);
41 static msg_t _create_active_win_msg(const char *appid, int surface);
42 static msg_t _create_change_layer_msg(const char *appid, int surface, int layer);
43 static msg_t _create_map_get_msg(const char *appid, int surface, const char *filepath);
44 static msg_t _create_map_thumb_msg(const char *appid, int surface, int framerate,
45 const char *filepath);
46 static msg_t _create_unmap_thumb_msg(const char *appid, int surface);
47 static msg_t _create_layer_msg(const char *appid, int layer, int type);
49 /*============================================================================*/
51 /*============================================================================*/
52 /*--------------------------------------------------------------------------*/
54 * @brief _create_win_msg
55 * Create the message to show/hide the application window.
57 * @param[in] appid application id
58 * @param[in] surface window's surface id
59 * @param[in] animation animation information
60 * @param[in] type type of command
61 * @return json generator
62 * @retval json generator success
65 /*--------------------------------------------------------------------------*/
67 _create_win_msg(const char *appid, int surface,
68 const ico_syc_animation_t *animation, int type)
70 JsonObject *obj = NULL;
71 JsonObject *argobj = NULL;
72 JsonGenerator *gen = NULL;
73 JsonNode *root = NULL;
76 /* create json object */
77 obj = json_object_new();
78 argobj = json_object_new();
79 if (obj == NULL || argobj == NULL) {
80 _ERR("json_object_new failed");
85 if (type == _CMD_SHOW_WIN) {
88 else if (type == _CMD_HIDE_WIN) {
93 json_object_set_int_member(obj, MSG_PRMKEY_CMD, cmd);
94 json_object_set_string_member(obj, MSG_PRMKEY_APPID, appid);
95 json_object_set_int_member(obj, MSG_PRMKEY_PID, getpid());
97 json_object_set_int_member(argobj, MSG_PRMKEY_SURFACE, surface);
98 /* set animation info */
99 if (animation != NULL) {
100 json_object_set_string_member(argobj, MSG_PRMKEY_ANIM_NAME,
102 json_object_set_int_member(argobj, MSG_PRMKEY_ANIM_TIME,
105 json_object_set_object_member(obj, MSG_PRMKEY_ARG, argobj);
107 /* create root object */
108 root = json_node_new(JSON_NODE_OBJECT);
109 json_node_take_object(root, obj);
111 /* create generator object */
112 gen = json_generator_new();
113 json_generator_set_root(gen, root);
118 /*--------------------------------------------------------------------------*/
120 * @brief _create_win_move_msg
121 * Create the message to move the application window.
123 * @param[in] appid application id
124 * @param[in] surface window's surface id
125 * @param[in] move move information (zone/position/size)
126 * @param[in] animation animation information
127 * @return json generator
128 * @retval json generator success
131 /*--------------------------------------------------------------------------*/
133 _create_win_move_msg(const char *appid, int surface,
134 const ico_syc_win_move_t *move,
135 const ico_syc_animation_t *animation)
137 JsonObject *obj = NULL;
138 JsonObject *argobj = NULL;
139 JsonGenerator *gen = NULL;
140 JsonNode *root = NULL;
142 /* create json object */
143 obj = json_object_new();
144 argobj = json_object_new();
145 if (obj == NULL || argobj == NULL) {
146 _ERR("json_object_new failed");
151 json_object_set_int_member(obj, MSG_PRMKEY_CMD, MSG_CMD_MOVE);
152 json_object_set_string_member(obj, MSG_PRMKEY_APPID, appid);
153 json_object_set_int_member(obj, MSG_PRMKEY_PID, getpid());
155 json_object_set_int_member(argobj, MSG_PRMKEY_SURFACE, surface);
157 if (move->zone != NULL) {
158 json_object_set_string_member(argobj, MSG_PRMKEY_ZONE, move->zone);
159 json_object_set_int_member(argobj, MSG_PRMKEY_LAYER, move->layer);
162 json_object_set_int_member(argobj, MSG_PRMKEY_POS_X, move->pos_x);
163 json_object_set_int_member(argobj, MSG_PRMKEY_POS_Y, move->pos_y);
164 json_object_set_int_member(argobj, MSG_PRMKEY_LAYER, -1);
166 json_object_set_int_member(argobj, MSG_PRMKEY_WIDTH, move->width);
167 json_object_set_int_member(argobj, MSG_PRMKEY_HEIGHT, move->height);
168 /* set animation info */
169 if (animation != NULL) {
170 json_object_set_string_member(argobj, MSG_PRMKEY_ANIM_NAME,
172 json_object_set_int_member(argobj, MSG_PRMKEY_ANIM_TIME,
175 json_object_set_object_member(obj, MSG_PRMKEY_ARG, argobj);
177 /* create root object */
178 root = json_node_new(JSON_NODE_OBJECT);
179 json_node_take_object(root, obj);
181 /* create generator object */
182 gen = json_generator_new();
183 json_generator_set_root(gen, root);
188 /*--------------------------------------------------------------------------*/
190 * @brief _create_active_win_msg
191 * Create the message to change active window.
193 * @param[in] appid application id
194 * @param[in] surface window's surface id
195 * @return json generator
196 * @retval json generator success
199 /*--------------------------------------------------------------------------*/
201 _create_active_win_msg(const char *appid, int surface)
203 JsonObject *obj = NULL;
204 JsonObject *argobj = NULL;
205 JsonGenerator *gen = NULL;
206 JsonNode *root = NULL;
208 /* create json object */
209 obj = json_object_new();
210 argobj = json_object_new();
211 if (obj == NULL || argobj == NULL) {
212 _ERR("json_object_new failed");
217 json_object_set_int_member(obj, MSG_PRMKEY_CMD, MSG_CMD_CHANGE_ACTIVE);
218 json_object_set_string_member(obj, MSG_PRMKEY_APPID, appid);
219 json_object_set_int_member(obj, MSG_PRMKEY_PID, getpid());
221 json_object_set_int_member(argobj, MSG_PRMKEY_SURFACE, surface);
222 json_object_set_object_member(obj, MSG_PRMKEY_ARG, argobj);
224 /* create root object */
225 root = json_node_new(JSON_NODE_OBJECT);
226 json_node_take_object(root, obj);
228 /* create generator object */
229 gen = json_generator_new();
230 json_generator_set_root(gen, root);
235 /*--------------------------------------------------------------------------*/
237 * @brief _create_change_layer_msg
238 * Create the message to change application window's layer.
240 * @param[in] appid application id
241 * @param[in] surface window's surface id
242 * @param[in] layer window's layer id
243 * @return json generator
244 * @retval json generator success
247 /*--------------------------------------------------------------------------*/
249 _create_change_layer_msg(const char *appid, int surface, int layer)
251 JsonObject *obj = NULL;
252 JsonObject *argobj = NULL;
253 JsonGenerator *gen = NULL;
254 JsonNode *root = NULL;
256 /* create json object */
257 obj = json_object_new();
258 argobj = json_object_new();
259 if (obj == NULL || argobj == NULL) {
260 _ERR("json_object_new failed");
265 json_object_set_int_member(obj, MSG_PRMKEY_CMD, MSG_CMD_CHANGE_LAYER);
266 json_object_set_string_member(obj, MSG_PRMKEY_APPID, appid);
267 json_object_set_int_member(obj, MSG_PRMKEY_PID, getpid());
269 json_object_set_int_member(argobj, MSG_PRMKEY_SURFACE, surface);
270 json_object_set_int_member(argobj, MSG_PRMKEY_LAYER, layer);
271 json_object_set_object_member(obj, MSG_PRMKEY_ARG, argobj);
273 /* create root object */
274 root = json_node_new(JSON_NODE_OBJECT);
275 json_node_take_object(root, obj);
277 /* create generator object */
278 gen = json_generator_new();
279 json_generator_set_root(gen, root);
284 /*--------------------------------------------------------------------------*/
286 * @brief _create_map_get_msg
287 * Create the message to map get.
289 * @param[in] appid application id
290 * @param[in] surface window's surface id
291 * @param[in] filepath pixel image file path
292 * @return json generator
293 * @retval json generator success
296 /*--------------------------------------------------------------------------*/
298 _create_map_get_msg(const char *appid, int surface, const char *filepath)
300 JsonObject *obj = NULL;
301 JsonObject *argobj = NULL;
302 JsonGenerator *gen = NULL;
303 JsonNode *root = NULL;
305 /* create json object */
306 obj = json_object_new();
307 argobj = json_object_new();
308 if (obj == NULL || argobj == NULL) {
309 _ERR("json_object_new failed");
314 json_object_set_int_member(obj, MSG_PRMKEY_CMD, MSG_CMD_MAP_GET);
315 json_object_set_string_member(obj, MSG_PRMKEY_APPID, appid);
316 json_object_set_int_member(obj, MSG_PRMKEY_PID, getpid());
318 json_object_set_int_member(argobj, MSG_PRMKEY_SURFACE, surface);
319 json_object_set_string_member(argobj, MSG_PRMKEY_ANIM_NAME, filepath);
320 json_object_set_object_member(obj, MSG_PRMKEY_ARG, argobj);
322 /* create root object */
323 root = json_node_new(JSON_NODE_OBJECT);
324 json_node_take_object(root, obj);
326 /* create generator object */
327 gen = json_generator_new();
328 json_generator_set_root(gen, root);
333 /*--------------------------------------------------------------------------*/
335 * @brief _create_map_thumb_msg
336 * Create the message to map thumbnail.
338 * @param[in] appid application id
339 * @param[in] surface window's surface id
340 * @param[in] framerate notify cycle [frames par sec]
341 * @param[in] filepath pixel image file path
342 * @return json generator
343 * @retval json generator success
346 /*--------------------------------------------------------------------------*/
348 _create_map_thumb_msg(const char *appid, int surface, int framerate, const char *filepath)
350 JsonObject *obj = NULL;
351 JsonObject *argobj = NULL;
352 JsonGenerator *gen = NULL;
353 JsonNode *root = NULL;
355 /* create json object */
356 obj = json_object_new();
357 argobj = json_object_new();
358 if (obj == NULL || argobj == NULL) {
359 _ERR("json_object_new failed");
364 json_object_set_int_member(obj, MSG_PRMKEY_CMD, MSG_CMD_MAP_THUMB);
365 json_object_set_string_member(obj, MSG_PRMKEY_APPID, appid);
366 json_object_set_int_member(obj, MSG_PRMKEY_PID, getpid());
368 json_object_set_int_member(argobj, MSG_PRMKEY_SURFACE, surface);
369 json_object_set_int_member(argobj, MSG_PRMKEY_RATE, framerate);
370 if ((filepath != NULL) && (*filepath != 0) && (*filepath != ' ')) {
371 json_object_set_string_member(argobj, MSG_PRMKEY_ANIM_NAME, filepath);
374 json_object_set_string_member(argobj, MSG_PRMKEY_ANIM_NAME, " ");
376 json_object_set_object_member(obj, MSG_PRMKEY_ARG, argobj);
378 /* create root object */
379 root = json_node_new(JSON_NODE_OBJECT);
380 json_node_take_object(root, obj);
382 /* create generator object */
383 gen = json_generator_new();
384 json_generator_set_root(gen, root);
389 /*--------------------------------------------------------------------------*/
391 * @brief _create_unmap_thumb_msg
392 * Create the message to unmap thumbnail.
394 * @param[in] appid application id
395 * @param[in] surface window's surface id
396 * @return json generator
397 * @retval json generator success
400 /*--------------------------------------------------------------------------*/
402 _create_unmap_thumb_msg(const char *appid, int surface)
404 JsonObject *obj = NULL;
405 JsonObject *argobj = NULL;
406 JsonGenerator *gen = NULL;
407 JsonNode *root = NULL;
409 /* create json object */
410 obj = json_object_new();
411 argobj = json_object_new();
412 if (obj == NULL || argobj == NULL) {
413 _ERR("json_object_new failed");
418 json_object_set_int_member(obj, MSG_PRMKEY_CMD, MSG_CMD_UNMAP_THUMB);
419 json_object_set_string_member(obj, MSG_PRMKEY_APPID, appid);
420 json_object_set_int_member(obj, MSG_PRMKEY_PID, getpid());
422 json_object_set_int_member(argobj, MSG_PRMKEY_SURFACE, surface);
423 json_object_set_object_member(obj, MSG_PRMKEY_ARG, argobj);
425 /* create root object */
426 root = json_node_new(JSON_NODE_OBJECT);
427 json_node_take_object(root, obj);
429 /* create generator object */
430 gen = json_generator_new();
431 json_generator_set_root(gen, root);
436 /*--------------------------------------------------------------------------*/
438 * @brief _create_layer_msg
439 * Create the message to show/hide layer or to set layer attribute.
441 * @param[in] appid application id
442 * @param[in] layer window's layer id
443 * @param[in] type type of command
444 * @return json generator
445 * @retval json generator success
448 /*--------------------------------------------------------------------------*/
450 _create_layer_msg(const char *appid, int layer, int type)
452 JsonObject *obj = NULL;
453 JsonObject *argobj = NULL;
454 JsonGenerator *gen = NULL;
455 JsonNode *root = NULL;
458 /* create json object */
459 obj = json_object_new();
460 argobj = json_object_new();
461 if (obj == NULL || argobj == NULL) {
462 _ERR("json_object_new failed");
467 if (type == _CMD_SHOW_LAYER) {
468 cmd = MSG_CMD_SHOW_LAYER;
470 else if (type == _CMD_HIDE_LAYER) {
471 cmd = MSG_CMD_HIDE_LAYER;
475 json_object_set_int_member(obj, MSG_PRMKEY_CMD, cmd);
476 json_object_set_string_member(obj, MSG_PRMKEY_APPID, appid);
477 json_object_set_int_member(obj, MSG_PRMKEY_PID, getpid());
479 json_object_set_int_member(argobj, MSG_PRMKEY_LAYER, layer);
480 json_object_set_object_member(obj, MSG_PRMKEY_ARG, argobj);
482 /* create root object */
483 root = json_node_new(JSON_NODE_OBJECT);
484 json_node_take_object(root, obj);
486 /* create generator object */
487 gen = json_generator_new();
488 json_generator_set_root(gen, root);
493 /*============================================================================*/
494 /* internal common function */
495 /*============================================================================*/
496 /*--------------------------------------------------------------------------*/
499 * @brief ico_syc_cb_win
500 * Execute callback function. (ICO_SYC_EV_WIN_ACTIVE
501 * ICO_SYC_EV_WIN_CREATE
502 * ICO_SYC_EV_WIN_DESTROY)
504 * @param[in] callback callback function
505 * @param[in] user_data passed data on called callback function
506 * @param[in] event event code
507 * @param[in] data message data
508 * @param[in] len length of data
511 /*--------------------------------------------------------------------------*/
513 ico_syc_cb_win(ico_syc_callback_t callback, void *user_data,
514 int event, const void *data, size_t len)
516 JsonParser *parser = NULL;
517 GError *error = NULL;
518 gboolean gbool = FALSE;
519 JsonNode *root = NULL;
520 JsonObject *obj = NULL;
521 JsonObject *argobj = NULL;
523 ico_syc_win_info_t *win_info = NULL;
526 win_info = calloc(1, sizeof(ico_syc_win_info_t));
527 if (win_info == NULL) {
528 _ERR("calloc failed");
533 parser = json_parser_new();
534 gbool = json_parser_load_from_data(parser, data, len, &error);
535 if (gbool == FALSE) {
536 g_object_unref(parser);
538 _ERR("json_parser_load_from_data failed");
543 root = json_parser_get_root(parser);
545 g_object_unref(parser);
547 _ERR("json_parser_get_root failed (root is NULL)");
551 /* get object from root */
552 obj = json_node_get_object(root);
554 if (json_object_has_member(obj, MSG_PRMKEY_ARG) == FALSE) {
555 g_object_unref(parser);
557 _ERR("invalid message" );
560 /* get object from obj */
561 argobj = json_object_get_object_member(obj, MSG_PRMKEY_ARG);
564 win_info->appid = strdup(ico_syc_get_str_member(obj, MSG_PRMKEY_APPID));
565 win_info->name = strdup(ico_syc_get_str_member(argobj, MSG_PRMKEY_WINNAME));
566 win_info->surface = ico_syc_get_int_member(argobj, MSG_PRMKEY_SURFACE);
569 callback(event, win_info, user_data);
572 g_object_unref(parser);
573 free(win_info->appid);
574 free(win_info->name);
580 /*--------------------------------------------------------------------------*/
583 * @brief ico_syc_cb_win_attr
584 * Execute callback function. (ICO_SYC_EV_WIN_ATTR_CHANGE)
586 * @param[in] callback callback function
587 * @param[in] user_data :assed data on called callback function
588 * @param[in] event event code
589 * @param[in] data message data
590 * @param[in] len length of data
593 /*--------------------------------------------------------------------------*/
595 ico_syc_cb_win_attr(ico_syc_callback_t callback, void *user_data,
596 int event, const void *data, size_t len)
598 JsonParser *parser = NULL;
599 GError *error = NULL;
600 gboolean gbool = FALSE;
601 JsonNode *root = NULL;
602 JsonObject *obj = NULL;
603 JsonObject *argobj = NULL;
605 ico_syc_win_attr_t *win_attr = NULL;
608 win_attr = calloc(1, sizeof(ico_syc_win_attr_t));
609 if (win_attr == NULL) {
610 _ERR("calloc failed");
615 parser = json_parser_new();
616 gbool = json_parser_load_from_data(parser, data, len, &error);
617 if (gbool == FALSE) {
618 g_object_unref(parser);
620 _ERR("json_parser_load_from_data failed");
625 root = json_parser_get_root(parser);
627 g_object_unref(parser);
629 _ERR("json_parser_get_root failed (root is NULL)");
633 /* get object from root */
634 obj = json_node_get_object(root);
636 if (json_object_has_member(obj, MSG_PRMKEY_ARG) == FALSE) {
637 g_object_unref(parser);
639 _ERR("invalid message" );
642 /* get object from obj */
643 argobj = json_object_get_object_member(obj, MSG_PRMKEY_ARG);
646 win_attr->appid = strdup(ico_syc_get_str_member(obj, MSG_PRMKEY_APPID));
647 win_attr->name = strdup(ico_syc_get_str_member(argobj, MSG_PRMKEY_WINNAME));
648 win_attr->zone = strdup(ico_syc_get_str_member(argobj, MSG_PRMKEY_ZONE));
649 win_attr->surface = ico_syc_get_int_member(argobj, MSG_PRMKEY_SURFACE);
650 win_attr->nodeid = ico_syc_get_int_member(argobj, MSG_PRMKEY_NODE);
651 win_attr->layer = ico_syc_get_int_member(argobj, MSG_PRMKEY_LAYER);
652 win_attr->pos_x = ico_syc_get_int_member(argobj, MSG_PRMKEY_POS_X);
653 win_attr->pos_y = ico_syc_get_int_member(argobj, MSG_PRMKEY_POS_Y);
654 win_attr->width = ico_syc_get_int_member(argobj, MSG_PRMKEY_WIDTH);
655 win_attr->height = ico_syc_get_int_member(argobj, MSG_PRMKEY_HEIGHT);
656 win_attr->raise = ico_syc_get_int_member(argobj, MSG_PRMKEY_RAISE);
657 win_attr->visible = ico_syc_get_int_member(argobj, MSG_PRMKEY_VISIBLE);
658 win_attr->active = ico_syc_get_int_member(argobj, MSG_PRMKEY_ACTIVE);
661 callback(event, win_attr, user_data);
664 g_object_unref(parser);
665 free(win_attr->appid);
666 free(win_attr->name);
667 free(win_attr->zone);
673 /*--------------------------------------------------------------------------*/
676 * @brief ico_syc_cb_thumb
677 * Execute callback function. (ICO_SYC_EV_THUMB_ERROR
678 * ICO_SYC_EV_THUMB_CHANGE
679 * ICO_SYC_EV_THUMB_UNMAP)
681 * @param[in] callback callback function
682 * @param[in] user_data passed data on called callback function
683 * @param[in] event event code
684 * @param[in] data message data
685 * @param[in] len length of data
688 /*--------------------------------------------------------------------------*/
690 ico_syc_cb_thumb(ico_syc_callback_t callback, void *user_data,
691 int event, const void *data, size_t len)
693 JsonParser *parser = NULL;
694 GError *error = NULL;
695 gboolean gbool = FALSE;
696 JsonNode *root = NULL;
697 JsonObject *obj = NULL;
698 JsonObject *argobj = NULL;
700 ico_syc_thumb_info_t *thumb_info = NULL;
703 thumb_info = calloc(1, sizeof(ico_syc_thumb_info_t));
704 if (thumb_info == NULL) {
705 _ERR("calloc failed");
710 parser = json_parser_new();
711 gbool = json_parser_load_from_data(parser, data, len, &error);
712 if (gbool == FALSE) {
713 g_object_unref(parser);
715 _ERR("json_parser_load_from_data failed");
720 root = json_parser_get_root(parser);
722 g_object_unref(parser);
724 _ERR("json_parser_get_root failed (root is NULL)");
728 /* get object from root */
729 obj = json_node_get_object(root);
731 if (json_object_has_member(obj, MSG_PRMKEY_ARG) == FALSE) {
732 g_object_unref(parser);
734 _ERR("invalid message" );
737 /* get object from obj */
738 argobj = json_object_get_object_member(obj, MSG_PRMKEY_ARG);
741 thumb_info->appid = strdup(ico_syc_get_str_member(obj, MSG_PRMKEY_APPID));
743 thumb_info->surface = ico_syc_get_int_member(argobj,
745 thumb_info->type = ico_syc_get_int_member(argobj, MSG_PRMKEY_ATTR);
746 thumb_info->width = ico_syc_get_int_member(argobj, MSG_PRMKEY_WIDTH);
747 thumb_info->height = ico_syc_get_int_member(argobj, MSG_PRMKEY_HEIGHT);
748 thumb_info->stride = ico_syc_get_int_member(argobj, MSG_PRMKEY_STRIDE);
749 thumb_info->format = ico_syc_get_int_member(argobj, MSG_PRMKEY_FORMAT);
752 callback(event, thumb_info, user_data);
755 g_object_unref(parser);
756 free(thumb_info->appid);
762 /*--------------------------------------------------------------------------*/
765 * @brief ico_syc_cb_layer
766 * Execute callback function. (ICO_SYC_EV_LAYER_ATTR_CHANGE)
768 * @param[in] callback callback function
769 * @param[in] user_data passed data on called callback function
770 * @param[in] event event code
771 * @param[in] data message data
772 * @param[in] len length of data
775 /*--------------------------------------------------------------------------*/
777 ico_syc_cb_layer(ico_syc_callback_t callback, void *user_data,
778 int event, const void *data, size_t len)
780 JsonParser *parser = NULL;
781 GError *error = NULL;
782 gboolean gbool = FALSE;
783 JsonNode *root = NULL;
784 JsonObject *obj = NULL;
785 JsonObject *argobj = NULL;
787 ico_syc_layer_attr_t *layer_attr = NULL;
790 layer_attr = calloc(1, sizeof(ico_syc_layer_attr_t));
791 if (layer_attr == NULL) {
792 _ERR("calloc failed");
797 parser = json_parser_new();
798 gbool = json_parser_load_from_data(parser, data, len, &error);
799 if (gbool == FALSE) {
800 g_object_unref(parser);
802 _ERR("json_parser_load_from_data failed");
807 root = json_parser_get_root(parser);
809 g_object_unref(parser);
811 _ERR("json_parser_get_root failed (root is NULL)");
815 /* get object from root */
816 obj = json_node_get_object(root);
818 if (json_object_has_member(obj, MSG_PRMKEY_ARG) == FALSE) {
819 g_object_unref(parser);
821 _ERR("invalid message" );
824 /* get object from obj */
825 argobj = json_object_get_object_member(obj, MSG_PRMKEY_ARG);
827 layer_attr->layer = ico_syc_get_int_member(argobj, MSG_PRMKEY_LAYER);
828 layer_attr->visible = ico_syc_get_int_member(argobj,
832 callback(event, layer_attr, user_data);
835 g_object_unref(parser);
841 /*============================================================================*/
842 /* public interface function */
843 /*============================================================================*/
844 /*--------------------------------------------------------------------------*/
846 * @brief ico_syc_show
847 * Show the application window with animation.
848 * If user sets argument surface "ICO_SYC_WIN_SHOW_ALL",
849 * show all of the application windows.
851 * @param[in] appid application id
852 * @param[in] surface window's surface id
853 * @param[in] animation animation information
856 * @retval not 0 error
858 /*--------------------------------------------------------------------------*/
860 ico_syc_show(const char *appid, int surface,
861 const ico_syc_animation_t *animation)
863 int ret = ICO_SYC_ERR_NONE;
868 _ERR("invalid parameter (appid is NULL)");
869 return ICO_SYC_ERR_INVALID_PARAM;
873 msg = _create_win_msg(appid, surface, animation, _CMD_SHOW_WIN);
875 ret = ico_syc_send_msg(msg);
876 /* free send message */
877 ico_syc_free_msg(msg);
882 /*--------------------------------------------------------------------------*/
884 * @brief ico_syc_hide
885 * Hide the application window with animation.
887 * @param[in] appid application id
888 * @param[in] surface window's surface id
889 * @param[in] animation animation information
892 * @retval not 0 error
894 /*--------------------------------------------------------------------------*/
896 ico_syc_hide(const char *appid, int surface,
897 const ico_syc_animation_t *animation)
899 int ret = ICO_SYC_ERR_NONE;
904 _ERR("invalid parameter (appid is NULL)");
905 return ICO_SYC_ERR_INVALID_PARAM;
909 msg = _create_win_msg(appid, surface, animation, _CMD_HIDE_WIN);
911 ret = ico_syc_send_msg(msg);
912 /* free send message */
913 ico_syc_free_msg(msg);
918 /*--------------------------------------------------------------------------*/
920 * @brief ico_syc_move
921 * Move the application window with animation.
923 * @param[in] appid application id
924 * @param[in] surface window's surface id
925 * @param[in] move move information (zone/position/size)
926 * @param[in] animation animation information
929 * @retval not 0 error
931 /*--------------------------------------------------------------------------*/
933 ico_syc_move(const char *appid, int surface,
934 const ico_syc_win_move_t *move,
935 const ico_syc_animation_t *animation)
937 int ret = ICO_SYC_ERR_NONE;
942 _ERR("invalid parameter (appid is NULL)");
943 return ICO_SYC_ERR_INVALID_PARAM;
947 msg = _create_win_move_msg(appid, surface, move, animation);
949 ret = ico_syc_send_msg(msg);
950 /* free send message */
951 ico_syc_free_msg(msg);
956 /*--------------------------------------------------------------------------*/
958 * @brief ico_syc_change_active
959 * Change the active window which receives the win-event notification
960 * from System Controller.
962 * @param[in] appid application id
963 * @param[in] surface window's surface id
966 * @retval not 0 error
968 /*--------------------------------------------------------------------------*/
970 ico_syc_change_active(const char *appid, int surface)
972 int ret = ICO_SYC_ERR_NONE;
977 _ERR("invalid parameter (appid is NULL)");
978 return ICO_SYC_ERR_INVALID_PARAM;
982 msg = _create_active_win_msg(appid, surface);
984 ret = ico_syc_send_msg(msg);
985 /* free send message */
986 ico_syc_free_msg(msg);
991 /*--------------------------------------------------------------------------*/
993 * @brief ico_syc_change_layer
994 * Change the window's layer.
996 * @param[in] appid application id
997 * @param[in] surface window's surface id
998 * @param[in] layer window's layer id
1001 * @retval not 0 error
1003 /*--------------------------------------------------------------------------*/
1005 ico_syc_change_layer(const char *appid, int surface, int layer)
1007 int ret = ICO_SYC_ERR_NONE;
1010 /* check argument */
1011 if (appid == NULL) {
1012 _ERR("invalid parameter (appid is NULL)");
1013 return ICO_SYC_ERR_INVALID_PARAM;
1017 msg = _create_change_layer_msg(appid, surface, layer);
1019 ret = ico_syc_send_msg(msg);
1020 /* free send message */
1021 ico_syc_free_msg(msg);
1026 /*--------------------------------------------------------------------------*/
1028 * @brief ico_syc_map_get
1029 * Get the surface thumbnail pixel image to the file.
1031 * @param[in] surface window's surface id
1032 * @param[in] filepath surface image pixel file path
1035 * @retval not 0 error
1037 /*--------------------------------------------------------------------------*/
1039 ico_syc_map_get(int surface, const char *filepath)
1041 int ret = ICO_SYC_ERR_NONE;
1046 appid = ico_syc_get_appid();
1049 msg = _create_map_get_msg(appid, surface, filepath);
1051 ret = ico_syc_send_msg(msg);
1052 /* free send message */
1053 ico_syc_free_msg(msg);
1058 /*--------------------------------------------------------------------------*/
1060 * @brief ico_syc_map_thumb
1061 * Prepare the thumbnail data
1063 * @param[in] surface window's surface id
1064 * @param[in] framerate notify cycle [ms]
1065 * @param[in] filepath pixel image file path
1068 * @retval not 0 error
1070 /*--------------------------------------------------------------------------*/
1072 ico_syc_map_thumb(int surface, int framerate, const char *filepath)
1074 int ret = ICO_SYC_ERR_NONE;
1079 appid = ico_syc_get_appid();
1082 msg = _create_map_thumb_msg(appid, surface, framerate, filepath);
1084 ret = ico_syc_send_msg(msg);
1085 /* free send message */
1086 ico_syc_free_msg(msg);
1091 /*--------------------------------------------------------------------------*/
1093 * @brief ico_syc_unmap_thumb
1094 * Unmap the thumbnail data.
1095 * User calls this API when receiving the notification that
1096 * terminated the application.
1098 * @param[in] surface window's surface id
1101 * @retval not 0 error
1103 /*--------------------------------------------------------------------------*/
1105 ico_syc_unmap_thumb(int surface)
1107 int ret = ICO_SYC_ERR_NONE;
1112 appid = ico_syc_get_appid();
1115 msg = _create_unmap_thumb_msg(appid, surface);
1117 ret = ico_syc_send_msg(msg);
1118 /* free send message */
1119 ico_syc_free_msg(msg);
1124 /*--------------------------------------------------------------------------*/
1126 * @brief ico_syc_show_layer
1129 * @param[in] layer window's layer id
1132 * @retval not 0 error
1134 /*--------------------------------------------------------------------------*/
1136 ico_syc_show_layer(int layer)
1138 int ret = ICO_SYC_ERR_NONE;
1143 appid = ico_syc_get_appid();
1146 msg = _create_layer_msg(appid, layer, _CMD_SHOW_LAYER);
1148 ret = ico_syc_send_msg(msg);
1149 /* free send message */
1150 ico_syc_free_msg(msg);
1155 /*--------------------------------------------------------------------------*/
1157 * @brief ico_syc_hide_layer
1160 * @param[in] layer window's layer id
1163 * @retval not 0 error
1165 /*--------------------------------------------------------------------------*/
1167 ico_syc_hide_layer(int layer)
1169 int ret = ICO_SYC_ERR_NONE;
1174 appid = ico_syc_get_appid();
1177 msg = _create_layer_msg(appid, layer, _CMD_HIDE_LAYER);
1179 ret = ico_syc_send_msg(msg);
1180 /* free send message */
1181 ico_syc_free_msg(msg);
1185 /* vim: set expandtab ts=4 sw=4: */