aboutsummaryrefslogtreecommitdiff
path: root/fmb_player_apl/src/scr/SetTsTypeCom.c
blob: 22d1c54bc1fda88e19d46fefc9ba1ed49e37ef0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/**
*	@brief 		The function of the setting TS packet type of Common setting is defined. 
*	@since		
*	@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 = "\
[[[ Common settings - Sub menu -> TS packet size ]]]\n\
                             'B'<-~~~~~~~~~~~~~~\n\
Select following number. (Current settings)\n\
  1   Input TS packet size    (%s)\n\
  2   Output TS packet size   (%s)\n\
";
static const char validChars[] = "12bB";

//Event function when key is input.
static BOOL OnKeyHit(char InputCharacterCode);

//Event function when show the screen.
static BOOL OnShow(void);

/**
*	@brief		Initial screen of the setting TS packet type of the common setting.
*	@param[out]	scr	Screen property
*	@return		None
*	@note		None
*	@attention	None
*/
void InitSetTsTypeCom(struct Screen	*scr)
{
	FMB_FUNC(TRUE);

	scr->displayString = _screenStr;
	scr->OnKeyFunc = OnKeyHit;
	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)
{
	FMB_FUNC(TRUE);
	
	printOut(_screenStr,
	g_FmbNamePacketSize[gp_FmbComProperty->tsFormat[FMBEnmInputTsPacket]],
	g_FmbNamePacketSize[gp_FmbComProperty->tsFormat[FMBEnmOutputTsPacket]]
	);
	
	SetInputEnabled(TRUE);

	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	'1':
		gp_FmbComProperty->TsType = FMBEnmInputTsPacket;
		break;
	case	'2':
		gp_FmbComProperty->TsType = FMBEnmOutputTsPacket;
		break;
	case	'b':
	case	'B':
		ChangeScreenTo(ScrEnmSetSubMenuCom);
		FMB_FUNC(FALSE);
		return TRUE;
		break;
	default:
		ASSERT_USR(FALSE, "Invalid character code.");
		break;
	};
	
	ChangeScreenTo(ScrEnmSetTsPacketCom);

	FMB_FUNC(FALSE);
	return TRUE;
}