64 #if defined(INCLUDE_DSM_FG) || defined(INCLUDE_NVM) 68 #ifdef INCLUDE_SA_PROFILE 76 #ifdef INCLUDE_FREESAT 78 #elif defined(INCLUDE_NVM) 86 #include "dsm_control.h" 92 #ifdef COMMON_INTERFACE 95 #ifdef INCLUDE_CI_PLUS 96 #include "ci_appmmi.h" 101 #define MAX_HANDLERS 2 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" 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 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 120 #define INVALID_CI_MODULE 0xFFFFFFFF 122 #ifndef INCLUDE_CI_PLUS 123 #define InformCiAppStopped(sc) 124 #define CI_APP_ABORT_SYSTEM 0x02 126 #define CI_APP_ABORT_USER STB_CI_APP_ABORT_USER 127 #define CI_APP_ABORT_SYSTEM STB_CI_APP_ABORT_SYSTEM 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";
169 static BOOLEAN changedScreenResolution = FALSE;
170 static F_NotifyMhegEvent mhegEventHandlers[MAX_HANDLERS] = { NULL, NULL };
171 #ifdef COMMON_INTERFACE 173 static U32BIT ci_module_id = INVALID_CI_MODULE;
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;
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);
194 extern int ASN1_MemInit(
void);
195 extern void ASN1_MemExit(
void);
205 #if defined(INCLUDE_DSM_FG) || defined(INCLUDE_NVM) 210 nvmSize = (512 * 1024);
214 nvmSize = (64 * 1024);
218 if (!ASN1_MemInit() || !MHEG5InitQueues())
220 TRACE(TERROR, (
"ASN1_MemInit or MHEG5InitQueues FAILED"))
221 return MHERR_ALLOCATING_MEMORY;
227 #ifdef ENGINE_LOG_LEVEL 228 MHEG5LogInit(ENGINE_LOG_LEVEL);
235 #ifdef INCLUDE_DSM_FG 240 #ifdef INCLUDE_FREESAT 241 MHEG5FSnvmStoreOpen();
242 #elif defined(INCLUDE_NVM) 249 #ifdef INCLUDE_CI_PLUS 251 STB_CIRegisterMmiEngine(CI_MHEG5_DOMAIN_ID,EngineStartCi);
254 TRACE(TMHBOOT, (
"done"))
270 #ifdef INCLUDE_DSM_FG 277 #ifdef INCLUDE_FREESAT 278 MHEG5FSnvmStoreClose();
279 #elif defined(INCLUDE_NVM) 285 void MHEG5RefreshDisplay(
void)
293 TRACE(TMHBOOT, (
"No App "))
294 changedScreenResolution = FALSE;
299 if (changedScreenResolution)
306 (U16BIT)scn->sceneCoordinateSystem[1], scn->aspectRatio );
313 changedScreenResolution = FALSE;
322 MHEG5displayResume();
329 E_MhegErr MHEG5ResetResolution( U16BIT screenWidth, U16BIT screenHeight )
334 TRACE(TGRAPHICS, (
""))
339 MHEG5groupClearImages( grp );
344 MHEG5groupClearImages( grp );
353 changedScreenResolution = TRUE;
359 #if defined(INCLUDE_NVM) || defined(INCLUDE_DSM_FG) 361 static void MHEG5FactoryReset(
void *dummy )
363 #ifdef INCLUDE_DSM_FG 368 #ifdef INCLUDE_FREESAT 369 MHEG5FSnvmStoreClose();
370 #elif defined(INCLUDE_NVM) 383 E_MhegErr MHEG5_ExecuteFactoryReset(
void)
388 event_msg.proc_msg_func = MHEG5FactoryReset;
389 event_msg.data_type = DT_NONE;
391 result =
VQ_PutMsg(&event_msg, PRTY_CRITICAL);
392 if (result != MHERR_OK)
394 TRACE(TERROR, (
"VQ_PutMsg Failed"));
401 void MHEG5NotifyEvent( E_MhegEvent event, U32BIT data )
404 for (i = 0; i != MAX_HANDLERS; i++)
406 if (mhegEventHandlers[i] != NULL)
408 mhegEventHandlers[i]( event, data );
413 BOOLEAN MHEG5_DvbRegisterEventHandler( F_NotifyMhegEvent handler )
416 for (i = 0; i != MAX_HANDLERS; i++)
418 if (mhegEventHandlers[i] == NULL)
420 mhegEventHandlers[i] = handler;
427 void MHEG5_DvbUnregisterEventHandler( F_NotifyMhegEvent handler )
430 for (i = 0; i != MAX_HANDLERS; i++)
432 if (mhegEventHandlers[i] == handler)
434 mhegEventHandlers[i] = NULL;
454 if (mheg_engine_status != ENG_STOPPED)
456 TRACE(TMHBOOT, (
"Engine Status not stopped",mheg_engine_status))
472 MHEG5clearICStatus();
483 workingDir.data = (U8BIT *)
"hybrid://";
489 workingDir.data = (U8BIT *)
"DSM://";
497 TRACE(TMHBOOT, (
"Eng Start %s", (
char *)app_name))
501 TRACE(TMHBOOT, (
"Engine Start Auto"))
508 mheg_engine_status = isCi ? ENG_CI_STARTING : ENG_DSM_STARTING;
514 if (MH5GlueActiveState() || special)
516 TRACE(TMHBOOT, (
"start processing"));
521 TRACE(TMHBOOT, (
"Waiting state!"));
526 TRACE(TERROR, (
"bootup failed ci?=%d",isCi));
531 MHEG5NotifyEvent(MHEG_EVENT_CI_APPLICATION_START_FAILED, 0);
532 InformCiAppStopped(CI_APP_ABORT_SYSTEM);
537 MHEG5NotifyEvent(MHEG_EVENT_DSM_APPLICATION_START_FAILED, 0);
540 mheg_engine_status = ENG_STOPPED;
545 void MHEG5NotifyEngineStarted(
void)
547 switch (mheg_engine_status)
549 case ENG_DSM_STARTING:
550 MHEG5NotifyEvent(MHEG_EVENT_DSM_APPLICATION_STARTED, 0);
551 mheg_engine_status = ENG_DSM_STARTED;
553 case ENG_CI_STARTING:
554 MHEG5NotifyEvent(MHEG_EVENT_CI_APPLICATION_STARTED, 0);
555 mheg_engine_status = ENG_CI_STARTED;
558 TRACE(TERROR, (
"Unexpected state"));
566 TRACE(TPERFORM | TSTATE, (
"engine_status=%s", ENG_STAT_STRING()))
567 if (mheg_engine_status == ENG_DSM_STARTED)
572 MHEG5applicationNDTcarouselAttach(param->hCarousel);
586 void MHEG5AutoPathComplete( E_FsStatus result )
595 TRACE(TERROR, (
"autoboot object failed"));
596 MHEG5NotifyEvent(MHEG_EVENT_DSM_APPLICATION_START_FAILED, 0);
601 MHEG5NotifyEngineStartFailed();
605 static void StartAutoboot(
void *dummy)
607 if (mheg_engine_status > ENG_DSM_STARTING)
609 TRACE(TERROR, (
"Unexpected state %d", mheg_engine_status));
623 static void startRetryMhegFunc( BOOLEAN triggered,
void *callerRef, H_Timer timerHandle )
627 TRACE(TMHBOOT, (
" trig=%d", triggered))
629 if (triggered == TRUE)
632 event_msg.proc_msg_func = StartAutoboot;
633 event_msg.data_type = DT_NONE;
640 void MHEG5NotifyEngineStartFailed(
void)
642 TRACE(TMHBOOT, (
" engine_status=%s", ENG_STAT_STRING()))
643 switch (mheg_engine_status)
646 case ENG_DSM_STARTING:
647 if (mhegTimerCreate( 2000 ,
648 (F_TimerCallback) startRetryMhegFunc,
649 0, &retryTimerHandle ) == MHERR_OK)
651 TRACE(TMHBOOT, (
"started timer"))
655 TRACE(TERROR, (
"mhegTimerCreate FAILED"));
657 #ifdef INCLUDE_SA_PROFILE 658 if (special_timer != 0)
660 mhegTimerDestroy(special_timer);
663 mheg_special_app = SA_NORMAL;
668 case ENG_CI_STARTING:
669 MHEG5NotifyEvent(MHEG_EVENT_CI_APPLICATION_START_FAILED, 0);
670 InformCiAppStopped(CI_APP_ABORT_SYSTEM);
674 TRACE(TERROR, (
"Unexpected state"));
676 mheg_engine_status = ENG_STOPPED;
679 void MHEG5NotifyEngineQuit(
void)
681 switch (mheg_engine_status)
684 TRACE(TPERFORM, (
"MHEG5_CI_APPLICATION_STOPPED"))
685 MHEG5NotifyEvent(MHEG_EVENT_CI_APPLICATION_STOPPED, 0);
686 InformCiAppStopped(CI_APP_ABORT_SYSTEM);
689 case ENG_DSM_STARTED:
690 TRACE(TPERFORM, (
"MHEG5_DSM_APPLICATION_STOPPED"))
691 MHEG5NotifyEvent(MHEG_EVENT_DSM_APPLICATION_STOPPED, 0);
692 #ifdef INCLUDE_SA_PROFILE 693 if (special_timer != 0)
695 mhegTimerDestroy(special_timer);
698 mheg_special_app = SA_NORMAL;
705 MH5GlueSetMainPostFunc( NULL );
723 if (mheg_engine_status == ENG_CI_STARTED)
725 TRACE(TPERFORM, (
"MHEG5_CI_APPLICATION_STOPPED"))
726 MHEG5NotifyEvent(MHEG_EVENT_CI_APPLICATION_STOPPED, 0);
727 InformCiAppStopped(CI_APP_ABORT_USER);
737 update = MH5GlueActiveState();
740 if (application != 0)
750 application->streamContinuanceFlag = MHEG5TRUE;
761 application->streamContinuanceFlag = MHEG5TRUE;
764 MHEG5freeMem(application);
767 MHEG5NotifyEngineQuit();
775 #ifdef INCLUDE_NATIVE_APP 776 MHEG5PromotionalLinkControl( TRUE );
801 MHEG5clearICStatus();
807 MHEG5applicationStackClear(FALSE);
814 #ifdef INCLUDE_SA_PROFILE 815 if (special_timer != 0)
817 mhegTimerDestroy(special_timer);
820 mheg_special_app = SA_NORMAL;
822 mheg_engine_status = ENG_STOPPED;
833 if (mheg_engine_status == ENG_DSM_STARTED ||
834 mheg_engine_status == ENG_DSM_STARTING)
838 lifecycle_state = LC_STATE_NONE;
854 MHEG5Bool rc = MHEG5FALSE;
855 TRACE(TSTATE, (
"LCS=0x%x, serviceIndex=%d", lifecycle_state, serviceIndex))
856 if (serviceIndex != -1)
858 tuneServiceIndex = serviceIndex;
859 lifecycle_state |= LC_STATE_MHG_TUNING;
884 if (tuneInfo & TINFO_QUIET_BIT)
886 lifecycle_state |= LC_STATE_QUIET;
890 lifecycle_state &= ~LC_STATE_QUIET;
893 if (tuneInfo & TINFO_NON_DESTRUCT_BIT)
895 lifecycle_state |= LC_STATE_NDT_ENABLE;
897 if (tuneInfo & TINFO_EXPLICIT_CRSL_BIT)
899 ndt_new_carousel_id = (tuneInfo >> 8) & 0xff;
901 else if (tuneInfo & TINFO_MAP_CRSL_INIT_BIT)
903 ndt_new_carousel_id = INVALID_CAROUSEL_ID;
913 lifecycle_state &= ~LC_STATE_NDT_ENABLE;
916 if (tuneInfo & TINFO_NATIVE_APP_BIT)
918 lifecycle_state |= LC_STATE_NATIVE_APP;
922 lifecycle_state &= ~LC_STATE_NATIVE_APP;
925 TRACE(TSTATE, (
"LCS=0x%x", lifecycle_state))
936 E_ChannelStartMode suppress = CHANNEL_START_NORMAL;
937 TRACE(TSTATE | TTUNE, (
"LCS=0x%x", lifecycle_state))
938 if (lifecycle_state & LC_STATE_MHG_TUNING)
940 if (tuneServiceIndex == serviceIndex)
942 if (lifecycle_state & LC_STATE_QUIET)
944 suppress = CHANNEL_START_QUIETLY;
946 else if (lifecycle_state & LC_STATE_NDT_ENABLE)
948 suppress = CHANNEL_START_QUIET_SHOW_INFO;
955 U32BIT MHEG5tuneProcess(
S_DvbLocator *pDvbLoc, S32BIT serviceIndex )
961 #ifdef INCLUDE_NATIVE_APP 962 BOOLEAN native_app_ok = TRUE;
964 #ifdef INCLUDE_SA_PROFILE 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)
972 TRACE(TERROR, (
"NDT Failed serv_id=%d,net_id=%d", pDvbLoc->service_id, pDvbLoc->original_network_id))
977 if (lifecycle_state & LC_STATE_MHG_TUNING)
979 if (tuneServiceIndex == serviceIndex)
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)
985 native_app_ok = FALSE;
988 if (lifecycle_state & LC_STATE_NDT_ENABLE)
990 TRACE(TSTATE | TFILE | TSTRM | TTUNE, (
"==== Non Destructive Tune (crsl=0x%x) =====", ndt_new_carousel_id))
991 cid = ndt_new_carousel_id;
998 TRACE(TSTATE | TTUNE, (
" MHEG5 Tune "))
1000 lifecycle_state &= ~LC_STATE_MHG_TUNING;
1004 TRACE(TERROR, (
"Supposed to be MHEG tune, but wrong service: serv_id=%d", pDvbLoc->service_id))
1012 TRACE(TSTATE | TTUNE, (
" Normal Tune "))
1022 #ifdef INCLUDE_SA_PROFILE 1023 if (chan_suppress == CHANNEL_START_NORMAL &&
1028 MHEG5StartInfoApp(TRUE);
1031 #ifdef INCLUDE_NATIVE_APP 1032 MHEG5PromotionalLinkControl( native_app_ok );
1039 TRACE(TMHBOOT | TPERFORM | TSTATE, (
"engine_status=%s", ENG_STAT_STRING()))
1040 if (mheg_engine_status == ENG_DSM_STARTED)
1045 #ifdef INCLUDE_SA_PROFILE 1046 else if (chan_suppress == CHANNEL_START_NORMAL &&
1048 mheg_special_app != SA_INFO)
1051 MHEG5StartInfoApp(TRUE);
1064 isNdt = ((lifecycle_state & (LC_STATE_MHG_TUNING|LC_STATE_NDT_ENABLE))
1065 == (LC_STATE_MHG_TUNING|LC_STATE_NDT_ENABLE))? TRUE : FALSE;
1066 MHEG5applicationCarouselUnload(param->hCarousel,isNdt);
1067 #ifdef INCLUDE_DSM_FG 1074 BOOLEAN MHEG5isProcessingNDT( BOOLEAN *native_app_ok )
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)
1082 if (lifecycle_state & LC_STATE_NDT_ENABLE)
1084 TRACE(TSTATE | TFILE | TSTRM, (
"==== About to do Non Destructive Tune ====="))
1087 if (lifecycle_state & LC_STATE_NATIVE_APP)
1089 *native_app_ok = FALSE;
1096 U8BIT MHEG5HandleEngineStopAction( U8BIT action )
1098 BOOLEAN native_app_ok = TRUE;
1100 TRACE(TSTATE, (
"action=0x%x Eng_stat=%s", action, ENG_STAT_STRING()))
1102 if (mheg_engine_status == ENG_STOPPED)
1104 TRACE(TERROR, (
"no application running"));
1109 if ( action & STOP_ACTION_CI_PLUS_NDT )
1114 MHEG5applicationStackClear(TRUE);
1116 else if ((action & STOP_ACTION_MHEG_TUNE) == 0 ||
1117 !MHEG5isProcessingNDT(&native_app_ok))
1120 if (mheg_engine_status != ENG_STOPPED)
1131 MHEG5applicationStackClear(TRUE);
1136 #ifdef INCLUDE_NATIVE_APP 1137 MHEG5PromotionalLinkControl( native_app_ok );
1141 #ifdef MHG_TRACK_MEM 1143 TRACE(TMEMORY, (
""))
1144 mh5emt_print(3 << SRCMEM_APP);
1147 #ifdef MHEG5_COMP_MEM_TRACKING 1160 return (mheg_engine_status == ENG_CI_STARTED ||
1161 mheg_engine_status == ENG_CI_STARTING) ? TRUE : FALSE;
1164 void MHEG5StartReboot(
void *param)
1168 TRACE(TMHBOOT, (
"CI application running - ignore external reboot"))
1170 #ifndef CI_PLUS_ONLY 1174 MH5GlueDsmccReboot();
1179 MH5GlueDoneRebootMessage();
1183 void MHEG5Pause(
void)
1185 TRACE(TSTATE|TMHBOOT, (
"engine_status=%s", ENG_STAT_STRING()))
1186 MH5GlueSetMainPostFunc( NULL );
1187 MHEG5displayPause();
1188 MHEG5NotifyEvent(MHEG_EVENT_STATE_PAUSED, 0);
1191 void MHEG5Resume(
void)
1193 TRACE(TSTATE|TMHBOOT, (
"engine_status=%s", ENG_STAT_STRING()))
1194 if (mheg_engine_status != ENG_STOPPED)
1199 MHEG5NotifyEvent(MHEG_EVENT_STATE_RESUME, 0);
1200 MHEG5RefreshDisplay();
1205 if (mheg_engine_status == ENG_DSM_STARTED)
1207 MHEG5displayRefreshStreams((U16BIT)param->eData);
1211 void MHEG5RefreshStreams(U16BIT service_id)
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)
1226 if (mheg_engine_status == ENG_DSM_STARTED)
1228 MHEG5displayRefreshDefaultAudio((U16BIT)param->eData);
1232 void MHEG5RefreshDefaultAudio(
void)
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)
1245 #ifdef COMMON_INTERFACE 1246 U32BIT MHEG5GetCiModuleId(
void)
1248 return ci_module_id;
1257 static void startCIApplication(
S_CiStart *params)
1259 ASSERTL1((params->name.zptr));
1267 #ifndef CI_PLUS_ONLY 1274 ci_module_id = params->module_id;
1277 DPL3((
"INFO: startCIApplication - calling engineStart\n"));
1281 SYS_Free(params->name.zptr);
1317 if ((application == NULL) || (strlen((
char *)application) == 0))
1320 DPL1((
"- Invalid CI application name\n"));
1321 return MHERR_BAD_PARAMETER;
1324 if (!MH5GlueIsStarted())
1326 return MHERR_COMP_NOT_STARTED;
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;
1337 event_msg.data.ciStart.name.zptr = (U8BIT *)MHEG5getMem(strlen((
char *)application) + 6);
1338 if (event_msg.data.string.zptr == NULL)
1340 DPL1((
"- Memory Allocation Error\n"));
1341 return MHERR_BAD_PARAMETER;
1345 event_msg.data.ciStart.name.zptr[0] =
'\0';
1346 if (strncmp((
char *)application,
"CI://", 5) != 0)
1348 strcpy((
char *)event_msg.data.ciStart.name.zptr,
"CI://");
1350 strcat((
char *)event_msg.data.ciStart.name.zptr, (
char *)application);
1353 cqu_err =
VQ_PutMsg(&event_msg, PRTY_CRITICAL);
1354 if (cqu_err != MHERR_OK)
1356 TRACE(TERROR, (
"VQ_PutMsg Failed %d", cqu_err));
1357 MHEG5freeMem(event_msg.data.ciStart.name.zptr);
1358 MHEG5NotifyEvent(MHEG_EVENT_CI_APPLICATION_START_FAILED, 0);
1359 InformCiAppStopped(CI_APP_ABORT_SYSTEM);
1360 return MHERR_INTERNAL;
1375 USE_UNWANTED_PARAM(params);
1380 ci_module_id = INVALID_CI_MODULE;
1381 #ifndef CI_PLUS_ONLY 1382 MH5GlueDsmccReboot();
1387 DPL2((
"WARNING: stopCIApplications - no CI application running\n"));
1389 MHEG5NotifyEvent(MHEG_EVENT_CI_APPLICATION_STOPPED, 0);
1390 InformCiAppStopped(params->action);
1414 if (!MH5GlueIsStarted())
1416 return MHERR_COMP_NOT_STARTED;
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);
1454 if (!MH5GlueIsStarted())
1456 return MHERR_COMP_NOT_STARTED;
1458 event_msg.data.ciFileAcknowledge.pFileData =
STB_MemAlloc(fileSize);
1459 if (event_msg.data.ciFileAcknowledge.pFileData == NULL)
1465 memcpy(event_msg.data.ciFileAcknowledge.pFileData, pFileData, fileSize);
1466 event_msg.data.ciFileAcknowledge.clr_func = (F_DESTROY)
STB_MemFree;
1467 event_msg.data.ciFileAcknowledge.clr_hdl = (FS_HANDLE)event_msg.data.ciFileAcknowledge.pFileData;
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);
1492 void MHEG5CiAckData(U8BIT *pData)
1500 void MHEG5notifyCiCamRemove(U32BIT slot_id)
1502 if (ci_module_id != INVALID_CI_MODULE &&
1503 STB_GetCIConditionalAccessSlotId(ci_module_id) == slot_id)
1510 #ifdef INCLUDE_CI_PLUS 1527 static BOOLEAN EngineStartCi(U32BIT module, U8BIT *appstr, U8BIT applen,
1528 U8BIT* optstr, U8BIT optlen)
1535 if ((appstr == NULL) || (applen == 0))
1537 TRACE(TERROR,(
"Invalid CI application name"));
1540 else if (!MH5GlueIsStarted())
1542 TRACE(TERROR,(
"- not started"));
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;
1553 event_msg.data.ciStart.name.zptr = (U8BIT *)MHEG5getMem(applen + 6);
1554 if (event_msg.data.string.zptr == NULL)
1556 DPL1((
"- Memory Allocation Error\n"));
1561 zptr = event_msg.data.ciStart.name.zptr;
1562 if (memcmp(appstr,
"CI://", 5) != 0)
1564 memcpy(zptr,
"CI://", 5);
1567 memcpy(zptr, appstr, applen);
1571 if (
VQ_PutMsg(&event_msg, PRTY_CRITICAL) != MHERR_OK)
1573 MHEG5freeMem(event_msg.data.ciStart.name.zptr);
1574 MHEG5NotifyEvent(MHEG_EVENT_CI_APPLICATION_START_FAILED, 0);
1575 InformCiAppStopped(CI_APP_ABORT_SYSTEM);
1580 STB_CISetAppMmiCallbacks(CiFileAck, CiAbortApp);
1598 static void CiFileAck(U32BIT module, BOOLEAN fileOK, U8BIT *pFileData, U32BIT fileSize)
1602 if (!MH5GlueIsStarted())
1604 TRACE(TERROR,(
"- not started"));
1608 event_msg.data.ciFileAcknowledge.pFileData =
STB_MemAlloc(fileSize);
1609 if (event_msg.data.ciFileAcknowledge.pFileData == NULL)
1615 memcpy(event_msg.data.ciFileAcknowledge.pFileData, pFileData, fileSize);
1616 event_msg.data.ciFileAcknowledge.clr_func = (F_DESTROY)
STB_MemFree;
1617 event_msg.data.ciFileAcknowledge.clr_hdl = (FS_HANDLE)event_msg.data.ciFileAcknowledge.pFileData;
1620 event_msg.data_type = DT_CONTENT;
1621 event_msg.data.ciFileAcknowledge.fileSize = fileSize;
1622 event_msg.data.ciFileAcknowledge.fileOK = fileOK;
1644 static void CiAbortApp(U32BIT module, U8BIT *code, U32BIT length)
1647 if (module == ci_module_id && MH5GlueIsStarted())
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)
1654 event_msg.data.ciStop.code = *code;
1658 event_msg.data.ciStop.code = CI_APP_ABORT_SYSTEM;
1664 static void InformCiAppStopped(U8BIT stop_code)
1666 STB_CISendAppAbortRequest(ci_module_id, &stop_code, 1);
1672 #ifdef INCLUDE_SA_PROFILE 1673 static void ClearSpecialApp(
void *dummy)
1675 if (mheg_special_app == SA_INFO)
1683 static void SpecialAppTimeout( BOOLEAN triggered,
void *callerRef, H_Timer timerHandle )
1686 TRACE(TMHBOOT, (
" trig=%d", triggered))
1687 if (triggered == TRUE)
1689 event_msg.proc_msg_func = ClearSpecialApp;
1690 event_msg.data_type = DT_NONE;
1696 void MHEG5StartEpgApp(
void)
1698 if (mheg_engine_status != ENG_STOPPED)
1703 if (mheg_engine_status == ENG_DSM_STARTING)
1705 mheg_special_app = SA_EPG;
1709 void MHEG5StartInfoApp(BOOLEAN doTimeout)
1711 if (mheg_engine_status != ENG_STOPPED)
1716 if (mheg_engine_status == ENG_DSM_STARTING)
1718 mheg_special_app = SA_INFO;
1721 S32BIT timeout = 30;
1724 if (mhegTimerCreate(timeout, SpecialAppTimeout, 0, &special_timer) != MHERR_OK)
1726 TRACE(TERROR, (
"mhegTimerCreate FAILED"));
1732 void MHEG5StartListApp(
void)
1734 if (mheg_engine_status != ENG_STOPPED)
1739 if (mheg_engine_status == ENG_DSM_STARTING)
1741 mheg_special_app = SA_LIST;
void MHEG5ResetStore(void)
destroy Persistent Storage - only really useful on platform like WINDOWS
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...
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.
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...
void MHEG5sceneDestruct(MHEG5Scene *scene)
Destruct a scene object.
void MHEG5sendAppEngineEvent(E_ENGINE_EVENT engine_event)
Store an Engine event in the asynchronous event queue.
E_MhegErr DVB_MhegGetBannerTimeout(S32BIT *timeout)
Return the banner timeout period in seconds. This setting is related to the information banner on the...
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...
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...
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.
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...
void FG_NotifyCarouselUnLoaded(H_ObjCarousel hOC)
Tell File Group that the Object Carousel has been unloaded, so all file groups on this carousel shoul...
True Persistent Storage functions.
void MHEG5sceneFree(MHEG5Scene *scene)
Free off all memory associated with the specified object, including any exchanged attributes and inte...
void MHEG5InvalidateTlsCertStore(void)
Invalidate the TLS certificate store.
void MHEG5CookieAckHeader(U8BIT *header)
This function should be called once the header string returned by MHEG5CookieGenerateHeader has been ...
void MHEG5ciFileAcknowledge(BOOLEAN fileOK, U8BIT *pFileData, U32BIT length)
Process the FileAcknowledge message sent from the CI module.
void STB_MemFree(void *ptr)
Releases previously allocated memory.
void MHEG5engineTerminate(void)
Force the engine to terminate.
void MHEG5_Terminate(void)
Terminate MHEG5 component.
void MHEG5eventProcessingReset(void)
Causes the MHEG5enableEventProcessing counter to be reset to 0, and event processing to be enabled...
BOOLEAN MHEG5engineIsCiAppRunning(void)
void MH5_GroupInit(void)
This function initialises Group Timers.
E_MhegErr MHEG5Initialise(S_MhegConfig *cfg_params)
initialise MHEG5 component
void MHEG5engineDsmTerminate(void)
Force the engine to terminate any DSM-CC based MHEG application.
Stream event subscription management.
U8BIT * MH5_GetUserAgent(void)
Return the "User Agent" string for the engine.
void MHEG5nvmReset(void)
Clear all NVM data from the persistent store.
void MHEG5engineStart(U8BIT *app_name, BOOLEAN isCi, BOOLEAN special)
Start the engine with the initial application.
void * MHEG5_DsmccInstance(void)
Get the DSMCC instance handle.
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.
void MHEG5FileOrmReset(MHEG5FileOrmResetMode resetMode)
Reset the ORM module. This function supports two modes:
void MHEG5stopEventsAndResetQueue(void)
Discard any pending events and actions and prevent future events from being queued. And reset queues. See also MHEG5queueEvents.
void(* F_MSG_PROCESS)(void *data)
Function to Process voyager message.
void MHEG5ActivateCurrentApplication(void)
Apply the group activation behaviour.
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...
DVB Video functions are required by MHEG5 engine. All required functions should be non-blocking...
void MHEG5streamClearCurrentService(void)
Clear the current service.
DVB Service information functions are required by MHEG5 engine. All required functions should be non-...
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 * STB_MemAlloc(U32BIT memSize)
Allocates the specified number of bytes.
void MHEG5ClearTlsCertStore(void)
Clear the TLS certificate store.
void MHEG5nvmInitialise(U32BIT nvmSize)
Initialise NVM Storage.
void MHEG5processQueue(void)
Process all pending events and actions. After processing all events and actions, Normally there will ...
Implement Functions to support Service Gateways. Functions for standarizing several GroupIDs like +DS...
void MHEG5ClearHybridFileSystem(void)
Clear the hybrid file system and restore the default mapping // -> DSM://.
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.
void MHEG5setWorkingDir(MHEG5String source)
Set the working directory for the current application. This is used to resolve relative paths...
void MHEG5applicationDestruct(MHEG5Application *application)
Destruct an application object. This function destructs all parts of an application object...
Event handling. Implementation of a combined queue for events and actions. This is the eventsystem wh...
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.
Functions relating to HTTPS Content Verification.
void MHEG5InvalidateSigCertCache(void)
Invalidate the certificates in the certificate cache.
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...
MHEG5Bool MH5_SupportMhegProfile(E_MHEG_PROFILE profile)
Return whether Mheg profile (UK, NZ, AU, HK, SA, FREESAT) is currently supported. ...
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...
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.
E_ChannelStartMode MHEG5_GetTuningInfoMode(S32BIT serviceIndex)
Get the current tuning mode for the target service. This is only relevant when MHEG5 has requested a ...
void MH5GlueDsmccMHEGInitialBoot(void)
Causes the autoboot application to be launched. The component must be in the correct state (DSM-CC bo...
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.
void MHEG5ResetServerAccess(void)
Reset the cachedserver access permission file.
MHEG5Scene * MHEG5getCurrentScene(void)
<Function description>="">
void MHEG5sendEvent(MHEG5Root *source, MHEG5EventType event, MHEG5Int data)
Store an event in the asynchronous event queue.
Functions relating to TLS certificate store.
The timer module allows the use of timers within the MHEG5 component. These timers can be set by othe...
void MHEG5ResetVerification(void)
Reset the entire state of the verification mechanism.
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.
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.
void MHEG5TpsSetCurrentService(S_DvbLocator *pDvbLoc)
Set current service for application none.
void MHEG5displayShowAll(void)
Redisplay all active visible objects. AKD: Optimised 12/5/99.
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...
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.
void MHEG5ClearSigCertCache(void)
Clear the signature certificate cache and all related information.
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.
void MHEG5streamUnloadAll(void)
Unsubscribe and unload all stream events.
void MHEG5CookieClearStore(void)
Delete all cookies from the temporary store.
E_FsStatus FG_FileExists(E_FS_ORIGIN origin, const char *fname)
Request file from file group stores.
Functions relating to Hybrid file system.
void MHEG5displayClear(void)
<Function description>="">
Key Press related functionality.
Engine support utility functions for MHEG5.
MHEG5Application * MHEG5getCurrentApplication(void)
<Function description>="">