Home2L - C/C++ API v1.4-0-g38cc (2024-05-25)
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-2024 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
57void SystemPreInit ();
58void *_AndroidGetJavaVM ();
59#define AndroidGetJavaVM() ((JavaVM *) _AndroidGetJavaVM ())
60#else
61static inline void SystemPreInit () {}
62#endif
63
64void SystemInit ();
65void SystemDone ();
66
67
69
70
71
72
73// *************************** System mode *************************************
74
75
77
109 smNone = -1,
113 smActive
115
116
118
119
122static inline void SystemWakeup () { SystemWakeupActive (); }
123
124
125void SystemActiveLock (const char *reqName, bool withWakeup = true);
130void SystemActiveUnlock (const char *reqName, bool withWakeup = true);
137
138
139void SystemStandbyLock (const char *reqName, bool withWakeup = true);
144
145void SystemStandbyUnlock (const char *reqName, bool withWakeup = true);
149
150
152
153
154
155
156
157// *************************** Fore/background *********************************
158
159
162
163
164void SystemGoBackground (const char *appStr = NULL);
169static inline void SystemLaunchApp (const char *appStr) { SystemGoBackground (appStr); }
171
172void SystemReportUiVisibility (bool foreNotBack);
174
175
177
178
179
180
181
182// *************************** Muting ******************************************
183
184
190
191
194void SystemMute (const char *reqName);
196void SystemUnmute (const char *reqName);
201
202
204
205
206
207
208
209// *************************** Audio *******************************************
210
211
216
217
218// TBD: Eliminate the following functions?
219
220void SystemSetAudioNormal ();
221void SystemSetAudioPhone ();
222//~ void SystemSetAudioRinging ();
223
224
226
227
228
229
230
231// *************************** Bluetooth ***************************************
232
233
236
237
242
243bool SystemBluetoothGetState (bool *retBusy = NULL, bool *retAudio = NULL);
247void SystemBluetoothSet (bool enable);
251
252
254
255
256
257
258
259// *************************** Phone State *************************************
260
261
264
265
268
271
272
274
275
276
277
283#endif
Home2L Resource.
Definition: resources.H:909
ERctPhoneState
Phone state (for 'rctPhoneState')
Definition: resources.H:406
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 * SystemGetPhoneStateRc()
Get readable resource indicating the reported phone state (may be NULL, if not present).
void SystemReportPhoneState(ERctPhoneState _phoneState)
Report phone state to the phone state resource.
CResource * SystemGetBluetoothRc()
Get readable/writable resource to indicate if bluetooth is generally on.
static void SystemBluetoothToggle()
Toggle the Bluetooth enable status.
Definition: system.H:249
static void SystemLaunchApp(const char *appStr)
Launch an (Android) app.
Definition: system.H:169
bool SystemIsMuted()
Query the mute state in a polling fashion.
CResource * SystemGetMuteRc()
Get the "mute" resource.
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 * SystemGetBluetoothAudioRc()
Get read-only resource to indicate if BT audio (output) is available.
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