Help to develop a service to get UPS information by unmanaged C++ code in Win7
-
Dear all, I want to develop a service (that is written by unmanaged C++) in Win7. This service can detect status of UPS, example: low battery, out of electric, etc.. It connect with UPS by RS232C cable through COM port. I google and find some funtions: GetCommState, SetCommState, GetCommModemStatus but don't know how to use it to check status of UPS (low battery, out of electric, ...) Pls. help me to solve it :( . Thanks a lot. Ratkit!
-
Dear all, I want to develop a service (that is written by unmanaged C++) in Win7. This service can detect status of UPS, example: low battery, out of electric, etc.. It connect with UPS by RS232C cable through COM port. I google and find some funtions: GetCommState, SetCommState, GetCommModemStatus but don't know how to use it to check status of UPS (low battery, out of electric, ...) Pls. help me to solve it :( . Thanks a lot. Ratkit!
You havnt said what you want to DO with the UPS status once you've found it - lets assume you wish to write it to the Windows Event Log for start.. I would appoach it in a number of 'phases', not knowing what experience you have 1) build a console mode program capable of writing application events to the event log 2) use something like Serial library for C++[^] in a console mode program to be able to read the UPS data from the serial port - somewhere in the specs for the UPS it will tell you how to interpret the data to give you the status 3) then write a service, make sure you can do the normal things - start, stop, use the knowledge gained from (1) to write an event to the log on a timed basis - eg, every 5 minutes 4) once youve gotten here, you then re-do the service to use the knowledge gained in step 2, to determine and log the UPS status to the event log Once your service is up and running, you can expand the logging event to (for example) send an email if the UPS needs attention, or (for example) add a system-tray applet and change the colour of it to red 'g'
-
Dear all, I want to develop a service (that is written by unmanaged C++) in Win7. This service can detect status of UPS, example: low battery, out of electric, etc.. It connect with UPS by RS232C cable through COM port. I google and find some funtions: GetCommState, SetCommState, GetCommModemStatus but don't know how to use it to check status of UPS (low battery, out of electric, ...) Pls. help me to solve it :( . Thanks a lot. Ratkit!
Check out the
Win32_UninterruptiblePowerSupply
WMI class."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
-
Dear all, I want to develop a service (that is written by unmanaged C++) in Win7. This service can detect status of UPS, example: low battery, out of electric, etc.. It connect with UPS by RS232C cable through COM port. I google and find some funtions: GetCommState, SetCommState, GetCommModemStatus but don't know how to use it to check status of UPS (low battery, out of electric, ...) Pls. help me to solve it :( . Thanks a lot. Ratkit!
-
Check out the
Win32_UninterruptiblePowerSupply
WMI class."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
According to the documentation on Win32_UninterruptiblePowerSupply: "Beginning with Windows Vista, this class is obsolete and not available because the UPS service is no longer available." http://msdn.microsoft.com/en-us/library/aa394503(VS.85).aspx Can you suggest another way to help me solve it?