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),
95 rdm_sensor_type Type()
const {
return m_type; }
96 rdm_pid_unit Unit()
const {
return m_unit; }
97 rdm_pid_prefix Prefix()
const {
return m_prefix; }
98 int16_t RangeMin()
const {
return m_range_min; }
99 int16_t RangeMax()
const {
return m_range_max; }
100 int16_t NormalMin()
const {
return m_normal_min; }
101 int16_t NormalMax()
const {
return m_normal_max; }
102 const std::string& Description()
const {
return m_description; }
104 int16_t Lowest()
const {
105 if (m_recorded_range_support) {
108 return SENSOR_RECORDED_RANGE_UNSUPPORTED;
112 int16_t Highest()
const {
113 if (m_recorded_range_support) {
116 return SENSOR_RECORDED_RANGE_UNSUPPORTED;
120 int16_t Recorded()
const {
121 if (m_recorded_value_support) {
124 return SENSOR_RECORDED_UNSUPPORTED;
134 m_lowest = std::min(value, m_lowest);
135 m_highest = std::max(value, m_highest);
158 uint8_t RecordedSupportBitMask()
const {
159 uint8_t bit_mask = 0;
160 if (m_recorded_value_support) {
161 bit_mask |= SENSOR_RECORDED_VALUE;
163 if (m_recorded_range_support) {
164 bit_mask |= SENSOR_RECORDED_RANGE_VALUES;
176 const ola::rdm::rdm_sensor_type m_type;
177 const ola::rdm::rdm_pid_unit m_unit;
178 const ola::rdm::rdm_pid_prefix m_prefix;
179 const std::string m_description;
180 const bool m_recorded_value_support;
181 const bool m_recorded_range_support;
182 const int16_t m_range_min;
183 const int16_t m_range_max;
184 const int16_t m_normal_min;
185 const int16_t m_normal_max;
191 typedef std::vector<ola::rdm::Sensor*> Sensors;
194 #endif // INCLUDE_OLA_RDM_RESPONDERSENSOR_H_