Signed-off-by: Jacob Stiffler <[email protected]>
---
 ...examples-client-allow-configurable-server.patch | 52 ++++++++++++++++++++
 .../open62541/open62541_git.bb                     | 57 ++++++++++++++++++++++
 2 files changed, 109 insertions(+)
 create mode 100644 
meta-arago-extras/recipes-connectivity/open62541/open62541/0001-examples-client-allow-configurable-server.patch
 create mode 100644 
meta-arago-extras/recipes-connectivity/open62541/open62541_git.bb

diff --git 
a/meta-arago-extras/recipes-connectivity/open62541/open62541/0001-examples-client-allow-configurable-server.patch
 
b/meta-arago-extras/recipes-connectivity/open62541/open62541/0001-examples-client-allow-configurable-server.patch
new file mode 100644
index 0000000..1cf89a9
--- /dev/null
+++ 
b/meta-arago-extras/recipes-connectivity/open62541/open62541/0001-examples-client-allow-configurable-server.patch
@@ -0,0 +1,52 @@
+From da2b9a741c3116a7774989f6338976c00a4c0496 Mon Sep 17 00:00:00 2001
+From: Jacob Stiffler <[email protected]>
+Date: Wed, 28 Nov 2018 14:31:22 -0500
+Subject: [PATCH] examples: client: allow configurable server
+
+* Enable a remote server URL to be provided as an argument.
+* Default to localhost if no arguments are provided.
+
+Upstream-Status: Pending
+
+Signed-off-by: Jacob Stiffler <[email protected]>
+---
+ examples/client.c | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/examples/client.c b/examples/client.c
+index c3147b7..90ab1c7 100644
+--- a/examples/client.c
++++ b/examples/client.c
+@@ -25,12 +25,17 @@ nodeIter(UA_NodeId childId, UA_Boolean isInverse, 
UA_NodeId referenceTypeId, voi
+ }
+ 
+ int main(int argc, char *argv[]) {
++    char *ua_server = "opc.tcp://localhost:4840";
++    if(argc > 1) {
++        ua_server = argv[1];
++    }
++
+     UA_Client *client = UA_Client_new(UA_ClientConfig_default);
+ 
+     /* Listing endpoints */
+     UA_EndpointDescription* endpointArray = NULL;
+     size_t endpointArraySize = 0;
+-    UA_StatusCode retval = UA_Client_getEndpoints(client, 
"opc.tcp://localhost:4840",
++    UA_StatusCode retval = UA_Client_getEndpoints(client, ua_server,
+                                                   &endpointArraySize, 
&endpointArray);
+     if(retval != UA_STATUSCODE_GOOD) {
+         UA_Array_delete(endpointArray, endpointArraySize, 
&UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
+@@ -46,8 +51,8 @@ int main(int argc, char *argv[]) {
+     UA_Array_delete(endpointArray,endpointArraySize, 
&UA_TYPES[UA_TYPES_ENDPOINTDESCRIPTION]);
+ 
+     /* Connect to a server */
+-    /* anonymous connect would be: retval = UA_Client_connect(client, 
"opc.tcp://localhost:4840"); */
+-    retval = UA_Client_connect_username(client, "opc.tcp://localhost:4840", 
"user1", "password");
++    /* anonymous connect would be: retval = UA_Client_connect(client, 
ua_server); */
++    retval = UA_Client_connect_username(client, ua_server, "user1", 
"password");
+     if(retval != UA_STATUSCODE_GOOD) {
+         UA_Client_delete(client);
+         return (int)retval;
+-- 
+2.7.4
+
diff --git a/meta-arago-extras/recipes-connectivity/open62541/open62541_git.bb 
b/meta-arago-extras/recipes-connectivity/open62541/open62541_git.bb
new file mode 100644
index 0000000..1166e26
--- /dev/null
+++ b/meta-arago-extras/recipes-connectivity/open62541/open62541_git.bb
@@ -0,0 +1,57 @@
+SUMMARY = "Open source implementation of OPC UA"
+HOMEPAGE = "http://open62541.org/";
+LICENSE = "MPL-2.0"
+
+LIC_FILES_CHKSUM = "file://LICENSE;md5=815ca599c9df247a0c7f619bab123dad"
+
+SRC_URI = 
"git://github.com/open62541/open62541.git;protocol=https;branch=${BRANCH} \
+           file://0001-examples-client-allow-configurable-server.patch"
+
+BRANCH = "0.3"
+SRCREV = "9f46963240854d9a65d1784a3d2d8440c70157e8"
+
+PV = "0.3-rc4+git${SRCPV}"
+
+inherit cmake python3native
+
+DEPENDS += "python3-six-native libcheck"
+
+S = "${WORKDIR}/git"
+
+EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=RelWithDebInfo -DUA_BUILD_EXAMPLES=1 
-DUA_BUILD_UNIT_TESTS=1"
+
+PACKAGECONFIG[sharedlibs] = "-DBUILD_SHARED_LIBS=1,-DBUILD_SHARED_LIBS=0,,"
+PACKAGECONFIG[encrypt] = "-DUA_ENABLE_ENCRYPTION=1 
-DMBEDTLS_FOLDER_LIBRARY=${STAGING_LIBDIR} 
-DMBEDTLS_FOLDER_INCLUDE=${STAGING_INCDIR},-DUA_ENABLE_ENCRYPTION=0,mbedtls,"
+
+# Current mbedtls is not sufficient.
+PACKAGECONFIG ?= ""
+
+do_install_append() {
+    # header file is not installed by default
+    install -d ${D}${includedir}
+    install -m 644 ${B}/open62541.h ${D}${includedir}
+
+    # Install examples
+    install -d "${D}${datadir}/${BPN}/examples"
+    for example in ${B}/bin/examples/*
+    do
+        install -m 755 "$example" "${D}${datadir}/${BPN}/examples"
+    done
+
+    # Install unittests
+    install -d "${D}${datadir}/${BPN}/tests"
+    for test in ${B}/bin/tests/*
+    do
+        install -m 755 "$test" "${D}${datadir}/${BPN}/tests"
+    done
+}
+
+PACKAGES =+ "${PN}-examples ${PN}-tests"
+FILES_${PN}-dev += "${libdir}/cmake/*"
+FILES_${PN}-examples += "${datadir}/${BPN}/examples"
+FILES_${PN}-tests += "${datadir}/${BPN}/tests"
+
+# Allow staticdev package to be empty incase sharedlibs is switched on
+ALLOW_EMPTY_${PN}-staticdev = "1"
+
+BBCLASSEXTEND = "native nativesdk"
-- 
2.7.4

_______________________________________________
meta-arago mailing list
[email protected]
http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago

Reply via email to