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 header file of Apprication Framework (Resource Control)
18 #include "ico_apf_private.h"
19 #include "ico_uxf_conf.h"
21 /* type user callback information */
22 typedef struct _resmgr_user_cb_info {
23 ico_apf_resource_notify_cb_t callbacks;
25 } resmgr_user_cb_info_t;
27 /* communication handle management table */
28 typedef struct _remgr_com_handle {
29 struct _remgr_com_handle *next;
30 ico_apf_com_handle_t *handle; /* communication handle */
31 int pid; /* client process id */
32 char appid[ICO_UXF_MAX_PROCESS_NAME+1];
33 /* client application id */
36 /* private variable */
37 static ico_apf_com_handle_t *appsctl_handle = NULL;
38 static ico_apf_com_handle_t *soundmgr_handle = NULL;
39 static resmgr_user_cb_info_t user_cb_info = {NULL, NULL};
40 static int resmgr_initialized = 0;
41 static remgr_com_handle_t *handles = NULL;
42 static remgr_com_handle_t *freehandles = NULL;
43 static Ico_Uxf_Sys_Config *sysconf = NULL;
44 static Ico_Uxf_Sys_Config *ifsysconf = NULL;
46 /*--------------------------------------------------------------------------*/
48 * @brief Callback at received from AppsController for client
50 * @param[in] handle communication handle
51 * @param[in] cmd command(event) code
52 * @param[in] res target resource
53 * @param[in] pid request client pid (server only)
54 * @param[in] appid request client application id (server only)
55 * @param[in] msg received message
56 * @param[in] user_data (unused)
59 /*--------------------------------------------------------------------------*/
61 ico_apf_resmgr_client_event(ico_apf_com_handle_t *handle, int cmd, int res,
62 int pid, char *appid, char *msg, void* user_data)
65 ico_apf_resource_notify_info_t info;
67 apfw_trace("ico_apf_resmgr_client_event: cmd=%d res=%d pid=%d(%s) msg=<%s>",
68 cmd, res, pid, appid, msg);
70 if (user_cb_info.callbacks != NULL) {
71 memset(&info, 0, sizeof(info));
73 /* get device and id */
74 for (i = 0; msg[i]; i++) {
75 if( msg[i] == ' ') break;
76 if (i < ICO_UXF_MAX_DEVICE_NAME) {
77 info.device[i] = msg[i];
81 info.id = strtol(&msg[i+1], (char **)0, 0);
83 info.state = (ico_apf_resource_state_e)cmd;
86 strncpy(info.appid, appid, ICO_UXF_MAX_PROCESS_NAME);
87 user_cb_info.callbacks(&info, user_cb_info.user_data);
91 /*--------------------------------------------------------------------------*/
93 * @brief Callback at received from Application for server
95 * @param[in] handle communication handle
96 * @param[in] cmd command(event) code
97 * @param[in] res target resource
98 * @param[in] pid request client pid (server only)
99 * @param[in] appid request client application id (server only)
100 * @param[in] msg received message
101 * @param[in] user_data (unused)
104 /*--------------------------------------------------------------------------*/
106 ico_apf_resmgr_server_event(ico_apf_com_handle_t *handle, int cmd, int res,
107 int pid, char *appid, char *msg, void* user_data)
110 ico_apf_resource_notify_info_t info;
111 remgr_com_handle_t *p;
112 remgr_com_handle_t *bp;
114 apfw_trace("ico_apf_resmgr_server_event: handle=%08x cmd=%d res=%d pid=%d(%s) msg=<%s>",
115 (int)handle, cmd, res, pid, appid, msg);
117 /* regist communication handle table */
120 if (p->handle == handle) break;
124 apfw_trace("ico_apf_resmgr_server_event: new client");
127 freehandles = p->next;
130 p = malloc(sizeof(remgr_com_handle_t));
133 memset(p, 0, sizeof(remgr_com_handle_t));
146 memset(&info, 0, sizeof(info));
148 /* get device and id */
149 for (i = 0; msg[i] ; i++) {
150 if (msg[i] == ' ') break;
151 if (i < ICO_UXF_MAX_DEVICE_NAME) {
152 info.device[i] = msg[i];
156 sscanf(&msg[i+1], "%d %d", &info.id, &info.bid);
158 info.state = (ico_apf_resource_state_e)cmd;
162 strncpy(info.appid, appid, ICO_UXF_MAX_PROCESS_NAME);
163 strcpy(p->appid, info.appid);
167 ico_apf_get_app_id(pid, info.appid);
168 strcpy(p->appid, info.appid);
171 if (info.state == ICO_APF_RESOURCE_STATE_CONNECTED) {
172 /* regist communication handle table */
175 if (p->handle == handle) break;
181 freehandles = p->next;
184 p = malloc(sizeof(remgr_com_handle_t));
187 memset(p, 0, sizeof(remgr_com_handle_t));
197 strncpy(p->appid, info.appid, ICO_UXF_MAX_PROCESS_NAME);
201 else if (info.state == ICO_APF_RESOURCE_STATE_DISCONNECTED) {
202 /* destory communiction handle table */
206 if (p->handle == handle) break;
217 p->next = freehandles;
221 if (user_cb_info.callbacks != NULL) {
222 user_cb_info.callbacks(&info, user_cb_info.user_data);
226 /*--------------------------------------------------------------------------*/
228 * @brief Initialize resouce manager component for client Application
230 * @param[in] uri server URI
231 * @return result status
232 * @retval ICO_APF_RESOURCE_E_NONE success
233 * @retval ICO_APF_RESOURCE_E_INIT_COM_FAILD can not create connection
234 * @retval ICO_APF_RESOURCE_E_INIT_COMMUNICATION initialize communication error
236 /*--------------------------------------------------------------------------*/
238 ico_apf_resource_init_client(const char *uri)
240 apfw_trace("ico_apf_resource_init_client: Enter(%s)", uri ? uri : "NULL");
242 if (resmgr_initialized & 1) {
243 apfw_warn("ico_apf_resource_init_client: Leave(already intialiezed)");
244 return ICO_APF_RESOURCE_E_NONE;
247 /* initialize connection for AppsController */
248 appsctl_handle = ico_apf_com_init_client(uri, ICO_APF_COM_TYPE_APPSCTL);
250 if (! appsctl_handle) {
251 apfw_error("ico_apf_resource_init_client: Leave(can not create connection)");
252 return ICO_APF_RESOURCE_E_INIT_COM_FAILD;
255 /* get system configuration */
256 ifsysconf = (Ico_Uxf_Sys_Config *)ico_uxf_ifGetSysConfig();
258 /* Another module already reads config file */
259 /* In this case, you don't release sysconf at finished this function. */
260 sysconf = (Ico_Uxf_Sys_Config *)ifsysconf;
263 /* never read a system config */
264 sysconf = (Ico_Uxf_Sys_Config *)ico_uxf_getSysConfig();
267 apfw_error("ico_apf_resource_init_client: Leave(can not read configuration files)");
268 return ICO_APF_RESOURCE_E_INIT_COM_FAILD;
271 if (ico_apf_com_addeventlistener(NULL, ico_apf_resmgr_client_event, NULL)
273 apfw_error("ico_apf_resource_init_client: Leave(can not set callback)");
274 return ICO_APF_RESOURCE_E_INIT_COM_FAILD;
277 /* chanage resmgr_client_intialized flag */
278 resmgr_initialized |= 1;
280 apfw_trace("ico_apf_resource_init_client: Leave(OK)");
281 return ICO_APF_RESOURCE_E_NONE;
284 /*--------------------------------------------------------------------------*/
286 * @brief Terminame resouce manager component
291 /*--------------------------------------------------------------------------*/
293 ico_apf_resource_term_client(void)
295 apfw_trace("ico_apf_resource_term_client: Enter");
297 /* unset callback functions */
298 ico_apf_resource_unset_event_cb();
300 /* terminate resourece server communication */
301 (void) ico_apf_com_term_client(appsctl_handle);
302 appsctl_handle = NULL;
304 /* close system configuration */
306 ico_uxf_closeSysConfig();
309 /* chanage resmgr_client_intialized flag */
310 resmgr_initialized &= ~1;
312 apfw_trace("ico_apf_resource_term_client: Leave");
315 /*--------------------------------------------------------------------------*/
317 * @brief Initialize resouce manager component for server Application
319 * @param[in] uri my URI
320 * @return result status
321 * @retval ICO_APF_RESOURCE_E_NONE success
322 * @retval ICO_APF_RESOURCE_E_INIT_COM_FAILD can not create connection
323 * @retval ICO_APF_RESOURCE_E_INIT_COMMUNICATION initialize communication error
325 /*--------------------------------------------------------------------------*/
327 ico_apf_resource_init_server(const char *uri)
329 apfw_trace("ico_apf_resource_init_server: Enter(%s)", uri ? uri : "NULL");
331 if (resmgr_initialized & 2) {
332 apfw_warn("ico_apf_resource_init_server: Leave(already intialiezed)");
333 return ICO_APF_RESOURCE_E_NONE;
336 /* initialize connection for AppsController */
337 appsctl_handle = ico_apf_com_init_server(uri, ICO_APF_COM_TYPE_APPSCTL);
338 if (! appsctl_handle) {
339 apfw_error("ico_apf_resource_init_server: Leave(can not create connection)");
340 return ICO_APF_RESOURCE_E_INIT_COM_FAILD;
343 /* get system configuration */
344 ifsysconf = (Ico_Uxf_Sys_Config *)ico_uxf_ifGetSysConfig();
346 /* Another module already reads config file */
347 /* In this case, you don't release sysconf at finished this function. */
348 sysconf = (Ico_Uxf_Sys_Config *)ifsysconf;
351 /* never read a system config */
352 sysconf = (Ico_Uxf_Sys_Config *)ico_uxf_getSysConfig();
355 apfw_error("ico_apf_resource_init_server: Leave(can not read configuration files)");
356 return ICO_APF_RESOURCE_E_INIT_COM_FAILD;
359 if (ico_apf_com_addeventlistener(NULL, ico_apf_resmgr_server_event, NULL)
361 apfw_error("ico_apf_resource_init_server: Leave(can not set callback)");
362 return ICO_APF_RESOURCE_E_INIT_COM_FAILD;
365 /* chanage resmgr_server_intialized flag */
366 resmgr_initialized = 2;
368 /* initialize connection for Multi Sound Manager */
369 soundmgr_handle = ico_apf_com_init_client(NULL, ICO_APF_COM_TYPE_SOUNDMGR);
370 if (! soundmgr_handle) {
371 apfw_error("ico_apf_resource_init_server: Leave(can not connect MSM)");
372 return ICO_APF_RESOURCE_E_INIT_COM_FAILD;
375 /* chanage resmgr_client_intialized flag */
376 resmgr_initialized |= 1;
378 apfw_trace("ico_apf_resource_init_server: Leave(OK)");
379 return ICO_APF_RESOURCE_E_NONE;
382 /*--------------------------------------------------------------------------*/
384 * @brief Terminame resouce manager component
389 /*--------------------------------------------------------------------------*/
391 ico_apf_resource_term_server(void)
393 apfw_trace("ico_apf_resource_term_server: Enter");
395 /* unset callback functions */
396 ico_apf_resource_unset_event_cb();
398 /* terminate resourece server communication */
399 (void) ico_apf_com_term_server(appsctl_handle);
400 appsctl_handle = NULL;
402 /* terminate Multi Sound Manager client communication */
403 (void) ico_apf_com_term_client(soundmgr_handle);
404 soundmgr_handle = NULL;
406 /* close system configuration */
408 ico_uxf_closeSysConfig();
411 /* chanage resmgr_client_intialized flag */
412 resmgr_initialized = 0;
414 apfw_trace("ico_apf_resource_term_server: Leave");
417 /*--------------------------------------------------------------------------*/
419 * @brief Set event callback function
421 * @param[in] callbacks callback functions
422 * @param[in] user_data passed data on called callback function
423 * @return result status
424 * @retval ICO_APF_RESOURCE_E_NONE success
425 * @retval ICO_APF_RESOURCE_E_INVAL callbacks is null
427 /*--------------------------------------------------------------------------*/
429 ico_apf_resource_set_event_cb(ico_apf_resource_notify_cb_t callbacks,
432 apfw_trace("ico_apf_resource_set_event_cb: Enter(0x%08x, 0x%08x)",
433 (int)callbacks, (int)user_data);
435 if (callbacks == NULL) {
436 apfw_error("ico_apf_resource_set_event_cb: Leave(callbacks is NULL)");
437 return ICO_APF_RESOURCE_E_INVAL;
439 user_cb_info.callbacks = callbacks;
440 user_cb_info.user_data = user_data;
442 apfw_trace("ico_apf_resource_set_event_cb: Leave(OK)");
443 return ICO_APF_RESOURCE_E_NONE;
446 /*--------------------------------------------------------------------------*/
448 * @brief Unset event callback function
451 * @return result status
452 * @retval ICO_APF_RESOURCE_E_NONE success(At present, always give back this)
454 /*--------------------------------------------------------------------------*/
456 ico_apf_resource_unset_event_cb(void)
458 apfw_trace("ico_apf_resource_unset_event_cb:");
460 user_cb_info.callbacks = NULL;
461 user_cb_info.user_data = NULL;
463 return ICO_APF_RESOURCE_E_NONE;
466 /*--------------------------------------------------------------------------*/
468 * @brief Get the rights of basic screen
470 * @param[in] disp_dev display device uri
471 * @param[in] src_id id of basic screen
472 * @return result status
473 * @retval ICO_APF_RESOURCE_E_NONE success
474 * @retval ICO_APF_RESOURCE_E_NOT_INITIALIZED not initialized
475 * @retval ICO_APF_RESOURCE_E_COMMUNICATION communication error
477 /*--------------------------------------------------------------------------*/
479 ico_apf_resource_get_screen_mode(const char* disp_dev, int scr_id)
481 char msg[ICO_APF_RESOURCE_MSG_LEN];
483 apfw_trace("ico_apf_resource_get_screen_mode: Enter(%s,%d)",
484 disp_dev ? disp_dev : "(NULL)", scr_id);
486 if ((! resmgr_initialized) || (! appsctl_handle)) {
487 apfw_error("ico_apf_resource_get_screen_mode: Leave(not initialized)");
488 return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
491 /* set send message parameter */
493 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", disp_dev, scr_id);
496 /* no display URI, default display */
497 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
498 sysconf->display[sysconf->misc.default_displayId].
499 zone[sysconf->misc.default_dispzoneId].name, scr_id);
501 if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_GET,
502 ICO_APF_RESID_BASIC_SCREEN, NULL, msg)
503 != ICO_APF_RESOURCE_E_NONE) {
504 apfw_error("ico_apf_resource_get_screen_mode: Leave(commnad send error)");
505 return ICO_APF_RESOURCE_E_COMMUNICATION;
508 apfw_trace("ico_apf_resource_get_screen_mode: Leave(OK)");
509 return ICO_APF_RESOURCE_E_NONE;
512 /*--------------------------------------------------------------------------*/
514 * @brief Release the rights of basic screen
516 * @param[in] disp_dev display device uri
517 * @param[in] src_id id of basic screen
518 * @return result status
519 * @retval ICO_APF_RESOURCE_E_NONE success
520 * @retval ICO_APF_RESOURCE_E_NOT_INITIALIZED not initialized
521 * @retval ICO_APF_RESOURCE_E_COMMUNICATION communication error
523 /*--------------------------------------------------------------------------*/
525 ico_apf_resource_release_screen_mode(const char* disp_dev, int scr_id)
527 char msg[ICO_APF_RESOURCE_MSG_LEN];
529 apfw_trace("ico_apf_resource_release_screen_mode: Enter(%s,%d)",
530 disp_dev ? disp_dev : "(NULL)", scr_id);
532 if ((! resmgr_initialized) || (! appsctl_handle)) {
533 apfw_error("ico_apf_resource_release_screen_mode: Leave(not initialized)");
534 return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
537 /* set send message parameter */
539 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", disp_dev, scr_id);
542 /* no display URI, default display */
543 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
544 sysconf->display[sysconf->misc.default_displayId].
545 zone[sysconf->misc.default_dispzoneId].name, scr_id);
547 if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_RELEASE,
548 ICO_APF_RESID_BASIC_SCREEN, NULL, msg)
549 != ICO_APF_RESOURCE_E_NONE) {
550 apfw_warn("ico_apf_resource_release_screen_mode: Leave(commnad send error)");
551 return ICO_APF_RESOURCE_E_COMMUNICATION;
554 apfw_trace("ico_apf_resource_release_screen_mode: Leave(OK)");
555 return ICO_APF_RESOURCE_E_NONE;
558 /*--------------------------------------------------------------------------*/
560 * @brief Reply the rights of basic screen
562 * @param[in] disp_dev display device uri
563 * @param[in] src_id id of basic screen
564 * @param[in] ok OK(1) or NG(0)
565 * @return result status
566 * @retval ICO_APF_RESOURCE_E_NONE success
567 * @retval ICO_APF_RESOURCE_E_NOT_INITIALIZED not initialized
568 * @retval ICO_APF_RESOURCE_E_COMMUNICATION communication error
570 /*--------------------------------------------------------------------------*/
572 ico_apf_resource_reply_screen_mode(const char* disp_dev, int scr_id, const int ok)
574 char msg[ICO_APF_RESOURCE_MSG_LEN];
576 apfw_trace("ico_apf_resource_reply_screen_mode: Enter(%s,%d,%d)",
577 disp_dev ? disp_dev : "(NULL)", scr_id, ok);
579 if ((! resmgr_initialized) || (! appsctl_handle)) {
580 apfw_error("ico_apf_resource_reply_screen_mode: Leave(not initialized)");
581 return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
584 /* set send message parameter */
586 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", disp_dev, scr_id);
589 /* no display URI, default display */
590 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
591 sysconf->display[sysconf->misc.default_displayId].
592 zone[sysconf->misc.default_dispzoneId].name, scr_id);
594 if (ico_apf_com_send(appsctl_handle,
595 (ok != 0) ? ICO_APF_RESOURCE_REPLY_OK
596 : ICO_APF_RESOURCE_REPLY_NG,
597 ICO_APF_RESID_BASIC_SCREEN, NULL, msg)
598 != ICO_APF_RESOURCE_E_NONE) {
599 apfw_warn("ico_apf_resource_reply_screen_mode: Leave(commnad send error)");
600 return ICO_APF_RESOURCE_E_COMMUNICATION;
603 apfw_trace("ico_apf_resource_reply_screen_mode: Leave(OK)");
604 return ICO_APF_RESOURCE_E_NONE;
607 /*--------------------------------------------------------------------------*/
609 * @brief Release the rights of interrupt screen
611 * @param[in] disp_dev display device uri
612 * @param[in] src_id id of basic screen
613 * @param[in] int_src_id id of interrupt screen
614 * @return result status
615 * @retval ICO_APF_RESOURCE_E_NONE success
616 * @retval ICO_APF_RESOURCE_E_NOT_INITIALIZED not initialized
617 * @retval ICO_APF_RESOURCE_E_COMMUNICATION communication error
619 /*--------------------------------------------------------------------------*/
621 ico_apf_resource_get_int_screen_mode(const char* disp_dev,
622 int scr_id, int int_scr_id)
624 char msg[ICO_APF_RESOURCE_MSG_LEN];
626 apfw_trace("ico_apf_resource_get_int_screen_mode: Enter(%s,%d,%d)",
627 disp_dev ? disp_dev : "(NULL)", scr_id, int_scr_id);
629 if ((! resmgr_initialized) || (! appsctl_handle)) {
630 apfw_error("ico_apf_resource_get_int_screen_mode: Leave(not initialized)");
631 return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
634 /* set send message parameter */
636 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d %d",
637 disp_dev, int_scr_id, scr_id);
640 /* no display URI, default display */
641 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d %d",
642 sysconf->display[sysconf->misc.default_displayId].
643 zone[sysconf->misc.default_dispzoneId].name,
646 if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_GET,
647 ICO_APF_RESID_INT_SCREEN, NULL, msg)
648 != ICO_APF_RESOURCE_E_NONE) {
649 apfw_error("ico_apf_resource_get_int_screen_mode: Leave(commnad send error)");
650 return ICO_APF_RESOURCE_E_COMMUNICATION;
653 apfw_trace("ico_apf_resource_get_int_screen_mode: Leave(OK)");
654 return ICO_APF_RESOURCE_E_NONE;
657 /*--------------------------------------------------------------------------*/
659 * @brief Release the rights of interrupt screen on basic screen
661 * @param[in] disp_dev display device uri
662 * @param[in] src_id id of basic screen
663 * @param[in] int_scr_id id of interrupt screen
664 * @return result status
665 * @retval ICO_APF_RESOURCE_E_NONE success
666 * @retval ICO_APF_RESOURCE_E_NOT_INITIALIZED not initialized
667 * @retval ICO_APF_RESOURCE_E_COMMUNICATION communication error
669 /*--------------------------------------------------------------------------*/
671 ico_apf_resource_release_int_screen_mode(const char* disp_dev,
672 int scr_id, int int_scr_id)
674 char msg[ICO_APF_RESOURCE_MSG_LEN];
676 apfw_trace("ico_apf_resource_release_int_screen_mode: Enter(%s,%d,%d)",
677 disp_dev ? disp_dev : "(NULL)", scr_id, int_scr_id);
679 if ((! resmgr_initialized) || (! appsctl_handle)) {
680 apfw_error("ico_apf_resource_release_int_screen_mode: Leave(not initialized)");
681 return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
684 /* set send message parameter */
686 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d %d",
687 disp_dev, int_scr_id, scr_id);
690 /* no display URI, default display */
691 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d %d",
692 sysconf->display[sysconf->misc.default_displayId].
693 zone[sysconf->misc.default_dispzoneId].name,
696 if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_RELEASE,
697 ICO_APF_RESID_INT_SCREEN, NULL, msg)
698 != ICO_APF_RESOURCE_E_NONE) {
699 apfw_warn("ico_apf_resource_release_int_screen_mode: Leave(commnad send error)");
700 return ICO_APF_RESOURCE_E_COMMUNICATION;
703 apfw_trace("ico_apf_resource_release_int_screen_mode: Leave(OK)");
704 return ICO_APF_RESOURCE_E_NONE;
707 /*--------------------------------------------------------------------------*/
709 * @brief Reply the rights of interrupt screen on basic screen
711 * @param[in] disp_dev display device uri
712 * @param[in] src_id id of basic screen
713 * @param[in] int_scr_id id of interrupt screen
714 * @param[in] ok OK(1) or NG(0)
715 * @return result status
716 * @retval ICO_APF_RESOURCE_E_NONE success
717 * @retval ICO_APF_RESOURCE_E_NOT_INITIALIZED not initialized
718 * @retval ICO_APF_RESOURCE_E_COMMUNICATION communication error
720 /*--------------------------------------------------------------------------*/
722 ico_apf_resource_reply_int_screen_mode(const char* disp_dev,
723 int scr_id, int int_scr_id, const int ok)
725 char msg[ICO_APF_RESOURCE_MSG_LEN];
727 apfw_trace("ico_apf_resource_reply_int_screen_mode: Enter(%s,%d,%d,%d)",
728 disp_dev ? disp_dev : "(NULL)", scr_id, int_scr_id, ok);
730 if ((! resmgr_initialized) || (! appsctl_handle)) {
731 apfw_error("ico_apf_resource_reply_int_screen_mode: Leave(not initialized)");
732 return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
735 /* set send message parameter */
737 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d %d",
738 disp_dev, int_scr_id, scr_id);
741 /* no display URI, default display */
742 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d %d",
743 sysconf->display[sysconf->misc.default_displayId].
744 zone[sysconf->misc.default_dispzoneId].name,
747 if (ico_apf_com_send(appsctl_handle,
748 (ok != 0) ? ICO_APF_RESOURCE_REPLY_OK
749 : ICO_APF_RESOURCE_REPLY_NG,
750 ICO_APF_RESID_INT_SCREEN, NULL, msg)
751 != ICO_APF_RESOURCE_E_NONE) {
752 apfw_warn("ico_apf_resource_reply_int_screen_mode: Leave(commnad send error)");
753 return ICO_APF_RESOURCE_E_COMMUNICATION;
756 apfw_trace("ico_apf_resource_reply_int_screen_mode: Leave(OK)");
757 return ICO_APF_RESOURCE_E_NONE;
760 /*--------------------------------------------------------------------------*/
762 * @brief Get the rights of interrupt screen on display
764 * @param[in] disp_dev display device uri
765 * @param[in] int_scr_id id of interrupt screen
766 * @return result status
767 * @retval ICO_APF_RESOURCE_E_NONE success
768 * @retval ICO_APF_RESOURCE_E_NOT_INITIALIZED not initialized
769 * @retval ICO_APF_RESOURCE_E_COMMUNICATION communication error
771 /*--------------------------------------------------------------------------*/
773 ico_apf_resource_get_int_screen_mode_disp(const char* disp_dev, int int_scr_id)
775 char msg[ICO_APF_RESOURCE_MSG_LEN];
777 apfw_trace("ico_apf_resource_get_int_screen_mode_disp: Enter(%s,%d)",
778 disp_dev ? disp_dev : "(NULL)", int_scr_id);
780 if ((! resmgr_initialized) || (! appsctl_handle)) {
781 apfw_error("ico_apf_resource_get_int_screen_mode_disp: Leave(not initialized)");
782 return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
785 /* set send message parameter */
787 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", disp_dev, int_scr_id);
790 /* no display URI, default display */
791 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
792 sysconf->display[sysconf->misc.default_displayId].
793 zone[sysconf->misc.default_dispzoneId].name, int_scr_id);
795 if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_GET,
796 ICO_APF_RESID_ON_SCREEN, NULL, msg)
797 != ICO_APF_RESOURCE_E_NONE) {
798 apfw_error("ico_apf_resource_get_int_screen_mode_disp: Leave(commnad send error)");
799 return ICO_APF_RESOURCE_E_COMMUNICATION;
802 apfw_trace("ico_apf_resource_get_int_screen_mode_disp: Leave(OK)");
803 return ICO_APF_RESOURCE_E_NONE;
806 /*--------------------------------------------------------------------------*/
808 * @brief Release the rights of interrupt screen on display
810 * @param[in] disp_dev display device uri
811 * @param[in] int_scr_id id of interrupt screen
812 * @return result status
813 * @retval ICO_APF_RESOURCE_E_NONE success
814 * @retval ICO_APF_RESOURCE_E_NOT_INITIALIZED not initialized
815 * @retval ICO_APF_RESOURCE_E_COMMUNICATION communication error
817 /*--------------------------------------------------------------------------*/
819 ico_apf_resource_release_int_screen_mode_disp(const char* disp_dev,
822 char msg[ICO_APF_RESOURCE_MSG_LEN];
824 apfw_trace("ico_apf_resource_release_int_screen_mode_disp: Enter(%s,%d)",
825 disp_dev ? disp_dev : "(NULL)", int_scr_id);
827 if ((! resmgr_initialized) || (! appsctl_handle)) {
828 apfw_error("ico_apf_resource_release_int_screen_mode_disp: Leave(not initialized)");
829 return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
832 /* set send message parameter */
834 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", disp_dev, int_scr_id);
837 /* no display URI, default display */
838 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
839 sysconf->display[sysconf->misc.default_displayId].
840 zone[sysconf->misc.default_dispzoneId].name, int_scr_id);
842 if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_RELEASE,
843 ICO_APF_RESID_ON_SCREEN, NULL, msg)
844 != ICO_APF_RESOURCE_E_NONE) {
845 apfw_warn("ico_apf_resource_release_int_screen_mode_disp: Leave(commnad send error)");
846 return ICO_APF_RESOURCE_E_COMMUNICATION;
849 apfw_trace("ico_apf_resource_release_int_screen_mode_disp: Leave(OK)");
850 return ICO_APF_RESOURCE_E_NONE;
853 /*--------------------------------------------------------------------------*/
855 * @brief Reply the rights of interrupt screen on display
857 * @param[in] disp_dev display device uri
858 * @param[in] int_scr_id id of interrupt screen
859 * @param[in] ok OK(1) or NG(0)
860 * @return result status
861 * @retval ICO_APF_RESOURCE_E_NONE success
862 * @retval ICO_APF_RESOURCE_E_NOT_INITIALIZED not initialized
863 * @retval ICO_APF_RESOURCE_E_COMMUNICATION communication error
865 /*--------------------------------------------------------------------------*/
867 ico_apf_resource_reply_int_screen_mode_disp(const char* disp_dev,
868 int int_scr_id, const int ok)
870 char msg[ICO_APF_RESOURCE_MSG_LEN];
872 apfw_trace("ico_apf_resource_reply_int_screen_mode_disp: Enter(%s,%d,%d)",
873 disp_dev ? disp_dev : "(NULL)", int_scr_id, ok);
875 if ((! resmgr_initialized) || (! appsctl_handle)) {
876 apfw_error("ico_apf_resource_reply_int_screen_mode_disp: Leave(not initialized)");
877 return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
880 /* set send message parameter */
882 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", disp_dev, int_scr_id);
885 /* no display URI, default display */
886 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
887 sysconf->display[sysconf->misc.default_displayId].
888 zone[sysconf->misc.default_dispzoneId].name, int_scr_id);
890 if (ico_apf_com_send(appsctl_handle,
891 (ok != 0) ? ICO_APF_RESOURCE_REPLY_OK
892 : ICO_APF_RESOURCE_REPLY_NG,
893 ICO_APF_RESID_ON_SCREEN, NULL, msg)
894 != ICO_APF_RESOURCE_E_NONE) {
895 apfw_warn("ico_apf_resource_reply_int_screen_mode_disp: Leave(commnad send error)");
896 return ICO_APF_RESOURCE_E_COMMUNICATION;
899 apfw_trace("ico_apf_resource_reply_int_screen_mode_disp: Leave(OK)");
900 return ICO_APF_RESOURCE_E_NONE;
903 /*--------------------------------------------------------------------------*/
905 * @brief Get the rights of basic sound on zone
907 * @param[in] zone sound device uri
908 * @param[in] snd_id id of basic sound
909 * @param[in] adjust adjust acction
910 * @return result status
911 * @retval ICO_APF_RESOURCE_E_NONE success
912 * @retval ICO_APF_RESOURCE_E_NOT_INITIALIZED not initialized
913 * @retval ICO_APF_RESOURCE_E_COMMUNICATION communication error
915 /*--------------------------------------------------------------------------*/
917 ico_apf_resource_get_sound_mode(const char* zone, int snd_id, int adjust)
919 char msg[ICO_APF_RESOURCE_MSG_LEN];
921 apfw_trace("ico_apf_resource_get_sound_mode: Enter(%s,%d,%d)",
922 zone ? zone : "(NULL)", snd_id, adjust);
924 if ((! resmgr_initialized) || (! appsctl_handle)) {
925 apfw_error("ico_apf_resource_get_sound_mode: Leave(not initialized)");
926 return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
929 /* set send message parameter */
931 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d %d", zone, snd_id, adjust);
934 /* no zone, default zone */
935 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d %d",
936 sysconf->sound[sysconf->misc.default_soundId].
937 zone[sysconf->misc.default_soundzoneId].name,
940 if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_GET,
941 ICO_APF_RESID_BASIC_SOUND, NULL, msg)
942 != ICO_APF_RESOURCE_E_NONE) {
943 apfw_error("ico_apf_resource_get_sound_mode: Leave(commnad send error)");
944 return ICO_APF_RESOURCE_E_COMMUNICATION;
947 apfw_trace("ico_apf_resource_get_sound_mode: Leave(OK)");
948 return ICO_APF_RESOURCE_E_NONE;
951 /*--------------------------------------------------------------------------*/
953 * @brief Release the rights of basic sound on zone
955 * @param[in] zone sound device uri
956 * @param[in] snd_id id of basic sound
957 * @return result status
958 * @retval ICO_APF_RESOURCE_E_NONE success
959 * @retval ICO_APF_RESOURCE_E_NOT_INITIALIZED not initialized
960 * @retval ICO_APF_RESOURCE_E_COMMUNICATION communication error
962 /*--------------------------------------------------------------------------*/
964 ico_apf_resource_release_sound_mode(const char* zone, int snd_id)
966 char msg[ICO_APF_RESOURCE_MSG_LEN];
968 apfw_trace("ico_apf_resource_release_sound_mode: Enter(%s,%d)",
969 zone ? zone : "(NULL)", snd_id);
971 if ((! resmgr_initialized) || (! appsctl_handle)) {
972 apfw_error("ico_apf_resource_release_sound_mode: Leave(not initialized)");
973 return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
976 /* set send message parameter */
978 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", zone, snd_id);
981 /* no zone, default zone */
982 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
983 sysconf->sound[sysconf->misc.default_soundId].
984 zone[sysconf->misc.default_soundzoneId].name, snd_id);
986 if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_RELEASE,
987 ICO_APF_RESID_BASIC_SOUND, NULL, msg)
988 != ICO_APF_RESOURCE_E_NONE) {
989 apfw_warn("ico_apf_resource_release_sound_mode: Leave(commnad send error)");
990 return ICO_APF_RESOURCE_E_COMMUNICATION;
993 apfw_trace("ico_apf_resource_release_sound_mode: Leave(OK)");
994 return ICO_APF_RESOURCE_E_NONE;
997 /*--------------------------------------------------------------------------*/
999 * @brief Reply the rights of basic sound on zone
1001 * @param[in] zone sound device uri
1002 * @param[in] snd_id id of basic sound
1003 * @param[in] ok OK(1) or NG(0)
1004 * @return result status
1005 * @retval ICO_APF_RESOURCE_E_NONE success
1006 * @retval ICO_APF_RESOURCE_E_NOT_INITIALIZED not initialized
1007 * @retval ICO_APF_RESOURCE_E_COMMUNICATION communication error
1009 /*--------------------------------------------------------------------------*/
1011 ico_apf_resource_reply_sound_mode(const char* zone, int snd_id, const int ok)
1013 char msg[ICO_APF_RESOURCE_MSG_LEN];
1015 apfw_trace("ico_apf_resource_reply_sound_mode: Enter(%s,%d,%d)",
1016 zone ? zone : "(NULL)", snd_id, ok);
1018 if ((! resmgr_initialized) || (! appsctl_handle)) {
1019 apfw_error("ico_apf_resource_reply_sound_mode: Leave(not initialized)");
1020 return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
1023 /* set send message parameter */
1025 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", zone, snd_id);
1028 /* no zone, default zone */
1029 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
1030 sysconf->sound[sysconf->misc.default_soundId].
1031 zone[sysconf->misc.default_soundzoneId].name, snd_id);
1033 if (ico_apf_com_send(appsctl_handle,
1034 (ok != 0) ? ICO_APF_RESOURCE_REPLY_OK
1035 : ICO_APF_RESOURCE_REPLY_NG,
1036 ICO_APF_RESID_BASIC_SOUND, NULL, msg)
1037 != ICO_APF_RESOURCE_E_NONE) {
1038 apfw_warn("ico_apf_resource_reply_sound_mode: Leave(commnad send error)");
1039 return ICO_APF_RESOURCE_E_COMMUNICATION;
1042 apfw_trace("ico_apf_resource_reply_sound_mode: Leave(OK)");
1043 return ICO_APF_RESOURCE_E_NONE;
1046 /*--------------------------------------------------------------------------*/
1048 * @brief Get the rights of interrupt sound on zone
1050 * @param[in] zone sound device uri
1051 * @param[in] int_snd_id id of basic sound
1052 * @param[in] adjust adjust action
1053 * @return result status
1054 * @retval ICO_APF_RESOURCE_E_NONE success
1055 * @retval ICO_APF_RESOURCE_E_NOT_INITIALIZED not initialized
1056 * @retval ICO_APF_RESOURCE_E_COMMUNICATION communication error
1058 /*--------------------------------------------------------------------------*/
1060 ico_apf_resource_get_int_sound_mode(const char* zone,
1061 int int_snd_id, int adjust)
1063 char msg[ICO_APF_RESOURCE_MSG_LEN];
1065 apfw_trace("ico_apf_resource_get_int_sound_mode: Enter(%s,%d,%d)",
1066 zone ? zone : "(NULL)", int_snd_id, adjust);
1068 if ((! resmgr_initialized) || (! appsctl_handle)) {
1069 apfw_error("ico_apf_resource_get_int_sound_mode: Leave(not initialized)");
1070 return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
1073 /* set send message parameter */
1075 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d %d", zone, int_snd_id, adjust);
1078 /* no zone, default zone */
1079 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d %d",
1080 sysconf->sound[sysconf->misc.default_soundId].
1081 zone[sysconf->misc.default_soundzoneId].name,
1082 int_snd_id, adjust);
1084 if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_GET,
1085 ICO_APF_RESID_INT_SOUND, NULL, msg)
1086 != ICO_APF_RESOURCE_E_NONE) {
1087 apfw_error("ico_apf_resource_get_int_sound_mode: Leave(commnad send error)");
1088 return ICO_APF_RESOURCE_E_COMMUNICATION;
1091 apfw_trace("ico_apf_resource_get_int_sound_mode: Leave(OK)");
1092 return ICO_APF_RESOURCE_E_NONE;
1095 /*--------------------------------------------------------------------------*/
1097 * @brief Release the rights of interrupt sound on zone
1099 * @param[in] zone sound device uri
1100 * @param[in] int_snd_id id of interrupt sound
1101 * @return result status
1102 * @retval ICO_APF_RESOURCE_E_NONE success
1103 * @retval ICO_APF_RESOURCE_E_NOT_INITIALIZED not initialized
1104 * @retval ICO_APF_RESOURCE_E_COMMUNICATION communication error
1106 /*--------------------------------------------------------------------------*/
1108 ico_apf_resource_release_int_sound_mode(const char* zone, int int_snd_id)
1110 char msg[ICO_APF_RESOURCE_MSG_LEN];
1112 apfw_trace("ico_apf_resource_release_int_sound_mode: Enter(%s,%d)",
1113 zone ? zone : "(NULL)", int_snd_id);
1115 if ((! resmgr_initialized) || (! appsctl_handle)) {
1116 apfw_error("ico_apf_resource_release_int_sound_mode: Leave(not initialized)");
1117 return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
1120 /* set send message parameter */
1122 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", zone, int_snd_id);
1125 /* no zone, default zone */
1126 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
1127 sysconf->sound[sysconf->misc.default_soundId].
1128 zone[sysconf->misc.default_soundzoneId].name, int_snd_id);
1130 if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_RELEASE,
1131 ICO_APF_RESID_INT_SOUND, NULL, msg)
1132 != ICO_APF_RESOURCE_E_NONE) {
1133 apfw_warn("ico_apf_resource_release_int_sound_mode: Leave(commnad send error)");
1134 return ICO_APF_RESOURCE_E_COMMUNICATION;
1137 apfw_trace("ico_apf_resource_release_int_sound_mode: Leave(OK)");
1138 return ICO_APF_RESOURCE_E_NONE;
1141 /*--------------------------------------------------------------------------*/
1143 * @brief Reply the rights of interrupt sound on zone
1145 * @param[in] zone sound device uri
1146 * @param[in] int_snd_id id of interrupt sound
1147 * @param[in] ok OK(1) or NG(0)
1148 * @return result status
1149 * @retval ICO_APF_RESOURCE_E_NONE success
1150 * @retval ICO_APF_RESOURCE_E_NOT_INITIALIZED not initialized
1151 * @retval ICO_APF_RESOURCE_E_COMMUNICATION communication error
1153 /*--------------------------------------------------------------------------*/
1155 ico_apf_resource_reply_int_sound_mode(const char* zone, int int_snd_id, const int ok)
1157 char msg[ICO_APF_RESOURCE_MSG_LEN];
1159 apfw_trace("ico_apf_resource_reply_int_sound_mode: Enter(%s,%d,%d)",
1160 zone ? zone : "(NULL)", int_snd_id, ok);
1162 if ((! resmgr_initialized) || (! appsctl_handle)) {
1163 apfw_error("ico_apf_resource_reply_int_sound_mode: Leave(not initialized)");
1164 return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
1167 /* set send message parameter */
1169 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", zone, int_snd_id);
1172 /* no zone, default zone */
1173 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
1174 sysconf->sound[sysconf->misc.default_soundId].
1175 zone[sysconf->misc.default_soundzoneId].name, int_snd_id);
1177 if (ico_apf_com_send(appsctl_handle,
1178 (ok != 0) ? ICO_APF_RESOURCE_REPLY_OK
1179 : ICO_APF_RESOURCE_REPLY_NG,
1180 ICO_APF_RESID_INT_SOUND, NULL, msg)
1181 != ICO_APF_RESOURCE_E_NONE) {
1182 apfw_warn("ico_apf_resource_reply_int_sound_mode: Leave(commnad send error)");
1183 return ICO_APF_RESOURCE_E_COMMUNICATION;
1186 apfw_trace("ico_apf_resource_reply_int_sound_mode: Leave(OK)");
1187 return ICO_APF_RESOURCE_E_NONE;
1190 /*--------------------------------------------------------------------------*/
1192 * @brief Add the input event notification from input device
1194 * @param[in] input_dev input device uri
1195 * @param[in] events notify input events
1196 * @return result status
1197 * @retval ICO_APF_RESOURCE_E_NONE success
1198 * @retval ICO_APF_RESOURCE_E_NOT_INITIALIZED not initialized
1199 * @retval ICO_APF_RESOURCE_E_COMMUNICATION communication error
1201 /*--------------------------------------------------------------------------*/
1203 ico_apf_resource_add_input_event(const char* input_dev, int events)
1205 char msg[ICO_APF_RESOURCE_MSG_LEN];
1207 apfw_trace("ico_apf_resource_add_input_event: Enter(%s,%d)",
1208 input_dev ? input_dev : "(NULL)", events);
1210 if ((! resmgr_initialized) || (! appsctl_handle)) {
1211 apfw_error("ico_apf_resource_add_input_event: Leave(not initialized)");
1212 return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
1215 /* set send message parameter */
1217 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", input_dev, events);
1220 /* no input device, default device */
1221 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
1222 sysconf->inputdev[sysconf->misc.default_inputdevId].name, events);
1224 if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_ADD,
1225 ICO_APF_RESID_INPUT_DEV, NULL, msg)
1226 != ICO_APF_RESOURCE_E_NONE) {
1227 apfw_error("ico_apf_resource_add_input_event: Leave(commnad send error)");
1228 return ICO_APF_RESOURCE_E_COMMUNICATION;
1231 apfw_trace("ico_apf_resource_add_input_event: Leave(OK)");
1232 return ICO_APF_RESOURCE_E_NONE;
1235 /*--------------------------------------------------------------------------*/
1237 * @brief Change the input event notification from input device
1239 * @param[in] input_dev input device uri
1240 * @param[in] events notify input events
1241 * @return result status
1242 * @retval ICO_APF_RESOURCE_E_NONE success
1243 * @retval ICO_APF_RESOURCE_E_NOT_INITIALIZED not initialized
1244 * @retval ICO_APF_RESOURCE_E_COMMUNICATION communication error
1246 /*--------------------------------------------------------------------------*/
1248 ico_apf_resource_change_input_event(const char* input_dev, int events)
1250 char msg[ICO_APF_RESOURCE_MSG_LEN];
1252 apfw_trace("ico_apf_resource_change_input_event: Enter(%s,%d)",
1253 input_dev ? input_dev : "(NULL)", events);
1255 if ((! resmgr_initialized) || (! appsctl_handle)) {
1256 apfw_error("ico_apf_resource_change_input_event: Leave(not initialized)");
1257 return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
1260 /* set send message parameter */
1262 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", input_dev, events);
1265 /* no input device, default device */
1266 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
1267 sysconf->inputdev[sysconf->misc.default_inputdevId].name, events);
1269 if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_CHANGE,
1270 ICO_APF_RESID_INPUT_DEV, NULL, msg)
1271 != ICO_APF_RESOURCE_E_NONE) {
1272 apfw_error("ico_apf_resource_change_input_event: Leave(commnad send error)");
1273 return ICO_APF_RESOURCE_E_COMMUNICATION;
1276 apfw_trace("ico_apf_resource_change_input_event: Leave(OK)");
1277 return ICO_APF_RESOURCE_E_NONE;
1280 /*--------------------------------------------------------------------------*/
1282 * @brief Delete the input event notification from input device
1284 * @param[in] input_dev input device uri
1285 * @param[in] events notify input events
1286 * @return result status
1287 * @retval ICO_APF_RESOURCE_E_NONE success
1288 * @retval ICO_APF_RESOURCE_E_NOT_INITIALIZED not initialized
1289 * @retval ICO_APF_RESOURCE_E_COMMUNICATION communication error
1291 /*--------------------------------------------------------------------------*/
1293 ico_apf_resource_delete_input_event(const char* input_dev, int events)
1295 char msg[ICO_APF_RESOURCE_MSG_LEN];
1297 apfw_trace("ico_apf_resource_delete_input_event: Enter(%s,%d)",
1298 input_dev ? input_dev : "(NULL)", events);
1300 if ((! resmgr_initialized) || (! appsctl_handle)) {
1301 apfw_error("ico_apf_resource_delete_input_event: Leave(not initialized)");
1302 return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
1305 /* set send message parameter */
1307 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", input_dev, events);
1310 /* no input device, default device */
1311 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
1312 sysconf->inputdev[sysconf->misc.default_inputdevId].name, events);
1314 if (ico_apf_com_send(appsctl_handle, ICO_APF_RESOURCE_COMMAND_DELETE,
1315 ICO_APF_RESID_INPUT_DEV, NULL, msg)
1316 != ICO_APF_RESOURCE_E_NONE) {
1317 apfw_error("ico_apf_resource_delete_input_event: Leave(commnad send error)");
1318 return ICO_APF_RESOURCE_E_COMMUNICATION;
1321 apfw_trace("ico_apf_resource_delete_input_event: Leave(OK)");
1322 return ICO_APF_RESOURCE_E_NONE;
1325 /*--------------------------------------------------------------------------*/
1327 * @brief Send responce form server(AppsController) to client application
1329 * @param[in] appid client application id
1330 * @param[in] event event
1331 * @param[in] resource target resource
1332 * @param[in] device display device / sound zone
1333 * @param[in] id application defined object id
1334 * @return result status
1335 * @retval ICO_APF_RESOURCE_E_NONE success
1336 * @retval ICO_APF_RESOURCE_E_NOT_INITIALIZED not initialized
1337 * @retval ICO_APF_RESOURCE_E_COMMUNICATION communication error
1338 * @retval ICO_APF_RESOURCE_E_INVAL illegal appid or event code
1340 /*--------------------------------------------------------------------------*/
1342 ico_apf_resource_send_to_client(const char *appid, const int event,
1343 const int resource, const char *device, const int id)
1345 remgr_com_handle_t *p;
1346 char msg[ICO_APF_RESOURCE_MSG_LEN];
1348 apfw_trace("ico_apf_resource_send_to_client: Enter(%s,%d,%d,%s,%d)",
1349 appid, event, resource, device ? device : "(NULL)", id);
1351 if ((! resmgr_initialized) || (! appsctl_handle)) {
1352 apfw_error("ico_apf_resource_send_to_client: Leave(not initialized)");
1353 return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
1356 /* search client application */
1359 if (strcmp(p->appid, appid) == 0) break;
1363 apfw_error("ico_apf_resource_send_to_client: Leave(appid not exist)");
1364 return ICO_APF_RESOURCE_E_INVAL;
1367 /* set send message parameter */
1369 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d", device, id);
1372 /* no display URI, default display */
1373 if ((resource == ICO_APF_RESID_BASIC_SCREEN) ||
1374 (resource == ICO_APF_RESID_INT_SCREEN) ||
1375 (resource == ICO_APF_RESID_ON_SCREEN)) {
1376 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
1377 sysconf->display[sysconf->misc.default_displayId].
1378 zone[sysconf->misc.default_dispzoneId].name, id);
1380 else if (resource == ICO_APF_RESID_INPUT_DEV) {
1381 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
1382 sysconf->inputdev[sysconf->misc.default_inputdevId].name, id);
1385 snprintf(msg, ICO_APF_RESOURCE_MSG_LEN-1, "%s %d",
1386 sysconf->sound[sysconf->misc.default_soundId].
1387 zone[sysconf->misc.default_soundzoneId].name, id);
1390 if (ico_apf_com_send(p->handle, event, resource, appid, msg)
1391 != ICO_APF_RESOURCE_E_NONE) {
1392 apfw_error("ico_apf_resource_send_to_client: Leave(commnad send error)");
1393 return ICO_APF_RESOURCE_E_COMMUNICATION;
1396 apfw_trace("ico_apf_resource_send_to_client: Leave(OK)");
1397 return ICO_APF_RESOURCE_E_NONE;
1400 /*--------------------------------------------------------------------------*/
1402 * @brief Send request to Multi Sound Manager
1404 * @param[in] cmd send command
1405 * @param[in] pid target pid
1406 * @return result status
1407 * @retval ICO_APF_RESOURCE_E_NONE success
1408 * @retval ICO_APF_RESOURCE_E_NOT_INITIALIZED not initialized
1409 * @retval ICO_APF_RESOURCE_E_COMMUNICATION communication error
1411 /*--------------------------------------------------------------------------*/
1413 ico_apf_resource_send_to_soundctl(const ico_apf_sound_state_e cmd, const int pid)
1415 apfw_trace("ico_apf_resource_send_to_soundctl: Enter(%s[%d],%d)",
1416 cmd == ICO_APF_SOUND_COMMAND_MUTEON ? "Stop" :
1417 (cmd == ICO_APF_SOUND_COMMAND_MUTEOFF ? "Start" : "\0"), (int)cmd, pid);
1419 if ((! resmgr_initialized) || (! soundmgr_handle)) {
1420 apfw_error("ico_apf_resource_send_to_soundctl: Leave(not initialized)");
1421 return ICO_APF_RESOURCE_E_NOT_INITIALIZED;
1424 if (ico_apf_com_send(soundmgr_handle, cmd, pid, NULL, NULL)
1425 != ICO_APF_RESOURCE_E_NONE) {
1426 apfw_error("ico_apf_resource_send_to_soundctl: Leave(commnad send error)");
1427 return ICO_APF_RESOURCE_E_COMMUNICATION;
1429 apfw_trace("ico_apf_resource_send_to_soundctl: Leave(OK)");
1430 return ICO_APF_RESOURCE_E_NONE;