Skip to content

Commit 40ffe01

Browse files
Merge branch 'master' into development/METROL-1196
2 parents 148f113 + 907b0c2 commit 40ffe01

File tree

12 files changed

+3213
-0
lines changed

12 files changed

+3213
-0
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ option(PLUGIN_DICTIONARY "Include Dictionary plugin" OFF)
3737
option(PLUGIN_DOGGO "Include watchdog plugin" OFF)
3838
option(PLUGIN_IOCONNECTOR "Include IOConnector plugin" OFF)
3939
option(PLUGIN_INPUTSWITCH "Include InputSwitch plugin" OFF)
40+
option(PLUGIN_JSONRPCMUXER "Include JsonRpcMuxer plugin capable to execute batched jsonRPC messages" OFF)
4041
option(PLUGIN_FIRMWARECONTROL "Include FirmwareControl Plugin" OFF)
4142
option(PLUGIN_PROCESSMONITOR "Include Process Monitor plugin" OFF)
4243
option(PLUGIN_LANGUAGEADMINISTRATOR "Include LanguageAdministrator plugin" OFF)
@@ -158,6 +159,10 @@ if(PLUGIN_INPUTSWITCH)
158159
add_subdirectory(InputSwitch)
159160
endif()
160161

162+
if(PLUGIN_JSONRPCMUXER)
163+
add_subdirectory(JsonRpcMuxer)
164+
endif()
165+
161166
if(PLUGIN_SICONTROL)
162167
add_subdirectory (SIControl)
163168
endif(PLUGIN_SICONTROL)

JsonRpcMuxer/CMakeLists.txt

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# If not stated otherwise in this file or this component's LICENSE file the
2+
# following copyright and licenses apply:
3+
#
4+
# Copyright 2020 Metrological
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
project(JsonRpcMuxer)
19+
20+
cmake_minimum_required(VERSION 3.15)
21+
22+
find_package(Thunder)
23+
24+
project_version(1.0.0)
25+
26+
set(MODULE_NAME ${NAMESPACE}${PROJECT_NAME})
27+
28+
message("Setup ${MODULE_NAME} v${PROJECT_VERSION}")
29+
30+
set(PLUGIN_JSONRPCMUXER_STARTMODE "Activated" CACHE STRING "Automatically start JsonRpcMuxer plugin")
31+
set(PLUGIN_JSONRPCMUXER_MAX_CONCURRENT_JOBS 0 CACHE STRING "Maximum number of concurrent WorkerPool jobs")
32+
set(PLUGIN_JSONRPCMUXER_MAX_BATCH_SIZE 0 CACHE STRING "Maximum requests per batch")
33+
34+
if(BUILD_REFERENCE)
35+
add_definitions(-DBUILD_REFERENCE=${BUILD_REFERENCE})
36+
endif()
37+
38+
find_package(${NAMESPACE}Plugins REQUIRED)
39+
find_package(CompileSettingsDebug CONFIG REQUIRED)
40+
41+
add_library(${MODULE_NAME} SHARED
42+
JsonRpcMuxer.cpp
43+
Module.cpp)
44+
45+
target_compile_definitions(${MODULE_NAME} PRIVATE
46+
PLUGIN_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}
47+
PLUGIN_VERSION_MINOR=${PROJECT_VERSION_MINOR}
48+
PLUGIN_VERSION_PATCH=${PROJECT_VERSION_PATCH}
49+
)
50+
51+
set_target_properties(${MODULE_NAME} PROPERTIES
52+
CXX_STANDARD 11
53+
CXX_STANDARD_REQUIRED YES)
54+
55+
target_link_libraries(${MODULE_NAME}
56+
PRIVATE
57+
CompileSettingsDebug::CompileSettingsDebug
58+
${NAMESPACE}Plugins::${NAMESPACE}Plugins)
59+
60+
install(TARGETS ${MODULE_NAME}
61+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/${STORAGE_DIRECTORY}/plugins COMPONENT ${NAMESPACE}_Runtime)
62+
63+
write_config()

JsonRpcMuxer/JsonRpcMuxer.conf.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
startmode = "@PLUGIN_JSONRPCMUXER_STARTMODE@"
2+
3+
configuration = JSON()
4+
5+
if @PLUGIN_JSONRPCMUXER_MAX_CONCURRENT_JOBS@:
6+
configuration.add("maxconcurrentjobs", "@PLUGIN_JSONRPCMUXER_MAX_CONCURRENT_JOBS@")
7+
8+
if @PLUGIN_JSONRPCMUXER_MAX_BATCH_SIZE@:
9+
configuration.add("maxbatchsize", "@PLUGIN_JSONRPCMUXER_MAX_BATCH_SIZE@")

0 commit comments

Comments
 (0)