Reputation: 2726
I have a hardware device running WinCE 5.
Our app in compact framework.
The device is attached to a power supply which has a power switch.
Our app receives a signal when the power switch is turned to OFF. This allows us to elegantly finish our work, shut down our threads, and shut the device down.
Currently our shut down procedure also involves unmounting the SDIO card, to ensure that it is not corrupted.
We do NOT call any windows api as part of the final shutdown. We are able to signal our power micro "that all is ok, it can really take the power away now.", which it then does.
Our key objective is to prevent corruption of any kind. For example, the windows registry does not sit on the SDIO card, but on an internal drive. We've not seen this exactly to my knowledge, but its a concern.
My question is:
Thank you.
Upvotes: 0
Views: 1004
Reputation: 67168
You should call a Suspend API (e.g. GwesPowerOffSystem()
) and let the power manager do its job of calling each of the drivers through their power manager entry points. I'd even argue that, if possible, an interrupt from the loss of power should be handled by a driver which then starts the suspend process.
An application should not be responsible for dealing with this.
Upvotes: 3