Click to Rate and Give Feedback
MSDN
MSDN Library
Windows Development
Devices
Sensor API
Sensor API

Purpose

Windows 7 includes native support for sensors, which are devices that can measure physical phenomena such as temperature or location. This documentation describes the Sensor API, which enables applications to get and use data from sensors in a standardized way.

As humans, we rely on our senses to provide us with information about the world around us. When we create machines to take on some of our work, we add sensor mechanisms so the machines can respond appropriately to changing conditions.

For example, automobile engines typically use a variety of sensors. These sensors are monitored by an onboard computer that continuously adjusts settings, such as engine timing, to maximize power and efficiency. A television may use an ambient light sensor to adjust the brightness of the picture to match changing room conditions. Even something as simple as a doorbell button acts as a rudimentary sensor to detect a human presence at the door.

While the purely mechanical doorbell fulfills its purpose, the information provided by complex sensors becomes far more powerful when it is combined with software. Modern sensors can provide a lot of data very quickly, and in a variety of formats, so software provides a natural mechanism for making sense of sensor data.

Today, software developers can write programs that use sensors, but a lack of standardization makes programming for sensors an arduous task. After a sensor-based program is completed, it is usually forever dependent on a particular type of hardware. Using one or more vertical solutions to enable deployment of a software-based system has limited the integration of sensors with computer hardware and, until now, Windows-based computers have been no exception.

Windows 7 includes native support for sensors, expanded by a new development platform for working with sensors, including location sensors, such as GPS devices. The Windows Sensor and Location platform provides a standard way for device manufacturers to expose sensor devices to software developers and consumers, while providing developers with a standardized application programming interface (API) for working with sensors and sensor data.

Sensors are devices or mechanisms that can measure physical phenomena, provide descriptive data, or provide information about the state of a physical object or environment. Computers can make use of built-in sensors, sensors that are connected through wired or wireless connections, or sensors that provide data through a network or the Internet.

The Sensor API provides a standard way to programmatically access data that sensors provide. The Sensor API standardizes:

  • Sensor categories, types, and properties.
  • Data formats for standard sensor types.
  • COM interfaces for working with sensors and collections of sensors.
  • Event mechanisms for asynchronously receiving sensor data.

The Sensor API also enables you to define custom sensor categories, types, properties, data formats, and events.

Developer audience

The Sensor API provides its functionality through a set of COM interfaces. This documentation assumes that you have a working knowledge of programming using the C++ programming language, and you have a basic understanding of how to use COM objects and interfaces. For the sake of brevity, many code examples in this documentation (as well as in the code samples) use Active Template Library (ATL) objects to implement COM functionality.

In this section

 

 

Build date: 3/6/2012

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
yo      ben80110   |   Edit   |   Show History
this is my sensor api avatar
Tags What's this?: Add a tag
Flag as ContentBug
GPS      Cosma Bogdan   |   Edit   |   Show History
GPS
Tags What's this?: Add a tag
Flag as ContentBug
sensorsapi.idl is missing from the sdk      Sébastien FR   |   Edit   |   Show History
The sensorsapi.idl is missing from the last Windows 7 SDK. Only the "always generated" .H file is present. Without this Interfaces Definition file, the Sensors API is unusable for another languages such as Delphi.
Tags What's this?: Add a tag
Flag as ContentBug
Will these cover industrial automation too?      Massimo Soricetti   |   Edit   |   Show History
Will be possible to interrogate/command PLCs, automation drives and other industrial automation devices with these APIs, like OPC does?
What kind of support is provided for buses (IEEE488/GPIB, CANbus, Profibus etc.)?
Tags What's this?: Add a tag
Flag as ContentBug
How about sample code?      Lawrence Ricci   |   Edit   |   Show History
I would like to see sample code for a sensor API that will look at a webcam and return head location of a viewer's eyes with respect to the camera.
Sensor API Future Looks Bright To Me      J Tracy   |   Edit   |   Show History
I have been a developer for over 20 years. In the 80's and 90's Microsoft pioneered a set of standard device API's for printers and databases. In fact, these have become a standard and are taken for granted by developers today. How long would it take to work with databases and printers where there was no standard API. I can tell you that in the past it was a nightmare.

Why did Oracle and others develop providers for RDBMS data storage? Why have hardware manufacturers such as HP, Cannon and many others created printer devices that have standardized device drivers? The reason is simple - if they want to see their hardware then they need to comply with some standardization from Microsoft.

.NET is a major focus in today's business development environment. I think that this is a good first stage to creating API's that eventually might be incorporated into .NET. So I applaud Microsoft for taking this initiative and the other initiatives in the last few years, such as the Robotics Factory and the Micro Factory.
Tags What's this?: Add a tag
Flag as ContentBug
Sensor API Future      WindowsNT   |   Edit   |   Show History
If anyone is to be forced, that will be done due to Windows 7' popularity.

However I doubt that the Sensor API is made to control DSLR. It is more appealing to me for output only devices, like GPS hardware etc.
Tags What's this?: Add a tag
Flag as ContentBug
Is there a future for Sensor API?      S. Kostrov   |   Edit   |   Show History
It looks very futuristic... How are you going to enforce different companies to use Sensor API in order
to control different hardware?

Let's take a look at 4 companies, that is, Nikon, Canon, Celestron and Meade.

Nikon and Canon are making DSLR cameras and because they compete they try to guard their solutions.
Both companies have SKDs which allow to create a C++ application that could fully control a
DSLR. But, when I use Nikon's SDK I can't create an application that controls Canon's DSLR! The same applies to
Canon's SDK.

Another example is Celestron and Meade. These two companies are making telescopes and their Go-To
telescopes could be easily controlled from a computer, but their Hand-Control command sets are so different
( because of competition! ) that I really don't believe in any possibility of a universal solution...
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker