Home2L - C/C++ API  v1.2-2-ga4fe (2023-04-15)
Smart Tools for a Private Home
system.H
Go to the documentation of this file.
1 /*
2  * This file is part of the Home2L project.
3  *
4  * (C) 2015-2021 Gundolf Kiefer
5  *
6  * Home2L is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Home2L is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Home2L. If not, see <https://www.gnu.org/licenses/>.
18  *
19  */
20 
21 
22 #ifndef _SYSTEM_
23 #define _SYSTEM_
24 
25 
39 #include "resources.H"
40 
41 
42 
43 
44 
45 // *************************** General *****************************************
46 
47 
49 #define WALLCLOCK_NAME "WallClock" // "Terminal" // "Klaus-Dieter"
50 
51 
54 
55 
56 #if ANDROID
57 void SystemPreInit ();
58 void *_AndroidGetJavaVM ();
59 #define AndroidGetJavaVM() ((JavaVM *) _AndroidGetJavaVM ())
60 #else
61 static inline void SystemPreInit () {}
62 #endif
63 
64 void SystemInit ();
65 void SystemDone ();
66 
67 
69 
70 
71 
72 
73 // *************************** System mode *************************************
74 
75 
77 
109  smNone = -1,
113  smActive
114 };
115 
116 
118 
119 
122 static inline void SystemWakeup () { SystemWakeupActive (); }
123 
124 
125 void SystemActiveLock (const char *reqName, bool withWakeup = true);
130 void SystemActiveUnlock (const char *reqName, bool withWakeup = true);
137 
138 
139 void SystemStandbyLock (const char *reqName, bool withWakeup = true);
144 
145 void SystemStandbyUnlock (const char *reqName, bool withWakeup = true);
149 
150 
152 
153 
154 
155 
156 
157 // *************************** Fore/background *********************************
158 
159 
162 
163 
164 void SystemGoBackground (const char *appStr = NULL);
169 static inline void SystemLaunchApp (const char *appStr) { SystemGoBackground (appStr); }
171 
172 void SystemReportUiVisibility (bool foreNotBack);
174 
175 
177 
178 
179 //~ // ***************** Immersive Mode ********************
180 //~
181 //~ void SystemSetImmersiveMode ();
182 
183 
184 
185 
186 
187 // *************************** Muting ******************************************
188 
189 
195 
196 
199 void SystemMute (const char *reqName);
201 void SystemUnmute (const char *reqName);
206 
207 
209 
210 
211 
212 
213 
214 // *************************** Audio *******************************************
215 
216 
221 
222 
223 // TBD: Eliminate the following functions?
224 
225 void SystemSetAudioNormal ();
226 void SystemSetAudioPhone ();
227 //~ void SystemSetAudioRinging ();
228 
229 
231 
232 
233 
234 
235 
236 // *************************** Bluetooth ***************************************
237 
238 
241 
242 
247 
248 bool SystemBluetoothGetState (bool *retBusy = NULL, bool *retAudio = NULL);
252 void SystemBluetoothSet (bool enable);
256 
257 
259 
260 
261 
262 
263 
264 // *************************** Phone State *************************************
265 
266 
269 
270 
273 
276 
277 
279 
280 
281 
282 
288 #endif
Home2L Resource.
Definition: resources.H:895
ERctPhoneState
Phone state (for 'rctPhoneState')
Definition: resources.H:403
void SystemMute(const char *reqName)
Mute.
void SystemWakeupStandby()
Wakeup into standby mode; Reset the off timer.
void SystemWakeupActive()
Wakeup into active mode (e.g. due to user interaction); Reset the standby & off timers.
CResource * SystemGetBluetoothAudioRc()
Get read-only resource to indicate if BT audio (output) is available.
void SystemReportPhoneState(ERctPhoneState _phoneState)
Report phone state to the phone state resource.
static void SystemBluetoothToggle()
Toggle the Bluetooth enable status.
Definition: system.H:254
static void SystemLaunchApp(const char *appStr)
Launch an (Android) app.
Definition: system.H:169
bool SystemIsMuted()
Query the mute state in a polling fashion.
void SystemGoBackground(const char *appStr=NULL)
Move the WallClock (Android) app into the background.
void SystemUnmute(const char *reqName)
Unmute.
bool SystemBluetoothGetState(bool *retBusy=NULL, bool *retAudio=NULL)
Return 'true' iff BT is currently on or switching on.
void SystemStandbyUnlock(const char *reqName, bool withWakeup=true)
Remove the specified standby lock.
void SystemActiveLock(const char *reqName, bool withWakeup=true)
Lock the device in active mode, e.g. during a phone call.
void SystemStandbyLock(const char *reqName, bool withWakeup=true)
Lock the device in standby mode to prevent the screen to be switched off completely,...
CResource * SystemGetPhoneStateRc()
Get readable resource indicating the reported phone state (may be NULL, if not present).
CResource * SystemGetBluetoothRc()
Get readable/writable resource to indicate if bluetooth is generally on.
CResource * SystemGetMuteRc()
Get the "mute" resource.
void SystemActiveUnlock(const char *reqName, bool withWakeup=true)
Remove the specified active lock.
void SystemReportUiVisibility(bool foreNotBack)
Report background/foreground state from UI system (for 'ui_base.C').
void SystemGoForeground()
Move the WallClock (Android) app into the foreground again.
ESystemMode
System mode.
Definition: system.H:108
static void SystemWakeup()
Unspecific wakeup (redirects to SystemWakeupActive() ).
Definition: system.H:122
void SystemBluetoothSet(bool enable)
Generally enable or disable Bluetooth.
ESystemMode SystemGetMode()
Get the current system mode.
@ smOff
Screen is off.
Definition: system.H:111
@ smBackground
Application is in background (e.g. other application in focus).
Definition: system.H:110
@ smActive
Screen is in active mode (bright, e.g. during user interaction)
Definition: system.H:113
@ smStandby
Screen is in standby mode (not bright, but visible).
Definition: system.H:112
@ smNone
Uninitialized; Value must not be used after initialization.
Definition: system.H:109