PowerNotify Beta (update) v0.2
Updated to Beta v0.2
PowerNotify allows Basic4PPC to receive Power Notifications from Power Management.
This is an early Beta release as I am still testing the Power Management functions of Windows Mobile and also for the lack of devices for debugging.
It is only for the Device and requires at least .Net Compact Framework v2.
The source will not be included until the final release.
An example is attached below with the Library.
BacklightOff is triggered in situations that the backlight is on, the example includes a workaround.
The backlight turning on does not seem to trigger a BackLightOn value.
Due to hardware limitations events will not be fired from a suspend or poweroff state until after resuming.
The two events, PowerStatus and PowerStatus2, are triggered in different ways.
PowerStatus sets PowerState while PowerStatus2 is only a triggered event.
Please post any comments and suggestions.
The following is included:
AcLineStatus Returns 1 when AC line is attached
BacklightOff Turns off the backlight
BacklightOn Turns on the backlight
BatteryPercent Returns the battery level as percentage
CurrentPowerState Returns the current power state as a string, is directly from the system and unchanged
Dispose Disposes the resources, handled by the Garbage Collector
New1 Initializes the PowerNotify Class
PowerOff Powers off the System
PowerOn Powers on the System, if this doesn't work use PowerOn2
PowerOn2 Powers on the System
PowerState Returns the current power state as a string, from a numerical value in a byte[] Array
ScreenOff Turns off the screen
Start Requests power notifications from Power Management
Stop Stops the power notifications
Suspend Suspends the system
Events:
Battery Fired when the battery level or AC status changes, sets AcLineStatus and BatteryPercent
PowerStatus Fired by the Power Manager, sets PowerState values
PowerStatus2 Fired by the Power Manager, use with CurrentPowerState
The following values are returned from PowerState:
UserIdle, On, ON, Unattended, Off, Resuming, ScreenOff, Suspend, BacklightOff, Critical, Boot, Reboot
Some values may not be returned by all devices.
There are two On values as both appear to be valid.
Updated to Beta v0.2
PowerNotify allows Basic4PPC to receive Power Notifications from Power Management.
This is an early Beta release as I am still testing the Power Management functions of Windows Mobile and also for the lack of devices for debugging.
It is only for the Device and requires at least .Net Compact Framework v2.
The source will not be included until the final release.
An example is attached below with the Library.
BacklightOff is triggered in situations that the backlight is on, the example includes a workaround.
The backlight turning on does not seem to trigger a BackLightOn value.
Due to hardware limitations events will not be fired from a suspend or poweroff state until after resuming.
The two events, PowerStatus and PowerStatus2, are triggered in different ways.
PowerStatus sets PowerState while PowerStatus2 is only a triggered event.
Please post any comments and suggestions.
The following is included:
AcLineStatus Returns 1 when AC line is attached
BacklightOff Turns off the backlight
BacklightOn Turns on the backlight
BatteryPercent Returns the battery level as percentage
CurrentPowerState Returns the current power state as a string, is directly from the system and unchanged
Dispose Disposes the resources, handled by the Garbage Collector
New1 Initializes the PowerNotify Class
PowerOff Powers off the System
PowerOn Powers on the System, if this doesn't work use PowerOn2
PowerOn2 Powers on the System
PowerState Returns the current power state as a string, from a numerical value in a byte[] Array
ScreenOff Turns off the screen
Start Requests power notifications from Power Management
Stop Stops the power notifications
Suspend Suspends the system
Events:
Battery Fired when the battery level or AC status changes, sets AcLineStatus and BatteryPercent
PowerStatus Fired by the Power Manager, sets PowerState values
PowerStatus2 Fired by the Power Manager, use with CurrentPowerState
The following values are returned from PowerState:
UserIdle, On, ON, Unattended, Off, Resuming, ScreenOff, Suspend, BacklightOff, Critical, Boot, Reboot
Some values may not be returned by all devices.
There are two On values as both appear to be valid.
Attachments
Last edited: