diff options
Diffstat (limited to 'fmb_player_apl/src/scr/ExecPlaySlow.c')
-rw-r--r-- | fmb_player_apl/src/scr/ExecPlaySlow.c | 158 |
1 files changed, 158 insertions, 0 deletions
diff --git a/fmb_player_apl/src/scr/ExecPlaySlow.c b/fmb_player_apl/src/scr/ExecPlaySlow.c new file mode 100644 index 0000000..46657bc --- /dev/null +++ b/fmb_player_apl/src/scr/ExecPlaySlow.c @@ -0,0 +1,158 @@ +/** +* @brief The function of the slow decode screen is defined. +* @since 2009/01/08 +* @note None +* @attention None +* <B><I>COPYRIGHT FUJITSU LIMITED 2009</I></B> +*/ + +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include "FmbCmn.h" +#include "Screen.h" +#include "FmbAp.h" + +static const char *_screenStr = "\ +[[[ Slow 1/%g ]]]\n\ +Select following character.\n\ + p Pause\n\ + d Decoding\n\ + s Slow\n\ + e Stop and return\n\ +"; + +static const char validChars[] = "pPdDsSeE"; + +//Event function when key is input. +static BOOL OnKeyHit(char InputCharacterCode); + +//Event function when fmb-request is complete. +static BOOL OnFmbRequestComplete(enum FMBRequestEnum req); + +//Event function when show the screen. +static BOOL OnShow(void); + +/** +* @brief Initial screen of the slow decode. +* @brief Initilize screen +* @param[out] scr Screen property +* @return None +* @note None +* @attention None +*/ +void InitDecSlow(struct Screen *scr) +{ + FMB_FUNC(TRUE); + scr->displayString = _screenStr; + scr->OnKeyFunc = OnKeyHit; + scr->OnFmbRequestCompleteFunc = OnFmbRequestComplete; + scr->OnShowFunc = OnShow; + scr->validChars = validChars; + FMB_FUNC(FALSE); +} + +/** +* @brief Screen display event +* @param[in] None +* @return TRUE Application execution continuance +* @return FALSE Application end +* @note None +* @attention None +*/ +static BOOL OnShow(void) +{ + enum FMBResultEnum fmbResult; + + FMB_FUNC(TRUE); + + fmbResult = FmbStartDecSlow(); + if(fmbResult == FMBEnmResultRequestComplete){ + printOut(_screenStr, gp_FmbProperty[gp_FmbComProperty->setMode].speedSlow); + SetInputEnabled(TRUE); + } + else{ + SetInputEnabled(FALSE); + } + + FMB_FUNC(FALSE); + return TRUE; +} + +/** +* @brief Event function when key is input. +* @param[in] InputCharacterCode Input character-code +* @return TRUE Application execution continuance +* @return FALSE Application end +* @note None +* @attention None +*/ +static BOOL OnKeyHit(char InputCharacterCode) +{ + FMB_FUNC(TRUE); + switch(InputCharacterCode){ + case 'p': + case 'P': + ChangeScreenTo(ScrEnmDecPause); + break; + case 'd': + case 'D': + ChangeScreenTo(ScrEnmDecNormal); + break; + case 's': + case 'S': + ChangeScreenTo(ScrEnmDecSlow); + break; + case 'e': + case 'E': + FmbStop(); + SetInputEnabled(FALSE); + break; + default: + ASSERT_USR(FALSE, "Invalid character code."); + break; + }; + + FMB_FUNC(FALSE); + return TRUE; +} + +/** +* @brief Event function when fmb-request is complete. +* @param[in] req Kind of completed request +* @return TRUE Application execution continuance +* @return FALSE Application end +* @note None +* @attention None +*/ +static BOOL OnFmbRequestComplete(enum FMBRequestEnum req) +{ + FMB_FUNC(TRUE); + + switch(req){ + case FMBEnmReqStartDecSlow: //Start-request is complete. + printOut(_screenStr, gp_FmbProperty[gp_FmbComProperty->setMode].speedSlow); + SetInputEnabled(TRUE); + break; + case FMBEnmReqStop: //Stop-request is complete. + ChangeScreenTo(ScrEnmMainMenu); + break; + case FMBEnmReqAutoStop: //AutoStop-request is complete. + break; + case FMBEnmReqStopDecCore: //Stop-request is complete. + fprintOut(stdout, "\n"); + ChangeScreenTo(ScrEnmEndOfPlay); + break; + default: + ASSERT_USR(FALSE, "Invalid request mode."); + break; + } + + FMB_FUNC(FALSE); + return TRUE; +} + |