mirror of
https://gitlab.com/ubports/development/core/hybris-support/libmce-glib-repowerd-stub
synced 2025-11-03 20:45:44 +08:00
Switched to use repowerd compatible dbus messages
This commit is contained in:
3
Makefile
3
Makefile
@@ -42,8 +42,7 @@ SRC = \
|
||||
mce_proxy.c \
|
||||
mce_tklock.c
|
||||
GEN_SRC = \
|
||||
com.nokia.mce.request.c \
|
||||
com.nokia.mce.signal.c
|
||||
com.canonical.Unity.Screen.c
|
||||
|
||||
#
|
||||
# Directories
|
||||
|
||||
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Repowerd compatibility layer for sailfish ofono-ril
|
||||
|
||||
MCE Client switched to reference repowerd
|
||||
20
spec/com.canonical.Unity.Screen.xml
Normal file
20
spec/com.canonical.Unity.Screen.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE node PUBLIC
|
||||
"-//freedesktop//DTD D-Bus Object Introspection 1.0//EN"
|
||||
"http://standards.freedesktop.org/dbus/1.0/introspect.dtd">
|
||||
<node name="/com/canonical/Unity/Screen">
|
||||
<interface name="com.canonical.Unity.Screen">
|
||||
<method name="getDisplayStatus">
|
||||
<arg direction="out" name="displayState" type="s"/>
|
||||
</method>
|
||||
<method name="getTklockMode">
|
||||
<arg direction="out" name="modeName" type="s"/>
|
||||
</method>
|
||||
<signal name="displayStatusInd">
|
||||
<arg name="displayState" type="s"/>
|
||||
</signal>
|
||||
<signal name="tklockModeInd">
|
||||
<arg name="modeName" type="s"/>
|
||||
</signal>
|
||||
</interface>
|
||||
</node>
|
||||
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE node PUBLIC
|
||||
"-//freedesktop//DTD D-Bus Object Introspection 1.0//EN"
|
||||
"http://standards.freedesktop.org/dbus/1.0/introspect.dtd">
|
||||
<node name="/com/nokia/mce/request">
|
||||
<interface name="com.nokia.mce.request">
|
||||
<method name="get_display_status">
|
||||
<arg direction="out" name="display_state" type="s"/>
|
||||
</method>
|
||||
<method name="get_tklock_mode">
|
||||
<arg direction="out" name="mode_name" type="s"/>
|
||||
</method>
|
||||
</interface>
|
||||
</node>
|
||||
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE node PUBLIC
|
||||
"-//freedesktop//DTD D-Bus Object Introspection 1.0//EN"
|
||||
"http://standards.freedesktop.org/dbus/1.0/introspect.dtd">
|
||||
<node name="/com/nokia/mce/signal">
|
||||
<interface name="com.nokia.mce.signal">
|
||||
<signal name="display_status_ind">
|
||||
<arg name="display_state" type="s"/>
|
||||
</signal>
|
||||
<signal name="tklock_mode_ind">
|
||||
<arg name="tklock_mode" type="s"/>
|
||||
</signal>
|
||||
</interface>
|
||||
</node>
|
||||
@@ -38,14 +38,10 @@
|
||||
#include "mce_proxy.h"
|
||||
#include "mce_log_p.h"
|
||||
|
||||
#include <mce/dbus-names.h>
|
||||
#include <mce/mode-names.h>
|
||||
|
||||
#include <gutil_misc.h>
|
||||
|
||||
/* Generated headers */
|
||||
#include "com.nokia.mce.request.h"
|
||||
#include "com.nokia.mce.signal.h"
|
||||
#include "com.canonical.Unity.Screen.h"
|
||||
|
||||
struct mce_display_priv {
|
||||
MceProxy* proxy;
|
||||
@@ -62,6 +58,12 @@ enum mce_display_signal {
|
||||
#define SIGNAL_VALID_CHANGED_NAME "mce-display-valid-changed"
|
||||
#define SIGNAL_STATE_CHANGED_NAME "mce-display-state-changed"
|
||||
|
||||
#define MCE_DISPLAY_OFF_STRING "off"
|
||||
#define MCE_DISPLAY_DIM_STRING "dim"
|
||||
#define MCE_DISPLAY_ON_STRING "on"
|
||||
|
||||
#define MCE_DISPLAY_SIG "displayStatusInd"
|
||||
|
||||
static guint mce_display_signals[SIGNAL_COUNT] = { 0 };
|
||||
|
||||
typedef GObjectClass MceDisplayClass;
|
||||
@@ -113,8 +115,8 @@ mce_display_status_query_done(
|
||||
char* status = NULL;
|
||||
MceDisplay* self = MCE_DISPLAY(arg);
|
||||
|
||||
if (com_nokia_mce_request_call_get_display_status_finish(
|
||||
COM_NOKIA_MCE_REQUEST(proxy), &status, result, &error)) {
|
||||
if (com_canonical_unity_screen_call_get_display_status_finish(
|
||||
COM_CANONICAL_UNITY_SCREEN(proxy), &status, result, &error)) {
|
||||
GDEBUG("Display is currently %s", status);
|
||||
mce_display_status_update(self, status);
|
||||
g_free(status);
|
||||
@@ -134,7 +136,7 @@ mce_display_status_query_done(
|
||||
static
|
||||
void
|
||||
mce_display_status_ind(
|
||||
ComNokiaMceSignal* proxy,
|
||||
ComCanonicalUnityScreen* proxy,
|
||||
const char* status,
|
||||
gpointer arg)
|
||||
{
|
||||
@@ -161,7 +163,7 @@ mce_display_status_query(
|
||||
MCE_DISPLAY_SIG, G_CALLBACK(mce_display_status_ind), self);
|
||||
}
|
||||
if (proxy->request && proxy->valid) {
|
||||
com_nokia_mce_request_call_get_display_status(proxy->request, NULL,
|
||||
com_canonical_unity_screen_call_get_display_status(proxy->request, NULL,
|
||||
mce_display_status_query_done, mce_display_ref(self));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,11 +37,8 @@
|
||||
#include "mce_proxy.h"
|
||||
#include "mce_log_p.h"
|
||||
|
||||
#include "mce/dbus-names.h"
|
||||
|
||||
/* Generated headers */
|
||||
#include "com.nokia.mce.request.h"
|
||||
#include "com.nokia.mce.signal.h"
|
||||
#include "com.canonical.Unity.Screen.h"
|
||||
|
||||
GLOG_MODULE_DEFINE("mce");
|
||||
|
||||
@@ -57,6 +54,10 @@ enum mce_proxy_signal {
|
||||
|
||||
#define SIGNAL_VALID_CHANGED_NAME "mce-proxy-valid-changed"
|
||||
|
||||
#define MCE_SERVICE "com.canonical.Unity.Screen"
|
||||
#define MCE_REQUEST_PATH "/com/canonical/Unity/Screen"
|
||||
#define MCE_SIGNAL_PATH "/com/canonical/Unity/Screen"
|
||||
|
||||
static guint mce_proxy_signals[SIGNAL_COUNT] = { 0 };
|
||||
|
||||
typedef GObjectClass MceProxyClass;
|
||||
|
||||
@@ -40,15 +40,14 @@
|
||||
#include "mce_types.h"
|
||||
|
||||
typedef struct mce_proxy_priv MceProxyPriv;
|
||||
struct _ComNokiaMceSignal;
|
||||
struct _ComNokiaMceRequest;
|
||||
struct _ComCanonicalUnityScreen;
|
||||
|
||||
typedef struct mce_proxy {
|
||||
GObject object;
|
||||
MceProxyPriv* priv;
|
||||
gboolean valid;
|
||||
struct _ComNokiaMceSignal* signal;
|
||||
struct _ComNokiaMceRequest* request;
|
||||
struct _ComCanonicalUnityScreen* signal;
|
||||
struct _ComCanonicalUnityScreen* request;
|
||||
} MceProxy;
|
||||
|
||||
typedef void
|
||||
|
||||
@@ -38,14 +38,10 @@
|
||||
#include "mce_proxy.h"
|
||||
#include "mce_log_p.h"
|
||||
|
||||
#include <mce/dbus-names.h>
|
||||
#include <mce/mode-names.h>
|
||||
|
||||
#include <gutil_misc.h>
|
||||
|
||||
/* Generated headers */
|
||||
#include "com.nokia.mce.request.h"
|
||||
#include "com.nokia.mce.signal.h"
|
||||
#include "com.canonical.Unity.Screen.h"
|
||||
|
||||
struct mce_tklock_priv {
|
||||
MceProxy* proxy;
|
||||
@@ -64,6 +60,16 @@ enum mce_tklock_signal {
|
||||
#define SIGNAL_MODE_CHANGED_NAME "mce-tklock-mode-changed"
|
||||
#define SIGNAL_LOCKED_CHANGED_NAME "mce-tklock-locked-changed"
|
||||
|
||||
#define MCE_TK_LOCKED "locked"
|
||||
#define MCE_TK_UNLOCKED "unlocked"
|
||||
#define MCE_TK_SILENT_LOCKED "silent-locked"
|
||||
#define MCE_TK_LOCKED_DIM "locked-dim"
|
||||
#define MCE_TK_SILENT_LOCKED_DIM "silent-locked-dim"
|
||||
#define MCE_TK_SILENT_UNLOCKED "silent-unlocked"
|
||||
#define MCE_TK_LOCKED_DELAY "locked-delay"
|
||||
|
||||
#define MCE_DISPLAY_SIG "displayStatusInd"
|
||||
|
||||
static guint mce_tklock_signals[SIGNAL_COUNT] = { 0 };
|
||||
|
||||
typedef GObjectClass MceTklockClass;
|
||||
@@ -135,8 +141,8 @@ mce_tklock_mode_query_done(
|
||||
char* status = NULL;
|
||||
MceTklock* self = MCE_TKLOCK(arg);
|
||||
|
||||
if (com_nokia_mce_request_call_get_tklock_mode_finish(
|
||||
COM_NOKIA_MCE_REQUEST(proxy), &status, result, &error)) {
|
||||
if (com_canonical_unity_screen_call_get_tklock_mode_finish(
|
||||
COM_CANONICAL_UNITY_SCREEN(proxy), &status, result, &error)) {
|
||||
GDEBUG("Mode is currently %s", status);
|
||||
mce_tklock_mode_update(self, status);
|
||||
g_free(status);
|
||||
@@ -156,7 +162,7 @@ mce_tklock_mode_query_done(
|
||||
static
|
||||
void
|
||||
mce_tklock_mode_ind(
|
||||
ComNokiaMceSignal* proxy,
|
||||
ComCanonicalUnityScreen* proxy,
|
||||
const char* mode,
|
||||
gpointer arg)
|
||||
{
|
||||
@@ -180,10 +186,10 @@ mce_tklock_mode_query(
|
||||
*/
|
||||
if (proxy->signal && !priv->tklock_mode_ind_id) {
|
||||
priv->tklock_mode_ind_id = g_signal_connect(proxy->signal,
|
||||
MCE_TKLOCK_MODE_SIG, G_CALLBACK(mce_tklock_mode_ind), self);
|
||||
MCE_DISPLAY_SIG, G_CALLBACK(mce_tklock_mode_ind), self);
|
||||
}
|
||||
if (proxy->request && proxy->valid) {
|
||||
com_nokia_mce_request_call_get_tklock_mode(proxy->request, NULL,
|
||||
com_canonical_unity_screen_call_get_tklock_mode(proxy->request, NULL,
|
||||
mce_tklock_mode_query_done, mce_tklock_ref(self));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user