| 1171 | } |
| 1172 | |
| 1173 | bool ThermalZone_Impl::setZoneControlHumidistat(const ZoneControlHumidistat& humidistat) { |
| 1174 | auto t_model = model(); |
| 1175 | |
| 1176 | if (t_model != humidistat.model()) { |
| 1177 | return false; |
| 1178 | } |
| 1179 | |
| 1180 | if (auto currentZone = humidistat.controlledZone()) { |
| 1181 | if (currentZone->handle() == handle()) { |
| 1182 | return true; |
| 1183 | } else { |
| 1184 | auto humidistatClone = humidistat.clone(t_model).cast<ZoneControlHumidistat>(); |
| 1185 | resetZoneControlHumidistat(); |
| 1186 | return setPointer(OS_ThermalZoneFields::HumidistatName, humidistatClone.handle()); |
| 1187 | } |
| 1188 | } else { |
| 1189 | resetZoneControlHumidistat(); |
| 1190 | return setPointer(OS_ThermalZoneFields::HumidistatName, humidistat.handle()); |
| 1191 | } |
| 1192 | } |
| 1193 | |
| 1194 | void ThermalZone_Impl::resetZoneControlHumidistat() { |
| 1195 | if (boost::optional<ZoneControlHumidistat> humidistat = this->zoneControlHumidistat()) { |