Reading Ultrabook Sensor Data with the Windows 8 Sensor API
Note: This is not a complete article. It is shared for the purpose of helping App Innovation contestants get started with Ultrabook sensor manipulation. As my schedule allows I will add detail to the article.
The Windows 8 Sensor API makes communication with the Ultrabook’s sensors a snap.
The Ultrabook includes several physical solid-state sensors as well as a few virtual sensors that are abstracted through the API.
How it Works
The application consists of a single-form Windows Forms application that updates the user interface in real-time with current sensor data. A background thread subscribes to sensor class events and collects sensor data. The UI thread updates the UI periodically with the data collected by the sensor thread.
To obtain sensor data, call the static
GetDefault() method of the appropriate class, set properties as necessary, and subscribe to available events (
ReadingChanged is typically available.)
The user interface uses a custom Metro-style-style group-box control.
Points of Interest
- I have been unable to get GPS sensor data from the Intel Ultrabook. From what I can tell it either:
- doesn’t have GPS or it’s not enabled.
- doesn’t have an antenna.
- doesn’t include working drivers.
- I have been unable to get near-field communication (NFC) working. I have only tried to sense NFC tags (containing the Mifare Ultralight chip).
- Use of the API in desktop applications requires a reference to the Windows 8 runtime. This requires a bit of mucking about in Visual Studio.
- If Windows 8 is not present, the application will fail with a
TypeLoadExceptionbefore even reaching
- The location API appears to use some standard accuracy values, from which we can infer the sensor being used:
- I don’t know if all of my units of measurement are correct.
- 1G is equal to an acceleration of 9.81m/s² or a force of 9.81N/kg.
If you have additional information to share, please contact me. If you found this useful, please cast a vote.
2012-11-06 – Original article