MFCSensor v1.08 A set of freeware C++
wrapper classes for the Windows Sensors API
These set of classes make it a lot easier to use the COM based Sensors API which
was introduced with Windows 7.
Features
- Provides a higher level wrapping for the ISensorManager, ISensorManagerEvents,
ISensor, ISensorEvents and ISensorDataReport COM interfaces. These interfaces
are wrapped using ATL's CComPtr class
- Provides prebuilt events classes both for the manager and sensor meaning
you do not need to write your own IUnknown implementation. The classes provided
mean you can implement just the callback methods you require. To hook up eventing
all you need to call is the appropriate SetEventSink method in the appropriate
wrapper class
- Provides a high level wrapping of sensor data types meaning that you can
call a simple function which returns say the current latitude position. Client
code does not need to worry about those messy PROPVARIANT unions or PROPERTYKEY's
The enclosed zip file contains the MFCSensor
wrapper classes and a simple VC 2017 dialog based test program to exercise most
of the classes functionality.
Copyright
- You are allowed to include the source code in any product (commercial, shareware,
freeware or otherwise) when your product is released in binary form.
- You are allowed to modify the source code in any way you want except you
cannot modify the copyright details at the top of each module.
- If you want to distribute source code with your application, then you are
only allowed to distribute versions released by the author. This is to maintain
a single distribution point for the source code.
Updates
v1.08 (29 April 2022)
- Updated copyright details.
- Updated the code to use C++ uniform initialization for all variable
declarations.
v1.07 (22 March 2020)
- Updated copyright details.
- Fixed more Clang-Tidy static code analysis warnings in the code.
v1.06 (4 October 2019)
- Fixed a number of compiler warnings when the code is compiled with VS
2019 Preview
- Updated copyright details.
v1.05 (21 October 2018)
- Updated copyright details.
- Fixed a number of C++ core guidelines compiler warnings. These changes
mean that the code will now only compile on VC 2017 or later.
- Removed all code which supported CMFCSENSOR_MFC_EXTENSIONS code path
v1.04 (19 November 2017)
- Updated copyright details.
- Updated the code to compile cleanly when _ATL_NO_AUTOMATIC_NAMESPACE is
defined.
- Replaced NULL throughout the codebase with nullptr.
v1.03 (13 January 2016)
- Updated copyright details.
- The preprocessor define to enable MFC integration is now CMFCSENSOR_MFC_EXTENSIONS
instead of CBITSWRAPPERS_MFC_EXTENSIONS which was a copy and paste bug.
- Verified the code compiles cleanly in VC 2015
- Added SAL annotations to all the code
- CSensor::GetFriendlyName now uses ATL::CComBSTR internally
v1.02 (1 December 2013)
- Updated copyright details.
- Updated the code to clean compile in VC 2012/VC 2013
- Reworked the classes to optionally compile without MFC. By default the classes
now use STL for strings and arrays but if you define CBITSWRAPPERS_MFC_EXTENSIONS,
the classes will revert back to using the MFC CString and CArray classes.
- The classes are now in a "SensorAPI" namespace and the MFC prefix
for all the classes have been removed.
v1.01 (7 February 2011)
- CMFCLocationSensorDataReport is now derived from a new "CMFCSensorDataReport"
class.
- Provided a number of new SensorDataReport classes including CMFCElectricalSensorDataReport,
CMFCEnvironmentalSensorDataReport, CMFCLightSensorDataReport, CMFCMechanicalSensorDataReport,
CMFCMotionSensorDataReport, CMFCOrientationSensorDataReport & CMFCScannerSensorDataReport
v1.0 (5 February 2011)