bug fix: TIVI-1997, TIVI-2161, An action is inaccurate when the menu of HomeScreen...
[profile/ivi/ico-uxf-homescreen.git] / lib / system-controller / ico_syc_mrp_resource_private.h
1 /*
2  * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
3  *
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
7  *
8  */
9
10 //==========================================================================
11 /**
12  *  @file   ico_syc_mrp_resource_private.h
13  *
14  *  @brief  This file is definition of murpy ressource control
15  */
16 //==========================================================================
17
18 #ifndef __ICO_SYC_MRP_RESOURCE_PRIVATE_H__
19 #define __ICO_SYC_MRP_RESOURCE_PRIVATE_H__
20
21 #include <murphy/plugins/resource-native/libmurphy-resource/resource-api.h>
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26
27 #define ICO_APC_REQTYPE_REQUEST 0               /* Request from application         */
28 #define ICO_APC_REQTYPE_CREATE  1               /* Request automatically             */
29
30 // TODO 
31 #define REQTYPE_APP             0
32 #define REQTYPE_AUTO            1
33
34 #define RESID_KIND_DISPLAY      0x00000001  
35 #define RESID_KIND_SOUND        0x00000002  
36 #define RESID_KIND_INPUT        0x00000004  
37 #define RESID_KIND_MASK         0x000000FF  
38                                             
39 #define RESID_TYPE_BASIC        0x00000100  
40 #define RESID_TYPE_INTERRUPT    0x00000200  
41 #define RESID_TYPE_ONSCREEN     0x00000400  
42 #define RESID_TYPE_MASK         0x00000F00  
43
44 #define RESID_CMD_ACQUIRE       0x00001000
45 #define RESID_CMD_RELEASE       0x00002000
46
47 #define RES_STATE_ACQUIRED      1
48 #define RES_STATE_DEPRIVED      2
49 #define RES_STATE_WAITING       3
50 #define RES_STATE_RELEASED      4
51
52 #define MURPHY_APPID_MAXIMUM_LENGTH 128
53
54 typedef struct {
55     int  req_id;
56     char appid[MURPHY_APPID_MAXIMUM_LENGTH];
57     int  res_type;
58     int  zone_idx;
59     int  prio;
60     mrp_list_hook_t hook;
61 } mrp_res_queue_item_t;
62
63 #define ICO_UXF_MAX_PROCESS_NAME 255
64 #define ICO_UXF_MAX_DEVICE_NAME  255
65
66 /* request information                          */
67 typedef struct  _resource_request {
68     int                         id;             /* request object                   */
69     int                         prio;           /* request priority                 */
70     unsigned short              reqtype;        /* Request type                     */
71     unsigned short              category;        /* Request category */
72
73     int  resid;           /* resource id      */
74     char *appid;          /* application id */
75     int  appkind;         /* id of application kind */
76     int  pid;             /* process id     */
77     int  state;           /* request state */
78
79     char *dispzone;       /* area of showing application window */
80     int  dispzoneid;      /* area of showing application window */
81     int  layerid;         /* layer of showing application window */
82     char *winname;        /* window's surface name */
83     int  surfaceid;       /* window id */
84     char *animation;      /* name of animation */
85     int  animationTime;   /* time of animation[ms] */
86
87     char *soundzone;      /* area of playing sound */
88     int  soundzoneid;     /* area of playing sound */
89     char *soundname;      /* sound stream name */
90     int  soundid;         /* sound id */
91     int  soundadjust;     /* adjust action */
92
93     char *device;         /* input device name */
94     int  input;           /* input event id */
95
96     mrp_res_resource_set_t      *rset;          /* Murphy resource set */
97     mrp_res_queue_item_t        *res_data;      /* identifier for the request */
98     mrp_list_hook_t             hook;           /* keep track of requests */
99     int                         released;
100
101 } resource_request_t;
102
103 typedef void (*ico_syc_mrp_enforce_sound_t)(unsigned short state,
104                                             resource_request_t *req,
105                                             void *user_data);
106
107
108 int ico_syc_mrp_init(ico_syc_mrp_enforce_sound_t soundcb,
109                      void *user_data);
110 void ico_syc_mrp_term(void);
111
112 bool ico_syc_mrp_acquire_sound_resource(resource_request_t *req);
113 bool ico_syc_mrp_release_sound_resource(resource_request_t *req);
114 void ico_syc_mrp_active_app(const char *appid);
115
116 #ifdef __cplusplus
117 }
118 #endif
119 #endif  /* __ICO_SYC_MRP_RESOURCE_PRIVATE_H__ */
120 /* vim:set expandtab ts=4 sw=4: */