57 #include "dsm_control.h" 68 #ifdef INCLUDE_FREESAT 69 #error Cannot define INCLUDE_NVM and INCLUDE_FREESAT in the same build 72 #define WRITE_BUFFER_MAX (64 * 1024) 74 #elif defined(INCLUDE_FREESAT) 75 #define WRITE_BUFFER_MAX (64 * 1024) 79 #define WRITE_BUFFER_MAX (2 * 1024) 83 #include "asn1_testHarness.h" 94 void *carousel_handle;
107 { 6, (U8BIT *)
"DSM://" },
108 { 5, (U8BIT *)
"CI://" },
109 { 9, (U8BIT *)
"hybrid://" }
113 static MHEG5Bool Restarted = MHEG5FALSE;
114 static void *BootupFileOrmHandle = NULL;
123 static U16BIT applStackCount = 0;
131 int mheg_trace_source = 1;
141 if (fontBody.ref.included.len != 0)
144 MHEG_PRINT(out,
":Font ");
145 if (fontBody.referenced == MHEG5TRUE)
147 if (fontBody.ref.referenced.grp.len)
149 MHEG5stringPrint(*((
MHEG5String *)&fontBody.ref.referenced.grp), out);
153 MHEG5stringPrint(((
MHEG5Group *)fontBody.ref.referenced.grp.ptr.group)->groupName, out);
155 MHEG_PRINT(out,
", ");
156 MHEG5intPrint(fontBody.ref.referenced.id, out);
160 MHEG5stringPrint(fontBody.ref.included, out);
175 int save_indent = MHEG5setIndent(0);
178 STB_DebugLogOpen(path.data);
182 MHEG5groupPrint(&application->group, out);
185 if (application->onSpawnCloseDown.a_ptr)
188 MHEG_PRINT(out,
":OnSpawnCloseDown ");
189 MHEG5actionPrint(application->onSpawnCloseDown, out);
192 if (application->onRestart.a_ptr)
195 MHEG_PRINT(out,
":OnRestart ");
196 MHEG5actionPrint(application->onRestart, out);
200 if (application->characterSet != 10)
203 MHEG_PRINT(out,
":CharacterSet ");
204 MHEG5intPrint(application->characterSet, out);
207 if (application->backgroundColour.value.i !=
OSDgetColour(TRANSPARENTCOLOR))
210 MHEG_PRINT(out,
":BackgroundColour ");
211 MHEG5colourPrint(application->backgroundColour, out);
216 MHEG_PRINT(out,
":TextColour ");
217 MHEG5colourPrint(application->textColour, out);
220 MHEG5fontBodyPrint(application->fontBody, out);
223 MHEG_PRINT(out,
":FontAttributes ");
224 MHEG5stringPrint(application->fontAttributes, out);
228 MHEG_PRINT(out,
":BitmapCHook ");
229 MHEG5intPrint(application->bitmapContentHook, out);
232 if (application->streamContentHook != 10)
235 MHEG_PRINT(out,
":StreamCHook: ");
236 MHEG5intPrint(application->streamContentHook, out);
239 if (application->textContentHook != 10)
242 MHEG_PRINT(out,
":TextCHook: ");
243 MHEG5intPrint(application->textContentHook, out);
246 if (application->lineArtContentHook != 0)
249 MHEG_PRINT(out,
":lineArtCHook: ");
250 MHEG5intPrint(application->lineArtContentHook, out);
276 MHEG_PRINT(out,
"}");
280 MHEG5setIndent(save_indent);
285 static void MHEG5unloadApp(
void)
289 H_ObjCarousel carousel;
294 assert( applStackCount != 0 );
298 carousel = applStack[applStackCount].carousel_handle;
300 assert( DSMCC_CurrentCarousel(dsmcc) == carousel );
302 changed = (applStack[applStackCount - 1].carousel_handle != carousel) ? TRUE : FALSE;
304 TRACE(TFILE, (
"crsl_hdl=%p stk=%d name=%s", carousel, applStackCount, applStack[applStackCount].app_name.data))
306 for (sp = 0; sp != applStackCount; sp++)
308 if (applStack[sp].carousel_handle == carousel)
317 TRACE(TFILE, (
"unload crsl_hdl=%p", carousel))
318 applStack[applStackCount].carousel_handle = NULL;
319 DSMCC_UnloadCarousel( dsmcc, carousel, RST_MODE_FORCE );
332 DSMCC_SetCurrentCarousel( dsmcc, applStack[applStackCount].carousel_handle );
338 void MHEG5applicationCarouselUnload(
void *carousel, BOOLEAN isNdt )
342 while (sp != applStackCount)
344 if (applStack[sp].carousel_handle == carousel)
347 for (i = sp; i != applStackCount; i++)
349 applStack[i] = applStack[i + 1];
351 applStack[applStackCount].app_name.data = NULL;
352 applStack[applStackCount].app_name.len = 0;
353 applStack[applStackCount].carousel_handle = NULL;
361 if (applStack[applStackCount].carousel_handle == carousel)
363 applStack[applStackCount].carousel_handle = NULL;
364 if (currentApplication != NULL && !isNdt)
366 MHEG5StartReboot(NULL);
371 void MHEG5applicationNDTcarouselAttach(
void *carousel)
373 TRACE(TFILE | TTUNE, (
"****** app name len=%d Carousel=%p *******",
374 applStack[0].app_name.len, carousel))
375 if (applStack[0].app_name.len)
377 applStack[0].carousel_handle = carousel;
384 void MHEG5applicationStackClear( BOOLEAN isNdt )
389 H_ObjCarousel carousel;
390 E_DsmRstMode mode = (isNdt) ? RST_MODE_PENDING : RST_MODE_FORCE;
393 TRACE(TFILE | TTUNE, (
"clearing app stack cnt=%d isNdt=%d", applStackCount, isNdt))
394 appstr = applStack[applStackCount].app_name;
395 applStack[applStackCount].app_name.data = NULL;
396 applStack[applStackCount].app_name.len = 0;
398 asc = (int)applStackCount;
402 if (applStack[asc].carousel_handle != NULL)
404 TRACE(TFILE, (
"asc=%d unload crsl_hdl=%p sa=%d", asc, applStack[asc].carousel_handle))
405 carousel = applStack[asc].carousel_handle;
406 applStack[asc].carousel_handle = NULL;
418 applStack[0].app_name = appstr;
423 currentApplication = 0;
426 applStack[0].spawned = MHEG5FALSE;
427 Restarted = MHEG5FALSE;
435 case MHEG5CONTENTREFVARIABLE:
437 len +=
sizeof(MHEG5Int);
439 case MHEG5INTEGERVARIABLE:
440 len =
sizeof(MHEG5Int);
442 case MHEG5BOOLEANVARIABLE:
445 case MHEG5OCTETSTRINGVARIABLE:
447 len +=
sizeof(MHEG5Int);
449 case MHEG5OBJECTREFVARIABLE:
451 len +=
sizeof(MHEG5Int) * 2;
461 while (actions.total != 0)
466 if ((actions.a_ptr->target != NULL) &&
467 (actions.a_ptr->target != (
MHEG5Root *)group) &&
468 (actions.a_ptr->target->grp == group))
471 actions.a_ptr->firstParam = actions.a_ptr->origFirstParam;
472 actions.a_ptr->target = NULL;
474 else if (actions.a_ptr->target == NULL)
477 actions.a_ptr->firstParam = actions.a_ptr->origFirstParam;
494 return currentApplication;
509 static void MHEG5applicationRetrieved(
void *userData,
S_CONTENT *content )
514 E_ProfileId currentProfileId, newProfileId;
516 TRACE(TMHBOOT | TFILE | TEVNTS, (
"(%.*s)", (
int)launchAppName.len, launchAppName.data))
518 if (userData == NULL)
527 assert( content->data );
540 TRACE(TFILE, (
"Got App (datalen=%ld)", (
long)content->size))
543 if (*(content->data) == 0xA0)
546 newProfileId = PROFILE_BROADCAST;
547 if (launchAppName.len >= 5)
549 if (memcmp(launchAppName.data,
"CI://", 5) == 0)
552 newProfileId = PROFILE_CI_PLUS;
559 if (mheg_trace_source)
560 MHEG5applicationPrint(newApplication, 0);
565 TRACE(TERROR, (
"This application is Text, and not ASN1 encoded!"))
566 newApplication = NULL;
571 TRACE(TERROR, (
"Failed to parse application (%.*s)", (
int)launchAppName.len, launchAppName.data))
578 if (currentApplication)
580 if ((applStackCount > 0) && (applStack[applStackCount].spawned))
589 if (applStack[applStackCount].app_name.len)
599 application = currentApplication;
600 if (application == NULL)
602 if (!Restarted && currentApplication == NULL)
605 MHEG5NotifyEngineStarted();
610 if (applStackCount != 0 &&
611 (applStack[applStackCount].spawned) &&
612 (application->onSpawnCloseDown.a_ptr != NULL))
614 assert( MH5GlueActiveState() == TRUE );
615 TRACE(TEVNTS, (
"onSpawnCloseDown %p, %p", application, application->onSpawnCloseDown))
622 application->streamContinuanceFlag = MHEG5TRUE;
626 if (applStackCount != 0 && applStack[applStackCount].spawned)
637 applStack[applStackCount].app_name = launchAppName;
646 newApplication->group.groupName = path;
659 if (application != 0)
663 MHEG5freeMem(application);
666 TRACE((TFILE | TPERFORM | TMEMORY), (
"Stopped any App"))
679 currentApplication = newApplication;
682 applStack[applStackCount].spawned = MHEG5FALSE;
684 TRACE((TFILE | TPERFORM), (
"Preparing %.*s", (
int)newApplication->group.groupName.len, (
char *)newApplication->group.groupName.data))
687 if (MH5GlueActiveState() == TRUE)
689 TRACE((TFILE | TPERFORM), (
"Running App"))
691 TRACE((TFILE | TPERFORM), (
"Started App"))
695 launchAppName.len = 0;
696 launchAppName.data = 0;
697 BootupFileOrmHandle = NULL;
726 if (!currentApplication)
730 return currentApplication->displayStackBottom;
760 if (!currentApplication)
764 s = currentApplication->displayStackTop;
765 while (s && (s->item != visible))
785 CALL_PRINT((
">> MHEG5displayStackAdd(%p %d)\n", visible, atTop));
789 if (visible->clazz == MHEG5RTGRAPHICS)
797 if (!currentApplication)
799 WARNING_PRINT((
"MHEG5displayStackAdd : currentApplication == Null\n"));
800 CALL_PRINT((
"<< MHEG5displayStackAdd\n"));
803 s = currentApplication->displayStackTop;
807 if (s->item == visible)
809 DEBUG_PRINT((
"MHEG5displayStackAdd : Item already in display stack\n"));
810 CALL_PRINT((
"<< MHEG5displayStackAdd\n"));
818 ERROR_PRINT((
"MHEG5displayStackAdd : MHEG5getMem failed\n"));
819 CALL_PRINT((
"<< MHEG5displayStackAdd\n"));
825 if (atTop == MHEG5TRUE)
827 if (currentApplication->displayStackTop)
829 currentApplication->displayStackTop->prev = s;
830 s->next = currentApplication->displayStackTop;
831 currentApplication->displayStackTop = s;
835 currentApplication->displayStackBottom = s;
836 currentApplication->displayStackTop = s;
841 if (currentApplication->displayStackBottom)
843 currentApplication->displayStackBottom->next = s;
844 s->prev = currentApplication->displayStackBottom;
845 currentApplication->displayStackBottom = s;
849 currentApplication->displayStackBottom = s;
850 currentApplication->displayStackTop = s;
854 CALL_PRINT((
"<< MHEG5displayStackAdd\n"));
868 CALL_PRINT((
">> MHEG5displayStackDelete(%p)\n", visible));
871 if (!currentApplication)
873 WARNING_PRINT((
"MHEG5displayStackDelete : currentApplication == Null\n"));
874 CALL_PRINT((
"<< MHEG5displayStackDelete MHEG5FALSE\n"));
877 s = currentApplication->displayStackTop;
881 if (s->item == visible)
885 s->prev->next = s->next;
889 currentApplication->displayStackTop = s->next;
893 s->next->prev = s->prev;
897 currentApplication->displayStackBottom = s->prev;
900 CALL_PRINT((
"<< MHEG5displayStackDelete MHEG5TRUE\n"));
906 CALL_PRINT((
"<< MHEG5displayStackDelete MHEG5FALSE\n"));
918 CALL_PRINT((
">> MHEG5displayStackToTop(%p)\n", visible));
925 CALL_PRINT((
"<< MHEG5displayStackToTop\n"));
936 CALL_PRINT((
">> MHEG5displayStackToBottom(%p)\n", visible));
943 CALL_PRINT((
"<< MHEG5displayStackToBottom\n"));
957 CALL_PRINT((
">> MHEG5displayStackPutBefore(%p, %p)\n", target, refVisible));
962 if (!currentApplication)
964 WARNING_PRINT((
"MHEG5displayStackPutBefore : currentApplication == Null\n"));
965 CALL_PRINT((
"<< MHEG5displayStackPutBefore\n"));
968 if (target == refVisible)
970 WARNING_PRINT((
"MHEG5displayStackPutBefore : target == refVisible\n"));
971 CALL_PRINT((
"<< MHEG5displayStackPutBefore\n"));
974 w = currentApplication->displayStackTop;
978 CALL_PRINT((
"<< MHEG5displayStackPutBefore\n"));
987 if (w->item == refVisible)
1004 currentApplication->displayStackTop = s;
1007 CALL_PRINT((
"<< MHEG5displayStackPutBefore\n"));
1016 WARNING_PRINT((
"MHEG5displayStackPutBefore : Unable to find refVisible in display stack\n"));
1017 CALL_PRINT((
"<< MHEG5displayStackPutBefore\n"));
1031 CALL_PRINT((
">> MHEG5displayStackPutBehind(%p, %p)\n", target, refVisible));
1035 if (!currentApplication)
1037 WARNING_PRINT((
"MHEG5displayStackPutBehind : currentApplication == Null\n"));
1038 CALL_PRINT((
"<< MHEG5displayStackPutBehind\n"));
1041 if (target == refVisible)
1043 WARNING_PRINT((
"MHEG5displayStackPutBehind : target == refVisible\n"));
1044 CALL_PRINT((
"<< MHEG5displayStackPutBehind\n"));
1047 w = currentApplication->displayStackTop;
1051 CALL_PRINT((
"<< MHEG5displayStackPutBehind\n"));
1060 if (w->item == refVisible)
1077 currentApplication->displayStackBottom = s;
1080 CALL_PRINT((
"<< MHEG5displayStackPutBehind\n"));
1089 WARNING_PRINT((
"MHEG5displayStackPutBehind : Unable to find refVisible in display stack\n"));
1090 CALL_PRINT((
"<< MHEG5displayStackPutBehind\n"));
1100 assert(application);
1104 MHEG5colourInit(&application->backgroundColour,
OSDgetColour(TRANSPARENTCOLOR));
1105 MHEG5colourInit(&application->textColour,
OSDgetColour(DEFAULTTEXTCOLOR));
1106 MHEG5colourInit(&application->buttonRefColour,
OSDgetColour(DEFAULTBUTTONCOLOR));
1107 MHEG5colourInit(&application->highlightRefColour,
OSDgetColour(DEFAULTHIGHLIGHTCOLOR));
1108 MHEG5colourInit(&application->sliderRefColour,
OSDgetColour(DEFAULTSLIDERCOLOR));
1109 MHEG5colourInit(&application->desktopColour,
OSDgetColour(DEFAULTDESKTOPCOLOUR));
1115 application->characterSet = 10;
1116 application->bitmapContentHook = 4;
1117 application->streamContentHook = 10;
1118 application->textContentHook = 10;
1130 assert(application);
1136 MHEG5colourDestruct(&application->backgroundColour);
1137 MHEG5colourDestruct(&application->textColour);
1138 if (application->fontBody.referenced)
1140 if (application->fontBody.ref.referenced.grp.len)
1150 MHEG5colourDestruct(&application->buttonRefColour);
1151 MHEG5colourDestruct(&application->highlightRefColour);
1152 MHEG5colourDestruct(&application->sliderRefColour);
1165 MHEG5Bool foundAudio = MHEG5FALSE;
1166 MHEG5Bool foundVideo = MHEG5FALSE;
1167 #ifndef MHEG5PROFILE_UK1_06 1168 MHEG5Bool foundRTGraphics = MHEG5FALSE;
1171 assert(application);
1173 application->lockCount = 0;
1175 if (application->onSpawnCloseDown.a_ptr)
1177 TRACE(TEVNTS, (
"onSpawnCloseDown %p, %p", application, application->onSpawnCloseDown))
1180 if (application->onRestart.a_ptr)
1182 TRACE(TEVNTS, (
"onRestart %p, %p", application, application->onRestart))
1193 item = application->group.itemHead;
1197 if ((item->root.clazz == MHEG5STREAM) && (!item->initiallyStopped))
1203 while ((mcnt != MAX_MLTPLX) && (((
MHEG5Stream *)item)->multiplex[mcnt]))
1205 if (!((
MHEG5Stream *)item)->multiplex[mcnt]->initiallyStopped)
1207 switch (((
MHEG5Stream *)item)->multiplex[mcnt]->root.clazz)
1211 foundAudio = MHEG5TRUE;
1215 foundVideo = MHEG5TRUE;
1217 #ifndef MHEG5PROFILE_UK1_06 1218 case MHEG5RTGRAPHICS:
1220 foundRTGraphics = MHEG5TRUE;
1224 ERROR_PRINT((
"ERROR: Unexpected object in stream multiplex\n"));
1250 #ifndef MHEG5PROFILE_UK1_06 1251 if (!foundRTGraphics)
1279 #if defined(INCLUDE_CI_PLUS) 1284 while (application->displayStackTop)
1286 t = application->displayStackTop;
1287 application->displayStackTop = application->displayStackTop->next;
1290 application->displayStackBottom = 0;
1292 if (application == currentApplication)
1294 currentApplication = 0;
1313 if (!currentApplication->group.root.runningStatus)
1327 if ((Restarted) && (currentApplication->onRestart.a_ptr != NULL))
1329 TRACE(TEVNTS, (
"onRestart %p, %p", currentApplication, currentApplication->onRestart))
1332 Restarted = MHEG5FALSE;
1346 assert(application);
1351 MHEG5LogPrintf(MHEG5CALLS,
"App Deactivate ");
1352 MHEG5LogPrintObjectPtr(MHEG5CALLS, (
MHEG5Root *) application);
1353 MHEG5LogPrintf(MHEG5CALLS,
"\n");
1378 MHEG5Int error = 0, pos = 0;
1380 MHEG5Bool invalidString;
1381 MHEG5ErrorCode returnCode = MHEG5ERR_NOERROR;
1385 U32BIT buffer_length = 0;
1386 #ifdef INCLUDE_FREESAT 1387 MHEG5Int expires = -1;
1388 MHEG5Int priority = -1;
1392 if (target != (
MHEG5Root *) currentApplication)
1394 return MHEG5ERR_WRONGTARGET;
1398 return MHEG5ERR_WRONGNUMBEROFPARAMS;
1400 thirdParam = MHEG5resolveORef(params, &rc);
1403 return MHEG5ERR_REFERENCEDPARAMNOTAVAILABLE;
1405 if (rc->clazz != MHEG5BOOLEANVARIABLE)
1407 return MHEG5ERR_WRONGPARAM;
1411 return MHEG5ERR_WRONGNUMBEROFPARAMS;
1413 if (thirdParam->generic.type != MHEG5BRACKETOPEN)
1415 return MHEG5ERR_WRONGPARAM;
1421 lastParam = thirdParam;
1422 while (lastParam->next)
1424 lastParam = lastParam->next;
1430 if ((invalidString) || (fn.len == 0))
1433 return MHEG5ERR_WRONGPARAM;
1435 thirdParam = thirdParam->next;
1436 #ifdef INCLUDE_FREESAT 1438 fn.len >= 6 && memcmp(fn.data,
"nvm://", 6) == 0)
1440 if (thirdParam && (thirdParam->generic.type != MHEG5BRACKETCLOSE))
1442 thirdParam = MHEG5resolveORef(thirdParam, ¶m);
1443 if (param->clazz == MHEG5INTEGERVARIABLE)
1448 if (thirdParam && (thirdParam->generic.type != MHEG5BRACKETCLOSE))
1450 thirdParam = MHEG5resolveORef(thirdParam, ¶m);
1451 if (param->clazz == MHEG5INTEGERVARIABLE)
1460 nextParam = thirdParam;
1461 while (nextParam && (nextParam->generic.type != MHEG5BRACKETCLOSE))
1463 nextParam = MHEG5resolveORef(nextParam, &peek_param);
1466 return MHEG5ERR_WRONGPARAM;
1468 buffer_length += storageSizeForVariable((
MHEG5Ingredient *)peek_param);
1472 return MHEG5ERR_WRONGPARAM;
1474 buf = MHEG5getMem(buffer_length);
1477 while (thirdParam && (thirdParam->generic.type != MHEG5BRACKETCLOSE))
1479 thirdParam = MHEG5resolveORef(thirdParam, ¶m);
1485 return MHEG5ERR_NOERROR;
1490 if (fn.len > 6 && memcmp(fn.data,
"ram://", 6) == 0)
1493 returnCode = MHEG5ERR_NOERROR;
1497 fn.len >= 6 && memcmp(fn.data,
"nvm://", 6) == 0)
1499 fn.data += 6; fn.len -= 6;
1501 returnCode = MHEG5ERR_NOERROR;
1505 else if (fn.len >= 6 && memcmp(fn.data,
"pst://", 6) == 0)
1510 returnCode = MHEG5ERR_NOERROR;
1513 #ifdef INCLUDE_FREESAT 1515 fn.len >= 6 && memcmp(fn.data,
"nvm://", 6) == 0)
1517 fn.data += 6; fn.len -= 6;
1519 returnCode = MHEG5ERR_NOERROR;
1525 returnCode = MHEG5ERR_WRONGPARAM;
1552 MHEG5Int error = 0, pos = 0;
1553 MHEG5Bool getSuccess = MHEG5FALSE;
1555 MHEG5Bool invalidString;
1556 MHEG5Int maximum_len;
1557 #ifdef INCLUDE_FREESAT 1564 if (target != (
MHEG5Root *) currentApplication)
1566 return MHEG5ERR_WRONGTARGET;
1570 return MHEG5ERR_WRONGNUMBEROFPARAMS;
1572 thirdParam = MHEG5resolveORef(params, &rc);
1575 return MHEG5ERR_REFERENCEDPARAMNOTAVAILABLE;
1577 if (rc->clazz != MHEG5BOOLEANVARIABLE)
1579 return MHEG5ERR_WRONGPARAM;
1583 return MHEG5ERR_WRONGNUMBEROFPARAMS;
1585 if (thirdParam->generic.type != MHEG5BRACKETOPEN)
1587 return MHEG5ERR_WRONGPARAM;
1589 thirdParam = thirdParam->next;
1592 return MHEG5ERR_WRONGNUMBEROFPARAMS;
1596 lastParam = thirdParam;
1597 while (lastParam->next)
1599 lastParam = lastParam->next;
1605 if ((invalidString) || (fn.len == 0))
1608 return MHEG5ERR_WRONGPARAM;
1611 if (fn.len > 6 && memcmp(fn.data,
"ram://", 6) == 0)
1617 fn.len >= 6 && memcmp(fn.data,
"nvm://", 6) == 0)
1619 fn.data += 6; fn.len -= 6;
1623 #ifdef INCLUDE_FREESAT 1625 fn.len >= 6 && memcmp(fn.data,
"nvm://", 6) == 0)
1627 short_fn.data = fn.data + 6;
1628 short_fn.len = fn.len - 6;
1629 getSuccess = MHEG5FSnvmRead(short_fn, (
void **) &buf, &len, &expires, &priority);
1633 else if (fn.len >= 6 && memcmp(fn.data,
"pst://", 6) == 0)
1643 return MHEG5ERR_NOERROR;
1646 #ifdef INCLUDE_FREESAT 1648 fn.len >= 6 && memcmp(fn.data,
"nvm://", 6) == 0)
1650 if (thirdParam && (thirdParam->generic.type != MHEG5BRACKETCLOSE))
1652 thirdParam = MHEG5resolveORef(thirdParam, ¶m);
1657 return MHEG5ERR_NOERROR;
1660 if (thirdParam && (thirdParam->generic.type != MHEG5BRACKETCLOSE))
1662 thirdParam = MHEG5resolveORef(thirdParam, ¶m);
1667 return MHEG5ERR_NOERROR;
1673 while (thirdParam && (thirdParam->generic.type != MHEG5BRACKETCLOSE))
1675 thirdParam = MHEG5resolveORef(thirdParam, ¶m);
1679 return MHEG5ERR_WRONGNUMBEROFPARAMS;
1685 return MHEG5ERR_NOERROR;
1690 return MHEG5ERR_NOERROR;
1697 static void MHEG5applicationRetrieveFail(
void *userData )
1699 USE_UNWANTED_PARAM(userData);
1703 if (currentApplication)
1709 TRACE(TERROR, (
"%d, Failed to retrieve App %.*s", applStackCount, (
int)launchAppName.len, launchAppName.data))
1711 assert( launchAppName.len );
1713 if (applStackCount == 0)
1715 if (applStack[0].app_name.data == launchAppName.data)
1717 #ifndef CI_PLUS_ONLY 1718 if (applStack[0].carousel_handle != NULL)
1722 MHEG5StartReboot(NULL);
1725 applStack[0].app_name.data = NULL;
1728 else if (applStack[applStackCount].spawned)
1741 static void MHEG5applicationBootFail(
void *userData )
1744 U32BIT stage = pBootData->stage;
1747 TRACE(TMHBOOT, (
"%d, Failed to retrieve App %.*s", applStackCount, (
int)launchAppName.len, launchAppName.data))
1749 assert( pBootData );
1750 assert( launchAppName.len );
1751 assert( currentApplication == NULL );
1752 assert( applStackCount == 0 );
1753 assert( pBootData->origin < 3 );
1757 case 0: launchAppName.len = oldName.len + 2;
break;
1758 case 1: launchAppName.len = oldName.len + 6;
break;
1759 case 2: launchAppName.len = boot_origins[pBootData->origin].len + 1;
break;
1760 case 3: launchAppName.len = boot_origins[pBootData->origin].len + 7;
break;
1761 default: launchAppName.len = 0;
1763 if (launchAppName.len)
1765 launchAppName.data = (MHEG5Byte *) STR_DataAlloc( launchAppName.len );
1766 if (launchAppName.data == 0)
1768 TRACE(TERROR, (
"Out of Memory"))
1769 launchAppName.len = 0;
1777 memcpy(launchAppName.data, oldName.data, oldName.len);
1778 launchAppName.data[oldName.len] =
'/';
1779 launchAppName.data[oldName.len + 1] =
'a';
1783 memcpy(launchAppName.data, oldName.data, oldName.len);
1784 launchAppName.data[oldName.len - 1] =
'\0';
1785 strcat((
char *)launchAppName.data,
"startup");
1789 strcpy((
char *)launchAppName.data, (
char *)boot_origins[pBootData->origin].data );
1790 strcat((
char *)launchAppName.data,
"a");
1794 strcpy((
char *)launchAppName.data, (
char *)boot_origins[pBootData->origin].data );
1795 strcat((
char *)launchAppName.data,
"startup");
1805 BootupFileOrmHandle =
MHEG5FileOrmGet( launchAppName, FRP_APPLICATION | FRP_CACHE_DEFAULT,
1806 (
void *)pBootData, MHEG5applicationRetrieved, MHEG5applicationBootFail );
1812 MHEG5NotifyEngineStartFailed();
1814 BootupFileOrmHandle = NULL;
1830 MHEG5ErrorCode err = MHEG5ERR_NOERROR;
1831 TRACE((TFILE | TPERFORM), (
"Launch App %.*s", (
int)gname.len, gname.data))
1833 USE_UNWANTED_PARAM(
id);
1835 assert( launchAppName.len == 0 );
1839 if (launchAppName.len == 0)
1841 ERROR_PRINT((
"ERROR: MHEG5Applaunch - failed to resolve path\n"));
1842 if (currentApplication != NULL)
1847 err = MHEG5ERR_IGNORE_ACTION;
1851 assert( launchAppName.data );
1859 TRACE(TFILE | TEVNTS, (
"(%.*s)", (
int)launchAppName.len, launchAppName.data))
1864 (void)
MHEG5FileOrmGet( launchAppName, FRP_APPLICATION | FRP_CACHE_DEFAULT,
1865 NULL, MHEG5applicationRetrieved, MHEG5applicationRetrieveFail );
1893 MHEG5ErrorCode err = MHEG5ERR_NOERROR;
1896 assert( currentApplication == NULL );
1898 if (currentApplication != NULL)
1900 return MHEG5ERR_NOERROR;
1905 if ((app_name == NULL) || (strlen(app_name) == 0))
1911 BootData.origin = ORIGIN_HYBRID;
1916 BootData.origin = ORIGIN_DSM;
1919 launchAppName.len = boot_origins[BootData.origin].len + 1;
1921 launchAppName.data = (MHEG5Byte *) STR_DataAlloc( launchAppName.len );
1922 if (launchAppName.data == 0)
1924 TRACE(TERROR, (
"Out of Memory"))
1925 launchAppName.len = 0;
1929 strcpy((
char *)launchAppName.data, (
char *)boot_origins[BootData.origin].data );
1930 strcat((
char *)launchAppName.data,
"a" );
1937 while (app_name[name.len] !=
'\0')
1939 if (app_name[name.len] ==
'\\')
1941 app_name[name.len] =
'/';
1947 while (name.len != 0 && app_name[name.len - 1] ==
'/')
1950 app_name[name.len] =
'\0';
1953 name.data = (MHEG5Byte *)app_name;
1957 if (launchAppName.len != 0)
1959 if ( BootData.origin == ORIGIN_CI || single )
1970 TRACE(TMHBOOT | TFILE, (
"(%.*s)", (
int)launchAppName.len, launchAppName.data))
1971 if (launchAppName.len)
1974 BootupFileOrmHandle =
MHEG5FileOrmGet( launchAppName, FRP_APPLICATION | FRP_CACHE_DEFAULT,
1975 &BootData, MHEG5applicationRetrieved, MHEG5applicationBootFail );
1979 err = MHEG5ERR_TARGETNOTAVAILABLE;
1991 if (BootupFileOrmHandle != NULL)
2013 item = application->group.itemHead;
2017 if ((item->root.clazz == MHEG5LINK) &&
2018 (item->root.availabilityStatus == MHEG5TRUE))
2021 ClearGroupTargets(link->linkEffect, group);
2027 ClearGroupTargets(application->onSpawnCloseDown, group);
2030 ClearGroupTargets(application->onRestart, group);
2044 item = application->group.itemHead;
2048 if ((item->root.clazz == MHEG5LINK) &&
2049 (item->root.availabilityStatus == MHEG5TRUE))
2075 if ((
id != 0) || (gref.len == 0))
2077 ERROR_PRINT((
"ERROR: MHEG5launch - id not zero (%ld) or name len zero (%ld)\n",
id, gref.len));
2078 err = MHEG5ERR_IGNORE_ACTION;
2080 else if (currentApplication &&
MHEG5sameGroup(¤tApplication->group, gref))
2083 WARNING_PRINT((
"MHEG5launch - abort, application already active\n"));
2084 err = MHEG5ERR_IGNORE_ACTION;
2089 name.len = gref.len;
2090 name.data = gref.ptr.name;
2091 TRACE((TFILE | TPERFORM), (
"launch app %.*s id=%ld", (
int)name.len, name.data,
id))
2110 MHEG5ErrorCode err = MHEG5ERR_IGNORE_ACTION;
2112 if (applStackCount < (MAX_APPS - 1))
2115 applStack[applStackCount].app_name.len = 0;
2116 applStack[applStackCount].app_name.data = NULL;
2117 applStack[applStackCount].carousel_handle = NULL;
2118 applStack[applStackCount].spawned = MHEG5TRUE;
2120 err = MHEG5launch(target, params);
2121 if (err != MHEG5ERR_NOERROR)
2130 err = MHEG5launch(target, params);
2149 if (target != (
MHEG5Root *) currentApplication)
2151 return MHEG5ERR_WRONGTARGET;
2156 return MHEG5ERR_NOERROR;
2180 MHEG5freeMem(scene);
2186 application = currentApplication;
2187 if (application != 0)
2193 application->streamContinuanceFlag = MHEG5TRUE;
2196 MHEG5freeMem(application);
2197 currentApplication = NULL;
2200 #ifdef MHG_TRACK_MEM 2202 TRACE(TMEMORY, (
"quit app done"))
2203 mh5emt_print(1 << SRCMEM_APP);
2212 if (applStackCount != 0)
2217 Restarted = MHEG5TRUE;
2221 TRACE(TFILE, (
"relaunching App"))
2223 launchAppName = applStack[applStackCount].app_name;
2224 applStack[applStackCount].app_name.len = 0;
2228 (void)
MHEG5FileOrmGet( launchAppName, FRP_APPLICATION | FRP_CACHE_DEFAULT, NULL,
2229 MHEG5applicationRetrieved, MHEG5applicationRetrieveFail );
2234 TRACE(TFILE, (
"Restart Boot App"))
2246 MHEG5NotifyEngineQuit();
2250 MHEG5StartReboot(NULL);
2267 if (target != (
MHEG5Root *) currentApplication)
2269 return MHEG5ERR_WRONGTARGET;
2272 DEBUG_PRINT((
" Old lockCount is %d\n", currentApplication->lockCount));
2274 if (currentApplication->lockCount <= 0)
2276 currentApplication->lockCount = 0;
2281 currentApplication->lockCount++;
2282 DEBUG_PRINT((
" New lockCount is %d\n", currentApplication->lockCount));
2284 return MHEG5ERR_NOERROR;
2301 if (target != (
MHEG5Root *) currentApplication)
2303 return MHEG5ERR_WRONGTARGET;
2306 DEBUG_PRINT((
" Old lockCount is %d\n", currentApplication->lockCount));
2308 currentApplication->lockCount--;
2309 if (currentApplication->lockCount < 0)
2311 currentApplication->lockCount = 0;
2313 DEBUG_PRINT((
" New lockCount is %d\n", currentApplication->lockCount));
2315 return MHEG5ERR_NOERROR;
2318 #ifndef MHEG5PROFILE_UK1_06 2330 USE_UNWANTED_PARAM(params);
2331 return MHEG5ERR_NOTSUPPORTEDBYPROFILE;
2345 USE_UNWANTED_PARAM(params);
2346 return MHEG5ERR_NOTSUPPORTEDBYPROFILE;
2392 MHEG5ErrorCode MHEG5getEngineSupport(MHEG5Root *target, MHEG5GList *params) 2397 MHEG5Bool invalidString;
2401 if (target != (
MHEG5Root *) currentApplication)
2403 return MHEG5ERR_WRONGTARGET;
2407 return MHEG5ERR_WRONGNUMBEROFPARAMS;
2413 return MHEG5ERR_WRONGPARAM;
2417 return MHEG5ERR_WRONGNUMBEROFPARAMS;
2419 MHEG5resolveORef(thirdParam, &bVar);
2422 return MHEG5ERR_WRONGNUMBEROFPARAMS;
2424 if (bVar->clazz != MHEG5BOOLEANVARIABLE)
2426 return MHEG5ERR_WRONGPARAM;
2429 if (feature.len < 3)
2438 return MHEG5ERR_NOERROR;
2457 if (target != (
MHEG5Root *) currentApplication)
2459 return MHEG5ERR_WRONGTARGET;
2462 return MHEG5ERR_WRONGNUMBEROFPARAMS;
2463 MHEG5resolveGenericGeneric(params, &newDesktopColour);
2469 return MHEG5ERR_NOERROR;
void MH5_SetCurrentProfile(E_ProfileId profile)
Set current profile - CI plus or broadcast (Could extend this fnc to distuinguish between UK/HK/NZ/AU...
Implement MHEG5 engine control functions (i.e. start/stop etc)
void MHEG5sceneDestruct(MHEG5Scene *scene)
Destruct a scene object.
void MHEG5groupDestruct(MHEG5Group *group)
Implementation of the Destruction behaviour Destruction.
MHEG5Bool MHEG5storageRead(MHEG5String fn, void **buf, MHEG5Int *len)
Read a file from the persistent store.
MHEG5Bool MHEG5sameGroup(MH5GroupPtr gptr, MH5GroupRef gref)
Compares group ptr with group ref to see whether they both reference the same group. The first is pointer to group, the second can be a relative group name and will be converted to absolute prior to the comparison, so two different references that resolve to reference the same group name produces a True return value.
void MHEG5applicationBootAbort(void)
Aborts launch of Boot Application.
MHEG5Int MHEG5variableStore(MHEG5Ingredient *v, void *buf, MHEG5Int bufLen)
This functions stores the value of a variable in the persistant storage. Implementation of the StoreP...
Interface functions to DSM-CC instance for MHEG5.
void MHEG5applicationClearGroupTargets(MHEG5Application *application, MHEG5Group *group)
Clear targets of actions if they are ingredients of the given group.
MHEG5ErrorCode MHEG5readPersistent(MHEG5Root *target, MHEG5GList *params)
Implementation of the ReadPersistent (ReadSucceded, OutVariables, InFileName) action from the applica...
void MHEG5queueEvents(void)
Allow future events to be stored in the event queues. See also MHEG5stopEventsAndQueueReset.
MHEG5ErrorCode MHEG5unlockScreen(MHEG5Root *target, MHEG5GList *params)
Impelemtation of the UnlockScreen action of the application class This action may refresh the display...
True Persistent Storage functions.
void MHEG5sceneFree(MHEG5Scene *scene)
Free off all memory associated with the specified object, including any exchanged attributes and inte...
void MHEG5actionListExecute(MHEG5Group *source, MHEG5ActionList actions)
Execute the supplied list of actions immediately. The actions will have been executed by the time the...
void MHEG5applicationResolveTargets(MHEG5Application *application)
Resolve unresolved targets of actions in the application.
void MHEG5SuppressMHEGGraphics(MHEG5Bool request)
Request that the external application toggles between showing MHEG graphics or subtitles This functio...
void MHEG5displayUpdate(void)
Update the display, redrawing any visible objects that are in the dirty rectangle.
MHEG5Application * asn1_parseApplication(unsigned char *asnData, unsigned long dataLength)
Top level ASN.1 parser interface function. Creates and fills a MHEG5Application object from a char ar...
void MHEG5groupInit(MHEG5Group *group)
Initialise an Group object with default Values.
MHEG5Bool MHEG5TpsWrite(MHEG5String fn, void *data, MHEG5Int len)
Write data passed from the application into the TPS stroe.
void MHEG5TpsClose()
Close the clear the store and delete the cache none.
MHEG5ErrorCode MHEG5lockScreen(MHEG5Root *target, MHEG5GList *params)
Implementation of the LockScreen action of the application class Freeze the display screen and preven...
void MHEG5groupDeactivate(MHEG5Group *group)
Implementation of the Deactivation behaviour Deactivation If group is not active, ignore behaviour...
void MHEG5groupFree(MHEG5Group *group)
Free off all memory associated with the specified object, including any exchanged attributes and inte...
void MHEG5applicationInit(MHEG5Application *application)
Initialise an application object with default values. This function initialises an application object...
MHEG5Bool MHEG5nvmWrite(MHEG5String fn, void *buf, MHEG5Int len)
Write a file to the persistent store.
void MHEG5applicationFree(MHEG5Application *application)
Free off all memory associated with the specified object, including any exchanged attributes and inte...
MHEG5Root * MHEG5displayStackGetVisible(MHEG5DisplayStackItem *item)
This function returns the visible at a specific display stack positon.
MHEG5Int MHEG5variableRead(MHEG5Ingredient *v, char *buf, MHEG5Int max_size)
This functions reads the value of a variable from the persistant storage. Implementation of the ReadP...
void * MHEG5FileOrmGet(MHEG5String name, U16BIT priority, void *userData, F_CB_Good cbGood, F_CB_Fail cbFail)
Get a file. The file will be loaded and one of the callback functions called when request is resolved...
void MHEG5genericCopy(MHEG5Generic *dest, MHEG5Generic *src)
Copy a MHEG5Generic.
void * MHEG5_DsmccInstance(void)
Get the DSMCC instance handle.
void MHEG5groupPrepare(MHEG5Group *group)
Implementation of the Preparation behaviour Preparation.
MHEG5Bool MHEG5storageWrite(MHEG5String fn, void *buf, MHEG5Int len)
Write a file to the persistent store.
Interface functions for invoking the ASN.1 parser.
void MHEG5applicationPrepare(MHEG5Application *application)
Apply the group preparation behaviour.
E_ProfileId MH5_GetCurrentProfile(void)
Get current profile - CI plus or broadcast.
void MHEG5FileOrmReset(MHEG5FileOrmResetMode resetMode)
Reset the ORM module. This function supports two modes:
void MHEG5applicationDestruct(MHEG5Application *application)
Destruct an application object. This function destructs all parts of an application object...
MHEG5DisplayStackItem * MHEG5displayStackPrev(MHEG5DisplayStackItem *item)
This function returns a pointer to the previous item in the display stack. The input parameter is a D...
void MHEG5restoreReceiverDefaults(void)
Restore receiver defaults as described in section 3.12.10 of the 1.06 profile.
Implement the MHEG5 Variable Class 21 Variable Class Defines a variable within the context of a Group...
MHEG5ErrorCode MHEG5spawn(MHEG5Root *target, MHEG5GList *params)
Implementation of the Spawn action from the application class +Execute the OnSpawnCloseDown Action of...
void MHEG5stringDestruct(MHEG5String *item)
Destruct a MHEG5String.
MHEG5Int MH5_MaxStorageFileLength(void)
Return maximum length of file for persistent storage depending on supported profiles (e...
void MHEG5stopEventsAndResetQueue(void)
Discard any pending events and actions and prevent future events from being queued. And reset queues. See also MHEG5queueEvents.
MHEG5Bool MHEG5displayStackDelete(MHEG5Root *visible)
This function removes the reference to a visible object from the display stack.
MHEG5ErrorCode MHEG5setDesktopColour(MHEG5Root *target, MHEG5GList *params)
Impelemtation of the SetDesktopColour action of the application class This action may refresh the dis...
void MHEG5displayVideoStop(void)
Stops playback of the video media decoder.
MHEG5Application * MHEG5getCurrentApplication(void)
Retrieve the current Application.
OSDColor OSDgetColour(const char *colour, int len)
Converts an MHEG5 colour value to an OSDColor type.
MHEG5ErrorCode MHEG5closeConnection(MHEG5Root *target, MHEG5GList *params)
Impelemtation of the CloseConnection(ConnectionTag) action of the application class |NOT IMPLEMENTED...
void MHEG5streamClearCurrentService(void)
Clear the current service.
void MHEG5FileOrmClear(void *orm_ref)
Aborts a request for file.
void MHEG5displayStackToBottom(MHEG5Root *visible)
Move a visible to the Bottom of the display stack.
Persistent storage module. The engine provides a persistent storage for 1024 bytes of data...
void MHEG5displayAudioStop(void)
Stops playback of the audio media decoder.
void MHEG5displayStackToTop(MHEG5Root *visible)
Move a Visible to the Top of the display stack.
void MHEG5ClearTlsCertStore(void)
Clear the TLS certificate store.
This file defines the profile for the MHEG engine.
MHEG5DisplayStackItem * MHEG5displayStackBottom(void)
This function returns a pointer to the DisplayStackItem at the Bottom of the Stack.
MHEG5GList * MHEG5resolveGenericOctetString(MHEG5GList *params, MHEG5String *value, MHEG5Bool *invalidString)
Resolve a parameter reference to a generic octet string. The reference can be either direct or indire...
void MHEG5displayStackAdd(MHEG5Root *visible, MHEG5Bool atTop)
This function adds a visible to the display stack. The parameter atTop defines if the Visible is adde...
Implement Functions to support Service Gateways. Functions for standarizing several GroupIDs like +DS...
MHEG5Bool MHEG5TpsRead(MHEG5String fn, void **data, MHEG5Int *len)
Read a file from the TPS store and pass it back to the application.
MHEG5String MHEG5convertGIDGetOrigin(MHEG5String *inRef, E_FS_ORIGIN *pOrigin)
Convert a group ID from a relative reference to an absolute reference. See UK1.05 section 8...
void MHEG5setWorkingDir(MHEG5String source)
Set the working directory for the current application. This is used to resolve relative paths...
Event handling. Implementation of a combined queue for events and actions. This is the eventsystem wh...
Functions relating to HTTPS Server Access.
MHEG5ErrorCode MHEG5quit(MHEG5Root *target, MHEG5GList *params)
Implementation of the Quit action from the application class Close an application and restart the pre...
void MHEG5ActivateCurrentApplication(void)
Apply the group activation behaviour.
void MHEG5displayStackPutBehind(MHEG5Root *target, MHEG5Root *refVisible)
Put a Visible exactly below another Visible in the display stack.
void MHEG5displayStackPutBefore(MHEG5Root *target, MHEG5Root *refVisible)
Put a Visible exactly in front of another Visible in the display stack.
void MHEG5quitApp(void)
Close an application because of the Quit Application Event defined by DTG.
Implement functions to retrieve MHEG5objects by GroupID and ID.
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.
Mheg5 logging and debug printing.
MHEG5ErrorCode MHEG5storePersistent(MHEG5Root *target, MHEG5GList *params)
Implementation of the StorePersistent (StoreSucceeded, InVariables, OutFileName) action from the appl...
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...
MHEG5ErrorCode MHEG5openConnection(MHEG5Root *target, MHEG5GList *params)
Impelemtation of the OpenConnection (OpenSucceeded, Protocol, Address, ConnectionTag) action of the a...
File interface functions to DSMCC component.
MHEG5DisplayStackItem * MHEG5displayStackPrevVisible(MHEG5Root *visible)
This function returns a pointer to the previous item in the display stack. The input parameter is a V...
void MHEG5actionDestruct(MHEG5ActionList actions)
<Function description>="">
void MHEG5PopHybridFileSystem(void)
Clear the current hybrid file system and pop a stored hybrid file system from the stack...
void MHEG5displayLockStreams(void)
Lock streams, disallow any stream updates.
MHEG5ErrorCode MHEG5applicationLaunch(MHEG5String gname, MHEG5Int id)
Implementation of the Launch action from the application class Activate a new application by flushing...
MHEG5Scene * MHEG5getCurrentScene(void)
<Function description>="">
void MHEG5sendEvent(MHEG5Root *source, MHEG5EventType event, MHEG5Int data)
Store an event in the asynchronous event queue.
void MHEG5PushHybridFileSystem(void)
Push a copy of the current hybrid file system into the stack.
Functions relating to TLS certificate store.
MHEG5Bool MH5_SupportInteractionChannel(void)
Return whether Interaction channel is supported by current profile.
void MHEG5queueResolveTargets(MHEG5ActionList actions)
Finds targets for the action list.
Definition of colour type for MHEG5 - settings and conversions.
void MHEG5displayShowAll(void)
Redisplay all active visible objects. AKD: Optimised 12/5/99.
MHEG5String MHEG5convertGID(MHEG5String *inRef)
Convert a group ID from a relative reference to an absolute reference. See UK1.05 section 8...
void MHEG5displayResetStreamDecoders(BOOLEAN update)
Reset all media decoders to default values. This is used when the MHEG-5 engine is terminated...
void MHEG5applicationDeactivate(MHEG5Application *application)
Apply the application deactivation behaviour +Apply the CloseConnection action to all opened auxiliar...
MHEG5ErrorCode MHEG5applicationBootup(char *app_name, BOOLEAN single)
Launches Boot Application according to name rules: This function will authenticate and resolve a file...
Implement generic MHEG5-display functions - independent from the OSD These are generic functions used...
void MHEG5displayRtgraphicsStop(void)
Stops playback of the RTGraphics (subtitle) media decoder.
void MHEG5enableEventProcessing(MHEG5Bool enable)
Enable or disable engine event processing. This function is used to implement the Call action for res...
MHEG5Bool MHEG5nvmRead(MHEG5String fn, void **buf, MHEG5Int *len)
Read a file from the persistent store.
Functions relating to Hybrid file system.
void MHEG5displayClear(void)
<Function description>="">
MHEG5GList * MHEG5resolveGenericORefProper(MHEG5GList *params, MH5GroupRef *pgroupRef, MHEG5Int *id)
Resolve a generic object reference, returning the object reference. The reference can be direct or in...
Engine support utility functions for MHEG5.
MHEG5Bool MH5_GetEngineSupport(MHEG5String feature)
Used by the GetEngineSupport action.
void MHEG5groupActivate(MHEG5Group *group)
Implementation of the Activation behaviour Activation.