HbbTv  17.9.0
Open source HBBTV engine
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
queue.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2011 Ocean Blue Software Ltd
4  *
5  * This file is part of a DTVKit Software Component
6  * You are permitted to copy, modify or distribute this file subject to the terms
7  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
8  *
9  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
10  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
11  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * If you or your organisation is not a member of DTVKit then you have access
14  * to this source code outside of the terms of the licence agreement
15  * and you are expected to delete this and any associated files immediately.
16  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
17  *******************************************************************************/
26 #ifndef _QUEUE_H
27 #define _QUEUE_H
28 
29 #include "hbbtv_types.h"
30 
31 #define MAX_MSG_SIZE 32 /*bytes*/
32 
33 typedef void (*F_QUE_NOTIFY)( void );
34 
35 typedef enum
36 {
37  PRTY_CRITICAL, /*start/stop/key-press*/
38  PRTY_NORMAL, /*Events*/
39  PRTY_RESULTS, /*query results*/
40  PRTY_DSMCC_HIGH,
41  PRTY_DSMCC_LOW,
42  PRTY_INVALID
43 } E_QUE_MESSAGE_PRIORITY;
44 
45 typedef enum
46 {
47  DT_NONE,
48  DT_VALUE,
49  DT_ALLOC,
50  DT_CONTENT,
51  DT_D_CONTENT,
52  DT_F_CONTENT,
53  DT_S_CONTENT
54 } E_QUE_DATA_TYPE;
55 
56 /*******************************************************************************
57  *@begin
58  * NAME: F_QUE_FUNCTION
59  * Function to Process HbbTV engine message
60  *
61  * Returns : void
62  *
63  * Parameter Flow Description
64  * ------------------------------------------------------------------------------
65  * data IN Pointer to msg data
66  *
67  *@end
68  *******************************************************************************/
69 typedef void (*F_QUE_FUNCTION)( void *data );
70 
71 typedef struct
72 {
73  void *usr_ptr;
74  U32BIT first32bit;
75  U16BIT secnd16bit;
76  U16BIT third16bit;
78 
79 typedef struct
80 {
81  U16BIT sid;
82  U16BIT type;
83  U16BIT pid;
85 
86 typedef struct
87 {
88  U16BIT serv_id;
89  U16BIT trans_id;
90  U16BIT onet_id;
91  U32BIT status;
93 
94 typedef struct
95 {
96  S_HBBTV_STRING url;
97  void *eventPtr;
99 
100 typedef struct
101 {
102  U32BIT id;
103  U32BIT event;
105 
106 typedef struct
107 {
108  U32BIT first_number;
109  U32BIT second_number;
110  U8BIT *message;
111  U32BIT length;
113 
114 /* Event parameters. */
115 typedef struct
116 {
117  F_QUE_FUNCTION proc_msg_func;
118  E_QUE_DATA_TYPE data_type;
119  union
120  {
121  S_QUE_GENERAL_PARAMS params;
122  S_QUE_AIT_PARAMS ait;
123  S_QUE_CHANNEL_CHANGE_PARAMS channel_change;
124  S_QUE_STREAM_EVENT_REQUEST SEventRqst;
125  S_QUE_RECORDING_EVENT_PARAMS recording_event;
126  S_QUE_DRM_PARAMS drm;
127  } data;
128 } S_QUE_MESSAGE;
129 
130 /*******************************************************************************
131  *@begin
132  * NAME: HBBTV_QueOpen
133  * Initialise component control and section queues. Allocates memory for,
134  * sets up and creates event (component control) and section queues.
135  *
136  * Returns : HBBTV_OK - Completed successfully.
137  * HBBTV_ERR_BAD_PARAMETER - Invalid parameter.
138  * HBBTV_ERR_COMP_ALREADY_OPEN - Component queues already open.
139  * HBBTV_ERR_ALLOCATING_MEMORY - Not enough memory to allocate.
140  * HBBTV_ERR_INTERNAL - System error.
141  *
142  * Parameter Flow Description
143  * ------------------------------------------------------------------------------
144  *
145  * Additional information:
146  * None.
147  *
148  *@end
149  *******************************************************************************/
150 E_HBBTV_ERR HBBTV_QueOpen(void);
151 
152 
153 /*******************************************************************************
154  *@begin
155  * NAME: HBBTV_QueClose
156  * Close component control and section queue component. Destroys all
157  * allocated memory and resources for event and section queues.
158  *
159  * Returns : void
160  *
161  * Parameter Flow Description
162  * ------------------------------------------------------------------------------
163  * None.
164  *
165  * Additional information:
166  * None.
167  *
168  *@end
169  *******************************************************************************/
170 void HBBTV_QueClose(void);
171 
172 /*******************************************************************************
173  *@begin
174  * NAME: HBBTV_QuePutMsg
175  * Post event or section message on queue. Copies data into queue.
176  *
177  * Returns : HBBTV_OK - Completed successfully.
178  * HBBTV_ERR_BAD_PARAMETER - Invalid parameter.
179  * HBBTV_ERR_COMP_NOT_OPEN - Component queues not open.
180  * HBBTV_ERR_INTERNAL - System error.
181  * HBBTV_ERR_ALLOCATING_MEMORY - Not enough memory to allocate.
182  * HBBTV_ERR_QUEUE_FULL - Queue full.
183  *
184  * Parameter Flow Description
185  * ------------------------------------------------------------------------------
186  * pMsg IN Pointer to message.
187  *
188  * Additional information:
189  * None.
190  *
191  *@end
192  *******************************************************************************/
193 E_HBBTV_ERR HBBTV_QuePutMsg(S_QUE_MESSAGE *p_msg, E_QUE_MESSAGE_PRIORITY priority);
194 
195 
196 /*******************************************************************************
197  *@begin
198  * NAME: HBBTV_QueGet
199  * Get an event or section from the component queues.
200  * This is a blocking function.
201  *
202  * Returns : HBBTV_OK - Completed successfully.
203  * HBBTV_ERR_COMP_NOT_OPEN - Component queues not open.
204  * HBBTV_ERR_INTERNAL - System error.
205  *
206  * Parameter Flow Description
207  * ------------------------------------------------------------------------------
208  * pElem OUT Pointer to event message
209  *
210  * Additional information:
211  * None.
212  *
213  *@end
214  *******************************************************************************/
215 E_HBBTV_ERR HBBTV_QueGetMsg(S_QUE_MESSAGE *pElem);
216 
217 /*******************************************************************************
218  *@begin
219  * NAME: HBBTV_QueGetSizeFree
220  * Get size available on a queue.
221  *
222  * Returns : number left in queue.
223  *
224  * Parameter Flow Description
225  * ------------------------------------------------------------------------------
226  * pEvent OUT Pointer to component event or section data
227  * structure.
228  *
229  * Additional information:
230  * None.
231  *
232  *@end
233  *******************************************************************************/
234 U16BIT HBBTV_QueGetSizeFree(E_QUE_MESSAGE_PRIORITY priority);
235 
236 /*******************************************************************************
237  *@begin
238  * NAME: HBBTV_QueEventNeedsProcessing
239  * Check whether any events on component queues needs processing.
240  *
241  * Returns : TRUE - if processing required
242  *
243  * Parameter Flow Description
244  * ------------------------------------------------------------------------------
245  *
246  * Additional information:
247  * None.
248  *
249  *@end
250  *******************************************************************************/
251 BOOLEAN HBBTV_QueEventNeedsProcessing(void);
252 
253 /*******************************************************************************
254  *@begin
255  * NAME: HBBTV_QueRegisterNormalNotify
256  *
257  * Returns : void
258  *
259  * Parameter Flow Description
260  * ------------------------------------------------------------------------------
261  * critical_rcvd IN Pointer to function signalling a critical event
262  * critical_done IN Pointer to function inform critical event done
263  *
264  * Additional information:
265  * None.
266  *
267  *@end
268  *******************************************************************************/
269 void* HBBTV_QueRegisterNotify(F_QUE_NOTIFY normal_rcvd, F_QUE_NOTIFY critical_rcvd,
270  F_QUE_NOTIFY critical_done);
271 
272 /*******************************************************************************
273  *@begin
274  * NAME: HBBTV_QueUnRegisterNotify
275  *
276  * Returns : void
277  *
278  * Parameter Flow Description
279  * ------------------------------------------------------------------------------
280  * normal_rcvd IN Pointer to function signalling an async event
281  *
282  * Additional information:
283  * None.
284  *
285  *@end
286  *******************************************************************************/
287 void HBBTV_QueUnRegisterNotify(void *qn);
288 
289 #endif /*_QUEUE_H*/
Definition: queue.h:86
Definition: queue.h:71
Definition: queue.h:115
Definition of general purpose types.
Definition: queue.h:100
void HBBTV_QueClose(void)
Not used for now.
Definition: queue.c:47
BOOLEAN HBBTV_QueEventNeedsProcessing(void)
Not used for now.
Definition: queue.c:97
Definition: queue.h:94
E_HBBTV_ERR HBBTV_QueOpen(void)
Not used for now.
Definition: queue.c:36
void * HBBTV_QueRegisterNotify(F_QUE_NOTIFY normal_rcvd, F_QUE_NOTIFY critical_rcvd, F_QUE_NOTIFY critical_done)
Not used for now.
Definition: queue.c:108
void HBBTV_QueUnRegisterNotify(void *qn)
Not used for now.
Definition: queue.c:120
Definition: queue.h:106
E_HBBTV_ERR HBBTV_QueGetMsg(S_QUE_MESSAGE *pElem)
Not used for now.
Definition: queue.c:75
Definition: hbbtv_types.h:167
E_HBBTV_ERR HBBTV_QuePutMsg(S_QUE_MESSAGE *p_msg, E_QUE_MESSAGE_PRIORITY priority)
Temporary implementation of HBBTV_QuePutMsg, for now it calls the function straight away as the queue...
Definition: queue.c:58
U16BIT HBBTV_QueGetSizeFree(E_QUE_MESSAGE_PRIORITY priority)
Not used for now.
Definition: queue.c:86
Definition: queue.h:79