Geoff
Wed Jan 14 13:50:02 CST 2004
Power manager - it is a bunch of timers and events. Some timers trigger
events, some events trigger timers. I think you have it but the sample is
only an example.
Think of a state machine that can leap between power modes - I like to use
the example of a mobile phone so that people (other than extreme luddites)
are familiar with it.
Your phone has state like this:
- (1) Fully on during in a call
- (2) No active call, user in a menu
- (3) No active call, user inactive, system active (such a during a cell
handoff of checking the battery)
- (4) No active call, user inactive, system inactive
- (5) Off
So you have these 5 states in my example. The drivers in the phone get told
to go to various states whenever a stae transition occurs. The way the PM
tracks who to tell what is via GUIDs in the registry.
- So your call ends, your mother was pleased to speak to you. The PM gets
an event to say the call ended and starts the user inactivity timer. The
power state changes (1) -> (2).
- A user presses a key, the PM resets the user inactive timer. (2) -> (2)
- The user puts the phone back in her pocket. The inactive timer triggers
and the phone switches to state (2) -> (3)
- The system is idle and times out, system goes to sleep (3) -> (4)
- Time to check the signal strength (4) -> (3)
- Strength checked, back to sleep (3) -> (4)
- Battery low!!! shutdown (4) -> (5)
etc....
You get the idea right?
The trick is mapping your system states and the events that change them
before going anywhere near the code.
Hope this helps,
Geoff
==
--
Geoff Smith
eMVP
http://www.BSQUARE.com
==
"Diadia" <jhchang@csie.nctu.edu.tw> wrote in message
news:bu2vq8$1m0p$1@netnews2.csie.nctu.edu.tw...
> Hi guys,
> I'm studying Power Manager now,and want to make sure that I don't get
> confused with it.
> So I try to explain what I know and hope someone could make a comment if
there
> is anything wrong.
>
>
============================================================================
==
> There are 5 level in device power status,D0~D4,Power Manager will switch
> device power status according to the system status.
>
> SetPowerRequirement tell PM minimum power level of specific device could
be.
> That means if we tell PM set backlight power requirement to D2,then PM
will
> switch power status of backlight from D0 to D1 and then stop at D2.
> If we set backlight power requirement to D0,backlight will stay at D0 ,and
> that's how media player preserve backlight on while playing .
>
> SetDevicePower just ask PM to change power state of given device
immediately.
> But it is used by some system applications.
>
> If we want to change power state of a device ,we can use DevicePowerNotify
> to inform PM.
>
============================================================================
==
>
> That's my understanding about Power Manager,if there is anything
wrong,please
> tell me and I'll appreciate your kindness.
>
> Thanks very much .
>
> Regards.
>
> Will
>