소스 검색

starting to build up a binary... current status: segfault

Stasik0 10 년 전
부모
커밋
f2e7bf9a87
3개의 변경된 파일20개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      CMakeLists.txt
  2. 6 0
      examples/client_proper.c
  3. 13 0
      include/ua_client.h

+ 1 - 1
CMakeLists.txt

@@ -219,7 +219,7 @@ if(BUILD_EXAMPLECLIENT)
 	message(STATUS "Extensions: enabling client")
 	add_definitions( -DBENCHMARK=1 )
 	add_executable(exampleClient $<TARGET_OBJECTS:open62541-object> examples/client.c)
-	add_executable(exampleClient_proper $<TARGET_OBJECTS:open62541-object> examples/client_proper.c)
+	add_executable(exampleClient_proper $<TARGET_OBJECTS:open62541-object> examples/client_proper.c examples/networklayer_tcp.c)
     target_include_directories(exampleClient PRIVATE ${PROJECT_BINARY_DIR})
     if(ENABLE_MULTITHREADING)
         target_link_libraries(exampleClient urcu-cds urcu urcu-common pthread)

+ 6 - 0
examples/client_proper.c

@@ -5,7 +5,13 @@
     #include "open62541.h"
 #endif
 
+#include "networklayer_tcp.h"
+
+
 int main(int argc, char *argv[]) {
 	UA_Client *client = UA_Client_new();
+	UA_ClientNetworkLayer nl = ClientNetworkLayerTCP_new(UA_ConnectionConfig_standard);
+    UA_Client_connect(client, UA_ConnectionConfig_standard, nl, "opc.tcp://localhost:16664");
+
 	free(client);
 }

+ 13 - 0
include/ua_client.h

@@ -1,3 +1,10 @@
+#ifndef UA_CLIENT_H_
+#define UA_CLIENT_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #include "ua_util.h"
 #include "ua_types.h"
 #include "ua_connection.h"
@@ -29,3 +36,9 @@ UA_StatusCode UA_EXPORT UA_Client_disconnect(UA_Client *c);
 UA_ReadResponse UA_EXPORT UA_Client_read(UA_Client *c, const UA_ReadRequest *request);
 UA_WriteResponse UA_EXPORT UA_Client_write(UA_Client *c, const UA_WriteRequest *request);
 UA_BrowseResponse UA_EXPORT UA_Client_browse(UA_Client *c, const UA_BrowseRequest *request);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* UA_CLIENT_H_ */