Darin Petkov | 394b7d4 | 2011-11-03 15:48:02 +0100 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef SHILL_POWER_MANAGER_PROXY_INTERFACE_ |
| 6 | #define SHILL_POWER_MANAGER_PROXY_INTERFACE_ |
| 7 | |
| 8 | #include <base/basictypes.h> |
| 9 | |
| 10 | namespace shill { |
| 11 | |
| 12 | class PowerManagerProxyInterface { |
| 13 | public: |
| 14 | virtual ~PowerManagerProxyInterface() {} |
| 15 | |
| 16 | // Sends a request to PowerManager to wait for this RPC client for up to |
| 17 | // |delay_ms| before suspending the system. When initiating suspend, |
| 18 | // PowerManager broadcasts a SuspendDelay signal and suspends the system after |
| 19 | // the maximal registered timeout expires or all registered clients are ready |
| 20 | // to suspend. Clients tell PowerManager that they are ready through the |
| 21 | // SuspendReady signal. |
| 22 | // |
| 23 | // TODO(petkov): Implement SuspendReady signal sending to |
| 24 | // PowerManager. Unfortunately, SuspendReady is declared as a signal when it |
| 25 | // should be a method. |
| 26 | virtual void RegisterSuspendDelay(uint32 delay_ms) = 0; |
| 27 | }; |
| 28 | |
| 29 | // PowerManager signal delegate to be associated with the proxy. |
| 30 | class PowerManagerProxyDelegate { |
| 31 | public: |
| 32 | virtual ~PowerManagerProxyDelegate() {} |
| 33 | |
| 34 | // Broadcasted by PowerManager when it initiates suspend. RPC clients that |
| 35 | // have registered through RegisterSuspendDelay tell PowerManager that they're |
| 36 | // ready to suspend by sending a SuspendReady signal with the same |
| 37 | // |sequence_number|. |
| 38 | virtual void OnSuspendDelay(uint32 sequence_number) = 0; |
| 39 | }; |
| 40 | |
| 41 | } // namespace shill |
| 42 | |
| 43 | #endif // SHILL_POWER_MANAGER_PROXY_INTERFACE_ |