[libmce] Initial commit
This commit is contained in:
12
.gitignore
vendored
Normal file
12
.gitignore
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
*~
|
||||
debian/files
|
||||
debian/libmce-glib
|
||||
debian/libmce-glib-dev
|
||||
debian/*.debhelper.log
|
||||
debian/*.debhelper
|
||||
debian/*.substvars
|
||||
debian/tmp
|
||||
documentation.list
|
||||
installroot
|
||||
build
|
||||
RPMS
|
||||
216
Makefile
Normal file
216
Makefile
Normal file
@@ -0,0 +1,216 @@
|
||||
# -*- Mode: makefile-gmake -*-
|
||||
|
||||
.PHONY: clean all debug release pkgconfig
|
||||
|
||||
#
|
||||
# Required packages
|
||||
#
|
||||
|
||||
PKGS = glib-2.0 gio-2.0 gio-unix-2.0 libglibutil
|
||||
|
||||
#
|
||||
# Default target
|
||||
#
|
||||
|
||||
all: debug release pkgconfig
|
||||
|
||||
#
|
||||
# Library version
|
||||
#
|
||||
|
||||
VERSION_MAJOR = 1
|
||||
VERSION_MINOR = 0
|
||||
VERSION_RELEASE = 0
|
||||
|
||||
# Version for pkg-config
|
||||
PCVERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE)
|
||||
|
||||
NAME = mce-glib
|
||||
LIB_NAME = lib$(NAME)
|
||||
LIB_DEV_SYMLINK = $(LIB_NAME).so
|
||||
LIB_SYMLINK1 = $(LIB_DEV_SYMLINK).$(VERSION_MAJOR)
|
||||
LIB_SYMLINK2 = $(LIB_SYMLINK1).$(VERSION_MINOR)
|
||||
LIB_SONAME = $(LIB_SYMLINK1)
|
||||
LIB = $(LIB_SONAME).$(VERSION_MINOR).$(VERSION_RELEASE)
|
||||
|
||||
#
|
||||
# Sources
|
||||
#
|
||||
|
||||
SRC = \
|
||||
mce_display.c \
|
||||
mce_proxy.c
|
||||
GEN_SRC = \
|
||||
com.nokia.mce.c
|
||||
|
||||
#
|
||||
# Directories
|
||||
#
|
||||
|
||||
SRC_DIR = src
|
||||
INCLUDE_DIR = include
|
||||
BUILD_DIR = build
|
||||
GEN_DIR = $(BUILD_DIR)
|
||||
SPEC_DIR = spec
|
||||
DEBUG_BUILD_DIR = $(BUILD_DIR)/debug
|
||||
RELEASE_BUILD_DIR = $(BUILD_DIR)/release
|
||||
|
||||
#
|
||||
# Tools and flags
|
||||
#
|
||||
|
||||
CC = $(CROSS_COMPILE)gcc
|
||||
LD = $(CC)
|
||||
WARNINGS = -Wall -Wno-unused-parameter -Wno-multichar
|
||||
INCLUDES = -I$(INCLUDE_DIR) -I$(GEN_DIR)
|
||||
BASE_FLAGS = -fPIC $(CFLAGS)
|
||||
FULL_CFLAGS = $(BASE_FLAGS) $(DEFINES) $(WARNINGS) $(INCLUDES) -MMD -MP \
|
||||
$(shell pkg-config --cflags $(PKGS))
|
||||
LDFLAGS = $(BASE_FLAGS) -shared -Wl,-soname -Wl,$(LIB_SONAME) \
|
||||
$(shell pkg-config --libs $(PKGS))
|
||||
DEBUG_FLAGS = -g
|
||||
RELEASE_FLAGS =
|
||||
|
||||
ifndef KEEP_SYMBOLS
|
||||
KEEP_SYMBOLS = 0
|
||||
endif
|
||||
|
||||
ifneq ($(KEEP_SYMBOLS),0)
|
||||
RELEASE_FLAGS += -g
|
||||
endif
|
||||
|
||||
DEBUG_CFLAGS = $(FULL_CFLAGS) $(DEBUG_FLAGS) -DDEBUG
|
||||
RELEASE_CFLAGS = $(FULL_CFLAGS) $(RELEASE_FLAGS) -O2
|
||||
DEBUG_LDFLAGS = $(LDFLAGS) $(DEBUG_FLAGS)
|
||||
RELEASE_LDFLAGS = $(LDFLAGS) $(RELEASE_FLAGS)
|
||||
|
||||
#
|
||||
# Files
|
||||
#
|
||||
|
||||
PKGCONFIG = \
|
||||
$(BUILD_DIR)/$(LIB_NAME).pc
|
||||
DEBUG_OBJS = \
|
||||
$(GEN_SRC:%.c=$(DEBUG_BUILD_DIR)/%.o) \
|
||||
$(SRC:%.c=$(DEBUG_BUILD_DIR)/%.o)
|
||||
RELEASE_OBJS = \
|
||||
$(GEN_SRC:%.c=$(RELEASE_BUILD_DIR)/%.o) \
|
||||
$(SRC:%.c=$(RELEASE_BUILD_DIR)/%.o)
|
||||
GEN_FILES = $(GEN_SRC:%=$(GEN_DIR)/%)
|
||||
.PRECIOUS: $(GEN_FILES)
|
||||
|
||||
#
|
||||
# Dependencies
|
||||
#
|
||||
|
||||
DEPS = $(DEBUG_OBJS:%.o=%.d) $(RELEASE_OBJS:%.o=%.d)
|
||||
ifneq ($(MAKECMDGOALS),clean)
|
||||
ifneq ($(strip $(DEPS)),)
|
||||
-include $(DEPS)
|
||||
endif
|
||||
endif
|
||||
|
||||
$(GEN_FILES): | $(GEN_DIR)
|
||||
$(DEBUG_OBJS): | $(DEBUG_BUILD_DIR)
|
||||
$(RELEASE_OBJS): | $(RELEASE_BUILD_DIR)
|
||||
|
||||
#
|
||||
# Rules
|
||||
#
|
||||
|
||||
DEBUG_LIB = $(DEBUG_BUILD_DIR)/$(LIB)
|
||||
RELEASE_LIB = $(RELEASE_BUILD_DIR)/$(LIB)
|
||||
DEBUG_LINK = $(DEBUG_BUILD_DIR)/$(LIB_SONAME)
|
||||
RELEASE_LINK = $(RELEASE_BUILD_DIR)/$(LIB_SONAME)
|
||||
|
||||
debug: $(DEBUG_LIB) $(DEBUG_LINK)
|
||||
|
||||
release: $(RELEASE_LIB) $(RELEASE_LINK)
|
||||
|
||||
pkgconfig: $(PKGCONFIG)
|
||||
|
||||
clean:
|
||||
rm -f *~ $(SRC_DIR)/*~ $(INCLUDE_DIR)/*~ rpm/*~
|
||||
rm -fr $(BUILD_DIR) RPMS installroot
|
||||
rm -fr debian/tmp debian/lib$(NAME) debian/lib$(NAME)-dev
|
||||
rm -f documentation.list debian/files debian/*.substvars
|
||||
rm -f debian/*.debhelper.log debian/*.debhelper debian/*~
|
||||
|
||||
$(GEN_DIR):
|
||||
mkdir -p $@
|
||||
|
||||
$(DEBUG_BUILD_DIR):
|
||||
mkdir -p $@
|
||||
|
||||
$(RELEASE_BUILD_DIR):
|
||||
mkdir -p $@
|
||||
|
||||
$(GEN_DIR)/%.c: $(SPEC_DIR)/%.xml
|
||||
gdbus-codegen --generate-c-code $(@:%.c=%) $<
|
||||
|
||||
$(DEBUG_BUILD_DIR)/%.o : $(GEN_DIR)/%.c
|
||||
$(CC) -c -I. $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
|
||||
|
||||
$(RELEASE_BUILD_DIR)/%.o : $(GEN_DIR)/%.c
|
||||
$(CC) -c -I. $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
|
||||
|
||||
$(DEBUG_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
|
||||
$(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
|
||||
|
||||
$(RELEASE_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
|
||||
$(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
|
||||
|
||||
$(DEBUG_LIB): $(DEBUG_BUILD_DIR) $(DEBUG_OBJS)
|
||||
$(LD) $(DEBUG_OBJS) $(DEBUG_LDFLAGS) -o $@
|
||||
|
||||
$(RELEASE_LIB): $(RELEASE_BUILD_DIR) $(RELEASE_OBJS)
|
||||
$(LD) $(RELEASE_OBJS) $(RELEASE_LDFLAGS) -o $@
|
||||
ifeq ($(KEEP_SYMBOLS),0)
|
||||
strip $@
|
||||
endif
|
||||
|
||||
$(DEBUG_LINK):
|
||||
ln -sf $(LIB) $@
|
||||
|
||||
$(RELEASE_LINK):
|
||||
ln -sf $(LIB) $@
|
||||
|
||||
$(PKGCONFIG): $(LIB_NAME).pc.in
|
||||
sed -e 's/\[version\]/'$(PCVERSION)/g $< > $@
|
||||
|
||||
#
|
||||
# Install
|
||||
#
|
||||
|
||||
INSTALL_PERM = 644
|
||||
INSTALL_OWNER = $(shell id -u)
|
||||
INSTALL_GROUP = $(shell id -g)
|
||||
|
||||
INSTALL = install
|
||||
INSTALL_DIRS = $(INSTALL) -d
|
||||
INSTALL_FILES = $(INSTALL) -m $(INSTALL_PERM)
|
||||
|
||||
INSTALL_LIB_DIR = $(DESTDIR)/usr/lib
|
||||
INSTALL_INCLUDE_DIR = $(DESTDIR)/usr/include/$(LIB_NAME)
|
||||
INSTALL_PKGCONFIG_DIR = $(DESTDIR)/usr/lib/pkgconfig
|
||||
|
||||
INSTALL_ALIAS = $(INSTALL_LIB_DIR)/$(LIB_SHORTCUT)
|
||||
|
||||
install: $(INSTALL_LIB_DIR)
|
||||
$(INSTALL_FILES) $(RELEASE_LIB) $(INSTALL_LIB_DIR)
|
||||
ln -sf $(LIB) $(INSTALL_LIB_DIR)/$(LIB_SYMLINK2)
|
||||
ln -sf $(LIB_SYMLINK2) $(INSTALL_LIB_DIR)/$(LIB_SYMLINK1)
|
||||
|
||||
install-dev: install $(INSTALL_INCLUDE_DIR) $(INSTALL_PKGCONFIG_DIR)
|
||||
$(INSTALL_FILES) $(INCLUDE_DIR)/*.h $(INSTALL_INCLUDE_DIR)
|
||||
$(INSTALL_FILES) $(PKGCONFIG) $(INSTALL_PKGCONFIG_DIR)
|
||||
ln -sf $(LIB_SYMLINK1) $(INSTALL_LIB_DIR)/$(LIB_DEV_SYMLINK)
|
||||
|
||||
$(INSTALL_LIB_DIR):
|
||||
$(INSTALL_DIRS) $@
|
||||
|
||||
$(INSTALL_INCLUDE_DIR):
|
||||
$(INSTALL_DIRS) $@
|
||||
|
||||
$(INSTALL_PKGCONFIG_DIR):
|
||||
$(INSTALL_DIRS) $@
|
||||
5
debian/changelog
vendored
Normal file
5
debian/changelog
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
libmce-glib (1.0.0) unstable; urgency=low
|
||||
|
||||
* Initial release
|
||||
|
||||
-- Slava Monich <slava.monich@jolla.com> Thu, 06 Oct 2016 13:15:12 +0300
|
||||
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
@@ -0,0 +1 @@
|
||||
5
|
||||
18
debian/control
vendored
Normal file
18
debian/control
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
Source: libmce-glib
|
||||
Section: libs
|
||||
Priority: optional
|
||||
Maintainer: Slava Monich <slava.monich@jolla.com>
|
||||
Build-Depends: debhelper (>= 7), libglib2.0-dev (>= 2.0), libglibutil-dev
|
||||
Standards-Version: 3.8.4
|
||||
|
||||
Package: libmce-glib
|
||||
Section: libs
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: Client library for mce
|
||||
|
||||
Package: libmce-glib-dev
|
||||
Section: libdevel
|
||||
Architecture: any
|
||||
Depends: libmce-glib (= ${binary:Version}), ${misc:Depends}
|
||||
Description: Development files for libmce-glib
|
||||
32
debian/copyright
vendored
Normal file
32
debian/copyright
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
Copyright (C) 2016 Jolla Ltd.
|
||||
|
||||
You may use this file under the terms of BSD license as follows:
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of Jolla Ltd nor the names of its contributors may
|
||||
be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation
|
||||
are those of the authors and should not be interpreted as representing
|
||||
any official policies, either expressed or implied.
|
||||
3
debian/libmce-glib-dev.install
vendored
Normal file
3
debian/libmce-glib-dev.install
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
debian/tmp/usr/lib/libmce-glib.so usr/lib
|
||||
include/*.h usr/include/libmce-glib
|
||||
build/libmce-glib.pc usr/lib/pkgconfig
|
||||
1
debian/libmce-glib.install
vendored
Normal file
1
debian/libmce-glib.install
vendored
Normal file
@@ -0,0 +1 @@
|
||||
debian/tmp/usr/lib/libmce-glib.so.* usr/lib
|
||||
11
debian/rules
vendored
Executable file
11
debian/rules
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/make -f
|
||||
# -*- makefile -*-
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
override_dh_auto_install:
|
||||
dh_auto_install -- install-dev
|
||||
|
||||
%:
|
||||
dh $@
|
||||
1
debian/source/format
vendored
Normal file
1
debian/source/format
vendored
Normal file
@@ -0,0 +1 @@
|
||||
1.0
|
||||
103
include/mce_display.h
Normal file
103
include/mce_display.h
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Jolla Ltd.
|
||||
* Contact: Slava Monich <slava.monich@jolla.com>
|
||||
*
|
||||
* You may use this file under the terms of BSD license as follows:
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of Jolla Ltd nor the names of its contributors may
|
||||
* be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation
|
||||
* are those of the authors and should not be interpreted as representing
|
||||
* any official policies, either expressed or implied.
|
||||
*/
|
||||
|
||||
#ifndef MCE_DISPLAY_H
|
||||
#define MCE_DISPLAY_H
|
||||
|
||||
#include "mce_types.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef enum mce_display_state {
|
||||
MCE_DISPLAY_STATE_OFF,
|
||||
MCE_DISPLAY_STATE_DIM,
|
||||
MCE_DISPLAY_STATE_ON
|
||||
} MCE_DISPLAY_STATE;
|
||||
|
||||
typedef struct mce_display_priv MceDisplayPriv;
|
||||
|
||||
typedef struct mce_display {
|
||||
GObject object;
|
||||
MceDisplayPriv* priv;
|
||||
gboolean valid;
|
||||
MCE_DISPLAY_STATE state;
|
||||
} MceDisplay;
|
||||
|
||||
typedef void
|
||||
(*MceDisplayFunc)(
|
||||
MceDisplay* display,
|
||||
void* arg);
|
||||
|
||||
MceDisplay*
|
||||
mce_display_new(
|
||||
void);
|
||||
|
||||
MceDisplay*
|
||||
mce_display_ref(
|
||||
MceDisplay* display);
|
||||
|
||||
void
|
||||
mce_display_unref(
|
||||
MceDisplay* display);
|
||||
|
||||
gulong
|
||||
mce_display_add_valid_changed_handler(
|
||||
MceDisplay* display,
|
||||
MceDisplayFunc fn,
|
||||
void* arg);
|
||||
|
||||
gulong
|
||||
mce_display_add_state_changed_handler(
|
||||
MceDisplay* display,
|
||||
MceDisplayFunc fn,
|
||||
void* arg);
|
||||
|
||||
void
|
||||
mce_display_remove_handler(
|
||||
MceDisplay* display,
|
||||
gulong id);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* MCE_DISPLAY_H */
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*/
|
||||
58
include/mce_log.h
Normal file
58
include/mce_log.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Jolla Ltd.
|
||||
* Contact: Slava Monich <slava.monich@jolla.com>
|
||||
*
|
||||
* You may use this file under the terms of BSD license as follows:
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of Jolla Ltd nor the names of its contributors may
|
||||
* be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation
|
||||
* are those of the authors and should not be interpreted as representing
|
||||
* any official policies, either expressed or implied.
|
||||
*/
|
||||
|
||||
#ifndef MCE_LOG_H
|
||||
#define MCE_LOG_H
|
||||
|
||||
#include "mce_types.h"
|
||||
#include <gutil_types.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define MCE_LOG_MODULE mce_log
|
||||
extern GLogModule MCE_LOG_MODULE;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* MCE_LOG_H */
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*/
|
||||
51
include/mce_types.h
Normal file
51
include/mce_types.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Jolla Ltd.
|
||||
* Contact: Slava Monich <slava.monich@jolla.com>
|
||||
*
|
||||
* You may use this file under the terms of BSD license as follows:
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of Jolla Ltd nor the names of its contributors may
|
||||
* be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation
|
||||
* are those of the authors and should not be interpreted as representing
|
||||
* any official policies, either expressed or implied.
|
||||
*/
|
||||
|
||||
#ifndef MCE_TYPES_H
|
||||
#define MCE_TYPES_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#endif /* MCE_TYPES_H */
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*/
|
||||
9
libmce-glib.pc.in
Normal file
9
libmce-glib.pc.in
Normal file
@@ -0,0 +1,9 @@
|
||||
libdir=/usr/lib
|
||||
includedir=/usr/include
|
||||
|
||||
Name: libmce-glib
|
||||
Description: MCE client library
|
||||
Version: [version]
|
||||
Requires: libglibutil glib-2.0 gio-2.0
|
||||
Libs: -lmce-glib
|
||||
Cflags: -I${includedir}/libmce-glib
|
||||
47
rpm/libmce-glib.spec
Normal file
47
rpm/libmce-glib.spec
Normal file
@@ -0,0 +1,47 @@
|
||||
Name: libmce-glib
|
||||
Version: 1.0.0
|
||||
Release: 0
|
||||
Summary: MCE client library
|
||||
Group: Development/Libraries
|
||||
License: BSD
|
||||
URL: https://git.merproject.org/mer-core/libmce-glib
|
||||
Source: %{name}-%{version}.tar.bz2
|
||||
BuildRequires: pkgconfig(glib-2.0)
|
||||
BuildRequires: pkgconfig(libglibutil)
|
||||
Requires(post): /sbin/ldconfig
|
||||
Requires(postun): /sbin/ldconfig
|
||||
|
||||
%description
|
||||
Provides glib-based MCE client API
|
||||
|
||||
%package devel
|
||||
Summary: Development library for %{name}
|
||||
Requires: %{name} = %{version}
|
||||
Requires: pkgconfig
|
||||
|
||||
%description devel
|
||||
This package contains the development library for %{name}.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
make KEEP_SYMBOLS=1 release pkgconfig
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
make install-dev DESTDIR=%{buildroot}
|
||||
|
||||
%post -p /sbin/ldconfig
|
||||
|
||||
%postun -p /sbin/ldconfig
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%{_libdir}/%{name}.so.*
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root,-)
|
||||
%{_libdir}/pkgconfig/*.pc
|
||||
%{_libdir}/%{name}.so
|
||||
%{_includedir}/%{name}/*.h
|
||||
18
spec/com.nokia.mce.xml
Normal file
18
spec/com.nokia.mce.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?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">
|
||||
<!-- com.nokia.mce.request -->
|
||||
<interface name="com.nokia.mce.request">
|
||||
<method name="get_display_status">
|
||||
<arg direction="out" name="display_state" type="s"/>
|
||||
</method>
|
||||
</interface>
|
||||
<!-- com.nokia.mce.signal -->
|
||||
<interface name="com.nokia.mce.signal">
|
||||
<signal name="display_status_ind">
|
||||
<arg name="display_state" type="s"/>
|
||||
</signal>
|
||||
</interface>
|
||||
</node>
|
||||
688
src/mce/dbus-names.h
Normal file
688
src/mce/dbus-names.h
Normal file
@@ -0,0 +1,688 @@
|
||||
/**
|
||||
* @file dbus-names.h
|
||||
* D-Bus Interface to the Mode Control Entity
|
||||
* <p>
|
||||
* This file is part of mce-dev
|
||||
* <p>
|
||||
* Copyright © 2004-2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
* <p>
|
||||
* @author David Weinehall <david.weinehall@nokia.com>
|
||||
*
|
||||
* These headers are free software; you can redistribute them
|
||||
* and/or modify them under the terms of the GNU Lesser General Public
|
||||
* License version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* These headers are distributed in the hope that they will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with these headers.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef _MCE_DBUS_NAMES_H_
|
||||
#define _MCE_DBUS_NAMES_H_
|
||||
|
||||
/**
|
||||
* @name D-Bus Daemon
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
* MCE D-Bus service
|
||||
*
|
||||
* @since v0.3
|
||||
*/
|
||||
#define MCE_SERVICE "com.nokia.mce"
|
||||
|
||||
/**
|
||||
* MCE D-Bus Request interface
|
||||
*
|
||||
* @since v0.3
|
||||
*/
|
||||
#define MCE_REQUEST_IF "com.nokia.mce.request"
|
||||
/**
|
||||
* MCE D-Bus Signal interface
|
||||
*
|
||||
* @since v0.3
|
||||
*/
|
||||
#define MCE_SIGNAL_IF "com.nokia.mce.signal"
|
||||
/**
|
||||
* MCE D-Bus Request path
|
||||
*
|
||||
* @since v0.3
|
||||
*/
|
||||
#define MCE_REQUEST_PATH "/com/nokia/mce/request"
|
||||
/**
|
||||
* MCE D-Bus Signal path
|
||||
*
|
||||
* @since v0.3
|
||||
*/
|
||||
#define MCE_SIGNAL_PATH "/com/nokia/mce/signal"
|
||||
|
||||
/**
|
||||
* The MCE D-Bus error interface; currently not used
|
||||
*
|
||||
* @since v0.3
|
||||
*/
|
||||
#define MCE_ERROR_FATAL "com.nokia.mce.error.fatal"
|
||||
/**
|
||||
* The D-Bus interface for invalid arguments; currently not used
|
||||
*
|
||||
* @since v0.3
|
||||
*/
|
||||
#define MCE_ERROR_INVALID_ARGS "org.freedesktop.DBus.Error.InvalidArgs"
|
||||
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* @name Generic D-Bus methods
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
* Query radio states
|
||||
*
|
||||
* @since v1.10.60
|
||||
* @return @c dbus_uint32_t Radio states or:ed together
|
||||
* (see @ref mce/mode-names.h for defines for the radio states)
|
||||
*/
|
||||
#define MCE_RADIO_STATES_GET "get_radio_states"
|
||||
|
||||
/**
|
||||
* Query the call state
|
||||
*
|
||||
* @since v1.8.1
|
||||
* @return @c gchar @c * with the new call state
|
||||
* (see @ref mce/mode-names.h for valid call states)
|
||||
* @return @c gchar @c * with the new emergency state type
|
||||
* (see @ref mce/mode-names.h for valid emergency state types)
|
||||
*/
|
||||
#define MCE_CALL_STATE_GET "get_call_state"
|
||||
|
||||
/**
|
||||
* Query the touchscreen/keypad lock mode
|
||||
*
|
||||
* @since v1.4.0
|
||||
* @return @c gchar @c * with the touchscreen/keypad lock mode
|
||||
* (see @ref mce/mode-names.h for valid lock modes)
|
||||
*/
|
||||
#define MCE_TKLOCK_MODE_GET "get_tklock_mode"
|
||||
|
||||
/**
|
||||
* Query the display status
|
||||
*
|
||||
* @since v1.5.21
|
||||
* @return @c gchar @c * with the display state
|
||||
* (see @ref mce/mode-names.h for valid display states)
|
||||
*/
|
||||
#define MCE_DISPLAY_STATUS_GET "get_display_status"
|
||||
|
||||
/**
|
||||
* Query CABC mode
|
||||
*
|
||||
* @since v1.10.0
|
||||
* @return @c gchar @c * with the CABC mode
|
||||
* (see @ref mce/mode-names.h for valid CABC modes)
|
||||
*/
|
||||
#define MCE_CABC_MODE_GET "get_cabc_mode"
|
||||
|
||||
/**
|
||||
* Query the automatic power saving mode
|
||||
*
|
||||
* @since v1.10.44
|
||||
* @return @c dbus_bool_t @c TRUE if automatic power saving mode is active,
|
||||
* @c FALSE if automatic power saving mode is inactive
|
||||
*/
|
||||
#define MCE_PSM_STATE_GET "get_psm_state"
|
||||
|
||||
/**
|
||||
* Query key backlight state
|
||||
*
|
||||
* @since v1.10.30
|
||||
* @return @c dbus_bool_t @c TRUE if the key backlight is on,
|
||||
* @c FALSE if the key backlight is off
|
||||
*/
|
||||
#define MCE_KEY_BACKLIGHT_STATE_GET "get_key_backlight_state"
|
||||
|
||||
/**
|
||||
* Add an activity notification callback;
|
||||
* the next user activity will trigger this callback
|
||||
* callbacks are one-shot -- once the callback has been invoked,
|
||||
* it will be unregistered
|
||||
*
|
||||
* @since 1.10.106
|
||||
* @param service @c gchar @c * The method call service
|
||||
* @param path @c gchar @c * The method call path
|
||||
* @param interface @c gchar @c * The method call interface
|
||||
* @param name @c gchar @c * The name of the method to call
|
||||
* @return @c dbus_bool_t @c TRUE if registration was successful,
|
||||
* @c FALSE if registration was a failure
|
||||
* (too many registered clients)
|
||||
*/
|
||||
#define MCE_ADD_ACTIVITY_CALLBACK_REQ "add_activity_callback"
|
||||
|
||||
/**
|
||||
* Remove any activity notification callback belonging to the calling process
|
||||
*
|
||||
* @since 1.10.106
|
||||
*/
|
||||
#define MCE_REMOVE_ACTIVITY_CALLBACK_REQ "remove_activity_callback"
|
||||
|
||||
/**
|
||||
* Query the inactivity status
|
||||
*
|
||||
* @since v1.5.2
|
||||
* @return @c dbus_bool_t @c TRUE if the system is inactive,
|
||||
* @c FALSE if the system is active
|
||||
*/
|
||||
#define MCE_INACTIVITY_STATUS_GET "get_inactivity_status"
|
||||
|
||||
/**
|
||||
* Query the current color profile id
|
||||
*
|
||||
* @since v1.11.2
|
||||
* @return @c gchar @c * with the the current profile id
|
||||
*/
|
||||
#define MCE_COLOR_PROFILE_GET "get_color_profile"
|
||||
|
||||
/**
|
||||
* Query the list of the available color profile ids
|
||||
*
|
||||
* @since v1.11.2
|
||||
* @return @c gchar @c ** with the nul-terminated array of the color profile ids
|
||||
*/
|
||||
#define MCE_COLOR_PROFILE_IDS_GET "get_color_profile_ids"
|
||||
|
||||
/**
|
||||
* Query the MCE version
|
||||
*
|
||||
* @since v1.1.6
|
||||
* @return @c gchar @c * with the MCE version
|
||||
*/
|
||||
#define MCE_VERSION_GET "get_version"
|
||||
|
||||
/**
|
||||
* Request radio states change
|
||||
*
|
||||
* @since v1.10.60
|
||||
* @credential mce::DeviceModeControl
|
||||
* @param @c dbus_uint32_t New radio states or:ed together
|
||||
* (see @ref mce/mode-names.h for defines for the radio states)
|
||||
* @param @c dbus_uint32_t Mask for radio states or:ed together
|
||||
* (see @ref mce/mode-names.h for defines for the radio states)
|
||||
*/
|
||||
#define MCE_RADIO_STATES_CHANGE_REQ "req_radio_states_change"
|
||||
|
||||
/**
|
||||
* Request call state change
|
||||
* Changes can only be made to/from the "none" state; all other
|
||||
* transitions will be vetoed. This is to avoid race conditions
|
||||
* between different services.
|
||||
*
|
||||
* An exception is made when the tuple is active:emergency;
|
||||
* such requests are always accepted
|
||||
*
|
||||
* If the service that requests the transition emits a NameOwnerChanged,
|
||||
* then the call state will revert back to "none", to ensure that
|
||||
* crashing applications doesn't cause a forever busy call state
|
||||
*
|
||||
* @since v1.8.1
|
||||
* @credential mce::CallStateControl
|
||||
* @param call_state @c gchar @c * with the new call state
|
||||
* (see @ref mce/mode-names.h for valid call states)
|
||||
* @param call_type @c gchar @c * with the new call type
|
||||
* (see @ref mce/mode-names.h for valid call types)
|
||||
* @return @c dbus_bool_t @c TRUE if the new call state was accepted,
|
||||
* @c FALSE if the new call state was vetoed
|
||||
*/
|
||||
#define MCE_CALL_STATE_CHANGE_REQ "req_call_state_change"
|
||||
|
||||
/** Inform mce that incoming call has been ignored by ui
|
||||
*
|
||||
* When there is an incoming call, mce reserves the power key
|
||||
* for silencing the ringing tone.
|
||||
*
|
||||
* This method can be used by the call ui to inform mce that the
|
||||
* call has been ignored and power key can be used for display
|
||||
* power control even though there are calls in ringing state.
|
||||
*
|
||||
* @since v1.19.0
|
||||
*/
|
||||
#define MCE_IGNORE_INCOMING_CALL_REQ "req_ignore_incoming_call"
|
||||
|
||||
/**
|
||||
* Unblank display
|
||||
*
|
||||
* @since v0.5
|
||||
*/
|
||||
#define MCE_DISPLAY_ON_REQ "req_display_state_on"
|
||||
|
||||
/**
|
||||
* Dim display
|
||||
*
|
||||
* @since v1.6.20
|
||||
*/
|
||||
#define MCE_DISPLAY_DIM_REQ "req_display_state_dim"
|
||||
|
||||
/**
|
||||
* Blank display
|
||||
*
|
||||
* @since v1.6.20
|
||||
*/
|
||||
#define MCE_DISPLAY_OFF_REQ "req_display_state_off"
|
||||
|
||||
/** Set display to low power mode
|
||||
*
|
||||
* Low power mode is a display off sub state. From normal
|
||||
* display state signaling point of view it behaves just as
|
||||
* display off would. Depending on available hw support and
|
||||
* configuration extra ipc relevant for home screen / system
|
||||
* ui only might happen.
|
||||
*
|
||||
* @since v1.33.0
|
||||
*/
|
||||
#define MCE_DISPLAY_LPM_REQ "req_display_state_lpm"
|
||||
|
||||
/**
|
||||
* Prevent display from blanking
|
||||
*
|
||||
* @since v0.5
|
||||
*/
|
||||
#define MCE_PREVENT_BLANK_REQ "req_display_blanking_pause"
|
||||
|
||||
/**
|
||||
* Cancel display blanking prevention
|
||||
*
|
||||
* @since v1.10.35
|
||||
*/
|
||||
#define MCE_CANCEL_PREVENT_BLANK_REQ "req_display_cancel_blanking_pause"
|
||||
|
||||
/** Get current blank prevention status
|
||||
*
|
||||
* @since 1.51.0
|
||||
*
|
||||
* @return @c gchar @c * with the blanking pause state
|
||||
* (see @ref mce/mode-names.h for valid blanking pause states)
|
||||
*/
|
||||
#define MCE_PREVENT_BLANK_GET "get_display_blanking_pause"
|
||||
|
||||
/** Get current blank inhibition status
|
||||
*
|
||||
* @since 1.51.0
|
||||
*
|
||||
* @return @c gchar @c * with the blanking inhibit state
|
||||
* (see @ref mce/mode-names.h for valid blanking inhibit states)
|
||||
*/
|
||||
#define MCE_BLANKING_INHIBIT_GET "get_display_blanking_inhibit"
|
||||
|
||||
/** Get current display blanking policy status
|
||||
*
|
||||
* @since v1.55.0
|
||||
*
|
||||
* @return @c gchar @c * with the blanking polic state
|
||||
* (see @ref mce/mode-names.h for valid blanking policy states)
|
||||
*/
|
||||
#define MCE_BLANKING_POLICY_GET "get_display_blanking_policy"
|
||||
|
||||
/**
|
||||
* Request CABC mode change
|
||||
*
|
||||
* @since v1.10.0
|
||||
* @param mode @c gchar @c * with the new CABC mode
|
||||
* (see @ref mce/mode-names.h for valid CABC modes)
|
||||
* @return @c gchar @c * with the updated CABC mode
|
||||
* (see @ref mce/mode-names.h for valid CABC modes)
|
||||
*/
|
||||
#define MCE_CABC_MODE_REQ "req_cabc_mode"
|
||||
|
||||
/**
|
||||
* Request tklock mode change
|
||||
*
|
||||
* @since v1.4.0
|
||||
* @credential mce::TKLockControl
|
||||
* @param mode @c gchar @c * with the new touchscreen/keypad lock mode
|
||||
* (see @ref mce/mode-names.h for valid lock modes)
|
||||
*/
|
||||
#define MCE_TKLOCK_MODE_CHANGE_REQ "req_tklock_mode_change"
|
||||
|
||||
/**
|
||||
* Request powerkey event triggering
|
||||
*
|
||||
* @credential mce::DeviceModeControl
|
||||
* @since v1.5.3
|
||||
* @param type @c dbus_bool_t with the type of powerkey event to
|
||||
* trigger; @c FALSE == short powerkey press,
|
||||
* @c TRUE == long powerkey press
|
||||
* @since v1.10.54
|
||||
* @param type @c dbus_uint32_t with the type of powerkey event to trigger
|
||||
* (see @ref mce/mode-names.h for valid events)
|
||||
*/
|
||||
#define MCE_TRIGGER_POWERKEY_EVENT_REQ "req_trigger_powerkey_event"
|
||||
|
||||
/**
|
||||
* Request color profile change
|
||||
*
|
||||
* @since v1.11.2
|
||||
* @credential mce::ColorProfileControl
|
||||
* @param mode @c gchar @c * with the new color profile id
|
||||
* (see @ref MCE_COLOR_PROFILE_IDS_GET to learn
|
||||
* how to get the valid color profile ids)
|
||||
*/
|
||||
#define MCE_COLOR_PROFILE_CHANGE_REQ "req_color_profile_change"
|
||||
|
||||
/** Query the length of time late suspend can be blocked
|
||||
*
|
||||
* The idea is: if some process needs to do non-interactive
|
||||
* background processing, it can prevent the system from
|
||||
* entering late suspend by
|
||||
*
|
||||
* 1) get timer period via #MCE_CPU_KEEPALIVE_PERIOD_REQ call
|
||||
*
|
||||
* 2) call #MCE_CPU_KEEPALIVE_START_REQ
|
||||
*
|
||||
* 3) repeat #MCE_CPU_KEEPALIVE_START_REQ calls in interval
|
||||
* that is shorter than the maximum obtained at (1)
|
||||
*
|
||||
* 4) call #MCE_CPU_KEEPALIVE_STOP_REQ when finished
|
||||
*
|
||||
* MCE keeps track of active clients and blocks late suspend
|
||||
* until all clients have called #MCE_CPU_KEEPALIVE_STOP_REQ,
|
||||
* lost D-Bus connection (exit, crash, ...) or all timeouts
|
||||
* have been missed.
|
||||
*
|
||||
* @since v1.12.8
|
||||
*
|
||||
* @since v1.23.7
|
||||
*
|
||||
* An unique within process tracking id can be passed to all
|
||||
* cpu keepalive related D-Bus method calls. This allows mce
|
||||
* to keep track of multiple, possibly overlapping keepalive
|
||||
* periods from one process.
|
||||
*
|
||||
* Old code that does not pass the tracking id still works
|
||||
* as long as the client process does not have multiple
|
||||
* overlapping periods at once.
|
||||
*
|
||||
* @param context Tracking id as DBUS_TYPE_STRING
|
||||
*
|
||||
* @return period in seconds as DBUS_TYPE_INT32
|
||||
*/
|
||||
#define MCE_CPU_KEEPALIVE_PERIOD_REQ "req_cpu_keepalive_period"
|
||||
|
||||
/** Temporarily disable enter late suspend policy
|
||||
*
|
||||
* This method call must be repeated periodically to keep
|
||||
* the system from entering late suspend.
|
||||
*
|
||||
* The period length can be obtained via #MCE_CPU_KEEPALIVE_PERIOD_REQ.
|
||||
*
|
||||
* Note: The boolean reply message is optional and will be sent
|
||||
* only if requested.
|
||||
*
|
||||
* @since v1.12.8
|
||||
*
|
||||
* @param context Tracking id as DBUS_TYPE_STRING
|
||||
*
|
||||
* @return success as DBUS_TYPE_BOOLEAN
|
||||
*/
|
||||
#define MCE_CPU_KEEPALIVE_START_REQ "req_cpu_keepalive_start"
|
||||
|
||||
/** Allow normal enter late suspend policy again
|
||||
*
|
||||
* If a process blocks late suspend via #MCE_CPU_KEEPALIVE_START_REQ,
|
||||
* it must call #MCE_CPU_KEEPALIVE_STOP_REQ when background processing
|
||||
* is finished to enable normal late suspend policy again.
|
||||
*
|
||||
* Note: The boolean reply message is optional and will be sent
|
||||
* only if requested.
|
||||
*
|
||||
* @since v1.12.8
|
||||
*
|
||||
* @param context Tracking id as DBUS_TYPE_STRING
|
||||
*
|
||||
* @return success as DBUS_TYPE_BOOLEAN
|
||||
*/
|
||||
#define MCE_CPU_KEEPALIVE_STOP_REQ "req_cpu_keepalive_stop"
|
||||
|
||||
/** Signal wakeup from suspend due to aligned timer triggering
|
||||
*
|
||||
* NOTE: This is reserved for use from dsme iphb module and is
|
||||
* used to transfer ownership of rtc irq wakeup wakelock from
|
||||
* dsme to mce.
|
||||
*
|
||||
* Note: The boolean reply message is optional and will be sent
|
||||
* only if requested.
|
||||
*
|
||||
* @since v1.12.8
|
||||
*
|
||||
* @return success as DBUS_TYPE_BOOLEAN
|
||||
*/
|
||||
#define MCE_CPU_KEEPALIVE_WAKEUP_REQ "req_cpu_keepalive_wakeup"
|
||||
|
||||
/** Query configuration value
|
||||
*
|
||||
* @since v1.12.15
|
||||
*
|
||||
* @param key Configuration value name as DBUS_TYPE_STRING
|
||||
*
|
||||
* @return Configuration value as DBUS_TYPE_VARIANT, or
|
||||
* error reply
|
||||
*/
|
||||
#define MCE_CONFIG_GET "get_config"
|
||||
|
||||
/** Set configuration value
|
||||
*
|
||||
* @since v1.12.15
|
||||
*
|
||||
* @param key Configuration value name as DBUS_TYPE_STRING
|
||||
* @param val Configuration value as DBUS_TYPE_VARIANT
|
||||
*
|
||||
* @return Success as DBUS_TYPE_BOOLEAN, or error reply
|
||||
*/
|
||||
#define MCE_CONFIG_SET "set_config"
|
||||
|
||||
/** Reset configuration values to default
|
||||
*
|
||||
* All config settings with keyname that matches the given substring
|
||||
* will be reset to configured defaults e.g. using "/" resets all
|
||||
* settings while using "/display/" resets only display related values.
|
||||
*
|
||||
* @since v1.42.0
|
||||
*
|
||||
* @param keyish Substring of config value name as DBUS_TYPE_STRING
|
||||
*
|
||||
* @return Number of changed settings as DBUS_TYPE_INT32; -1 on failure
|
||||
*/
|
||||
#define MCE_CONFIG_RESET "reset_config"
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* @name Generic D-Bus signals
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
* Signal that indicates that the touchscreen/keypad lock mode has changed
|
||||
*
|
||||
* @since v1.4.0
|
||||
* @return @c gchar @c * with the new touchscreen/keypad lock mode
|
||||
* (see @ref mce/mode-names.h for valid lock modes)
|
||||
*/
|
||||
#define MCE_TKLOCK_MODE_SIG "tklock_mode_ind"
|
||||
|
||||
/**
|
||||
* Notify everyone that the display is on/dimmed/off
|
||||
*
|
||||
* @since v1.5.21
|
||||
* @return @c gchar @c * with the display state
|
||||
* (see @ref mce/mode-names.h for valid display states)
|
||||
*/
|
||||
#define MCE_DISPLAY_SIG "display_status_ind"
|
||||
|
||||
/** Notify everyone whether the display blanking is paused
|
||||
*
|
||||
* @since v1.51.0
|
||||
*
|
||||
* @return @c gchar @c * with the blanking pause state
|
||||
* (see @ref mce/mode-names.h for valid blanking pause states)
|
||||
*/
|
||||
#define MCE_PREVENT_BLANK_SIG "display_blanking_pause_ind"
|
||||
|
||||
/** Notify everyone whether the display blanking is inhibited
|
||||
*
|
||||
* @since v1.51.0
|
||||
*
|
||||
* @return @c gchar @c * with the display baling inhibit state
|
||||
* (see @ref mce/mode-names.h for valid blanking inhibit states)
|
||||
*/
|
||||
#define MCE_BLANKING_INHIBIT_SIG "display_blanking_inhibit_ind"
|
||||
|
||||
/** Notify everyone when the display blanking policy changes
|
||||
*
|
||||
* @since v1.55.0
|
||||
*
|
||||
* @return @c gchar @c * with the display blankiing policy state
|
||||
* (see @ref mce/mode-names.h for valid blanking policy states)
|
||||
*/
|
||||
#define MCE_BLANKING_POLICY_SIG "display_blanking_policy_ind"
|
||||
|
||||
/**
|
||||
* Notify everyone that the state of the automatic power saving mode changed
|
||||
*
|
||||
* @since v1.10.44
|
||||
* @return @c dbus_bool_t @c TRUE if automatic power saving mode is active,
|
||||
* @c FALSE if automatic power saving mode is inactive
|
||||
*/
|
||||
#define MCE_PSM_STATE_SIG "psm_state_ind"
|
||||
|
||||
/**
|
||||
* Notify everyone that the system is active/inactive
|
||||
*
|
||||
* @since v0.9.3
|
||||
* @return @c dbus_bool_t @c TRUE if the system is inactive,
|
||||
* @c FALSE if the system is active
|
||||
*/
|
||||
#define MCE_INACTIVITY_SIG "system_inactivity_ind"
|
||||
|
||||
/**
|
||||
* Notify everyone that the color profile has changed
|
||||
*
|
||||
* @since v1.11.2
|
||||
* @return @c gchar @c * with the color profile id
|
||||
*/
|
||||
#define MCE_COLOR_PROFILE_SIG "color_profile_ind"
|
||||
|
||||
/**
|
||||
* Notify everyone that the radio states have changed
|
||||
*
|
||||
* @since v1.10.60
|
||||
* @return @c dbus_uint32_t Radio states or:ed together
|
||||
* (see @ref mce/mode-names.h for defines for the radio states)
|
||||
*/
|
||||
#define MCE_RADIO_STATES_SIG "radio_states_ind"
|
||||
|
||||
/**
|
||||
* Notify everyone that the call state has changed
|
||||
*
|
||||
* @since v1.8.1
|
||||
* @return @c gchar @c * with the new call state
|
||||
* (see @ref mce/mode-names.h for valid call states)
|
||||
* @return @c gchar @c * with the new emergency state type
|
||||
* (see @ref mce/mode-names.h for valid emergency state types)
|
||||
*/
|
||||
#define MCE_CALL_STATE_SIG "sig_call_state_ind"
|
||||
|
||||
/** Notify everyone that mce configuration value has changed
|
||||
*
|
||||
* @since v1.14.1
|
||||
*
|
||||
* @param key Config value name as DBUS_TYPE_STRING
|
||||
* @param val Config value as DBUS_TYPE_VARIANT
|
||||
*/
|
||||
#define MCE_CONFIG_CHANGE_SIG "config_change_ind"
|
||||
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* @name LED interface D-Bus methods
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
* Activates a pre-defined LED pattern
|
||||
*
|
||||
* Non-existing patterns are ignored
|
||||
*
|
||||
* See also: MCE_LED_PATTERN_ACTIVATED_SIG
|
||||
*
|
||||
* @credential mce::LEDControl
|
||||
* @since v1.5.0
|
||||
* @param pattern @c gchar @c * with the pattern name
|
||||
* (see @c /etc/mce/mce.ini for valid pattern names)
|
||||
*/
|
||||
#define MCE_ACTIVATE_LED_PATTERN "req_led_pattern_activate"
|
||||
|
||||
/**
|
||||
* Deactivates a pre-defined LED pattern
|
||||
*
|
||||
* Non-existing patterns are ignored
|
||||
*
|
||||
* See also: MCE_LED_PATTERN_DEACTIVATED_SIG
|
||||
*
|
||||
* @credential mce::LEDControl
|
||||
* @since v1.5.0
|
||||
* @param pattern @c gchar @c * with the pattern name
|
||||
* (see @c /etc/mce/mce.ini for valid pattern names)
|
||||
*/
|
||||
#define MCE_DEACTIVATE_LED_PATTERN "req_led_pattern_deactivate"
|
||||
|
||||
/** Notify everyone that a led pattern has been activated
|
||||
*
|
||||
* @since v1.25.0
|
||||
* @return @c gchar @c * led pattern name
|
||||
*/
|
||||
#define MCE_LED_PATTERN_ACTIVATED_SIG "led_pattern_activated_ind"
|
||||
|
||||
/** Notify everyone that a led pattern has been deactivated
|
||||
*
|
||||
* @since v1.25.0
|
||||
* @return @c gchar @c * led pattern name
|
||||
*/
|
||||
#define MCE_LED_PATTERN_DEACTIVATED_SIG "led_pattern_deactivated_ind"
|
||||
|
||||
/**
|
||||
* Enable LED; this does not affect the LED pattern stack
|
||||
* Note: The GConf setting for LED flashing overrides this value
|
||||
* If the pattern stack does not contain any active patterns,
|
||||
* the LED logic will still remain in enabled mode,
|
||||
* but will not display any patterns until a pattern is activated
|
||||
*
|
||||
* Do NOT use this as a "master switch" for the LED framework,
|
||||
* since some patterns should *always* be visible
|
||||
* this interface is meant for testing and development only
|
||||
*
|
||||
* @credential mce::LEDControl
|
||||
* @since v1.5.0
|
||||
*/
|
||||
#define MCE_ENABLE_LED "req_led_enable"
|
||||
|
||||
/**
|
||||
* Disable LED; this does not affect the LED pattern stack
|
||||
* Note: Do NOT use this as a "master switch" for the LED framework,
|
||||
* since some patterns should *always* be visible
|
||||
* this interface is meant for testing and development only
|
||||
*
|
||||
* @credential mce::LEDControl
|
||||
* @since v1.5.0
|
||||
*/
|
||||
#define MCE_DISABLE_LED "req_led_disable"
|
||||
|
||||
/*@}*/
|
||||
|
||||
#endif /* _MCE_DBUS_NAMES_H_ */
|
||||
261
src/mce/mode-names.h
Normal file
261
src/mce/mode-names.h
Normal file
@@ -0,0 +1,261 @@
|
||||
/**
|
||||
* @file mode-names.h
|
||||
* Defines for names of various modes and submodes for Mode Control Entity
|
||||
* <p>
|
||||
* This file is part of mce-dev
|
||||
* <p>
|
||||
* Copyright © 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
* <p>
|
||||
* @author David Weinehall <david.weinehall@nokia.com>
|
||||
*
|
||||
* These headers are free software; you can redistribute them
|
||||
* and/or modify them under the terms of the GNU Lesser General Public
|
||||
* License version 2.1 as published by the Free Software Foundation.
|
||||
*
|
||||
* These headers are distributed in the hope that they will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with these headers.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef _MCE_MODE_NAMES_H_
|
||||
#define _MCE_MODE_NAMES_H_
|
||||
|
||||
/**
|
||||
* Master switch; set - radios enabled, unset - radios disabled
|
||||
*
|
||||
* @since v1.10.60
|
||||
*/
|
||||
#define MCE_RADIO_STATE_MASTER (1 << 0)
|
||||
/**
|
||||
* Cellular; set - enabled, unset - disabled
|
||||
*
|
||||
* @since v1.10.60
|
||||
*/
|
||||
#define MCE_RADIO_STATE_CELLULAR (1 << 1)
|
||||
/**
|
||||
* WLAN; set - enabled, unset - disabled
|
||||
*
|
||||
* @since v1.10.60
|
||||
*/
|
||||
#define MCE_RADIO_STATE_WLAN (1 << 2)
|
||||
/**
|
||||
* Bluetooth; set - enabled, unset - disabled
|
||||
*
|
||||
* @since v1.10.60
|
||||
*/
|
||||
#define MCE_RADIO_STATE_BLUETOOTH (1 << 3)
|
||||
/**
|
||||
* NFC; set - enabled, unset - disabled
|
||||
*
|
||||
* @since v1.10.93
|
||||
*/
|
||||
#define MCE_RADIO_STATE_NFC (1 << 4)
|
||||
/**
|
||||
* FM transmitter; set - enabled, unset - disabled
|
||||
*
|
||||
* @since v1.10.93
|
||||
*/
|
||||
#define MCE_RADIO_STATE_FMTX (1 << 5)
|
||||
|
||||
/**
|
||||
* No ongoing call
|
||||
*
|
||||
* @since v1.8.4
|
||||
*/
|
||||
#define MCE_CALL_STATE_NONE "none"
|
||||
/**
|
||||
* Call ringing
|
||||
*
|
||||
* @since v1.8.29
|
||||
*/
|
||||
#define MCE_CALL_STATE_RINGING "ringing"
|
||||
/**
|
||||
* Call on-going
|
||||
*
|
||||
* @since v1.8.29
|
||||
*/
|
||||
#define MCE_CALL_STATE_ACTIVE "active"
|
||||
/**
|
||||
* Service operation on-going
|
||||
* use to prevent calls from being initiated;
|
||||
* will not prevent emergency calls
|
||||
*
|
||||
* @since v1.8.29
|
||||
*/
|
||||
#define MCE_CALL_STATE_SERVICE "service"
|
||||
|
||||
/**
|
||||
* Normal call
|
||||
*
|
||||
* @since v1.8.4
|
||||
*/
|
||||
#define MCE_NORMAL_CALL "normal"
|
||||
/**
|
||||
* Emergency call
|
||||
*
|
||||
* @since v1.8.4
|
||||
*/
|
||||
#define MCE_EMERGENCY_CALL "emergency"
|
||||
|
||||
/**
|
||||
* Touchscreen/Keypad locked
|
||||
*
|
||||
* @since v1.4.5
|
||||
*/
|
||||
#define MCE_TK_LOCKED "locked"
|
||||
/**
|
||||
* Touchscreen/Keypad silently locked
|
||||
*
|
||||
* @since v1.4.15
|
||||
*/
|
||||
#define MCE_TK_SILENT_LOCKED "silent-locked"
|
||||
/**
|
||||
* Touchscreen/Keypad locked with fadeout
|
||||
*
|
||||
* @since v1.4.15
|
||||
*/
|
||||
#define MCE_TK_LOCKED_DIM "locked-dim"
|
||||
/**
|
||||
* Touchscreen/Keypad locked with delay
|
||||
*
|
||||
* @since v1.12.2
|
||||
*/
|
||||
#define MCE_TK_LOCKED_DELAY "locked-delay"
|
||||
/**
|
||||
* Touchscreen/Keypad silently locked with fadeout
|
||||
*
|
||||
* @since v1.4.15
|
||||
*/
|
||||
#define MCE_TK_SILENT_LOCKED_DIM "silent-locked-dim"
|
||||
/**
|
||||
* Touchscreen/Keypad unlocked
|
||||
*
|
||||
* @since v1.4.5
|
||||
*/
|
||||
#define MCE_TK_UNLOCKED "unlocked"
|
||||
/**
|
||||
* Touchscreen/Keypad silently unlocked
|
||||
*
|
||||
* @since v1.6.33
|
||||
*/
|
||||
#define MCE_TK_SILENT_UNLOCKED "silent-unlocked"
|
||||
|
||||
/**
|
||||
* Display state name for display on
|
||||
*
|
||||
* @since v1.5.21
|
||||
*/
|
||||
#define MCE_DISPLAY_ON_STRING "on"
|
||||
/**
|
||||
* Display state name for display dim
|
||||
*
|
||||
* @since v1.5.21
|
||||
*/
|
||||
#define MCE_DISPLAY_DIM_STRING "dimmed"
|
||||
/**
|
||||
* Display state name for display off
|
||||
*
|
||||
* @since v1.5.21
|
||||
*/
|
||||
#define MCE_DISPLAY_OFF_STRING "off"
|
||||
|
||||
/** Blank prevent state name for active
|
||||
*
|
||||
* @since v1.51.0
|
||||
*/
|
||||
#define MCE_PREVENT_BLANK_ACTIVE_STRING "active"
|
||||
/** Blank prevent state name for inactive
|
||||
*
|
||||
* @since v1.51.0
|
||||
*/
|
||||
#define MCE_PREVENT_BLANK_INACTIVE_STRING "inactive"
|
||||
|
||||
/** Blank inhibit state name for active
|
||||
*
|
||||
* @since v1.51.0
|
||||
*/
|
||||
#define MCE_INHIBIT_BLANK_ACTIVE_STRING "active"
|
||||
/** Blank inhibit state name for inactive
|
||||
*
|
||||
* @since v1.51.0
|
||||
*/
|
||||
#define MCE_INHIBIT_BLANK_INACTIVE_STRING "inactive"
|
||||
|
||||
/** Default blanking policy active
|
||||
*
|
||||
* @since v1.55.0
|
||||
*/
|
||||
#define MCE_BLANKING_POLICY_DEFAULT_STRING "default"
|
||||
|
||||
/** Default blanking policy disabled due to notifications
|
||||
*
|
||||
* @since v1.55.0
|
||||
*/
|
||||
#define MCE_BLANKING_POLICY_NOTIFICATION_STRING "notification"
|
||||
|
||||
/** Default blanking policy disabled due to alarm dialog state
|
||||
*
|
||||
* @since v1.55.0
|
||||
*/
|
||||
#define MCE_BLANKING_POLICY_ALARM_STRING "alarm"
|
||||
|
||||
/** Default blanking policy disabled due to call state
|
||||
*
|
||||
* @since v1.55.0
|
||||
*/
|
||||
#define MCE_BLANKING_POLICY_CALL_STRING "call"
|
||||
|
||||
/** Default blanking policy is about to be restored
|
||||
*
|
||||
* @since v1.55.0
|
||||
*/
|
||||
#define MCE_BLANKING_POLICY_LINGER_STRING "linger"
|
||||
|
||||
/**
|
||||
* CABC name for CABC disabled
|
||||
*
|
||||
* @since v1.8.88
|
||||
*/
|
||||
#define MCE_CABC_MODE_OFF "off"
|
||||
/**
|
||||
* CABC name for UI mode
|
||||
*
|
||||
* @since v1.8.88
|
||||
*/
|
||||
#define MCE_CABC_MODE_UI "ui"
|
||||
/**
|
||||
* CABC name for still image mode
|
||||
*
|
||||
* @since v1.8.88
|
||||
*/
|
||||
#define MCE_CABC_MODE_STILL_IMAGE "still-image"
|
||||
/**
|
||||
* CABC name for moving image mode
|
||||
*
|
||||
* @since v1.8.88
|
||||
*/
|
||||
#define MCE_CABC_MODE_MOVING_IMAGE "moving-image"
|
||||
/**
|
||||
* POWERKEY EVENT for single powerkey press
|
||||
*
|
||||
* @since v1.10.54
|
||||
*/
|
||||
#define MCE_POWERKEY_EVENT_SHORT_PRESS (0u)
|
||||
/**
|
||||
* POWERKEY EVENT for long powerkey press
|
||||
*
|
||||
* @since v1.10.54
|
||||
*/
|
||||
#define MCE_POWERKEY_EVENT_LONG_PRESS (1u)
|
||||
/**
|
||||
* POWERKEY EVENT for double powerkey press
|
||||
*
|
||||
* @since v1.10.54
|
||||
*/
|
||||
#define MCE_POWERKEY_EVENT_DOUBLE_PRESS (2u)
|
||||
|
||||
#endif /* _MCE_MODE_NAMES_H_ */
|
||||
294
src/mce_display.c
Normal file
294
src/mce_display.c
Normal file
@@ -0,0 +1,294 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Jolla Ltd.
|
||||
* Contact: Slava Monich <slava.monich@jolla.com>
|
||||
*
|
||||
* You may use this file under the terms of BSD license as follows:
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of Jolla Ltd nor the names of its contributors may
|
||||
* be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation
|
||||
* are those of the authors and should not be interpreted as representing
|
||||
* any official policies, either expressed or implied.
|
||||
*/
|
||||
|
||||
#include "mce_display.h"
|
||||
#include "mce_proxy.h"
|
||||
#include "mce_log_p.h"
|
||||
|
||||
#include "mce/mode-names.h"
|
||||
|
||||
/* Generated headers */
|
||||
#include "com.nokia.mce.h"
|
||||
|
||||
struct mce_display_priv {
|
||||
MceProxy* proxy;
|
||||
gulong proxy_valid_id;
|
||||
gulong display_status_ind_id;
|
||||
};
|
||||
|
||||
enum mce_display_signal {
|
||||
SIGNAL_VALID_CHANGED,
|
||||
SIGNAL_STATE_CHANGED,
|
||||
SIGNAL_COUNT
|
||||
};
|
||||
|
||||
#define SIGNAL_VALID_CHANGED_NAME "mce-display-valid-changed"
|
||||
#define SIGNAL_STATE_CHANGED_NAME "mce-display-state-changed"
|
||||
|
||||
static guint mce_display_signals[SIGNAL_COUNT] = { 0 };
|
||||
|
||||
typedef GObjectClass MceDisplayClass;
|
||||
G_DEFINE_TYPE(MceDisplay, mce_display, G_TYPE_OBJECT)
|
||||
#define PARENT_CLASS mce_display_parent_class
|
||||
#define MCE_DISPLAY_TYPE (mce_display_get_type())
|
||||
#define MCE_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST(obj,\
|
||||
MCE_DISPLAY_TYPE,MceDisplay))
|
||||
|
||||
/*==========================================================================*
|
||||
* Implementation
|
||||
*==========================================================================*/
|
||||
|
||||
static
|
||||
void
|
||||
mce_display_status_update(
|
||||
MceDisplay* self,
|
||||
const char* status)
|
||||
{
|
||||
MCE_DISPLAY_STATE state;
|
||||
MceDisplayPriv* priv = self->priv;
|
||||
|
||||
if (!g_strcmp0(status, MCE_DISPLAY_OFF_STRING)) {
|
||||
state = MCE_DISPLAY_STATE_OFF;
|
||||
} else if (!g_strcmp0(status, MCE_DISPLAY_DIM_STRING)) {
|
||||
state = MCE_DISPLAY_STATE_DIM;
|
||||
} else {
|
||||
GASSERT(!g_strcmp0(status, MCE_DISPLAY_ON_STRING));
|
||||
state = MCE_DISPLAY_STATE_ON;
|
||||
}
|
||||
if (self->state != state) {
|
||||
self->state = state;
|
||||
g_signal_emit(self, mce_display_signals[SIGNAL_STATE_CHANGED], 0);
|
||||
}
|
||||
if (priv->proxy->valid && !self->valid) {
|
||||
self->valid = TRUE;
|
||||
g_signal_emit(self, mce_display_signals[SIGNAL_VALID_CHANGED], 0);
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
mce_display_status_query_done(
|
||||
GObject* proxy,
|
||||
GAsyncResult* result,
|
||||
gpointer arg)
|
||||
{
|
||||
GError* error = NULL;
|
||||
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)) {
|
||||
GDEBUG("Display is currently %s", status);
|
||||
mce_display_status_update(self, status);
|
||||
g_free(status);
|
||||
} else {
|
||||
GWARN("Failed to query display state %s", GERRMSG(error));
|
||||
g_error_free(error);
|
||||
}
|
||||
mce_display_unref(self);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
mce_display_status_query(
|
||||
MceDisplay* self)
|
||||
{
|
||||
MceProxy* proxy = self->priv->proxy;
|
||||
|
||||
if (proxy->valid) {
|
||||
com_nokia_mce_request_call_get_display_status(proxy->request, NULL,
|
||||
mce_display_status_query_done, mce_display_ref(self));
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
mce_display_valid_changed(
|
||||
MceProxy* proxy,
|
||||
void* arg)
|
||||
{
|
||||
MceDisplay* self = MCE_DISPLAY(arg);
|
||||
|
||||
if (proxy->valid) {
|
||||
mce_display_status_query(self);
|
||||
} else {
|
||||
if (self->valid) {
|
||||
self->valid = FALSE;
|
||||
g_signal_emit(self, mce_display_signals[SIGNAL_VALID_CHANGED], 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
void
|
||||
mce_display_status_ind(
|
||||
ComNokiaMceSignal* proxy,
|
||||
const char* status,
|
||||
gpointer arg)
|
||||
{
|
||||
GDEBUG("Display is %s", status);
|
||||
mce_display_status_update(MCE_DISPLAY(arg), status);
|
||||
}
|
||||
|
||||
/*==========================================================================*
|
||||
* API
|
||||
*==========================================================================*/
|
||||
|
||||
MceDisplay*
|
||||
mce_display_new()
|
||||
{
|
||||
/* MCE assumes one display */
|
||||
static MceDisplay* mce_display_instance = NULL;
|
||||
|
||||
if (mce_display_instance) {
|
||||
mce_display_ref(mce_display_instance);
|
||||
} else {
|
||||
mce_display_instance = g_object_new(MCE_DISPLAY_TYPE, NULL);
|
||||
mce_display_status_query(mce_display_instance);
|
||||
g_object_add_weak_pointer(G_OBJECT(mce_display_instance),
|
||||
(gpointer*)(&mce_display_instance));
|
||||
}
|
||||
return mce_display_instance;
|
||||
}
|
||||
|
||||
MceDisplay*
|
||||
mce_display_ref(
|
||||
MceDisplay* self)
|
||||
{
|
||||
if (G_LIKELY(self)) {
|
||||
g_object_ref(MCE_DISPLAY(self));
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
mce_display_unref(
|
||||
MceDisplay* self)
|
||||
{
|
||||
if (G_LIKELY(self)) {
|
||||
g_object_unref(MCE_DISPLAY(self));
|
||||
}
|
||||
}
|
||||
|
||||
gulong
|
||||
mce_display_add_valid_changed_handler(
|
||||
MceDisplay* self,
|
||||
MceDisplayFunc fn,
|
||||
void* arg)
|
||||
{
|
||||
return (G_LIKELY(self) && G_LIKELY(fn)) ? g_signal_connect(self,
|
||||
SIGNAL_VALID_CHANGED_NAME, G_CALLBACK(fn), arg) : 0;
|
||||
}
|
||||
|
||||
gulong
|
||||
mce_display_add_state_changed_handler(
|
||||
MceDisplay* self,
|
||||
MceDisplayFunc fn,
|
||||
void* arg)
|
||||
{
|
||||
return (G_LIKELY(self) && G_LIKELY(fn)) ? g_signal_connect(self,
|
||||
SIGNAL_STATE_CHANGED_NAME, G_CALLBACK(fn), arg) : 0;
|
||||
}
|
||||
|
||||
void
|
||||
mce_display_remove_handler(
|
||||
MceDisplay* self,
|
||||
gulong id)
|
||||
{
|
||||
if (G_LIKELY(self) && G_LIKELY(id)) {
|
||||
g_signal_handler_disconnect(self, id);
|
||||
}
|
||||
}
|
||||
|
||||
/*==========================================================================*
|
||||
* Internals
|
||||
*==========================================================================*/
|
||||
|
||||
static
|
||||
void
|
||||
mce_display_init(
|
||||
MceDisplay* self)
|
||||
{
|
||||
MceDisplayPriv* priv = G_TYPE_INSTANCE_GET_PRIVATE(self, MCE_DISPLAY_TYPE,
|
||||
MceDisplayPriv);
|
||||
|
||||
self->priv = priv;
|
||||
priv->proxy = mce_proxy_new();
|
||||
priv->proxy_valid_id = mce_proxy_add_valid_changed_handler(priv->proxy,
|
||||
mce_display_valid_changed, self);
|
||||
priv->display_status_ind_id = g_signal_connect(priv->proxy->signal,
|
||||
"display_status_ind", G_CALLBACK(mce_display_status_ind), self);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
mce_display_finalize(
|
||||
GObject* object)
|
||||
{
|
||||
MceDisplay* self = MCE_DISPLAY(object);
|
||||
MceDisplayPriv* priv = self->priv;
|
||||
|
||||
mce_proxy_unref(priv->proxy);
|
||||
G_OBJECT_CLASS(PARENT_CLASS)->finalize(object);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
mce_display_class_init(
|
||||
MceDisplayClass* klass)
|
||||
{
|
||||
GObjectClass* object_class = G_OBJECT_CLASS(klass);
|
||||
|
||||
object_class->finalize = mce_display_finalize;
|
||||
g_type_class_add_private(klass, sizeof(MceDisplayPriv));
|
||||
mce_display_signals[SIGNAL_VALID_CHANGED] =
|
||||
g_signal_new(SIGNAL_VALID_CHANGED_NAME,
|
||||
G_OBJECT_CLASS_TYPE(klass), G_SIGNAL_RUN_FIRST,
|
||||
0, NULL, NULL, NULL, G_TYPE_NONE, 0);
|
||||
mce_display_signals[SIGNAL_STATE_CHANGED] =
|
||||
g_signal_new(SIGNAL_STATE_CHANGED_NAME,
|
||||
G_OBJECT_CLASS_TYPE(klass), G_SIGNAL_RUN_FIRST,
|
||||
0, NULL, NULL, NULL, G_TYPE_NONE, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*/
|
||||
54
src/mce_log_p.h
Normal file
54
src/mce_log_p.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Jolla Ltd.
|
||||
* Contact: Slava Monich <slava.monich@jolla.com>
|
||||
*
|
||||
* You may use this file under the terms of BSD license as follows:
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of Jolla Ltd nor the names of its contributors may
|
||||
* be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation
|
||||
* are those of the authors and should not be interpreted as representing
|
||||
* any official policies, either expressed or implied.
|
||||
*/
|
||||
|
||||
#ifndef MCE_LOG_PRIVATE_H
|
||||
#define MCE_LOG_PRIVATE_H
|
||||
|
||||
#include "mce_log.h"
|
||||
|
||||
#define GLOG_MODULE_NAME MCE_LOG_MODULE
|
||||
|
||||
#include <gutil_log.h>
|
||||
|
||||
#endif /* MCE_LOG_PRIVATE_H */
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*/
|
||||
207
src/mce_proxy.c
Normal file
207
src/mce_proxy.c
Normal file
@@ -0,0 +1,207 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Jolla Ltd.
|
||||
* Contact: Slava Monich <slava.monich@jolla.com>
|
||||
*
|
||||
* You may use this file under the terms of BSD license as follows:
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of Jolla Ltd nor the names of its contributors may
|
||||
* be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation
|
||||
* are those of the authors and should not be interpreted as representing
|
||||
* any official policies, either expressed or implied.
|
||||
*/
|
||||
|
||||
#include "mce_proxy.h"
|
||||
#include "mce_log_p.h"
|
||||
|
||||
#include "mce/dbus-names.h"
|
||||
|
||||
/* Generated headers */
|
||||
#include "com.nokia.mce.h"
|
||||
|
||||
GLOG_MODULE_DEFINE("mce");
|
||||
|
||||
struct mce_proxy_priv {
|
||||
GDBusConnection* bus;
|
||||
guint mce_watch_id;
|
||||
};
|
||||
|
||||
enum mce_proxy_signal {
|
||||
SIGNAL_VALID_CHANGED,
|
||||
SIGNAL_COUNT
|
||||
};
|
||||
|
||||
#define SIGNAL_VALID_CHANGED_NAME "mce-proxy-valid-changed"
|
||||
|
||||
static guint mce_proxy_signals[SIGNAL_COUNT] = { 0 };
|
||||
|
||||
typedef GObjectClass MceProxyClass;
|
||||
G_DEFINE_TYPE(MceProxy, mce_proxy, G_TYPE_OBJECT)
|
||||
#define PARENT_CLASS mce_proxy_parent_class
|
||||
#define MCE_PROXY_TYPE (mce_proxy_get_type())
|
||||
#define MCE_PROXY(obj) (G_TYPE_CHECK_INSTANCE_CAST(obj,\
|
||||
MCE_PROXY_TYPE,MceProxy))
|
||||
|
||||
static
|
||||
void
|
||||
mce_name_appeared(
|
||||
GDBusConnection* bus,
|
||||
const gchar* name,
|
||||
const gchar* owner,
|
||||
gpointer arg)
|
||||
{
|
||||
MceProxy* self = MCE_PROXY(arg);
|
||||
GDEBUG("Name '%s' is owned by %s", name, owner);
|
||||
GASSERT(!self->valid);
|
||||
self->valid = TRUE;
|
||||
g_signal_emit(self, mce_proxy_signals[SIGNAL_VALID_CHANGED], 0);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
mce_name_vanished(
|
||||
GDBusConnection* bus,
|
||||
const gchar* name,
|
||||
gpointer arg)
|
||||
{
|
||||
MceProxy* self = MCE_PROXY(arg);
|
||||
GDEBUG("Name '%s' has disappeared", name);
|
||||
if (self->valid) {
|
||||
self->valid = FALSE;
|
||||
g_signal_emit(self, mce_proxy_signals[SIGNAL_VALID_CHANGED], 0);
|
||||
}
|
||||
}
|
||||
|
||||
MceProxy*
|
||||
mce_proxy_new()
|
||||
{
|
||||
/*
|
||||
* Since there's only one mce in the system, there's no need for
|
||||
* more than one proxy object.
|
||||
*/
|
||||
static MceProxy* mce_proxy_instance = NULL;
|
||||
if (mce_proxy_instance) {
|
||||
mce_proxy_ref(mce_proxy_instance);
|
||||
} else {
|
||||
mce_proxy_instance = g_object_new(MCE_PROXY_TYPE, NULL);
|
||||
g_object_add_weak_pointer(G_OBJECT(mce_proxy_instance),
|
||||
(gpointer*)(&mce_proxy_instance));
|
||||
}
|
||||
return mce_proxy_instance;
|
||||
}
|
||||
|
||||
MceProxy*
|
||||
mce_proxy_ref(
|
||||
MceProxy* self)
|
||||
{
|
||||
if (G_LIKELY(self)) {
|
||||
g_object_ref(MCE_PROXY(self));
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
void
|
||||
mce_proxy_unref(
|
||||
MceProxy* self)
|
||||
{
|
||||
if (G_LIKELY(self)) {
|
||||
g_object_unref(MCE_PROXY(self));
|
||||
}
|
||||
}
|
||||
|
||||
gulong
|
||||
mce_proxy_add_valid_changed_handler(
|
||||
MceProxy* self,
|
||||
MceProxyFunc fn,
|
||||
void* arg)
|
||||
{
|
||||
return (G_LIKELY(self) && G_LIKELY(fn)) ? g_signal_connect(self,
|
||||
SIGNAL_VALID_CHANGED_NAME, G_CALLBACK(fn), arg) : 0;
|
||||
}
|
||||
|
||||
void
|
||||
mce_proxy_remove_handler(
|
||||
MceProxy* self,
|
||||
gulong id)
|
||||
{
|
||||
if (G_LIKELY(self) && G_LIKELY(id)) {
|
||||
g_signal_handler_disconnect(self, id);
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
mce_proxy_init(
|
||||
MceProxy* self)
|
||||
{
|
||||
MceProxyPriv* priv = G_TYPE_INSTANCE_GET_PRIVATE(self, MCE_PROXY_TYPE,
|
||||
MceProxyPriv);
|
||||
self->priv = priv;
|
||||
priv->bus = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, NULL);
|
||||
self->signal = com_nokia_mce_signal_proxy_new_sync(priv->bus,
|
||||
G_DBUS_PROXY_FLAGS_NONE, MCE_SERVICE, MCE_SIGNAL_PATH, NULL, NULL);
|
||||
self->request = com_nokia_mce_request_proxy_new_sync(priv->bus,
|
||||
G_DBUS_PROXY_FLAGS_NONE, MCE_SERVICE, MCE_REQUEST_PATH, NULL, NULL);
|
||||
priv->mce_watch_id = g_bus_watch_name_on_connection(priv->bus,
|
||||
MCE_SERVICE, G_BUS_NAME_WATCHER_FLAGS_NONE,
|
||||
mce_name_appeared, mce_name_vanished, self, NULL);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
mce_proxy_finalize(
|
||||
GObject* object)
|
||||
{
|
||||
MceProxy* self = MCE_PROXY(object);
|
||||
MceProxyPriv* priv = self->priv;
|
||||
g_bus_unwatch_name(priv->mce_watch_id);
|
||||
g_object_unref(self->signal);
|
||||
g_object_unref(self->request);
|
||||
g_object_unref(priv->bus);
|
||||
G_OBJECT_CLASS(PARENT_CLASS)->finalize(object);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
mce_proxy_class_init(
|
||||
MceProxyClass* klass)
|
||||
{
|
||||
GObjectClass* object_class = G_OBJECT_CLASS(klass);
|
||||
object_class->finalize = mce_proxy_finalize;
|
||||
g_type_class_add_private(klass, sizeof(MceProxyPriv));
|
||||
mce_proxy_signals[SIGNAL_VALID_CHANGED] =
|
||||
g_signal_new(SIGNAL_VALID_CHANGED_NAME,
|
||||
G_OBJECT_CLASS_TYPE(klass), G_SIGNAL_RUN_FIRST,
|
||||
0, NULL, NULL, NULL, G_TYPE_NONE, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*/
|
||||
90
src/mce_proxy.h
Normal file
90
src/mce_proxy.h
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Jolla Ltd.
|
||||
* Contact: Slava Monich <slava.monich@jolla.com>
|
||||
*
|
||||
* You may use this file under the terms of BSD license as follows:
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of Jolla Ltd nor the names of its contributors may
|
||||
* be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation
|
||||
* are those of the authors and should not be interpreted as representing
|
||||
* any official policies, either expressed or implied.
|
||||
*/
|
||||
|
||||
#ifndef MCE_PROXY_H
|
||||
#define MCE_PROXY_H
|
||||
|
||||
#include "mce_types.h"
|
||||
|
||||
typedef struct mce_proxy_priv MceProxyPriv;
|
||||
struct _ComNokiaMceSignal;
|
||||
struct _ComNokiaMceRequest;
|
||||
|
||||
typedef struct mce_proxy {
|
||||
GObject object;
|
||||
MceProxyPriv* priv;
|
||||
gboolean valid;
|
||||
struct _ComNokiaMceSignal* signal;
|
||||
struct _ComNokiaMceRequest* request;
|
||||
} MceProxy;
|
||||
|
||||
typedef void
|
||||
(*MceProxyFunc)(
|
||||
MceProxy* proxy,
|
||||
void* arg);
|
||||
|
||||
MceProxy*
|
||||
mce_proxy_new(
|
||||
void);
|
||||
|
||||
MceProxy*
|
||||
mce_proxy_ref(
|
||||
MceProxy* proxy);
|
||||
|
||||
void
|
||||
mce_proxy_unref(
|
||||
MceProxy* proxy);
|
||||
|
||||
gulong
|
||||
mce_proxy_add_valid_changed_handler(
|
||||
MceProxy* proxy,
|
||||
MceProxyFunc fn,
|
||||
void* arg);
|
||||
|
||||
void
|
||||
mce_proxy_remove_handler(
|
||||
MceProxy* proxy,
|
||||
gulong id);
|
||||
|
||||
#endif /* MCE_PROXY_H */
|
||||
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: C
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*/
|
||||
Reference in New Issue
Block a user