2
* Copyright © 2015 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 3 as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
19
#ifndef USC_UNITY_SCREEN_SERVICE_H_
20
#define USC_UNITY_SCREEN_SERVICE_H_
22
#include "dbus_event_loop.h"
23
#include "dbus_connection_handle.h"
25
#include <mir_toolkit/common.h>
32
#include <unordered_map>
34
enum class PowerStateChangeReason;
41
class UnityScreenService
45
std::string const& bus_addr,
46
std::shared_ptr<usc::Screen> const& screen);
47
~UnityScreenService();
52
static ::DBusHandlerResult handle_dbus_message_thunk(
53
DBusConnection* connection, DBusMessage* message, void* user_data);
54
::DBusHandlerResult handle_dbus_message(
55
DBusConnection* connection, DBusMessage* message, void* user_data);
57
void dbus_setUserBrightness(int32_t brightness);
58
void dbus_userAutobrightnessEnable(dbus_bool_t enable);
59
void dbus_setInactivityTimeouts(int32_t poweroff_timeout, int32_t dimmer_timeout);
60
void dbus_setTouchVisualizationEnabled(dbus_bool_t enable);
61
bool dbus_setScreenPowerMode(std::string const& mode, int32_t reason);
62
int32_t dbus_keepDisplayOn(std::string const& sender);
63
void dbus_removeDisplayOnRequest(std::string const& sender, int32_t id);
64
void dbus_NameOwnerChanged(
65
std::string const& name,
66
std::string const& old_owner,
67
std::string const& new_owner);
68
void dbus_emit_DisplayPowerStateChange(
69
MirPowerMode power_mode, PowerStateChangeReason reason);
71
DBusConnectionHandle const connection;
72
std::shared_ptr<usc::Screen> const screen;
74
DBusEventLoop dbus_event_loop;
75
std::thread dbus_loop_thread;
76
std::mutex keep_display_on_mutex;
77
std::unordered_multimap<std::string,int32_t> keep_display_on_ids;