Wince6.0 + 2443 the system enters sleep status in about 10 minutes.

Source: Internet
Author: User

Recently, When I was developing a GPS product based on wince6.0 + 2443, I found that when my machine was powered by a battery, if there were no other actions after it was started, it would take about 10 minutes, my system will enter the sleep state. Later I found that I commented out the following part of the batterypddgetstatus () function when implementing the batterypddgetstatus ().

Memcpy (pstatus, & gpstatus-> SPS, sizeof (* pstatus ));

* Pfbatterieschangedsincelastcall = gpstatus-> fchanged;

If (* pfbatterieschangedsincelastcall ){

Gpstatus-> fchanged = false; // reset changed flag if it's set

}

Why does the above Code cause this problem? Let's take a look at the batteryapigetsystempowerstatusex2 () definition of the batteryapigetsystemstatusex2:

The first line is used to determine whether the current status of the system is AC or battery. At present, I have not fully figured out why the system will not enter sleep when AC power is used, I think it has a lot to do with the batteryapistopwatch () function called in the middle. I added the following sentence before returning the batterypddgetstatus () function:

Pstatus-> aclinestatus = ac_line_online;

In this way, even when the battery is powered (at this time, I did a false action to tell batteryapigetsystempowerstatusex2 () function: The system is always powered by AC ), this proves that the system will not enter sleep state when the AC is powered, but why? We need to make it clear later. If you know, please let us know.

As mentioned above, adding pstatus-> aclinestatus = ac_line_online; this line of statements can prevent the system from entering sleep, but this problem cannot be solved for a product that requires battery power, because the application needs to determine whether the current charging is based on pstatus-> aclinestatus, so as to tell the user the charging status. Later, I checked the information online and gave some advice from csdn experts. I added the following code before returning the batterypddgetstatus () function:

Why do I add the IF (noentersleepstatus> = 50) Judgment? I just don't want to execute the above action every time I call the batterypddgetstatus () function (called every 5S, the above code can be called before the system enters the sleep timeout to prevent the system from entering the sleep state.

There is a question here. Many online users say that by regularly calling the systemidletimerreset () function, the system can also be prevented from entering the sleep state, however, after I add the following code in the above position, the system cannot be blocked from entering the sleep state. It's strange. Please let me know. Thank you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.