22 water_detected = i != 0;
33 status.
level = mm ? level_t::CRITICAL : level_t::NOTIFY;
44 snprintf(description,
sizeof(description),
"%imm water in %s", water_level, location);
49 status_t::encode(buffer);
50 uint8_t start_byte = status_t::get_encode_size();
51 buffer[start_byte] = water_level_mm;
52 buffer[start_byte + 1] = strlen(location);
53 memcpy((
char *) &buffer[start_byte + 2], location, strlen(location));
57 status_t::decode(to_decode);
58 uint8_t start_byte = status_t::get_encode_size();
59 water_level_mm = to_decode[start_byte];
61 memcpy(location, (
char *) &to_decode[start_byte + 2], to_decode[start_byte + 1]);
65 return status_t::get_encode_size() + strlen(location) + 2;
const std::map< err_t, char * > err_to_char
err_t is_wet(bool &water_detected)
Is water detected at the sensor?
uint8_t get_encode_size() override
status_t status
stores the comm status
void update_description(uint8_t water_level)
updates description with water level.
void set_sis_status_location(char *location)
Set the location of the sensor.
sis::status_t * update_status() override
Perform check to see if system is secure and return updated status.
void encode(uint8_t *buffer) override
int error(const char *format,...)
log error message
status that is to be reported to the watcher
void decode(uint8_t *to_decode) override
water_status_t()
water-specific SIS status
virtual err_t get_water_level(uint16_t &water_level_in_mm)=0
Get water level in millimeters of the sensor.