Procházet zdrojové kódy

main.c seems to work,
uncommented @uleon 's decodeVariant code from basictypes.c

Stasik0 před 11 roky
rodič
revize
92be86424e
2 změnil soubory, kde provedl 8 přidání a 11 odebrání
  1. 7 4
      tool/main.c
  2. 1 7
      tool/opcua_basictypes.c

+ 7 - 4
tool/main.c

@@ -9,23 +9,26 @@
 #include "opcua.h"
 
 typedef union Integer {
-	Int32 i;
+	UA_Int32 i;
 	SByte b[4];
 } Integer;
 
 int main() {
-	Integer a = { 0x11 };
+	Integer a;
 	Integer b;
 	int pos = 0;
 
-	a.i = 0;
-	a.b[3] = 1;
+	UA_Int32 i = -42;
 
+	UA_Int32_encode(&i, &pos, &a.b[0]);
 	printf("%d, {%d,%d,%d,%d}\n", a.i, a.b[0], a.b[1], a.b[2], a.b[3]);
 
+	pos = 0;
 	UA_Int32_decode((char *) &a.b[0], &pos, &(b.i));
 	printf("%d, {%d,%d,%d,%d}\n", b.i, b.b[0], b.b[1], b.b[2], b.b[3]);
 
+	printf("%i\n", UA_Int32_calcSize(b.i));
+
 	return 0;
 }
 

+ 1 - 7
tool/opcua_basictypes.c

@@ -11,9 +11,7 @@
 
 
 Int32 UA_calcSize(void* const data, UInt32 type) {
-	//return (UA_namespace_zero[type].calcSize)(data);
-	//FIXME:
-	return 0;
+	return (UA_namespace_zero[type].calcSize)(data);
 }
 
 Int32 UA_Array_calcSize(Int32 nElements, Int32 type, void const ** data) {
@@ -839,11 +837,7 @@ Int32 UA_Variant_encode(UA_Variant const *src, Int32* pos, char *dst) {
 	return retval;
 }
 
-//FIXME:
 Int32 UA_Variant_decode(char const * src, Int32 *pos, UA_Variant *dst) {
-	return UA_SUCCESS;
-
-	//FIXME:
 	Int32 retval = UA_SUCCESS;
 	Int32 ns0Id;
 	int i;