-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jooyong
committed
Feb 1, 2018
0 parents
commit 351766a
Showing
661 changed files
with
122,981 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
## Abstract | ||
It serves as a kind of bridge between server to other-clients. | ||
connection with OPCUA server( https://github.com/FactoryThing/opcua_sensor_server ) and gathering data, send data using MQTT or TCP | ||
|
||
|
||
## Using open62541 | ||
A general introduction to OPC UA and the open62541 documentation can be found at http://open62541.org/doc/current. | ||
Past releases of the library can be downloaded at https://github.com/open62541/open62541/releases. | ||
To use the latest improvements, download a nightly build of the *single-file distribution* (the entire library merged into a single source and header file) from http://open62541.org/releases. | ||
Nightly builds of MSVC binaries of the library are available [here](https://ci.appveyor.com/project/open62541/open62541/build/artifacts). | ||
## Using json-c | ||
JSON-C implements a reference counting object model that allows you to easily construct JSON objects in C, output them as JSON formatted strings and parse JSON formatted strings back into the C representation of JSON objects. It aims to conform to RFC 7159. | ||
## Using paho.mqtt.embedded-c | ||
The Paho embedded client libraries arose out of the desire to allow the smallest microcontrollers to easily connect to MQTT servers. | ||
|
||
## Implementation | ||
### Pre-condition | ||
- mqtt : install ( https://mosquitto.org/ | mosquitto broker/ client) | ||
- json-c : build ( included ) | ||
- paho.mqtt.embedded-c : build ( included ) | ||
|
||
|
||
1) need to modify the path ( /home/mint/ ) | ||
- open62541_mqtt/mqtt/CMakeLists.txt need modify | ||
|
||
- EX) set(EXTER_MQTT_ROOT "/home/mint/paho.mqtt.embedded-c" CACHE STRING "MQTT paho header and library root path") | ||
- EX) set(EXTER_JSON_ROOT "/home/mint/json-c" CACHE STRING "JSON header and library root path") | ||
|
||
2) build | ||
- mkdir build | ||
- cd build | ||
- cmake .. -DUA_ENABLE_SUBSCRIPTIONS=true -DUA_ENABLE_METHODCALLS=true -DUA_ENABLE_NODEMANAGEMENT=true -DUA_ENABLE_NONSTANDARD_MQTT=true | ||
- make ( created bin folder : config.json, libopen62541.a, opcua-mqtt-bridge) | ||
|
||
|
||
3) config.json modify | ||
- open62541_mqtt/build/bin | ||
```c | ||
//EXAMPLE | ||
{ | ||
"device-configuration": { | ||
"Device": { | ||
"deviceID": "sensor0" | ||
} | ||
}, | ||
"server-configuration": { | ||
"opcuaServer": { | ||
"EndpointURL": "opc.tcp://localhost:16664", | ||
"publishIntervalUs":1000000, | ||
"asycRequestSupported": false, | ||
"method": "poll" | ||
}, | ||
"mqttBrocker": { | ||
"enable": true, | ||
"ip" : "192.168.0.197", | ||
"port": 1883, | ||
"topicBase": "topic" | ||
}, | ||
"tcpSever": { | ||
"enable": false, | ||
"ip": "192.168.2.104", | ||
"port": 5555, | ||
"sampleIntervalUs": 100, | ||
"singleshot": true /* at now : should be true */ | ||
} | ||
}, | ||
|
||
// 1usec = 1 | ||
// 1msec = 1000 | ||
// 1sec = 1000000 | ||
// 1min = 60000000 | ||
|
||
"node-map": [ | ||
{ | ||
"name": "test", | ||
"enable": true, | ||
"method": "poll", | ||
"intervalUSec": 1000000, | ||
"topic": "test_opcua", | ||
"mqtt": true, | ||
"format": "json", | ||
"nodes": [ | ||
{ "id": "ns=1;s=sound_data", "topic":"sound", "alias": "" }, | ||
{ "id": "ns=1;s=temp_data", "topic": "temp", "alias": "" }, | ||
{ "id": "ns=1;s=tilt_data", "topic": "tilt", "alias": "" } | ||
] | ||
} | ||
] | ||
} | ||
``` | ||
4) run | ||
- ./opcua-mqtt-bridge --config config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# EditorConfig | ||
# http://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# LF end-of-line, insert an empty new line and UTF-8 | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
charset = utf-8 | ||
|
||
# Tab indentation | ||
[makefile,Makefile] | ||
indent_style = tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# Temp files | ||
*~ | ||
*.swp | ||
*.bak | ||
*.backup | ||
\#* | ||
.\#* | ||
*\# | ||
*.sav | ||
*.save | ||
*.autosav | ||
*.autosave | ||
|
||
# Tests | ||
/test-driver | ||
/tests/Makefile | ||
/tests/Makefile.in | ||
/tests/test1 | ||
/tests/test1Formatted | ||
/tests/test2 | ||
/tests/test2Formatted | ||
/tests/test4 | ||
/tests/testReplaceExisting | ||
/tests/testSubDir | ||
/tests/test_cast | ||
/tests/test_charcase | ||
/tests/test_compare | ||
/tests/test_deep_copy | ||
/tests/test_double_serializer | ||
/tests/test_float | ||
/tests/test_int_add | ||
/tests/test_json_pointer | ||
/tests/test_locale | ||
/tests/test_null | ||
/tests/test_parse | ||
/tests/test_parse_int64 | ||
/tests/test_printbuf | ||
/tests/test_set_serializer | ||
/tests/test_set_value | ||
/tests/test_util_file | ||
/tests/test_visit | ||
/tests/*.vg.out | ||
/tests/*.log | ||
/tests/*.trs | ||
|
||
# Generated folders | ||
/Debug | ||
/Release | ||
/*/Debug | ||
/*/Release | ||
|
||
# Generated binaries | ||
*.lo | ||
*.o | ||
/libjson-c.la | ||
/libjson.la | ||
|
||
# Archives | ||
*.zip | ||
*.tar.* | ||
*.tgz | ||
*.gz | ||
*.bz2 | ||
*.xz | ||
*.lz | ||
*.lzma | ||
*.7z | ||
*.dll | ||
*.deb | ||
*.rpm | ||
*.apk | ||
*.exe | ||
*.msi | ||
*.dmg | ||
*.ipa | ||
|
||
.deps/ | ||
.libs/ | ||
/aclocal.m4 | ||
/autoconf-archive | ||
/autom4te.cache | ||
/config.guess | ||
/config.h.in | ||
/json_config.h | ||
/compile | ||
/config.h | ||
/config.log | ||
/config.status | ||
/config.sub | ||
/configure | ||
/depcomp | ||
/doc | ||
/install-sh | ||
/json.pc | ||
/json-c.pc | ||
/json-c-uninstalled.pc | ||
/libtool | ||
/ltmain.sh | ||
/Makefile | ||
/Makefile.in | ||
/missing | ||
/stamp-h1 | ||
/stamp-h2 | ||
|
||
# cmake auto-generated files | ||
/CMakeCache.txt | ||
/CMakeFiles | ||
/cmake_install.cmake | ||
/include | ||
/libjson-c.a | ||
/libjson-c.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
language: cpp | ||
|
||
compiler: | ||
- gcc | ||
- clang | ||
|
||
addons: | ||
apt: | ||
packages: | ||
- cppcheck | ||
|
||
os: | ||
- linux | ||
- osx | ||
|
||
before_install: | ||
- echo $LANG | ||
- echo $LC_ALL | ||
- set -e | ||
|
||
install: | ||
- sh autogen.sh | ||
|
||
before_script: | ||
- ./configure | ||
|
||
script: | ||
- make | ||
|
||
after_success: | ||
- make check | ||
- if type cppcheck &> /dev/null ; then cppcheck --error-exitcode=1 --quiet *.h *.c tests/ ; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Michael Clark <michael@metaparadigm.com> | ||
Jehiah Czebotar <jehiah@gmail.com> | ||
Eric Haszlakiewicz <hawicz+json-c@gmail.com> | ||
C. Watford (christopher.watford@gmail.com) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# This file is the top android makefile for all sub-modules. | ||
# | ||
# Suggested settings to build for Android: | ||
# | ||
# export PATH=$PATH:/opt/android-ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/ | ||
# export SYSROOT=/opt/android-ndk/platforms/android-9/arch-arm/usr/ | ||
# export LD=arm-linux-androideabi-ld | ||
# export CC="arm-linux-androideabi-gcc --sysroot=/opt/android-ndk/platforms/android-9/arch-arm" | ||
# | ||
# Then run autogen.sh, configure and make. | ||
# | ||
|
||
LOCAL_PATH := $(call my-dir) | ||
include $(CLEAR_VARS) | ||
|
||
json_c_TOP := $(LOCAL_PATH) | ||
|
||
JSON_C_BUILT_SOURCES := Android.mk | ||
|
||
JSON_C_BUILT_SOURCES := $(patsubst %, $(abspath $(json_c_TOP))/%, $(JSON_C_BUILT_SOURCES)) | ||
|
||
.PHONY: json-c-configure json-c-configure-real | ||
json-c-configure-real: | ||
echo $(JSON_C_BUILT_SOURCES) | ||
cd $(json_c_TOP) ; \ | ||
$(abspath $(json_c_TOP))/autogen.sh && \ | ||
CC="$(CONFIGURE_CC)" \ | ||
CFLAGS="$(CONFIGURE_CFLAGS)" \ | ||
LD=$(TARGET_LD) \ | ||
LDFLAGS="$(CONFIGURE_LDFLAGS)" \ | ||
CPP=$(CONFIGURE_CPP) \ | ||
CPPFLAGS="$(CONFIGURE_CPPFLAGS)" \ | ||
PKG_CONFIG_LIBDIR=$(CONFIGURE_PKG_CONFIG_LIBDIR) \ | ||
PKG_CONFIG_TOP_BUILD_DIR=/ \ | ||
ac_cv_func_malloc_0_nonnull=yes \ | ||
ac_cv_func_realloc_0_nonnull=yes \ | ||
$(abspath $(json_c_TOP))/$(CONFIGURE) --host=$(CONFIGURE_HOST) \ | ||
--prefix=/system \ | ||
&& \ | ||
for file in $(JSON_C_BUILT_SOURCES); do \ | ||
rm -f $$file && \ | ||
make -C $$(dirname $$file) $$(basename $$file) ; \ | ||
done | ||
|
||
json-c-configure: json-c-configure-real | ||
|
||
PA_CONFIGURE_TARGETS += json-c-configure | ||
|
||
-include $(json_c_TOP)/Android.mk |
Oops, something went wrong.