LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Still trying to Communicate with APC Smartups

Phil,

 

I had the two DWORDs defined as I32s - probably because of MS's notes about returning the flag value of (-1).  I ultimately promote the data to double, and substitute NaN for (-1).

 

I'm looking at the problem from a different angle.  The call to GetPowerStatus in kernel32.dll seems to work OK for me.  But the .NET event registration for the PowerModeChanged event only seems to fire on plug/unplug events.  It doesn't fire when the battery percentage/lifetime values change.  And since I don't poll, I'll only call to GetPowerStatus to update the battery percentage if the AC line changes - not good.

 

So on my Dell laptop, W7 x64, LV2011, the PowerModeChanged event doesn't fire to alert me to battery status changes, only AC changes.

 

Dave

David Boyd
Sr. Test Engineer
Abbott Labs
(lapsed) Certified LabVIEW Developer
0 Kudos
Message 31 of 33
(1,039 Views)

Maybe it has something to do with the .net version.

 

i noticed that there is a comment about a message pump if you are writing a service With later versions.

 

http://msdn.microsoft.com/en-us/library/microsoft.win32.systemevents.powermodechanged(v=vs.110).aspx

 

LabVIEW should be a UI, but maybe this is part of the problem.

 

can you select a different version of the powermodechanged event?

 

 


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

0 Kudos
Message 32 of 33
(1,023 Views)

This may give us a clue.  The events version works perfectly in LV2012 and Win7 (so far) for monitoring the laptop power.  The LEDs, the tank, and the Estimated time all seem to be updating correctly (don't know about the Low, Critical, and No Battery yet).  It does not work for the USB connection to the APC UPS.  Remember that the AC/DC and Charging indicators do work correctly for the APC ups under WIN XP and LV 2011, and the Estimated Time sort of works.

 

Soon I will check with the computer we will be using for our product as it is not a laptop so it doesn't have a battery.  Also, it has LV 2011 on it (but it is running under Win 7 32-bit).  If it does work I may table my investigations until I have more time.  I will keep you all updated.

 

Thanks for all the help.

 

Roy

0 Kudos
Message 33 of 33
(1,017 Views)