Skip to content

Commit

Permalink
webOS Open Source Edition initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
Changhyeok Bae committed Mar 17, 2018
0 parents commit 8c7d87c
Show file tree
Hide file tree
Showing 33 changed files with 3,707 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright (c) 2015-2018 LG Electronics, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

# Common Eclipse project files
.project
.cproject

#Clion project files
.idea

# Ignore the build artifacts.
BUILD*
/build
release-*/
debug-*/
CMakeCache.txt
cmake_install.cmake
CMakeFiles
conf/*.conf
doc/Doxyfile
doc/html
patches
src/*.pc
*.orig
src/config.h
102 changes: 102 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Copyright (c) 2015-2018 LG Electronics, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 2.8.7)

project(event-monitor CXX)

include(webOS/webOS)
webos_modules_init(1 6 0)
webos_component(1 1 0)

webos_add_compiler_flags(ALL -Wall -std=c++11)

if (_LOCAL_BUILD)
webos_add_compiler_flags(ALL -DSECURITY_COMPATIBILITY)
endif (_LOCAL_BUILD)

include(FindPkgConfig)

pkg_check_modules(GLIB2 REQUIRED glib-2.0)
include_directories(${GLIB2_INCLUDE_DIRS})
webos_add_compiler_flags(ALL ${GLIB2_CFLAGS_OTHER})

pkg_check_modules(LUNASERVICE2PP REQUIRED luna-service2++)
include_directories(${LUNASERVICE2PP_INCLUDE_DIRS})
webos_add_compiler_flags(ALL ${LUNASERVICE2PP_CFLAGS_OTHER})

pkg_check_modules(PBNJSON_CPP REQUIRED pbnjson_cpp)
include_directories(${PBNJSON_CPP_INCLUDE_DIRS})
webos_add_compiler_flags(ALL ${PBNJSON_CPP_CFLAGS_OTHER})

pkg_check_modules(PMLOG REQUIRED PmLogLib)
include_directories(${PMLOG_INCLUDE_DIRS})
webos_add_compiler_flags(ALL ${PMLOG_CFLAGS_OTHER})

pkg_check_modules(I18N REQUIRED webosi18n)
include_directories(${I18N_INCLUDE_DIRS})
webos_add_compiler_flags(ALL ${I18N_CFLAGS_OTHER})


# Require that all undefined symbols are satisfied by the libraries from target_link_libraries()
webos_add_linker_options(ALL --no-undefined)

include_directories(include/public)

######## Service ########

set(LIBS
${GLIB2_LDFLAGS}
${PBNJSON_CPP_LDFLAGS}
${PMLOG_LDFLAGS}
${LUNASERVICE2PP_LDFLAGS}
${I18N_LDFLAGS}
dl
)

file(GLOB SOURCES src/service/*.cpp)

webos_configure_source_files(SOURCES src/config.h)
webos_add_compiler_flags(ALL -I${CMAKE_CURRENT_BINARY_DIR}/Configured/src)

add_executable(event-monitor ${SOURCES})
target_link_libraries(event-monitor ${LIBS})
webos_build_daemon()
webos_build_system_bus_files()

######## Headers for plugins ########

install(DIRECTORY "include/public/" DESTINATION @WEBOS_INSTALL_INCLUDEDIR@ FILES_MATCHING PATTERN "*.h*" PATTERN ".*" EXCLUDE)

######## Mock plugin ########
if (BUILD_MOCK_PLUGIN)

set(MOCK_LIBS
${GLIB2_LDFLAGS}
${PBNJSON_CPP_LDFLAGS}
${PMLOG_LDFLAGS}
${I18N_LDFLAGS}
)

file(GLOB MOCK_SOURCES src/mockplugin/*.cpp)

set(CMAKE_SHARED_MODULE_PREFIX "")
add_library(mock-plugin MODULE ${MOCK_SOURCES})
target_link_libraries(mock-plugin ${MOCK_LIBS})

install(TARGETS mock-plugin DESTINATION ${WEBOS_EVENT_MONITOR_PLUGIN_PATH})

endif (BUILD_MOCK_PLUGIN)
89 changes: 89 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
event-monitor
=============

Summary
-------
webOS event monitor service.

Description
-----------
Event monitor is a service to monitor events from system services and show UI
notifications on relevant events.
Event monitor provides common framework for monitoring events. Actual business
logic is implemented in plugins. A mock plugin is provided for testing.

How to Build on Linux
=====================

## Dependencies

Below are the tools and libraries (and their minimum versions) required to build
event-monitor:

* cmake (version required by webosose/cmake-modules-webos)
* gcc 4.7.2
* glib-2.0 2.32.1
* make (any version)
* webosose/pbnjson_cpp 1.3.0
* webosose/luna-service2 3.9.5
* pkg-config 0.26
* pmloglib

## Building

Once you have downloaded the source, enter the following to build it (after
changing into the directory under which it was downloaded):

$ mkdir BUILD
$ cd BUILD
$ cmake ..
$ make
$ sudo make install

The directory under which the files are installed defaults to `/usr/local/webos`.
You can install them elsewhere by supplying a value for `WEBOS_INSTALL_ROOT`
when invoking `cmake`. For example:

$ cmake -D WEBOS_INSTALL_ROOT:PATH=$HOME/projects/webos-pro ..
$ make
$ make install

will install the files in subdirectories of `$HOME/projects/webos-pro`.

Specifying `WEBOS_INSTALL_ROOT` also causes `pkg-config` to look in that tree
first before searching the standard locations. You can specify additional
directories to be searched prior to this one by setting the `PKG_CONFIG_PATH`
environment variable.

If not specified, `WEBOS_INSTALL_ROOT` defaults to `/usr/local/webos`.

To configure for a debug build, enter:

$ cmake -D CMAKE_BUILD_TYPE:STRING=Debug ..

To see a list of the make targets that `cmake` has generated, enter:

$ make help

## Uninstalling

From the directory where you originally ran `make install`, enter:

$ [sudo] make uninstall

You will need to use `sudo` if you did not specify `WEBOS_INSTALL_ROOT`.

# Copyright and License Information

Unless otherwise specified, all content, including all source code files and
documentation files in this repository are:

Copyright (c) 2015-2018 LG Electronics, Inc.

All content, including all source code files and documentation files in this repository except otherwise noted are: Licensed under the Apache License, Version 2.0 (the "License"); you may not use this content except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0
18 changes: 18 additions & 0 deletions astyle_options
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
style=ansi
indent=tab=4
indent-switches
indent-namespaces
indent-col1-comments
break-blocks
pad-oper
pad-header
unpad-paren
align-pointer=name
align-reference=name
add-brackets
convert-tabs
close-templates
break-after-logical
max-code-length=80
lineend=linux

27 changes: 27 additions & 0 deletions files/launch/event-monitor.conf.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright (c) 2015-2018 LG Electronics, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

description "@WEBOS_PROJECT_SUMMARY@"

start on settingsservice-ready
stop on started start_update

respawn

# Comment this line out to suppress logs on the console
#console output

exec @WEBOS_INSTALL_SBINDIR@/event-monitor
14 changes: 14 additions & 0 deletions files/sysbus/com.webos.service.eventmonitor.api.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"eventmonitor.plugins": [
"com.webos.service.eventmonitor/mockPlugin/action",
"com.webos.service.eventmonitor/mockPlugin/getEvents",
"com.webos.service.eventmonitor/network/starfish/enableWifiDirectNotifications",
"com.webos.service.eventmonitor/network/starfish/alertClose"
],
"private": [
"com.webos.service.eventmonitor/mockPlugin/action",
"com.webos.service.eventmonitor/mockPlugin/getEvents",
"com.webos.service.eventmonitor/network/starfish/enableWifiDirectNotifications",
"com.webos.service.eventmonitor/network/starfish/alertClose"
]
}
14 changes: 14 additions & 0 deletions files/sysbus/com.webos.service.eventmonitor.perm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"com.webos.service.eventmonitor": [
"settings",
"notifications",
"applications",
"applications.internal",
"networking.query",
"devices",
"nfc.query",
"services",
"networking.internal",
"tv.management"
]
}
26 changes: 26 additions & 0 deletions files/sysbus/com.webos.service.eventmonitor.role.json.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"exeName":"@WEBOS_INSTALL_SBINDIR@/event-monitor",
"type": "regular",
"allowedNames": ["com.webos.service.eventmonitor"],
"permissions": [
{
"service":"com.webos.service.eventmonitor",
"outbound":[
"com.webos.service.eventmonitor",
"com.webos.settingsservice",
"com.webos.service.bus",
"com.webos.notification",
"com.webos.applicationManager",
"com.webos.service.connectionmanager",
"com.webos.service.bluetooth2",
"com.webos.service.nfc",
"com.lge.service.systemui",
"com.webos.service.battery",
"com.palm.display",
"com.lge.settingmanager",
"com.webos.service.wifi",
"com.webos.service.tvpower"
]
}
]
}
20 changes: 20 additions & 0 deletions files/sysbus/com.webos.service.eventmonitor.service.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright (c) 2015-2018 LG Electronics, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

[D-BUS Service]
Name=com.webos.service.eventmonitor
Exec=@WEBOS_INSTALL_SBINDIR@/event-monitor
Type=static
Loading

0 comments on commit 8c7d87c

Please sign in to comment.