MHEG5  18.9.0
MHEG5 Documentation
mh5keypress.c
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2012 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  *******************************************************************************/
25 /*---includes for this file--------------------------------------------------*/
26 #include <glue_memory.h>
27 #include <glue_debug.h>
28 #include <glue_queue.h>
29 #include <glue_main.h>
30 #include "mheg5_keypress.h"
31 #include "mheg5_events.h"
32 #include "mh5application.h"
33 #include "mh5scene.h"
34 #include "mh5queue.h"
35 #include "mh5display.h"
36 #include "mh5entryfield.h"
37 #include "mh5hypertext.h"
38 #include "mh5slider.h"
39 #include "mh5profile.h"
40 #include "mh5support.h"
41 #ifdef INCLUDE_SA_PROFILE
42 #include "mh5control.h"
43 #endif
44 #include "mh5keypress.h"
45 
46 #ifdef NOTIFY_KEYSET
48 #endif
49 
50 /*---constant definitions for this file--------------------------------------*/
51 
52 /* It is safe to always include input registers for AU and NZ */
53 #define INCLUDE_AU_PROFILE
54 #define INCLUDE_NZ_PROFILE
55 
56 /*---local typedef structs for this file-------------------------------------*/
57 
58 /* User interface function groups */
59 typedef enum
60 {
74 
75 
76 typedef struct s_keyMask
77 {
80 } s_keyMask_t;
81 
82 /*---local (static) variable declarations for this file----------------------*/
83 static BOOLEAN Register3Accept(E_MHEG5_KEY key);
84 
85 /*pointer to user input register check function*/
86 static BOOLEAN (*inputAcceptFn)(E_MHEG5_KEY key) = Register3Accept;
87 
88 static BOOLEAN promotional_linking_enabled = TRUE;
89 
90 static s_keyMask_t key_mask_values[TOTAL_MHEG5_KEYS] =
91 {
92  {0, 0x01}, /* MHEG5_KEY_UP */
93  {0, 0x02}, /* MHEG5_KEY_DOWN */
94  {0, 0x04}, /* MHEG5_KEY_LEFT */
95  {0, 0x08}, /* MHEG5_KEY_RIGHT */
96  {0, 0x10}, /* MHEG5_KEY_0 */
97  {0, 0x10}, /* MHEG5_KEY_1 */
98  {0, 0x10}, /* MHEG5_KEY_2 */
99  {0, 0x10}, /* MHEG5_KEY_3 */
100  {0, 0x10}, /* MHEG5_KEY_4 */
101  {0, 0x10}, /* MHEG5_KEY_5 */
102  {0, 0x10}, /* MHEG5_KEY_6 */
103  {0, 0x10}, /* MHEG5_KEY_7 */
104  {0, 0x10}, /* MHEG5_KEY_8 */
105  {0, 0x10}, /* MHEG5_KEY_9 */
106  {0, 0x20}, /* MHEG5_KEY_SELECT*/
107  {0, 0x40}, /* MHEG5_KEY_CANCEL*/
108  {0, 0x80}, /* MHEG5_KEY_HELP */
109  {1, 0x01}, /* MHEG5_KEY_RED */
110  {1, 0x02}, /* MHEG5_KEY_GREEN */
111  {1, 0x04}, /* MHEG5_KEY_YELLOW*/
112  {1, 0x08}, /* MHEG5_KEY_BLUE */
113  {1, 0x10}, /* MHEG5_KEY_TEXT */
114  {1, 0x20}, /* MHEG5_KEY_INFO */
115  {2, 0x20}, /* MHEG5_KEY_EPG */
116  {1, 0x40}, /* MHEG5_KEY_STOP */
117  {1, 0x80}, /* MHEG5_KEY_PLAY */
118  {2, 0x01}, /* MHEG5_KEY_PAUSE */
119  {2, 0x02}, /* MHEG5_KEY_SKIP_FWD */
120  {2, 0x04}, /* MHEG5_KEY_SKIP_BACK */
121  {2, 0x08}, /* MHEG5_KEY_FAST_FWD */
122  {2, 0x10}, /* MHEG5_KEY_REWIND */
123  {2, 0x40}, /* MHEG5_KEY_PLAY_PAUSE */
124  {4, 0x01}, /* MHEG5_KEY_RECORD */
125 };
126 
129 {
130  FALSE, /* MHEG5_KEY_UP */
131  FALSE, /* MHEG5_KEY_DOWN */
132  FALSE, /* MHEG5_KEY_LEFT */
133  FALSE, /* MHEG5_KEY_RIGHT */
134  FALSE, /* MHEG5_KEY_0 */
135  FALSE, /* MHEG5_KEY_1 */
136  FALSE, /* MHEG5_KEY_2 */
137  FALSE, /* MHEG5_KEY_3 */
138  FALSE, /* MHEG5_KEY_4 */
139  FALSE, /* MHEG5_KEY_5 */
140  FALSE, /* MHEG5_KEY_6 */
141  FALSE, /* MHEG5_KEY_7 */
142  FALSE, /* MHEG5_KEY_8 */
143  FALSE, /* MHEG5_KEY_9 */
144  FALSE, /* MHEG5_KEY_SELECT*/
145  FALSE, /* MHEG5_KEY_CANCEL*/
146  FALSE, /* MHEG5_KEY_HELP */
147  FALSE, /* MHEG5_KEY_RED */
148  FALSE, /* MHEG5_KEY_GREEN */
149  FALSE, /* MHEG5_KEY_YELLOW*/
150  FALSE, /* MHEG5_KEY_BLUE */
151  FALSE, /* MHEG5_KEY_TEXT */
152  FALSE, /* MHEG5_KEY_INFO */
153  FALSE, /* MHEG5_KEY_EPG */
154  FALSE, /* MHEG5_KEY_STOP */
155  FALSE, /* MHEG5_KEY_PLAY */
156  FALSE, /* MHEG5_KEY_PAUSE */
157  FALSE, /* MHEG5_KEY_SKIP_FWD */
158  FALSE, /* MHEG5_KEY_SKIP_BACK */
159  FALSE, /* MHEG5_KEY_FAST_FWD */
160  FALSE, /* MHEG5_KEY_REWIND */
161  FALSE, /* MHEG5_KEY_PLAY_PAUSE */
162  FALSE, /* MHEG5_KEY_RECORD */
163 };
164 
165 static int UserInputEventData[TOTAL_MHEG5_KEYS] =
166 {
167  1, /* MHEG5_KEY_UP */
168  2, /* MHEG5_KEY_DOWN */
169  3, /* MHEG5_KEY_LEFT */
170  4, /* MHEG5_KEY_RIGHT */
171  5, /* MHEG5_KEY_0 */
172  6, /* MHEG5_KEY_1 */
173  7, /* MHEG5_KEY_2 */
174  8, /* MHEG5_KEY_3 */
175  9, /* MHEG5_KEY_4 */
176  10, /* MHEG5_KEY_5 */
177  11, /* MHEG5_KEY_6 */
178  12, /* MHEG5_KEY_7 */
179  13, /* MHEG5_KEY_8 */
180  14, /* MHEG5_KEY_9 */
181  15, /* MHEG5_KEY_SELECT*/
182  16, /* MHEG5_KEY_CANCEL*/
183  17, /* MHEG5_KEY_HELP */
184  100, /* MHEG5_KEY_RED */
185  101, /* MHEG5_KEY_GREEN */
186  102, /* MHEG5_KEY_YELLOW*/
187  103, /* MHEG5_KEY_BLUE */
188  104, /* MHEG5_KEY_TEXT */
189  105, /* MHEG5_KEY_INFO */
190  300, /* MHEG5_KEY_EPG */
191  120, /* MHEG5_KEY_STOP */
192  121, /* MHEG5_KEY_PLAY */
193  122, /* MHEG5_KEY_PAUSE */
194  123, /* MHEG5_KEY_SKIP_FWD */
195  124, /* MHEG5_KEY_SKIP_BACK */
196  125, /* MHEG5_KEY_FAST_FWD */
197  126, /* MHEG5_KEY_REWIND */
198  127, /* MHEG5_KEY_PLAY_PAUSE */
199  400, /* MHEG5_KEY_RECORD */
200 };
201 
202 #ifdef NOTIFY_KEYSET
203 static MHEG5Int key_input_reg;
204 static U32BIT last_keyset = 0;
205 #endif
206 
207 /*---local function definitions----------------------------------------------*/
208 
209 /*---global function definitions---------------------------------------------*/
210 /*functions to check if a key is part of a particular register*/
211 static BOOLEAN Register4Accept(E_MHEG5_KEY key);
212 static BOOLEAN Register5Accept(E_MHEG5_KEY key);
213 static BOOLEAN Register6Accept(E_MHEG5_KEY key);
214 #ifdef INCLUDE_FREESAT
215 static BOOLEAN Register7Accept(E_MHEG5_KEY key);
216 #endif
217 #ifdef INCLUDE_NZ_PROFILE
218 static BOOLEAN Register13Accept(E_MHEG5_KEY key);
219 static BOOLEAN Register14Accept(E_MHEG5_KEY key);
220 static BOOLEAN Register15Accept(E_MHEG5_KEY key);
221 static BOOLEAN Register16Accept(E_MHEG5_KEY key);
222 #endif
223 #ifdef INCLUDE_AU_PROFILE
224 static BOOLEAN Register33Accept(E_MHEG5_KEY key);
225 static BOOLEAN Register34Accept(E_MHEG5_KEY key);
226 static BOOLEAN Register35Accept(E_MHEG5_KEY key);
227 #endif
228 
229 static BOOLEAN IsKeypressInMask(E_MHEG5_KEY key);
230 
231 #ifdef NOTIFY_KEYSET
232 BOOLEAN NotifyKeyset(void)
233 {
234  U32BIT key;
235  U32BIT keyset = 0;
236  switch (key_input_reg)
237  {
238  case 0:
239  {
240  for (key = MHEG5_KEY_UP; key != MHEG5_KEY_0; key++)
241  {
242  if (key_mask_enable[key])
243  {
244  keyset |= KS_NAVIGATION;
245  break;
246  }
247  }
248  for (key = MHEG5_KEY_0; key != MHEG5_KEY_SELECT; key++)
249  {
250  if (key_mask_enable[key])
251  {
252  keyset |= KS_NUMERIC;
253  break;
254  }
255  }
257  {
258  keyset |= KS_NAVIGATION;
259  }
261  {
262  keyset |= KS_RED;
263  }
265  {
266  keyset |= KS_GREEN;
267  }
269  {
270  keyset |= KS_YELLOW;
271  }
273  {
274  keyset |= KS_BLUE;
275  }
277  {
278  keyset |= KS_INFO;
279  }
280  for (key = MHEG5_KEY_STOP; key != TOTAL_MHEG5_KEYS; key++)
281  {
282  if (key_mask_enable[key])
283  {
284  keyset |= KS_VCR;
285  break;
286  }
287  }
288  break;
289  }
290  case 7:
291  keyset |= KS_INFO;
292  case 6:
293  keyset |= KS_VCR;
294  case 4:
295  keyset |= KS_NUMERIC;
296  case 5:
297  keyset |= KS_NAVIGATION;
298  default:
299  keyset |= KS_RED|KS_GREEN|KS_YELLOW|KS_BLUE;
300  }
301  if (last_keyset != keyset)
302  {
304  last_keyset = keyset;
305  }
306  return FALSE;
307 }
308 #endif
309 
320 void MHEG5setInputEventRegister(MHEG5Int inputEventRegister)
321 {
322  switch (inputEventRegister)
323  {
324  case 0:
325  /* InputMask extension */
326  inputAcceptFn = IsKeypressInMask;
327  break;
328 
329  default:
330  /* Invalid value encoded in scene. What should we do here? Either we
331  * grab all the keys, potentially causing user confusion, or we just
332  * grab the group 3 keys with the posibility that the user cannot
333  * interact with the application. Let's try to keep TV functionality
334  * consistant, and hope the broadcaster fixes their broadcast.
335  * So fall through to zero case */
336  case 1:
337  case 2:
338  /* Group 1 & 2 not supported*/
339 
340  case 3:
341  /* Group 3 - Red, Green, Yellow, Blue, Text and Cancel/Exit */
342  inputAcceptFn = Register3Accept;
343  break;
344 
345  case 4:
346  /* Group 4 - Group 3, digits, Up, Down, Left, Right, Select */
347  inputAcceptFn = Register4Accept;
348  break;
349 
350  case 5:
351  /* Group 5 - Group 4 without digits */
352  inputAcceptFn = Register5Accept;
353  break;
354 
355  case 6:
356  /* Group 6 - */
357  inputAcceptFn = Register6Accept;
358  break;
359 
360  #ifdef INCLUDE_FREESAT
361  case 7:
363  {
364  /* Group 7 - Freesat with INFO (but no EngineEvent) */
365  inputAcceptFn = Register7Accept;
366  }
367  else
368  {
369  inputAcceptFn = Register3Accept;
370  }
371  break;
372  #endif
373 
374  #ifdef INCLUDE_NZ_PROFILE
375  case 13:
377  {
378  /* Group 13 - EPG, Red, Green, Yellow, Blue, Text and Cancel/Exit */
379  inputAcceptFn = Register13Accept;
380  }
381  else
382  {
383  inputAcceptFn = Register3Accept;
384  }
385  break;
386 
387  case 14:
389  {
390  inputAcceptFn = Register14Accept;
391  }
392  else
393  {
394  inputAcceptFn = Register4Accept;
395  }
396  break;
397 
398  case 15:
400  {
401  inputAcceptFn = Register15Accept;
402  }
403  else
404  {
405  inputAcceptFn = Register5Accept;
406  }
407  break;
408 
409  case 16:
411  {
412  /* Group 16 - Group 6 with EPG key */
413  inputAcceptFn = Register16Accept;
414  }
415  else
416  {
417  inputAcceptFn = Register6Accept;
418  }
419  break;
420  #endif /* INCLUDE_NZ_PROFILE*/
421 
422  #ifdef INCLUDE_AU_PROFILE
423  case 33:
425  {
426  /* Group 33 - EPG, INFO, Red, Green, Yellow, Blue, Text and Cancel/Exit */
427  inputAcceptFn = Register33Accept;
428  }
429  else
430  {
431  inputAcceptFn = Register3Accept;
432  }
433  break;
434 
435  case 34:
437  {
438  /* Group 34 - Group 13, digits, Up, Down, Left, Right, Select */
439  inputAcceptFn = Register34Accept;
440  }
441  else
442  {
443  inputAcceptFn = Register4Accept;
444  }
445  break;
446 
447  case 35:
449  {
450  /* Group 35 - Group 14 without digits */
451  inputAcceptFn = Register35Accept;
452  }
453  else
454  {
455  inputAcceptFn = Register5Accept;
456  }
457  break;
458  #endif /* INCLUDE_AU_PROFILE*/
459  }
460 
461 #ifdef NOTIFY_KEYPRESS_REQ
462  DVB_MhegSetInputRegister(inputEventRegister);
463 #endif /* NOTIFY_KEYPRESS_REQ */
464 #ifdef NOTIFY_KEYSET
465  key_input_reg = inputEventRegister;
466  MH5GlueAddPostProcessFunc( NotifyKeyset );
467 #endif
468 }
469 
471 {
472  BOOLEAN accepted;
473  switch (keyPress)
474  {
475  case MHEG5_KEY_EPG:
476  case MHEG5_KEY_INFO:
477  #ifdef INCLUDE_SA_PROFILE
479  {
480  accepted = TRUE;
481  break;
482  }
483  #endif /*INCLUDE_SA_PROFILE*/
484  default:
485  if (MHEG5getCurrentScene())
486  {
487  /*check if the key is part of the selected input register*/
488  accepted = inputAcceptFn(keyPress);
489  }
490  else
491  {
492  TRACE(TKEYS, ("No scene for key %d", keyPress))
493  accepted = FALSE;
494  }
495  }
496  return accepted;
497 }
498 
508 {
509  E_MHEG5_KEY ui = params->key;
510  MHEG5Scene *scene;
511  MHEG5Root *application;
512  MHEG5Entryfield *entryfield;
513  MHEG5Hypertext *hypertext;
514  MHEG5Slider *slider;
515 
516  scene = MHEG5getCurrentScene();
517 
518  /* Check that there is an active scene before sending the event */
519  if (!scene)
520  {
521  #ifdef INCLUDE_SA_PROFILE
523  {
524  // For South Africa profile, when no scene, launch default apps.
525  switch (ui)
526  {
527  case MHEG5_KEY_EPG:
528  MHEG5StartEpgApp();
529  break;
530  case MHEG5_KEY_INFO:
531  MHEG5StartInfoApp(FALSE);
532  break;
533  case MHEG5_KEY_SELECT:
534  MHEG5StartListApp();
535  break;
536  default:;
537  TRACE(TKEYS, ("No Scene - ignoring key %d", ui));
538  }
539  }
540  else
541  #endif /*INCLUDE_SA_PROFILE*/
542  {
543  TRACE(TKEYS, ("No Scene - ignoring key %d", ui))
544  }
545  }
546  else if (!inputAcceptFn(ui))
547  {
548  /* If there is a scene then an application should be running */
549  TRACE(TKEYS, ("key %d not included in input register", ui))
551  {
552  // For South Africa profile, always send these engine events...
553  switch (ui)
554  {
555  case MHEG5_KEY_EPG:
557  break;
558 
559  case MHEG5_KEY_INFO:
561  break;
562  default:;
563  }
564  }
565  }
566  else
567  {
568  TRACE_SET_TIME();
569  TRACE(TKEYS, ("got key %d", ui))
570 
571  /* If there is a scene then an application should be running */
572  application = (MHEG5Root *)MHEG5getCurrentApplication();
573 
574  switch (ui)
575  {
576  case MHEG5_KEY_TEXT:
577  /* Generate TextFunction engine event */
579  break;
580 
581  case MHEG5_KEY_CANCEL:
582  /* Generate CancelKeyFunction engine event */
584  break;
585 
586  case MHEG5_KEY_RED:
587  /* Generate RedKeyFunction engine event */
589  break;
590 
591  case MHEG5_KEY_GREEN:
592  /* Generate GreenKeyFunction engine event */
594  break;
595 
596  case MHEG5_KEY_YELLOW:
597  /* Generate YellowKeyFunction engine event */
599  break;
600 
601  case MHEG5_KEY_BLUE:
602  /* Generate BlueKeyFunction engine event */
604  break;
605 
606  #ifndef INCLUDE_FREESAT
607  case MHEG5_KEY_INFO:
608  /* Generate InfoKeyFunction engine event for OZ profile,
609  * but not for Freesat.
610  */
612  break;
613  #endif /* !INCLUDE_FREESAT */
614 
615  case MHEG5_KEY_EPG:
616  /* Generate EPGKeyFunction engine event - for NZ profile */
618  break;
619 
620  default:
621  /* No other keys generate engine events */
622  ;
623  }
624 
625  if (scene->currentInteractible)
626  {
627  switch (scene->currentInteractible->clazz)
628  {
629  case MHEG5ENTRYFIELD:
630  entryfield = (MHEG5Entryfield *)scene->currentInteractible;
631  MHEG5entryfieldUserInput(entryfield, ui);
632  return;
633 
634  case MHEG5HYPERTEXT:
635  hypertext = (MHEG5Hypertext *)scene->currentInteractible;
636  switch (ui)
637  {
638  case MHEG5_KEY_UP:
639  case MHEG5_KEY_LEFT:
640  MHEG5hypertextUP(hypertext);
641  break;
642  case MHEG5_KEY_DOWN:
643  case MHEG5_KEY_RIGHT:
644  MHEG5hypertextDOWN(hypertext);
645  break;
646  case MHEG5_KEY_SELECT:
647  MHEG5hypertextSELECT(hypertext);
648  break;
649  case MHEG5_KEY_CANCEL:
651  scene->currentInteractible = 0;
653  return;
654  default:
655  /* Not interested in other keys */
656  ;
657  }
658  break;
659 
660  case MHEG5SLIDER:
661  slider = (MHEG5Slider *)scene->currentInteractible;
662  switch (ui)
663  {
664  case MHEG5_KEY_LEFT:
665  MHEG5sliderLEFT(slider);
666  break;
667  case MHEG5_KEY_UP:
668  MHEG5sliderUP(slider);
669  break;
670  case MHEG5_KEY_RIGHT:
671  MHEG5sliderRIGHT(slider);
672  break;
673  case MHEG5_KEY_DOWN:
674  MHEG5sliderDOWN(slider);
675  break;
676  case MHEG5_KEY_SELECT:
677  /* should there be any difference between the actions of SELECT and EXIT?*/
678  case MHEG5_KEY_CANCEL:
679  MHEG5sliderEXIT(slider);
680  return;
681  default:
682  /* Not interested in other keys */
683  ;
684  }
685  break;
686 
687  default:
688  return;
689  }
691  return;
692  }
693  MHEG5sendEvent((MHEG5Root *) scene, MHEG5USERINPUT, UserInputEventData[ui] );
694  }
695 }
696 
706 static BOOLEAN Register3Accept(E_MHEG5_KEY key)
707 {
708  switch (key)
709  {
710  case MHEG5_KEY_CANCEL:
711  case MHEG5_KEY_RED:
712  case MHEG5_KEY_GREEN:
713  case MHEG5_KEY_YELLOW:
714  case MHEG5_KEY_BLUE:
715  case MHEG5_KEY_TEXT:
716 #ifdef INCLUDE_RECORD_KEY
717  case MHEG5_KEY_RECORD:
718 #endif
719  return TRUE;
720  default:
721  return FALSE;
722  }
723 }
724 
725 static BOOLEAN Register4Accept(E_MHEG5_KEY key)
726 {
727  switch (key)
728  {
729  case MHEG5_KEY_CANCEL:
730  case MHEG5_KEY_RED:
731  case MHEG5_KEY_GREEN:
732  case MHEG5_KEY_YELLOW:
733  case MHEG5_KEY_BLUE:
734  case MHEG5_KEY_TEXT:
735  case MHEG5_KEY_UP:
736  case MHEG5_KEY_DOWN:
737  case MHEG5_KEY_LEFT:
738  case MHEG5_KEY_RIGHT:
739  case MHEG5_KEY_0:
740  case MHEG5_KEY_1:
741  case MHEG5_KEY_2:
742  case MHEG5_KEY_3:
743  case MHEG5_KEY_4:
744  case MHEG5_KEY_5:
745  case MHEG5_KEY_6:
746  case MHEG5_KEY_7:
747  case MHEG5_KEY_8:
748  case MHEG5_KEY_9:
749  case MHEG5_KEY_SELECT:
750 #ifdef INCLUDE_RECORD_KEY
751  case MHEG5_KEY_RECORD:
752 #endif
753  return TRUE;
754  default:
755  return FALSE;
756  }
757 }
758 
759 static BOOLEAN Register5Accept(E_MHEG5_KEY key)
760 {
761  switch (key)
762  {
763  case MHEG5_KEY_CANCEL:
764  case MHEG5_KEY_RED:
765  case MHEG5_KEY_GREEN:
766  case MHEG5_KEY_YELLOW:
767  case MHEG5_KEY_BLUE:
768  case MHEG5_KEY_TEXT:
769  case MHEG5_KEY_UP:
770  case MHEG5_KEY_DOWN:
771  case MHEG5_KEY_LEFT:
772  case MHEG5_KEY_RIGHT:
773  case MHEG5_KEY_SELECT:
774 #ifdef INCLUDE_RECORD_KEY
775  case MHEG5_KEY_RECORD:
776 #endif
777  return TRUE;
778  default:
779  return FALSE;
780  }
781 }
782 
783 static BOOLEAN Register6Accept(E_MHEG5_KEY key)
784 {
785  switch (key)
786  {
787  case MHEG5_KEY_CANCEL:
788  case MHEG5_KEY_RED:
789  case MHEG5_KEY_GREEN:
790  case MHEG5_KEY_YELLOW:
791  case MHEG5_KEY_BLUE:
792  case MHEG5_KEY_TEXT:
793  case MHEG5_KEY_UP:
794  case MHEG5_KEY_DOWN:
795  case MHEG5_KEY_LEFT:
796  case MHEG5_KEY_RIGHT:
797  case MHEG5_KEY_0:
798  case MHEG5_KEY_1:
799  case MHEG5_KEY_2:
800  case MHEG5_KEY_3:
801  case MHEG5_KEY_4:
802  case MHEG5_KEY_5:
803  case MHEG5_KEY_6:
804  case MHEG5_KEY_7:
805  case MHEG5_KEY_8:
806  case MHEG5_KEY_9:
807  case MHEG5_KEY_SELECT:
808 #ifdef INCLUDE_ICS
809  case MHEG5_KEY_STOP:
810  case MHEG5_KEY_PLAY:
811  case MHEG5_KEY_PAUSE:
813  case MHEG5_KEY_SKIP_FWD:
814  case MHEG5_KEY_SKIP_BACK:
815  case MHEG5_KEY_FAST_FWD:
816  case MHEG5_KEY_REWIND:
817 #endif
818 #ifdef INCLUDE_RECORD_KEY
819  case MHEG5_KEY_RECORD:
820 #endif
821  return TRUE;
822  default:
823  return FALSE;
824  }
825 }
826 
827 #ifdef INCLUDE_FREESAT
828 static BOOLEAN Register7Accept(E_MHEG5_KEY key)
829 {
830  switch (key)
831  {
832  case MHEG5_KEY_CANCEL:
833  case MHEG5_KEY_RED:
834  case MHEG5_KEY_GREEN:
835  case MHEG5_KEY_YELLOW:
836  case MHEG5_KEY_BLUE:
837  case MHEG5_KEY_TEXT:
838  case MHEG5_KEY_UP:
839  case MHEG5_KEY_DOWN:
840  case MHEG5_KEY_LEFT:
841  case MHEG5_KEY_RIGHT:
842  case MHEG5_KEY_0:
843  case MHEG5_KEY_1:
844  case MHEG5_KEY_2:
845  case MHEG5_KEY_3:
846  case MHEG5_KEY_4:
847  case MHEG5_KEY_5:
848  case MHEG5_KEY_6:
849  case MHEG5_KEY_7:
850  case MHEG5_KEY_8:
851  case MHEG5_KEY_9:
852  case MHEG5_KEY_SELECT:
853  case MHEG5_KEY_INFO:
854 #ifdef INCLUDE_ICS
855  case MHEG5_KEY_STOP:
856  case MHEG5_KEY_PLAY:
857  case MHEG5_KEY_PAUSE:
859  case MHEG5_KEY_SKIP_FWD:
860  case MHEG5_KEY_SKIP_BACK:
861  case MHEG5_KEY_FAST_FWD:
862  case MHEG5_KEY_REWIND:
863 #endif
864 #ifdef INCLUDE_RECORD_KEY
865  case MHEG5_KEY_RECORD:
866 #endif
867  return TRUE;
868  default:
869  return FALSE;
870  }
871 }
872 
873 #endif /* INCLUDE_FREESAT */
874 
875 #ifdef INCLUDE_NZ_PROFILE
876 
877 static BOOLEAN Register13Accept(E_MHEG5_KEY key)
878 {
879  switch (key)
880  {
881  case MHEG5_KEY_CANCEL:
882  case MHEG5_KEY_RED:
883  case MHEG5_KEY_GREEN:
884  case MHEG5_KEY_YELLOW:
885  case MHEG5_KEY_BLUE:
886  case MHEG5_KEY_TEXT:
887  case MHEG5_KEY_EPG:
888  return TRUE;
889  default:
890  return FALSE;
891  }
892 }
893 
894 static BOOLEAN Register14Accept(E_MHEG5_KEY key)
895 {
896  switch (key)
897  {
898  case MHEG5_KEY_CANCEL:
899  case MHEG5_KEY_RED:
900  case MHEG5_KEY_GREEN:
901  case MHEG5_KEY_YELLOW:
902  case MHEG5_KEY_BLUE:
903  case MHEG5_KEY_TEXT:
904  case MHEG5_KEY_UP:
905  case MHEG5_KEY_DOWN:
906  case MHEG5_KEY_LEFT:
907  case MHEG5_KEY_RIGHT:
908  case MHEG5_KEY_0:
909  case MHEG5_KEY_1:
910  case MHEG5_KEY_2:
911  case MHEG5_KEY_3:
912  case MHEG5_KEY_4:
913  case MHEG5_KEY_5:
914  case MHEG5_KEY_6:
915  case MHEG5_KEY_7:
916  case MHEG5_KEY_8:
917  case MHEG5_KEY_9:
918  case MHEG5_KEY_SELECT:
919  case MHEG5_KEY_EPG:
920  return TRUE;
921  default:
922  return FALSE;
923  }
924 }
925 
926 static BOOLEAN Register15Accept(E_MHEG5_KEY key)
927 {
928  switch (key)
929  {
930  case MHEG5_KEY_CANCEL:
931  case MHEG5_KEY_RED:
932  case MHEG5_KEY_GREEN:
933  case MHEG5_KEY_YELLOW:
934  case MHEG5_KEY_BLUE:
935  case MHEG5_KEY_TEXT:
936  case MHEG5_KEY_UP:
937  case MHEG5_KEY_DOWN:
938  case MHEG5_KEY_LEFT:
939  case MHEG5_KEY_RIGHT:
940  case MHEG5_KEY_SELECT:
941  case MHEG5_KEY_EPG:
942  return TRUE;
943  default:
944  return FALSE;
945  }
946 }
947 
948 static BOOLEAN Register16Accept(E_MHEG5_KEY key)
949 {
950  switch (key)
951  {
952  case MHEG5_KEY_CANCEL:
953  case MHEG5_KEY_RED:
954  case MHEG5_KEY_GREEN:
955  case MHEG5_KEY_YELLOW:
956  case MHEG5_KEY_BLUE:
957  case MHEG5_KEY_TEXT:
958  case MHEG5_KEY_UP:
959  case MHEG5_KEY_DOWN:
960  case MHEG5_KEY_LEFT:
961  case MHEG5_KEY_RIGHT:
962  case MHEG5_KEY_0:
963  case MHEG5_KEY_1:
964  case MHEG5_KEY_2:
965  case MHEG5_KEY_3:
966  case MHEG5_KEY_4:
967  case MHEG5_KEY_5:
968  case MHEG5_KEY_6:
969  case MHEG5_KEY_7:
970  case MHEG5_KEY_8:
971  case MHEG5_KEY_9:
972  case MHEG5_KEY_SELECT:
973  case MHEG5_KEY_EPG:
974 #ifdef INCLUDE_ICS
975  case MHEG5_KEY_STOP:
976  case MHEG5_KEY_PLAY:
977  case MHEG5_KEY_PAUSE:
979  case MHEG5_KEY_SKIP_FWD:
980  case MHEG5_KEY_SKIP_BACK:
981  case MHEG5_KEY_FAST_FWD:
982  case MHEG5_KEY_REWIND:
983 #endif
984  return TRUE;
985  default:
986  return FALSE;
987  }
988 }
989 
990 #endif /* INCLUDE_NZ_PROFILE*/
991 #ifdef INCLUDE_AU_PROFILE
992 
993 static BOOLEAN Register33Accept(E_MHEG5_KEY key)
994 {
995  switch (key)
996  {
997  case MHEG5_KEY_CANCEL:
998  case MHEG5_KEY_RED:
999  case MHEG5_KEY_GREEN:
1000  case MHEG5_KEY_YELLOW:
1001  case MHEG5_KEY_BLUE:
1002  case MHEG5_KEY_TEXT:
1003  case MHEG5_KEY_INFO:
1004  case MHEG5_KEY_EPG:
1005  return TRUE;
1006  default:
1007  return FALSE;
1008  }
1009 }
1010 
1011 static BOOLEAN Register34Accept(E_MHEG5_KEY key)
1012 {
1013  switch (key)
1014  {
1015  case MHEG5_KEY_CANCEL:
1016  case MHEG5_KEY_RED:
1017  case MHEG5_KEY_GREEN:
1018  case MHEG5_KEY_YELLOW:
1019  case MHEG5_KEY_BLUE:
1020  case MHEG5_KEY_TEXT:
1021  case MHEG5_KEY_UP:
1022  case MHEG5_KEY_DOWN:
1023  case MHEG5_KEY_LEFT:
1024  case MHEG5_KEY_RIGHT:
1025  case MHEG5_KEY_0:
1026  case MHEG5_KEY_1:
1027  case MHEG5_KEY_2:
1028  case MHEG5_KEY_3:
1029  case MHEG5_KEY_4:
1030  case MHEG5_KEY_5:
1031  case MHEG5_KEY_6:
1032  case MHEG5_KEY_7:
1033  case MHEG5_KEY_8:
1034  case MHEG5_KEY_9:
1035  case MHEG5_KEY_SELECT:
1036  case MHEG5_KEY_INFO:
1037  case MHEG5_KEY_EPG:
1038  return TRUE;
1039  default:
1040  return FALSE;
1041  }
1042 }
1043 
1044 static BOOLEAN Register35Accept(E_MHEG5_KEY key)
1045 {
1046  switch (key)
1047  {
1048  case MHEG5_KEY_CANCEL:
1049  case MHEG5_KEY_RED:
1050  case MHEG5_KEY_GREEN:
1051  case MHEG5_KEY_YELLOW:
1052  case MHEG5_KEY_BLUE:
1053  case MHEG5_KEY_TEXT:
1054  case MHEG5_KEY_UP:
1055  case MHEG5_KEY_DOWN:
1056  case MHEG5_KEY_LEFT:
1057  case MHEG5_KEY_RIGHT:
1058  case MHEG5_KEY_SELECT:
1059  case MHEG5_KEY_INFO:
1060  case MHEG5_KEY_EPG:
1061  return TRUE;
1062  default:
1063  return FALSE;
1064  }
1065 }
1066 
1067 #endif /* INCLUDE_AU_PROFILE*/
1068 
1069 
1077 {
1078  int index;
1079  U8BIT mask_byte;
1080  MHEG5String untested_bits;
1081  MHEG5Bool mask_supported;
1082 
1083  mask_supported = MHEG5TRUE;
1084  untested_bits = MHEG5stringCopy(query_mask);
1085 
1086  /*check all the keys known to MHEG5*/
1087  for (index = 0; index != TOTAL_MHEG5_KEYS; index++)
1088  {
1089  mask_byte = key_mask_values[index].byte;
1090 
1091  if (untested_bits.len > mask_byte)
1092  {
1093  if (untested_bits.data[mask_byte] & key_mask_values[index].bit)
1094  {
1095  /* check all the keys that are in the input mask*/
1096  if (!key_unsupported[index])
1097  {
1098  mask_supported = MHEG5FALSE;
1099  break;
1100  }
1101  /*turn off the bit that has just been tested*/
1102  untested_bits.data[mask_byte] &= ~key_mask_values[index].bit;
1103  }
1104  }
1105  }
1106 
1107  for (index = 0; index < untested_bits.len; index++)
1108  {
1109  /* Fail if there were characters in the mask unsupported by MHEG5*/
1110  if (untested_bits.data[index])
1111  {
1112  mask_supported = MHEG5FALSE;
1113  break;
1114  }
1115  }
1116  MHEG5stringDestruct(&untested_bits);
1117 #ifdef NOTIFY_KEYSET
1118  MH5GlueAddPostProcessFunc( NotifyKeyset );
1119 #endif
1120  return mask_supported;
1121 }
1122 
1123 static BOOLEAN IsKeypressInMask(E_MHEG5_KEY key)
1124 {
1125  MHEG5Scene *scene;
1126  BOOLEAN in_mask;
1127  scene = MHEG5getCurrentScene();
1128  if (scene != NULL && key < TOTAL_MHEG5_KEYS)
1129  {
1130  in_mask = key_mask_enable[key];
1131  }
1132  else
1133  {
1134  in_mask = FALSE;
1135  }
1136  return in_mask;
1137 }
1138 
1147 {
1148  s_keyMask_t *keyMask;
1149  U32BIT byte, key, len;
1150 #ifdef NOTIFY_KEYPRESS_REQ
1152  U16BIT count = 0;
1153 #endif
1154 
1155  /* Create an array of the keys that are required by the input mask */
1156  keyMask = key_mask_values;
1157  len = inputEventMask->len;
1158  for (key = 0; key != TOTAL_MHEG5_KEYS; key++, keyMask++)
1159  {
1160  byte = keyMask->byte;
1161  if ((byte < len) && (keyMask->bit & inputEventMask->data[byte]) != 0)
1162  {
1163  switch ((E_MHEG5_KEY)key)
1164  {
1165  case MHEG5_KEY_INFO:
1167  {
1168  key_mask_enable[key] = TRUE;
1169  }
1170  else
1171  {
1172  key_mask_enable[key] = FALSE;
1173  }
1174  break;
1175  case MHEG5_KEY_EPG:
1177  {
1178  key_mask_enable[key] = TRUE;
1179  }
1180  else
1181  {
1182  key_mask_enable[key] = FALSE;
1183  }
1184  break;
1185  default:
1186  key_mask_enable[key] = TRUE;
1187  }
1188  #ifdef NOTIFY_KEYPRESS_REQ
1189  if (key_mask_enable[key])
1190  {
1191  mask[count] = (E_MHEG5_KEY)key;
1192  count++;
1193  }
1194  #endif
1195  }
1196  else
1197  {
1198  key_mask_enable[key] = FALSE;
1199  }
1200  }
1201 
1202 #ifdef NOTIFY_KEYPRESS_REQ
1203  /* Notify the controlling application */
1204  DVB_MhegSetInputMask(mask, count);
1205 #endif
1206 }
1207 
1215 {
1216  MHEG5eventMessage_t event_msg;
1217 
1218  if ( !MH5GlueIsStarted() )
1219  {
1220  TRACE(TKEYS | TMHAPI, ("Keypress( %d ) IGNORED\n", key));
1221  return FALSE;
1222  }
1223 
1224  if ( !MH5GlueActiveState() )
1225  {
1226  TRACE(TKEYS | TMHAPI, ("Keypress( %d ) IGNORED\n", key));
1227  return FALSE;
1228  }
1229 
1230  if ( !MHEG5_IsKeyNeeded( key ))
1231  {
1232  TRACE(TKEYS | TMHAPI, ("Keypress( %d ) IGNORED\n", key));
1233  return FALSE;
1234  }
1235 
1237  event_msg.data_type = DT_VALUE;
1238  event_msg.data.keypress.key = key;
1239  if (VQ_PutMsg(&event_msg, PRTY_CRITICAL) != MHERR_OK)
1240  {
1241  TRACE(TKEYS | TMHAPI, ("Keypress( %d ) IGNORED\n", key));
1242  return FALSE;
1243  }
1244 
1245  return TRUE;
1246 }
1247 
1249 {
1250  if (promotional_linking_enabled != isEnabled)
1251  {
1252  promotional_linking_enabled = isEnabled;
1253  DVB_MhegPromotionalLinkControl(isEnabled);
1254  }
1255 }
1256 
1270 {
1271  return promotional_linking_enabled;
1272 }
1273 
1281 {
1282  if (key < TOTAL_MHEG5_KEYS)
1283  {
1284  key_unsupported[key] = TRUE;
1285  }
1286 }
1287 
1294 {
1295  if (key < TOTAL_MHEG5_KEYS)
1296  {
1297  key_unsupported[key] = FALSE;
1298  }
1299 }
1300 
1301 
1302 
BOOLEAN key_mask_enable[TOTAL_MHEG5_KEYS]
Definition: mh5keypress.c:127
Implement MHEG5 engine control functions (i.e. start/stop etc)
E_MhegErr VQ_PutMsg(S_MhegMessage *pMsg, E_PRIORITY priority)
Post event or section message on queue. Copies data into queue.
Definition: glue_queue.c:248
void MHEG5sliderEXIT(MHEG5Slider *slider)
Perform action of exit key on interacting Slider.
Definition: mh5slider.c:714
BOOLEAN MH5GlueActiveState(void)
Definition: glue_main.c:993
MHEG5Interactible interactible
Definition: mh5hypertext.h:49
Implement the MHEG5 Hypertext Class. The HyperText class is a subclass of the Text class...
void MHEG5NotifyEvent(E_MhegEvent event, U32BIT data)
Definition: mh5control.c:401
F_MSG_PROCESS proc_msg_func
Definition: glue_queue.h:198
void MHEG5_KeySupportDisabled(E_MHEG5_KEY key)
Inform MHEG5 engine that key is not supported by the platform or product. By default MHEG5 engine ass...
Definition: mh5keypress.c:1280
BOOLEAN MHEG5_IsPromotionalLinkingEnabled(void)
This function is relevant to PVR products that support NativeApplicationExtension for broadcast-trigg...
Definition: mh5keypress.c:1269
U8BIT bit
Definition: mh5keypress.c:79
const char * data
Definition: mh5gate.c:56
void MHEG5sliderUP(MHEG5Slider *slider)
Perform action of up arrow key on interacting Slider.
Definition: mh5slider.c:589
Debug tracing.
MHEG5 queue.
E_MhegEvent
Definition: mheg5_events.h:54
void DVB_MhegPromotionalLinkControl(BOOLEAN isEnabled)
This function is relevant to PVR products that support NativeApplicationExtension for broadcast-trigg...
MHEG5Final clazz
Definition: mh5root.h:55
struct s_keyMask s_keyMask_t
E_MHEG5_KEY
MHEG5String MHEG5stringCopy(MHEG5String source)
<Function description>="">
Definition: mh5base.c:574
#define TRACE_SET_TIME()
Definition: glue_debug.h:125
Implement the MHEG5 Slider Class. Slider Class. Defines the behaviour of sliders. Base class: Visible...
S_KeyPressEvent keypress
Definition: glue_queue.h:207
void MHEG5stringDestruct(MHEG5String *item)
Destruct a MHEG5String.
Definition: mh5base.c:686
void MHEG5setInputEventMask(MHEG5String *inputEventMask)
Change the input mask. This indicates which keypresses the MHEG-5 engine requires to be passed...
Definition: mh5keypress.c:1146
void(* F_MSG_PROCESS)(void *data)
Function to Process voyager message.
Definition: glue_queue.h:70
uint8_t U8BIT
Definition: techtype.h:82
long MHEG5Int
Definition: mh5base.h:73
Memory functions.
void MHEG5hypertextUP(MHEG5Hypertext *hypertext)
Definition: mh5hypertext.c:72
This file defines the profile for the MHEG engine.
void MHEG5sliderDOWN(MHEG5Slider *slider)
Perform action of down arrow key on interacting Slider.
Definition: mh5slider.c:661
#define MHEG5displayRedraw(v)
Definition: mh5display.h:47
void MHEG5PromotionalLinkControl(BOOLEAN isEnabled)
Definition: mh5keypress.c:1248
void MHEG5sliderRIGHT(MHEG5Slider *slider)
Perform action of right arrow key on interacting Slider.
Definition: mh5slider.c:625
short MHEG5Bool
Definition: mh5base.h:71
BOOLEAN key_unsupported[TOTAL_MHEG5_KEYS]
Definition: mh5keypress.c:128
E_MHEG5_KEY key
Definition: glue_queue.h:80
Event handling. Implementation of a combined queue for events and actions. This is the eventsystem wh...
MHEG5Byte * data
Definition: mh5base.h:85
int len
Definition: mh5gate.c:57
MHEG5Bool MHEG5IsInputMaskSupported(MHEG5String query_mask)
Tell whether the set of keys indicated by the input mask is supported by the receiver (this means tha...
Definition: mh5keypress.c:1076
void MHEG5hypertextDOWN(MHEG5Hypertext *hypertext)
Definition: mh5hypertext.c:108
MHEG5Bool interactionStatus
#define MHEG5TRUE
Definition: mh5base.h:49
E_DATA_TYPE data_type
Definition: glue_queue.h:199
U8BIT byte
Definition: mh5keypress.c:78
uint16_t U16BIT
Definition: techtype.h:84
BOOLEAN MHEG5_IsKeyNeeded(E_MHEG5_KEY keyPress)
Enquire from MHEG5 engine about whether a key is needed, without actually passing the key to it...
Definition: mh5keypress.c:470
Implementation of the MHEG5 Application Class Defines a set of Ingredient objects, which are shared within an application scope. Base class: Group Subclasses: None Status: Concrete class.
Implementation of the MHEG5 Scene Class Scene Class Defines a set of Ingredient objects to be activat...
with MHEG5 engine
void MHEG5interactibleInteractionCompleted(MHEG5Interactible *interactible, MHEG5Root *item)
MHEG5Bool MH5_SupportMhegProfile(E_MHEG_PROFILE profile)
Return whether Mheg profile (UK, NZ, AU, HK, SA, FREESAT) is currently supported. ...
Definition: mh5support.c:451
E_FunctionGroup
Definition: mh5keypress.c:59
MHEG5Scene * MHEG5getCurrentScene(void)
<Function description>="">
Definition: mh5scene.c:207
Key press interface with MHEG5 engine.
void MHEG5sendEvent(MHEG5Root *source, MHEG5EventType event, MHEG5Int data)
Store an event in the asynchronous event queue.
Definition: mh5queue.c:1540
#define FALSE
Definition: techtype.h:68
void MHEG5sliderLEFT(MHEG5Slider *slider)
Perform action of left arrow key on interacting Slider.
Definition: mh5slider.c:553
MHEG5Root * currentInteractible
Definition: mh5scene.h:56
MHEG5Int len
Definition: mh5base.h:84
BOOLEAN MH5GlueIsStarted(void)
Definition: glue_main.c:241
U8BIT BOOLEAN
Definition: techtype.h:99
#define TRUE
Definition: techtype.h:69
void MHEG5userInputEvent(S_KeyPressEvent *params)
Process the UserInput from the system. According to the current profile and the UserInputRegister of ...
Definition: mh5keypress.c:507
BOOLEAN MHEG5_NotifyKeyPress(E_MHEG5_KEY key)
Notify MHEG5 engine of a key press. If FALSE is returned, the external application may use the key...
Definition: mh5keypress.c:1214
Implement generic MHEG5-display functions - independent from the OSD These are generic functions used...
void MHEG5setInputEventRegister(MHEG5Int inputEventRegister)
Change the input event register. This indicates which keypresses the MHEG-5 engine requires to be pas...
Definition: mh5keypress.c:320
union s_mhg_message::@13 data
void MHEG5_KeySupportEnabled(E_MHEG5_KEY key)
Key press support is enabled. May be called after the key has been disabled by MHEG5_KeySupportDisabl...
Definition: mh5keypress.c:1293
void MHEG5entryfieldUserInput(MHEG5Entryfield *entryfield, E_MHEG5_KEY ui)
Test user input and perform required actions.
void MHEG5hypertextSELECT(MHEG5Hypertext *hypertext)
Definition: mh5hypertext.c:140
#define MHEG5FALSE
Definition: mh5base.h:48
uint32_t U32BIT
Definition: techtype.h:86
Key Press related functionality.
void MH5GlueAddPostProcessFunc(F_PostProcess func)
Definition: glue_main.c:275
Engine support utility functions for MHEG5.
Implement the MHEG5 EntryField Class. Defines an interaction widget used by the final user to edit an...
MHEG5Application * MHEG5getCurrentApplication(void)
<Function description>="">
#define TRACE(t, x)
Definition: glue_debug.h:118