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 there are different sensor types, so each category has its own enumerated type as well. All specialized sensor types derive from an abstract TCustomSensor
class that provides basic functionality that is common to all sensors, for example, Start
and Stop...