This C# application contains classes PapouchSensorTmeHttp and PapouchSensorTmeTcp, which may be used in your applications to read data from the "TME" digital thermometer.
Microsoft .NET Framework 2.0 is required for running this application. Microsoft Visual Studio 2005 or Microsoft Visual C# Express is required to open the sample project and to compile the application.
Constructor of this class takes single argument, which is URL of thermometer's XML file (which is http://host/tme.xml). Then call the ReadSample method to get current temperature in degrees of Celsius. The following code demonstrates the usage:
PapouchSensorTmeHttp sensor = new PapouchSensorTmeHttp("http://192.168.168.3/tme.xml");
try {
float t = sensor.ReadSample();
MessageBox.Show(string.Format("Temperature is {0:N1} °C", t), "Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex) {
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
This class reads values from TME thermometer using its own proprietal protocol based on direct TCP thermometer. Usage is similar to the above, only constructor takes two arguments:
Manufacturer of the TME sensor is Papouch, s. r. o.
Author of this sample is Michal Altair Valasek from Altairis, s. r. o.
Copyright © Michal Altair Valasek - Altairis, 2006
This program is free software licensed under terms of the BSD license.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.