Kallisto Linux API
Library for interacting with Kallisto devices
Sensor Class Reference

#include <sensor.hpp>

Inheritance diagram for Sensor:

Public Types

enum  SensorType {
  ACCELEROMETER, MAGNETIC_FIELD, GYROSCOPE, PRESSURE,
  RELATIVE_HUMIDITY, AMBIENT_TEMPERATURE, BATTERY_SOC, BATTERY_CHARGING_STATUS,
  RSSI, ANALOG, CO2_CONCENTRATION, TVOC_CONCENTRATION
}
 
enum  ReportingMode { REPORTING_MODE_CONTINUOUS, REPORTING_MODE_ON_CHANGE, REPORTING_MODE_ONE_SHOT, REPORTING_MODE_SPECIAL_TRIGGER }
 

Public Member Functions

unsigned int getHandle () const
 
std::string getName () const
 
std::string getAddress () const
 
std::string getVendor () const
 
unsigned int getVersion () const
 
SensorType getType () const
 
std::string getStringType () const
 
ReportingMode getReportingMode () const
 
unsigned int getIdentifier () const
 
float getMaximumRange () const
 
float getResolution () const
 
float getPower () const
 
std::chrono::microseconds getMinDelay () const
 
std::chrono::microseconds getMaxDelay () const
 
std::string toString ()
 
bool operator== (const Sensor &other) const
 
bool operator!= (const Sensor &other) const
 

Static Public Member Functions

static unsigned int getValueArraySize (SensorType type)
 

Protected Member Functions

 Sensor (unsigned int handle, std::string name, std::string address, std::string vendor, unsigned int version, SensorType type, std::string string_type, ReportingMode reporting_mode, unsigned int identifier, float max_range, float resolution, float power, std::chrono::microseconds min_delay, std::chrono::microseconds max_delay)
 
virtual ~Sensor ()
 
 Sensor (Sensor const &)=delete
 
 Sensor (Sensor &&)=delete
 
void operator= (Sensor const &)=delete
 
void operator= (Sensor &&)=delete
 

Protected Attributes

const unsigned int m_handle
 
const std::string m_name
 
const std::string m_address
 
const std::string m_vendor
 
const unsigned int m_version
 
const SensorType m_type
 
const std::string m_string_type
 
const ReportingMode m_reporting_mode
 
const unsigned int m_identifier
 
const float m_max_range
 
const float m_resolution
 
const float m_power
 
const std::chrono::microseconds m_min_delay
 
const std::chrono::microseconds m_max_delay
 

Detailed Description

Class representing a sensor.

Member Enumeration Documentation

◆ ReportingMode

enum ReportingMode
strong

Supported reporting modes.

See de.sensry.kallisto.hardware.listeners.events.SensorEvent#values for more details.

Enumerator
REPORTING_MODE_CONTINUOUS 

Events are reported at a constant rate which is set by the rate parameter of registerListener(SensorEventListener, Sensor, int). Note: If other applications are requesting a higher rate, the sensor data might be delivered at faster rates than requested.

REPORTING_MODE_ON_CHANGE 

Events are reported only when the value changes. Event delivery rate can be limited by setting appropriate value for rate parameter of registerListener(SensorEventListener, Sensor, int) Note: If other applications are requesting a higher rate, the sensor data might be delivered at faster rates than requested.

REPORTING_MODE_ONE_SHOT 

Events are reported in one-shot mode. Upon detection of an event, the sensor deactivates itself and then sends a single event. Sensors of this reporting mode must be registered to using requestTriggerSensor(TriggerEventListener, Sensor).

REPORTING_MODE_SPECIAL_TRIGGER 

Events are reported as described in the description of the sensor. The rate passed to registerListener might not have an impact on the rate of event delivery. See the sensor definition for more information on when and how frequently the events are reported. For example, step detectors report events when a step is detected.

◆ SensorType

enum SensorType
strong

Supported sensor types.

See de.sensry.kallisto.hardware.listeners.events.SensorEvent#values for more details.

Enumerator
ACCELEROMETER 

A constant describing an accelerometer sensor type.

MAGNETIC_FIELD 

A constant describing a magnetic field sensor type.

GYROSCOPE 

A constant describing a gyroscope sensor type.

PRESSURE 

