1 #define LOG_TAG "com.android.server.display.config" 2 #include "com_android_server_display_config.h" 3 4 #include <assert.h> 5 #ifndef __BIONIC__ 6 #define __assert2(f,n,fun,e) do { fprintf(stderr, "%s:%d: %s: Assertion `%s' failed", (f), (n), (fun), (e)); abort(); } while (false) 7 #endif 8 #define _xsdc_assert(e) do if (!(e)) __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, #e); while (false) 9 10 namespace com { 11 namespace android { 12 namespace server { 13 namespace display { 14 namespace config { 15 template <class T> 16 constexpr void (*xmlDeleter)(T* t); 17 template <> 18 constexpr auto xmlDeleter<xmlDoc> = xmlFreeDoc; 19 template <> __anon2da0c60f0102(xmlChar *s) 20 auto xmlDeleter<xmlChar> = [](xmlChar *s) { xmlFree(s); }; 21 22 template <class T> make_xmlUnique(T * t)23 constexpr auto make_xmlUnique(T *t) { 24 auto deleter = [](T *t) { xmlDeleter<T>(t); }; 25 return std::unique_ptr<T, decltype(deleter)>{t, deleter}; 26 } 27 getXmlAttribute(const xmlNode * cur,const char * attribute)28 static std::string getXmlAttribute(const xmlNode *cur, const char *attribute) { 29 auto xmlValue = make_xmlUnique(xmlGetProp(cur, reinterpret_cast<const xmlChar*>(attribute))); 30 if (xmlValue == nullptr) { 31 return ""; 32 } 33 std::string value(reinterpret_cast<const char*>(xmlValue.get())); 34 return value; 35 } 36 read(const char * configFile)37 std::optional<DisplayConfiguration> read(const char* configFile) { 38 auto doc = make_xmlUnique(xmlParseFile(configFile)); 39 if (doc == nullptr) { 40 return std::nullopt; 41 } 42 xmlNodePtr _child = xmlDocGetRootElement(doc.get()); 43 if (_child == nullptr) { 44 return std::nullopt; 45 } 46 if (xmlXIncludeProcess(doc.get()) < 0) { 47 return std::nullopt; 48 } 49 50 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("displayConfiguration"))) { 51 DisplayConfiguration _value = DisplayConfiguration::read(_child); 52 return _value; 53 } 54 return std::nullopt; 55 } 56 parse(const char * xml)57 std::optional<DisplayConfiguration> parse(const char* xml) { 58 auto doc = make_xmlUnique(xmlParseDoc(reinterpret_cast<const xmlChar*>(xml))); 59 if (doc == nullptr) { 60 return std::nullopt; 61 } 62 xmlNodePtr _child = xmlDocGetRootElement(doc.get()); 63 if (_child == nullptr) { 64 return std::nullopt; 65 } 66 if (xmlXIncludeProcess(doc.get()) < 0) { 67 return std::nullopt; 68 } 69 70 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("displayConfiguration"))) { 71 DisplayConfiguration _value = DisplayConfiguration::read(_child); 72 return _value; 73 } 74 return std::nullopt; 75 } 76 77 DisplayQuirks(std::vector<std::string> quirk)78 DisplayQuirks::DisplayQuirks(std::vector<std::string> quirk) : quirk_(std::move(quirk)) { 79 } 80 getQuirk() const81 const std::vector<std::string>& DisplayQuirks::getQuirk() const { 82 return quirk_; 83 } 84 hasQuirk() const85 bool DisplayQuirks::hasQuirk() const { 86 return !(quirk_.empty()); 87 } 88 getFirstQuirk() const89 const std::string* DisplayQuirks::getFirstQuirk() const { 90 if (quirk_.empty()) { 91 return nullptr; 92 } 93 return &quirk_[0]; 94 } 95 read(xmlNode * root)96 DisplayQuirks DisplayQuirks::read(xmlNode *root) { 97 std::string _raw; 98 std::vector<std::string> quirk; 99 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 100 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("quirk"))) { 101 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 102 if (xmlValue == nullptr) { 103 _raw = ""; 104 } else { 105 _raw = reinterpret_cast<const char*>(xmlValue.get()); 106 } 107 std::string &_value = _raw; 108 quirk.push_back(std::move(_value)); 109 } 110 } 111 DisplayQuirks instance(quirk); 112 return instance; 113 } 114 LuxThrottling(std::vector<BrightnessLimitMap> brightnessLimitMap)115 LuxThrottling::LuxThrottling(std::vector<BrightnessLimitMap> brightnessLimitMap) : brightnessLimitMap_(std::move(brightnessLimitMap)) { 116 } 117 getBrightnessLimitMap() const118 const std::vector<BrightnessLimitMap>& LuxThrottling::getBrightnessLimitMap() const { 119 return brightnessLimitMap_; 120 } 121 hasBrightnessLimitMap() const122 bool LuxThrottling::hasBrightnessLimitMap() const { 123 return !(brightnessLimitMap_.empty()); 124 } 125 getFirstBrightnessLimitMap() const126 const BrightnessLimitMap* LuxThrottling::getFirstBrightnessLimitMap() const { 127 if (brightnessLimitMap_.empty()) { 128 return nullptr; 129 } 130 return &brightnessLimitMap_[0]; 131 } 132 read(xmlNode * root)133 LuxThrottling LuxThrottling::read(xmlNode *root) { 134 std::string _raw; 135 std::vector<BrightnessLimitMap> brightnessLimitMap; 136 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 137 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("brightnessLimitMap"))) { 138 BrightnessLimitMap _value = BrightnessLimitMap::read(_child); 139 brightnessLimitMap.push_back(std::move(_value)); 140 } 141 } 142 LuxThrottling instance(brightnessLimitMap); 143 return instance; 144 } 145 BrightnessLimitMap(std::optional<PredefinedBrightnessLimitNames> type,std::vector<NonNegativeFloatToFloatMap> map)146 BrightnessLimitMap::BrightnessLimitMap(std::optional<PredefinedBrightnessLimitNames> type, std::vector<NonNegativeFloatToFloatMap> map) : type_(type), map_(std::move(map)) { 147 } 148 getType() const149 const PredefinedBrightnessLimitNames& BrightnessLimitMap::getType() const { 150 _xsdc_assert(hasType()); 151 return type_.value(); 152 } 153 hasType() const154 bool BrightnessLimitMap::hasType() const { 155 return type_.has_value(); 156 } 157 getMap() const158 const std::vector<NonNegativeFloatToFloatMap>& BrightnessLimitMap::getMap() const { 159 return map_; 160 } 161 hasMap() const162 bool BrightnessLimitMap::hasMap() const { 163 return !(map_.empty()); 164 } 165 getFirstMap() const166 const NonNegativeFloatToFloatMap* BrightnessLimitMap::getFirstMap() const { 167 if (map_.empty()) { 168 return nullptr; 169 } 170 return &map_[0]; 171 } 172 read(xmlNode * root)173 BrightnessLimitMap BrightnessLimitMap::read(xmlNode *root) { 174 std::string _raw; 175 std::optional<PredefinedBrightnessLimitNames> type; 176 std::vector<NonNegativeFloatToFloatMap> map; 177 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 178 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("type"))) { 179 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 180 if (xmlValue == nullptr) { 181 _raw = ""; 182 } else { 183 _raw = reinterpret_cast<const char*>(xmlValue.get()); 184 } 185 PredefinedBrightnessLimitNames _value = stringToPredefinedBrightnessLimitNames(_raw); 186 type = std::move(_value); 187 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("map"))) { 188 NonNegativeFloatToFloatMap _value = NonNegativeFloatToFloatMap::read(_child); 189 map.push_back(std::move(_value)); 190 } 191 } 192 BrightnessLimitMap instance(type, map); 193 return instance; 194 } 195 EvenDimmerMode(std::optional<double> transitionPoint,std::vector<ComprehensiveBrightnessMap> brightnessMapping,std::vector<NitsMap> luxToMinimumNitsMap,std::optional<bool> enabled)196 EvenDimmerMode::EvenDimmerMode(std::optional<double> transitionPoint, std::vector<ComprehensiveBrightnessMap> brightnessMapping, std::vector<NitsMap> luxToMinimumNitsMap, std::optional<bool> enabled) : transitionPoint_(transitionPoint), brightnessMapping_(std::move(brightnessMapping)), luxToMinimumNitsMap_(std::move(luxToMinimumNitsMap)), enabled_(enabled) { 197 } 198 getTransitionPoint() const199 const double& EvenDimmerMode::getTransitionPoint() const { 200 _xsdc_assert(hasTransitionPoint()); 201 return transitionPoint_.value(); 202 } 203 hasTransitionPoint() const204 bool EvenDimmerMode::hasTransitionPoint() const { 205 return transitionPoint_.has_value(); 206 } 207 getBrightnessMapping() const208 const std::vector<ComprehensiveBrightnessMap>& EvenDimmerMode::getBrightnessMapping() const { 209 return brightnessMapping_; 210 } 211 hasBrightnessMapping() const212 bool EvenDimmerMode::hasBrightnessMapping() const { 213 return !(brightnessMapping_.empty()); 214 } 215 getFirstBrightnessMapping() const216 const ComprehensiveBrightnessMap* EvenDimmerMode::getFirstBrightnessMapping() const { 217 if (brightnessMapping_.empty()) { 218 return nullptr; 219 } 220 return &brightnessMapping_[0]; 221 } 222 getLuxToMinimumNitsMap() const223 const std::vector<NitsMap>& EvenDimmerMode::getLuxToMinimumNitsMap() const { 224 return luxToMinimumNitsMap_; 225 } 226 hasLuxToMinimumNitsMap() const227 bool EvenDimmerMode::hasLuxToMinimumNitsMap() const { 228 return !(luxToMinimumNitsMap_.empty()); 229 } 230 getFirstLuxToMinimumNitsMap() const231 const NitsMap* EvenDimmerMode::getFirstLuxToMinimumNitsMap() const { 232 if (luxToMinimumNitsMap_.empty()) { 233 return nullptr; 234 } 235 return &luxToMinimumNitsMap_[0]; 236 } 237 getEnabled() const238 const bool& EvenDimmerMode::getEnabled() const { 239 _xsdc_assert(hasEnabled()); 240 return enabled_.value(); 241 } 242 hasEnabled() const243 bool EvenDimmerMode::hasEnabled() const { 244 return enabled_.has_value(); 245 } 246 read(xmlNode * root)247 EvenDimmerMode EvenDimmerMode::read(xmlNode *root) { 248 std::string _raw; 249 _raw = getXmlAttribute(root, "enabled"); 250 std::optional<bool> enabled = std::nullopt; 251 if (_raw != "") { 252 bool _value = _raw == "true"; 253 enabled = _value; 254 } 255 std::optional<double> transitionPoint; 256 std::vector<ComprehensiveBrightnessMap> brightnessMapping; 257 std::vector<NitsMap> luxToMinimumNitsMap; 258 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 259 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("transitionPoint"))) { 260 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 261 if (xmlValue == nullptr) { 262 _raw = ""; 263 } else { 264 _raw = reinterpret_cast<const char*>(xmlValue.get()); 265 } 266 double _value = std::stod(_raw); 267 transitionPoint = std::move(_value); 268 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("brightnessMapping"))) { 269 ComprehensiveBrightnessMap _value = ComprehensiveBrightnessMap::read(_child); 270 brightnessMapping.push_back(std::move(_value)); 271 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("luxToMinimumNitsMap"))) { 272 NitsMap _value = NitsMap::read(_child); 273 luxToMinimumNitsMap.push_back(std::move(_value)); 274 } 275 } 276 EvenDimmerMode instance(transitionPoint, brightnessMapping, luxToMinimumNitsMap, enabled); 277 return instance; 278 } 279 HighBrightnessMode(std::optional<double> transitionPoint_all,std::optional<double> minimumLux_all,std::vector<HbmTiming> timing_all,std::vector<RefreshRateRange> refreshRate_all,std::optional<bool> allowInLowPowerMode_all,std::optional<double> minimumHdrPercentOfScreen_all,std::vector<SdrHdrRatioMap> sdrHdrRatioMap_all,std::optional<bool> enabled)280 HighBrightnessMode::HighBrightnessMode(std::optional<double> transitionPoint_all, std::optional<double> minimumLux_all, std::vector<HbmTiming> timing_all, std::vector<RefreshRateRange> refreshRate_all, std::optional<bool> allowInLowPowerMode_all, std::optional<double> minimumHdrPercentOfScreen_all, std::vector<SdrHdrRatioMap> sdrHdrRatioMap_all, std::optional<bool> enabled) : transitionPoint_all_(transitionPoint_all), minimumLux_all_(minimumLux_all), timing_all_(std::move(timing_all)), refreshRate_all_(std::move(refreshRate_all)), allowInLowPowerMode_all_(allowInLowPowerMode_all), minimumHdrPercentOfScreen_all_(minimumHdrPercentOfScreen_all), sdrHdrRatioMap_all_(std::move(sdrHdrRatioMap_all)), enabled_(enabled) { 281 } 282 getTransitionPoint_all() const283 const double& HighBrightnessMode::getTransitionPoint_all() const { 284 _xsdc_assert(hasTransitionPoint_all()); 285 return transitionPoint_all_.value(); 286 } 287 hasTransitionPoint_all() const288 bool HighBrightnessMode::hasTransitionPoint_all() const { 289 return transitionPoint_all_.has_value(); 290 } 291 getMinimumLux_all() const292 const double& HighBrightnessMode::getMinimumLux_all() const { 293 _xsdc_assert(hasMinimumLux_all()); 294 return minimumLux_all_.value(); 295 } 296 hasMinimumLux_all() const297 bool HighBrightnessMode::hasMinimumLux_all() const { 298 return minimumLux_all_.has_value(); 299 } 300 getTiming_all() const301 const std::vector<HbmTiming>& HighBrightnessMode::getTiming_all() const { 302 return timing_all_; 303 } 304 hasTiming_all() const305 bool HighBrightnessMode::hasTiming_all() const { 306 return !(timing_all_.empty()); 307 } 308 getFirstTiming_all() const309 const HbmTiming* HighBrightnessMode::getFirstTiming_all() const { 310 if (timing_all_.empty()) { 311 return nullptr; 312 } 313 return &timing_all_[0]; 314 } 315 getRefreshRate_all() const316 const std::vector<RefreshRateRange>& HighBrightnessMode::getRefreshRate_all() const { 317 return refreshRate_all_; 318 } 319 hasRefreshRate_all() const320 bool HighBrightnessMode::hasRefreshRate_all() const { 321 return !(refreshRate_all_.empty()); 322 } 323 getFirstRefreshRate_all() const324 const RefreshRateRange* HighBrightnessMode::getFirstRefreshRate_all() const { 325 if (refreshRate_all_.empty()) { 326 return nullptr; 327 } 328 return &refreshRate_all_[0]; 329 } 330 getAllowInLowPowerMode_all() const331 const bool& HighBrightnessMode::getAllowInLowPowerMode_all() const { 332 _xsdc_assert(hasAllowInLowPowerMode_all()); 333 return allowInLowPowerMode_all_.value(); 334 } 335 hasAllowInLowPowerMode_all() const336 bool HighBrightnessMode::hasAllowInLowPowerMode_all() const { 337 return allowInLowPowerMode_all_.has_value(); 338 } 339 getMinimumHdrPercentOfScreen_all() const340 const double& HighBrightnessMode::getMinimumHdrPercentOfScreen_all() const { 341 _xsdc_assert(hasMinimumHdrPercentOfScreen_all()); 342 return minimumHdrPercentOfScreen_all_.value(); 343 } 344 hasMinimumHdrPercentOfScreen_all() const345 bool HighBrightnessMode::hasMinimumHdrPercentOfScreen_all() const { 346 return minimumHdrPercentOfScreen_all_.has_value(); 347 } 348 getSdrHdrRatioMap_all() const349 const std::vector<SdrHdrRatioMap>& HighBrightnessMode::getSdrHdrRatioMap_all() const { 350 return sdrHdrRatioMap_all_; 351 } 352 hasSdrHdrRatioMap_all() const353 bool HighBrightnessMode::hasSdrHdrRatioMap_all() const { 354 return !(sdrHdrRatioMap_all_.empty()); 355 } 356 getFirstSdrHdrRatioMap_all() const357 const SdrHdrRatioMap* HighBrightnessMode::getFirstSdrHdrRatioMap_all() const { 358 if (sdrHdrRatioMap_all_.empty()) { 359 return nullptr; 360 } 361 return &sdrHdrRatioMap_all_[0]; 362 } 363 getEnabled() const364 const bool& HighBrightnessMode::getEnabled() const { 365 _xsdc_assert(hasEnabled()); 366 return enabled_.value(); 367 } 368 hasEnabled() const369 bool HighBrightnessMode::hasEnabled() const { 370 return enabled_.has_value(); 371 } 372 read(xmlNode * root)373 HighBrightnessMode HighBrightnessMode::read(xmlNode *root) { 374 std::string _raw; 375 _raw = getXmlAttribute(root, "enabled"); 376 std::optional<bool> enabled = std::nullopt; 377 if (_raw != "") { 378 bool _value = _raw == "true"; 379 enabled = _value; 380 } 381 std::optional<double> transitionPoint_all; 382 std::optional<double> minimumLux_all; 383 std::vector<HbmTiming> timing_all; 384 std::vector<RefreshRateRange> refreshRate_all; 385 std::optional<bool> allowInLowPowerMode_all; 386 std::optional<double> minimumHdrPercentOfScreen_all; 387 std::vector<SdrHdrRatioMap> sdrHdrRatioMap_all; 388 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 389 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("transitionPoint"))) { 390 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 391 if (xmlValue == nullptr) { 392 _raw = ""; 393 } else { 394 _raw = reinterpret_cast<const char*>(xmlValue.get()); 395 } 396 double _value = std::stod(_raw); 397 transitionPoint_all = std::move(_value); 398 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("minimumLux"))) { 399 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 400 if (xmlValue == nullptr) { 401 _raw = ""; 402 } else { 403 _raw = reinterpret_cast<const char*>(xmlValue.get()); 404 } 405 double _value = std::stod(_raw); 406 minimumLux_all = std::move(_value); 407 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("timing"))) { 408 HbmTiming _value = HbmTiming::read(_child); 409 timing_all.push_back(std::move(_value)); 410 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("refreshRate"))) { 411 RefreshRateRange _value = RefreshRateRange::read(_child); 412 refreshRate_all.push_back(std::move(_value)); 413 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("allowInLowPowerMode"))) { 414 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 415 if (xmlValue == nullptr) { 416 _raw = ""; 417 } else { 418 _raw = reinterpret_cast<const char*>(xmlValue.get()); 419 } 420 bool _value = _raw == "true"; 421 allowInLowPowerMode_all = std::move(_value); 422 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("minimumHdrPercentOfScreen"))) { 423 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 424 if (xmlValue == nullptr) { 425 _raw = ""; 426 } else { 427 _raw = reinterpret_cast<const char*>(xmlValue.get()); 428 } 429 double _value = std::stod(_raw); 430 minimumHdrPercentOfScreen_all = std::move(_value); 431 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("sdrHdrRatioMap"))) { 432 SdrHdrRatioMap _value = SdrHdrRatioMap::read(_child); 433 sdrHdrRatioMap_all.push_back(std::move(_value)); 434 } 435 } 436 HighBrightnessMode instance(transitionPoint_all, minimumLux_all, timing_all, refreshRate_all, allowInLowPowerMode_all, minimumHdrPercentOfScreen_all, sdrHdrRatioMap_all, enabled); 437 return instance; 438 } 439 HbmTiming(std::optional<int64_t> timeWindowSecs_all,std::optional<int64_t> timeMaxSecs_all,std::optional<int64_t> timeMinSecs_all)440 HbmTiming::HbmTiming(std::optional<int64_t> timeWindowSecs_all, std::optional<int64_t> timeMaxSecs_all, std::optional<int64_t> timeMinSecs_all) : timeWindowSecs_all_(timeWindowSecs_all), timeMaxSecs_all_(timeMaxSecs_all), timeMinSecs_all_(timeMinSecs_all) { 441 } 442 getTimeWindowSecs_all() const443 const int64_t& HbmTiming::getTimeWindowSecs_all() const { 444 _xsdc_assert(hasTimeWindowSecs_all()); 445 return timeWindowSecs_all_.value(); 446 } 447 hasTimeWindowSecs_all() const448 bool HbmTiming::hasTimeWindowSecs_all() const { 449 return timeWindowSecs_all_.has_value(); 450 } 451 getTimeMaxSecs_all() const452 const int64_t& HbmTiming::getTimeMaxSecs_all() const { 453 _xsdc_assert(hasTimeMaxSecs_all()); 454 return timeMaxSecs_all_.value(); 455 } 456 hasTimeMaxSecs_all() const457 bool HbmTiming::hasTimeMaxSecs_all() const { 458 return timeMaxSecs_all_.has_value(); 459 } 460 getTimeMinSecs_all() const461 const int64_t& HbmTiming::getTimeMinSecs_all() const { 462 _xsdc_assert(hasTimeMinSecs_all()); 463 return timeMinSecs_all_.value(); 464 } 465 hasTimeMinSecs_all() const466 bool HbmTiming::hasTimeMinSecs_all() const { 467 return timeMinSecs_all_.has_value(); 468 } 469 read(xmlNode * root)470 HbmTiming HbmTiming::read(xmlNode *root) { 471 std::string _raw; 472 std::optional<int64_t> timeWindowSecs_all; 473 std::optional<int64_t> timeMaxSecs_all; 474 std::optional<int64_t> timeMinSecs_all; 475 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 476 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("timeWindowSecs"))) { 477 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 478 if (xmlValue == nullptr) { 479 _raw = ""; 480 } else { 481 _raw = reinterpret_cast<const char*>(xmlValue.get()); 482 } 483 int64_t _value = std::stoll(_raw); 484 timeWindowSecs_all = std::move(_value); 485 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("timeMaxSecs"))) { 486 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 487 if (xmlValue == nullptr) { 488 _raw = ""; 489 } else { 490 _raw = reinterpret_cast<const char*>(xmlValue.get()); 491 } 492 int64_t _value = std::stoll(_raw); 493 timeMaxSecs_all = std::move(_value); 494 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("timeMinSecs"))) { 495 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 496 if (xmlValue == nullptr) { 497 _raw = ""; 498 } else { 499 _raw = reinterpret_cast<const char*>(xmlValue.get()); 500 } 501 int64_t _value = std::stoll(_raw); 502 timeMinSecs_all = std::move(_value); 503 } 504 } 505 HbmTiming instance(timeWindowSecs_all, timeMaxSecs_all, timeMinSecs_all); 506 return instance; 507 } 508 HdrBrightnessConfig(std::vector<NonNegativeFloatToFloatMap> brightnessMap,std::optional<int64_t> brightnessIncreaseDebounceMillis,std::optional<int64_t> brightnessDecreaseDebounceMillis,std::optional<double> screenBrightnessRampIncrease,std::optional<double> screenBrightnessRampDecrease,std::optional<double> minimumHdrPercentOfScreenForNbm,std::optional<double> minimumHdrPercentOfScreenForHbm,std::optional<bool> allowInLowPowerMode,std::vector<NonNegativeFloatToFloatMap> sdrHdrRatioMap)509 HdrBrightnessConfig::HdrBrightnessConfig(std::vector<NonNegativeFloatToFloatMap> brightnessMap, std::optional<int64_t> brightnessIncreaseDebounceMillis, std::optional<int64_t> brightnessDecreaseDebounceMillis, std::optional<double> screenBrightnessRampIncrease, std::optional<double> screenBrightnessRampDecrease, std::optional<double> minimumHdrPercentOfScreenForNbm, std::optional<double> minimumHdrPercentOfScreenForHbm, std::optional<bool> allowInLowPowerMode, std::vector<NonNegativeFloatToFloatMap> sdrHdrRatioMap) : brightnessMap_(std::move(brightnessMap)), brightnessIncreaseDebounceMillis_(brightnessIncreaseDebounceMillis), brightnessDecreaseDebounceMillis_(brightnessDecreaseDebounceMillis), screenBrightnessRampIncrease_(screenBrightnessRampIncrease), screenBrightnessRampDecrease_(screenBrightnessRampDecrease), minimumHdrPercentOfScreenForNbm_(minimumHdrPercentOfScreenForNbm), minimumHdrPercentOfScreenForHbm_(minimumHdrPercentOfScreenForHbm), allowInLowPowerMode_(allowInLowPowerMode), sdrHdrRatioMap_(std::move(sdrHdrRatioMap)) { 510 } 511 getBrightnessMap() const512 const std::vector<NonNegativeFloatToFloatMap>& HdrBrightnessConfig::getBrightnessMap() const { 513 return brightnessMap_; 514 } 515 hasBrightnessMap() const516 bool HdrBrightnessConfig::hasBrightnessMap() const { 517 return !(brightnessMap_.empty()); 518 } 519 getFirstBrightnessMap() const520 const NonNegativeFloatToFloatMap* HdrBrightnessConfig::getFirstBrightnessMap() const { 521 if (brightnessMap_.empty()) { 522 return nullptr; 523 } 524 return &brightnessMap_[0]; 525 } 526 getBrightnessIncreaseDebounceMillis() const527 const int64_t& HdrBrightnessConfig::getBrightnessIncreaseDebounceMillis() const { 528 _xsdc_assert(hasBrightnessIncreaseDebounceMillis()); 529 return brightnessIncreaseDebounceMillis_.value(); 530 } 531 hasBrightnessIncreaseDebounceMillis() const532 bool HdrBrightnessConfig::hasBrightnessIncreaseDebounceMillis() const { 533 return brightnessIncreaseDebounceMillis_.has_value(); 534 } 535 getBrightnessDecreaseDebounceMillis() const536 const int64_t& HdrBrightnessConfig::getBrightnessDecreaseDebounceMillis() const { 537 _xsdc_assert(hasBrightnessDecreaseDebounceMillis()); 538 return brightnessDecreaseDebounceMillis_.value(); 539 } 540 hasBrightnessDecreaseDebounceMillis() const541 bool HdrBrightnessConfig::hasBrightnessDecreaseDebounceMillis() const { 542 return brightnessDecreaseDebounceMillis_.has_value(); 543 } 544 getScreenBrightnessRampIncrease() const545 const double& HdrBrightnessConfig::getScreenBrightnessRampIncrease() const { 546 _xsdc_assert(hasScreenBrightnessRampIncrease()); 547 return screenBrightnessRampIncrease_.value(); 548 } 549 hasScreenBrightnessRampIncrease() const550 bool HdrBrightnessConfig::hasScreenBrightnessRampIncrease() const { 551 return screenBrightnessRampIncrease_.has_value(); 552 } 553 getScreenBrightnessRampDecrease() const554 const double& HdrBrightnessConfig::getScreenBrightnessRampDecrease() const { 555 _xsdc_assert(hasScreenBrightnessRampDecrease()); 556 return screenBrightnessRampDecrease_.value(); 557 } 558 hasScreenBrightnessRampDecrease() const559 bool HdrBrightnessConfig::hasScreenBrightnessRampDecrease() const { 560 return screenBrightnessRampDecrease_.has_value(); 561 } 562 getMinimumHdrPercentOfScreenForNbm() const563 const double& HdrBrightnessConfig::getMinimumHdrPercentOfScreenForNbm() const { 564 _xsdc_assert(hasMinimumHdrPercentOfScreenForNbm()); 565 return minimumHdrPercentOfScreenForNbm_.value(); 566 } 567 hasMinimumHdrPercentOfScreenForNbm() const568 bool HdrBrightnessConfig::hasMinimumHdrPercentOfScreenForNbm() const { 569 return minimumHdrPercentOfScreenForNbm_.has_value(); 570 } 571 getMinimumHdrPercentOfScreenForHbm() const572 const double& HdrBrightnessConfig::getMinimumHdrPercentOfScreenForHbm() const { 573 _xsdc_assert(hasMinimumHdrPercentOfScreenForHbm()); 574 return minimumHdrPercentOfScreenForHbm_.value(); 575 } 576 hasMinimumHdrPercentOfScreenForHbm() const577 bool HdrBrightnessConfig::hasMinimumHdrPercentOfScreenForHbm() const { 578 return minimumHdrPercentOfScreenForHbm_.has_value(); 579 } 580 getAllowInLowPowerMode() const581 const bool& HdrBrightnessConfig::getAllowInLowPowerMode() const { 582 _xsdc_assert(hasAllowInLowPowerMode()); 583 return allowInLowPowerMode_.value(); 584 } 585 hasAllowInLowPowerMode() const586 bool HdrBrightnessConfig::hasAllowInLowPowerMode() const { 587 return allowInLowPowerMode_.has_value(); 588 } 589 getSdrHdrRatioMap() const590 const std::vector<NonNegativeFloatToFloatMap>& HdrBrightnessConfig::getSdrHdrRatioMap() const { 591 return sdrHdrRatioMap_; 592 } 593 hasSdrHdrRatioMap() const594 bool HdrBrightnessConfig::hasSdrHdrRatioMap() const { 595 return !(sdrHdrRatioMap_.empty()); 596 } 597 getFirstSdrHdrRatioMap() const598 const NonNegativeFloatToFloatMap* HdrBrightnessConfig::getFirstSdrHdrRatioMap() const { 599 if (sdrHdrRatioMap_.empty()) { 600 return nullptr; 601 } 602 return &sdrHdrRatioMap_[0]; 603 } 604 read(xmlNode * root)605 HdrBrightnessConfig HdrBrightnessConfig::read(xmlNode *root) { 606 std::string _raw; 607 std::vector<NonNegativeFloatToFloatMap> brightnessMap; 608 std::optional<int64_t> brightnessIncreaseDebounceMillis; 609 std::optional<int64_t> brightnessDecreaseDebounceMillis; 610 std::optional<double> screenBrightnessRampIncrease; 611 std::optional<double> screenBrightnessRampDecrease; 612 std::optional<double> minimumHdrPercentOfScreenForNbm; 613 std::optional<double> minimumHdrPercentOfScreenForHbm; 614 std::optional<bool> allowInLowPowerMode; 615 std::vector<NonNegativeFloatToFloatMap> sdrHdrRatioMap; 616 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 617 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("brightnessMap"))) { 618 NonNegativeFloatToFloatMap _value = NonNegativeFloatToFloatMap::read(_child); 619 brightnessMap.push_back(std::move(_value)); 620 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("brightnessIncreaseDebounceMillis"))) { 621 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 622 if (xmlValue == nullptr) { 623 _raw = ""; 624 } else { 625 _raw = reinterpret_cast<const char*>(xmlValue.get()); 626 } 627 int64_t _value = std::stoll(_raw); 628 brightnessIncreaseDebounceMillis = std::move(_value); 629 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("brightnessDecreaseDebounceMillis"))) { 630 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 631 if (xmlValue == nullptr) { 632 _raw = ""; 633 } else { 634 _raw = reinterpret_cast<const char*>(xmlValue.get()); 635 } 636 int64_t _value = std::stoll(_raw); 637 brightnessDecreaseDebounceMillis = std::move(_value); 638 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("screenBrightnessRampIncrease"))) { 639 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 640 if (xmlValue == nullptr) { 641 _raw = ""; 642 } else { 643 _raw = reinterpret_cast<const char*>(xmlValue.get()); 644 } 645 double _value = std::stod(_raw); 646 screenBrightnessRampIncrease = std::move(_value); 647 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("screenBrightnessRampDecrease"))) { 648 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 649 if (xmlValue == nullptr) { 650 _raw = ""; 651 } else { 652 _raw = reinterpret_cast<const char*>(xmlValue.get()); 653 } 654 double _value = std::stod(_raw); 655 screenBrightnessRampDecrease = std::move(_value); 656 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("minimumHdrPercentOfScreenForNbm"))) { 657 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 658 if (xmlValue == nullptr) { 659 _raw = ""; 660 } else { 661 _raw = reinterpret_cast<const char*>(xmlValue.get()); 662 } 663 double _value = std::stod(_raw); 664 minimumHdrPercentOfScreenForNbm = std::move(_value); 665 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("minimumHdrPercentOfScreenForHbm"))) { 666 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 667 if (xmlValue == nullptr) { 668 _raw = ""; 669 } else { 670 _raw = reinterpret_cast<const char*>(xmlValue.get()); 671 } 672 double _value = std::stod(_raw); 673 minimumHdrPercentOfScreenForHbm = std::move(_value); 674 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("allowInLowPowerMode"))) { 675 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 676 if (xmlValue == nullptr) { 677 _raw = ""; 678 } else { 679 _raw = reinterpret_cast<const char*>(xmlValue.get()); 680 } 681 bool _value = _raw == "true"; 682 allowInLowPowerMode = std::move(_value); 683 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("sdrHdrRatioMap"))) { 684 NonNegativeFloatToFloatMap _value = NonNegativeFloatToFloatMap::read(_child); 685 sdrHdrRatioMap.push_back(std::move(_value)); 686 } 687 } 688 HdrBrightnessConfig instance(brightnessMap, brightnessIncreaseDebounceMillis, brightnessDecreaseDebounceMillis, screenBrightnessRampIncrease, screenBrightnessRampDecrease, minimumHdrPercentOfScreenForNbm, minimumHdrPercentOfScreenForHbm, allowInLowPowerMode, sdrHdrRatioMap); 689 return instance; 690 } 691 ThermalThrottling(std::vector<BrightnessThrottlingMap> brightnessThrottlingMap,std::vector<RefreshRateThrottlingMap> refreshRateThrottlingMap)692 ThermalThrottling::ThermalThrottling(std::vector<BrightnessThrottlingMap> brightnessThrottlingMap, std::vector<RefreshRateThrottlingMap> refreshRateThrottlingMap) : brightnessThrottlingMap_(std::move(brightnessThrottlingMap)), refreshRateThrottlingMap_(std::move(refreshRateThrottlingMap)) { 693 } 694 getBrightnessThrottlingMap() const695 const std::vector<BrightnessThrottlingMap>& ThermalThrottling::getBrightnessThrottlingMap() const { 696 return brightnessThrottlingMap_; 697 } 698 hasBrightnessThrottlingMap() const699 bool ThermalThrottling::hasBrightnessThrottlingMap() const { 700 return !(brightnessThrottlingMap_.empty()); 701 } 702 getFirstBrightnessThrottlingMap() const703 const BrightnessThrottlingMap* ThermalThrottling::getFirstBrightnessThrottlingMap() const { 704 if (brightnessThrottlingMap_.empty()) { 705 return nullptr; 706 } 707 return &brightnessThrottlingMap_[0]; 708 } 709 getRefreshRateThrottlingMap() const710 const std::vector<RefreshRateThrottlingMap>& ThermalThrottling::getRefreshRateThrottlingMap() const { 711 return refreshRateThrottlingMap_; 712 } 713 hasRefreshRateThrottlingMap() const714 bool ThermalThrottling::hasRefreshRateThrottlingMap() const { 715 return !(refreshRateThrottlingMap_.empty()); 716 } 717 getFirstRefreshRateThrottlingMap() const718 const RefreshRateThrottlingMap* ThermalThrottling::getFirstRefreshRateThrottlingMap() const { 719 if (refreshRateThrottlingMap_.empty()) { 720 return nullptr; 721 } 722 return &refreshRateThrottlingMap_[0]; 723 } 724 read(xmlNode * root)725 ThermalThrottling ThermalThrottling::read(xmlNode *root) { 726 std::string _raw; 727 std::vector<BrightnessThrottlingMap> brightnessThrottlingMap; 728 std::vector<RefreshRateThrottlingMap> refreshRateThrottlingMap; 729 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 730 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("brightnessThrottlingMap"))) { 731 BrightnessThrottlingMap _value = BrightnessThrottlingMap::read(_child); 732 brightnessThrottlingMap.push_back(std::move(_value)); 733 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("refreshRateThrottlingMap"))) { 734 RefreshRateThrottlingMap _value = RefreshRateThrottlingMap::read(_child); 735 refreshRateThrottlingMap.push_back(std::move(_value)); 736 } 737 } 738 ThermalThrottling instance(brightnessThrottlingMap, refreshRateThrottlingMap); 739 return instance; 740 } 741 RefreshRateThrottlingMap(std::vector<RefreshRateThrottlingPoint> refreshRateThrottlingPoint,std::optional<std::string> id)742 RefreshRateThrottlingMap::RefreshRateThrottlingMap(std::vector<RefreshRateThrottlingPoint> refreshRateThrottlingPoint, std::optional<std::string> id) : refreshRateThrottlingPoint_(std::move(refreshRateThrottlingPoint)), id_(std::move(id)) { 743 } 744 getRefreshRateThrottlingPoint() const745 const std::vector<RefreshRateThrottlingPoint>& RefreshRateThrottlingMap::getRefreshRateThrottlingPoint() const { 746 return refreshRateThrottlingPoint_; 747 } 748 hasRefreshRateThrottlingPoint() const749 bool RefreshRateThrottlingMap::hasRefreshRateThrottlingPoint() const { 750 return !(refreshRateThrottlingPoint_.empty()); 751 } 752 getFirstRefreshRateThrottlingPoint() const753 const RefreshRateThrottlingPoint* RefreshRateThrottlingMap::getFirstRefreshRateThrottlingPoint() const { 754 if (refreshRateThrottlingPoint_.empty()) { 755 return nullptr; 756 } 757 return &refreshRateThrottlingPoint_[0]; 758 } 759 getId() const760 const std::string& RefreshRateThrottlingMap::getId() const { 761 _xsdc_assert(hasId()); 762 return id_.value(); 763 } 764 hasId() const765 bool RefreshRateThrottlingMap::hasId() const { 766 return id_.has_value(); 767 } 768 read(xmlNode * root)769 RefreshRateThrottlingMap RefreshRateThrottlingMap::read(xmlNode *root) { 770 std::string _raw; 771 _raw = getXmlAttribute(root, "id"); 772 std::optional<std::string> id = std::nullopt; 773 if (_raw != "") { 774 std::string &_value = _raw; 775 id = _value; 776 } 777 std::vector<RefreshRateThrottlingPoint> refreshRateThrottlingPoint; 778 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 779 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("refreshRateThrottlingPoint"))) { 780 RefreshRateThrottlingPoint _value = RefreshRateThrottlingPoint::read(_child); 781 refreshRateThrottlingPoint.push_back(std::move(_value)); 782 } 783 } 784 RefreshRateThrottlingMap instance(refreshRateThrottlingPoint, id); 785 return instance; 786 } 787 RefreshRateThrottlingPoint(std::optional<ThermalStatus> thermalStatus,std::vector<RefreshRateRange> refreshRateRange)788 RefreshRateThrottlingPoint::RefreshRateThrottlingPoint(std::optional<ThermalStatus> thermalStatus, std::vector<RefreshRateRange> refreshRateRange) : thermalStatus_(thermalStatus), refreshRateRange_(std::move(refreshRateRange)) { 789 } 790 getThermalStatus() const791 const ThermalStatus& RefreshRateThrottlingPoint::getThermalStatus() const { 792 _xsdc_assert(hasThermalStatus()); 793 return thermalStatus_.value(); 794 } 795 hasThermalStatus() const796 bool RefreshRateThrottlingPoint::hasThermalStatus() const { 797 return thermalStatus_.has_value(); 798 } 799 getRefreshRateRange() const800 const std::vector<RefreshRateRange>& RefreshRateThrottlingPoint::getRefreshRateRange() const { 801 return refreshRateRange_; 802 } 803 hasRefreshRateRange() const804 bool RefreshRateThrottlingPoint::hasRefreshRateRange() const { 805 return !(refreshRateRange_.empty()); 806 } 807 getFirstRefreshRateRange() const808 const RefreshRateRange* RefreshRateThrottlingPoint::getFirstRefreshRateRange() const { 809 if (refreshRateRange_.empty()) { 810 return nullptr; 811 } 812 return &refreshRateRange_[0]; 813 } 814 read(xmlNode * root)815 RefreshRateThrottlingPoint RefreshRateThrottlingPoint::read(xmlNode *root) { 816 std::string _raw; 817 std::optional<ThermalStatus> thermalStatus; 818 std::vector<RefreshRateRange> refreshRateRange; 819 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 820 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("thermalStatus"))) { 821 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 822 if (xmlValue == nullptr) { 823 _raw = ""; 824 } else { 825 _raw = reinterpret_cast<const char*>(xmlValue.get()); 826 } 827 ThermalStatus _value = stringToThermalStatus(_raw); 828 thermalStatus = std::move(_value); 829 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("refreshRateRange"))) { 830 RefreshRateRange _value = RefreshRateRange::read(_child); 831 refreshRateRange.push_back(std::move(_value)); 832 } 833 } 834 RefreshRateThrottlingPoint instance(thermalStatus, refreshRateRange); 835 return instance; 836 } 837 BrightnessThrottlingMap(std::vector<BrightnessThrottlingPoint> brightnessThrottlingPoint,std::optional<std::string> id)838 BrightnessThrottlingMap::BrightnessThrottlingMap(std::vector<BrightnessThrottlingPoint> brightnessThrottlingPoint, std::optional<std::string> id) : brightnessThrottlingPoint_(std::move(brightnessThrottlingPoint)), id_(std::move(id)) { 839 } 840 getBrightnessThrottlingPoint() const841 const std::vector<BrightnessThrottlingPoint>& BrightnessThrottlingMap::getBrightnessThrottlingPoint() const { 842 return brightnessThrottlingPoint_; 843 } 844 hasBrightnessThrottlingPoint() const845 bool BrightnessThrottlingMap::hasBrightnessThrottlingPoint() const { 846 return !(brightnessThrottlingPoint_.empty()); 847 } 848 getFirstBrightnessThrottlingPoint() const849 const BrightnessThrottlingPoint* BrightnessThrottlingMap::getFirstBrightnessThrottlingPoint() const { 850 if (brightnessThrottlingPoint_.empty()) { 851 return nullptr; 852 } 853 return &brightnessThrottlingPoint_[0]; 854 } 855 getId() const856 const std::string& BrightnessThrottlingMap::getId() const { 857 _xsdc_assert(hasId()); 858 return id_.value(); 859 } 860 hasId() const861 bool BrightnessThrottlingMap::hasId() const { 862 return id_.has_value(); 863 } 864 read(xmlNode * root)865 BrightnessThrottlingMap BrightnessThrottlingMap::read(xmlNode *root) { 866 std::string _raw; 867 _raw = getXmlAttribute(root, "id"); 868 std::optional<std::string> id = std::nullopt; 869 if (_raw != "") { 870 std::string &_value = _raw; 871 id = _value; 872 } 873 std::vector<BrightnessThrottlingPoint> brightnessThrottlingPoint; 874 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 875 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("brightnessThrottlingPoint"))) { 876 BrightnessThrottlingPoint _value = BrightnessThrottlingPoint::read(_child); 877 brightnessThrottlingPoint.push_back(std::move(_value)); 878 } 879 } 880 BrightnessThrottlingMap instance(brightnessThrottlingPoint, id); 881 return instance; 882 } 883 BrightnessThrottlingPoint(std::optional<ThermalStatus> thermalStatus,std::optional<double> brightness)884 BrightnessThrottlingPoint::BrightnessThrottlingPoint(std::optional<ThermalStatus> thermalStatus, std::optional<double> brightness) : thermalStatus_(thermalStatus), brightness_(brightness) { 885 } 886 getThermalStatus() const887 const ThermalStatus& BrightnessThrottlingPoint::getThermalStatus() const { 888 _xsdc_assert(hasThermalStatus()); 889 return thermalStatus_.value(); 890 } 891 hasThermalStatus() const892 bool BrightnessThrottlingPoint::hasThermalStatus() const { 893 return thermalStatus_.has_value(); 894 } 895 getBrightness() const896 const double& BrightnessThrottlingPoint::getBrightness() const { 897 _xsdc_assert(hasBrightness()); 898 return brightness_.value(); 899 } 900 hasBrightness() const901 bool BrightnessThrottlingPoint::hasBrightness() const { 902 return brightness_.has_value(); 903 } 904 read(xmlNode * root)905 BrightnessThrottlingPoint BrightnessThrottlingPoint::read(xmlNode *root) { 906 std::string _raw; 907 std::optional<ThermalStatus> thermalStatus; 908 std::optional<double> brightness; 909 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 910 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("thermalStatus"))) { 911 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 912 if (xmlValue == nullptr) { 913 _raw = ""; 914 } else { 915 _raw = reinterpret_cast<const char*>(xmlValue.get()); 916 } 917 ThermalStatus _value = stringToThermalStatus(_raw); 918 thermalStatus = std::move(_value); 919 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("brightness"))) { 920 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 921 if (xmlValue == nullptr) { 922 _raw = ""; 923 } else { 924 _raw = reinterpret_cast<const char*>(xmlValue.get()); 925 } 926 double _value = std::stod(_raw); 927 brightness = std::move(_value); 928 } 929 } 930 BrightnessThrottlingPoint instance(thermalStatus, brightness); 931 return instance; 932 } 933 PowerThrottlingMap(std::vector<PowerThrottlingPoint> powerThrottlingPoint,std::optional<std::string> id)934 PowerThrottlingMap::PowerThrottlingMap(std::vector<PowerThrottlingPoint> powerThrottlingPoint, std::optional<std::string> id) : powerThrottlingPoint_(std::move(powerThrottlingPoint)), id_(std::move(id)) { 935 } 936 getPowerThrottlingPoint() const937 const std::vector<PowerThrottlingPoint>& PowerThrottlingMap::getPowerThrottlingPoint() const { 938 return powerThrottlingPoint_; 939 } 940 hasPowerThrottlingPoint() const941 bool PowerThrottlingMap::hasPowerThrottlingPoint() const { 942 return !(powerThrottlingPoint_.empty()); 943 } 944 getFirstPowerThrottlingPoint() const945 const PowerThrottlingPoint* PowerThrottlingMap::getFirstPowerThrottlingPoint() const { 946 if (powerThrottlingPoint_.empty()) { 947 return nullptr; 948 } 949 return &powerThrottlingPoint_[0]; 950 } 951 getId() const952 const std::string& PowerThrottlingMap::getId() const { 953 _xsdc_assert(hasId()); 954 return id_.value(); 955 } 956 hasId() const957 bool PowerThrottlingMap::hasId() const { 958 return id_.has_value(); 959 } 960 read(xmlNode * root)961 PowerThrottlingMap PowerThrottlingMap::read(xmlNode *root) { 962 std::string _raw; 963 _raw = getXmlAttribute(root, "id"); 964 std::optional<std::string> id = std::nullopt; 965 if (_raw != "") { 966 std::string &_value = _raw; 967 id = _value; 968 } 969 std::vector<PowerThrottlingPoint> powerThrottlingPoint; 970 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 971 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("powerThrottlingPoint"))) { 972 PowerThrottlingPoint _value = PowerThrottlingPoint::read(_child); 973 powerThrottlingPoint.push_back(std::move(_value)); 974 } 975 } 976 PowerThrottlingMap instance(powerThrottlingPoint, id); 977 return instance; 978 } 979 PowerThrottlingPoint(std::optional<ThermalStatus> thermalStatus,std::optional<double> powerQuotaMilliWatts)980 PowerThrottlingPoint::PowerThrottlingPoint(std::optional<ThermalStatus> thermalStatus, std::optional<double> powerQuotaMilliWatts) : thermalStatus_(thermalStatus), powerQuotaMilliWatts_(powerQuotaMilliWatts) { 981 } 982 getThermalStatus() const983 const ThermalStatus& PowerThrottlingPoint::getThermalStatus() const { 984 _xsdc_assert(hasThermalStatus()); 985 return thermalStatus_.value(); 986 } 987 hasThermalStatus() const988 bool PowerThrottlingPoint::hasThermalStatus() const { 989 return thermalStatus_.has_value(); 990 } 991 getPowerQuotaMilliWatts() const992 const double& PowerThrottlingPoint::getPowerQuotaMilliWatts() const { 993 _xsdc_assert(hasPowerQuotaMilliWatts()); 994 return powerQuotaMilliWatts_.value(); 995 } 996 hasPowerQuotaMilliWatts() const997 bool PowerThrottlingPoint::hasPowerQuotaMilliWatts() const { 998 return powerQuotaMilliWatts_.has_value(); 999 } 1000 read(xmlNode * root)1001 PowerThrottlingPoint PowerThrottlingPoint::read(xmlNode *root) { 1002 std::string _raw; 1003 std::optional<ThermalStatus> thermalStatus; 1004 std::optional<double> powerQuotaMilliWatts; 1005 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 1006 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("thermalStatus"))) { 1007 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1008 if (xmlValue == nullptr) { 1009 _raw = ""; 1010 } else { 1011 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1012 } 1013 ThermalStatus _value = stringToThermalStatus(_raw); 1014 thermalStatus = std::move(_value); 1015 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("powerQuotaMilliWatts"))) { 1016 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1017 if (xmlValue == nullptr) { 1018 _raw = ""; 1019 } else { 1020 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1021 } 1022 double _value = std::stod(_raw); 1023 powerQuotaMilliWatts = std::move(_value); 1024 } 1025 } 1026 PowerThrottlingPoint instance(thermalStatus, powerQuotaMilliWatts); 1027 return instance; 1028 } 1029 PowerThrottlingConfig(std::optional<double> brightnessLowestCapAllowed,std::optional<double> customAnimationRate,std::optional<int64_t> pollingWindowMaxMillis,std::optional<int64_t> pollingWindowMinMillis,std::vector<PowerThrottlingMap> powerThrottlingMap)1030 PowerThrottlingConfig::PowerThrottlingConfig(std::optional<double> brightnessLowestCapAllowed, std::optional<double> customAnimationRate, std::optional<int64_t> pollingWindowMaxMillis, std::optional<int64_t> pollingWindowMinMillis, std::vector<PowerThrottlingMap> powerThrottlingMap) : brightnessLowestCapAllowed_(brightnessLowestCapAllowed), customAnimationRate_(customAnimationRate), pollingWindowMaxMillis_(pollingWindowMaxMillis), pollingWindowMinMillis_(pollingWindowMinMillis), powerThrottlingMap_(std::move(powerThrottlingMap)) { 1031 } 1032 getBrightnessLowestCapAllowed() const1033 const double& PowerThrottlingConfig::getBrightnessLowestCapAllowed() const { 1034 _xsdc_assert(hasBrightnessLowestCapAllowed()); 1035 return brightnessLowestCapAllowed_.value(); 1036 } 1037 hasBrightnessLowestCapAllowed() const1038 bool PowerThrottlingConfig::hasBrightnessLowestCapAllowed() const { 1039 return brightnessLowestCapAllowed_.has_value(); 1040 } 1041 getCustomAnimationRate() const1042 const double& PowerThrottlingConfig::getCustomAnimationRate() const { 1043 _xsdc_assert(hasCustomAnimationRate()); 1044 return customAnimationRate_.value(); 1045 } 1046 hasCustomAnimationRate() const1047 bool PowerThrottlingConfig::hasCustomAnimationRate() const { 1048 return customAnimationRate_.has_value(); 1049 } 1050 getPollingWindowMaxMillis() const1051 const int64_t& PowerThrottlingConfig::getPollingWindowMaxMillis() const { 1052 _xsdc_assert(hasPollingWindowMaxMillis()); 1053 return pollingWindowMaxMillis_.value(); 1054 } 1055 hasPollingWindowMaxMillis() const1056 bool PowerThrottlingConfig::hasPollingWindowMaxMillis() const { 1057 return pollingWindowMaxMillis_.has_value(); 1058 } 1059 getPollingWindowMinMillis() const1060 const int64_t& PowerThrottlingConfig::getPollingWindowMinMillis() const { 1061 _xsdc_assert(hasPollingWindowMinMillis()); 1062 return pollingWindowMinMillis_.value(); 1063 } 1064 hasPollingWindowMinMillis() const1065 bool PowerThrottlingConfig::hasPollingWindowMinMillis() const { 1066 return pollingWindowMinMillis_.has_value(); 1067 } 1068 getPowerThrottlingMap() const1069 const std::vector<PowerThrottlingMap>& PowerThrottlingConfig::getPowerThrottlingMap() const { 1070 return powerThrottlingMap_; 1071 } 1072 hasPowerThrottlingMap() const1073 bool PowerThrottlingConfig::hasPowerThrottlingMap() const { 1074 return !(powerThrottlingMap_.empty()); 1075 } 1076 getFirstPowerThrottlingMap() const1077 const PowerThrottlingMap* PowerThrottlingConfig::getFirstPowerThrottlingMap() const { 1078 if (powerThrottlingMap_.empty()) { 1079 return nullptr; 1080 } 1081 return &powerThrottlingMap_[0]; 1082 } 1083 read(xmlNode * root)1084 PowerThrottlingConfig PowerThrottlingConfig::read(xmlNode *root) { 1085 std::string _raw; 1086 std::optional<double> brightnessLowestCapAllowed; 1087 std::optional<double> customAnimationRate; 1088 std::optional<int64_t> pollingWindowMaxMillis; 1089 std::optional<int64_t> pollingWindowMinMillis; 1090 std::vector<PowerThrottlingMap> powerThrottlingMap; 1091 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 1092 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("brightnessLowestCapAllowed"))) { 1093 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1094 if (xmlValue == nullptr) { 1095 _raw = ""; 1096 } else { 1097 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1098 } 1099 double _value = std::stod(_raw); 1100 brightnessLowestCapAllowed = std::move(_value); 1101 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("customAnimationRate"))) { 1102 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1103 if (xmlValue == nullptr) { 1104 _raw = ""; 1105 } else { 1106 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1107 } 1108 double _value = std::stod(_raw); 1109 customAnimationRate = std::move(_value); 1110 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("pollingWindowMaxMillis"))) { 1111 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1112 if (xmlValue == nullptr) { 1113 _raw = ""; 1114 } else { 1115 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1116 } 1117 int64_t _value = std::stoll(_raw); 1118 pollingWindowMaxMillis = std::move(_value); 1119 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("pollingWindowMinMillis"))) { 1120 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1121 if (xmlValue == nullptr) { 1122 _raw = ""; 1123 } else { 1124 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1125 } 1126 int64_t _value = std::stoll(_raw); 1127 pollingWindowMinMillis = std::move(_value); 1128 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("powerThrottlingMap"))) { 1129 PowerThrottlingMap _value = PowerThrottlingMap::read(_child); 1130 powerThrottlingMap.push_back(std::move(_value)); 1131 } 1132 } 1133 PowerThrottlingConfig instance(brightnessLowestCapAllowed, customAnimationRate, pollingWindowMaxMillis, pollingWindowMinMillis, powerThrottlingMap); 1134 return instance; 1135 } 1136 NitsMap(std::vector<Point> point,std::optional<std::string> interpolation)1137 NitsMap::NitsMap(std::vector<Point> point, std::optional<std::string> interpolation) : point_(std::move(point)), interpolation_(std::move(interpolation)) { 1138 } 1139 getPoint() const1140 const std::vector<Point>& NitsMap::getPoint() const { 1141 return point_; 1142 } 1143 hasPoint() const1144 bool NitsMap::hasPoint() const { 1145 return !(point_.empty()); 1146 } 1147 getFirstPoint() const1148 const Point* NitsMap::getFirstPoint() const { 1149 if (point_.empty()) { 1150 return nullptr; 1151 } 1152 return &point_[0]; 1153 } 1154 getInterpolation() const1155 const std::string& NitsMap::getInterpolation() const { 1156 _xsdc_assert(hasInterpolation()); 1157 return interpolation_.value(); 1158 } 1159 hasInterpolation() const1160 bool NitsMap::hasInterpolation() const { 1161 return interpolation_.has_value(); 1162 } 1163 read(xmlNode * root)1164 NitsMap NitsMap::read(xmlNode *root) { 1165 std::string _raw; 1166 _raw = getXmlAttribute(root, "interpolation"); 1167 std::optional<std::string> interpolation = std::nullopt; 1168 if (_raw != "") { 1169 std::string &_value = _raw; 1170 interpolation = _value; 1171 } 1172 std::vector<Point> point; 1173 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 1174 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("point"))) { 1175 Point _value = Point::read(_child); 1176 point.push_back(std::move(_value)); 1177 } 1178 } 1179 NitsMap instance(point, interpolation); 1180 return instance; 1181 } 1182 Point(std::optional<double> value,std::optional<double> nits)1183 Point::Point(std::optional<double> value, std::optional<double> nits) : value_(value), nits_(nits) { 1184 } 1185 getValue() const1186 const double& Point::getValue() const { 1187 _xsdc_assert(hasValue()); 1188 return value_.value(); 1189 } 1190 hasValue() const1191 bool Point::hasValue() const { 1192 return value_.has_value(); 1193 } 1194 getNits() const1195 const double& Point::getNits() const { 1196 _xsdc_assert(hasNits()); 1197 return nits_.value(); 1198 } 1199 hasNits() const1200 bool Point::hasNits() const { 1201 return nits_.has_value(); 1202 } 1203 read(xmlNode * root)1204 Point Point::read(xmlNode *root) { 1205 std::string _raw; 1206 std::optional<double> value; 1207 std::optional<double> nits; 1208 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 1209 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("value"))) { 1210 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1211 if (xmlValue == nullptr) { 1212 _raw = ""; 1213 } else { 1214 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1215 } 1216 double _value = std::stod(_raw); 1217 value = std::move(_value); 1218 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("nits"))) { 1219 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1220 if (xmlValue == nullptr) { 1221 _raw = ""; 1222 } else { 1223 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1224 } 1225 double _value = std::stod(_raw); 1226 nits = std::move(_value); 1227 } 1228 } 1229 Point instance(value, nits); 1230 return instance; 1231 } 1232 ComprehensiveBrightnessMap(std::vector<BrightnessPoint> brightnessPoint)1233 ComprehensiveBrightnessMap::ComprehensiveBrightnessMap(std::vector<BrightnessPoint> brightnessPoint) : brightnessPoint_(std::move(brightnessPoint)) { 1234 } 1235 getBrightnessPoint() const1236 const std::vector<BrightnessPoint>& ComprehensiveBrightnessMap::getBrightnessPoint() const { 1237 return brightnessPoint_; 1238 } 1239 hasBrightnessPoint() const1240 bool ComprehensiveBrightnessMap::hasBrightnessPoint() const { 1241 return !(brightnessPoint_.empty()); 1242 } 1243 getFirstBrightnessPoint() const1244 const BrightnessPoint* ComprehensiveBrightnessMap::getFirstBrightnessPoint() const { 1245 if (brightnessPoint_.empty()) { 1246 return nullptr; 1247 } 1248 return &brightnessPoint_[0]; 1249 } 1250 read(xmlNode * root)1251 ComprehensiveBrightnessMap ComprehensiveBrightnessMap::read(xmlNode *root) { 1252 std::string _raw; 1253 std::vector<BrightnessPoint> brightnessPoint; 1254 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 1255 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("brightnessPoint"))) { 1256 BrightnessPoint _value = BrightnessPoint::read(_child); 1257 brightnessPoint.push_back(std::move(_value)); 1258 } 1259 } 1260 ComprehensiveBrightnessMap instance(brightnessPoint); 1261 return instance; 1262 } 1263 BrightnessPoint(std::optional<double> nits,std::optional<double> backlight,std::optional<double> brightness)1264 BrightnessPoint::BrightnessPoint(std::optional<double> nits, std::optional<double> backlight, std::optional<double> brightness) : nits_(nits), backlight_(backlight), brightness_(brightness) { 1265 } 1266 getNits() const1267 const double& BrightnessPoint::getNits() const { 1268 _xsdc_assert(hasNits()); 1269 return nits_.value(); 1270 } 1271 hasNits() const1272 bool BrightnessPoint::hasNits() const { 1273 return nits_.has_value(); 1274 } 1275 getBacklight() const1276 const double& BrightnessPoint::getBacklight() const { 1277 _xsdc_assert(hasBacklight()); 1278 return backlight_.value(); 1279 } 1280 hasBacklight() const1281 bool BrightnessPoint::hasBacklight() const { 1282 return backlight_.has_value(); 1283 } 1284 getBrightness() const1285 const double& BrightnessPoint::getBrightness() const { 1286 _xsdc_assert(hasBrightness()); 1287 return brightness_.value(); 1288 } 1289 hasBrightness() const1290 bool BrightnessPoint::hasBrightness() const { 1291 return brightness_.has_value(); 1292 } 1293 read(xmlNode * root)1294 BrightnessPoint BrightnessPoint::read(xmlNode *root) { 1295 std::string _raw; 1296 std::optional<double> nits; 1297 std::optional<double> backlight; 1298 std::optional<double> brightness; 1299 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 1300 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("nits"))) { 1301 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1302 if (xmlValue == nullptr) { 1303 _raw = ""; 1304 } else { 1305 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1306 } 1307 double _value = std::stod(_raw); 1308 nits = std::move(_value); 1309 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("backlight"))) { 1310 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1311 if (xmlValue == nullptr) { 1312 _raw = ""; 1313 } else { 1314 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1315 } 1316 double _value = std::stod(_raw); 1317 backlight = std::move(_value); 1318 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("brightness"))) { 1319 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1320 if (xmlValue == nullptr) { 1321 _raw = ""; 1322 } else { 1323 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1324 } 1325 double _value = std::stod(_raw); 1326 brightness = std::move(_value); 1327 } 1328 } 1329 BrightnessPoint instance(nits, backlight, brightness); 1330 return instance; 1331 } 1332 SdrHdrRatioMap(std::vector<SdrHdrRatioPoint> point)1333 SdrHdrRatioMap::SdrHdrRatioMap(std::vector<SdrHdrRatioPoint> point) : point_(std::move(point)) { 1334 } 1335 getPoint() const1336 const std::vector<SdrHdrRatioPoint>& SdrHdrRatioMap::getPoint() const { 1337 return point_; 1338 } 1339 hasPoint() const1340 bool SdrHdrRatioMap::hasPoint() const { 1341 return !(point_.empty()); 1342 } 1343 getFirstPoint() const1344 const SdrHdrRatioPoint* SdrHdrRatioMap::getFirstPoint() const { 1345 if (point_.empty()) { 1346 return nullptr; 1347 } 1348 return &point_[0]; 1349 } 1350 read(xmlNode * root)1351 SdrHdrRatioMap SdrHdrRatioMap::read(xmlNode *root) { 1352 std::string _raw; 1353 std::vector<SdrHdrRatioPoint> point; 1354 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 1355 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("point"))) { 1356 SdrHdrRatioPoint _value = SdrHdrRatioPoint::read(_child); 1357 point.push_back(std::move(_value)); 1358 } 1359 } 1360 SdrHdrRatioMap instance(point); 1361 return instance; 1362 } 1363 SdrHdrRatioPoint(std::optional<double> sdrNits,std::optional<double> hdrRatio)1364 SdrHdrRatioPoint::SdrHdrRatioPoint(std::optional<double> sdrNits, std::optional<double> hdrRatio) : sdrNits_(sdrNits), hdrRatio_(hdrRatio) { 1365 } 1366 getSdrNits() const1367 const double& SdrHdrRatioPoint::getSdrNits() const { 1368 _xsdc_assert(hasSdrNits()); 1369 return sdrNits_.value(); 1370 } 1371 hasSdrNits() const1372 bool SdrHdrRatioPoint::hasSdrNits() const { 1373 return sdrNits_.has_value(); 1374 } 1375 getHdrRatio() const1376 const double& SdrHdrRatioPoint::getHdrRatio() const { 1377 _xsdc_assert(hasHdrRatio()); 1378 return hdrRatio_.value(); 1379 } 1380 hasHdrRatio() const1381 bool SdrHdrRatioPoint::hasHdrRatio() const { 1382 return hdrRatio_.has_value(); 1383 } 1384 read(xmlNode * root)1385 SdrHdrRatioPoint SdrHdrRatioPoint::read(xmlNode *root) { 1386 std::string _raw; 1387 std::optional<double> sdrNits; 1388 std::optional<double> hdrRatio; 1389 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 1390 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("sdrNits"))) { 1391 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1392 if (xmlValue == nullptr) { 1393 _raw = ""; 1394 } else { 1395 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1396 } 1397 double _value = std::stod(_raw); 1398 sdrNits = std::move(_value); 1399 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("hdrRatio"))) { 1400 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1401 if (xmlValue == nullptr) { 1402 _raw = ""; 1403 } else { 1404 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1405 } 1406 double _value = std::stod(_raw); 1407 hdrRatio = std::move(_value); 1408 } 1409 } 1410 SdrHdrRatioPoint instance(sdrNits, hdrRatio); 1411 return instance; 1412 } 1413 SensorDetails(std::optional<std::string> type,std::optional<std::string> name,std::vector<RefreshRateRange> refreshRate,std::vector<NonNegativeFloatToFloatMap> supportedModes,std::optional<std::string> featureFlag)1414 SensorDetails::SensorDetails(std::optional<std::string> type, std::optional<std::string> name, std::vector<RefreshRateRange> refreshRate, std::vector<NonNegativeFloatToFloatMap> supportedModes, std::optional<std::string> featureFlag) : type_(std::move(type)), name_(std::move(name)), refreshRate_(std::move(refreshRate)), supportedModes_(std::move(supportedModes)), featureFlag_(std::move(featureFlag)) { 1415 } 1416 getType() const1417 const std::string& SensorDetails::getType() const { 1418 _xsdc_assert(hasType()); 1419 return type_.value(); 1420 } 1421 hasType() const1422 bool SensorDetails::hasType() const { 1423 return type_.has_value(); 1424 } 1425 getName() const1426 const std::string& SensorDetails::getName() const { 1427 _xsdc_assert(hasName()); 1428 return name_.value(); 1429 } 1430 hasName() const1431 bool SensorDetails::hasName() const { 1432 return name_.has_value(); 1433 } 1434 getRefreshRate() const1435 const std::vector<RefreshRateRange>& SensorDetails::getRefreshRate() const { 1436 return refreshRate_; 1437 } 1438 hasRefreshRate() const1439 bool SensorDetails::hasRefreshRate() const { 1440 return !(refreshRate_.empty()); 1441 } 1442 getFirstRefreshRate() const1443 const RefreshRateRange* SensorDetails::getFirstRefreshRate() const { 1444 if (refreshRate_.empty()) { 1445 return nullptr; 1446 } 1447 return &refreshRate_[0]; 1448 } 1449 getSupportedModes() const1450 const std::vector<NonNegativeFloatToFloatMap>& SensorDetails::getSupportedModes() const { 1451 return supportedModes_; 1452 } 1453 hasSupportedModes() const1454 bool SensorDetails::hasSupportedModes() const { 1455 return !(supportedModes_.empty()); 1456 } 1457 getFirstSupportedModes() const1458 const NonNegativeFloatToFloatMap* SensorDetails::getFirstSupportedModes() const { 1459 if (supportedModes_.empty()) { 1460 return nullptr; 1461 } 1462 return &supportedModes_[0]; 1463 } 1464 getFeatureFlag() const1465 const std::string& SensorDetails::getFeatureFlag() const { 1466 _xsdc_assert(hasFeatureFlag()); 1467 return featureFlag_.value(); 1468 } 1469 hasFeatureFlag() const1470 bool SensorDetails::hasFeatureFlag() const { 1471 return featureFlag_.has_value(); 1472 } 1473 read(xmlNode * root)1474 SensorDetails SensorDetails::read(xmlNode *root) { 1475 std::string _raw; 1476 _raw = getXmlAttribute(root, "featureFlag"); 1477 std::optional<std::string> featureFlag = std::nullopt; 1478 if (_raw != "") { 1479 std::string &_value = _raw; 1480 featureFlag = _value; 1481 } 1482 std::optional<std::string> type; 1483 std::optional<std::string> name; 1484 std::vector<RefreshRateRange> refreshRate; 1485 std::vector<NonNegativeFloatToFloatMap> supportedModes; 1486 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 1487 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("type"))) { 1488 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1489 if (xmlValue == nullptr) { 1490 _raw = ""; 1491 } else { 1492 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1493 } 1494 std::string &_value = _raw; 1495 type = std::move(_value); 1496 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("name"))) { 1497 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1498 if (xmlValue == nullptr) { 1499 _raw = ""; 1500 } else { 1501 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1502 } 1503 std::string &_value = _raw; 1504 name = std::move(_value); 1505 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("refreshRate"))) { 1506 RefreshRateRange _value = RefreshRateRange::read(_child); 1507 refreshRate.push_back(std::move(_value)); 1508 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("supportedModes"))) { 1509 NonNegativeFloatToFloatMap _value = NonNegativeFloatToFloatMap::read(_child); 1510 supportedModes.push_back(std::move(_value)); 1511 } 1512 } 1513 SensorDetails instance(type, name, refreshRate, supportedModes, featureFlag); 1514 return instance; 1515 } 1516 RefreshRateRange(std::optional<int64_t> minimum,std::optional<int64_t> maximum)1517 RefreshRateRange::RefreshRateRange(std::optional<int64_t> minimum, std::optional<int64_t> maximum) : minimum_(minimum), maximum_(maximum) { 1518 } 1519 getMinimum() const1520 const int64_t& RefreshRateRange::getMinimum() const { 1521 _xsdc_assert(hasMinimum()); 1522 return minimum_.value(); 1523 } 1524 hasMinimum() const1525 bool RefreshRateRange::hasMinimum() const { 1526 return minimum_.has_value(); 1527 } 1528 getMaximum() const1529 const int64_t& RefreshRateRange::getMaximum() const { 1530 _xsdc_assert(hasMaximum()); 1531 return maximum_.value(); 1532 } 1533 hasMaximum() const1534 bool RefreshRateRange::hasMaximum() const { 1535 return maximum_.has_value(); 1536 } 1537 read(xmlNode * root)1538 RefreshRateRange RefreshRateRange::read(xmlNode *root) { 1539 std::string _raw; 1540 std::optional<int64_t> minimum; 1541 std::optional<int64_t> maximum; 1542 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 1543 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("minimum"))) { 1544 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1545 if (xmlValue == nullptr) { 1546 _raw = ""; 1547 } else { 1548 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1549 } 1550 int64_t _value = std::stoll(_raw); 1551 minimum = std::move(_value); 1552 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("maximum"))) { 1553 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1554 if (xmlValue == nullptr) { 1555 _raw = ""; 1556 } else { 1557 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1558 } 1559 int64_t _value = std::stoll(_raw); 1560 maximum = std::move(_value); 1561 } 1562 } 1563 RefreshRateRange instance(minimum, maximum); 1564 return instance; 1565 } 1566 DensityMapping(std::vector<Density> density)1567 DensityMapping::DensityMapping(std::vector<Density> density) : density_(std::move(density)) { 1568 } 1569 getDensity() const1570 const std::vector<Density>& DensityMapping::getDensity() const { 1571 return density_; 1572 } 1573 hasDensity() const1574 bool DensityMapping::hasDensity() const { 1575 return !(density_.empty()); 1576 } 1577 getFirstDensity() const1578 const Density* DensityMapping::getFirstDensity() const { 1579 if (density_.empty()) { 1580 return nullptr; 1581 } 1582 return &density_[0]; 1583 } 1584 read(xmlNode * root)1585 DensityMapping DensityMapping::read(xmlNode *root) { 1586 std::string _raw; 1587 std::vector<Density> density; 1588 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 1589 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("density"))) { 1590 Density _value = Density::read(_child); 1591 density.push_back(std::move(_value)); 1592 } 1593 } 1594 DensityMapping instance(density); 1595 return instance; 1596 } 1597 Density(std::optional<int64_t> width,std::optional<int64_t> height,std::optional<int64_t> density)1598 Density::Density(std::optional<int64_t> width, std::optional<int64_t> height, std::optional<int64_t> density) : width_(width), height_(height), density_(density) { 1599 } 1600 getWidth() const1601 const int64_t& Density::getWidth() const { 1602 _xsdc_assert(hasWidth()); 1603 return width_.value(); 1604 } 1605 hasWidth() const1606 bool Density::hasWidth() const { 1607 return width_.has_value(); 1608 } 1609 getHeight() const1610 const int64_t& Density::getHeight() const { 1611 _xsdc_assert(hasHeight()); 1612 return height_.value(); 1613 } 1614 hasHeight() const1615 bool Density::hasHeight() const { 1616 return height_.has_value(); 1617 } 1618 getDensity() const1619 const int64_t& Density::getDensity() const { 1620 _xsdc_assert(hasDensity()); 1621 return density_.value(); 1622 } 1623 hasDensity() const1624 bool Density::hasDensity() const { 1625 return density_.has_value(); 1626 } 1627 read(xmlNode * root)1628 Density Density::read(xmlNode *root) { 1629 std::string _raw; 1630 std::optional<int64_t> width; 1631 std::optional<int64_t> height; 1632 std::optional<int64_t> density; 1633 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 1634 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("width"))) { 1635 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1636 if (xmlValue == nullptr) { 1637 _raw = ""; 1638 } else { 1639 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1640 } 1641 int64_t _value = std::stoll(_raw); 1642 width = std::move(_value); 1643 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("height"))) { 1644 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1645 if (xmlValue == nullptr) { 1646 _raw = ""; 1647 } else { 1648 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1649 } 1650 int64_t _value = std::stoll(_raw); 1651 height = std::move(_value); 1652 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("density"))) { 1653 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1654 if (xmlValue == nullptr) { 1655 _raw = ""; 1656 } else { 1657 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1658 } 1659 int64_t _value = std::stoll(_raw); 1660 density = std::move(_value); 1661 } 1662 } 1663 Density instance(width, height, density); 1664 return instance; 1665 } 1666 Thresholds(std::vector<BrightnessThresholds> brighteningThresholds,std::vector<BrightnessThresholds> darkeningThresholds)1667 Thresholds::Thresholds(std::vector<BrightnessThresholds> brighteningThresholds, std::vector<BrightnessThresholds> darkeningThresholds) : brighteningThresholds_(std::move(brighteningThresholds)), darkeningThresholds_(std::move(darkeningThresholds)) { 1668 } 1669 getBrighteningThresholds() const1670 const std::vector<BrightnessThresholds>& Thresholds::getBrighteningThresholds() const { 1671 return brighteningThresholds_; 1672 } 1673 hasBrighteningThresholds() const1674 bool Thresholds::hasBrighteningThresholds() const { 1675 return !(brighteningThresholds_.empty()); 1676 } 1677 getFirstBrighteningThresholds() const1678 const BrightnessThresholds* Thresholds::getFirstBrighteningThresholds() const { 1679 if (brighteningThresholds_.empty()) { 1680 return nullptr; 1681 } 1682 return &brighteningThresholds_[0]; 1683 } 1684 getDarkeningThresholds() const1685 const std::vector<BrightnessThresholds>& Thresholds::getDarkeningThresholds() const { 1686 return darkeningThresholds_; 1687 } 1688 hasDarkeningThresholds() const1689 bool Thresholds::hasDarkeningThresholds() const { 1690 return !(darkeningThresholds_.empty()); 1691 } 1692 getFirstDarkeningThresholds() const1693 const BrightnessThresholds* Thresholds::getFirstDarkeningThresholds() const { 1694 if (darkeningThresholds_.empty()) { 1695 return nullptr; 1696 } 1697 return &darkeningThresholds_[0]; 1698 } 1699 read(xmlNode * root)1700 Thresholds Thresholds::read(xmlNode *root) { 1701 std::string _raw; 1702 std::vector<BrightnessThresholds> brighteningThresholds; 1703 std::vector<BrightnessThresholds> darkeningThresholds; 1704 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 1705 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("brighteningThresholds"))) { 1706 BrightnessThresholds _value = BrightnessThresholds::read(_child); 1707 brighteningThresholds.push_back(std::move(_value)); 1708 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("darkeningThresholds"))) { 1709 BrightnessThresholds _value = BrightnessThresholds::read(_child); 1710 darkeningThresholds.push_back(std::move(_value)); 1711 } 1712 } 1713 Thresholds instance(brighteningThresholds, darkeningThresholds); 1714 return instance; 1715 } 1716 BrightnessThresholds(std::optional<double> minimum,std::vector<ThresholdPoints> brightnessThresholdPoints)1717 BrightnessThresholds::BrightnessThresholds(std::optional<double> minimum, std::vector<ThresholdPoints> brightnessThresholdPoints) : minimum_(minimum), brightnessThresholdPoints_(std::move(brightnessThresholdPoints)) { 1718 } 1719 getMinimum() const1720 const double& BrightnessThresholds::getMinimum() const { 1721 _xsdc_assert(hasMinimum()); 1722 return minimum_.value(); 1723 } 1724 hasMinimum() const1725 bool BrightnessThresholds::hasMinimum() const { 1726 return minimum_.has_value(); 1727 } 1728 getBrightnessThresholdPoints() const1729 const std::vector<ThresholdPoints>& BrightnessThresholds::getBrightnessThresholdPoints() const { 1730 return brightnessThresholdPoints_; 1731 } 1732 hasBrightnessThresholdPoints() const1733 bool BrightnessThresholds::hasBrightnessThresholdPoints() const { 1734 return !(brightnessThresholdPoints_.empty()); 1735 } 1736 getFirstBrightnessThresholdPoints() const1737 const ThresholdPoints* BrightnessThresholds::getFirstBrightnessThresholdPoints() const { 1738 if (brightnessThresholdPoints_.empty()) { 1739 return nullptr; 1740 } 1741 return &brightnessThresholdPoints_[0]; 1742 } 1743 read(xmlNode * root)1744 BrightnessThresholds BrightnessThresholds::read(xmlNode *root) { 1745 std::string _raw; 1746 std::optional<double> minimum; 1747 std::vector<ThresholdPoints> brightnessThresholdPoints; 1748 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 1749 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("minimum"))) { 1750 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1751 if (xmlValue == nullptr) { 1752 _raw = ""; 1753 } else { 1754 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1755 } 1756 double _value = std::stod(_raw); 1757 minimum = std::move(_value); 1758 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("brightnessThresholdPoints"))) { 1759 ThresholdPoints _value = ThresholdPoints::read(_child); 1760 brightnessThresholdPoints.push_back(std::move(_value)); 1761 } 1762 } 1763 BrightnessThresholds instance(minimum, brightnessThresholdPoints); 1764 return instance; 1765 } 1766 ThresholdPoints(std::vector<ThresholdPoint> brightnessThresholdPoint)1767 ThresholdPoints::ThresholdPoints(std::vector<ThresholdPoint> brightnessThresholdPoint) : brightnessThresholdPoint_(std::move(brightnessThresholdPoint)) { 1768 } 1769 getBrightnessThresholdPoint() const1770 const std::vector<ThresholdPoint>& ThresholdPoints::getBrightnessThresholdPoint() const { 1771 return brightnessThresholdPoint_; 1772 } 1773 hasBrightnessThresholdPoint() const1774 bool ThresholdPoints::hasBrightnessThresholdPoint() const { 1775 return !(brightnessThresholdPoint_.empty()); 1776 } 1777 getFirstBrightnessThresholdPoint() const1778 const ThresholdPoint* ThresholdPoints::getFirstBrightnessThresholdPoint() const { 1779 if (brightnessThresholdPoint_.empty()) { 1780 return nullptr; 1781 } 1782 return &brightnessThresholdPoint_[0]; 1783 } 1784 read(xmlNode * root)1785 ThresholdPoints ThresholdPoints::read(xmlNode *root) { 1786 std::string _raw; 1787 std::vector<ThresholdPoint> brightnessThresholdPoint; 1788 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 1789 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("brightnessThresholdPoint"))) { 1790 ThresholdPoint _value = ThresholdPoint::read(_child); 1791 brightnessThresholdPoint.push_back(std::move(_value)); 1792 } 1793 } 1794 ThresholdPoints instance(brightnessThresholdPoint); 1795 return instance; 1796 } 1797 ThresholdPoint(std::optional<double> threshold,std::optional<double> percentage)1798 ThresholdPoint::ThresholdPoint(std::optional<double> threshold, std::optional<double> percentage) : threshold_(threshold), percentage_(percentage) { 1799 } 1800 getThreshold() const1801 const double& ThresholdPoint::getThreshold() const { 1802 _xsdc_assert(hasThreshold()); 1803 return threshold_.value(); 1804 } 1805 hasThreshold() const1806 bool ThresholdPoint::hasThreshold() const { 1807 return threshold_.has_value(); 1808 } 1809 getPercentage() const1810 const double& ThresholdPoint::getPercentage() const { 1811 _xsdc_assert(hasPercentage()); 1812 return percentage_.value(); 1813 } 1814 hasPercentage() const1815 bool ThresholdPoint::hasPercentage() const { 1816 return percentage_.has_value(); 1817 } 1818 read(xmlNode * root)1819 ThresholdPoint ThresholdPoint::read(xmlNode *root) { 1820 std::string _raw; 1821 std::optional<double> threshold; 1822 std::optional<double> percentage; 1823 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 1824 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("threshold"))) { 1825 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1826 if (xmlValue == nullptr) { 1827 _raw = ""; 1828 } else { 1829 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1830 } 1831 double _value = std::stod(_raw); 1832 threshold = std::move(_value); 1833 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("percentage"))) { 1834 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1835 if (xmlValue == nullptr) { 1836 _raw = ""; 1837 } else { 1838 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1839 } 1840 double _value = std::stod(_raw); 1841 percentage = std::move(_value); 1842 } 1843 } 1844 ThresholdPoint instance(threshold, percentage); 1845 return instance; 1846 } 1847 AutoBrightness(std::optional<int64_t> brighteningLightDebounceMillis,std::optional<int64_t> darkeningLightDebounceMillis,std::optional<int64_t> brighteningLightDebounceIdleMillis,std::optional<int64_t> darkeningLightDebounceIdleMillis,std::vector<LuxToBrightnessMapping> luxToBrightnessMapping,std::optional<int64_t> idleStylusTimeoutMillis,std::optional<bool> enabled)1848 AutoBrightness::AutoBrightness(std::optional<int64_t> brighteningLightDebounceMillis, std::optional<int64_t> darkeningLightDebounceMillis, std::optional<int64_t> brighteningLightDebounceIdleMillis, std::optional<int64_t> darkeningLightDebounceIdleMillis, std::vector<LuxToBrightnessMapping> luxToBrightnessMapping, std::optional<int64_t> idleStylusTimeoutMillis, std::optional<bool> enabled) : brighteningLightDebounceMillis_(brighteningLightDebounceMillis), darkeningLightDebounceMillis_(darkeningLightDebounceMillis), brighteningLightDebounceIdleMillis_(brighteningLightDebounceIdleMillis), darkeningLightDebounceIdleMillis_(darkeningLightDebounceIdleMillis), luxToBrightnessMapping_(std::move(luxToBrightnessMapping)), idleStylusTimeoutMillis_(idleStylusTimeoutMillis), enabled_(enabled) { 1849 } 1850 getBrighteningLightDebounceMillis() const1851 const int64_t& AutoBrightness::getBrighteningLightDebounceMillis() const { 1852 _xsdc_assert(hasBrighteningLightDebounceMillis()); 1853 return brighteningLightDebounceMillis_.value(); 1854 } 1855 hasBrighteningLightDebounceMillis() const1856 bool AutoBrightness::hasBrighteningLightDebounceMillis() const { 1857 return brighteningLightDebounceMillis_.has_value(); 1858 } 1859 getDarkeningLightDebounceMillis() const1860 const int64_t& AutoBrightness::getDarkeningLightDebounceMillis() const { 1861 _xsdc_assert(hasDarkeningLightDebounceMillis()); 1862 return darkeningLightDebounceMillis_.value(); 1863 } 1864 hasDarkeningLightDebounceMillis() const1865 bool AutoBrightness::hasDarkeningLightDebounceMillis() const { 1866 return darkeningLightDebounceMillis_.has_value(); 1867 } 1868 getBrighteningLightDebounceIdleMillis() const1869 const int64_t& AutoBrightness::getBrighteningLightDebounceIdleMillis() const { 1870 _xsdc_assert(hasBrighteningLightDebounceIdleMillis()); 1871 return brighteningLightDebounceIdleMillis_.value(); 1872 } 1873 hasBrighteningLightDebounceIdleMillis() const1874 bool AutoBrightness::hasBrighteningLightDebounceIdleMillis() const { 1875 return brighteningLightDebounceIdleMillis_.has_value(); 1876 } 1877 getDarkeningLightDebounceIdleMillis() const1878 const int64_t& AutoBrightness::getDarkeningLightDebounceIdleMillis() const { 1879 _xsdc_assert(hasDarkeningLightDebounceIdleMillis()); 1880 return darkeningLightDebounceIdleMillis_.value(); 1881 } 1882 hasDarkeningLightDebounceIdleMillis() const1883 bool AutoBrightness::hasDarkeningLightDebounceIdleMillis() const { 1884 return darkeningLightDebounceIdleMillis_.has_value(); 1885 } 1886 getLuxToBrightnessMapping() const1887 const std::vector<LuxToBrightnessMapping>& AutoBrightness::getLuxToBrightnessMapping() const { 1888 return luxToBrightnessMapping_; 1889 } 1890 hasLuxToBrightnessMapping() const1891 bool AutoBrightness::hasLuxToBrightnessMapping() const { 1892 return !(luxToBrightnessMapping_.empty()); 1893 } 1894 getFirstLuxToBrightnessMapping() const1895 const LuxToBrightnessMapping* AutoBrightness::getFirstLuxToBrightnessMapping() const { 1896 if (luxToBrightnessMapping_.empty()) { 1897 return nullptr; 1898 } 1899 return &luxToBrightnessMapping_[0]; 1900 } 1901 getIdleStylusTimeoutMillis() const1902 const int64_t& AutoBrightness::getIdleStylusTimeoutMillis() const { 1903 _xsdc_assert(hasIdleStylusTimeoutMillis()); 1904 return idleStylusTimeoutMillis_.value(); 1905 } 1906 hasIdleStylusTimeoutMillis() const1907 bool AutoBrightness::hasIdleStylusTimeoutMillis() const { 1908 return idleStylusTimeoutMillis_.has_value(); 1909 } 1910 getEnabled() const1911 const bool& AutoBrightness::getEnabled() const { 1912 _xsdc_assert(hasEnabled()); 1913 return enabled_.value(); 1914 } 1915 hasEnabled() const1916 bool AutoBrightness::hasEnabled() const { 1917 return enabled_.has_value(); 1918 } 1919 read(xmlNode * root)1920 AutoBrightness AutoBrightness::read(xmlNode *root) { 1921 std::string _raw; 1922 _raw = getXmlAttribute(root, "enabled"); 1923 std::optional<bool> enabled = std::nullopt; 1924 if (_raw != "") { 1925 bool _value = _raw == "true"; 1926 enabled = _value; 1927 } 1928 std::optional<int64_t> brighteningLightDebounceMillis; 1929 std::optional<int64_t> darkeningLightDebounceMillis; 1930 std::optional<int64_t> brighteningLightDebounceIdleMillis; 1931 std::optional<int64_t> darkeningLightDebounceIdleMillis; 1932 std::vector<LuxToBrightnessMapping> luxToBrightnessMapping; 1933 std::optional<int64_t> idleStylusTimeoutMillis; 1934 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 1935 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("brighteningLightDebounceMillis"))) { 1936 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1937 if (xmlValue == nullptr) { 1938 _raw = ""; 1939 } else { 1940 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1941 } 1942 int64_t _value = std::stoll(_raw); 1943 brighteningLightDebounceMillis = std::move(_value); 1944 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("darkeningLightDebounceMillis"))) { 1945 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1946 if (xmlValue == nullptr) { 1947 _raw = ""; 1948 } else { 1949 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1950 } 1951 int64_t _value = std::stoll(_raw); 1952 darkeningLightDebounceMillis = std::move(_value); 1953 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("brighteningLightDebounceIdleMillis"))) { 1954 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1955 if (xmlValue == nullptr) { 1956 _raw = ""; 1957 } else { 1958 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1959 } 1960 int64_t _value = std::stoll(_raw); 1961 brighteningLightDebounceIdleMillis = std::move(_value); 1962 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("darkeningLightDebounceIdleMillis"))) { 1963 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1964 if (xmlValue == nullptr) { 1965 _raw = ""; 1966 } else { 1967 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1968 } 1969 int64_t _value = std::stoll(_raw); 1970 darkeningLightDebounceIdleMillis = std::move(_value); 1971 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("luxToBrightnessMapping"))) { 1972 LuxToBrightnessMapping _value = LuxToBrightnessMapping::read(_child); 1973 luxToBrightnessMapping.push_back(std::move(_value)); 1974 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("idleStylusTimeoutMillis"))) { 1975 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 1976 if (xmlValue == nullptr) { 1977 _raw = ""; 1978 } else { 1979 _raw = reinterpret_cast<const char*>(xmlValue.get()); 1980 } 1981 int64_t _value = std::stoll(_raw); 1982 idleStylusTimeoutMillis = std::move(_value); 1983 } 1984 } 1985 AutoBrightness instance(brighteningLightDebounceMillis, darkeningLightDebounceMillis, brighteningLightDebounceIdleMillis, darkeningLightDebounceIdleMillis, luxToBrightnessMapping, idleStylusTimeoutMillis, enabled); 1986 return instance; 1987 } 1988 LuxToBrightnessMapping(std::vector<NonNegativeFloatToFloatMap> map,std::optional<AutoBrightnessModeName> mode,std::optional<AutoBrightnessSettingName> setting)1989 LuxToBrightnessMapping::LuxToBrightnessMapping(std::vector<NonNegativeFloatToFloatMap> map, std::optional<AutoBrightnessModeName> mode, std::optional<AutoBrightnessSettingName> setting) : map_(std::move(map)), mode_(mode), setting_(setting) { 1990 } 1991 getMap() const1992 const std::vector<NonNegativeFloatToFloatMap>& LuxToBrightnessMapping::getMap() const { 1993 return map_; 1994 } 1995 hasMap() const1996 bool LuxToBrightnessMapping::hasMap() const { 1997 return !(map_.empty()); 1998 } 1999 getFirstMap() const2000 const NonNegativeFloatToFloatMap* LuxToBrightnessMapping::getFirstMap() const { 2001 if (map_.empty()) { 2002 return nullptr; 2003 } 2004 return &map_[0]; 2005 } 2006 getMode() const2007 const AutoBrightnessModeName& LuxToBrightnessMapping::getMode() const { 2008 _xsdc_assert(hasMode()); 2009 return mode_.value(); 2010 } 2011 hasMode() const2012 bool LuxToBrightnessMapping::hasMode() const { 2013 return mode_.has_value(); 2014 } 2015 getSetting() const2016 const AutoBrightnessSettingName& LuxToBrightnessMapping::getSetting() const { 2017 _xsdc_assert(hasSetting()); 2018 return setting_.value(); 2019 } 2020 hasSetting() const2021 bool LuxToBrightnessMapping::hasSetting() const { 2022 return setting_.has_value(); 2023 } 2024 read(xmlNode * root)2025 LuxToBrightnessMapping LuxToBrightnessMapping::read(xmlNode *root) { 2026 std::string _raw; 2027 std::vector<NonNegativeFloatToFloatMap> map; 2028 std::optional<AutoBrightnessModeName> mode; 2029 std::optional<AutoBrightnessSettingName> setting; 2030 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 2031 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("map"))) { 2032 NonNegativeFloatToFloatMap _value = NonNegativeFloatToFloatMap::read(_child); 2033 map.push_back(std::move(_value)); 2034 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("mode"))) { 2035 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 2036 if (xmlValue == nullptr) { 2037 _raw = ""; 2038 } else { 2039 _raw = reinterpret_cast<const char*>(xmlValue.get()); 2040 } 2041 AutoBrightnessModeName _value = stringToAutoBrightnessModeName(_raw); 2042 mode = std::move(_value); 2043 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("setting"))) { 2044 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 2045 if (xmlValue == nullptr) { 2046 _raw = ""; 2047 } else { 2048 _raw = reinterpret_cast<const char*>(xmlValue.get()); 2049 } 2050 AutoBrightnessSettingName _value = stringToAutoBrightnessSettingName(_raw); 2051 setting = std::move(_value); 2052 } 2053 } 2054 LuxToBrightnessMapping instance(map, mode, setting); 2055 return instance; 2056 } 2057 DisplayBrightnessPoint(std::optional<int64_t> lux,std::optional<double> nits)2058 DisplayBrightnessPoint::DisplayBrightnessPoint(std::optional<int64_t> lux, std::optional<double> nits) : lux_(lux), nits_(nits) { 2059 } 2060 getLux() const2061 const int64_t& DisplayBrightnessPoint::getLux() const { 2062 _xsdc_assert(hasLux()); 2063 return lux_.value(); 2064 } 2065 hasLux() const2066 bool DisplayBrightnessPoint::hasLux() const { 2067 return lux_.has_value(); 2068 } 2069 getNits() const2070 const double& DisplayBrightnessPoint::getNits() const { 2071 _xsdc_assert(hasNits()); 2072 return nits_.value(); 2073 } 2074 hasNits() const2075 bool DisplayBrightnessPoint::hasNits() const { 2076 return nits_.has_value(); 2077 } 2078 read(xmlNode * root)2079 DisplayBrightnessPoint DisplayBrightnessPoint::read(xmlNode *root) { 2080 std::string _raw; 2081 std::optional<int64_t> lux; 2082 std::optional<double> nits; 2083 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 2084 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("lux"))) { 2085 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 2086 if (xmlValue == nullptr) { 2087 _raw = ""; 2088 } else { 2089 _raw = reinterpret_cast<const char*>(xmlValue.get()); 2090 } 2091 int64_t _value = std::stoll(_raw); 2092 lux = std::move(_value); 2093 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("nits"))) { 2094 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 2095 if (xmlValue == nullptr) { 2096 _raw = ""; 2097 } else { 2098 _raw = reinterpret_cast<const char*>(xmlValue.get()); 2099 } 2100 double _value = std::stod(_raw); 2101 nits = std::move(_value); 2102 } 2103 } 2104 DisplayBrightnessPoint instance(lux, nits); 2105 return instance; 2106 } 2107 RefreshRateConfigs(std::optional<int64_t> defaultRefreshRate,std::optional<int64_t> defaultPeakRefreshRate,std::vector<RefreshRateZoneProfiles> refreshRateZoneProfiles,std::optional<int64_t> defaultRefreshRateInHbmHdr,std::optional<int64_t> defaultRefreshRateInHbmSunlight,std::vector<BlockingZoneConfig> lowerBlockingZoneConfigs,std::vector<BlockingZoneConfig> higherBlockingZoneConfigs,std::vector<NonNegativeFloatToFloatMap> lowPowerSupportedModes)2108 RefreshRateConfigs::RefreshRateConfigs(std::optional<int64_t> defaultRefreshRate, std::optional<int64_t> defaultPeakRefreshRate, std::vector<RefreshRateZoneProfiles> refreshRateZoneProfiles, std::optional<int64_t> defaultRefreshRateInHbmHdr, std::optional<int64_t> defaultRefreshRateInHbmSunlight, std::vector<BlockingZoneConfig> lowerBlockingZoneConfigs, std::vector<BlockingZoneConfig> higherBlockingZoneConfigs, std::vector<NonNegativeFloatToFloatMap> lowPowerSupportedModes) : defaultRefreshRate_(defaultRefreshRate), defaultPeakRefreshRate_(defaultPeakRefreshRate), refreshRateZoneProfiles_(std::move(refreshRateZoneProfiles)), defaultRefreshRateInHbmHdr_(defaultRefreshRateInHbmHdr), defaultRefreshRateInHbmSunlight_(defaultRefreshRateInHbmSunlight), lowerBlockingZoneConfigs_(std::move(lowerBlockingZoneConfigs)), higherBlockingZoneConfigs_(std::move(higherBlockingZoneConfigs)), lowPowerSupportedModes_(std::move(lowPowerSupportedModes)) { 2109 } 2110 getDefaultRefreshRate() const2111 const int64_t& RefreshRateConfigs::getDefaultRefreshRate() const { 2112 _xsdc_assert(hasDefaultRefreshRate()); 2113 return defaultRefreshRate_.value(); 2114 } 2115 hasDefaultRefreshRate() const2116 bool RefreshRateConfigs::hasDefaultRefreshRate() const { 2117 return defaultRefreshRate_.has_value(); 2118 } 2119 getDefaultPeakRefreshRate() const2120 const int64_t& RefreshRateConfigs::getDefaultPeakRefreshRate() const { 2121 _xsdc_assert(hasDefaultPeakRefreshRate()); 2122 return defaultPeakRefreshRate_.value(); 2123 } 2124 hasDefaultPeakRefreshRate() const2125 bool RefreshRateConfigs::hasDefaultPeakRefreshRate() const { 2126 return defaultPeakRefreshRate_.has_value(); 2127 } 2128 getRefreshRateZoneProfiles() const2129 const std::vector<RefreshRateZoneProfiles>& RefreshRateConfigs::getRefreshRateZoneProfiles() const { 2130 return refreshRateZoneProfiles_; 2131 } 2132 hasRefreshRateZoneProfiles() const2133 bool RefreshRateConfigs::hasRefreshRateZoneProfiles() const { 2134 return !(refreshRateZoneProfiles_.empty()); 2135 } 2136 getFirstRefreshRateZoneProfiles() const2137 const RefreshRateZoneProfiles* RefreshRateConfigs::getFirstRefreshRateZoneProfiles() const { 2138 if (refreshRateZoneProfiles_.empty()) { 2139 return nullptr; 2140 } 2141 return &refreshRateZoneProfiles_[0]; 2142 } 2143 getDefaultRefreshRateInHbmHdr() const2144 const int64_t& RefreshRateConfigs::getDefaultRefreshRateInHbmHdr() const { 2145 _xsdc_assert(hasDefaultRefreshRateInHbmHdr()); 2146 return defaultRefreshRateInHbmHdr_.value(); 2147 } 2148 hasDefaultRefreshRateInHbmHdr() const2149 bool RefreshRateConfigs::hasDefaultRefreshRateInHbmHdr() const { 2150 return defaultRefreshRateInHbmHdr_.has_value(); 2151 } 2152 getDefaultRefreshRateInHbmSunlight() const2153 const int64_t& RefreshRateConfigs::getDefaultRefreshRateInHbmSunlight() const { 2154 _xsdc_assert(hasDefaultRefreshRateInHbmSunlight()); 2155 return defaultRefreshRateInHbmSunlight_.value(); 2156 } 2157 hasDefaultRefreshRateInHbmSunlight() const2158 bool RefreshRateConfigs::hasDefaultRefreshRateInHbmSunlight() const { 2159 return defaultRefreshRateInHbmSunlight_.has_value(); 2160 } 2161 getLowerBlockingZoneConfigs() const2162 const std::vector<BlockingZoneConfig>& RefreshRateConfigs::getLowerBlockingZoneConfigs() const { 2163 return lowerBlockingZoneConfigs_; 2164 } 2165 hasLowerBlockingZoneConfigs() const2166 bool RefreshRateConfigs::hasLowerBlockingZoneConfigs() const { 2167 return !(lowerBlockingZoneConfigs_.empty()); 2168 } 2169 getFirstLowerBlockingZoneConfigs() const2170 const BlockingZoneConfig* RefreshRateConfigs::getFirstLowerBlockingZoneConfigs() const { 2171 if (lowerBlockingZoneConfigs_.empty()) { 2172 return nullptr; 2173 } 2174 return &lowerBlockingZoneConfigs_[0]; 2175 } 2176 getHigherBlockingZoneConfigs() const2177 const std::vector<BlockingZoneConfig>& RefreshRateConfigs::getHigherBlockingZoneConfigs() const { 2178 return higherBlockingZoneConfigs_; 2179 } 2180 hasHigherBlockingZoneConfigs() const2181 bool RefreshRateConfigs::hasHigherBlockingZoneConfigs() const { 2182 return !(higherBlockingZoneConfigs_.empty()); 2183 } 2184 getFirstHigherBlockingZoneConfigs() const2185 const BlockingZoneConfig* RefreshRateConfigs::getFirstHigherBlockingZoneConfigs() const { 2186 if (higherBlockingZoneConfigs_.empty()) { 2187 return nullptr; 2188 } 2189 return &higherBlockingZoneConfigs_[0]; 2190 } 2191 getLowPowerSupportedModes() const2192 const std::vector<NonNegativeFloatToFloatMap>& RefreshRateConfigs::getLowPowerSupportedModes() const { 2193 return lowPowerSupportedModes_; 2194 } 2195 hasLowPowerSupportedModes() const2196 bool RefreshRateConfigs::hasLowPowerSupportedModes() const { 2197 return !(lowPowerSupportedModes_.empty()); 2198 } 2199 getFirstLowPowerSupportedModes() const2200 const NonNegativeFloatToFloatMap* RefreshRateConfigs::getFirstLowPowerSupportedModes() const { 2201 if (lowPowerSupportedModes_.empty()) { 2202 return nullptr; 2203 } 2204 return &lowPowerSupportedModes_[0]; 2205 } 2206 read(xmlNode * root)2207 RefreshRateConfigs RefreshRateConfigs::read(xmlNode *root) { 2208 std::string _raw; 2209 std::optional<int64_t> defaultRefreshRate; 2210 std::optional<int64_t> defaultPeakRefreshRate; 2211 std::vector<RefreshRateZoneProfiles> refreshRateZoneProfiles; 2212 std::optional<int64_t> defaultRefreshRateInHbmHdr; 2213 std::optional<int64_t> defaultRefreshRateInHbmSunlight; 2214 std::vector<BlockingZoneConfig> lowerBlockingZoneConfigs; 2215 std::vector<BlockingZoneConfig> higherBlockingZoneConfigs; 2216 std::vector<NonNegativeFloatToFloatMap> lowPowerSupportedModes; 2217 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 2218 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("defaultRefreshRate"))) { 2219 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 2220 if (xmlValue == nullptr) { 2221 _raw = ""; 2222 } else { 2223 _raw = reinterpret_cast<const char*>(xmlValue.get()); 2224 } 2225 int64_t _value = std::stoll(_raw); 2226 defaultRefreshRate = std::move(_value); 2227 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("defaultPeakRefreshRate"))) { 2228 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 2229 if (xmlValue == nullptr) { 2230 _raw = ""; 2231 } else { 2232 _raw = reinterpret_cast<const char*>(xmlValue.get()); 2233 } 2234 int64_t _value = std::stoll(_raw); 2235 defaultPeakRefreshRate = std::move(_value); 2236 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("refreshRateZoneProfiles"))) { 2237 RefreshRateZoneProfiles _value = RefreshRateZoneProfiles::read(_child); 2238 refreshRateZoneProfiles.push_back(std::move(_value)); 2239 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("defaultRefreshRateInHbmHdr"))) { 2240 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 2241 if (xmlValue == nullptr) { 2242 _raw = ""; 2243 } else { 2244 _raw = reinterpret_cast<const char*>(xmlValue.get()); 2245 } 2246 int64_t _value = std::stoll(_raw); 2247 defaultRefreshRateInHbmHdr = std::move(_value); 2248 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("defaultRefreshRateInHbmSunlight"))) { 2249 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 2250 if (xmlValue == nullptr) { 2251 _raw = ""; 2252 } else { 2253 _raw = reinterpret_cast<const char*>(xmlValue.get()); 2254 } 2255 int64_t _value = std::stoll(_raw); 2256 defaultRefreshRateInHbmSunlight = std::move(_value); 2257 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("lowerBlockingZoneConfigs"))) { 2258 BlockingZoneConfig _value = BlockingZoneConfig::read(_child); 2259 lowerBlockingZoneConfigs.push_back(std::move(_value)); 2260 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("higherBlockingZoneConfigs"))) { 2261 BlockingZoneConfig _value = BlockingZoneConfig::read(_child); 2262 higherBlockingZoneConfigs.push_back(std::move(_value)); 2263 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("lowPowerSupportedModes"))) { 2264 NonNegativeFloatToFloatMap _value = NonNegativeFloatToFloatMap::read(_child); 2265 lowPowerSupportedModes.push_back(std::move(_value)); 2266 } 2267 } 2268 RefreshRateConfigs instance(defaultRefreshRate, defaultPeakRefreshRate, refreshRateZoneProfiles, defaultRefreshRateInHbmHdr, defaultRefreshRateInHbmSunlight, lowerBlockingZoneConfigs, higherBlockingZoneConfigs, lowPowerSupportedModes); 2269 return instance; 2270 } 2271 RefreshRateZoneProfiles(std::vector<RefreshRateZone> refreshRateZoneProfile)2272 RefreshRateZoneProfiles::RefreshRateZoneProfiles(std::vector<RefreshRateZone> refreshRateZoneProfile) : refreshRateZoneProfile_(std::move(refreshRateZoneProfile)) { 2273 } 2274 getRefreshRateZoneProfile() const2275 const std::vector<RefreshRateZone>& RefreshRateZoneProfiles::getRefreshRateZoneProfile() const { 2276 return refreshRateZoneProfile_; 2277 } 2278 hasRefreshRateZoneProfile() const2279 bool RefreshRateZoneProfiles::hasRefreshRateZoneProfile() const { 2280 return !(refreshRateZoneProfile_.empty()); 2281 } 2282 getFirstRefreshRateZoneProfile() const2283 const RefreshRateZone* RefreshRateZoneProfiles::getFirstRefreshRateZoneProfile() const { 2284 if (refreshRateZoneProfile_.empty()) { 2285 return nullptr; 2286 } 2287 return &refreshRateZoneProfile_[0]; 2288 } 2289 read(xmlNode * root)2290 RefreshRateZoneProfiles RefreshRateZoneProfiles::read(xmlNode *root) { 2291 std::string _raw; 2292 std::vector<RefreshRateZone> refreshRateZoneProfile; 2293 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 2294 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("refreshRateZoneProfile"))) { 2295 RefreshRateZone _value = RefreshRateZone::read(_child); 2296 refreshRateZoneProfile.push_back(std::move(_value)); 2297 } 2298 } 2299 RefreshRateZoneProfiles instance(refreshRateZoneProfile); 2300 return instance; 2301 } 2302 RefreshRateZone(std::vector<RefreshRateRange> refreshRateRange,std::string id)2303 RefreshRateZone::RefreshRateZone(std::vector<RefreshRateRange> refreshRateRange, std::string id) : refreshRateRange_(std::move(refreshRateRange)), id_(std::move(id)) { 2304 } 2305 getRefreshRateRange() const2306 const std::vector<RefreshRateRange>& RefreshRateZone::getRefreshRateRange() const { 2307 return refreshRateRange_; 2308 } 2309 hasRefreshRateRange() const2310 bool RefreshRateZone::hasRefreshRateRange() const { 2311 return !(refreshRateRange_.empty()); 2312 } 2313 getFirstRefreshRateRange() const2314 const RefreshRateRange* RefreshRateZone::getFirstRefreshRateRange() const { 2315 if (refreshRateRange_.empty()) { 2316 return nullptr; 2317 } 2318 return &refreshRateRange_[0]; 2319 } 2320 getId() const2321 const std::string& RefreshRateZone::getId() const { 2322 return id_; 2323 } 2324 hasId() const2325 bool RefreshRateZone::hasId() const { 2326 return true; 2327 } 2328 read(xmlNode * root)2329 RefreshRateZone RefreshRateZone::read(xmlNode *root) { 2330 std::string _raw; 2331 _raw = getXmlAttribute(root, "id"); 2332 std::string id{}; 2333 if (_raw != "") { 2334 std::string &_value = _raw; 2335 id = _value; 2336 } 2337 std::vector<RefreshRateRange> refreshRateRange; 2338 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 2339 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("refreshRateRange"))) { 2340 RefreshRateRange _value = RefreshRateRange::read(_child); 2341 refreshRateRange.push_back(std::move(_value)); 2342 } 2343 } 2344 RefreshRateZone instance(refreshRateRange, id); 2345 return instance; 2346 } 2347 BlockingZoneConfig(std::vector<NonNegativeFloatToFloatMap> supportedModes,std::optional<int64_t> defaultRefreshRate,std::optional<std::string> refreshRateThermalThrottlingId,std::vector<BlockingZoneThreshold> blockingZoneThreshold)2348 BlockingZoneConfig::BlockingZoneConfig(std::vector<NonNegativeFloatToFloatMap> supportedModes, std::optional<int64_t> defaultRefreshRate, std::optional<std::string> refreshRateThermalThrottlingId, std::vector<BlockingZoneThreshold> blockingZoneThreshold) : supportedModes_(std::move(supportedModes)), defaultRefreshRate_(defaultRefreshRate), refreshRateThermalThrottlingId_(std::move(refreshRateThermalThrottlingId)), blockingZoneThreshold_(std::move(blockingZoneThreshold)) { 2349 } 2350 getSupportedModes() const2351 const std::vector<NonNegativeFloatToFloatMap>& BlockingZoneConfig::getSupportedModes() const { 2352 return supportedModes_; 2353 } 2354 hasSupportedModes() const2355 bool BlockingZoneConfig::hasSupportedModes() const { 2356 return !(supportedModes_.empty()); 2357 } 2358 getFirstSupportedModes() const2359 const NonNegativeFloatToFloatMap* BlockingZoneConfig::getFirstSupportedModes() const { 2360 if (supportedModes_.empty()) { 2361 return nullptr; 2362 } 2363 return &supportedModes_[0]; 2364 } 2365 getDefaultRefreshRate() const2366 const int64_t& BlockingZoneConfig::getDefaultRefreshRate() const { 2367 _xsdc_assert(hasDefaultRefreshRate()); 2368 return defaultRefreshRate_.value(); 2369 } 2370 hasDefaultRefreshRate() const2371 bool BlockingZoneConfig::hasDefaultRefreshRate() const { 2372 return defaultRefreshRate_.has_value(); 2373 } 2374 getRefreshRateThermalThrottlingId() const2375 const std::string& BlockingZoneConfig::getRefreshRateThermalThrottlingId() const { 2376 _xsdc_assert(hasRefreshRateThermalThrottlingId()); 2377 return refreshRateThermalThrottlingId_.value(); 2378 } 2379 hasRefreshRateThermalThrottlingId() const2380 bool BlockingZoneConfig::hasRefreshRateThermalThrottlingId() const { 2381 return refreshRateThermalThrottlingId_.has_value(); 2382 } 2383 getBlockingZoneThreshold() const2384 const std::vector<BlockingZoneThreshold>& BlockingZoneConfig::getBlockingZoneThreshold() const { 2385 return blockingZoneThreshold_; 2386 } 2387 hasBlockingZoneThreshold() const2388 bool BlockingZoneConfig::hasBlockingZoneThreshold() const { 2389 return !(blockingZoneThreshold_.empty()); 2390 } 2391 getFirstBlockingZoneThreshold() const2392 const BlockingZoneThreshold* BlockingZoneConfig::getFirstBlockingZoneThreshold() const { 2393 if (blockingZoneThreshold_.empty()) { 2394 return nullptr; 2395 } 2396 return &blockingZoneThreshold_[0]; 2397 } 2398 read(xmlNode * root)2399 BlockingZoneConfig BlockingZoneConfig::read(xmlNode *root) { 2400 std::string _raw; 2401 std::vector<NonNegativeFloatToFloatMap> supportedModes; 2402 std::optional<int64_t> defaultRefreshRate; 2403 std::optional<std::string> refreshRateThermalThrottlingId; 2404 std::vector<BlockingZoneThreshold> blockingZoneThreshold; 2405 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 2406 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("supportedModes"))) { 2407 NonNegativeFloatToFloatMap _value = NonNegativeFloatToFloatMap::read(_child); 2408 supportedModes.push_back(std::move(_value)); 2409 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("defaultRefreshRate"))) { 2410 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 2411 if (xmlValue == nullptr) { 2412 _raw = ""; 2413 } else { 2414 _raw = reinterpret_cast<const char*>(xmlValue.get()); 2415 } 2416 int64_t _value = std::stoll(_raw); 2417 defaultRefreshRate = std::move(_value); 2418 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("refreshRateThermalThrottlingId"))) { 2419 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 2420 if (xmlValue == nullptr) { 2421 _raw = ""; 2422 } else { 2423 _raw = reinterpret_cast<const char*>(xmlValue.get()); 2424 } 2425 std::string &_value = _raw; 2426 refreshRateThermalThrottlingId = std::move(_value); 2427 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("blockingZoneThreshold"))) { 2428 BlockingZoneThreshold _value = BlockingZoneThreshold::read(_child); 2429 blockingZoneThreshold.push_back(std::move(_value)); 2430 } 2431 } 2432 BlockingZoneConfig instance(supportedModes, defaultRefreshRate, refreshRateThermalThrottlingId, blockingZoneThreshold); 2433 return instance; 2434 } 2435 BlockingZoneThreshold(std::vector<DisplayBrightnessPoint> displayBrightnessPoint)2436 BlockingZoneThreshold::BlockingZoneThreshold(std::vector<DisplayBrightnessPoint> displayBrightnessPoint) : displayBrightnessPoint_(std::move(displayBrightnessPoint)) { 2437 } 2438 getDisplayBrightnessPoint() const2439 const std::vector<DisplayBrightnessPoint>& BlockingZoneThreshold::getDisplayBrightnessPoint() const { 2440 return displayBrightnessPoint_; 2441 } 2442 hasDisplayBrightnessPoint() const2443 bool BlockingZoneThreshold::hasDisplayBrightnessPoint() const { 2444 return !(displayBrightnessPoint_.empty()); 2445 } 2446 getFirstDisplayBrightnessPoint() const2447 const DisplayBrightnessPoint* BlockingZoneThreshold::getFirstDisplayBrightnessPoint() const { 2448 if (displayBrightnessPoint_.empty()) { 2449 return nullptr; 2450 } 2451 return &displayBrightnessPoint_[0]; 2452 } 2453 read(xmlNode * root)2454 BlockingZoneThreshold BlockingZoneThreshold::read(xmlNode *root) { 2455 std::string _raw; 2456 std::vector<DisplayBrightnessPoint> displayBrightnessPoint; 2457 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 2458 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("displayBrightnessPoint"))) { 2459 DisplayBrightnessPoint _value = DisplayBrightnessPoint::read(_child); 2460 displayBrightnessPoint.push_back(std::move(_value)); 2461 } 2462 } 2463 BlockingZoneThreshold instance(displayBrightnessPoint); 2464 return instance; 2465 } 2466 IntegerArray(std::vector<int64_t> item)2467 IntegerArray::IntegerArray(std::vector<int64_t> item) : item_(item) { 2468 } 2469 getItem() const2470 const std::vector<int64_t>& IntegerArray::getItem() const { 2471 return item_; 2472 } 2473 hasItem() const2474 bool IntegerArray::hasItem() const { 2475 return !(item_.empty()); 2476 } 2477 getFirstItem() const2478 const int64_t* IntegerArray::getFirstItem() const { 2479 if (item_.empty()) { 2480 return nullptr; 2481 } 2482 return &item_[0]; 2483 } 2484 read(xmlNode * root)2485 IntegerArray IntegerArray::read(xmlNode *root) { 2486 std::string _raw; 2487 std::vector<int64_t> item; 2488 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 2489 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("item"))) { 2490 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 2491 if (xmlValue == nullptr) { 2492 _raw = ""; 2493 } else { 2494 _raw = reinterpret_cast<const char*>(xmlValue.get()); 2495 } 2496 int64_t _value = std::stoll(_raw); 2497 item.push_back(std::move(_value)); 2498 } 2499 } 2500 IntegerArray instance(item); 2501 return instance; 2502 } 2503 FloatArray(std::vector<double> item)2504 FloatArray::FloatArray(std::vector<double> item) : item_(item) { 2505 } 2506 getItem() const2507 const std::vector<double>& FloatArray::getItem() const { 2508 return item_; 2509 } 2510 hasItem() const2511 bool FloatArray::hasItem() const { 2512 return !(item_.empty()); 2513 } 2514 getFirstItem() const2515 const double* FloatArray::getFirstItem() const { 2516 if (item_.empty()) { 2517 return nullptr; 2518 } 2519 return &item_[0]; 2520 } 2521 read(xmlNode * root)2522 FloatArray FloatArray::read(xmlNode *root) { 2523 std::string _raw; 2524 std::vector<double> item; 2525 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 2526 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("item"))) { 2527 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 2528 if (xmlValue == nullptr) { 2529 _raw = ""; 2530 } else { 2531 _raw = reinterpret_cast<const char*>(xmlValue.get()); 2532 } 2533 double _value = std::stod(_raw); 2534 item.push_back(std::move(_value)); 2535 } 2536 } 2537 FloatArray instance(item); 2538 return instance; 2539 } 2540 UsiVersion(std::optional<int64_t> majorVersion,std::optional<int64_t> minorVersion)2541 UsiVersion::UsiVersion(std::optional<int64_t> majorVersion, std::optional<int64_t> minorVersion) : majorVersion_(majorVersion), minorVersion_(minorVersion) { 2542 } 2543 getMajorVersion() const2544 const int64_t& UsiVersion::getMajorVersion() const { 2545 _xsdc_assert(hasMajorVersion()); 2546 return majorVersion_.value(); 2547 } 2548 hasMajorVersion() const2549 bool UsiVersion::hasMajorVersion() const { 2550 return majorVersion_.has_value(); 2551 } 2552 getMinorVersion() const2553 const int64_t& UsiVersion::getMinorVersion() const { 2554 _xsdc_assert(hasMinorVersion()); 2555 return minorVersion_.value(); 2556 } 2557 hasMinorVersion() const2558 bool UsiVersion::hasMinorVersion() const { 2559 return minorVersion_.has_value(); 2560 } 2561 read(xmlNode * root)2562 UsiVersion UsiVersion::read(xmlNode *root) { 2563 std::string _raw; 2564 std::optional<int64_t> majorVersion; 2565 std::optional<int64_t> minorVersion; 2566 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 2567 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("majorVersion"))) { 2568 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 2569 if (xmlValue == nullptr) { 2570 _raw = ""; 2571 } else { 2572 _raw = reinterpret_cast<const char*>(xmlValue.get()); 2573 } 2574 int64_t _value = std::stoll(_raw); 2575 majorVersion = std::move(_value); 2576 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("minorVersion"))) { 2577 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 2578 if (xmlValue == nullptr) { 2579 _raw = ""; 2580 } else { 2581 _raw = reinterpret_cast<const char*>(xmlValue.get()); 2582 } 2583 int64_t _value = std::stoll(_raw); 2584 minorVersion = std::move(_value); 2585 } 2586 } 2587 UsiVersion instance(majorVersion, minorVersion); 2588 return instance; 2589 } 2590 NonNegativeFloatToFloatPoint(std::optional<double> first,std::optional<double> second)2591 NonNegativeFloatToFloatPoint::NonNegativeFloatToFloatPoint(std::optional<double> first, std::optional<double> second) : first_(first), second_(second) { 2592 } 2593 getFirst() const2594 const double& NonNegativeFloatToFloatPoint::getFirst() const { 2595 _xsdc_assert(hasFirst()); 2596 return first_.value(); 2597 } 2598 hasFirst() const2599 bool NonNegativeFloatToFloatPoint::hasFirst() const { 2600 return first_.has_value(); 2601 } 2602 getSecond() const2603 const double& NonNegativeFloatToFloatPoint::getSecond() const { 2604 _xsdc_assert(hasSecond()); 2605 return second_.value(); 2606 } 2607 hasSecond() const2608 bool NonNegativeFloatToFloatPoint::hasSecond() const { 2609 return second_.has_value(); 2610 } 2611 read(xmlNode * root)2612 NonNegativeFloatToFloatPoint NonNegativeFloatToFloatPoint::read(xmlNode *root) { 2613 std::string _raw; 2614 std::optional<double> first; 2615 std::optional<double> second; 2616 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 2617 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("first"))) { 2618 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 2619 if (xmlValue == nullptr) { 2620 _raw = ""; 2621 } else { 2622 _raw = reinterpret_cast<const char*>(xmlValue.get()); 2623 } 2624 double _value = std::stod(_raw); 2625 first = std::move(_value); 2626 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("second"))) { 2627 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 2628 if (xmlValue == nullptr) { 2629 _raw = ""; 2630 } else { 2631 _raw = reinterpret_cast<const char*>(xmlValue.get()); 2632 } 2633 double _value = std::stod(_raw); 2634 second = std::move(_value); 2635 } 2636 } 2637 NonNegativeFloatToFloatPoint instance(first, second); 2638 return instance; 2639 } 2640 NonNegativeFloatToFloatMap(std::vector<NonNegativeFloatToFloatPoint> point)2641 NonNegativeFloatToFloatMap::NonNegativeFloatToFloatMap(std::vector<NonNegativeFloatToFloatPoint> point) : point_(std::move(point)) { 2642 } 2643 getPoint() const2644 const std::vector<NonNegativeFloatToFloatPoint>& NonNegativeFloatToFloatMap::getPoint() const { 2645 return point_; 2646 } 2647 hasPoint() const2648 bool NonNegativeFloatToFloatMap::hasPoint() const { 2649 return !(point_.empty()); 2650 } 2651 getFirstPoint() const2652 const NonNegativeFloatToFloatPoint* NonNegativeFloatToFloatMap::getFirstPoint() const { 2653 if (point_.empty()) { 2654 return nullptr; 2655 } 2656 return &point_[0]; 2657 } 2658 read(xmlNode * root)2659 NonNegativeFloatToFloatMap NonNegativeFloatToFloatMap::read(xmlNode *root) { 2660 std::string _raw; 2661 std::vector<NonNegativeFloatToFloatPoint> point; 2662 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 2663 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("point"))) { 2664 NonNegativeFloatToFloatPoint _value = NonNegativeFloatToFloatPoint::read(_child); 2665 point.push_back(std::move(_value)); 2666 } 2667 } 2668 NonNegativeFloatToFloatMap instance(point); 2669 return instance; 2670 } 2671 IdleScreenRefreshRateTimeout(std::vector<IdleScreenRefreshRateTimeoutLuxThresholds> luxThresholds)2672 IdleScreenRefreshRateTimeout::IdleScreenRefreshRateTimeout(std::vector<IdleScreenRefreshRateTimeoutLuxThresholds> luxThresholds) : luxThresholds_(std::move(luxThresholds)) { 2673 } 2674 getLuxThresholds() const2675 const std::vector<IdleScreenRefreshRateTimeoutLuxThresholds>& IdleScreenRefreshRateTimeout::getLuxThresholds() const { 2676 return luxThresholds_; 2677 } 2678 hasLuxThresholds() const2679 bool IdleScreenRefreshRateTimeout::hasLuxThresholds() const { 2680 return !(luxThresholds_.empty()); 2681 } 2682 getFirstLuxThresholds() const2683 const IdleScreenRefreshRateTimeoutLuxThresholds* IdleScreenRefreshRateTimeout::getFirstLuxThresholds() const { 2684 if (luxThresholds_.empty()) { 2685 return nullptr; 2686 } 2687 return &luxThresholds_[0]; 2688 } 2689 read(xmlNode * root)2690 IdleScreenRefreshRateTimeout IdleScreenRefreshRateTimeout::read(xmlNode *root) { 2691 std::string _raw; 2692 std::vector<IdleScreenRefreshRateTimeoutLuxThresholds> luxThresholds; 2693 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 2694 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("luxThresholds"))) { 2695 IdleScreenRefreshRateTimeoutLuxThresholds _value = IdleScreenRefreshRateTimeoutLuxThresholds::read(_child); 2696 luxThresholds.push_back(std::move(_value)); 2697 } 2698 } 2699 IdleScreenRefreshRateTimeout instance(luxThresholds); 2700 return instance; 2701 } 2702 IdleScreenRefreshRateTimeoutLuxThresholds(std::vector<IdleScreenRefreshRateTimeoutLuxThresholdPoint> point)2703 IdleScreenRefreshRateTimeoutLuxThresholds::IdleScreenRefreshRateTimeoutLuxThresholds(std::vector<IdleScreenRefreshRateTimeoutLuxThresholdPoint> point) : point_(std::move(point)) { 2704 } 2705 getPoint() const2706 const std::vector<IdleScreenRefreshRateTimeoutLuxThresholdPoint>& IdleScreenRefreshRateTimeoutLuxThresholds::getPoint() const { 2707 return point_; 2708 } 2709 hasPoint() const2710 bool IdleScreenRefreshRateTimeoutLuxThresholds::hasPoint() const { 2711 return !(point_.empty()); 2712 } 2713 getFirstPoint() const2714 const IdleScreenRefreshRateTimeoutLuxThresholdPoint* IdleScreenRefreshRateTimeoutLuxThresholds::getFirstPoint() const { 2715 if (point_.empty()) { 2716 return nullptr; 2717 } 2718 return &point_[0]; 2719 } 2720 read(xmlNode * root)2721 IdleScreenRefreshRateTimeoutLuxThresholds IdleScreenRefreshRateTimeoutLuxThresholds::read(xmlNode *root) { 2722 std::string _raw; 2723 std::vector<IdleScreenRefreshRateTimeoutLuxThresholdPoint> point; 2724 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 2725 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("point"))) { 2726 IdleScreenRefreshRateTimeoutLuxThresholdPoint _value = IdleScreenRefreshRateTimeoutLuxThresholdPoint::read(_child); 2727 point.push_back(std::move(_value)); 2728 } 2729 } 2730 IdleScreenRefreshRateTimeoutLuxThresholds instance(point); 2731 return instance; 2732 } 2733 IdleScreenRefreshRateTimeoutLuxThresholdPoint(std::optional<int64_t> lux,std::optional<int64_t> timeout)2734 IdleScreenRefreshRateTimeoutLuxThresholdPoint::IdleScreenRefreshRateTimeoutLuxThresholdPoint(std::optional<int64_t> lux, std::optional<int64_t> timeout) : lux_(lux), timeout_(timeout) { 2735 } 2736 getLux() const2737 const int64_t& IdleScreenRefreshRateTimeoutLuxThresholdPoint::getLux() const { 2738 _xsdc_assert(hasLux()); 2739 return lux_.value(); 2740 } 2741 hasLux() const2742 bool IdleScreenRefreshRateTimeoutLuxThresholdPoint::hasLux() const { 2743 return lux_.has_value(); 2744 } 2745 getTimeout() const2746 const int64_t& IdleScreenRefreshRateTimeoutLuxThresholdPoint::getTimeout() const { 2747 _xsdc_assert(hasTimeout()); 2748 return timeout_.value(); 2749 } 2750 hasTimeout() const2751 bool IdleScreenRefreshRateTimeoutLuxThresholdPoint::hasTimeout() const { 2752 return timeout_.has_value(); 2753 } 2754 read(xmlNode * root)2755 IdleScreenRefreshRateTimeoutLuxThresholdPoint IdleScreenRefreshRateTimeoutLuxThresholdPoint::read(xmlNode *root) { 2756 std::string _raw; 2757 std::optional<int64_t> lux; 2758 std::optional<int64_t> timeout; 2759 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 2760 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("lux"))) { 2761 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 2762 if (xmlValue == nullptr) { 2763 _raw = ""; 2764 } else { 2765 _raw = reinterpret_cast<const char*>(xmlValue.get()); 2766 } 2767 int64_t _value = std::stoll(_raw); 2768 lux = std::move(_value); 2769 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("timeout"))) { 2770 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 2771 if (xmlValue == nullptr) { 2772 _raw = ""; 2773 } else { 2774 _raw = reinterpret_cast<const char*>(xmlValue.get()); 2775 } 2776 int64_t _value = std::stoll(_raw); 2777 timeout = std::move(_value); 2778 } 2779 } 2780 IdleScreenRefreshRateTimeoutLuxThresholdPoint instance(lux, timeout); 2781 return instance; 2782 } 2783 DisplayConfiguration(std::optional<std::string> name,std::vector<DensityMapping> densityMapping,std::vector<NitsMap> screenBrightnessMap,std::optional<double> screenBrightnessDefault,std::vector<ThermalThrottling> thermalThrottling,std::vector<PowerThrottlingConfig> powerThrottlingConfig,std::vector<LuxThrottling> luxThrottling,std::vector<HighBrightnessMode> highBrightnessMode,std::vector<HdrBrightnessConfig> hdrBrightnessConfig,std::vector<DisplayQuirks> quirks,std::vector<AutoBrightness> autoBrightness,std::vector<RefreshRateConfigs> refreshRate,std::optional<double> screenBrightnessRampFastDecrease,std::optional<double> screenBrightnessRampFastIncrease,std::optional<double> screenBrightnessRampSlowDecrease,std::optional<double> screenBrightnessRampSlowIncrease,std::optional<double> screenBrightnessRampSlowDecreaseIdle,std::optional<double> screenBrightnessRampSlowIncreaseIdle,std::optional<int64_t> screenBrightnessRampIncreaseMaxMillis,std::optional<int64_t> screenBrightnessRampDecreaseMaxMillis,std::optional<int64_t> screenBrightnessRampIncreaseMaxIdleMillis,std::optional<int64_t> screenBrightnessRampDecreaseMaxIdleMillis,std::vector<SensorDetails> lightSensor,std::vector<SensorDetails> screenOffBrightnessSensor,std::vector<SensorDetails> proxSensor,std::vector<SensorDetails> tempSensor,std::optional<int64_t> ambientLightHorizonLong,std::optional<int64_t> ambientLightHorizonShort,std::vector<Thresholds> displayBrightnessChangeThresholds,std::vector<Thresholds> ambientBrightnessChangeThresholds,std::vector<Thresholds> displayBrightnessChangeThresholdsIdle,std::vector<Thresholds> ambientBrightnessChangeThresholdsIdle,std::vector<IntegerArray> screenOffBrightnessSensorValueToLux,std::vector<UsiVersion> usiVersion,std::vector<EvenDimmerMode> evenDimmer,std::optional<double> screenBrightnessCapForWearBedtimeMode,std::vector<IdleScreenRefreshRateTimeout> idleScreenRefreshRateTimeout,std::optional<bool> supportsVrr,std::vector<FloatArray> dozeBrightnessSensorValueToBrightness,std::optional<double> defaultDozeBrightness)2784 DisplayConfiguration::DisplayConfiguration(std::optional<std::string> name, std::vector<DensityMapping> densityMapping, std::vector<NitsMap> screenBrightnessMap, std::optional<double> screenBrightnessDefault, std::vector<ThermalThrottling> thermalThrottling, std::vector<PowerThrottlingConfig> powerThrottlingConfig, std::vector<LuxThrottling> luxThrottling, std::vector<HighBrightnessMode> highBrightnessMode, std::vector<HdrBrightnessConfig> hdrBrightnessConfig, std::vector<DisplayQuirks> quirks, std::vector<AutoBrightness> autoBrightness, std::vector<RefreshRateConfigs> refreshRate, std::optional<double> screenBrightnessRampFastDecrease, std::optional<double> screenBrightnessRampFastIncrease, std::optional<double> screenBrightnessRampSlowDecrease, std::optional<double> screenBrightnessRampSlowIncrease, std::optional<double> screenBrightnessRampSlowDecreaseIdle, std::optional<double> screenBrightnessRampSlowIncreaseIdle, std::optional<int64_t> screenBrightnessRampIncreaseMaxMillis, std::optional<int64_t> screenBrightnessRampDecreaseMaxMillis, std::optional<int64_t> screenBrightnessRampIncreaseMaxIdleMillis, std::optional<int64_t> screenBrightnessRampDecreaseMaxIdleMillis, std::vector<SensorDetails> lightSensor, std::vector<SensorDetails> screenOffBrightnessSensor, std::vector<SensorDetails> proxSensor, std::vector<SensorDetails> tempSensor, std::optional<int64_t> ambientLightHorizonLong, std::optional<int64_t> ambientLightHorizonShort, std::vector<Thresholds> displayBrightnessChangeThresholds, std::vector<Thresholds> ambientBrightnessChangeThresholds, std::vector<Thresholds> displayBrightnessChangeThresholdsIdle, std::vector<Thresholds> ambientBrightnessChangeThresholdsIdle, std::vector<IntegerArray> screenOffBrightnessSensorValueToLux, std::vector<UsiVersion> usiVersion, std::vector<EvenDimmerMode> evenDimmer, std::optional<double> screenBrightnessCapForWearBedtimeMode, std::vector<IdleScreenRefreshRateTimeout> idleScreenRefreshRateTimeout, std::optional<bool> supportsVrr, std::vector<FloatArray> dozeBrightnessSensorValueToBrightness, std::optional<double> defaultDozeBrightness) : name_(std::move(name)), densityMapping_(std::move(densityMapping)), screenBrightnessMap_(std::move(screenBrightnessMap)), screenBrightnessDefault_(screenBrightnessDefault), thermalThrottling_(std::move(thermalThrottling)), powerThrottlingConfig_(std::move(powerThrottlingConfig)), luxThrottling_(std::move(luxThrottling)), highBrightnessMode_(std::move(highBrightnessMode)), hdrBrightnessConfig_(std::move(hdrBrightnessConfig)), quirks_(std::move(quirks)), autoBrightness_(std::move(autoBrightness)), refreshRate_(std::move(refreshRate)), screenBrightnessRampFastDecrease_(screenBrightnessRampFastDecrease), screenBrightnessRampFastIncrease_(screenBrightnessRampFastIncrease), screenBrightnessRampSlowDecrease_(screenBrightnessRampSlowDecrease), screenBrightnessRampSlowIncrease_(screenBrightnessRampSlowIncrease), screenBrightnessRampSlowDecreaseIdle_(screenBrightnessRampSlowDecreaseIdle), screenBrightnessRampSlowIncreaseIdle_(screenBrightnessRampSlowIncreaseIdle), screenBrightnessRampIncreaseMaxMillis_(screenBrightnessRampIncreaseMaxMillis), screenBrightnessRampDecreaseMaxMillis_(screenBrightnessRampDecreaseMaxMillis), screenBrightnessRampIncreaseMaxIdleMillis_(screenBrightnessRampIncreaseMaxIdleMillis), screenBrightnessRampDecreaseMaxIdleMillis_(screenBrightnessRampDecreaseMaxIdleMillis), lightSensor_(std::move(lightSensor)), screenOffBrightnessSensor_(std::move(screenOffBrightnessSensor)), proxSensor_(std::move(proxSensor)), tempSensor_(std::move(tempSensor)), ambientLightHorizonLong_(ambientLightHorizonLong), ambientLightHorizonShort_(ambientLightHorizonShort), displayBrightnessChangeThresholds_(std::move(displayBrightnessChangeThresholds)), ambientBrightnessChangeThresholds_(std::move(ambientBrightnessChangeThresholds)), displayBrightnessChangeThresholdsIdle_(std::move(displayBrightnessChangeThresholdsIdle)), ambientBrightnessChangeThresholdsIdle_(std::move(ambientBrightnessChangeThresholdsIdle)), screenOffBrightnessSensorValueToLux_(std::move(screenOffBrightnessSensorValueToLux)), usiVersion_(std::move(usiVersion)), evenDimmer_(std::move(evenDimmer)), screenBrightnessCapForWearBedtimeMode_(screenBrightnessCapForWearBedtimeMode), idleScreenRefreshRateTimeout_(std::move(idleScreenRefreshRateTimeout)), supportsVrr_(supportsVrr), dozeBrightnessSensorValueToBrightness_(std::move(dozeBrightnessSensorValueToBrightness)), defaultDozeBrightness_(defaultDozeBrightness) { 2785 } 2786 getName() const2787 const std::string& DisplayConfiguration::getName() const { 2788 _xsdc_assert(hasName()); 2789 return name_.value(); 2790 } 2791 hasName() const2792 bool DisplayConfiguration::hasName() const { 2793 return name_.has_value(); 2794 } 2795 getDensityMapping() const2796 const std::vector<DensityMapping>& DisplayConfiguration::getDensityMapping() const { 2797 return densityMapping_; 2798 } 2799 hasDensityMapping() const2800 bool DisplayConfiguration::hasDensityMapping() const { 2801 return !(densityMapping_.empty()); 2802 } 2803 getFirstDensityMapping() const2804 const DensityMapping* DisplayConfiguration::getFirstDensityMapping() const { 2805 if (densityMapping_.empty()) { 2806 return nullptr; 2807 } 2808 return &densityMapping_[0]; 2809 } 2810 getScreenBrightnessMap() const2811 const std::vector<NitsMap>& DisplayConfiguration::getScreenBrightnessMap() const { 2812 return screenBrightnessMap_; 2813 } 2814 hasScreenBrightnessMap() const2815 bool DisplayConfiguration::hasScreenBrightnessMap() const { 2816 return !(screenBrightnessMap_.empty()); 2817 } 2818 getFirstScreenBrightnessMap() const2819 const NitsMap* DisplayConfiguration::getFirstScreenBrightnessMap() const { 2820 if (screenBrightnessMap_.empty()) { 2821 return nullptr; 2822 } 2823 return &screenBrightnessMap_[0]; 2824 } 2825 getScreenBrightnessDefault() const2826 const double& DisplayConfiguration::getScreenBrightnessDefault() const { 2827 _xsdc_assert(hasScreenBrightnessDefault()); 2828 return screenBrightnessDefault_.value(); 2829 } 2830 hasScreenBrightnessDefault() const2831 bool DisplayConfiguration::hasScreenBrightnessDefault() const { 2832 return screenBrightnessDefault_.has_value(); 2833 } 2834 getThermalThrottling() const2835 const std::vector<ThermalThrottling>& DisplayConfiguration::getThermalThrottling() const { 2836 return thermalThrottling_; 2837 } 2838 hasThermalThrottling() const2839 bool DisplayConfiguration::hasThermalThrottling() const { 2840 return !(thermalThrottling_.empty()); 2841 } 2842 getFirstThermalThrottling() const2843 const ThermalThrottling* DisplayConfiguration::getFirstThermalThrottling() const { 2844 if (thermalThrottling_.empty()) { 2845 return nullptr; 2846 } 2847 return &thermalThrottling_[0]; 2848 } 2849 getPowerThrottlingConfig() const2850 const std::vector<PowerThrottlingConfig>& DisplayConfiguration::getPowerThrottlingConfig() const { 2851 return powerThrottlingConfig_; 2852 } 2853 hasPowerThrottlingConfig() const2854 bool DisplayConfiguration::hasPowerThrottlingConfig() const { 2855 return !(powerThrottlingConfig_.empty()); 2856 } 2857 getFirstPowerThrottlingConfig() const2858 const PowerThrottlingConfig* DisplayConfiguration::getFirstPowerThrottlingConfig() const { 2859 if (powerThrottlingConfig_.empty()) { 2860 return nullptr; 2861 } 2862 return &powerThrottlingConfig_[0]; 2863 } 2864 getLuxThrottling() const2865 const std::vector<LuxThrottling>& DisplayConfiguration::getLuxThrottling() const { 2866 return luxThrottling_; 2867 } 2868 hasLuxThrottling() const2869 bool DisplayConfiguration::hasLuxThrottling() const { 2870 return !(luxThrottling_.empty()); 2871 } 2872 getFirstLuxThrottling() const2873 const LuxThrottling* DisplayConfiguration::getFirstLuxThrottling() const { 2874 if (luxThrottling_.empty()) { 2875 return nullptr; 2876 } 2877 return &luxThrottling_[0]; 2878 } 2879 getHighBrightnessMode() const2880 const std::vector<HighBrightnessMode>& DisplayConfiguration::getHighBrightnessMode() const { 2881 return highBrightnessMode_; 2882 } 2883 hasHighBrightnessMode() const2884 bool DisplayConfiguration::hasHighBrightnessMode() const { 2885 return !(highBrightnessMode_.empty()); 2886 } 2887 getFirstHighBrightnessMode() const2888 const HighBrightnessMode* DisplayConfiguration::getFirstHighBrightnessMode() const { 2889 if (highBrightnessMode_.empty()) { 2890 return nullptr; 2891 } 2892 return &highBrightnessMode_[0]; 2893 } 2894 getHdrBrightnessConfig() const2895 const std::vector<HdrBrightnessConfig>& DisplayConfiguration::getHdrBrightnessConfig() const { 2896 return hdrBrightnessConfig_; 2897 } 2898 hasHdrBrightnessConfig() const2899 bool DisplayConfiguration::hasHdrBrightnessConfig() const { 2900 return !(hdrBrightnessConfig_.empty()); 2901 } 2902 getFirstHdrBrightnessConfig() const2903 const HdrBrightnessConfig* DisplayConfiguration::getFirstHdrBrightnessConfig() const { 2904 if (hdrBrightnessConfig_.empty()) { 2905 return nullptr; 2906 } 2907 return &hdrBrightnessConfig_[0]; 2908 } 2909 getQuirks() const2910 const std::vector<DisplayQuirks>& DisplayConfiguration::getQuirks() const { 2911 return quirks_; 2912 } 2913 hasQuirks() const2914 bool DisplayConfiguration::hasQuirks() const { 2915 return !(quirks_.empty()); 2916 } 2917 getFirstQuirks() const2918 const DisplayQuirks* DisplayConfiguration::getFirstQuirks() const { 2919 if (quirks_.empty()) { 2920 return nullptr; 2921 } 2922 return &quirks_[0]; 2923 } 2924 getAutoBrightness() const2925 const std::vector<AutoBrightness>& DisplayConfiguration::getAutoBrightness() const { 2926 return autoBrightness_; 2927 } 2928 hasAutoBrightness() const2929 bool DisplayConfiguration::hasAutoBrightness() const { 2930 return !(autoBrightness_.empty()); 2931 } 2932 getFirstAutoBrightness() const2933 const AutoBrightness* DisplayConfiguration::getFirstAutoBrightness() const { 2934 if (autoBrightness_.empty()) { 2935 return nullptr; 2936 } 2937 return &autoBrightness_[0]; 2938 } 2939 getRefreshRate() const2940 const std::vector<RefreshRateConfigs>& DisplayConfiguration::getRefreshRate() const { 2941 return refreshRate_; 2942 } 2943 hasRefreshRate() const2944 bool DisplayConfiguration::hasRefreshRate() const { 2945 return !(refreshRate_.empty()); 2946 } 2947 getFirstRefreshRate() const2948 const RefreshRateConfigs* DisplayConfiguration::getFirstRefreshRate() const { 2949 if (refreshRate_.empty()) { 2950 return nullptr; 2951 } 2952 return &refreshRate_[0]; 2953 } 2954 getScreenBrightnessRampFastDecrease() const2955 const double& DisplayConfiguration::getScreenBrightnessRampFastDecrease() const { 2956 _xsdc_assert(hasScreenBrightnessRampFastDecrease()); 2957 return screenBrightnessRampFastDecrease_.value(); 2958 } 2959 hasScreenBrightnessRampFastDecrease() const2960 bool DisplayConfiguration::hasScreenBrightnessRampFastDecrease() const { 2961 return screenBrightnessRampFastDecrease_.has_value(); 2962 } 2963 getScreenBrightnessRampFastIncrease() const2964 const double& DisplayConfiguration::getScreenBrightnessRampFastIncrease() const { 2965 _xsdc_assert(hasScreenBrightnessRampFastIncrease()); 2966 return screenBrightnessRampFastIncrease_.value(); 2967 } 2968 hasScreenBrightnessRampFastIncrease() const2969 bool DisplayConfiguration::hasScreenBrightnessRampFastIncrease() const { 2970 return screenBrightnessRampFastIncrease_.has_value(); 2971 } 2972 getScreenBrightnessRampSlowDecrease() const2973 const double& DisplayConfiguration::getScreenBrightnessRampSlowDecrease() const { 2974 _xsdc_assert(hasScreenBrightnessRampSlowDecrease()); 2975 return screenBrightnessRampSlowDecrease_.value(); 2976 } 2977 hasScreenBrightnessRampSlowDecrease() const2978 bool DisplayConfiguration::hasScreenBrightnessRampSlowDecrease() const { 2979 return screenBrightnessRampSlowDecrease_.has_value(); 2980 } 2981 getScreenBrightnessRampSlowIncrease() const2982 const double& DisplayConfiguration::getScreenBrightnessRampSlowIncrease() const { 2983 _xsdc_assert(hasScreenBrightnessRampSlowIncrease()); 2984 return screenBrightnessRampSlowIncrease_.value(); 2985 } 2986 hasScreenBrightnessRampSlowIncrease() const2987 bool DisplayConfiguration::hasScreenBrightnessRampSlowIncrease() const { 2988 return screenBrightnessRampSlowIncrease_.has_value(); 2989 } 2990 getScreenBrightnessRampSlowDecreaseIdle() const2991 const double& DisplayConfiguration::getScreenBrightnessRampSlowDecreaseIdle() const { 2992 _xsdc_assert(hasScreenBrightnessRampSlowDecreaseIdle()); 2993 return screenBrightnessRampSlowDecreaseIdle_.value(); 2994 } 2995 hasScreenBrightnessRampSlowDecreaseIdle() const2996 bool DisplayConfiguration::hasScreenBrightnessRampSlowDecreaseIdle() const { 2997 return screenBrightnessRampSlowDecreaseIdle_.has_value(); 2998 } 2999 getScreenBrightnessRampSlowIncreaseIdle() const3000 const double& DisplayConfiguration::getScreenBrightnessRampSlowIncreaseIdle() const { 3001 _xsdc_assert(hasScreenBrightnessRampSlowIncreaseIdle()); 3002 return screenBrightnessRampSlowIncreaseIdle_.value(); 3003 } 3004 hasScreenBrightnessRampSlowIncreaseIdle() const3005 bool DisplayConfiguration::hasScreenBrightnessRampSlowIncreaseIdle() const { 3006 return screenBrightnessRampSlowIncreaseIdle_.has_value(); 3007 } 3008 getScreenBrightnessRampIncreaseMaxMillis() const3009 const int64_t& DisplayConfiguration::getScreenBrightnessRampIncreaseMaxMillis() const { 3010 _xsdc_assert(hasScreenBrightnessRampIncreaseMaxMillis()); 3011 return screenBrightnessRampIncreaseMaxMillis_.value(); 3012 } 3013 hasScreenBrightnessRampIncreaseMaxMillis() const3014 bool DisplayConfiguration::hasScreenBrightnessRampIncreaseMaxMillis() const { 3015 return screenBrightnessRampIncreaseMaxMillis_.has_value(); 3016 } 3017 getScreenBrightnessRampDecreaseMaxMillis() const3018 const int64_t& DisplayConfiguration::getScreenBrightnessRampDecreaseMaxMillis() const { 3019 _xsdc_assert(hasScreenBrightnessRampDecreaseMaxMillis()); 3020 return screenBrightnessRampDecreaseMaxMillis_.value(); 3021 } 3022 hasScreenBrightnessRampDecreaseMaxMillis() const3023 bool DisplayConfiguration::hasScreenBrightnessRampDecreaseMaxMillis() const { 3024 return screenBrightnessRampDecreaseMaxMillis_.has_value(); 3025 } 3026 getScreenBrightnessRampIncreaseMaxIdleMillis() const3027 const int64_t& DisplayConfiguration::getScreenBrightnessRampIncreaseMaxIdleMillis() const { 3028 _xsdc_assert(hasScreenBrightnessRampIncreaseMaxIdleMillis()); 3029 return screenBrightnessRampIncreaseMaxIdleMillis_.value(); 3030 } 3031 hasScreenBrightnessRampIncreaseMaxIdleMillis() const3032 bool DisplayConfiguration::hasScreenBrightnessRampIncreaseMaxIdleMillis() const { 3033 return screenBrightnessRampIncreaseMaxIdleMillis_.has_value(); 3034 } 3035 getScreenBrightnessRampDecreaseMaxIdleMillis() const3036 const int64_t& DisplayConfiguration::getScreenBrightnessRampDecreaseMaxIdleMillis() const { 3037 _xsdc_assert(hasScreenBrightnessRampDecreaseMaxIdleMillis()); 3038 return screenBrightnessRampDecreaseMaxIdleMillis_.value(); 3039 } 3040 hasScreenBrightnessRampDecreaseMaxIdleMillis() const3041 bool DisplayConfiguration::hasScreenBrightnessRampDecreaseMaxIdleMillis() const { 3042 return screenBrightnessRampDecreaseMaxIdleMillis_.has_value(); 3043 } 3044 getLightSensor() const3045 const std::vector<SensorDetails>& DisplayConfiguration::getLightSensor() const { 3046 return lightSensor_; 3047 } 3048 hasLightSensor() const3049 bool DisplayConfiguration::hasLightSensor() const { 3050 return !(lightSensor_.empty()); 3051 } 3052 getFirstLightSensor() const3053 const SensorDetails* DisplayConfiguration::getFirstLightSensor() const { 3054 if (lightSensor_.empty()) { 3055 return nullptr; 3056 } 3057 return &lightSensor_[0]; 3058 } 3059 getScreenOffBrightnessSensor() const3060 const std::vector<SensorDetails>& DisplayConfiguration::getScreenOffBrightnessSensor() const { 3061 return screenOffBrightnessSensor_; 3062 } 3063 hasScreenOffBrightnessSensor() const3064 bool DisplayConfiguration::hasScreenOffBrightnessSensor() const { 3065 return !(screenOffBrightnessSensor_.empty()); 3066 } 3067 getFirstScreenOffBrightnessSensor() const3068 const SensorDetails* DisplayConfiguration::getFirstScreenOffBrightnessSensor() const { 3069 if (screenOffBrightnessSensor_.empty()) { 3070 return nullptr; 3071 } 3072 return &screenOffBrightnessSensor_[0]; 3073 } 3074 getProxSensor() const3075 const std::vector<SensorDetails>& DisplayConfiguration::getProxSensor() const { 3076 return proxSensor_; 3077 } 3078 hasProxSensor() const3079 bool DisplayConfiguration::hasProxSensor() const { 3080 return !(proxSensor_.empty()); 3081 } 3082 getFirstProxSensor() const3083 const SensorDetails* DisplayConfiguration::getFirstProxSensor() const { 3084 if (proxSensor_.empty()) { 3085 return nullptr; 3086 } 3087 return &proxSensor_[0]; 3088 } 3089 getTempSensor() const3090 const std::vector<SensorDetails>& DisplayConfiguration::getTempSensor() const { 3091 return tempSensor_; 3092 } 3093 hasTempSensor() const3094 bool DisplayConfiguration::hasTempSensor() const { 3095 return !(tempSensor_.empty()); 3096 } 3097 getFirstTempSensor() const3098 const SensorDetails* DisplayConfiguration::getFirstTempSensor() const { 3099 if (tempSensor_.empty()) { 3100 return nullptr; 3101 } 3102 return &tempSensor_[0]; 3103 } 3104 getAmbientLightHorizonLong() const3105 const int64_t& DisplayConfiguration::getAmbientLightHorizonLong() const { 3106 _xsdc_assert(hasAmbientLightHorizonLong()); 3107 return ambientLightHorizonLong_.value(); 3108 } 3109 hasAmbientLightHorizonLong() const3110 bool DisplayConfiguration::hasAmbientLightHorizonLong() const { 3111 return ambientLightHorizonLong_.has_value(); 3112 } 3113 getAmbientLightHorizonShort() const3114 const int64_t& DisplayConfiguration::getAmbientLightHorizonShort() const { 3115 _xsdc_assert(hasAmbientLightHorizonShort()); 3116 return ambientLightHorizonShort_.value(); 3117 } 3118 hasAmbientLightHorizonShort() const3119 bool DisplayConfiguration::hasAmbientLightHorizonShort() const { 3120 return ambientLightHorizonShort_.has_value(); 3121 } 3122 getDisplayBrightnessChangeThresholds() const3123 const std::vector<Thresholds>& DisplayConfiguration::getDisplayBrightnessChangeThresholds() const { 3124 return displayBrightnessChangeThresholds_; 3125 } 3126 hasDisplayBrightnessChangeThresholds() const3127 bool DisplayConfiguration::hasDisplayBrightnessChangeThresholds() const { 3128 return !(displayBrightnessChangeThresholds_.empty()); 3129 } 3130 getFirstDisplayBrightnessChangeThresholds() const3131 const Thresholds* DisplayConfiguration::getFirstDisplayBrightnessChangeThresholds() const { 3132 if (displayBrightnessChangeThresholds_.empty()) { 3133 return nullptr; 3134 } 3135 return &displayBrightnessChangeThresholds_[0]; 3136 } 3137 getAmbientBrightnessChangeThresholds() const3138 const std::vector<Thresholds>& DisplayConfiguration::getAmbientBrightnessChangeThresholds() const { 3139 return ambientBrightnessChangeThresholds_; 3140 } 3141 hasAmbientBrightnessChangeThresholds() const3142 bool DisplayConfiguration::hasAmbientBrightnessChangeThresholds() const { 3143 return !(ambientBrightnessChangeThresholds_.empty()); 3144 } 3145 getFirstAmbientBrightnessChangeThresholds() const3146 const Thresholds* DisplayConfiguration::getFirstAmbientBrightnessChangeThresholds() const { 3147 if (ambientBrightnessChangeThresholds_.empty()) { 3148 return nullptr; 3149 } 3150 return &ambientBrightnessChangeThresholds_[0]; 3151 } 3152 getDisplayBrightnessChangeThresholdsIdle() const3153 const std::vector<Thresholds>& DisplayConfiguration::getDisplayBrightnessChangeThresholdsIdle() const { 3154 return displayBrightnessChangeThresholdsIdle_; 3155 } 3156 hasDisplayBrightnessChangeThresholdsIdle() const3157 bool DisplayConfiguration::hasDisplayBrightnessChangeThresholdsIdle() const { 3158 return !(displayBrightnessChangeThresholdsIdle_.empty()); 3159 } 3160 getFirstDisplayBrightnessChangeThresholdsIdle() const3161 const Thresholds* DisplayConfiguration::getFirstDisplayBrightnessChangeThresholdsIdle() const { 3162 if (displayBrightnessChangeThresholdsIdle_.empty()) { 3163 return nullptr; 3164 } 3165 return &displayBrightnessChangeThresholdsIdle_[0]; 3166 } 3167 getAmbientBrightnessChangeThresholdsIdle() const3168 const std::vector<Thresholds>& DisplayConfiguration::getAmbientBrightnessChangeThresholdsIdle() const { 3169 return ambientBrightnessChangeThresholdsIdle_; 3170 } 3171 hasAmbientBrightnessChangeThresholdsIdle() const3172 bool DisplayConfiguration::hasAmbientBrightnessChangeThresholdsIdle() const { 3173 return !(ambientBrightnessChangeThresholdsIdle_.empty()); 3174 } 3175 getFirstAmbientBrightnessChangeThresholdsIdle() const3176 const Thresholds* DisplayConfiguration::getFirstAmbientBrightnessChangeThresholdsIdle() const { 3177 if (ambientBrightnessChangeThresholdsIdle_.empty()) { 3178 return nullptr; 3179 } 3180 return &ambientBrightnessChangeThresholdsIdle_[0]; 3181 } 3182 getScreenOffBrightnessSensorValueToLux() const3183 const std::vector<IntegerArray>& DisplayConfiguration::getScreenOffBrightnessSensorValueToLux() const { 3184 return screenOffBrightnessSensorValueToLux_; 3185 } 3186 hasScreenOffBrightnessSensorValueToLux() const3187 bool DisplayConfiguration::hasScreenOffBrightnessSensorValueToLux() const { 3188 return !(screenOffBrightnessSensorValueToLux_.empty()); 3189 } 3190 getFirstScreenOffBrightnessSensorValueToLux() const3191 const IntegerArray* DisplayConfiguration::getFirstScreenOffBrightnessSensorValueToLux() const { 3192 if (screenOffBrightnessSensorValueToLux_.empty()) { 3193 return nullptr; 3194 } 3195 return &screenOffBrightnessSensorValueToLux_[0]; 3196 } 3197 getUsiVersion() const3198 const std::vector<UsiVersion>& DisplayConfiguration::getUsiVersion() const { 3199 return usiVersion_; 3200 } 3201 hasUsiVersion() const3202 bool DisplayConfiguration::hasUsiVersion() const { 3203 return !(usiVersion_.empty()); 3204 } 3205 getFirstUsiVersion() const3206 const UsiVersion* DisplayConfiguration::getFirstUsiVersion() const { 3207 if (usiVersion_.empty()) { 3208 return nullptr; 3209 } 3210 return &usiVersion_[0]; 3211 } 3212 getEvenDimmer() const3213 const std::vector<EvenDimmerMode>& DisplayConfiguration::getEvenDimmer() const { 3214 return evenDimmer_; 3215 } 3216 hasEvenDimmer() const3217 bool DisplayConfiguration::hasEvenDimmer() const { 3218 return !(evenDimmer_.empty()); 3219 } 3220 getFirstEvenDimmer() const3221 const EvenDimmerMode* DisplayConfiguration::getFirstEvenDimmer() const { 3222 if (evenDimmer_.empty()) { 3223 return nullptr; 3224 } 3225 return &evenDimmer_[0]; 3226 } 3227 getScreenBrightnessCapForWearBedtimeMode() const3228 const double& DisplayConfiguration::getScreenBrightnessCapForWearBedtimeMode() const { 3229 _xsdc_assert(hasScreenBrightnessCapForWearBedtimeMode()); 3230 return screenBrightnessCapForWearBedtimeMode_.value(); 3231 } 3232 hasScreenBrightnessCapForWearBedtimeMode() const3233 bool DisplayConfiguration::hasScreenBrightnessCapForWearBedtimeMode() const { 3234 return screenBrightnessCapForWearBedtimeMode_.has_value(); 3235 } 3236 getIdleScreenRefreshRateTimeout() const3237 const std::vector<IdleScreenRefreshRateTimeout>& DisplayConfiguration::getIdleScreenRefreshRateTimeout() const { 3238 return idleScreenRefreshRateTimeout_; 3239 } 3240 hasIdleScreenRefreshRateTimeout() const3241 bool DisplayConfiguration::hasIdleScreenRefreshRateTimeout() const { 3242 return !(idleScreenRefreshRateTimeout_.empty()); 3243 } 3244 getFirstIdleScreenRefreshRateTimeout() const3245 const IdleScreenRefreshRateTimeout* DisplayConfiguration::getFirstIdleScreenRefreshRateTimeout() const { 3246 if (idleScreenRefreshRateTimeout_.empty()) { 3247 return nullptr; 3248 } 3249 return &idleScreenRefreshRateTimeout_[0]; 3250 } 3251 getSupportsVrr() const3252 const bool& DisplayConfiguration::getSupportsVrr() const { 3253 _xsdc_assert(hasSupportsVrr()); 3254 return supportsVrr_.value(); 3255 } 3256 hasSupportsVrr() const3257 bool DisplayConfiguration::hasSupportsVrr() const { 3258 return supportsVrr_.has_value(); 3259 } 3260 getDozeBrightnessSensorValueToBrightness() const3261 const std::vector<FloatArray>& DisplayConfiguration::getDozeBrightnessSensorValueToBrightness() const { 3262 return dozeBrightnessSensorValueToBrightness_; 3263 } 3264 hasDozeBrightnessSensorValueToBrightness() const3265 bool DisplayConfiguration::hasDozeBrightnessSensorValueToBrightness() const { 3266 return !(dozeBrightnessSensorValueToBrightness_.empty()); 3267 } 3268 getFirstDozeBrightnessSensorValueToBrightness() const3269 const FloatArray* DisplayConfiguration::getFirstDozeBrightnessSensorValueToBrightness() const { 3270 if (dozeBrightnessSensorValueToBrightness_.empty()) { 3271 return nullptr; 3272 } 3273 return &dozeBrightnessSensorValueToBrightness_[0]; 3274 } 3275 getDefaultDozeBrightness() const3276 const double& DisplayConfiguration::getDefaultDozeBrightness() const { 3277 _xsdc_assert(hasDefaultDozeBrightness()); 3278 return defaultDozeBrightness_.value(); 3279 } 3280 hasDefaultDozeBrightness() const3281 bool DisplayConfiguration::hasDefaultDozeBrightness() const { 3282 return defaultDozeBrightness_.has_value(); 3283 } 3284 read(xmlNode * root)3285 DisplayConfiguration DisplayConfiguration::read(xmlNode *root) { 3286 std::string _raw; 3287 std::optional<std::string> name; 3288 std::vector<DensityMapping> densityMapping; 3289 std::vector<NitsMap> screenBrightnessMap; 3290 std::optional<double> screenBrightnessDefault; 3291 std::vector<ThermalThrottling> thermalThrottling; 3292 std::vector<PowerThrottlingConfig> powerThrottlingConfig; 3293 std::vector<LuxThrottling> luxThrottling; 3294 std::vector<HighBrightnessMode> highBrightnessMode; 3295 std::vector<HdrBrightnessConfig> hdrBrightnessConfig; 3296 std::vector<DisplayQuirks> quirks; 3297 std::vector<AutoBrightness> autoBrightness; 3298 std::vector<RefreshRateConfigs> refreshRate; 3299 std::optional<double> screenBrightnessRampFastDecrease; 3300 std::optional<double> screenBrightnessRampFastIncrease; 3301 std::optional<double> screenBrightnessRampSlowDecrease; 3302 std::optional<double> screenBrightnessRampSlowIncrease; 3303 std::optional<double> screenBrightnessRampSlowDecreaseIdle; 3304 std::optional<double> screenBrightnessRampSlowIncreaseIdle; 3305 std::optional<int64_t> screenBrightnessRampIncreaseMaxMillis; 3306 std::optional<int64_t> screenBrightnessRampDecreaseMaxMillis; 3307 std::optional<int64_t> screenBrightnessRampIncreaseMaxIdleMillis; 3308 std::optional<int64_t> screenBrightnessRampDecreaseMaxIdleMillis; 3309 std::vector<SensorDetails> lightSensor; 3310 std::vector<SensorDetails> screenOffBrightnessSensor; 3311 std::vector<SensorDetails> proxSensor; 3312 std::vector<SensorDetails> tempSensor; 3313 std::optional<int64_t> ambientLightHorizonLong; 3314 std::optional<int64_t> ambientLightHorizonShort; 3315 std::vector<Thresholds> displayBrightnessChangeThresholds; 3316 std::vector<Thresholds> ambientBrightnessChangeThresholds; 3317 std::vector<Thresholds> displayBrightnessChangeThresholdsIdle; 3318 std::vector<Thresholds> ambientBrightnessChangeThresholdsIdle; 3319 std::vector<IntegerArray> screenOffBrightnessSensorValueToLux; 3320 std::vector<UsiVersion> usiVersion; 3321 std::vector<EvenDimmerMode> evenDimmer; 3322 std::optional<double> screenBrightnessCapForWearBedtimeMode; 3323 std::vector<IdleScreenRefreshRateTimeout> idleScreenRefreshRateTimeout; 3324 std::optional<bool> supportsVrr; 3325 std::vector<FloatArray> dozeBrightnessSensorValueToBrightness; 3326 std::optional<double> defaultDozeBrightness; 3327 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 3328 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("name"))) { 3329 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 3330 if (xmlValue == nullptr) { 3331 _raw = ""; 3332 } else { 3333 _raw = reinterpret_cast<const char*>(xmlValue.get()); 3334 } 3335 std::string &_value = _raw; 3336 name = std::move(_value); 3337 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("densityMapping"))) { 3338 DensityMapping _value = DensityMapping::read(_child); 3339 densityMapping.push_back(std::move(_value)); 3340 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("screenBrightnessMap"))) { 3341 NitsMap _value = NitsMap::read(_child); 3342 screenBrightnessMap.push_back(std::move(_value)); 3343 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("screenBrightnessDefault"))) { 3344 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 3345 if (xmlValue == nullptr) { 3346 _raw = ""; 3347 } else { 3348 _raw = reinterpret_cast<const char*>(xmlValue.get()); 3349 } 3350 double _value = std::stod(_raw); 3351 screenBrightnessDefault = std::move(_value); 3352 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("thermalThrottling"))) { 3353 ThermalThrottling _value = ThermalThrottling::read(_child); 3354 thermalThrottling.push_back(std::move(_value)); 3355 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("powerThrottlingConfig"))) { 3356 PowerThrottlingConfig _value = PowerThrottlingConfig::read(_child); 3357 powerThrottlingConfig.push_back(std::move(_value)); 3358 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("luxThrottling"))) { 3359 LuxThrottling _value = LuxThrottling::read(_child); 3360 luxThrottling.push_back(std::move(_value)); 3361 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("highBrightnessMode"))) { 3362 HighBrightnessMode _value = HighBrightnessMode::read(_child); 3363 highBrightnessMode.push_back(std::move(_value)); 3364 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("hdrBrightnessConfig"))) { 3365 HdrBrightnessConfig _value = HdrBrightnessConfig::read(_child); 3366 hdrBrightnessConfig.push_back(std::move(_value)); 3367 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("quirks"))) { 3368 DisplayQuirks _value = DisplayQuirks::read(_child); 3369 quirks.push_back(std::move(_value)); 3370 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("autoBrightness"))) { 3371 AutoBrightness _value = AutoBrightness::read(_child); 3372 autoBrightness.push_back(std::move(_value)); 3373 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("refreshRate"))) { 3374 RefreshRateConfigs _value = RefreshRateConfigs::read(_child); 3375 refreshRate.push_back(std::move(_value)); 3376 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("screenBrightnessRampFastDecrease"))) { 3377 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 3378 if (xmlValue == nullptr) { 3379 _raw = ""; 3380 } else { 3381 _raw = reinterpret_cast<const char*>(xmlValue.get()); 3382 } 3383 double _value = std::stod(_raw); 3384 screenBrightnessRampFastDecrease = std::move(_value); 3385 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("screenBrightnessRampFastIncrease"))) { 3386 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 3387 if (xmlValue == nullptr) { 3388 _raw = ""; 3389 } else { 3390 _raw = reinterpret_cast<const char*>(xmlValue.get()); 3391 } 3392 double _value = std::stod(_raw); 3393 screenBrightnessRampFastIncrease = std::move(_value); 3394 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("screenBrightnessRampSlowDecrease"))) { 3395 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 3396 if (xmlValue == nullptr) { 3397 _raw = ""; 3398 } else { 3399 _raw = reinterpret_cast<const char*>(xmlValue.get()); 3400 } 3401 double _value = std::stod(_raw); 3402 screenBrightnessRampSlowDecrease = std::move(_value); 3403 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("screenBrightnessRampSlowIncrease"))) { 3404 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 3405 if (xmlValue == nullptr) { 3406 _raw = ""; 3407 } else { 3408 _raw = reinterpret_cast<const char*>(xmlValue.get()); 3409 } 3410 double _value = std::stod(_raw); 3411 screenBrightnessRampSlowIncrease = std::move(_value); 3412 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("screenBrightnessRampSlowDecreaseIdle"))) { 3413 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 3414 if (xmlValue == nullptr) { 3415 _raw = ""; 3416 } else { 3417 _raw = reinterpret_cast<const char*>(xmlValue.get()); 3418 } 3419 double _value = std::stod(_raw); 3420 screenBrightnessRampSlowDecreaseIdle = std::move(_value); 3421 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("screenBrightnessRampSlowIncreaseIdle"))) { 3422 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 3423 if (xmlValue == nullptr) { 3424 _raw = ""; 3425 } else { 3426 _raw = reinterpret_cast<const char*>(xmlValue.get()); 3427 } 3428 double _value = std::stod(_raw); 3429 screenBrightnessRampSlowIncreaseIdle = std::move(_value); 3430 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("screenBrightnessRampIncreaseMaxMillis"))) { 3431 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 3432 if (xmlValue == nullptr) { 3433 _raw = ""; 3434 } else { 3435 _raw = reinterpret_cast<const char*>(xmlValue.get()); 3436 } 3437 int64_t _value = std::stoll(_raw); 3438 screenBrightnessRampIncreaseMaxMillis = std::move(_value); 3439 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("screenBrightnessRampDecreaseMaxMillis"))) { 3440 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 3441 if (xmlValue == nullptr) { 3442 _raw = ""; 3443 } else { 3444 _raw = reinterpret_cast<const char*>(xmlValue.get()); 3445 } 3446 int64_t _value = std::stoll(_raw); 3447 screenBrightnessRampDecreaseMaxMillis = std::move(_value); 3448 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("screenBrightnessRampIncreaseMaxIdleMillis"))) { 3449 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 3450 if (xmlValue == nullptr) { 3451 _raw = ""; 3452 } else { 3453 _raw = reinterpret_cast<const char*>(xmlValue.get()); 3454 } 3455 int64_t _value = std::stoll(_raw); 3456 screenBrightnessRampIncreaseMaxIdleMillis = std::move(_value); 3457 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("screenBrightnessRampDecreaseMaxIdleMillis"))) { 3458 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 3459 if (xmlValue == nullptr) { 3460 _raw = ""; 3461 } else { 3462 _raw = reinterpret_cast<const char*>(xmlValue.get()); 3463 } 3464 int64_t _value = std::stoll(_raw); 3465 screenBrightnessRampDecreaseMaxIdleMillis = std::move(_value); 3466 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("lightSensor"))) { 3467 SensorDetails _value = SensorDetails::read(_child); 3468 lightSensor.push_back(std::move(_value)); 3469 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("screenOffBrightnessSensor"))) { 3470 SensorDetails _value = SensorDetails::read(_child); 3471 screenOffBrightnessSensor.push_back(std::move(_value)); 3472 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("proxSensor"))) { 3473 SensorDetails _value = SensorDetails::read(_child); 3474 proxSensor.push_back(std::move(_value)); 3475 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("tempSensor"))) { 3476 SensorDetails _value = SensorDetails::read(_child); 3477 tempSensor.push_back(std::move(_value)); 3478 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("ambientLightHorizonLong"))) { 3479 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 3480 if (xmlValue == nullptr) { 3481 _raw = ""; 3482 } else { 3483 _raw = reinterpret_cast<const char*>(xmlValue.get()); 3484 } 3485 int64_t _value = std::stoll(_raw); 3486 ambientLightHorizonLong = std::move(_value); 3487 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("ambientLightHorizonShort"))) { 3488 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 3489 if (xmlValue == nullptr) { 3490 _raw = ""; 3491 } else { 3492 _raw = reinterpret_cast<const char*>(xmlValue.get()); 3493 } 3494 int64_t _value = std::stoll(_raw); 3495 ambientLightHorizonShort = std::move(_value); 3496 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("displayBrightnessChangeThresholds"))) { 3497 Thresholds _value = Thresholds::read(_child); 3498 displayBrightnessChangeThresholds.push_back(std::move(_value)); 3499 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("ambientBrightnessChangeThresholds"))) { 3500 Thresholds _value = Thresholds::read(_child); 3501 ambientBrightnessChangeThresholds.push_back(std::move(_value)); 3502 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("displayBrightnessChangeThresholdsIdle"))) { 3503 Thresholds _value = Thresholds::read(_child); 3504 displayBrightnessChangeThresholdsIdle.push_back(std::move(_value)); 3505 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("ambientBrightnessChangeThresholdsIdle"))) { 3506 Thresholds _value = Thresholds::read(_child); 3507 ambientBrightnessChangeThresholdsIdle.push_back(std::move(_value)); 3508 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("screenOffBrightnessSensorValueToLux"))) { 3509 IntegerArray _value = IntegerArray::read(_child); 3510 screenOffBrightnessSensorValueToLux.push_back(std::move(_value)); 3511 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("usiVersion"))) { 3512 UsiVersion _value = UsiVersion::read(_child); 3513 usiVersion.push_back(std::move(_value)); 3514 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("evenDimmer"))) { 3515 EvenDimmerMode _value = EvenDimmerMode::read(_child); 3516 evenDimmer.push_back(std::move(_value)); 3517 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("screenBrightnessCapForWearBedtimeMode"))) { 3518 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 3519 if (xmlValue == nullptr) { 3520 _raw = ""; 3521 } else { 3522 _raw = reinterpret_cast<const char*>(xmlValue.get()); 3523 } 3524 double _value = std::stod(_raw); 3525 screenBrightnessCapForWearBedtimeMode = std::move(_value); 3526 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("idleScreenRefreshRateTimeout"))) { 3527 IdleScreenRefreshRateTimeout _value = IdleScreenRefreshRateTimeout::read(_child); 3528 idleScreenRefreshRateTimeout.push_back(std::move(_value)); 3529 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("supportsVrr"))) { 3530 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 3531 if (xmlValue == nullptr) { 3532 _raw = ""; 3533 } else { 3534 _raw = reinterpret_cast<const char*>(xmlValue.get()); 3535 } 3536 bool _value = _raw == "true"; 3537 supportsVrr = std::move(_value); 3538 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("dozeBrightnessSensorValueToBrightness"))) { 3539 FloatArray _value = FloatArray::read(_child); 3540 dozeBrightnessSensorValueToBrightness.push_back(std::move(_value)); 3541 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("defaultDozeBrightness"))) { 3542 auto xmlValue = make_xmlUnique(xmlNodeListGetString(_child->doc, _child->xmlChildrenNode, 1)); 3543 if (xmlValue == nullptr) { 3544 _raw = ""; 3545 } else { 3546 _raw = reinterpret_cast<const char*>(xmlValue.get()); 3547 } 3548 double _value = std::stod(_raw); 3549 defaultDozeBrightness = std::move(_value); 3550 } 3551 } 3552 DisplayConfiguration instance(name, densityMapping, screenBrightnessMap, screenBrightnessDefault, thermalThrottling, powerThrottlingConfig, luxThrottling, highBrightnessMode, hdrBrightnessConfig, quirks, autoBrightness, refreshRate, screenBrightnessRampFastDecrease, screenBrightnessRampFastIncrease, screenBrightnessRampSlowDecrease, screenBrightnessRampSlowIncrease, screenBrightnessRampSlowDecreaseIdle, screenBrightnessRampSlowIncreaseIdle, screenBrightnessRampIncreaseMaxMillis, screenBrightnessRampDecreaseMaxMillis, screenBrightnessRampIncreaseMaxIdleMillis, screenBrightnessRampDecreaseMaxIdleMillis, lightSensor, screenOffBrightnessSensor, proxSensor, tempSensor, ambientLightHorizonLong, ambientLightHorizonShort, displayBrightnessChangeThresholds, ambientBrightnessChangeThresholds, displayBrightnessChangeThresholdsIdle, ambientBrightnessChangeThresholdsIdle, screenOffBrightnessSensorValueToLux, usiVersion, evenDimmer, screenBrightnessCapForWearBedtimeMode, idleScreenRefreshRateTimeout, supportsVrr, dozeBrightnessSensorValueToBrightness, defaultDozeBrightness); 3553 return instance; 3554 } 3555 } // config 3556 } // display 3557 } // server 3558 } // android 3559 } // com 3560