Forráskód Böngészése

Merge branch 'automation' of https://github.com/acplt/open62541 into automation

Conflicts:
	examples/src/opcuaServer.c
FlorianPalm 10 éve
szülő
commit
cc7fe324d7
4 módosított fájl, 26 hozzáadás és 28 törlés
  1. 23 24
      examples/src/opcuaServer.c
  2. 1 0
      examples/src/raspberrypi_io.h
  3. 0 2
      src/ua_types.h
  4. 2 2
      tools/generate_builtin.py

+ 23 - 24
examples/src/opcuaServer.c

@@ -78,38 +78,37 @@ int main(int argc, char** argv) {
     if (i == 0)
     {
     	Namespace* ns0 = (Namespace*)UA_indexedList_find(appMockup.namespaces, 0)->payload;
+		const UA_Node *foundNode1 = UA_NULL;
+		const UA_Node *foundNode2 = UA_NULL;
+		const UA_Node *foundNode3 = UA_NULL;
+		Namespace_Entry_Lock *lock;
+		//node which should be filled with data (float value)
+		UA_NodeId tmpNodeId1;
+		UA_NodeId tmpNodeId2;
+		UA_NodeId tmpNodeId3;
+
+		tmpNodeId1.encodingByte = UA_NODEIDTYPE_TWOBYTE;
+		tmpNodeId1.identifier.numeric = 108;
+		tmpNodeId1.namespace =  0;
+
+		tmpNodeId2.encodingByte = UA_NODEIDTYPE_TWOBYTE;
+		tmpNodeId2.identifier.numeric = 109;
+		tmpNodeId2.namespace =  0;
+
+		tmpNodeId3.encodingByte = UA_NODEIDTYPE_TWOBYTE;
+		tmpNodeId3.identifier.numeric = 110;
+		tmpNodeId3.namespace =  0;
     	while(1){
-			const UA_Node *foundNode1 = UA_NULL;
-			const UA_Node *foundNode2 = UA_NULL;
-			const UA_Node *foundNode3 = UA_NULL;
-			Namespace_Entry_Lock *lock;
-			//node which should be filled with data (float value)
-			UA_NodeId tmpNodeId1;
-			UA_NodeId tmpNodeId2;
-			UA_NodeId tmpNodeId3;
-
-			tmpNodeId1.encodingByte = UA_NODEIDTYPE_TWOBYTE;
-			tmpNodeId1.identifier.numeric = 108;
-			tmpNodeId1.namespace =  0;
-
-			tmpNodeId2.encodingByte = UA_NODEIDTYPE_TWOBYTE;
-			tmpNodeId2.identifier.numeric = 109;
-			tmpNodeId2.namespace =  0;
-
-			tmpNodeId3.encodingByte = UA_NODEIDTYPE_TWOBYTE;
-			tmpNodeId3.identifier.numeric = 110;
-			tmpNodeId3.namespace =  0;
-
 			if(Namespace_get(ns0,&tmpNodeId1, &foundNode1,&lock) != UA_SUCCESS){
-				return UA_ERROR;
+				_exit(1);
 			}
 
 			if(Namespace_get(ns0,&tmpNodeId2, &foundNode2,&lock) != UA_SUCCESS){
-				return UA_ERROR;
+				_exit(1);
 			}
 
 			if(Namespace_get(ns0,&tmpNodeId3, &foundNode3,&lock) != UA_SUCCESS){
-				return UA_ERROR;
+				_exit(1);
 			}
 			readTemp((float*)((UA_VariableNode *)foundNode1)->value.data);
 			writePin(*((UA_Boolean*)((UA_VariableNode *)foundNode2)->value.data),0);

+ 1 - 0
examples/src/raspberrypi_io.h

@@ -17,5 +17,6 @@
 #include "string.h"
 int readTemp(float *temp);
 int writePin(_Bool state, int pin);
+int initIO();
 
 #endif /* RASPBERRYPI_IO_H_ */

+ 0 - 2
src/ua_types.h

@@ -318,8 +318,6 @@ void UA_ByteString_printx_hex(char *label, const UA_ByteString *string);
 UA_Int32 UA_NodeId_equal(const UA_NodeId *n1, const UA_NodeId *n2);
 void UA_NodeId_printf(char *label, const UA_NodeId *node);
 UA_Boolean UA_NodeId_isNull(const UA_NodeId *p);
-UA_Int16 UA_NodeId_getNamespace(UA_NodeId const *id);
-UA_Int16 UA_NodeId_getIdentifier(UA_NodeId const *id);
 UA_Boolean UA_NodeId_isBasicType(UA_NodeId const *id);
 
 /* ExpandedNodeId */

+ 2 - 2
tools/generate_builtin.py

@@ -16,8 +16,8 @@ ns = {"opc": "http://opcfoundation.org/BinarySchema/"}
 tree = etree.parse(sys.argv[1])
 types = tree.xpath("/opc:TypeDictionary/*[not(self::opc:Import)]", namespaces=ns)
 
-fh = open(sys.argv[2] + ".h",'w');
-fc = open(sys.argv[2] + ".c",'w');
+fh = open(sys.argv[2] + ".h",'w')
+fc = open(sys.argv[2] + ".c",'w')
 
 # dirty hack. we go up the call frames to access local variables of the calling
 # function. this allows to shorten code and get %()s replaces with less clutter.