SetSystemPowerState in OpenNetCF SDF

Last post 01-08-2009 10:27 by neil. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 01-08-2009 6:38

    • ChrisE
    • Top 75 Contributor
    • Joined on 12-10-2008
    • Posts 8

    SetSystemPowerState in OpenNetCF SDF

    Hi, Is SetSystemPowerState wrapped anywhere in OpenNetCF SDF? Or is there any other way to fully turn on the device using the SDF when a LargeIntervalTimer brings it out of standby? Or do I have to use P/Invoke it... (which seems a shame when so much else is wrapped...).
    Filed under:
  • 01-08-2009 7:20 In reply to

    • neil
    • OpenNETCF Staff
    • Top 10 Contributor
    • Joined on 07-30-2007
    • North Wales
    • Posts 1,349

    Re: SetSystemPowerState in OpenNetCF SDF

     See OpenNETCF.WindowsCE.PowerManagement.Suspend() in OpenNETCF.WindowsCE.dll.

    Neil Cowburn
    OpenNETCF Consulting

      
  • 01-08-2009 7:51 In reply to

    • ChrisE
    • Top 75 Contributor
    • Joined on 12-10-2008
    • Posts 8

    Re: SetSystemPowerState in OpenNetCF SDF

    Thanks Neil, but this call does the opposite of what I want to do. I want to turn the device fully on (i.e.Backlight and all), not off. On my devices (HTC TYTN II) the LargeIntervalTimer causes the device wake up in some low power mode, the screen and backlight don't turn on (which is fine most of the time). I then run an SQLCE Merge Replication against a server. If there are any new records I use a Microsoft.WindowsCE.Forms.Notification control to alert the users. Strangely this does produce a sound (so that's not turned off), but it does not turn on the screen and backlight. This is what I want to happen in this case.
  • 01-08-2009 9:20 In reply to

    Re: SetSystemPowerState in OpenNetCF SDF

     I'm currently doing this:

            [DllImport("coredll", EntryPoint = "SetDevicePower")]
            private static extern IntPtr SetDevicePower(string pvDevice, int dwDeviceFlags, DevicePowerState DeviceState);


                if (ipBacklight != null) ReleasePowerRequirement(ipBacklight);
                ipBacklight = SetDevicePower("BKL1:", POWER_NAME | POWER_FORCE, DevicePowerState.D0);


    Followed by a couple of simulated mouse taps. If this is wrapped in the SDF,  I'd like to clean up my code and use that instead.

  • 01-08-2009 9:39 In reply to

    • ctacke
    • OpenNETCF Staff
    • Top 10 Contributor
    • Joined on 07-27-2007
    • Indiana
    • Posts 2,163

    Re: SetSystemPowerState in OpenNetCF SDF

     I just grepped the entire soure tree and SetDevicePower shows up only once, and that's in a comment (showing we had some thought of adding it at some point).  So that indicates that no, it's not in there anywhere.

  • 01-08-2009 10:21 In reply to

    • ChrisE
    • Top 75 Contributor
    • Joined on 12-10-2008
    • Posts 8

    Re: SetSystemPowerState in OpenNetCF SDF

    Hi, OK, thanks very much for looking! Especially since I don't grok grep. From your use of the word "we" I guess you are involved in the development of OpenNetCF SDF in some way. If you search these forums for SetSystemPowerState you can see that a few people are P/Invoking their way through this so is there anyway I could add a feature request for a SetSystemPowerState to be wrapped in the SDF to save us all the trouble. Honestly, us VB'ers get very confused with these funny strings and NULLs etc. ;) ....
    Filed under:
  • 01-08-2009 10:25 In reply to

    • ctacke
    • OpenNETCF Staff
    • Top 10 Contributor
    • Joined on 07-27-2007
    • Indiana
    • Posts 2,163

    Re: SetSystemPowerState in OpenNetCF SDF

     Sure, leave your suggestion here.  It's certainly something we'll look into and adding it to the UserVoice will remind us.

  • 01-08-2009 10:27 In reply to

    • neil
    • OpenNETCF Staff
    • Top 10 Contributor
    • Joined on 07-30-2007
    • North Wales
    • Posts 1,349

    Re: SetSystemPowerState in OpenNetCF SDF

    If you look under the photos on the left of the forum next to my and ctacke's posts, you'll see it says OpenNETCF Staff

    For feature requests, you can use our bug tracker to add an enhancement request.

    Neil Cowburn
    OpenNETCF Consulting

      
Page 1 of 1 (8 items)