1 // Automatic generation of D-Bus interfaces: 2 // - org.chromium.PowerManager 3 #ifndef ____CHROMEOS_DBUS_BINDING____________________BUILD_LINK_TMP_PORTAGE_CHROMEOS_BASE_POWER_MANAGER_9999_WORK_BUILD_OUT_DEFAULT_GEN_INCLUDE_POWER_MANAGER_DBUS_PROXIES_H 4 #define ____CHROMEOS_DBUS_BINDING____________________BUILD_LINK_TMP_PORTAGE_CHROMEOS_BASE_POWER_MANAGER_9999_WORK_BUILD_OUT_DEFAULT_GEN_INCLUDE_POWER_MANAGER_DBUS_PROXIES_H 5 #include <memory> 6 #include <string> 7 #include <vector> 8 9 #include <base/bind.h> 10 #include <base/callback.h> 11 #include <base/logging.h> 12 #include <base/macros.h> 13 #include <base/memory/ref_counted.h> 14 #include <brillo/any.h> 15 #include <brillo/dbus/dbus_method_invoker.h> 16 #include <brillo/dbus/dbus_property.h> 17 #include <brillo/dbus/dbus_signal_handler.h> 18 #include <brillo/errors/error.h> 19 #include <brillo/variant_dictionary.h> 20 #include <dbus/bus.h> 21 #include <dbus/message.h> 22 #include <dbus/object_manager.h> 23 #include <dbus/object_path.h> 24 #include <dbus/object_proxy.h> 25 26 namespace org { 27 namespace chromium { 28 29 // Abstract interface proxy for org::chromium::PowerManager. 30 class PowerManagerProxyInterface { 31 public: 32 virtual ~PowerManagerProxyInterface() = default; 33 34 virtual bool RequestShutdown( 35 brillo::ErrorPtr* error, 36 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 37 38 virtual void RequestShutdownAsync( 39 const base::Callback<void()>& success_callback, 40 const base::Callback<void(brillo::Error*)>& error_callback, 41 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 42 43 // The |reason| arg is a power_manager::RequestRestartReason value. 44 virtual bool RequestRestart( 45 int32_t in_reason, 46 brillo::ErrorPtr* error, 47 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 48 49 // The |reason| arg is a power_manager::RequestRestartReason value. 50 virtual void RequestRestartAsync( 51 int32_t in_reason, 52 const base::Callback<void()>& success_callback, 53 const base::Callback<void(brillo::Error*)>& error_callback, 54 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 55 56 // The |external_wakeup_count| arg is optional, and it will call two 57 // different methods in the backend. This can't be expressed in the DBus 58 // Introspection XML file. 59 virtual bool RequestSuspend( 60 uint64_t in_external_wakeup_count, 61 brillo::ErrorPtr* error, 62 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 63 64 // The |external_wakeup_count| arg is optional, and it will call two 65 // different methods in the backend. This can't be expressed in the DBus 66 // Introspection XML file. 67 virtual void RequestSuspendAsync( 68 uint64_t in_external_wakeup_count, 69 const base::Callback<void()>& success_callback, 70 const base::Callback<void(brillo::Error*)>& error_callback, 71 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 72 73 virtual bool DecreaseScreenBrightness( 74 bool in_allow_off, 75 brillo::ErrorPtr* error, 76 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 77 78 virtual void DecreaseScreenBrightnessAsync( 79 bool in_allow_off, 80 const base::Callback<void()>& success_callback, 81 const base::Callback<void(brillo::Error*)>& error_callback, 82 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 83 84 virtual bool IncreaseScreenBrightness( 85 brillo::ErrorPtr* error, 86 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 87 88 virtual void IncreaseScreenBrightnessAsync( 89 const base::Callback<void()>& success_callback, 90 const base::Callback<void(brillo::Error*)>& error_callback, 91 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 92 93 virtual bool GetScreenBrightnessPercent( 94 double* out_percent, 95 brillo::ErrorPtr* error, 96 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 97 98 virtual void GetScreenBrightnessPercentAsync( 99 const base::Callback<void(double /*percent*/)>& success_callback, 100 const base::Callback<void(brillo::Error*)>& error_callback, 101 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 102 103 // The |style| arg must be one of the values: 104 // power_manager::kBrightnessTransitionGradual or 105 // power_manager::kBrightnessTransitionInstant. 106 virtual bool SetScreenBrightnessPercent( 107 double in_percent, 108 int32_t in_style, 109 brillo::ErrorPtr* error, 110 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 111 112 // The |style| arg must be one of the values: 113 // power_manager::kBrightnessTransitionGradual or 114 // power_manager::kBrightnessTransitionInstant. 115 virtual void SetScreenBrightnessPercentAsync( 116 double in_percent, 117 int32_t in_style, 118 const base::Callback<void()>& success_callback, 119 const base::Callback<void(brillo::Error*)>& error_callback, 120 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 121 122 virtual bool DecreaseKeyboardBrightness( 123 brillo::ErrorPtr* error, 124 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 125 126 virtual void DecreaseKeyboardBrightnessAsync( 127 const base::Callback<void()>& success_callback, 128 const base::Callback<void(brillo::Error*)>& error_callback, 129 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 130 131 virtual bool IncreaseKeyboardBrightness( 132 brillo::ErrorPtr* error, 133 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 134 135 virtual void IncreaseKeyboardBrightnessAsync( 136 const base::Callback<void()>& success_callback, 137 const base::Callback<void(brillo::Error*)>& error_callback, 138 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 139 140 // The |serialized_proto| arg is a serialized 141 // power_manager::PowerSupplyProperties protobuf. 142 virtual bool GetPowerSupplyProperties( 143 std::vector<uint8_t>* out_serialized_proto, 144 brillo::ErrorPtr* error, 145 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 146 147 // The |serialized_proto| arg is a serialized 148 // power_manager::PowerSupplyProperties protobuf. 149 virtual void GetPowerSupplyPropertiesAsync( 150 const base::Callback<void(const std::vector<uint8_t>& /*serialized_proto*/)>& success_callback, 151 const base::Callback<void(brillo::Error*)>& error_callback, 152 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 153 154 virtual bool HandleVideoActivity( 155 bool in_fullscreen, 156 brillo::ErrorPtr* error, 157 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 158 159 virtual void HandleVideoActivityAsync( 160 bool in_fullscreen, 161 const base::Callback<void()>& success_callback, 162 const base::Callback<void(brillo::Error*)>& error_callback, 163 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 164 165 // The |type| arg is a power_manager::UserActivityType. 166 virtual bool HandleUserActivity( 167 int32_t in_type, 168 brillo::ErrorPtr* error, 169 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 170 171 // The |type| arg is a power_manager::UserActivityType. 172 virtual void HandleUserActivityAsync( 173 int32_t in_type, 174 const base::Callback<void()>& success_callback, 175 const base::Callback<void(brillo::Error*)>& error_callback, 176 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 177 178 virtual bool SetIsProjecting( 179 bool in_is_projecting, 180 brillo::ErrorPtr* error, 181 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 182 183 virtual void SetIsProjectingAsync( 184 bool in_is_projecting, 185 const base::Callback<void()>& success_callback, 186 const base::Callback<void(brillo::Error*)>& error_callback, 187 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 188 189 // The |serialized_proto| arg is a serialized 190 // power_manager::PowerManagementPolicy protobuf. 191 virtual bool SetPolicy( 192 const std::vector<uint8_t>& in_serialized_proto, 193 brillo::ErrorPtr* error, 194 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 195 196 // The |serialized_proto| arg is a serialized 197 // power_manager::PowerManagementPolicy protobuf. 198 virtual void SetPolicyAsync( 199 const std::vector<uint8_t>& in_serialized_proto, 200 const base::Callback<void()>& success_callback, 201 const base::Callback<void(brillo::Error*)>& error_callback, 202 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 203 204 virtual bool SetPowerSource( 205 const std::string& in_id, 206 brillo::ErrorPtr* error, 207 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 208 209 virtual void SetPowerSourceAsync( 210 const std::string& in_id, 211 const base::Callback<void()>& success_callback, 212 const base::Callback<void(brillo::Error*)>& error_callback, 213 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 214 215 // The |timestamp_internal| arg is represented as the return value of 216 // base::TimeTicks::ToInternalValue(). 217 virtual bool HandlePowerButtonAcknowledgment( 218 int64_t in_timestamp_internal, 219 brillo::ErrorPtr* error, 220 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 221 222 // The |timestamp_internal| arg is represented as the return value of 223 // base::TimeTicks::ToInternalValue(). 224 virtual void HandlePowerButtonAcknowledgmentAsync( 225 int64_t in_timestamp_internal, 226 const base::Callback<void()>& success_callback, 227 const base::Callback<void(brillo::Error*)>& error_callback, 228 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 229 230 // The |serialized_request_proto| arg is a serialized 231 // power_manager::RegisterSuspendDelayRequest protobuf. 232 // The |serialized_reply_proto| arg is a serialized 233 // RegisterSuspendDelayReply protobuf. 234 virtual bool RegisterSuspendDelay( 235 const std::vector<uint8_t>& in_serialized_request_proto, 236 std::vector<uint8_t>* out_serialized_reply_proto, 237 brillo::ErrorPtr* error, 238 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 239 240 // The |serialized_request_proto| arg is a serialized 241 // power_manager::RegisterSuspendDelayRequest protobuf. 242 // The |serialized_reply_proto| arg is a serialized 243 // RegisterSuspendDelayReply protobuf. 244 virtual void RegisterSuspendDelayAsync( 245 const std::vector<uint8_t>& in_serialized_request_proto, 246 const base::Callback<void(const std::vector<uint8_t>& /*serialized_reply_proto*/)>& success_callback, 247 const base::Callback<void(brillo::Error*)>& error_callback, 248 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 249 250 // The |serialized_proto| arg is a serialized 251 // power_manager::UnregisterSuspendDelayRequest protobuf. 252 virtual bool UnregisterSuspendDelay( 253 const std::vector<uint8_t>& in_serialized_proto, 254 brillo::ErrorPtr* error, 255 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 256 257 // The |serialized_proto| arg is a serialized 258 // power_manager::UnregisterSuspendDelayRequest protobuf. 259 virtual void UnregisterSuspendDelayAsync( 260 const std::vector<uint8_t>& in_serialized_proto, 261 const base::Callback<void()>& success_callback, 262 const base::Callback<void(brillo::Error*)>& error_callback, 263 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 264 265 // The |serialized_proto| arg is a serialized 266 // power_manager::SuspendReadinessInfo protobuf. 267 virtual bool HandleSuspendReadiness( 268 const std::vector<uint8_t>& in_serialized_proto, 269 brillo::ErrorPtr* error, 270 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 271 272 // The |serialized_proto| arg is a serialized 273 // power_manager::SuspendReadinessInfo protobuf. 274 virtual void HandleSuspendReadinessAsync( 275 const std::vector<uint8_t>& in_serialized_proto, 276 const base::Callback<void()>& success_callback, 277 const base::Callback<void(brillo::Error*)>& error_callback, 278 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 279 280 // The |serialized_request_proto| arg is a serialized 281 // power_manager::RegisterSuspendDelayRequest protobuf. 282 // The |serialized_reply_proto| arg is a serialized 283 // RegisterSuspendDelayReply protobuf. 284 virtual bool RegisterDarkSuspendDelay( 285 const std::vector<uint8_t>& in_serialized_request_proto, 286 std::vector<uint8_t>* out_serialized_reply_proto, 287 brillo::ErrorPtr* error, 288 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 289 290 // The |serialized_request_proto| arg is a serialized 291 // power_manager::RegisterSuspendDelayRequest protobuf. 292 // The |serialized_reply_proto| arg is a serialized 293 // RegisterSuspendDelayReply protobuf. 294 virtual void RegisterDarkSuspendDelayAsync( 295 const std::vector<uint8_t>& in_serialized_request_proto, 296 const base::Callback<void(const std::vector<uint8_t>& /*serialized_reply_proto*/)>& success_callback, 297 const base::Callback<void(brillo::Error*)>& error_callback, 298 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 299 300 // The |serialized_proto| arg is a serialized 301 // power_manager::UnregisterSuspendDelayRequest protobuf. 302 virtual bool UnregisterDarkSuspendDelay( 303 const std::vector<uint8_t>& in_serialized_proto, 304 brillo::ErrorPtr* error, 305 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 306 307 // The |serialized_proto| arg is a serialized 308 // power_manager::UnregisterSuspendDelayRequest protobuf. 309 virtual void UnregisterDarkSuspendDelayAsync( 310 const std::vector<uint8_t>& in_serialized_proto, 311 const base::Callback<void()>& success_callback, 312 const base::Callback<void(brillo::Error*)>& error_callback, 313 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 314 315 // The |serialized_proto| arg is a serialized 316 // power_manager::SuspendReadinessInfo protobuf. 317 virtual bool HandleDarkSuspendReadiness( 318 const std::vector<uint8_t>& in_serialized_proto, 319 brillo::ErrorPtr* error, 320 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 321 322 // The |serialized_proto| arg is a serialized 323 // power_manager::SuspendReadinessInfo protobuf. 324 virtual void HandleDarkSuspendReadinessAsync( 325 const std::vector<uint8_t>& in_serialized_proto, 326 const base::Callback<void()>& success_callback, 327 const base::Callback<void(brillo::Error*)>& error_callback, 328 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 329 330 // The |serialized_proto| arg is a serialized 331 // power_manager::DarkResumeWakeReason protobuf. 332 virtual bool RecordDarkResumeWakeReason( 333 const std::vector<uint8_t>& in_serialized_proto, 334 brillo::ErrorPtr* error, 335 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 336 337 // The |serialized_proto| arg is a serialized 338 // power_manager::DarkResumeWakeReason protobuf. 339 virtual void RecordDarkResumeWakeReasonAsync( 340 const std::vector<uint8_t>& in_serialized_proto, 341 const base::Callback<void()>& success_callback, 342 const base::Callback<void(brillo::Error*)>& error_callback, 343 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) = 0; 344 345 virtual void RegisterBrightnessChangedSignalHandler( 346 const base::Callback<void(int32_t, 347 bool)>& signal_callback, 348 dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0; 349 350 virtual void RegisterKeyboardBrightnessChangedSignalHandler( 351 const base::Callback<void(int32_t, 352 bool)>& signal_callback, 353 dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0; 354 355 virtual void RegisterPeripheralBatteryStatusSignalHandler( 356 const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, 357 dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0; 358 359 virtual void RegisterPowerSupplyPollSignalHandler( 360 const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, 361 dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0; 362 363 virtual void RegisterSuspendImminentSignalHandler( 364 const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, 365 dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0; 366 367 virtual void RegisterSuspendDoneSignalHandler( 368 const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, 369 dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0; 370 371 virtual void RegisterDarkSuspendImminentSignalHandler( 372 const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, 373 dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0; 374 375 virtual void RegisterInputEventSignalHandler( 376 const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, 377 dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0; 378 379 virtual void RegisterIdleActionImminentSignalHandler( 380 const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, 381 dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0; 382 383 virtual void RegisterIdleActionDeferredSignalHandler( 384 const base::Closure& signal_callback, 385 dbus::ObjectProxy::OnConnectedCallback on_connected_callback) = 0; 386 }; 387 388 } // namespace chromium 389 } // namespace org 390 391 namespace org { 392 namespace chromium { 393 394 // Interface proxy for org::chromium::PowerManager. 395 class PowerManagerProxy final : public PowerManagerProxyInterface { 396 public: PowerManagerProxy(const scoped_refptr<dbus::Bus> & bus)397 PowerManagerProxy(const scoped_refptr<dbus::Bus>& bus) : 398 bus_{bus}, 399 dbus_object_proxy_{ 400 bus_->GetObjectProxy(service_name_, object_path_)} { 401 } 402 ~PowerManagerProxy()403 ~PowerManagerProxy() override { 404 bus_->RemoveObjectProxy( 405 service_name_, object_path_, base::Bind(&base::DoNothing)); 406 } 407 RegisterBrightnessChangedSignalHandler(const base::Callback<void (int32_t,bool)> & signal_callback,dbus::ObjectProxy::OnConnectedCallback on_connected_callback)408 void RegisterBrightnessChangedSignalHandler( 409 const base::Callback<void(int32_t, 410 bool)>& signal_callback, 411 dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override { 412 brillo::dbus_utils::ConnectToSignal( 413 dbus_object_proxy_, 414 "org.chromium.PowerManager", 415 "BrightnessChanged", 416 signal_callback, 417 on_connected_callback); 418 } 419 RegisterKeyboardBrightnessChangedSignalHandler(const base::Callback<void (int32_t,bool)> & signal_callback,dbus::ObjectProxy::OnConnectedCallback on_connected_callback)420 void RegisterKeyboardBrightnessChangedSignalHandler( 421 const base::Callback<void(int32_t, 422 bool)>& signal_callback, 423 dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override { 424 brillo::dbus_utils::ConnectToSignal( 425 dbus_object_proxy_, 426 "org.chromium.PowerManager", 427 "KeyboardBrightnessChanged", 428 signal_callback, 429 on_connected_callback); 430 } 431 RegisterPeripheralBatteryStatusSignalHandler(const base::Callback<void (const std::vector<uint8_t> &)> & signal_callback,dbus::ObjectProxy::OnConnectedCallback on_connected_callback)432 void RegisterPeripheralBatteryStatusSignalHandler( 433 const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, 434 dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override { 435 brillo::dbus_utils::ConnectToSignal( 436 dbus_object_proxy_, 437 "org.chromium.PowerManager", 438 "PeripheralBatteryStatus", 439 signal_callback, 440 on_connected_callback); 441 } 442 RegisterPowerSupplyPollSignalHandler(const base::Callback<void (const std::vector<uint8_t> &)> & signal_callback,dbus::ObjectProxy::OnConnectedCallback on_connected_callback)443 void RegisterPowerSupplyPollSignalHandler( 444 const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, 445 dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override { 446 brillo::dbus_utils::ConnectToSignal( 447 dbus_object_proxy_, 448 "org.chromium.PowerManager", 449 "PowerSupplyPoll", 450 signal_callback, 451 on_connected_callback); 452 } 453 RegisterSuspendImminentSignalHandler(const base::Callback<void (const std::vector<uint8_t> &)> & signal_callback,dbus::ObjectProxy::OnConnectedCallback on_connected_callback)454 void RegisterSuspendImminentSignalHandler( 455 const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, 456 dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override { 457 brillo::dbus_utils::ConnectToSignal( 458 dbus_object_proxy_, 459 "org.chromium.PowerManager", 460 "SuspendImminent", 461 signal_callback, 462 on_connected_callback); 463 } 464 RegisterSuspendDoneSignalHandler(const base::Callback<void (const std::vector<uint8_t> &)> & signal_callback,dbus::ObjectProxy::OnConnectedCallback on_connected_callback)465 void RegisterSuspendDoneSignalHandler( 466 const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, 467 dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override { 468 brillo::dbus_utils::ConnectToSignal( 469 dbus_object_proxy_, 470 "org.chromium.PowerManager", 471 "SuspendDone", 472 signal_callback, 473 on_connected_callback); 474 } 475 RegisterDarkSuspendImminentSignalHandler(const base::Callback<void (const std::vector<uint8_t> &)> & signal_callback,dbus::ObjectProxy::OnConnectedCallback on_connected_callback)476 void RegisterDarkSuspendImminentSignalHandler( 477 const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, 478 dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override { 479 brillo::dbus_utils::ConnectToSignal( 480 dbus_object_proxy_, 481 "org.chromium.PowerManager", 482 "DarkSuspendImminent", 483 signal_callback, 484 on_connected_callback); 485 } 486 RegisterInputEventSignalHandler(const base::Callback<void (const std::vector<uint8_t> &)> & signal_callback,dbus::ObjectProxy::OnConnectedCallback on_connected_callback)487 void RegisterInputEventSignalHandler( 488 const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, 489 dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override { 490 brillo::dbus_utils::ConnectToSignal( 491 dbus_object_proxy_, 492 "org.chromium.PowerManager", 493 "InputEvent", 494 signal_callback, 495 on_connected_callback); 496 } 497 RegisterIdleActionImminentSignalHandler(const base::Callback<void (const std::vector<uint8_t> &)> & signal_callback,dbus::ObjectProxy::OnConnectedCallback on_connected_callback)498 void RegisterIdleActionImminentSignalHandler( 499 const base::Callback<void(const std::vector<uint8_t>&)>& signal_callback, 500 dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override { 501 brillo::dbus_utils::ConnectToSignal( 502 dbus_object_proxy_, 503 "org.chromium.PowerManager", 504 "IdleActionImminent", 505 signal_callback, 506 on_connected_callback); 507 } 508 RegisterIdleActionDeferredSignalHandler(const base::Closure & signal_callback,dbus::ObjectProxy::OnConnectedCallback on_connected_callback)509 void RegisterIdleActionDeferredSignalHandler( 510 const base::Closure& signal_callback, 511 dbus::ObjectProxy::OnConnectedCallback on_connected_callback) override { 512 brillo::dbus_utils::ConnectToSignal( 513 dbus_object_proxy_, 514 "org.chromium.PowerManager", 515 "IdleActionDeferred", 516 signal_callback, 517 on_connected_callback); 518 } 519 ReleaseObjectProxy(const base::Closure & callback)520 void ReleaseObjectProxy(const base::Closure& callback) { 521 bus_->RemoveObjectProxy(service_name_, object_path_, callback); 522 } 523 GetObjectPath()524 const dbus::ObjectPath& GetObjectPath() const { 525 return object_path_; 526 } 527 GetObjectProxy()528 dbus::ObjectProxy* GetObjectProxy() const { return dbus_object_proxy_; } 529 530 bool RequestShutdown( 531 brillo::ErrorPtr* error, 532 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 533 auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( 534 timeout_ms, 535 dbus_object_proxy_, 536 "org.chromium.PowerManager", 537 "RequestShutdown", 538 error); 539 return response && brillo::dbus_utils::ExtractMethodCallResults( 540 response.get(), error); 541 } 542 543 void RequestShutdownAsync( 544 const base::Callback<void()>& success_callback, 545 const base::Callback<void(brillo::Error*)>& error_callback, 546 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 547 brillo::dbus_utils::CallMethodWithTimeout( 548 timeout_ms, 549 dbus_object_proxy_, 550 "org.chromium.PowerManager", 551 "RequestShutdown", 552 success_callback, 553 error_callback); 554 } 555 556 // The |reason| arg is a power_manager::RequestRestartReason value. 557 bool RequestRestart( 558 int32_t in_reason, 559 brillo::ErrorPtr* error, 560 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 561 auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( 562 timeout_ms, 563 dbus_object_proxy_, 564 "org.chromium.PowerManager", 565 "RequestRestart", 566 error, 567 in_reason); 568 return response && brillo::dbus_utils::ExtractMethodCallResults( 569 response.get(), error); 570 } 571 572 // The |reason| arg is a power_manager::RequestRestartReason value. 573 void RequestRestartAsync( 574 int32_t in_reason, 575 const base::Callback<void()>& success_callback, 576 const base::Callback<void(brillo::Error*)>& error_callback, 577 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 578 brillo::dbus_utils::CallMethodWithTimeout( 579 timeout_ms, 580 dbus_object_proxy_, 581 "org.chromium.PowerManager", 582 "RequestRestart", 583 success_callback, 584 error_callback, 585 in_reason); 586 } 587 588 // The |external_wakeup_count| arg is optional, and it will call two 589 // different methods in the backend. This can't be expressed in the DBus 590 // Introspection XML file. 591 bool RequestSuspend( 592 uint64_t in_external_wakeup_count, 593 brillo::ErrorPtr* error, 594 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 595 auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( 596 timeout_ms, 597 dbus_object_proxy_, 598 "org.chromium.PowerManager", 599 "RequestSuspend", 600 error, 601 in_external_wakeup_count); 602 return response && brillo::dbus_utils::ExtractMethodCallResults( 603 response.get(), error); 604 } 605 606 // The |external_wakeup_count| arg is optional, and it will call two 607 // different methods in the backend. This can't be expressed in the DBus 608 // Introspection XML file. 609 void RequestSuspendAsync( 610 uint64_t in_external_wakeup_count, 611 const base::Callback<void()>& success_callback, 612 const base::Callback<void(brillo::Error*)>& error_callback, 613 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 614 brillo::dbus_utils::CallMethodWithTimeout( 615 timeout_ms, 616 dbus_object_proxy_, 617 "org.chromium.PowerManager", 618 "RequestSuspend", 619 success_callback, 620 error_callback, 621 in_external_wakeup_count); 622 } 623 624 bool DecreaseScreenBrightness( 625 bool in_allow_off, 626 brillo::ErrorPtr* error, 627 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 628 auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( 629 timeout_ms, 630 dbus_object_proxy_, 631 "org.chromium.PowerManager", 632 "DecreaseScreenBrightness", 633 error, 634 in_allow_off); 635 return response && brillo::dbus_utils::ExtractMethodCallResults( 636 response.get(), error); 637 } 638 639 void DecreaseScreenBrightnessAsync( 640 bool in_allow_off, 641 const base::Callback<void()>& success_callback, 642 const base::Callback<void(brillo::Error*)>& error_callback, 643 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 644 brillo::dbus_utils::CallMethodWithTimeout( 645 timeout_ms, 646 dbus_object_proxy_, 647 "org.chromium.PowerManager", 648 "DecreaseScreenBrightness", 649 success_callback, 650 error_callback, 651 in_allow_off); 652 } 653 654 bool IncreaseScreenBrightness( 655 brillo::ErrorPtr* error, 656 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 657 auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( 658 timeout_ms, 659 dbus_object_proxy_, 660 "org.chromium.PowerManager", 661 "IncreaseScreenBrightness", 662 error); 663 return response && brillo::dbus_utils::ExtractMethodCallResults( 664 response.get(), error); 665 } 666 667 void IncreaseScreenBrightnessAsync( 668 const base::Callback<void()>& success_callback, 669 const base::Callback<void(brillo::Error*)>& error_callback, 670 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 671 brillo::dbus_utils::CallMethodWithTimeout( 672 timeout_ms, 673 dbus_object_proxy_, 674 "org.chromium.PowerManager", 675 "IncreaseScreenBrightness", 676 success_callback, 677 error_callback); 678 } 679 680 bool GetScreenBrightnessPercent( 681 double* out_percent, 682 brillo::ErrorPtr* error, 683 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 684 auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( 685 timeout_ms, 686 dbus_object_proxy_, 687 "org.chromium.PowerManager", 688 "GetScreenBrightnessPercent", 689 error); 690 return response && brillo::dbus_utils::ExtractMethodCallResults( 691 response.get(), error, out_percent); 692 } 693 694 void GetScreenBrightnessPercentAsync( 695 const base::Callback<void(double /*percent*/)>& success_callback, 696 const base::Callback<void(brillo::Error*)>& error_callback, 697 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 698 brillo::dbus_utils::CallMethodWithTimeout( 699 timeout_ms, 700 dbus_object_proxy_, 701 "org.chromium.PowerManager", 702 "GetScreenBrightnessPercent", 703 success_callback, 704 error_callback); 705 } 706 707 // The |style| arg must be one of the values: 708 // power_manager::kBrightnessTransitionGradual or 709 // power_manager::kBrightnessTransitionInstant. 710 bool SetScreenBrightnessPercent( 711 double in_percent, 712 int32_t in_style, 713 brillo::ErrorPtr* error, 714 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 715 auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( 716 timeout_ms, 717 dbus_object_proxy_, 718 "org.chromium.PowerManager", 719 "SetScreenBrightnessPercent", 720 error, 721 in_percent, 722 in_style); 723 return response && brillo::dbus_utils::ExtractMethodCallResults( 724 response.get(), error); 725 } 726 727 // The |style| arg must be one of the values: 728 // power_manager::kBrightnessTransitionGradual or 729 // power_manager::kBrightnessTransitionInstant. 730 void SetScreenBrightnessPercentAsync( 731 double in_percent, 732 int32_t in_style, 733 const base::Callback<void()>& success_callback, 734 const base::Callback<void(brillo::Error*)>& error_callback, 735 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 736 brillo::dbus_utils::CallMethodWithTimeout( 737 timeout_ms, 738 dbus_object_proxy_, 739 "org.chromium.PowerManager", 740 "SetScreenBrightnessPercent", 741 success_callback, 742 error_callback, 743 in_percent, 744 in_style); 745 } 746 747 bool DecreaseKeyboardBrightness( 748 brillo::ErrorPtr* error, 749 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 750 auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( 751 timeout_ms, 752 dbus_object_proxy_, 753 "org.chromium.PowerManager", 754 "DecreaseKeyboardBrightness", 755 error); 756 return response && brillo::dbus_utils::ExtractMethodCallResults( 757 response.get(), error); 758 } 759 760 void DecreaseKeyboardBrightnessAsync( 761 const base::Callback<void()>& success_callback, 762 const base::Callback<void(brillo::Error*)>& error_callback, 763 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 764 brillo::dbus_utils::CallMethodWithTimeout( 765 timeout_ms, 766 dbus_object_proxy_, 767 "org.chromium.PowerManager", 768 "DecreaseKeyboardBrightness", 769 success_callback, 770 error_callback); 771 } 772 773 bool IncreaseKeyboardBrightness( 774 brillo::ErrorPtr* error, 775 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 776 auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( 777 timeout_ms, 778 dbus_object_proxy_, 779 "org.chromium.PowerManager", 780 "IncreaseKeyboardBrightness", 781 error); 782 return response && brillo::dbus_utils::ExtractMethodCallResults( 783 response.get(), error); 784 } 785 786 void IncreaseKeyboardBrightnessAsync( 787 const base::Callback<void()>& success_callback, 788 const base::Callback<void(brillo::Error*)>& error_callback, 789 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 790 brillo::dbus_utils::CallMethodWithTimeout( 791 timeout_ms, 792 dbus_object_proxy_, 793 "org.chromium.PowerManager", 794 "IncreaseKeyboardBrightness", 795 success_callback, 796 error_callback); 797 } 798 799 // The |serialized_proto| arg is a serialized 800 // power_manager::PowerSupplyProperties protobuf. 801 bool GetPowerSupplyProperties( 802 std::vector<uint8_t>* out_serialized_proto, 803 brillo::ErrorPtr* error, 804 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 805 auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( 806 timeout_ms, 807 dbus_object_proxy_, 808 "org.chromium.PowerManager", 809 "GetPowerSupplyProperties", 810 error); 811 return response && brillo::dbus_utils::ExtractMethodCallResults( 812 response.get(), error, out_serialized_proto); 813 } 814 815 // The |serialized_proto| arg is a serialized 816 // power_manager::PowerSupplyProperties protobuf. 817 void GetPowerSupplyPropertiesAsync( 818 const base::Callback<void(const std::vector<uint8_t>& /*serialized_proto*/)>& success_callback, 819 const base::Callback<void(brillo::Error*)>& error_callback, 820 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 821 brillo::dbus_utils::CallMethodWithTimeout( 822 timeout_ms, 823 dbus_object_proxy_, 824 "org.chromium.PowerManager", 825 "GetPowerSupplyProperties", 826 success_callback, 827 error_callback); 828 } 829 830 bool HandleVideoActivity( 831 bool in_fullscreen, 832 brillo::ErrorPtr* error, 833 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 834 auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( 835 timeout_ms, 836 dbus_object_proxy_, 837 "org.chromium.PowerManager", 838 "HandleVideoActivity", 839 error, 840 in_fullscreen); 841 return response && brillo::dbus_utils::ExtractMethodCallResults( 842 response.get(), error); 843 } 844 845 void HandleVideoActivityAsync( 846 bool in_fullscreen, 847 const base::Callback<void()>& success_callback, 848 const base::Callback<void(brillo::Error*)>& error_callback, 849 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 850 brillo::dbus_utils::CallMethodWithTimeout( 851 timeout_ms, 852 dbus_object_proxy_, 853 "org.chromium.PowerManager", 854 "HandleVideoActivity", 855 success_callback, 856 error_callback, 857 in_fullscreen); 858 } 859 860 // The |type| arg is a power_manager::UserActivityType. 861 bool HandleUserActivity( 862 int32_t in_type, 863 brillo::ErrorPtr* error, 864 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 865 auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( 866 timeout_ms, 867 dbus_object_proxy_, 868 "org.chromium.PowerManager", 869 "HandleUserActivity", 870 error, 871 in_type); 872 return response && brillo::dbus_utils::ExtractMethodCallResults( 873 response.get(), error); 874 } 875 876 // The |type| arg is a power_manager::UserActivityType. 877 void HandleUserActivityAsync( 878 int32_t in_type, 879 const base::Callback<void()>& success_callback, 880 const base::Callback<void(brillo::Error*)>& error_callback, 881 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 882 brillo::dbus_utils::CallMethodWithTimeout( 883 timeout_ms, 884 dbus_object_proxy_, 885 "org.chromium.PowerManager", 886 "HandleUserActivity", 887 success_callback, 888 error_callback, 889 in_type); 890 } 891 892 bool SetIsProjecting( 893 bool in_is_projecting, 894 brillo::ErrorPtr* error, 895 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 896 auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( 897 timeout_ms, 898 dbus_object_proxy_, 899 "org.chromium.PowerManager", 900 "SetIsProjecting", 901 error, 902 in_is_projecting); 903 return response && brillo::dbus_utils::ExtractMethodCallResults( 904 response.get(), error); 905 } 906 907 void SetIsProjectingAsync( 908 bool in_is_projecting, 909 const base::Callback<void()>& success_callback, 910 const base::Callback<void(brillo::Error*)>& error_callback, 911 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 912 brillo::dbus_utils::CallMethodWithTimeout( 913 timeout_ms, 914 dbus_object_proxy_, 915 "org.chromium.PowerManager", 916 "SetIsProjecting", 917 success_callback, 918 error_callback, 919 in_is_projecting); 920 } 921 922 // The |serialized_proto| arg is a serialized 923 // power_manager::PowerManagementPolicy protobuf. 924 bool SetPolicy( 925 const std::vector<uint8_t>& in_serialized_proto, 926 brillo::ErrorPtr* error, 927 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 928 auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( 929 timeout_ms, 930 dbus_object_proxy_, 931 "org.chromium.PowerManager", 932 "SetPolicy", 933 error, 934 in_serialized_proto); 935 return response && brillo::dbus_utils::ExtractMethodCallResults( 936 response.get(), error); 937 } 938 939 // The |serialized_proto| arg is a serialized 940 // power_manager::PowerManagementPolicy protobuf. 941 void SetPolicyAsync( 942 const std::vector<uint8_t>& in_serialized_proto, 943 const base::Callback<void()>& success_callback, 944 const base::Callback<void(brillo::Error*)>& error_callback, 945 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 946 brillo::dbus_utils::CallMethodWithTimeout( 947 timeout_ms, 948 dbus_object_proxy_, 949 "org.chromium.PowerManager", 950 "SetPolicy", 951 success_callback, 952 error_callback, 953 in_serialized_proto); 954 } 955 956 bool SetPowerSource( 957 const std::string& in_id, 958 brillo::ErrorPtr* error, 959 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 960 auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( 961 timeout_ms, 962 dbus_object_proxy_, 963 "org.chromium.PowerManager", 964 "SetPowerSource", 965 error, 966 in_id); 967 return response && brillo::dbus_utils::ExtractMethodCallResults( 968 response.get(), error); 969 } 970 971 void SetPowerSourceAsync( 972 const std::string& in_id, 973 const base::Callback<void()>& success_callback, 974 const base::Callback<void(brillo::Error*)>& error_callback, 975 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 976 brillo::dbus_utils::CallMethodWithTimeout( 977 timeout_ms, 978 dbus_object_proxy_, 979 "org.chromium.PowerManager", 980 "SetPowerSource", 981 success_callback, 982 error_callback, 983 in_id); 984 } 985 986 // The |timestamp_internal| arg is represented as the return value of 987 // base::TimeTicks::ToInternalValue(). 988 bool HandlePowerButtonAcknowledgment( 989 int64_t in_timestamp_internal, 990 brillo::ErrorPtr* error, 991 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 992 auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( 993 timeout_ms, 994 dbus_object_proxy_, 995 "org.chromium.PowerManager", 996 "HandlePowerButtonAcknowledgment", 997 error, 998 in_timestamp_internal); 999 return response && brillo::dbus_utils::ExtractMethodCallResults( 1000 response.get(), error); 1001 } 1002 1003 // The |timestamp_internal| arg is represented as the return value of 1004 // base::TimeTicks::ToInternalValue(). 1005 void HandlePowerButtonAcknowledgmentAsync( 1006 int64_t in_timestamp_internal, 1007 const base::Callback<void()>& success_callback, 1008 const base::Callback<void(brillo::Error*)>& error_callback, 1009 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 1010 brillo::dbus_utils::CallMethodWithTimeout( 1011 timeout_ms, 1012 dbus_object_proxy_, 1013 "org.chromium.PowerManager", 1014 "HandlePowerButtonAcknowledgment", 1015 success_callback, 1016 error_callback, 1017 in_timestamp_internal); 1018 } 1019 1020 // The |serialized_request_proto| arg is a serialized 1021 // power_manager::RegisterSuspendDelayRequest protobuf. 1022 // The |serialized_reply_proto| arg is a serialized 1023 // RegisterSuspendDelayReply protobuf. 1024 bool RegisterSuspendDelay( 1025 const std::vector<uint8_t>& in_serialized_request_proto, 1026 std::vector<uint8_t>* out_serialized_reply_proto, 1027 brillo::ErrorPtr* error, 1028 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 1029 auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( 1030 timeout_ms, 1031 dbus_object_proxy_, 1032 "org.chromium.PowerManager", 1033 "RegisterSuspendDelay", 1034 error, 1035 in_serialized_request_proto); 1036 return response && brillo::dbus_utils::ExtractMethodCallResults( 1037 response.get(), error, out_serialized_reply_proto); 1038 } 1039 1040 // The |serialized_request_proto| arg is a serialized 1041 // power_manager::RegisterSuspendDelayRequest protobuf. 1042 // The |serialized_reply_proto| arg is a serialized 1043 // RegisterSuspendDelayReply protobuf. 1044 void RegisterSuspendDelayAsync( 1045 const std::vector<uint8_t>& in_serialized_request_proto, 1046 const base::Callback<void(const std::vector<uint8_t>& /*serialized_reply_proto*/)>& success_callback, 1047 const base::Callback<void(brillo::Error*)>& error_callback, 1048 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 1049 brillo::dbus_utils::CallMethodWithTimeout( 1050 timeout_ms, 1051 dbus_object_proxy_, 1052 "org.chromium.PowerManager", 1053 "RegisterSuspendDelay", 1054 success_callback, 1055 error_callback, 1056 in_serialized_request_proto); 1057 } 1058 1059 // The |serialized_proto| arg is a serialized 1060 // power_manager::UnregisterSuspendDelayRequest protobuf. 1061 bool UnregisterSuspendDelay( 1062 const std::vector<uint8_t>& in_serialized_proto, 1063 brillo::ErrorPtr* error, 1064 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 1065 auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( 1066 timeout_ms, 1067 dbus_object_proxy_, 1068 "org.chromium.PowerManager", 1069 "UnregisterSuspendDelay", 1070 error, 1071 in_serialized_proto); 1072 return response && brillo::dbus_utils::ExtractMethodCallResults( 1073 response.get(), error); 1074 } 1075 1076 // The |serialized_proto| arg is a serialized 1077 // power_manager::UnregisterSuspendDelayRequest protobuf. 1078 void UnregisterSuspendDelayAsync( 1079 const std::vector<uint8_t>& in_serialized_proto, 1080 const base::Callback<void()>& success_callback, 1081 const base::Callback<void(brillo::Error*)>& error_callback, 1082 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 1083 brillo::dbus_utils::CallMethodWithTimeout( 1084 timeout_ms, 1085 dbus_object_proxy_, 1086 "org.chromium.PowerManager", 1087 "UnregisterSuspendDelay", 1088 success_callback, 1089 error_callback, 1090 in_serialized_proto); 1091 } 1092 1093 // The |serialized_proto| arg is a serialized 1094 // power_manager::SuspendReadinessInfo protobuf. 1095 bool HandleSuspendReadiness( 1096 const std::vector<uint8_t>& in_serialized_proto, 1097 brillo::ErrorPtr* error, 1098 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 1099 auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( 1100 timeout_ms, 1101 dbus_object_proxy_, 1102 "org.chromium.PowerManager", 1103 "HandleSuspendReadiness", 1104 error, 1105 in_serialized_proto); 1106 return response && brillo::dbus_utils::ExtractMethodCallResults( 1107 response.get(), error); 1108 } 1109 1110 // The |serialized_proto| arg is a serialized 1111 // power_manager::SuspendReadinessInfo protobuf. 1112 void HandleSuspendReadinessAsync( 1113 const std::vector<uint8_t>& in_serialized_proto, 1114 const base::Callback<void()>& success_callback, 1115 const base::Callback<void(brillo::Error*)>& error_callback, 1116 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 1117 brillo::dbus_utils::CallMethodWithTimeout( 1118 timeout_ms, 1119 dbus_object_proxy_, 1120 "org.chromium.PowerManager", 1121 "HandleSuspendReadiness", 1122 success_callback, 1123 error_callback, 1124 in_serialized_proto); 1125 } 1126 1127 // The |serialized_request_proto| arg is a serialized 1128 // power_manager::RegisterSuspendDelayRequest protobuf. 1129 // The |serialized_reply_proto| arg is a serialized 1130 // RegisterSuspendDelayReply protobuf. 1131 bool RegisterDarkSuspendDelay( 1132 const std::vector<uint8_t>& in_serialized_request_proto, 1133 std::vector<uint8_t>* out_serialized_reply_proto, 1134 brillo::ErrorPtr* error, 1135 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 1136 auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( 1137 timeout_ms, 1138 dbus_object_proxy_, 1139 "org.chromium.PowerManager", 1140 "RegisterDarkSuspendDelay", 1141 error, 1142 in_serialized_request_proto); 1143 return response && brillo::dbus_utils::ExtractMethodCallResults( 1144 response.get(), error, out_serialized_reply_proto); 1145 } 1146 1147 // The |serialized_request_proto| arg is a serialized 1148 // power_manager::RegisterSuspendDelayRequest protobuf. 1149 // The |serialized_reply_proto| arg is a serialized 1150 // RegisterSuspendDelayReply protobuf. 1151 void RegisterDarkSuspendDelayAsync( 1152 const std::vector<uint8_t>& in_serialized_request_proto, 1153 const base::Callback<void(const std::vector<uint8_t>& /*serialized_reply_proto*/)>& success_callback, 1154 const base::Callback<void(brillo::Error*)>& error_callback, 1155 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 1156 brillo::dbus_utils::CallMethodWithTimeout( 1157 timeout_ms, 1158 dbus_object_proxy_, 1159 "org.chromium.PowerManager", 1160 "RegisterDarkSuspendDelay", 1161 success_callback, 1162 error_callback, 1163 in_serialized_request_proto); 1164 } 1165 1166 // The |serialized_proto| arg is a serialized 1167 // power_manager::UnregisterSuspendDelayRequest protobuf. 1168 bool UnregisterDarkSuspendDelay( 1169 const std::vector<uint8_t>& in_serialized_proto, 1170 brillo::ErrorPtr* error, 1171 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 1172 auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( 1173 timeout_ms, 1174 dbus_object_proxy_, 1175 "org.chromium.PowerManager", 1176 "UnregisterDarkSuspendDelay", 1177 error, 1178 in_serialized_proto); 1179 return response && brillo::dbus_utils::ExtractMethodCallResults( 1180 response.get(), error); 1181 } 1182 1183 // The |serialized_proto| arg is a serialized 1184 // power_manager::UnregisterSuspendDelayRequest protobuf. 1185 void UnregisterDarkSuspendDelayAsync( 1186 const std::vector<uint8_t>& in_serialized_proto, 1187 const base::Callback<void()>& success_callback, 1188 const base::Callback<void(brillo::Error*)>& error_callback, 1189 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 1190 brillo::dbus_utils::CallMethodWithTimeout( 1191 timeout_ms, 1192 dbus_object_proxy_, 1193 "org.chromium.PowerManager", 1194 "UnregisterDarkSuspendDelay", 1195 success_callback, 1196 error_callback, 1197 in_serialized_proto); 1198 } 1199 1200 // The |serialized_proto| arg is a serialized 1201 // power_manager::SuspendReadinessInfo protobuf. 1202 bool HandleDarkSuspendReadiness( 1203 const std::vector<uint8_t>& in_serialized_proto, 1204 brillo::ErrorPtr* error, 1205 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 1206 auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( 1207 timeout_ms, 1208 dbus_object_proxy_, 1209 "org.chromium.PowerManager", 1210 "HandleDarkSuspendReadiness", 1211 error, 1212 in_serialized_proto); 1213 return response && brillo::dbus_utils::ExtractMethodCallResults( 1214 response.get(), error); 1215 } 1216 1217 // The |serialized_proto| arg is a serialized 1218 // power_manager::SuspendReadinessInfo protobuf. 1219 void HandleDarkSuspendReadinessAsync( 1220 const std::vector<uint8_t>& in_serialized_proto, 1221 const base::Callback<void()>& success_callback, 1222 const base::Callback<void(brillo::Error*)>& error_callback, 1223 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 1224 brillo::dbus_utils::CallMethodWithTimeout( 1225 timeout_ms, 1226 dbus_object_proxy_, 1227 "org.chromium.PowerManager", 1228 "HandleDarkSuspendReadiness", 1229 success_callback, 1230 error_callback, 1231 in_serialized_proto); 1232 } 1233 1234 // The |serialized_proto| arg is a serialized 1235 // power_manager::DarkResumeWakeReason protobuf. 1236 bool RecordDarkResumeWakeReason( 1237 const std::vector<uint8_t>& in_serialized_proto, 1238 brillo::ErrorPtr* error, 1239 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 1240 auto response = brillo::dbus_utils::CallMethodAndBlockWithTimeout( 1241 timeout_ms, 1242 dbus_object_proxy_, 1243 "org.chromium.PowerManager", 1244 "RecordDarkResumeWakeReason", 1245 error, 1246 in_serialized_proto); 1247 return response && brillo::dbus_utils::ExtractMethodCallResults( 1248 response.get(), error); 1249 } 1250 1251 // The |serialized_proto| arg is a serialized 1252 // power_manager::DarkResumeWakeReason protobuf. 1253 void RecordDarkResumeWakeReasonAsync( 1254 const std::vector<uint8_t>& in_serialized_proto, 1255 const base::Callback<void()>& success_callback, 1256 const base::Callback<void(brillo::Error*)>& error_callback, 1257 int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT) override { 1258 brillo::dbus_utils::CallMethodWithTimeout( 1259 timeout_ms, 1260 dbus_object_proxy_, 1261 "org.chromium.PowerManager", 1262 "RecordDarkResumeWakeReason", 1263 success_callback, 1264 error_callback, 1265 in_serialized_proto); 1266 } 1267 1268 private: 1269 scoped_refptr<dbus::Bus> bus_; 1270 const std::string service_name_{"org.chromium.PowerManager"}; 1271 const dbus::ObjectPath object_path_{"/org/chromium/PowerManager"}; 1272 dbus::ObjectProxy* dbus_object_proxy_; 1273 1274 DISALLOW_COPY_AND_ASSIGN(PowerManagerProxy); 1275 }; 1276 1277 } // namespace chromium 1278 } // namespace org 1279 1280 #endif // ____CHROMEOS_DBUS_BINDING____________________BUILD_LINK_TMP_PORTAGE_CHROMEOS_BASE_POWER_MANAGER_9999_WORK_BUILD_OUT_DEFAULT_GEN_INCLUDE_POWER_MANAGER_DBUS_PROXIES_H 1281