According to MSDN documentation
ResumeAutomatic: the computer automatically woke up to handle the event.
Note. If the system detects user activity after broadcasting ResumeAutomatic, it will broadcast the ResumeSuspend event so that applications know that they can resume full user interaction.
ResumeSuspend: the system resumed operation after a suspension.
Does this mean that "ResumeAutomatic" is called when the computer wakes up from sleep, and "ResumeSuspend" is called when the user logs in after entering the credentials?
I am using tcp socket to communicate with the server. Therefore, in order to reconnect to the service when the system returned from sleep state, I have the following code
protected override bool OnPowerEvent(PowerBroadcastStatus powerStatus) { Logger.Log("Power status is : " + powerStatus); if (powerStatus == PowerBroadcastStatus.ResumeAutomatic) { ConnectionWatchdog.ReConnect(); } return base.OnPowerEvent(powerStatus); }
But I notice that the enum values ββare random. Below are 3 different tracks in 3 different wake modes.
20150525 # 094449 :: Power Status: Pause
20150525 # 094716 :: Power Status: ResumeSuspend
20150525 # 103431 :: Power Status: Suspended
20150525 # 103525 :: Power Status: ResumeSuspend
20150525 # 103525 :: Power Condition: ResumeAutomatic
20150525 # 103558 :: Power Status: Suspended
20150525 # 103835 :: Power Condition: ResumeAutomatic