UPS is Soltec Apa-650 with "megatec battery driver". Even being in the device manager battery area, it doesn't appear in the Win32_Battery.
Status is available with Upsilon 2000 software (remaining, temperature, etc...). But now I need to read these values from a C# program First idea: After seeing the payload with Wireshark, I want to replay it with c#. Any Idea?
For example, I tried pinvoke
deviceHandle = Kernel32.CreateFile(deviceInstancePath, 0, Constants.FileShareRead | Constants.FileShareWrite, IntPtr.Zero, Constants.OpenExisting, 0, 0);
=> The handle is ok
var success = Kernel32.WriteFile( deviceInformation.WriteHandle, outputReportBuffer, outputReportBuffer.Length, ref numberOfBytesWritten, IntPtr.Zero);
=> The success returns false
Does anybody know where I can find the failing explanation?
Any help would be appreciated (sorry for my English, I'm a french guy)
Edit
Thank's to aja here is the answer about the failing explaination
Win32Exception a = new Win32Exception(Marshal.GetLastWin32Error());
Console.WriteLine(a.Message)