Detecting Ultrabook Sensors on Windows 8This article is sponsored by the new Intel Developer Zone
With the recent launch of the 3rd Generation Intel Core Processors, Intel has introduced a new breed of Ultrabook and it's a game-changer. Ultrabooks and Convertibles based on the 3rd Generation Intel Core Processors come with new touch and sensor features. In this post, we will focus on the sensors and how to detect their presence on an Ultrabook running Windows 8:
There are 5 Sensors relevant to the Ultrabook/Convertibles:
Sensors Recommended for the Ultrabook
The following table provides information about the new sensors that are recommended for the Ultrabook (and required for convertibles.) It will be up to the OEMs which sensors are included for their specific models/usages.
Figuring out which sensors are on Convertibles is easy. All of the above sensors are required. For the basic Ultrabook, it isn't so easy. There will be different classes of Ultrabooks: the Business Ultrabook and the Consumer Ultrabook. While OEMs have been given a minimum specification that dictates what features an Ultrabook has, there will be some differentiating amongst the OEMS for the different classes of computers. The OEMs will determine which sensors are best suited for their various models.
Detecting Sensors on an Ultrabook
There are a few ways in which to determine if a system supports the sensors, and if so, which sensors:
Computer Management/Device Manager
Once the Device Manager is up, look for "Sensors" in the device tree. The "HID Sensor Collection" contains the new sensors associated with Ultrabook. Unfortunately it does not provide a breakout of which of the sensors are on the system; just that at least one of them is present. HID is "Human Interface Device" and the five Ultrabook sensors use the HID protocol.
Sensor Diagnostic Tool
The Sensor Diagnostic tool uses the Sensor and Location API for data retrieval, event handling, report intervals, changing sensitivity, and property retrieval. The tool can also be used to write the sensor data to a CSV file. I should note, however that the Sensor Diagnostic Tool really exists to aid with the development of Windows Drivers; its true use is to help with the testing and optimization of Windows Drivers. This tool can be found in the following folder once you have installed the Windows Driver Kit: C:\Program Files (x86)\Windows Kits\8.0\Tools\x86.
Sensor Diagnostic Tool run on an Ivy Bridge Software Development Platform + USB Sensor Hub
Programatically detecting sensors using the Sensor APIs
The Sensor Diagnostic Tool is useful to monitor and test your sensors; however, in software that is written to take advantage of the Ultrabook Sensors, it would be better to call the Sensor APIs from within the code in order to ensure that the platform supports the sensors. If the system does not support a particular sensor then the software should still be able to offer a different but compelling experience for the end user.
Before we talk about the specific APIs, let's take a look at what the development environment looks like for Windows 8. Take note of the languages supported in Metro Style Apps and Desktop Apps. Also note that for Metro Style Apps, the Device APIs are included inside the Windows Run Time environment.
There is also a Windows 8 Sensor Platform that provides support for both Metro style app and desktop development. The examples below pertain to the Windows 8 Desktop environment. For Desktop Apps, accessing the sensors is done via the object SensorManager. Sensors can be queried in the following manners:
Asking by Type
If you are interested in a specific type of sensor, for example, "Gyrometer3D", SensorManager will consult the list of sensor hardware present on the computer and return a collection of matching objects bound to that hardware. The Sensor Collection may have zero or more objects in it but usually will have only one.
result = pSensorManager-> GetSensorsByType(SENSOR_TYPE_GYROMETER_3D, &pSensorCollection)
Asking by Category
Rather than looking for a specific type of sensor, you may be interested in looking for all sensors in a specific category, for example, "Motion" sensors. SensorManager will consult the list of sensor hardware on the computer, and return a collection of Motion objects bound to that hardware. The SensorCollection may have zero or more objects in it. On most computers, the collection will have two Motion objects: Accelerometer3D and Gyrometer3D.
result = pSensorManager-> GetSensorsByCategory(SENSOR_CATEGORY_MOTION, &pSensorCollection)
Asking by Category "ALL"
Finally, you might be interested on getting all the sensors on the computer by using the "ALL" method. This would most likely be the preferred way to query the sensors on the system; however, it will return all sensors, not just the five listed above. Once again, SensorManager will consult the list of sensor hardware on the computer and return a collection of all the objects bound to that hardware. The SensorCollection may have zero or more objects in it. On most computers, the collection will have seven or more objects. Note that C++ does not have a GetAllSensors call, so you must use GetSensorsByCategory(SENSOR_CATEGORY_ALL, ...) instead.
result = pSensorManager-> GetSensorsByCategory(SENSOR_CATEGORY_ALL,&pSensorCollection)
Querying the Sensors in Metro/WinRT
For Metro/WinRT, you will simply use the methods to get the sensor object and test for NULL. The Geolocation method is a little different. Here are some examples:
Here are some good resources from the Microsoft website for developing sensor-enabled apps:
Also, here are some more blogs/articles that may be useful regarding on Ultrabooks and Windows 8:
The primary goal for this blog was to educate the reader on how to detect the required sensors supported for Windows 8 Ultrabooks. The focus was primarily on the "clam-shell" form factor since Convertibles, Tablets and Mobile devices will be required to have all the sensors. It is important to note that sensor support for Ultrabooks is dependent on the OEM and Model. While it is possible to run local tools to determine the existence of sensors, software developers will need to be able to programmatically check for the sensors so that their software will not attempt to use a device that may or may not be there.