DeviceEmulator and virtual battery


I'm looking at implementing a virtual battery in the next DeviceEmulator release.  How much control do you need over the virtual battery?


The straightforward way to emulate a battery is to have two controls:



  1. Is the emulated device on battery or A/C power?

  2. What is the battery charge as a percentage?

With those, you can simulate the transition from battery to A/C and back, and set the battery charge to values that trigger the low-battery and critical-battery events.  Is there a need for more?  The battery APIs return a SYSTEM_POWER_STATUS_EX2 structure which contains data about battery temperature, which kind of battery (NiCAD, Lithium-ion, etc.), number of seconds of runtime predicted.  They also can return status about both a primary and backup battery. 


Is that important to anyone?


Comments (3)
  1. suniljagadish says:

    Battery emulation would be great. It would be useful in testing applications. How do you plan to make the functionality of the battery level actually changing? As in, would we see a GUI to do that?

  2. Barry Bond says:

    Yes, there will be GUI in the emulator’s config dialog, to switch between "on battery" and "on AC", and to set the battery charge level, as a percentage.

    I also envision introducing a COM interface to the DeviceEmulator, that will let test automation reconfigure the emulator as it runs.  With that, you’ll be able to model battery charge/discharge curves, etc.

  3. temper says:

    I think that is a great idea. You should talk to the SMS provider to make a system to test SMS messaging. I was thinking something like a menu on the emulator.

Comments are closed.

Skip to main content