8#include "dawn/io/common.hxx"
9#include "dawn/porting/config.hxx"
10#include "dawn/porting/sensors.hxx"
25 ,
public CIOSensorPorting
30 IO_SENSOR_CFG_FIRST = 0,
41 IO_SENSOR_CFG_LAST = 31
48 , info(getSensorInfo(
getCls()))
51 , measurementPeriod(0)
56 ~CIOSensor()
override;
58#ifdef CONFIG_DAWN_OBJECT_HAS_NAME
59 const char *getClassNameStr()
const override
97 int getDataImpl(IODataCmn &data,
size_t len)
override;
99#ifdef CONFIG_DAWN_IO_NOTIFY
100 int getFd()
const override;
126 constexpr static SObjectId::ObjectId objectId(uint16_t cls, uint8_t dtype,
bool ts, uint16_t inst)
130#ifdef CONFIG_DAWN_IO_TIMESTAMP
136 DAWNASSERT(ts ==
false,
"ts not supported");
228 constexpr static const size_t DATA_BUFFER_SIZE = 32;
230 const SIOSensorMapInfo *info;
232 uint32_t updateInterval;
233 uint32_t measurementPeriod;
234 char path[PATH_MAX] = {};
237 int configureDesc(
const CDescObject &desc);
Descriptor wrapper for individual object configuration.
Base class for all I/O objects.
virtual int getFd() const
Get file descriptor for notifications.
@ IO_FLAGS_TS
Timestamp support flag.
@ IO_CLASS_SENSOR_MAGNETICFIELD
Magnetic field sensor.
@ IO_CLASS_ANY
Any I/O class.
@ IO_CLASS_SENSOR_LIGHT
Light sensor.
@ IO_CLASS_SENSOR_BAROMETER
Barometer sensor.
@ IO_CLASS_SENSOR_HUMIDITY
Humidity sensor.
@ IO_CLASS_SENSOR_PROXIMITY
Proximity sensor.
@ IO_CLASS_SENSOR_TEMPERATURE
Temperature sensor.
@ IO_CLASS_SENSOR_UV
Ultraviolet sensor.
@ IO_CLASS_SENSOR_ACCELEROMETER
Accelerometer sensor.
@ IO_CLASS_SENSOR_RGB
RGB color sensor.
@ IO_CLASS_SENSOR_GYROSCOPE
Gyroscope sensor.
@ IO_CLASS_SENSOR_IR
Infrared sensor.
@ IO_CLASS_SENSOR_ATEMPERATURE
Ambient temperature sensor.
@ IO_CLASS_SENSOR_GAS
Gas sensor.
Generic sensor interface for various sensor types.
bool isNotify() const
Check if IO supports notifications.
bool isWrite() const
Check if IO supports write operations.
int deinit()
De-initialize object.
int getDataImpl(IODataCmn &data, size_t len)
Get data implementation (override in derived classes).
bool isBatch() const
Check if IO supports batch operations.
size_t getDataSize() const
Get data size in bytes.
@ IO_SENSOR_CFG_GAIN
Analog gain setting.
@ IO_SENSOR_CFG_UNIT
Measurement unit selection.
@ IO_SENSOR_CFG_ORIENTATION
Sensor orientation/mounting angle.
@ IO_SENSOR_CFG_ALERT
Alert threshold configuration.
@ IO_SENSOR_CFG_BANDWIDTHLP
Low-pass filter bandwidth.
@ IO_SENSOR_CFG_MEASPERIOD
Measurement period.
@ IO_SENSOR_CFG_SCALE
Scale/multiplier for raw sensor values.
@ IO_SENSOR_CFG_BANDWIDTHHP
High-pass filter bandwidth.
@ IO_SENSOR_CFG_UPDATEINTERVAL
Data update interval in milliseconds.
@ IO_SENSOR_CFG_ENABLE
Sensor enable/disable configuration.
bool isRead() const
Check if IO supports read operations.
int configure()
Configure object from descriptor data.
size_t getDataDim() const
Get data vector dimension.
uint16_t getCls() const
Get object class field.
static ObjectCfgId objectCfg(uint8_t type, uint16_t cls, uint8_t dtype, bool rw, uint16_t size, uint8_t id)
Construct 32-bit ConfigID from component fields.
uint32_t ObjectCfgId
ConfigID type - single 32-bit value.
static size_t ID_MAX
Configuration ID field constants and bit shift positions.
Out-of-tree user-extension hooks for Dawn.
@ OBJTYPE_IO
Input/Output object type.
@ DTYPE_UINT32
Unsigned 32-bit integer (0 to 4294967295).
uint32_t ObjectId
ObjectID type - single 32-bit value.
static ObjectId objectId(uint8_t type, uint16_t cls, uint8_t dtype, uint8_t flags, uint16_t priv)
Construct 32-bit ObjectID from component fields.