Naughter Software Logo

HIDWrappers v1.09 & CTemperDevice v1.09 Two C++ classes to encapsulate the Windows HID API and the Temper USB Thermometer

The classes provided are HID::CDevice which provides a simple RAII wrapper for programming to the HID API on Windows and HID::CTemperDevice which derives from HID::CDevice which encapsulates the Temper USB thermometer.

 

Features

 

The enclosed zip file contains the HIDWrappers and CTemperDevice source code and a simple VC 2017 console application which exercises all of the various functionality. If the sample app detects that you have an Temper HID device attached to your computer (with a VID of 0xC45 and PID of 0x7401) then it will initialize the device and spin in a loop reading the temperature from the device every second. For more information about using this device from Windows, please see http://www.codeproject.com/Tips/1007522/Temper-USB-Thermometer-in-Csharp on which the CTemperDevice code is partly based. Please note that some of the information in this CodeProject article is incorrect as it mislabels what it calls the "Control" interface. This interface is in fact the "Interface 0" keyboard emulation interface exposed by the Temper devices. Windows versions since Windows 2000 denies user mode code low level access to any Keyboard or Mouse USB interface and the C# code from this article will fail to open this interface with an Access Denied Error message. The temperature related functionality of the device is on "Interface 1" anyway. For examples of interfacing to the Temper device please see the source code of the demo application in the HIDWrappersDemo.cpp module in the download. Please note that there are many variants of the Temper device being sold. As it stands the CTemperDevice code has been tested with a device which returns a VID of 0xC45, a PID of 0x7401 and with the initialization strings as defined at the top of the HIDWrappersDemo.cpp module. Also the version of the device I tested the code with returns the raw temperature value in the sixth and seventh byte of the returned HID report of nine bytes in total. The sample app will report the raw data sent and received from the device so it should not be too difficult to change the code to suit other devices. If you are interested in this you might want to check out USBPcap and WireShark to capture USB traces to see how I reverse engineered the data my device generates. If you have other variants of the Temper device please try the sample app with it and drop me an email and we should be able to get the code working with your variant of the device.

 

Copyright

 

Updates

v1.09 (13 April 2022)

v1.08 (11 February 2022)

v1.07 (21 February 2021)

v1.06 (12 January 2020)

v1.05 (16 December 2019)

v1.04 (26 August 2019)

v1.03 (6 May 2019)

v1.02 (18 August 2018)

v1.01 (28 November 2017)

v1.0 (27 December 2015)