A constant describing a pressure sensor type.

RELATIVE_HUMIDITY 

A constant describing a relative humidity sensor type.

AMBIENT_TEMPERATURE 

A constant describing an ambient temperature sensor type.

BATTERY_SOC 

A constant describing a battery state-of-charge sensor type.

BATTERY_CHARGING_STATUS 

A constant describing a battery charging status sensor type.

RSSI 

A constant describing a RSSI value sensor type.

ANALOG 

A constant describing an analog sensor.

CO2_CONCENTRATION 

A constant describing an CO2 concentration sensor.

TVOC_CONCENTRATION 

A constant describing a total volatile organic compound concentration sensor.

Constructor & Destructor Documentation

◆ Sensor() [1/2]

Sensor ( unsigned int  handle,
std::string  name,
std::string  address,
std::string  vendor,
unsigned int  version,
SensorType  type,
std::string  string_type,
ReportingMode  reporting_mode,
unsigned int  identifier,
float  max_range,
float  resolution,
float  power,
std::chrono::microseconds  min_delay,
std::chrono::microseconds  max_delay 
)
protected

Constructor

◆ ~Sensor()

virtual ~Sensor ( )
protectedvirtual

Destructor

◆ Sensor() [2/2]

Sensor ( Sensor const &  )
protecteddelete

Remove copy and move.

Member Function Documentation

◆ getAddress()

std::string getAddress ( ) const
Returns
The MAC address of the Kallisto that contains this sensor.

◆ getHandle()

unsigned int getHandle ( ) const
Returns
This sensor handle.

◆ getIdentifier()

unsigned int getIdentifier ( ) const
Returns
The identifier of this sensor instance. Identifies different instances of the same sensor inside an Kallisto.

◆ getMaxDelay()

std::chrono::microseconds getMaxDelay ( ) const

This value is defined only for continuous and on-change sensors. It is the delay between two sensor events corresponding to the lowest frequency that this sensor supports. When lower frequencies are requested through registerListener() the events will be generated at this frequency instead.

Returns
The max delay for this sensor in microseconds.

◆ getMaximumRange()

float getMaximumRange ( ) const
Returns
The maximum range of the sensor in the sensor's unit.

◆ getMinDelay()

std::chrono::microseconds getMinDelay ( ) const
Returns
The minimum delay allowed between two events in microsecond or zero if this sensor only returns a value when the data it's measuring changes.

◆ getName()

std::string getName ( ) const
Returns
The name string of the sensor.

◆ getPower()

float getPower ( ) const
Returns
The power in mA used by this sensor while in use

◆ getReportingMode()

ReportingMode getReportingMode ( ) const
Returns
The reporting mode of this sensor.

◆ getResolution()

float getResolution ( ) const
Returns
The resolution of the sensor in the sensor's unit.

◆ getStringType()

std::string getStringType ( ) const
Returns
The type of this sensor as a string.

◆ getType()

SensorType getType ( ) const
Returns
The generic type of this sensor.

◆ getValueArraySize()

static unsigned int getValueArraySize ( SensorType  type)
static

Returns the size of the data array in the Sensor callback.

Parameters
typeThe sensor type.
Returns
The data array size for the passed sensor type.

◆ getVendor()

std::string getVendor ( ) const
Returns
The vendor string of this sensor.

◆ getVersion()

unsigned int getVersion ( ) const
Returns
The version of the sensor's module.

◆ toString()

std::string toString ( )

Field Documentation

◆ m_address

const std::string m_address
protected

◆ m_handle

const unsigned int m_handle
protected

◆ m_identifier

const unsigned int m_identifier
protected

◆ m_max_delay

const std::chrono::microseconds m_max_delay
protected

◆ m_max_range

const float m_max_range
protected

◆ m_min_delay

const std::chrono::microseconds m_min_delay
protected

◆ m_name

const std::string m_name
protected

◆ m_power

const float m_power
protected

◆ m_reporting_mode

const ReportingMode m_reporting_mode
protected

◆ m_resolution

const float m_resolution
protected

◆ m_string_type

const std::string m_string_type
protected

◆ m_type

const SensorType m_type
protected

◆ m_vendor

const std::string m_vendor
protected

◆ m_version

const unsigned int m_version
protected

The documentation for this class was generated from the following file: