Sensing the world

Delphi comes with the System.Sensors unit, where all kinds of possible sensors are defined. Similarly to the FMX.Platform unit, the System.Sensors also has ifdefs in its implementation and a uses clause for different platforms including Android and iOS.

There is main TSensorManager class that acts as a gateway to all sensor information. It has a Current: TSensorManager class property that is used to reference all sensor information. At the top of the System.Sensors unit, you can find a TSensorCategory enumerated type that provides the top level categorization of all possible sensors:

type   TSensorCategory = (Location, Environmental, Motion, Orientation, Mechanical, Electrical, Biometric, Light, Scanner); 

Within each category ...

Get Expert Delphi now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.