Struct PowerSensor::Sensor

Nested Relationships

This struct is a nested type of Class PowerSensor.

Nested Types

Struct Documentation

struct Sensor

Public Functions

struct PowerSensor3::PowerSensor::Sensor::EEPROM __attribute__ ((packed))
void setType(const std::string type)

Set type of sensor.

Parameters:

type

void setPairName(const std::string pairName)

Set name of sensor pair.

Parameters:

pairName

void setVref(const float vref)

Set reference voltage of sensor.

Parameters:

vref

void setSensitivity(const float slope)

Set sensitivity of sensor.

Parameters:

sensitivity

void setInUse(const bool inUse)

Set whether or not the sensor is in use.

Parameters:

inUse

void setPolarity(const int polarity)

Set polarity of sensor.

Parameters:

polarity – (-1 or 1)

double getValue() const

Get current calibrated sensor value.

Returns:

double

void readFromEEPROM(int fd)

Read configuration of single sensor from device EEPROM.

Parameters:

fd – file descriptor to device

void writeToEEPROM(int fd) const

Write configuration of single sensor to device EEPROM.

Parameters:

fd – file descriptor to device

void updateLevel(uint16_t level)

Update calibrated sensor value based on raw level.

Parameters:

level

void reset()

Reset the sensor value to 0.

Public Members

std::string type
std::string pairName
float vref
float sensitivity
bool inUse
uint16_t level
double valueAtLastMeasurement
struct EEPROM

Configuration of a single sensor as read from device EEPROM.

Public Members

char type[MAX_TYPE_LENGTH]

Sensor type.

char pairName[MAX_PAIRNAME_LENGTH]

Sensor pair name.

float vref

Sensor reference voltage.

float sensitivity

Sensor sensitivity (V/A for current sensors, unitless gain for voltage sensors)

bool inUse

Whether or not the sensor is in use.