1 // Copyright (c) 2013 Intel Corporation. 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.
5 #ifndef POWER_POWER_EVENT_SOURCE_TIZEN_H_
6 #define POWER_POWER_EVENT_SOURCE_TIZEN_H_
11 class PowerEventListener {
13 virtual void OnPowerStateChanged(power_state_e state) = 0;
15 // We don't use listener interface to destroy them, so protected and
16 // non-virtual destructor is fine.
17 ~PowerEventListener() {}
20 // Track power changed events from Tizen native library. The library supports
21 // only one callback, so this class multiplexes to the different instances that
22 // maybe listening for event changes.
23 class PowerEventSource {
28 void AddListener(PowerEventListener* listener);
29 void RemoveListener(PowerEventListener* listener);
32 // Handler for callback in power.h library.
33 static void OnPowerChangedCallback(power_state_e state, void* user_data);
35 void DispatchEvent(power_state_e state);
37 std::list<PowerEventListener*> listeners_;
40 #endif // POWER_POWER_EVENT_SOURCE_TIZEN_H_