MHEG5  18.9.0
MHEG5 Documentation
mh5control.c
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2004 Ocean Blue Software Ltd
4  * Copyright © 2000 Koninklijke Philips Electronics N.V
5  *
6  * This file is part of a DTVKit Software Component
7  * You are permitted to copy, modify or distribute this file subject to the terms
8  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
9  *
10  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
11  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
12  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
13  *
14  * If you or your organisation is not a member of DTVKit then you have access
15  * to this source code outside of the terms of the licence agreement
16  * and you are expected to delete this and any associated files immediately.
17  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
18  *******************************************************************************/
31 /*---includes for this file--------------------------------------------------*/
32 #include "mheg5_events.h"
33 #include "dvb_service.h"
34 #include "dvb_native.h"
35 
36 #include "mh5application.h" /* For Termination */
37 #include "mh5scene.h" /* UserInput for Scene */
38 #include "mh5queue.h" /* Events */
39 #include "glue_memory.h"
40 #include "glue_queue.h"
41 #include "glue_timers.h"
42 #include "glue_main.h"
43 #include "glue_debug.h"
44 #include "mh5display.h"
45 #include "mh5fileorm.h"
46 #include "mh5misc.h"
47 #include "mh5streamevent.h"
48 #include "mh5gate.h"
49 #include "mg_osd.h"
50 #include "mg_api.h"
51 #include "dvb_video.h"
52 #include "dvb_audio.h"
53 #ifdef INCLUDE_IC
54 #include "mh5hfs.h"
55 #include "mh5tls.h"
56 #include "mh5access.h"
57 #include "mh5hash.h"
58 #include "mh5sig.h"
59 #include "mh5cookies.h"
60 /* HTTP control */
61 #include "http_interface.h"
62 #include "mh5support.h"
63 #else
64 #if defined(INCLUDE_DSM_FG) || defined(INCLUDE_NVM)
65 #include "mh5support.h"
66 #endif
67 #endif
68 #ifdef INCLUDE_SA_PROFILE
69 #include "dvb_native.h"
70 #endif
71 #include "mh5storage.h"
72 #ifdef INCLUDE_TPS
73 #include "mh5tps.h"
74 #endif
75 
76 #ifdef INCLUDE_FREESAT
77  #include "mh5fsnvm.h"
78 #elif defined(INCLUDE_NVM)
79  #include "mh5nvm.h"
80 #endif
81 #ifndef CI_PLUS_ONLY
82  #ifdef INCLUDE_DSM_FG
83  #include "mh5filegroup.h"
84  #endif
85  #include "glue_dsmcc.h"
86  #include "dsm_control.h"
87 #endif
88 #include "mh5control.h"
89 #include "mh5keypress.h"
90 
91 #include "mheg5_ci.h"
92 #ifdef COMMON_INTERFACE
93 #include "stbci.h"
94 #endif
95 #ifdef INCLUDE_CI_PLUS
96 #include "ci_appmmi.h"
97 #endif
98 
99 /*---constant definitions for this file--------------------------------------*/
100 
101 #define MAX_HANDLERS 2
102 
103 #define ENG_STAT_STRING() (mheg_engine_status == ENG_STOPPED) ? "STOPPED" : \
104  (mheg_engine_status == ENG_DSM_STARTING) ? "STARTING DSM" : \
105  (mheg_engine_status == ENG_DSM_STARTED) ? "STARTED DSM" : \
106  (mheg_engine_status == ENG_CI_STARTING) ? "STARTING CI" : "STARTED CI"
107 
108 #define TINFO_QUIET_BIT 0x01
109 #define TINFO_NON_DESTRUCT_BIT 0x02
110 #define TINFO_EXPLICIT_CRSL_BIT 0x04
111 #define TINFO_MAP_CRSL_INIT_BIT 0x08
112 #define TINFO_NATIVE_APP_BIT 0x10
113 
114 #define LC_STATE_NONE 0x00
115 #define LC_STATE_QUIET TINFO_QUIET_BIT
116 #define LC_STATE_NDT_ENABLE TINFO_NON_DESTRUCT_BIT
117 #define LC_STATE_NATIVE_APP TINFO_NATIVE_APP_BIT
118 #define LC_STATE_MHG_TUNING 0x80
119 
120 #define INVALID_CI_MODULE 0xFFFFFFFF
121 
122 #ifndef INCLUDE_CI_PLUS
123 #define InformCiAppStopped(sc)
124 #define CI_APP_ABORT_SYSTEM 0x02
125 #else
126 #define CI_APP_ABORT_USER STB_CI_APP_ABORT_USER
127 #define CI_APP_ABORT_SYSTEM STB_CI_APP_ABORT_SYSTEM
128 #endif
129 
130 /*---local typedef structs for this file-------------------------------------*/
131 /* Engine status enumerations */
132 typedef enum
133 {
134  /* No currently running application */
136 
137  /* Starting DSM application */
139 
140  /* Currently running DSM application */
142 
143  /* Starting CI application */
145 
146  /* Currently running CI application */
149 
150 typedef enum
151 {
156 } E_SPECIAL_APP;
157 
158 /*---local (static) variable declarations for this file----------------------*/
159 
160 static E_ENGINE_STATUS mheg_engine_status = ENG_STOPPED;
161 #ifdef INCLUDE_SA_PROFILE
162 static E_ChannelStartMode chan_suppress = CHANNEL_START_NORMAL;
163 static E_SPECIAL_APP mheg_special_app = SA_NORMAL;
164 static H_Timer special_timer = 0;
165 static const char specialEpgApp[] = "DSM://navigator/epg";
166 static const char specialInfoApp[] = "DSM://navigator/info";
167 static const char specialListApp[] = "DSM://navigator/slist";
168 #endif
169 static BOOLEAN changedScreenResolution = FALSE;
170 static F_NotifyMhegEvent mhegEventHandlers[MAX_HANDLERS] = { NULL, NULL };
171 #ifdef COMMON_INTERFACE
172 /* Common Interface module ID for current CI application */
173 static U32BIT ci_module_id = INVALID_CI_MODULE;
174 #endif
175 
176 #ifndef CI_PLUS_ONLY
177 static H_Timer retryTimerHandle = 0;
178 static U32BIT ndt_new_carousel_id = INVALID_CAROUSEL_ID;
179 static U8BIT lifecycle_state = LC_STATE_NONE;
180 static S32BIT tuneServiceIndex = 0;
181 #endif
182 
183 /*---local function definitions----------------------------------------------*/
184 
185 #ifdef INCLUDE_CI_PLUS
186 static BOOLEAN EngineStartCi(U32BIT module, U8BIT *appstr, U8BIT applen,
187  U8BIT* optstr, U8BIT optlen);
188 static void CiFileAck(U32BIT module, BOOLEAN fileOK, U8BIT *pFileData, U32BIT fileSize);
189 static void CiAbortApp(U32BIT module, U8BIT *code, U32BIT length);
190 static void InformCiAppStopped(U8BIT stop_code);
191 #endif
192 
193 /*---global function definitions---------------------------------------------*/
194 extern int ASN1_MemInit(void);
195 extern void ASN1_MemExit(void);
196 
197 
204 {
205 #if defined(INCLUDE_DSM_FG) || defined(INCLUDE_NVM)
206  U32BIT nvmSize;
207 
209  {
210  nvmSize = (512 * 1024); /*512k*/
211  }
212  else // Aus
213  {
214  nvmSize = (64 * 1024); /*64k*/
215  }
216 #endif
217 
218  if (!ASN1_MemInit() || !MHEG5InitQueues())
219  {
220  TRACE(TERROR, ("ASN1_MemInit or MHEG5InitQueues FAILED"))
222  }
223  MH5_GroupInit();
224 
225 #ifdef MHEG5LOG
226  /* Set up engine debug logging */
227  #ifdef ENGINE_LOG_LEVEL
228  MHEG5LogInit(ENGINE_LOG_LEVEL);
229  #else /* #ifdef ENGINE_LOG_LEVEL */
230  /* Default to error and warning logging setting */
231  MHEG5LogInit(2);
232  #endif /* #ifdef ENGINE_LOG_LEVEL #else */
233 #endif /* MHEG5LOG */
234 
235 #ifdef INCLUDE_DSM_FG
236  FG_Initialise( cfg_params->nvmSize - nvmSize );
237 #endif
238 
239  MHEG5InitStore();
240 #ifdef INCLUDE_FREESAT
242 #elif defined(INCLUDE_NVM)
243  MHEG5nvmInitialise( nvmSize );
244 #endif
245 
246  /* Initialise the file ORM. */
248 
249 #ifdef INCLUDE_CI_PLUS
250  /* register engine with CI stack */
251  STB_CIRegisterMmiEngine(CI_MHEG5_DOMAIN_ID,EngineStartCi);
252 #endif
253 
254  TRACE(TMHBOOT, ("done"))
255 
256  return MHERR_OK;
257 }
258 
263 void MHEG5_Terminate( void )
264 {
265  TRACE(TMHBOOT, (""))
266 
267  /* Destroy the fileOrm. */
269 
270 #ifdef INCLUDE_DSM_FG
271  FG_Terminate();
272 #endif
273 
274  MHEG5ExitQueues();
275 
276  MHEG5ResetStore();
277 #ifdef INCLUDE_FREESAT
279 #elif defined(INCLUDE_NVM)
280  MHEG5nvmReset();
281 #endif
282  ASN1_MemExit();
283 }
284 
286 {
287  MHEG5Application *app;
288  MHEG5Scene *scn;
289 
291  if (app == NULL)
292  {
293  TRACE(TMHBOOT, ("No App "))
294  changedScreenResolution = FALSE;
295  }
296  else
297  {
298  TRACE(TMHBOOT, (""))
299  if (changedScreenResolution)
300  {
301  scn = MHEG5getCurrentScene();
302 
303  if (scn)
304  {
306  (U16BIT)scn->sceneCoordinateSystem[1], scn->aspectRatio );
307 
309 
310  MHEG5groupRedraw((MHEG5Root *)app );
311  MHEG5groupRedraw((MHEG5Root *)scn );
312  }
313  changedScreenResolution = FALSE;
314  }
315  else
316  {
318  }
319 
320  /* Make sure we update the screen */
323 
324  /* Send a resume event to the MHEG-5 application */
326  }
327 }
328 
329 E_MhegErr MHEG5ResetResolution( U16BIT screenWidth, U16BIT screenHeight )
330 {
331  E_MhegErr result;
332  MHEG5Root *grp;
333 
334  TRACE(TGRAPHICS, (""))
335 
336  grp = (MHEG5Root *)MHEG5getCurrentScene();
337  if (grp)
338  {
339  MHEG5groupClearImages( grp );
340  }
342  if (grp)
343  {
344  MHEG5groupClearImages( grp );
345  }
346 
347  MG_Terminate();
348 
349  result = MG_Initialise( screenWidth, screenHeight, 0 );
350 
351  if (grp) /*application*/
352  {
353  changedScreenResolution = TRUE;
354  /* wait for Resume */
355  }
356  return result;
357 }
358 
359 #if defined(INCLUDE_NVM) || defined(INCLUDE_DSM_FG)
360 
361 static void MHEG5FactoryReset( void *dummy )
362 {
363 #ifdef INCLUDE_DSM_FG
364  FG_FactoryReset();
365 #endif
366 
367  MHEG5ResetStore();
368 #ifdef INCLUDE_FREESAT
370 #elif defined(INCLUDE_NVM)
371  MHEG5nvmReset();
372 #endif
373 }
374 
383 E_MhegErr MHEG5_ExecuteFactoryReset(void)
384 {
385  E_MhegErr result;
386  MHEG5eventMessage_t event_msg;
387 
388  event_msg.proc_msg_func = MHEG5FactoryReset;
389  event_msg.data_type = DT_NONE;
390 
391  result = VQ_PutMsg(&event_msg, PRTY_CRITICAL);
392  if (result != MHERR_OK)
393  {
394  TRACE(TERROR, ("VQ_PutMsg Failed"));
395  }
396  return result;
397 }
398 
399 #endif /* INCLUDE_NVM || INCLUDE_DSM_FG */
400 
402 {
403  int i;
404  for (i = 0; i != MAX_HANDLERS; i++)
405  {
406  if (mhegEventHandlers[i] != NULL)
407  {
408  mhegEventHandlers[i]( event, data );
409  }
410  }
411 }
412 
414 {
415  int i;
416  for (i = 0; i != MAX_HANDLERS; i++)
417  {
418  if (mhegEventHandlers[i] == NULL)
419  {
420  mhegEventHandlers[i] = handler;
421  return TRUE;
422  }
423  }
424  return FALSE;
425 }
426 
428 {
429  int i;
430  for (i = 0; i != MAX_HANDLERS; i++)
431  {
432  if (mhegEventHandlers[i] == handler)
433  {
434  mhegEventHandlers[i] = NULL;
435  break;
436  }
437  }
438 }
439 
447 void MHEG5engineStart( U8BIT *app_name, BOOLEAN isCi, BOOLEAN special )
448 {
449  MHEG5String workingDir;
450 #ifdef INCLUDE_IC
451  HttpCookieManager_t manager;
452 #endif
453 
454  if (mheg_engine_status != ENG_STOPPED)
455  {
456  TRACE(TMHBOOT, ("Engine Status not stopped",mheg_engine_status))
457  }
458  else
459  {
460  #ifdef INCLUDE_IC
461  /* Completely clear the hybrid file system */
463  /* Clear the TLS certificate store */
465  /* Clear server access information */
467  /* Clear verification information */
469  /* Clear signature certificate cache */
471  /* Clear current IC status */
472  MHEG5clearICStatus();
473  /* Set cookie manager */
474  manager.parse = MHEG5CookieParse;
477  httpSetCookieManager(&manager);
478  /* Set User Agent */
480  /* Set working dir to hybrid:// if IC is enabled */
482  {
483  workingDir.data = (U8BIT *)"hybrid://";
484  workingDir.len = 9;
485  }
486  else
487  #endif
488  {
489  workingDir.data = (U8BIT *)"DSM://";
490  workingDir.len = 6;
491  }
492  MHEG5setWorkingDir(workingDir);
493 
494  #ifdef TRACING
495  if (app_name)
496  {
497  TRACE(TMHBOOT, ("Eng Start %s", (char *)app_name))
498  }
499  else
500  {
501  TRACE(TMHBOOT, ("Engine Start Auto"))
502  }
503  #endif
504 
505  /* Need to set status before calling Bootup func, because
506  * MHEG5NotifyEngineStarted could be called before returning from Bootup
507  */
508  mheg_engine_status = isCi ? ENG_CI_STARTING : ENG_DSM_STARTING;
509 
511 
512  if (MHEG5applicationBootup((char *)app_name,isCi|special) == MHEG5ERR_NOERROR)
513  {
514  if (MH5GlueActiveState() || special)
515  {
516  TRACE(TMHBOOT, ("start processing"));
518  }
519  else
520  {
521  TRACE(TMHBOOT, ("Waiting state!"));
522  }
523  }
524  else
525  {
526  TRACE(TERROR, ("bootup failed ci?=%d",isCi));
527  if (!special)
528  {
529  if (isCi)
530  {
533  }
534  else
535  {
536  /* Unable to start the autoboot application. */
538  }
539  }
540  mheg_engine_status = ENG_STOPPED;
541  }
542  }
543 }
544 
546 {
547  switch (mheg_engine_status)
548  {
549  case ENG_DSM_STARTING:
551  mheg_engine_status = ENG_DSM_STARTED;
552  break;
553  case ENG_CI_STARTING:
555  mheg_engine_status = ENG_CI_STARTED;
556  break;
557  default:
558  TRACE(TERROR, ("Unexpected state"));
559  }
560 }
561 
562 #ifndef CI_PLUS_ONLY
563 
565 {
566  TRACE(TPERFORM | TSTATE, ("engine_status=%s", ENG_STAT_STRING()))
567  if (mheg_engine_status == ENG_DSM_STARTED)
568  {
569  /* Non-destructive tuning - see DBook6.1 sec 16.2.9 */
571 
573 
575 
577 
578  #ifdef INCLUDE_IC
582  #endif
583  }
584 }
585 
587 {
588  switch (result)
589  {
590  case FS_STATUS_OK:
591  break;
592 
593  default:
594  /* Signal to the controlling application that an internal error has ocurred */
595  TRACE(TERROR, ("autoboot object failed"));
597  /* fallthrough */
598 
599  case FS_STATUS_NONE:
600  /* did not find data_broadcast_id with 0x0106 (i.e. not DSMCC with MHEG). Probably HbbTv DSM-CC */
601  MHEG5NotifyEngineStartFailed(); /* Sets timer to restart, and set state to 'stopped' */
602  }
603 }
604 
605 static void StartAutoboot(void *dummy)
606 {
607  if (mheg_engine_status > ENG_DSM_STARTING)
608  {
609  TRACE(TERROR, ("Unexpected state %d", mheg_engine_status));
610  }
611  else
612  {
613  TRACE(TMHBOOT, (""))
614  #ifdef INCLUDE_IC
617  #endif
618  /* (re)start the autoboot application */
620  }
621 }
622 
623 static void startRetryMhegFunc( BOOLEAN triggered, void *callerRef, H_Timer timerHandle )
624 {
625  MHEG5eventMessage_t event_msg;
626 
627  TRACE(TMHBOOT, (" trig=%d", triggered))
628 
629  if (triggered == TRUE)
630  {
631  /* Maybe could check that DSM-CC is still booted? */
632  event_msg.proc_msg_func = StartAutoboot;
633  event_msg.data_type = DT_NONE;
634  VQ_PutMsg(&event_msg, PRTY_NORMAL);
635  }
636 }
637 
638 #endif /* !CI_PLUS_ONLY */
639 
641 {
642  TRACE(TMHBOOT, (" engine_status=%s", ENG_STAT_STRING()))
643  switch (mheg_engine_status)
644  {
645  #ifndef CI_PLUS_ONLY
646  case ENG_DSM_STARTING:
647  if (mhegTimerCreate( 2000 /*msecs*/,
648  (F_TimerCallback) startRetryMhegFunc,
649  0, &retryTimerHandle ) == MHERR_OK)
650  {
651  TRACE(TMHBOOT, ("started timer"))
652  }
653  else
654  {
655  TRACE(TERROR, ("mhegTimerCreate FAILED"));
656  }
657  #ifdef INCLUDE_SA_PROFILE
658  if (special_timer != 0)
659  {
660  mhegTimerDestroy(special_timer);
661  special_timer = 0;
662  }
663  mheg_special_app = SA_NORMAL;
664  #endif
665  break;
666  #endif /* !CI_PLUS_ONLY */
667 
668  case ENG_CI_STARTING:
671  break;
672 
673  default:
674  TRACE(TERROR, ("Unexpected state"));
675  }
676  mheg_engine_status = ENG_STOPPED;
677 }
678 
680 {
681  switch (mheg_engine_status)
682  {
683  case ENG_CI_STARTED:
684  TRACE(TPERFORM, ("MHEG5_CI_APPLICATION_STOPPED"))
687  break;
688 
689  case ENG_DSM_STARTED:
690  TRACE(TPERFORM, ("MHEG5_DSM_APPLICATION_STOPPED"))
692  #ifdef INCLUDE_SA_PROFILE
693  if (special_timer != 0)
694  {
695  mhegTimerDestroy(special_timer);
696  special_timer = 0;
697  }
698  mheg_special_app = SA_NORMAL;
699  #endif
700  break;
701 
702  default:
703  break;
704  }
705  MH5GlueSetMainPostFunc( NULL );
706 }
707 
713 {
714  MHEG5Scene *scene;
715  MHEG5Application *application;
716  BOOLEAN update;
717  MHEG5String workingDir = {0,NULL};
718 
719  /* Check if currently engine starting */
721 
722  /* Notify component that start attempt has been aborted */
723  if (mheg_engine_status == ENG_CI_STARTED)
724  {
725  TRACE(TPERFORM, ("MHEG5_CI_APPLICATION_STOPPED"))
727  InformCiAppStopped(CI_APP_ABORT_USER);
728  }
729 
730  /* Prevent event processing while we destruct the scene and application,
731  * And reset the event and action queues*/
733 
734  /* Abort any pending file loads */
736 
737  update = MH5GlueActiveState();
738 
739  application = MHEG5getCurrentApplication();
740  if (application != 0)
741  {
742  scene = MHEG5getCurrentScene();
743  if (scene != 0)
744  {
745  if (!update)
746  {
747  /* Engine is NOT active, so as far as MHEG is concerned there is
748  * "stream continuance". Importantly, setting this flag prevents
749  * MHEG5displayUpdate() call in MHEG5streamDeactivate() */
750  application->streamContinuanceFlag = MHEG5TRUE;
751  }
752  MHEG5sceneDestruct(scene);
753  MHEG5sceneFree(scene);
754  MHEG5freeMem(scene);
755  }
756 
757  /* During destruction of an application triggered by Quit, Launch or Spawn
758  * actions, any stream decoder associated with Stream objects are not
759  * stopped. See UK1.05 section 6.3.4
760  */
761  application->streamContinuanceFlag = MHEG5TRUE;
762  MHEG5applicationDestruct(application);
763  MHEG5applicationFree(application);
764  MHEG5freeMem(application);
765 
766  /* Notify that the final Application has Quit. */
768  }
769  /* Reset the media decoders to their default state */
771 
772  /* Clear current service */
774 
775 #ifdef INCLUDE_NATIVE_APP
777 #endif
778 
779  /* Force the display to be cleared */
780  if (update)
781  {
783  }
784 
785  #ifdef INCLUDE_IC
786  /* Clear cookie manager */
787  httpSetCookieManager(NULL);
788  /* Completely clear the hybrid file system */
790  /* Clear the TLS certificate store */
792  /* Clear server access information */
794  /* Clear verification information */
796  /* Clear signature certificate cache */
798  /*Clear the stored cookies*/
800  /* Clear current IC status */
801  MHEG5clearICStatus();
802  #endif
803 
804  MHEG5setWorkingDir(workingDir);
805 
806  /* Clear the MHEG-5 application stack */
808 
809  /* Reset the event processing enable flag. This will allow the MHEG-5 engine
810  * to recover in the case of programming errors leaving events processing
811  * disabled.
812  */
814 #ifdef INCLUDE_SA_PROFILE
815  if (special_timer != 0)
816  {
817  mhegTimerDestroy(special_timer);
818  special_timer = 0;
819  }
820  mheg_special_app = SA_NORMAL;
821 #endif
822  mheg_engine_status = ENG_STOPPED;
823 }
824 
825 #ifndef CI_PLUS_ONLY
826 
832 {
833  if (mheg_engine_status == ENG_DSM_STARTED ||
834  mheg_engine_status == ENG_DSM_STARTING)
835  {
837  }
838  lifecycle_state = LC_STATE_NONE;
839 }
840 
853 {
854  MHEG5Bool rc = MHEG5FALSE;
855  TRACE(TSTATE, ("LCS=0x%x, serviceIndex=%d", lifecycle_state, serviceIndex))
856  if (serviceIndex != -1)
857  {
858  tuneServiceIndex = serviceIndex;
859  lifecycle_state |= LC_STATE_MHG_TUNING;
860  /* Call the environment's tune index function */
861  if (DVB_MhegTuneIndex(serviceIndex) == MHERR_OK)
862  {
863  rc = MHEG5TRUE;
864  }
865  }
866  return rc;
867 }
868 
883 {
884  if (tuneInfo & TINFO_QUIET_BIT)
885  {
886  lifecycle_state |= LC_STATE_QUIET;
887  }
888  else
889  {
890  lifecycle_state &= ~LC_STATE_QUIET;
891  }
892 
893  if (tuneInfo & TINFO_NON_DESTRUCT_BIT)
894  {
895  lifecycle_state |= LC_STATE_NDT_ENABLE;
896 
897  if (tuneInfo & TINFO_EXPLICIT_CRSL_BIT)
898  {
899  ndt_new_carousel_id = (tuneInfo >> 8) & 0xff;
900  }
901  else if (tuneInfo & TINFO_MAP_CRSL_INIT_BIT)
902  {
903  ndt_new_carousel_id = INVALID_CAROUSEL_ID;
904  }
905  else
906  {
907  /* new carousel id will be same as current one */
908  ndt_new_carousel_id = DSMCC_CurrentCarouselId( MHEG5_DsmccInstance());
909  }
910  }
911  else
912  {
913  lifecycle_state &= ~LC_STATE_NDT_ENABLE;
914  }
915 
916  if (tuneInfo & TINFO_NATIVE_APP_BIT)
917  {
918  lifecycle_state |= LC_STATE_NATIVE_APP;
919  }
920  else
921  {
922  lifecycle_state &= ~LC_STATE_NATIVE_APP;
923  }
924 
925  TRACE(TSTATE, ("LCS=0x%x", lifecycle_state))
926 }
927 
935 {
937  TRACE(TSTATE | TTUNE, ("LCS=0x%x", lifecycle_state))
938  if (lifecycle_state & LC_STATE_MHG_TUNING)
939  {
940  if (tuneServiceIndex == serviceIndex)
941  {
942  if (lifecycle_state & LC_STATE_QUIET)
943  {
944  suppress = CHANNEL_START_QUIETLY;
945  }
946  else if (lifecycle_state & LC_STATE_NDT_ENABLE)
947  {
949  }
950  }
951  }
952  return suppress;
953 }
954 
955 U32BIT MHEG5tuneProcess( S_DvbLocator *pDvbLoc, S32BIT serviceIndex )
956 {
957  U32BIT cid;
958 #ifdef INCLUDE_TPS
959  BOOLEAN ndt = FALSE;
960 #endif
961 #ifdef INCLUDE_NATIVE_APP
962  BOOLEAN native_app_ok = TRUE;
963 #endif
964 #ifdef INCLUDE_SA_PROFILE
965  chan_suppress = MHEG5_GetTuningInfoMode(serviceIndex);
966 #endif
967  TRACE(TSTATE | TTUNE, ("serv_id=%d,net_id=%d", pDvbLoc->service_id, pDvbLoc->original_network_id))
968  cid = INVALID_CAROUSEL_ID;
969  if (pDvbLoc->service_id == 0 || pDvbLoc->original_network_id == 0)
970  {
971  /* NDT failed */
972  TRACE(TERROR, ("NDT Failed serv_id=%d,net_id=%d", pDvbLoc->service_id, pDvbLoc->original_network_id))
974  }
975  else
976  {
977  if (lifecycle_state & LC_STATE_MHG_TUNING)
978  {
979  if (tuneServiceIndex == serviceIndex)
980  {
981  TRACE(TSTATE | TSTRM | TTUNE, (" MHEG Tune to service_id=0x%x(%d)", pDvbLoc->service_id, pDvbLoc->service_id))
982  #ifdef INCLUDE_NATIVE_APP
983  if (lifecycle_state & LC_STATE_NATIVE_APP)
984  {
985  native_app_ok = FALSE;
986  }
987  #endif
988  if (lifecycle_state & LC_STATE_NDT_ENABLE)
989  {
990  TRACE(TSTATE | TFILE | TSTRM | TTUNE, ("==== Non Destructive Tune (crsl=0x%x) =====", ndt_new_carousel_id))
991  cid = ndt_new_carousel_id;
992  #ifdef INCLUDE_TPS
993  ndt = TRUE;
994  #endif
995  }
996  else
997  {
998  TRACE(TSTATE | TTUNE, (" MHEG5 Tune "))
999  }
1000  lifecycle_state &= ~LC_STATE_MHG_TUNING;
1001  }
1002  else
1003  {
1004  TRACE(TERROR, ("Supposed to be MHEG tune, but wrong service: serv_id=%d", pDvbLoc->service_id))
1005  /* Resquest for NDT happened just before user did a channel change
1006  * - this is the user's channel change, so we must destroy the MHEG application */
1008  }
1009  }
1010  else
1011  {
1012  TRACE(TSTATE | TTUNE, (" Normal Tune "))
1013  }
1014 #ifdef INCLUDE_TPS
1015  if (!ndt)
1016  {
1017  MHEG5TpsSetCurrentService(pDvbLoc);
1018  }
1019 #endif
1020  }
1021 
1022 #ifdef INCLUDE_SA_PROFILE
1023  if (chan_suppress == CHANNEL_START_NORMAL &&
1025  FG_FileExists(ORIGIN_DSM, specialInfoApp) == FS_STATUS_OK)
1026  {
1027  /*Launch Now/Next Banner*/
1028  MHEG5StartInfoApp(TRUE);
1029  }
1030 #endif
1031 #ifdef INCLUDE_NATIVE_APP
1032  MHEG5PromotionalLinkControl( native_app_ok );
1033 #endif
1034  return cid;
1035 }
1036 
1038 {
1039  TRACE(TMHBOOT | TPERFORM | TSTATE, ("engine_status=%s", ENG_STAT_STRING()))
1040  if (mheg_engine_status == ENG_DSM_STARTED)
1041  {
1042  /* This was an NDT, process any pending requests in fileOrm */
1044  }
1045 #ifdef INCLUDE_SA_PROFILE
1046  else if (chan_suppress == CHANNEL_START_NORMAL &&
1048  mheg_special_app != SA_INFO)
1049  {
1050  /*Launch Now/Next Banner*/
1051  MHEG5StartInfoApp(TRUE);
1052  }
1053 #endif
1054 
1055  else
1056  {
1057  StartAutoboot(0);
1058  }
1059 }
1060 
1062 {
1063  BOOLEAN isNdt;
1064  isNdt = ((lifecycle_state & (LC_STATE_MHG_TUNING|LC_STATE_NDT_ENABLE))
1067 #ifdef INCLUDE_DSM_FG
1069 #endif
1070 }
1071 
1072 #endif /* CI_PLUS_ONLY*/
1073 
1075 {
1076  BOOLEAN isNdt = FALSE;
1077 #ifndef CI_PLUS_ONLY
1078  assert( *native_app_ok == TRUE );
1079  TRACE(TSTATE | TTUNE, ("LCS=0x%x", lifecycle_state))
1080  if (lifecycle_state & LC_STATE_MHG_TUNING)
1081  {
1082  if (lifecycle_state & LC_STATE_NDT_ENABLE)
1083  {
1084  TRACE(TSTATE | TFILE | TSTRM, ("==== About to do Non Destructive Tune ====="))
1085  isNdt = TRUE;
1086  }
1087  if (lifecycle_state & LC_STATE_NATIVE_APP)
1088  {
1089  *native_app_ok = FALSE;
1090  }
1091  }
1092 #endif /* CI_PLUS_ONLY*/
1093  return isNdt;
1094 }
1095 
1097 {
1098  BOOLEAN native_app_ok = TRUE;
1099 
1100  TRACE(TSTATE, ("action=0x%x Eng_stat=%s", action, ENG_STAT_STRING()))
1101  /* Check application running */
1102  if (mheg_engine_status == ENG_STOPPED)
1103  {
1104  TRACE(TERROR, ("no application running"));
1105  action = 0;
1106  }
1107  else
1108  {
1109  if ( action & STOP_ACTION_CI_PLUS_NDT )
1110  {
1111  /* Non-destructive tuning for CI Plus */
1112  TRACE(TSTATE,(""))
1115  }
1116  else if ((action & STOP_ACTION_MHEG_TUNE) == 0 ||
1117  !MHEG5isProcessingNDT(&native_app_ok))
1118  {
1119  action = 0;
1120  if (mheg_engine_status != ENG_STOPPED)
1121  {
1123  }
1124  }
1125  else
1126  {
1127  TRACE(TSTATE, (""))
1128  /* Non-destructive tuning - see DBook6.1 sec 16.2.9
1129  * clear app stack (except current application) */
1132  /*DBook spec is not clear about whether promotional linking should be changed
1133  * when doing NDT and still apply the native_app bit of tune-info
1134  - so we will apply it below anyway*/
1135  }
1136  #ifdef INCLUDE_NATIVE_APP
1137  MHEG5PromotionalLinkControl( native_app_ok );
1138  #endif
1139  }
1140 
1141 #ifdef MHG_TRACK_MEM
1142  /* -- Debug code - print engine memory tracking state */
1143  TRACE(TMEMORY, (""))
1144  mh5emt_print(3 << SRCMEM_APP);
1145 #endif
1146 
1147 #ifdef MHEG5_COMP_MEM_TRACKING
1148  /* -- Debug code - print component memory tracking state */
1149  mh5cmt_print();
1150 #endif
1151 #ifdef SRF_MEM_DGB
1152  OSD_DbgListSrf();
1153 #endif
1154 
1155  return action;
1156 }
1157 
1159 {
1160  return (mheg_engine_status == ENG_CI_STARTED ||
1161  mheg_engine_status == ENG_CI_STARTING) ? TRUE : FALSE;
1162 }
1163 
1164 void MHEG5StartReboot(void *param)
1165 {
1167  {
1168  TRACE(TMHBOOT, ("CI application running - ignore external reboot"))
1169  }
1170 #ifndef CI_PLUS_ONLY
1171  else
1172  {
1175  }
1176 #endif
1177  if (param != NULL)
1178  {
1180  }
1181 }
1182 
1183 void MHEG5Pause(void)
1184 {
1185  TRACE(TSTATE|TMHBOOT, ("engine_status=%s", ENG_STAT_STRING()))
1186  MH5GlueSetMainPostFunc( NULL );
1189 }
1190 
1191 void MHEG5Resume(void)
1192 {
1193  TRACE(TSTATE|TMHBOOT, ("engine_status=%s", ENG_STAT_STRING()))
1194  if (mheg_engine_status != ENG_STOPPED)
1195  {
1198  }
1201 }
1202 
1203 static void RefreshStreams(S_DvpEventType *param)
1204 {
1205  if (mheg_engine_status == ENG_DSM_STARTED)
1206  {
1208  }
1209 }
1210 
1211 void MHEG5RefreshStreams(U16BIT service_id)
1212 {
1213  MHEG5eventMessage_t event_msg;
1214  event_msg.proc_msg_func = (F_MSG_PROCESS)RefreshStreams;
1215  event_msg.data_type = DT_VALUE;
1216  event_msg.data.dvpEvent.eType = DVB_EVENT_NONE;
1217  event_msg.data.dvpEvent.eData = service_id;
1218  if (VQ_PutMsg(&event_msg, PRTY_HIGH) != MHERR_OK)
1219  {
1220  DBGTRACE(TERROR,"")
1221  }
1222 }
1223 
1224 static void RefreshDefaultAudio(S_DvpEventType *param)
1225 {
1226  if (mheg_engine_status == ENG_DSM_STARTED)
1227  {
1229  }
1230 }
1231 
1233 {
1234  MHEG5eventMessage_t event_msg;
1235  event_msg.proc_msg_func = (F_MSG_PROCESS)RefreshDefaultAudio;
1236  event_msg.data_type = DT_VALUE;
1237  event_msg.data.dvpEvent.eType = DVB_EVENT_NONE;
1238  event_msg.data.dvpEvent.eData = MHEG5DefaultServiceId();
1239  if (VQ_PutMsg(&event_msg, PRTY_HIGH) != MHERR_OK)
1240  {
1241  DBGTRACE(TERROR,"")
1242  }
1243 }
1244 
1245 #ifdef COMMON_INTERFACE
1246 U32BIT MHEG5GetCiModuleId(void)
1247 {
1248  return ci_module_id;
1249 }
1250 
1257 static void startCIApplication(S_CiStart *params)
1258 {
1259  ASSERTL1((params->name.zptr));
1260 
1261  /* Check if any application currently running *
1262  * Stop any currently running applications. */
1264  {
1266  }
1267 #ifndef CI_PLUS_ONLY
1268  else
1269  {
1271  }
1272 #endif
1273 
1274  ci_module_id = params->module_id;
1275 
1276  /* Attempt start */
1277  DPL3(("INFO: startCIApplication - calling engineStart\n"));
1278  MHEG5engineStart(params->name.zptr, TRUE, FALSE);
1279 
1280  /* Free memory allcated for application name in MHEG5_StartCIApplication */
1281  SYS_Free(params->name.zptr);
1282 }
1283 
1311 E_MhegErr MHEG5_StartCIApplication(U32BIT module, U8BIT *application)
1312 {
1313  MHEG5eventMessage_t event_msg;
1314  E_MhegErr cqu_err;
1315 
1316  /* Check function parameter */
1317  if ((application == NULL) || (strlen((char *)application) == 0))
1318  {
1319  /* Invalid filename */
1320  DPL1(("- Invalid CI application name\n"));
1321  return MHERR_BAD_PARAMETER;
1322  }
1323 
1324  if (!MH5GlueIsStarted())
1325  {
1326  return MHERR_COMP_NOT_STARTED;
1327  }
1328 
1329  /* Set up event structure and associated data */
1330  event_msg.proc_msg_func = (F_MSG_PROCESS)startCIApplication;
1331  event_msg.data_type = DT_ALLOC;
1332  event_msg.data.ciStart.module_id = module;
1333 
1334  /* Allocate memory for pathname parameter, remembering the "CI://" and
1335  * terminating null.
1336  */
1337  event_msg.data.ciStart.name.zptr = (U8BIT *)MHEG5getMem(strlen((char *)application) + 6);
1338  if (event_msg.data.string.zptr == NULL)
1339  {
1340  DPL1(("- Memory Allocation Error\n"));
1341  return MHERR_BAD_PARAMETER;
1342  }
1343 
1344  /* Copy pathname parameter */
1345  event_msg.data.ciStart.name.zptr[0] = '\0';
1346  if (strncmp((char *)application, "CI://", 5) != 0)
1347  {
1348  strcpy((char *)event_msg.data.ciStart.name.zptr, "CI://");
1349  }
1350  strcat((char *)event_msg.data.ciStart.name.zptr, (char *)application);
1351 
1352  /* Send start event to component */
1353  cqu_err = VQ_PutMsg(&event_msg, PRTY_CRITICAL);
1354  if (cqu_err != MHERR_OK)
1355  {
1356  TRACE(TERROR, ("VQ_PutMsg Failed %d", cqu_err));
1357  MHEG5freeMem(event_msg.data.ciStart.name.zptr);
1360  return MHERR_INTERNAL;
1361  }
1362 
1363  return MHERR_OK;
1364 }
1365 
1373 static void stopCIApplications(MHEG5StopEventParams_t *params)
1374 {
1375  USE_UNWANTED_PARAM(params);
1376  /* Check whether there is a CI application running */
1378  {
1380  ci_module_id = INVALID_CI_MODULE;
1381 #ifndef CI_PLUS_ONLY
1382  MH5GlueDsmccReboot(); // TODO: is this the right thing to do?
1383 #endif
1384  }
1385  else
1386  {
1387  DPL2(("WARNING: stopCIApplications - no CI application running\n"));
1388  /* Notify that stop CI event has been processed */
1390  InformCiAppStopped(params->action);
1391  }
1392 }
1393 
1411 {
1412  MHEG5eventMessage_t event_msg;
1413 
1414  if (!MH5GlueIsStarted())
1415  {
1416  return MHERR_COMP_NOT_STARTED;
1417  }
1418  event_msg.proc_msg_func = (F_MSG_PROCESS)stopCIApplications;
1419  event_msg.data_type = DT_VALUE;
1420  event_msg.data.ciStop.module_id = ci_module_id;
1421  event_msg.data.ciStop.code = CI_APP_ABORT_SYSTEM;
1422  return VQ_PutMsg(&event_msg, PRTY_CRITICAL);
1423 }
1424 
1431 static void ciFileAck(MHEG5CiFileAcknowledgeEventParams_t *params)
1432 {
1433  MHEG5ciFileAcknowledge(params->fileOK, params->pFileData, params->fileSize);
1434 }
1435 
1449 E_MhegErr MHEG5_CiFileAcknowledge(U32BIT module, BOOLEAN fileOK, U8BIT *pFileData,
1450  U32BIT fileSize)
1451 {
1452  MHEG5eventMessage_t event_msg;
1453 
1454  if (!MH5GlueIsStarted())
1455  {
1456  return MHERR_COMP_NOT_STARTED;
1457  }
1458  event_msg.data.ciFileAcknowledge.pFileData = STB_MemAlloc(fileSize);
1459  if (event_msg.data.ciFileAcknowledge.pFileData == NULL)
1460  {
1461  fileSize = 0;
1462  }
1463  else
1464  {
1465  memcpy(event_msg.data.ciFileAcknowledge.pFileData, pFileData, fileSize);
1468  }
1469  event_msg.proc_msg_func = (F_MSG_PROCESS)ciFileAck;
1470  event_msg.data_type = DT_CONTENT;
1471  event_msg.data.ciFileAcknowledge.fileSize = fileSize;
1472  event_msg.data.ciFileAcknowledge.fileOK = fileOK;
1473  return VQ_PutMsg(&event_msg, PRTY_NORMAL);
1474 }
1475 
1492 void MHEG5CiAckData(U8BIT *pData)
1493 {
1494  if (pData)
1495  {
1496  STB_MemFree(pData);
1497  }
1498 }
1499 
1500 void MHEG5notifyCiCamRemove(U32BIT slot_id)
1501 {
1502  if (ci_module_id != INVALID_CI_MODULE &&
1503  STB_GetCIConditionalAccessSlotId(ci_module_id) == slot_id)
1504  {
1506  }
1507 }
1508 
1509 #endif /*COMMON_INTERFACE*/
1510 #ifdef INCLUDE_CI_PLUS
1511 
1527 static BOOLEAN EngineStartCi(U32BIT module, U8BIT *appstr, U8BIT applen,
1528  U8BIT* optstr, U8BIT optlen)
1529 {
1530  BOOLEAN result;
1531  MHEG5eventMessage_t event_msg;
1532  U8BIT *zptr;
1533 
1534  /* Check function parameter */
1535  if ((appstr == NULL) || (applen == 0))
1536  {
1537  TRACE(TERROR,("Invalid CI application name"));
1538  result = FALSE;
1539  }
1540  else if (!MH5GlueIsStarted())
1541  {
1542  TRACE(TERROR,("- not started"));
1543  result = FALSE;
1544  }
1545  else
1546  {
1547  /* Set up event structure and associated data */
1548  event_msg.proc_msg_func = (F_MSG_PROCESS)startCIApplication;
1549  event_msg.data_type = DT_ALLOC;
1550  event_msg.data.ciStart.module_id = module;
1551 
1552  /* Allocate memory for pathname parameter, remembering the "CI://" and terminating null */
1553  event_msg.data.ciStart.name.zptr = (U8BIT *)MHEG5getMem(applen + 6);
1554  if (event_msg.data.string.zptr == NULL)
1555  {
1556  DPL1(("- Memory Allocation Error\n"));
1557  result = FALSE;
1558  }
1559  else
1560  {
1561  zptr = event_msg.data.ciStart.name.zptr;
1562  if (memcmp(appstr, "CI://", 5) != 0)
1563  {
1564  memcpy(zptr, "CI://", 5);
1565  zptr += 5;
1566  }
1567  memcpy(zptr, appstr, applen);
1568  zptr[applen] = 0;
1569 
1570  /* Send start event to component */
1571  if (VQ_PutMsg(&event_msg, PRTY_CRITICAL) != MHERR_OK)
1572  {
1573  MHEG5freeMem(event_msg.data.ciStart.name.zptr);
1576  result = FALSE;
1577  }
1578  else
1579  {
1580  STB_CISetAppMmiCallbacks(CiFileAck, CiAbortApp);
1581  result = TRUE;
1582  }
1583  }
1584  }
1585  return result;
1586 }
1587 
1598 static void CiFileAck(U32BIT module, BOOLEAN fileOK, U8BIT *pFileData, U32BIT fileSize)
1599 {
1600  MHEG5eventMessage_t event_msg;
1601 
1602  if (!MH5GlueIsStarted())
1603  {
1604  TRACE(TERROR,("- not started"));
1605  }
1606  else
1607  {
1608  event_msg.data.ciFileAcknowledge.pFileData = STB_MemAlloc(fileSize);
1609  if (event_msg.data.ciFileAcknowledge.pFileData == NULL)
1610  {
1611  fileSize = 0;
1612  }
1613  else
1614  {
1615  memcpy(event_msg.data.ciFileAcknowledge.pFileData, pFileData, fileSize);
1618  }
1619  event_msg.proc_msg_func = (F_MSG_PROCESS)ciFileAck;
1620  event_msg.data_type = DT_CONTENT;
1621  event_msg.data.ciFileAcknowledge.fileSize = fileSize;
1622  event_msg.data.ciFileAcknowledge.fileOK = fileOK;
1623  VQ_PutMsg(&event_msg, PRTY_NORMAL);
1624  }
1625 }
1626 
1644 static void CiAbortApp(U32BIT module, U8BIT *code, U32BIT length)
1645 {
1646  MHEG5eventMessage_t event_msg;
1647  if (module == ci_module_id && MH5GlueIsStarted())
1648  {
1649  event_msg.proc_msg_func = (F_MSG_PROCESS)stopCIApplications;
1650  event_msg.data_type = DT_VALUE;
1651  event_msg.data.ciStop.module_id = module;
1652  if (code && length >= 1)
1653  {
1654  event_msg.data.ciStop.code = *code;
1655  }
1656  else
1657  {
1658  event_msg.data.ciStop.code = CI_APP_ABORT_SYSTEM;
1659  }
1660  VQ_PutMsg(&event_msg, PRTY_CRITICAL);
1661  }
1662 }
1663 
1664 static void InformCiAppStopped(U8BIT stop_code)
1665 {
1666  STB_CISendAppAbortRequest(ci_module_id, &stop_code, 1);
1667 }
1668 
1669 #endif /*INCLUDE_CI_PLUS*/
1670 
1671 
1672 #ifdef INCLUDE_SA_PROFILE
1673 static void ClearSpecialApp(void *dummy)
1674 {
1675  if (mheg_special_app == SA_INFO)
1676  {
1678  /* (re)start the autoboot application */
1680  }
1681 }
1682 
1683 static void SpecialAppTimeout( BOOLEAN triggered, void *callerRef, H_Timer timerHandle )
1684 {
1685  MHEG5eventMessage_t event_msg;
1686  TRACE(TMHBOOT, (" trig=%d", triggered))
1687  if (triggered == TRUE)
1688  {
1689  event_msg.proc_msg_func = ClearSpecialApp;
1690  event_msg.data_type = DT_NONE;
1691  VQ_PutMsg(&event_msg, PRTY_NORMAL);
1692  }
1693 }
1694 
1695 
1696 void MHEG5StartEpgApp(void)
1697 {
1698  if (mheg_engine_status != ENG_STOPPED)
1699  {
1701  }
1702  MHEG5engineStart((U8BIT*)specialEpgApp, FALSE, TRUE);
1703  if (mheg_engine_status == ENG_DSM_STARTING)
1704  {
1705  mheg_special_app = SA_EPG;
1706  }
1707 }
1708 
1709 void MHEG5StartInfoApp(BOOLEAN doTimeout)
1710 {
1711  if (mheg_engine_status != ENG_STOPPED)
1712  {
1714  }
1715  MHEG5engineStart((U8BIT*)specialInfoApp, FALSE, TRUE);
1716  if (mheg_engine_status == ENG_DSM_STARTING)
1717  {
1718  mheg_special_app = SA_INFO;
1719  if ( doTimeout )
1720  {
1721  S32BIT timeout = 30;
1722  DVB_MhegGetBannerTimeout(&timeout);
1723  timeout *= 1000;
1724  if (mhegTimerCreate(timeout, SpecialAppTimeout, 0, &special_timer) != MHERR_OK)
1725  {
1726  TRACE(TERROR, ("mhegTimerCreate FAILED"));
1727  }
1728  }
1729  }
1730 }
1731 
1732 void MHEG5StartListApp(void)
1733 {
1734  if (mheg_engine_status != ENG_STOPPED)
1735  {
1737  }
1738  MHEG5engineStart((U8BIT*)specialListApp, FALSE, TRUE);
1739  if (mheg_engine_status == ENG_DSM_STARTING)
1740  {
1741  mheg_special_app = SA_LIST;
1742  }
1743 }
1744 
1745 #endif /*INCLUDE_SA_PROFILE*/
1746 
void MHEG5ResetStore(void)
destroy Persistent Storage - only really useful on platform like WINDOWS
Definition: mh5storage.c:135
MHEG5Bool MHEG5TuneIndex(MHEG5Int serviceIndex)
Ref: [1] - 3.10.6.2 Tune to the specified service. If the tuner fails to tune to the service it shoul...
Definition: mh5control.c:852
#define INVALID_CI_MODULE
Definition: mh5control.c:120
#define TINFO_EXPLICIT_CRSL_BIT
Definition: mh5control.c:110
Implement MHEG5 engine control functions (i.e. start/stop etc)
E_ChannelStartMode
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 MHEG5applicationBootAbort(void)
Aborts launch of Boot Application.
void FG_FactoryReset(void)
In the "factory reset", we clear all file groups from cache store. Then re-aquire file groups for the...
BOOLEAN MH5GlueActiveState(void)
Definition: glue_main.c:993
void MHEG5sceneDestruct(MHEG5Scene *scene)
Destruct a scene object.
Definition: mh5scene.c:446
void MHEG5sendAppEngineEvent(E_ENGINE_EVENT engine_event)
Store an Engine event in the asynchronous event queue.
Definition: mh5queue.c:1633
#define LC_STATE_NONE
Definition: mh5control.c:114
void MH5GlueSetMainPostFunc(F_MainProcess func)
Definition: glue_main.c:261
E_MhegErr DVB_MhegGetBannerTimeout(S32BIT *timeout)
Return the banner timeout period in seconds. This setting is related to the information banner on the...
void MHEG5groupRedraw(MHEG5Root *group)
Definition: mh5display.c:1485
E_MhegErr DVB_MhegTuneIndex(S32BIT serviceIndex)
Tunes to the specified service. This MUST be a non-blocking function If the tuner fails to tune to th...
void MHEG5NotifyEvent(E_MhegEvent event, U32BIT data)
Definition: mh5control.c:401
F_MSG_PROCESS proc_msg_func
Definition: glue_queue.h:198
#define LC_STATE_NDT_ENABLE
Definition: mh5control.c:116
U32BIT module_id
Definition: glue_queue.h:105
Functions relating to HTTPS Signature Certificates.
MHEG5ErrorCode MHEG5applicationBootup(char *app_name, BOOLEAN single)
Launches Boot Application according to name rules: This function will authenticate and resolve a file...
int MHEG5InitQueues(void)
Definition: mh5queue.c:858
void httpSetCookieManager(HttpCookieManager_t *manager)
Set cookie manager for HTTP connections.
File acceleration for Australia and Souh Africa.
Interface functions to DSM-CC instance for MHEG5.
void MHEG5InitStore(void)
Initialise Persistent Storage.
Definition: mh5storage.c:115
Manages the interface between MHEG5 Engine and the HTTP component.
void MHEG5applicationFree(MHEG5Application *application)
Free off all memory associated with the specified object, including any exchanged attributes and inte...
H_ObjCarousel hCarousel
Definition: glue_queue.h:87
#define DBGTRACE(...)
Definition: glue_debug.h:126
#define TINFO_NON_DESTRUCT_BIT
Definition: mh5control.c:109
void FG_NotifyCarouselUnLoaded(H_ObjCarousel hOC)
Tell File Group that the Object Carousel has been unloaded, so all file groups on this carousel shoul...
const char * data
Definition: mh5gate.c:56
True Persistent Storage functions.
void * H_Timer
Definition: glue_timers.h:58
void MHEG5sceneFree(MHEG5Scene *scene)
Free off all memory associated with the specified object, including any exchanged attributes and inte...
Definition: mh5scene.c:395
void MHEG5InvalidateTlsCertStore(void)
Invalidate the TLS certificate store.
Definition: mh5tls.c:95
void MHEG5CookieAckHeader(U8BIT *header)
This function should be called once the header string returned by MHEG5CookieGenerateHeader has been ...
Definition: mh5cookies.c:354
void MHEG5ciFileAcknowledge(BOOLEAN fileOK, U8BIT *pFileData, U32BIT length)
Process the FileAcknowledge message sent from the CI module.
void(* F_DESTROY)(FS_HANDLE fs_handle)
Definition: fs_types.h:47
void STB_MemFree(void *ptr)
Releases previously allocated memory.
void MHEG5engineTerminate(void)
Force the engine to terminate.
Definition: mh5control.c:712
Debug tracing.
MHEG5 queue.
void MHEG5_Terminate(void)
Terminate MHEG5 component.
Definition: mh5control.c:263
#define TINFO_MAP_CRSL_INIT_BIT
Definition: mh5control.c:111
void MHEG5NotifyCarouselBooted(S_DsmccEvent *param)
Definition: mh5control.c:564
E_MhegEvent
Definition: mheg5_events.h:54
void MHEG5Pause(void)
Definition: mh5control.c:1183
void MHEG5eventProcessingReset(void)
Causes the MHEG5enableEventProcessing counter to be reset to 0, and event processing to be enabled...
Definition: mh5queue.c:1795
BOOLEAN MHEG5engineIsCiAppRunning(void)
Definition: mh5control.c:1158
void ASN1_MemExit(void)
#define MHEG5getMem
Definition: glue_memory.h:93
void MHEG5applicationNDTcarouselAttach(void *carousel)
void MH5_GroupInit(void)
This function initialises Group Timers.
Definition: mh5group.c:93
#define SD_HEIGHT
Definition: osdtype.h:30
E_MhegErr MHEG5Initialise(S_MhegConfig *cfg_params)
initialise MHEG5 component
Definition: mh5control.c:203
void MHEG5engineDsmTerminate(void)
Force the engine to terminate any DSM-CC based MHEG application.
Definition: mh5control.c:831
Stream event subscription management.
U8BIT * MH5_GetUserAgent(void)
Return the "User Agent" string for the engine.
Definition: mh5support.c:1552
void MHEG5Resume(void)
Definition: mh5control.c:1191
void MHEG5nvmReset(void)
Clear all NVM data from the persistent store.
Definition: mh5nvm.c:380
void MHEG5engineStart(U8BIT *app_name, BOOLEAN isCi, BOOLEAN special)
Start the engine with the initial application.
Definition: mh5control.c:447
S_CiStop ciStop
Definition: glue_queue.h:205
Miscellaneous.
void MHEG5displayRefreshDefaultAudio(U16BIT service_id)
Definition: mh5display.c:2376
void * MHEG5_DsmccInstance(void)
Get the DSMCC instance handle.
Definition: glue_dsmcc.c:778
E_MhegErr MHEG5ResetResolution(U16BIT screenWidth, U16BIT screenHeight)
Definition: mh5control.c:329
MHEG5CiFileAcknowledgeEventParams_t ciFileAcknowledge
Definition: glue_queue.h:213
void MHEG5displayResume(void)
Definition: mh5display.c:1395
BOOLEAN MHEG5FileOrmProcess(void)
Check for any file requests that have arrived since this function was last called. For each arrived file the callback will be called. The function may have to be called more than once in case a file the arrived affects other files as well.
Definition: mh5fileorm.c:830
#define DPL3(x)
Definition: glue_debug.h:179
#define mhegTimerCreate
Definition: glue_timers.h:85
void MHEG5_DvbUnregisterEventHandler(F_NotifyMhegEvent handler)
Definition: mh5control.c:427
U8BIT * zptr
Definition: dtvstring.h:31
#define CI_APP_ABORT_SYSTEM
Definition: mh5control.c:124
void MHEG5FileOrmReset(MHEG5FileOrmResetMode resetMode)
Reset the ORM module. This function supports two modes:
Definition: mh5fileorm.c:595
#define SYS_Free
Definition: glue_memory.h:85
E_MhegErr
Definition: mherrors.h:28
#define ENG_STAT_STRING()
Definition: mh5control.c:103
void * FS_HANDLE
Definition: fs_types.h:46
void MHEG5RefreshDefaultAudio(void)
Definition: mh5control.c:1232
#define InformCiAppStopped(sc)
Definition: mh5control.c:123
MHEG5Bool streamContinuanceFlag
void MHEG5groupClearImages(MHEG5Root *group)
Definition: mh5display.c:1451
void MHEG5applicationCarouselUnload(void *carousel, BOOLEAN isNdt)
void MHEG5stopEventsAndResetQueue(void)
Discard any pending events and actions and prevent future events from being queued. And reset queues. See also MHEG5queueEvents.
Definition: mh5queue.c:914
void(* F_MSG_PROCESS)(void *data)
Function to Process voyager message.
Definition: glue_queue.h:70
void MHEG5ActivateCurrentApplication(void)
Apply the group activation behaviour.
U16BIT original_network_id
Definition: dvblocator.h:32
Freesat NVM.
uint8_t U8BIT
Definition: techtype.h:82
long MHEG5Int
Definition: mh5base.h:73
S_CiStart ciStart
Definition: glue_queue.h:204
void MHEG5ExitQueues(void)
Definition: mh5queue.c:1000
U32BIT MHEG5tuneProcess(S_DvbLocator *pDvbLoc, S32BIT serviceIndex)
Definition: mh5control.c:955
void MHEG5CookieParse(void *data, U32BIT data_len, char *url)
Parse a Set-cookie header and add the new cookie to the store. If the header is not a set-cookie...
Definition: mh5cookies.c:102
void(* F_TimerCallback)(BOOLEAN triggered, void *callerRef, H_Timer timerHandle)
Definition: glue_timers.h:77
void MHEG5NotifyEngineQuit(void)
Definition: mh5control.c:679
DVB Video functions are required by MHEG5 engine. All required functions should be non-blocking...
void MHEG5streamClearCurrentService(void)
Clear the current service.
Definition: mh5stream.c:1274
S_STRING string
Definition: glue_queue.h:203
BOOLEAN MHEG5_DvbRegisterEventHandler(F_NotifyMhegEvent handler)
Definition: mh5control.c:413
Memory functions.
DVB Service information functions are required by MHEG5 engine. All required functions should be non-...
#define MHEG5freeMem
Definition: glue_memory.h:94
void MHEG5FSnvmStoreClose(void)
E_MhegErr MHEG5_StartCIApplication(U32BIT module, U8BIT *application)
Instruct the MHEG5 component to start a specified CI application. This process may be stopped by a ca...
Persistent storage module. The engine provides a persistent storage for 1024 bytes of data...
void MHEG5displayRefreshStreams(U16BIT service_id)
Definition: mh5display.c:2362
void * STB_MemAlloc(U32BIT memSize)
Allocates the specified number of bytes.
void MHEG5ClearTlsCertStore(void)
Clear the TLS certificate store.
Definition: mh5tls.c:86
void MHEG5nvmInitialise(U32BIT nvmSize)
Initialise NVM Storage.
Definition: mh5nvm.c:72
void MHEG5NotifyCarouselUnload(S_DsmccEvent *param)
Definition: mh5control.c:1061
void MH5GlueDoneRebootMessage(void)
Definition: glue_main.c:250
#define LC_STATE_QUIET
Definition: mh5control.c:115
void MHEG5processQueue(void)
Process all pending events and actions. After processing all events and actions, Normally there will ...
Definition: mh5queue.c:1333
#define LC_STATE_NATIVE_APP
Definition: mh5control.c:117
void MHEG5FSnvmStoreOpen(void)
E_ASPECT_RATIO aspectRatio
Definition: mh5scene.h:51
void MHEG5NotifyEngineStarted(void)
Definition: mh5control.c:545
Implement Functions to support Service Gateways. Functions for standarizing several GroupIDs like +DS...
short MHEG5Bool
Definition: mh5base.h:71
void MHEG5ClearHybridFileSystem(void)
Clear the hybrid file system and restore the default mapping // -> DSM://.
Definition: mh5hfs.c:117
E_MhegErr MHEG5_CiFileAcknowledge(U32BIT module, BOOLEAN fileOK, U8BIT *pFileData, U32BIT fileSize)
The MMI FileAcknowledge message, which is a reply from the CI module to an MMI FileRequest sent using...
Native language, reminder and banner functions for South Africa profile.
void MG_Terminate(void)
Free all OSD resources.
Definition: mg_osd.c:367
void MHEG5setWorkingDir(MHEG5String source)
Set the working directory for the current application. This is used to resolve relative paths...
Definition: mh5gate.c:583
U8BIT MHEG5HandleEngineStopAction(U8BIT action)
Definition: mh5control.c:1096
#define TINFO_QUIET_BIT
Definition: mh5control.c:108
Interface to OSD.
void MHEG5applicationDestruct(MHEG5Application *application)
Destruct an application object. This function destructs all parts of an application object...
void MHEG5RefreshDisplay(void)
Definition: mh5control.c:285
Event handling. Implementation of a combined queue for events and actions. This is the eventsystem wh...
#define DPL1(x)
Definition: glue_debug.h:191
#define MAX_HANDLERS
Definition: mh5control.c:101
Functions relating to HTTPS Server Access.
void MG_OSDMhegInit(U16BIT inWidth, U16BIT inHeight, E_ASPECT_RATIO sar)
Initialise the on screen display Initialise the font and fill in font info.
Definition: mg_osd.c:250
Functions relating to HTTPS Content Verification.
void MHEG5InvalidateSigCertCache(void)
Invalidate the certificates in the certificate cache.
Definition: mh5sig.c:262
MHEG5Byte * data
Definition: mh5base.h:85
E_DvbEvent eType
Definition: glue_queue.h:184
#define DPL2(x)
Definition: glue_debug.h:185
#define LC_STATE_MHG_TUNING
Definition: mh5control.c:118
int32_t S32BIT
Definition: techtype.h:87
#define MHEG5TRUE
Definition: mh5base.h:49
E_DATA_TYPE data_type
Definition: glue_queue.h:199
void(* F_NotifyMhegEvent)(E_MhegEvent event, U32BIT data)
Definition: mheg5_events.h:91
uint16_t U16BIT
Definition: techtype.h:84
MHEG5Int sceneCoordinateSystem[2]
Definition: mh5scene.h:50
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
U16BIT service_id
Definition: dvblocator.h:34
void MHEG5StartReboot(void *param)
Definition: mh5control.c:1164
MHEG5Bool MH5_SupportMhegProfile(E_MHEG_PROFILE profile)
Return whether Mheg profile (UK, NZ, AU, HK, SA, FREESAT) is currently supported. ...
Definition: mh5support.c:451
Persistent storage module. The engine provides a persistent storage for 1024 bytes of data...
void MHEG5TuneIndexInfo(MHEG5Int tuneInfo)
Sets the way the application expects the receiver is to perform all subsequence application initiated...
Definition: mh5control.c:882
File interface functions to DSMCC component.
DVB Audio functions are required by MHEG5 engine. All required functions should be non-blocking...
void MHEG5FileOrmInit(void)
Initialise the file ORM module.
Definition: mh5fileorm.c:576
E_ChannelStartMode MHEG5_GetTuningInfoMode(S32BIT serviceIndex)
Get the current tuning mode for the target service. This is only relevant when MHEG5 has requested a ...
Definition: mh5control.c:934
void MH5GlueDsmccMHEGInitialBoot(void)
Causes the autoboot application to be launched. The component must be in the correct state (DSM-CC bo...
Definition: glue_dsmcc.c:897
S_DvpEventType dvpEvent
Definition: glue_queue.h:206
void MHEG5NotifyEngineStartFailed(void)
Definition: mh5control.c:640
Functions relating to HTTP Cookie Store.
E_MhegErr MG_Initialise(U16BIT screenWidth, U16BIT screenHeight, U8BIT colourDepth)
Initialise OSD, font, and font fill information. Should only be called at start up.
Definition: mg_osd.c:281
void MHEG5ResetServerAccess(void)
Reset the cachedserver access permission file.
Definition: mh5access.c:323
MHEG5Scene * MHEG5getCurrentScene(void)
<Function description>="">
Definition: mh5scene.c:207
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 MHEG5AutoPathComplete(E_FsStatus result)
Definition: mh5control.c:586
Functions relating to TLS certificate store.
U32BIT module_id
Definition: glue_queue.h:100
The timer module allows the use of timers within the MHEG5 component. These timers can be set by othe...
#define SD_WIDTH
Definition: osdtype.h:31
void MHEG5ResetVerification(void)
Reset the entire state of the verification mechanism.
Definition: mh5hash.c:138
U16BIT MHEG5DefaultServiceId(void)
Definition: glue_main.c:1191
void httpSetUserAgent(U8BIT *user_agent)
Set User Agent for HTTP connections.
E_MhegErr MHEG5_StopCIApplication(void)
Stop any currently running CI MHEG5 applications. This is a non-blocking function, and may return before completion. This function will asynchronously return MHEG5_CI_APPLICATION_STOPPED, through through event call back function F_NotifyMhegEvent, when the current CI application(s) have been stopped. If there are no CI applications running then the notification, MHEG5_CI_APPLICATION_STOPPED, will still be sent. If any currently running CI application is stopped then the default DSM-CC auto-boot application will be launched. See section 6.10 of reference [1] for details of interaction between the MHEG-5 component and the CI module.
E_ENGINE_STATUS
Definition: mh5control.c:132
void FG_Initialise(U32BIT nvmSize)
Initialise - retrieve data from NVM storage for any file groups and allocate the file group list...
MHEG5Bool MH5_SupportInteractionChannel(void)
Return whether Interaction channel is supported by current profile.
Definition: mh5support.c:423
MHEG5Int len
Definition: mh5base.h:84
BOOLEAN MH5GlueIsStarted(void)
Definition: glue_main.c:241
void MH5GlueDsmccReboot(void)
Definition: glue_dsmcc.c:956
void MHEG5TpsSetCurrentService(S_DvbLocator *pDvbLoc)
Set current service for application none.
Definition: mh5tps.c:144
U8BIT BOOLEAN
Definition: techtype.h:99
#define USE_UNWANTED_PARAM(param)
Definition: techtype.h:48
#define TRUE
Definition: techtype.h:69
void MHEG5displayShowAll(void)
Redisplay all active visible objects. AKD: Optimised 12/5/99.
Definition: mh5display.c:1362
int ASN1_MemInit(void)
void MHEG5streamReloadAll(void)
Load and Subscribe all stream events.
void MHEG5displayResetStreamDecoders(BOOLEAN update)
Reset all media decoders to default values. This is used when the MHEG-5 engine is terminated...
Definition: mh5display.c:2909
E_SPECIAL_APP
Definition: mh5control.c:150
This file describes the interface to an MHEG5 component for CI. For example, MHEG5_StartCIApplication...
U8BIT * MHEG5CookieGenerateHeader(U8BIT *url)
Generate a "Cookie" header for the required http request, containing all valid cookies.
Definition: mh5cookies.c:243
void MHEG5ClearSigCertCache(void)
Clear the signature certificate cache and all related information.
Definition: mh5sig.c:242
#define mhegTimerDestroy
Definition: glue_timers.h:86
BOOLEAN MHEG5isProcessingNDT(BOOLEAN *native_app_ok)
Definition: mh5control.c:1074
void MHEG5applicationStackClear(BOOLEAN isNdt)
Implement generic MHEG5-display functions - independent from the OSD These are generic functions used...
void FG_Terminate(void)
Terminate - free data associated with all file groups.
U8BIT code
Definition: glue_queue.h:106
void MHEG5PromotionalLinkControl(BOOLEAN isEnabled)
Definition: mh5keypress.c:1248
void MHEG5streamUnloadAll(void)
Unsubscribe and unload all stream events.
void MHEG5RefreshStreams(U16BIT service_id)
Definition: mh5control.c:1211
union s_mhg_message::@13 data
S_STRING name
Definition: glue_queue.h:99
void MHEG5CookieClearStore(void)
Delete all cookies from the temporary store.
Definition: mh5cookies.c:405
E_FsStatus FG_FileExists(E_FS_ORIGIN origin, const char *fname)
Request file from file group stores.
#define ASSERTL1(x)
Definition: glue_assert.h:54
#define MHEG5FALSE
Definition: mh5base.h:48
uint32_t U32BIT
Definition: techtype.h:86
void MHEG5displayPause(void)
Definition: mh5display.c:1422
E_FsStatus
Definition: fs_types.h:34
Functions relating to Hybrid file system.
void MHEG5displayClear(void)
<Function description>="">
Definition: mh5display.c:220
#define TINFO_NATIVE_APP_BIT
Definition: mh5control.c:112
void MHEG5NotifyCarouselLoaded(S_DsmccEvent *param)
Definition: mh5control.c:1037
Key Press related functionality.
void MH5GlueAddPostProcessFunc(F_PostProcess func)
Definition: glue_main.c:275
Engine support utility functions for MHEG5.
MHEG5Application * MHEG5getCurrentApplication(void)
<Function description>="">
#define TRACE(t, x)
Definition: glue_debug.h:118