Преглед на файлове

Merge branch 'master' of https://github.com/Stasik0/Open62541

FlorianPalm преди 11 години
родител
ревизия
fd676f85f6
променени са 1 файла, в които са добавени 19 реда и са изтрити 0 реда
  1. 19 0
      OPCUAServer/src/opcua_binaryEncDec.c

+ 19 - 0
OPCUAServer/src/opcua_binaryEncDec.c

@@ -46,6 +46,13 @@ Int16 decodeInt16(const char* buf, Int32 *pos)
 	*pos += 2;
 	return t1 + t2;
 }
+
+void encodeInt16(Int16 value, Int32 *pos, AD_RawMessage *dstBuf)
+{
+	memcpy(dstBuf->message, &value, sizeof(Int16));
+	*pos = (*pos) + sizeof(Int16);
+}
+
 Int32 decodeInt32(const char* buf, Int32 *pos)
 {
 
@@ -57,6 +64,12 @@ Int32 decodeInt32(const char* buf, Int32 *pos)
 	return t1 + t2 + t3 + t4;
 }
 
+void encodeInt32(Int32 value, Int32 *pos, AD_RawMessage *dstBuf)
+{
+	memcpy(dstBuf->message, &value, sizeof(Int32));
+	*pos = (*pos) + sizeof(Int32);
+}
+
 UInt32 decodeUInt32(const char* buf, Int32 *pos)
 {
 	Byte t1 = buf[*pos];
@@ -89,6 +102,12 @@ Int64 decodeInt64(const char* buf, Int32 *pos)
 	return t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8;
 }
 
+void encodeInt64(Int64 value, Int64 *pos, AD_RawMessage *dstBuf)
+{
+	memcpy(dstBuf->message, &value, sizeof(Int64));
+	*pos = (*pos) + sizeof(Int64);
+}
+
 Int32 decodeUAString(const char* buf, Int32 *pos, UA_String *dstUAString)
 {