29 #ifndef INCLUDE_OLA_RDM_RESPONDERSENSOR_H_
30 #define INCLUDE_OLA_RDM_RESPONDERSENSOR_H_
49 bool recorded_value_support;
50 bool recorded_range_support;
60 bool recorded_range_support =
true,
61 int16_t range_min = SENSOR_DEFINITION_RANGE_MIN_UNDEFINED,
62 int16_t range_max = SENSOR_DEFINITION_RANGE_MAX_UNDEFINED,
64 SENSOR_DEFINITION_NORMAL_MIN_UNDEFINED,
66 SENSOR_DEFINITION_NORMAL_MAX_UNDEFINED)
67 : recorded_value_support(recorded_value_support),
68 recorded_range_support(recorded_range_support),
71 normal_min(normal_min),
72 normal_max(normal_max) {
76 Sensor(ola::rdm::rdm_sensor_type type,
77 ola::rdm::rdm_pid_unit unit,
78 ola::rdm::rdm_pid_prefix prefix,
79 const std::string &description,
84 m_description(description),
85 m_recorded_value_support(options.recorded_value_support),
86 m_recorded_range_support(options.recorded_range_support),
87 m_range_min(options.range_min),
88 m_range_max(options.range_max),
89 m_normal_min(options.normal_min),
90 m_normal_max(options.normal_max),
97 rdm_sensor_type Type()
const {
return m_type; }
98 rdm_pid_unit Unit()
const {
return m_unit; }
99 rdm_pid_prefix Prefix()
const {
return m_prefix; }
100 int16_t RangeMin()
const {
return m_range_min; }
101 int16_t RangeMax()
const {
return m_range_max; }
102 int16_t NormalMin()
const {
return m_normal_min; }
103 int16_t NormalMax()
const {
return m_normal_max; }
104 const std::string& Description()
const {
return m_description; }
106 int16_t Lowest()
const {
107 if (m_recorded_range_support) {
110 return SENSOR_RECORDED_RANGE_UNSUPPORTED;
114 int16_t Highest()
const {
115 if (m_recorded_range_support) {
118 return SENSOR_RECORDED_RANGE_UNSUPPORTED;
122 int16_t Recorded()
const {
123 if (m_recorded_value_support) {
126 return SENSOR_RECORDED_UNSUPPORTED;
136 m_lowest = std::min(value, m_lowest);
137 m_highest = std::max(value, m_highest);
160 uint8_t RecordedSupportBitMask()
const {
161 uint8_t bit_mask = 0;
162 if (m_recorded_value_support) {
163 bit_mask |= SENSOR_RECORDED_VALUE;
165 if (m_recorded_range_support) {
166 bit_mask |= SENSOR_RECORDED_RANGE_VALUES;
178 const ola::rdm::rdm_sensor_type m_type;
179 const ola::rdm::rdm_pid_unit m_unit;
180 const ola::rdm::rdm_pid_prefix m_prefix;
181 const std::string m_description;
182 const bool m_recorded_value_support;
183 const bool m_recorded_range_support;
184 const int16_t m_range_min;
185 const int16_t m_range_max;
186 const int16_t m_normal_min;
187 const int16_t m_normal_max;
193 typedef std::vector<ola::rdm::Sensor*> Sensors;
196 #endif // INCLUDE_OLA_RDM_RESPONDERSENSOR_H_