DVBCore  20.3.0
DVBCore Documentation
ap_state.c
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2011 Ocean Blue Software Ltd
4  *
5  * This file is part of a DTVKit Software Component
6  * You are permitted to copy, modify or distribute this file subject to the terms
7  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
8  *
9  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
10  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
11  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * If you or your organisation is not a member of DTVKit then you have access
14  * to this source code outside of the terms of the licence agreement
15  * and you are expected to delete this and any associated files immediately.
16  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
17  *******************************************************************************/
25 //---includes for this file----------------------------------------------------
26 // compiler library header files
27 
28 // third party header files
29 
30 // Ocean Blue Software header files
31 
32 #include "techtype.h"
33 #include "dbgfuncs.h"
34 
35 
36 //---constant definitions for this file----------------------------------------
37 #ifdef STATE_DEBUG
38  #define STATE_DBG(x) STB_SPDebugWrite x
39 #else
40  #define STATE_DBG(x)
41 #endif
42 
43 
44 //---local typedefs, structs, enumerations for this file--------------------------------------------
45 typedef enum
46 {
47  DVB_STATE_ON,
48  DVB_STATE_STANDBY,
49  DVB_STATE_STANDBY_RECORDING,
50  DVB_STATE_STANDBY_SERV_SEARCH,
51  DVB_STATE_STANDBY_SSU_SEARCH
52 // DVB_STATE_STANDBY_EIT_SEARCH
53 } E_DVB_STATE;
54 
55 
56 //---local (static) variable declarations for this file------------------------
57 // (internal variables declared static to make them local)
58 static E_DVB_STATE dvb_state;
59 
60 //---local function prototypes for this file-----------------------------------
61 // (internal functions declared static to make them local)
62 
63 
64 /*!**************************************************************************
65  @brief
66  ****************************************************************************/
67 void ASTE_Initialise(void)
68 {
69  FUNCTION_START(ASTE_Initialise);
70 
71  dvb_state = DVB_STATE_ON;
72 
73  FUNCTION_FINISH(ASTE_Initialise);
74 }
75 
76 /*!**************************************************************************
77  @brief
78  ****************************************************************************/
79 void ASTE_EnterStandby(BOOLEAN recording)
80 {
81  FUNCTION_START(ASTE_EnterStandby);
82 
83  /* Only change the state if ON as all other states are standby states already */
84  if (dvb_state == DVB_STATE_ON)
85  {
86  if (recording)
87  {
88  dvb_state = DVB_STATE_STANDBY_RECORDING;
89  }
90  else
91  {
92  dvb_state = DVB_STATE_STANDBY;
93  }
94  }
95 
96  FUNCTION_FINISH(ASTE_EnterStandby);
97 }
98 
99 /*!**************************************************************************
100  @brief
101  ****************************************************************************/
103 {
104  FUNCTION_START(ASTE_LeaveStandby);
105 
106  //if (dvb_state == DVB_STATE_STANDBY)
107  {
108  dvb_state = DVB_STATE_ON;
109  }
110 
111  FUNCTION_FINISH(ASTE_LeaveStandby);
112 }
113 
114 /*!**************************************************************************
115  @brief
116  ****************************************************************************/
117 BOOLEAN ASTE_InStandby(void)
118 {
119  BOOLEAN retval;
120 
121  FUNCTION_START(ASTE_InStandby);
122 
123  if (dvb_state == DVB_STATE_ON)
124  {
125  retval = FALSE;
126  }
127  else
128  {
129  retval = TRUE;
130  }
131 
132  FUNCTION_FINISH(ASTE_InStandby);
133 
134  return(retval);
135 }
136 
137 /*!**************************************************************************
138  @brief
139  ****************************************************************************/
141 {
142  FUNCTION_START(ASTE_StartRecording);
143 
144  if (dvb_state == DVB_STATE_STANDBY)
145  {
146  dvb_state = DVB_STATE_STANDBY_RECORDING;
147  }
148 
149  FUNCTION_FINISH(ASTE_StartRecording);
150 }
151 
152 /*!**************************************************************************
153  @brief
154  ****************************************************************************/
156 {
157  FUNCTION_START(ASTE_StartServiceSearch);
158 
159  if (dvb_state == DVB_STATE_STANDBY)
160  {
161  dvb_state = DVB_STATE_STANDBY_SERV_SEARCH;
162  }
163 
164  FUNCTION_FINISH(ASTE_StartServiceSearch);
165 }
166 
167 /*!**************************************************************************
168  @brief
169  ****************************************************************************/
171 {
172  FUNCTION_START(ASTE_StartSSUSearch);
173 
174  if (dvb_state == DVB_STATE_STANDBY)
175  {
176  dvb_state = DVB_STATE_STANDBY_SSU_SEARCH;
177  }
178 
179  FUNCTION_FINISH(ASTE_StartSSUSearch);
180 }
181 
182 /*!**************************************************************************
183  @brief
184  ****************************************************************************/
186 {
187  FUNCTION_START(ASTE_SearchComplete);
188 
189  if ((dvb_state == DVB_STATE_STANDBY_SERV_SEARCH) || (dvb_state == DVB_STATE_STANDBY_SSU_SEARCH))
190  {
191  dvb_state = DVB_STATE_STANDBY;
192  }
193 
194  FUNCTION_FINISH(ASTE_SearchComplete);
195 }
196 
197 //--------------------------------------------------------------------------------------------------
198 // local function definitions
199 //--------------------------------------------------------------------------------------------------
200 
201 /*!**************************************************************************
202  ****************************************************************************/
203 
void ASTE_SearchComplete(void)
Definition: ap_state.c:185
void ASTE_StartRecording(void)
Definition: ap_state.c:140
void ASTE_Initialise(void)
Definition: ap_state.c:67
void ASTE_EnterStandby(BOOLEAN recording)
Definition: ap_state.c:79
Debug functions header file.
void ASTE_LeaveStandby(void)
Definition: ap_state.c:102
System Wide Global Technical Data Type Definitions.
BOOLEAN ASTE_InStandby(void)
Definition: ap_state.c:117
void ASTE_StartServiceSearch(void)
Definition: ap_state.c:155
void ASTE_StartSSUSearch(void)
Definition: ap_state.c:170