Auto dim the display and sleep Mono after a given period of inactivity.
This class will automatically dim the display and enter sleep mode, after a period of user inactivity. The uses 3 states:
- Normal mode (full brightness on display)
- After a period of no user touch input (default 10 secs.), display dims to 11%
- After yet a period (default 10 secs.) of no touch input, sleep mode is entered.
Any touch input will reset the state to 1.
You should add this objact to your AppController class, to enable automatic power saving.
If you want to use multiple instances of this class, remember to deactivate the instances that should be inactive. Having two active instances at one time, can be confusing to the users.
TO capture all touches, any instane should be the first to respond to touch inputs. The touch system has a responder chain of objects that handles touch input. Any of these objects might choose to break the chain and allow no further processing of a given touch event.
Therefore the PowerSaver must be the first (or one of) to handle touch events. You accomplish this by initializing the PowerSaver object as the first member object of your AppController. Before any other touch related classes.
PowerSaver(int dimTimeoutMs, int sleepTimeoutMs, int dimBrightness, int fullBrightness)¶
Construct a auto dimmer and sleep timer.
The delay before display is dimmed (in milliseconds)
The delay before sleep mode is entered (in milliseconds)
The brightness level when display is dimmed (0 to 255)
The full brightness level (normal mode) (0 to 255)
Starts the timer that will dim the display after the chosen timeout.
This call stops any running sleep timer. After the dim timer fires, the sleep timer is automatically started.
Starts the sleep timer, that will sleep Mono after the chson timeout.
This will stop a running dim timer, and trigger sleep mode on timeout.
Immidiately dim the display and then start the sleep timer.
This will (asynchronously) dim the display to the chosen brightness level. WHen the display has been dimmed, the sleep timer is started.
Immidiately undim the display to full brightness.
This will stop the sleep timer and re-start the dim timer.