title: How to wake up Windows 8.1 from connected standby programmatically
body: <p>Is there a way to wake up Windows 8.1 from connected standby programmatically? For my requirement, it's acceptable by using either a store app background task, or a session 0 service.</p>
  
  <p>My scenario is that I have a store app background task to be periodically invoked (or be triggered by push notification). When the background task is invoked, it checks to see if a certain condition is met. If so, it shall perform an operation to wake up the device from connected standby. The reason I need to exit CS is that I need to launch a process when the condition is met. This process will serve a TCP connection to run a extended period of time. It's kind of like a remote desktop server which automatically wakes up upon a connection request, but normally in connected standby to save power (the device is on battery).</p>
  
  <p>The first approach I think of is using scheduled task with the "wake the computer to run" option. But according to <a href="http://social.msdn.microsoft.com/forums/windowsapps/en-us/e21f2dd7-dde5-4053-8ef1-649ae75f40cf/how-to-wake-windows-8-tablet-from-sleep">this post</a>, it doesn't wake the machine when in connected standby mode.</p>
  
  <p>Now <em>if</em> there is a way to do this programmatically, it would be logical to do this as a store app background task, or a session 0 service, both of which get a short chance to run during connected standby. But the question is - what operation to perform to exit connected standby? </p>
  
  <p>According to <a href="http://msdn.microsoft.com/en-us/library/windows/hardware/dn495447(v=vs.85).aspx">Connected standby wake sources</a>, various peripheral <em>hardware</em> can wake the device. For example, power button press wakes up the device through GPIO interrupt. So the question boils down to is there a way to "simulate" a power button press by generating such GPIO interrupt? I don't know much about windows kernel/driver programming. Any advice will be appreciated. I think this is a feasible approach as this <a href="http://msdn.microsoft.com/en-us/library/windows/hardware/hh781397(v=vs.85).aspx">WDTF method</a> can put the system into CS and wake up after a given interval.</p>
  
  <p>Another seemingly possible approach would be to generate a toast notification as a "VoIP" app. As mentioned in <a href="http://download.microsoft.com/download/5/D/1/5D167007-01CF-4977-9F82-5FEEEA4C9FDB/introduction-to-connected-standby.docx">Introduction to Connected Standby</a>, a background task scheduled by a lock screen app can send toast notification, which <em>ONLY</em> generates a short sound with the display turned off. Only after the user pressing the power button will the toast be shown. So I assume generating toast in such a way won't wake up the device. However, the document does mention "VoIP" apps can generate toast notification with longer, customize ringtone, <em>AND</em> with display turned <em>ON</em>. I assume the device might be waked up in this case. But the document doesn't provide any reference to how such "VoIP" apps are written.</p>