The change of the configuration and the implementation of the event input.
[profile/ivi/ico-uxf-weston-plugin.git] / src / ico_ivi_common.h
1 /*
2  * Copyright © 2010-2011 Intel Corporation
3  * Copyright © 2008-2011 Kristian Høgsberg
4  * Copyright © 2013 TOYOTA MOTOR CORPORATION.
5  *
6  * Permission to use, copy, modify, distribute, and sell this software and
7  * its documentation for any purpose is hereby granted without fee, provided
8  * that the above copyright notice appear in all copies and that both that
9  * copyright notice and this permission notice appear in supporting
10  * documentation, and that the name of the copyright holders not be used in
11  * advertising or publicity pertaining to distribution of the software
12  * without specific, written prior permission.  The copyright holders make
13  * no representations about the suitability of this software for any
14  * purpose.  It is provided "as is" without express or implied warranty.
15  *
16  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
17  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
18  * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
19  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
20  * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
21  * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
22  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23  */
24 /**
25  * @brief   The common functions that each Plugin is available.
26  *
27  * @date    Jul-26-2013
28  */
29
30 #ifndef _ICO_IVI_COMMON_H_
31 #define _ICO_IVI_COMMON_H_
32
33 /* Macros                               */
34 #define ICO_IVI_NODEID_2_HOSTID(nodeid)         (((unsigned int)nodeid) >> 8)
35 #define ICO_IVI_NODEID_2_DISPLAYNO(nodeid)      (((unsigned int)nodeid) & 0x0ff)
36 #define ICO_IVI_NODEDISP_2_NODEID(nodeid, displayno)  \
37                                                 ((nodeid << 8) | displayno)
38 #define ICO_IVI_SURFACEID_2_HOSTID(surfid)      (((unsigned int)surfid) >> 24)
39 #define ICO_IVI_SURFACEID_2_DISPLAYNO(surfid)   ((((unsigned int)surfid) >> 16) & 0x0ff)
40 #define ICO_IVI_SURFACEID_2_NODEID(surfid)      (((unsigned int)surfid) >> 16)
41 #define ICO_IVI_SURFACEID_BASE(nodeid)          (((unsigned int)nodeid) << 16)
42
43 /* System limit                         */
44 #define ICO_IVI_MAX_DISPLAY      (8)        /* Maximum numer of displays in a ECU   */
45 #define ICO_IVI_APPID_LENGTH     (128)      /* Maximum length of applicationId(AppCore) */
46                                             /* (with terminate NULL)                */
47 #define ICO_IVI_WINNAME_LENGTH   (32)       /* Maximum length of window name (with NULL)*/
48 #define ICO_IVI_ANIMATION_LENGTH (16)       /* Maximum length of animation name (w NULL)*/
49 #define ICO_IVI_MAX_COORDINATE   (16383)    /* Maximum X or Y coordinate            */
50
51 /* Fixed value                          */
52 #ifndef TRUE
53 #define TRUE    1
54 #endif
55 #ifndef FALSE
56 #define FALSE   0
57 #endif
58
59 /* Debug flags                          */
60 #define ICO_IVI_DEBUG_SHOW_SURFACE  0x01    /* new surface show on create           */
61
62 /* Function prototype                   */
63 int ico_ivi_get_mynode(void);               /* Get my node numner                   */
64 int ico_ivi_debugflag(void);                /* Get debug flag                       */
65 int ico_ivi_debuglevel(void);               /* Get debug level                      */
66                                             /* Get default animation name           */
67 const char *ico_ivi_default_animation_name(void);
68 int ico_ivi_default_animation_time(void);   /* Get default animation time(ms)       */
69 int ico_ivi_default_animation_fps(void);    /* Get animation frame rate(fps)        */
70
71 /* Debug Traces                         */
72 /* Define for debug write               */
73 #define UIFW_DEBUG_OUT  1   /* 1=Debug Print/0=No Debug Print           */
74
75 #if UIFW_DEBUG_OUT > 0
76 #define uifw_debug(fmt,...)  \
77     { if (ico_ivi_debuglevel() >= 5) {weston_log("DBG>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} }
78 #define uifw_trace(fmt,...)  \
79     { if (ico_ivi_debuglevel() >= 4) {weston_log("TRC>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} }
80 #else  /*UIFW_DEBUG_OUT*/
81 #define uifw_debug(fmt,...)
82 #define uifw_trace(fmt,...)
83 #endif /*UIFW_DEBUG_OUT*/
84
85 #define uifw_info(fmt,...)  \
86     { if (ico_ivi_debuglevel() >= 3) {weston_log("INF>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} }
87 #define uifw_warn(fmt,...)  \
88     { if (ico_ivi_debuglevel() >= 2) {weston_log("WRN>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} }
89 #define uifw_error(fmt,...)  \
90     { if (ico_ivi_debuglevel() >= 1) {weston_log("ERR>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} }
91
92 #endif  /*_ICO_IVI_COMMON_H_*/
93