Port to Weston 1.3 API.
[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     (80)       /* Maximum length of applicationId(AppCore) */
46                                             /* (with terminate NULL)                */
47 #define ICO_IVI_WINNAME_LENGTH   (40)       /* 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      0x0001  /* new surface show on create       */
61 #define ICO_IVI_DEBUG_SHOW_NODISP       0x0002  /* show if display not exist        */
62 #define ICO_IVI_DEBUG_SHOW_INPUTLAYER   0x0004  /* show input panel layer           */
63 #define ICO_IVI_DEBUG_FIXED_ASPECT      0x0100  /* surface fixed aspect rate        */
64
65 /* Function prototype                   */
66 int ico_ivi_get_mynode(void);               /* Get my node numner                   */
67 int ico_ivi_debugflag(void);                /* Get debug flag                       */
68 int ico_ivi_debuglevel(void);               /* Get debug level                      */
69                                             /* Get default animation name           */
70 const char *ico_ivi_default_animation_name(void);
71 int ico_ivi_default_animation_time(void);   /* Get default animation time(ms)       */
72 int ico_ivi_default_animation_fps(void);    /* Get animation frame rate(fps)        */
73
74 /* Debug Traces                         */
75 /* Define for debug write               */
76 #define UIFW_DEBUG_OUT  1   /* 1=Debug Print/0=No Debug Print           */
77
78 #if UIFW_DEBUG_OUT > 0
79 #define uifw_debug(fmt,...)  \
80     { if (ico_ivi_debuglevel() >= 5) {weston_log("DBG>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} }
81 #define uifw_trace(fmt,...)  \
82     { if (ico_ivi_debuglevel() >= 4) {weston_log("TRC>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} }
83 #else  /*UIFW_DEBUG_OUT*/
84 #define uifw_debug(fmt,...)
85 #define uifw_trace(fmt,...)
86 #endif /*UIFW_DEBUG_OUT*/
87
88 #define uifw_info(fmt,...)  \
89     { if (ico_ivi_debuglevel() >= 3) {weston_log("INF>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} }
90 #define uifw_warn(fmt,...)  \
91     { if (ico_ivi_debuglevel() >= 2) {weston_log("WRN>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} }
92 #define uifw_error(fmt,...)  \
93     { if (ico_ivi_debuglevel() >= 1) {weston_log("ERR>"fmt" (%s:%d)\n",##__VA_ARGS__,__FILE__,__LINE__);} }
94
95 #endif  /*_ICO_IVI_COMMON_H_*/
96