[.net] PDA Capturing battery temperature data.
Hi there, I hope this is suitable here. I've got a Dell Axim 51v. I've been using a program called wr_Resinfo and on the advanced tab it displays the battery temperature.
I'm trying to make my own little application is visual studio 2005, in a smart device project. Is there anyway I can capture the battery temperature data? I've seen a number of applications like the one stated above doing it so I'm sure its possible.
- Any help would be appreiated.
A simple google search gave me this:
http://msdn.microsoft.com/en-us/library/ms955711.aspx
and
http://msdn.microsoft.com/en-us/library/ms941842.aspx
The SYSTEM_POWER_STATUS_EX2 structure holds a BatteryTemperature field.
Just to note: I searched for "wince battery temperature". I find that when I preceed all my search queries with "wince" I usually get programming related topics.
http://msdn.microsoft.com/en-us/library/ms955711.aspx
and
http://msdn.microsoft.com/en-us/library/ms941842.aspx
The SYSTEM_POWER_STATUS_EX2 structure holds a BatteryTemperature field.
Just to note: I searched for "wince battery temperature". I find that when I preceed all my search queries with "wince" I usually get programming related topics.
Actually I thought all was well, though it's not working. I found some examples posted on the internet tried to put it together with a timer and a text box, it deploys fine I get no errors, all I see in the text box is zero. The sensor is working, I'm still using wr_Resinfo to monitor it. Yet I'm unable to obtain it.
I've also tried TextBox1.Text = PowerStatus.BatteryTemperature.ToString
Any ideas why its just showing zero?
Imports System.Runtime.InteropServicesPublic Class Form1 Private Class SYSTEM_POWER_STATUS_EX2 Public ACLineStatus As Byte Public BatteryFlag As Byte Public BatteryLifePercent As Byte Public Reserved1 As Byte Public BatteryLifeTime As System.UInt32 Public BatteryFullLifeTime As System.UInt32 Public Reserved2 As Byte Public BackupBatteryFlag As Byte Public BackupBatteryLifePercent As Byte Public Reserved3 As Byte Public BackupBatteryLifeTime As System.UInt32 Public BackupBatteryFullLifeTime As System.UInt32 Public BatteryVoltage As System.UInt32 Public BatteryCurrent As System.UInt32 Public BatteryAverageCurrent As System.UInt32 Public BatteryAverageInterval As System.UInt32 Public BatterymAHourConsumed As System.UInt32 Public BatteryTemperature As System.UInt32 Public BackupBatteryVoltage As System.UInt32 Public BatteryChemistry As Byte End Class Private Class SYSTEM_POWER_STATUS_EX Public ACLineStatus As Byte Public BatteryFlag As Byte Public BatteryLifePercent As Byte Public Reserved1 As Byte Public BatteryLifeTime As System.UInt32 Public BatteryFullLifeTime As System.UInt32 Public Reserved2 As Byte Public BackupBatteryFlag As Byte Public BackupBatteryLifePercent As Byte Public Reserved3 As Byte Public BackupBatteryLifeTime As System.UInt32 Public BackupBatteryFullLifeTime As System.UInt32 End Class Dim PowerStatus As New SYSTEM_POWER_STATUS_EX2() <DllImport("coredll")> _ Private Shared Function GetSystemPowerStatusEx(ByVal lpSystemPowerStatus As SYSTEM_POWER_STATUS_EX, ByVal fUpdate As Boolean) As System.UInt32() End Function <DllImport("coredll")> _ Private Shared Function GetSystemPowerStatusEx2(ByVal lpSystemPowerStatus As SYSTEM_POWER_STATUS_EX2, ByVal dwLen As System.UInt32, ByVal fUpdate As Boolean) As System.UInt32 End Function Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Timer1.Enabled = True End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick TextBox1.Text = Convert.ToInt32(PowerStatus.BatteryTemperature).ToString End SubEnd Class
I've also tried TextBox1.Text = PowerStatus.BatteryTemperature.ToString
Any ideas why its just showing zero?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement