Explorar el Código

added some new headers
added encoding/decoding functionality

FlorianPalm hace 11 años
padre
commit
351c55064d

+ 117 - 59
OPCUAServer/src/opcua_binaryEncDec.c

@@ -20,6 +20,7 @@ Byte decodeByte(const char *buf, Int32 *pos)
 	return (Byte) buf[(*pos) - 1];
 
 }
+
 void encodeByte(Byte encodeByte, Int32 *pos, char *dstBuf)
 {
 	dstBuf[*pos] = encodeByte;
@@ -52,9 +53,9 @@ Int16 decodeInt16(const char* buf, Int32 *pos)
 	return t1 + t2;
 }
 
-void encodeInt16(Int16 value, Int32 *pos, AD_RawMessage *dstBuf)
+void encodeInt16(Int16 value, Int32 *pos, char *dstBuf)
 {
-	memcpy(dstBuf->message, &value, sizeof(Int16));
+	memcpy(dstBuf, &value, sizeof(Int16));
 	*pos = (*pos) + sizeof(Int16);
 }
 
@@ -69,9 +70,9 @@ Int32 decodeInt32(const char* buf, Int32 *pos)
 	return t1 + t2 + t3 + t4;
 }
 
-void encodeInt32(Int32 value, Int32 *pos, AD_RawMessage *dstBuf)
+void encodeInt32(Int32 value, Int32 *pos, char *dstBuf)
 {
-	memcpy(dstBuf->message, &value, sizeof(Int32));
+	memcpy(dstBuf, &value, sizeof(Int32));
 	*pos = (*pos) + sizeof(Int32);
 }
 
@@ -92,7 +93,6 @@ void encodeUInt32(UInt32 value, Int32 *pos,char *dstBuf)
 
 }
 
-
 Int64 decodeInt64(const char* buf, Int32 *pos)
 {
 
@@ -108,13 +108,39 @@ Int64 decodeInt64(const char* buf, Int32 *pos)
 	return t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8;
 }
 
-void encodeInt64(Int64 value, Int64 *pos, char *dstBuf)
+void encodeInt64(Int64 value, Int32 *pos, char *dstBuf)
 {
 	memcpy(dstBuf, &value, sizeof(Int64));
 	*pos = (*pos) + sizeof(Int64);
 }
 
-Int32 decodeUAString(const char* buf, Int32 *pos, UA_String *dstUAString)
+Float decodeFloat(char *buf, Int32 *pos)
+{
+	Float tmpFloat;
+	tmpFloat = (Float)(buf[*pos]);
+	*pos += sizeof(Float);
+	return tmpFloat;
+}
+Int32 encodeFloat(Float value,Int32 *pos,char *dstBuf)
+{
+	memcpy(&(dstBuf[*pos]), &value, sizeof(Float));
+	*pos *= sizeof(Float);
+	return UA_NO_ERROR;
+}
+Double decodeDouble(char *buf, Int32 *pos)
+{
+	Double tmpDouble;
+	tmpDouble = (Double)(buf[*pos]);
+	*pos += sizeof(Double);
+	return tmpDouble;
+}
+Int32 encodeDouble(Double value, Int32 *pos,char *dstBuf)
+{
+	memcpy(&(dstBuf[*pos]),&value,sizeof(Double));
+	*pos *= sizeof(Double);
+	return UA_NO_ERROR;
+}
+Int32 decodeUAString(char *const buf, Int32 *pos, UA_String *dstUAString)
 {
 
 	dstUAString->Length = decodeInt32(buf, pos);
@@ -130,6 +156,7 @@ Int32 decodeUAString(const char* buf, Int32 *pos, UA_String *dstUAString)
 	*pos += dstUAString->Length;
 	return 0;
 }
+
 Int32 encodeUAString(UA_String *string, Int32 *pos, char *dstBuf)
 {
 	if(string->Length > 0)
@@ -147,6 +174,7 @@ Int32 encodeUAString(UA_String *string, Int32 *pos, char *dstBuf)
 	}
 	return 0;
 }
+
 Int32 UAString_calcSize(UA_String *string)
 {
 	if(string->Length>0)
@@ -178,13 +206,11 @@ Int32 encodeUAGuid(UA_Guid *srcGuid, Int32 *pos, char *buf)
 
 }
 
-
 Int32 UAGuid_calcSize(UA_Guid *guid)
 {
 	return sizeof(guid->Data1) + sizeof(guid->Data2) + sizeof(guid->Data3) + UAByteString_calcSize(&(guid->Data4));
 }
 
-
 Int32 decodeUAByteString(const char *buf, Int32* pos,
 		UA_ByteString *dstBytestring)
 {
@@ -200,10 +226,12 @@ Int32 encodeUAByteString(UA_ByteString *srcByteString, Int32* pos,
 	return encodeUAString((UA_String*)srcByteString,pos,dstBuf);
 
 }
+
 Int32 UAByteString_calcSize(UA_ByteString *byteString)
 {
 	return UAString_calcSize((UA_String*)byteString);
 }
+
 UA_DateTime decodeUADateTime(const char *buf, Int32 *pos)
 {
 	return decodeInt64(buf, pos);
@@ -214,7 +242,7 @@ UA_StatusCode decodeUAStatusCode(const char* buf, Int32 *pos)
 	return decodeUInt32(buf, pos);
 }
 
-Int32 decodeUANodeId(const char* buf, Int32 *pos, UA_NodeId *dstNodeId)
+Int32 decodeUANodeId(char *const buf, Int32 *pos, UA_NodeId *dstNodeId)
 {
 
 	dstNodeId->EncodingByte = decodeInt32(buf, pos);
@@ -240,7 +268,7 @@ Int32 decodeUANodeId(const char* buf, Int32 *pos, UA_NodeId *dstNodeId)
 	}
 	case NIEVT_STRING:
 	{
-		decodeUAString(buf, pos, &dstNodeId->Identifier.String);
+		decodeUAString(buf, pos, &(dstNodeId->Identifier.String));
 		break;
 	}
 	case NIEVT_GUID:
@@ -265,35 +293,100 @@ Int32 decodeUANodeId(const char* buf, Int32 *pos, UA_NodeId *dstNodeId)
 	}
 	return 0;
 }
+Int32 encodeUANodeId(UA_NodeId *srcNodeId, Int32 *pos, char *buf)
+{
+		buf[*pos] = srcNodeId->EncodingByte;
+		*pos += sizeof(Byte);
+		switch(srcNodeId->EncodingByte)
+		{
+		case NIEVT_TWO_BYTE:
+			memcpy(&(buf[*pos]),&(srcNodeId->Identifier.Numeric),sizeof(Byte));
+			*pos +=  sizeof(Byte);
+			break;
+		case NIEVT_FOUR_BYTE:
+			encodeByte((Byte)(srcNodeId->Namespace & 0xFF),pos,buf);
+			encodeUInt16((UInt16)(srcNodeId->Identifier.Numeric & 0xFFFF),pos,buf);
+			break;
+		case NIEVT_NUMERIC:
+			if(srcNodeId->Namespace == 0)
+			{
+				encodeUInt16((UInt16)(srcNodeId->Namespace & 0xFFFF),pos,buf);
+				encodeUInt32(srcNodeId->Identifier.Numeric,pos,buf);
+			}
+			else
+			{
+			//TODO call registered function which knows how to calculate the length
+			}
+			break;
+		case NIEVT_STRING:
+			encodeUInt16(srcNodeId->Namespace,pos,buf);
+			encodeUAString(&(srcNodeId->Identifier.String),pos,buf);
+			break;
+		case NIEVT_GUID:
+			encodeUInt16(srcNodeId->Namespace,pos,buf);
+			encodeUAGuid(&(srcNodeId->Identifier.Guid),pos,buf);
+			break;
+		case NIEVT_BYTESTRING:
+			encodeUInt16(srcNodeId->Namespace,pos,buf);
+			encodeUAByteString(&(srcNodeId->Identifier.OPAQUE),pos,buf);
+			break;
+		default:
+			break;
+	}
+		return UA_NO_ERROR;
 
+}
 /**
- * IntegerId
+* IntegerId
  * Part: 4
  * Chapter: 7.13
  * Page: 118
  */
+Int32 nodeId_calcSize(UA_NodeId *nodeId)
+{
+	Int32 length = 0;
+	switch(nodeId->EncodingByte)
+	{
+		case NIEVT_TWO_BYTE:
+			length += 2 * sizeof(Byte);
+			break;
+		case NIEVT_FOUR_BYTE:
+			length += 4 * sizeof(Byte);
+			break;
+		case NIEVT_NUMERIC:
+			if(nodeId->Namespace == 0) // builtIn Type
+			{
+				length += sizeof(Byte) + sizeof(UInt16) + sizeof(UInt32);
+			}
+			//TODO call registered function which knows how to calculate the length
+			break;
+		case NIEVT_STRING:
+			length += sizeof(Byte) + sizeof(UInt16) + sizeof(UInt32) + nodeId->Identifier.String.Length;
+			break;
+		case NIEVT_GUID:
+			length += sizeof(Byte) + sizeof(UInt16) + sizeof(UInt32) + sizeof(UInt16) + sizeof(UInt16) + 8 * sizeof(Byte);
+			break;
+		case NIEVT_BYTESTRING:
+			length += sizeof(Byte) + sizeof(UInt16) +  sizeof(UInt32) + nodeId->Identifier.OPAQUE.Length;
+			break;
+		default:
+			break;
+	}
+	return length;
+}
+
 T_IntegerId decodeIntegerId(char* buf, Int32 *pos)
 {
 	return decodeUInt32(buf, pos);
 }
-
 /**
  * DiagnosticInfo
  * Part: 4
  * Chapter: 7.9
  * Page: 116
  */
-enum encodingMask
-{
-	encodingMask_HasSymbolicId = 0x01,
-	encodingMask_HasNamespace = 0x02,
-	encodingMask_HasLocalizedText = 0x04,
-	encodingMask_HasLocale = 0x08,
-	encodingMask_HasAdditionalInfo = 0x10,
-	encodingMask_HasInnerStatusCode = 0x20,
-	encodingMask_HasInnerDiagnosticInfo= 0x40
-};
-Int32 decodeToDiagnosticInfo(char* buf, Int32 *pos,
+Int32 decodeDiagnosticInfo(char* buf, Int32 *pos,
+
 		T_DiagnosticInfo* dstDiagnosticInfo)
 {
 	Byte encodingByte =  (buf[*pos]);
@@ -334,7 +427,6 @@ Int32 decodeToDiagnosticInfo(char* buf, Int32 *pos,
 	return 0;
 }
 
-
 Int32 diagnosticInfo_calcSize(UA_DiagnosticInfo *diagnosticInfo)
 {
 	Int32 minimumLength = 1;
@@ -419,39 +511,6 @@ Int32 encodeResponseHeader(const T_ResponseHeader *responseHeader, Int32 *pos,
 }
 
 
-
-
-
-Int32 nodeId_calcSize(UA_NodeId *nodeId)
-{
-	Int32 length = 0;
-	switch(nodeId->EncodingByte)
-	{
-		case NIEVT_TWO_BYTE:
-			length += 2 * sizeof(Byte);
-			break;
-		case NIEVT_FOUR_BYTE:
-			length += 4 * sizeof(Byte);
-			break;
-		case NIEVT_NUMERIC:
-			//TODO call registered function which knows how to calculate the length
-			break;
-		case NIEVT_STRING:
-			length += sizeof(Byte) + sizeof(UInt16) + sizeof(UInt32) + nodeId->Identifier.String.Length;
-			break;
-		case NIEVT_GUID:
-			length += sizeof(Byte) + sizeof(UInt16) + sizeof(UInt32) + sizeof(UInt16) + sizeof(UInt16) + 8 * sizeof(Byte);
-			break;
-		case NIEVT_BYTESTRING:
-			length += sizeof(Byte) + sizeof(UInt16) +  sizeof(UInt32) + nodeId->Identifier.OPAQUE.Length;
-			break;
-		default:
-			break;
-	}
-	return length;
-}
-
-
 Int32 extensionObject_calcSize(UA_ExtensionObject *extensionObject)
 {
 	Int32 length;
@@ -469,7 +528,6 @@ Int32 extensionObject_calcSize(UA_ExtensionObject *extensionObject)
 	return length;
 }
 
-
 Int32 responseHeader_calcSize(T_ResponseHeader *responseHeader)
 {
 	Int32 minimumLength = 20; // summation of all simple types

+ 78 - 32
OPCUAServer/src/opcua_binaryEncDec.h

@@ -23,7 +23,6 @@
  * @return
  */
 Byte decodeByte(const char* buf, Int32 *pos);
-
 /**
  *
  * @param encodeByte 	byte that should be encoded
@@ -31,15 +30,13 @@ Byte decodeByte(const char* buf, Int32 *pos);
  * @param dstBuf		rawMessage where the Byte is encoded in
  */
 void encodeByte(Byte encodeByte, Int32 *pos, char *dstBuf);
-
 /**
  *
  * @param buf
  * @param pos
  * @return
  */
-Int16 decodeInt16(const char* buf, Int32 *pos);
-
+UInt16 decodeUInt16(const char* buf, Int32 *pos);
 /**
  *
  * @param value
@@ -53,7 +50,14 @@ void encodeUInt16(UInt16 value, Int32 *pos, char *dstBuf);
  * @param pos
  * @return
  */
-UInt16 decodeUInt16(const char* buf, Int32 *pos);
+Int16 decodeInt16(const char* buf, Int32 *pos);
+/**
+ *
+ * @param value
+ * @param pos
+ * @param dstBuf
+ */
+void encodeInt16(Int16 value, Int32 *pos, char *dstBuf);
 /**
  *
  * @param buf  			binary encoded message
@@ -61,7 +65,13 @@ UInt16 decodeUInt16(const char* buf, Int32 *pos);
  * @return
  */
 Int32 decodeInt32(const char* buf, Int32 *pos);
-
+/**
+ *
+ * @param value
+ * @param pos
+ * @param dstBuf
+ */
+void encodeInt32(Int32 value, Int32 *pos, char *dstBuf);
 /**
  *
  * @param buf  			binary encoded message
@@ -69,6 +79,13 @@ Int32 decodeInt32(const char* buf, Int32 *pos);
  * @return				encoded data
  */
 UInt32 decodeUInt32(const char* buf, Int32 *pos);
+/**
+ *
+ * @param value
+ * @param dstBuf
+ * @param pos
+ */
+void encodeUInt32(UInt32 value, Int32 *pos, char *dstBuf);
 /**
  *
  * @param buf
@@ -76,6 +93,13 @@ UInt32 decodeUInt32(const char* buf, Int32 *pos);
  * @return
  */
 Int64 decodeInt64(const char* buf, Int32 *pos);
+/**
+ *
+ * @param value
+ * @param pos
+ * @param dstBuf
+ */
+void encodeInt64(Int64 value, Int32 *pos, char *dstBuf);
 /**
  *
  * @param buf  			binary encoded message
@@ -83,7 +107,53 @@ Int64 decodeInt64(const char* buf, Int32 *pos);
  * @param dstNodeId		receiver of the nodeid structure
  * @param return		success = 0
  */
-Int32 decodeUANodeId(const char* buf, Int32 *pos, UA_NodeId *dstNodeId);
+Int32 decodeUANodeId(char *const buf, Int32 *pos, UA_NodeId *dstNodeId);
+/**
+ *
+ * @param buf
+ * @param pos
+ * @return
+ */
+Float decodeFloat(char *buf, Int32 *pos);
+/**
+ *
+ * @param value
+ * @param pos
+ * @param dstBuf
+ * @return
+ */
+Int32 encodeFloat(Float value,Int32 *pos,char *dstBuf);
+/**
+ *
+ * @param buf
+ * @param pos
+ * @return
+ */
+Double decodeDouble(char *buf, Int32 *pos);
+/**
+ *
+ * @param value
+ * @param pos
+ * @param dstBuf
+ * @return
+ */
+Int32 encodeDouble(Double value, Int32 *pos,char *dstBuf);
+/**
+ *
+ * @param srcNodeId
+ * @param pos
+ * @param buf
+ * @return
+ */
+Int32 encodeUANodeId(UA_NodeId *srcNodeId, Int32 *pos, char *buf);
+/**
+ *
+ * @param srcGuid
+ * @param pos
+ * @param buf
+ * @return
+ */
+Int32 encodeUAGuid(UA_Guid *srcGuid, Int32 *pos, char *buf);
 /**
  *
  * @param buf
@@ -92,7 +162,6 @@ Int32 decodeUANodeId(const char* buf, Int32 *pos, UA_NodeId *dstNodeId);
  * @return
  */
 Int32 decodeUAGuid(const char *buf, Int32 *pos, UA_Guid *dstGUID);
-
 /**
  *
  * @param buf
@@ -107,7 +176,6 @@ UA_StatusCode decodeUAStatusCode(const char* buf, Int32 *pos);
  * @return
  */
 UA_DateTime decodeUADateTime(const char *buf, Int32 *pos);
-
 /**
  *
  * @param buf
@@ -115,25 +183,13 @@ UA_DateTime decodeUADateTime(const char *buf, Int32 *pos);
  * @param dstUAString
  * @return
  */
-Int32 decodeUAString(const char* buf, Int32 *pos, UA_String *dstUAString);
-
-
-
+Int32 decodeUAString(char *const buf, Int32 *pos, UA_String *dstUAString);
 /**
  *
  * @param byteString
  * @return length of the binary encoded data
  */
 Int32 UAByteString_calcSize(UA_ByteString *byteString);
-/**
- *
- * @param value
- * @param dstBuf
- * @param pos
- */
-void encodeUInt32(UInt32 value, Int32 *pos, char *dstBuf);
-
-
 /**
  * \brief
  * \param srcRaw             pointer to raw data which holds the encoded data
@@ -142,9 +198,6 @@ void encodeUInt32(UInt32 value, Int32 *pos, char *dstBuf);
  * \return                   0 = success
  */
 Int32 decodeRequestHeader(const AD_RawMessage *srcRaw,Int32 *pos, T_RequestHeader *dstRequestHeader);
-
-
-
 /**
  *
  * @param srcHeader
@@ -153,9 +206,6 @@ Int32 decodeRequestHeader(const AD_RawMessage *srcRaw,Int32 *pos, T_RequestHeade
  * @return
  */
 Int32 encodeRequestHeader(const T_RequestHeader *srcHeader,Int32 *pos,AD_RawMessage *dstRaw);
-
-
-
 /**
  *
  * @param srcRaw
@@ -164,7 +214,6 @@ Int32 encodeRequestHeader(const T_RequestHeader *srcHeader,Int32 *pos,AD_RawMess
  * @return
  */
 Int32 decodeResponseHeader(const AD_RawMessage *srcRaw, Int32 *pos, T_ResponseHeader *dstResponseHeader);
-
 /**
  *  @brief function to encode a secureChannelRequestHeader
  *
@@ -173,15 +222,12 @@ Int32 decodeResponseHeader(const AD_RawMessage *srcRaw, Int32 *pos, T_ResponseHe
  * @return
  */
 Int32 encodeResponseHeader(const T_ResponseHeader *responseHeader, Int32 *pos, AD_RawMessage *dstBuf);
-
-
 /**
  *
  * @param diagnosticInfo
  * @return length of the binary encoded data
  */
 Int32 diagnosticInfo_calcSize(UA_DiagnosticInfo *diagnosticInfo);
-
 /**
  *
  * @param extensionObject

+ 25 - 0
OPCUAServer/src/opcua_linkedList.h

@@ -0,0 +1,25 @@
+/*
+ * opcua_linkedList.h
+ *
+ *  Created on: Feb 5, 2014
+ *      Author: opcua
+ */
+
+#ifndef OPCUA_LINKEDLIST_H_
+#define OPCUA_LINKEDLIST_H_
+
+#include "opcua_advancedDatatypes.h";
+#include "opcua_types.h"
+#include "opcua_builtInDatatypes.h";
+
+typedef struct T_element
+{
+   AD_RawMessage *binaryData;
+   int(*serviceImplementation)(AD_RawMessage *data, AD_RawMessage *response);
+   struct T_linkedList * next;
+};
+
+typedef struct T_element element;
+
+#endif /* OPCUA_LINKEDLIST_H_ */
+

+ 1 - 1
OPCUAServer/src/opcua_secureChannelLayer.c

@@ -77,7 +77,7 @@ Int32 SL_openSecureChannel_responseMessage_calcSize(SL_Response *response, Int32
 {
 	Int32 length = 0;
 	length += sizeof(response->SecurityToken);
-	length += UA_String_calcSize(response->ServerNonce);
+	length += UAString_calcSize(response->ServerNonce);
 	length += sizeof(response->ServerProtocolVersion);
 	return length;
 }

+ 19 - 0
OPCUAServer/src/opcua_serializationLayer.c

@@ -0,0 +1,19 @@
+/*
+ * opcua_serializationLayer.c
+ *
+ *  Created on: Feb 5, 2014
+ *      Author: opcua
+ */
+#include "opcua_serializationLayer.h"
+
+serviceManager_registerServiceImplementation()
+{
+
+}
+serviceManager(Int32 serviceRequest)
+{
+	if(serviceManager_serviceAvailable(serviceRequest))
+	{
+
+	}
+}

+ 22 - 0
OPCUAServer/src/opcua_time.c

@@ -0,0 +1,22 @@
+/*
+ * opcua_time.c
+ *
+ *  Created on: Feb 5, 2014
+ *      Author: opcua
+ */
+#include "opcua_builtInDatatypes.h"
+#include "opcua_advancedDatatypes.h"
+#include <time.h>
+#include <assert.h>
+#include <errno.h>
+#include <stdarg.h>
+
+//get the current Server Time
+UA_DateTime opcua_getTime()
+{
+	//TODO call System Time function
+	UA_DateTime time = 10000000;
+	return time;
+}
+
+

+ 15 - 0
OPCUAServer/src/opcua_time.h

@@ -0,0 +1,15 @@
+/*
+ * opcua_time.h
+ *
+ *  Created on: Feb 5, 2014
+ *      Author: opcua
+ */
+
+#ifndef OPCUA_TIME_H_
+#define OPCUA_TIME_H_
+
+
+
+#endif /* OPCUA_TIME_H_ */
+
+UA_DateTime opcua_getTime();

+ 22 - 0
OPCUAServer/src/opuca_linkedList.c

@@ -0,0 +1,22 @@
+/*
+ * opuca_linkedList.c
+ *
+ *  Created on: Feb 5, 2014
+ *      Author: opcua
+ */
+
+
+#include<stdlib.h>
+#include<stdio.h>
+
+
+
+list_add(element *list,element *elementToAdd)
+{
+	element *nElement;
+	while(list->next != NULL)
+	{
+		nElement = list->next;
+	}
+
+}

+ 59 - 7
OPCUAServer/tests/check_stack.c

@@ -96,6 +96,7 @@ START_TEST(decodeUInt16_test)
 
 }
 END_TEST
+
 START_TEST(encodeUInt16_test)
 {
 
@@ -120,6 +121,27 @@ START_TEST(encodeUInt16_test)
 }
 END_TEST
 
+START_TEST(encodeFloat_test)
+{
+	Float value = -6.5;
+	Int32 pos = 0;
+	char *buf = (char*)opcua_malloc(sizeof(Float));
+
+	encodeFloat(value,&pos,buf);
+
+	ck_assert_int_eq(buf[2],0xD0);
+	ck_assert_int_eq(buf[3],0xC0);
+	opcua_free(buf);
+
+}
+END_TEST
+
+START_TEST(encodeDouble_test)
+{
+
+}
+END_TEST
+
 
 START_TEST(encodeUAString_test)
 {
@@ -161,6 +183,7 @@ START_TEST(decodeUAString_test)
 
 }
 END_TEST
+
 START_TEST(diagnosticInfo_calcSize_test)
 {
 
@@ -238,7 +261,7 @@ START_TEST(responseHeader_calcSize_test)
 
 }
 END_TEST
-Suite* testSuite_getPacketType(void)
+Suite *testSuite_getPacketType(void)
 {
 	Suite *s = suite_create("getPacketType");
 	TCase *tc_core = tcase_create("Core");
@@ -247,7 +270,7 @@ Suite* testSuite_getPacketType(void)
 	return s;
 }
 
-Suite* testSuite_encodeByte(void)
+Suite *testSuite_encodeByte(void)
 {
 	Suite *s = suite_create("encodeByte_test");
 	TCase *tc_core = tcase_create("Core");
@@ -255,7 +278,7 @@ Suite* testSuite_encodeByte(void)
 	suite_add_tcase(s,tc_core);
 	return s;
 }
-Suite* testSuite_decodeUInt16(void)
+Suite *testSuite_decodeUInt16(void)
 {
 	Suite *s = suite_create("decodeUInt16_test");
 	TCase *tc_core = tcase_create("Core");
@@ -263,7 +286,7 @@ Suite* testSuite_decodeUInt16(void)
 	suite_add_tcase(s,tc_core);
 	return s;
 }
-Suite* testSuite_encodeUInt16(void)
+Suite*testSuite_encodeUInt16(void)
 {
 	Suite *s = suite_create("encodeUInt16_test");
 	TCase *tc_core = tcase_create("Core");
@@ -272,9 +295,24 @@ Suite* testSuite_encodeUInt16(void)
 	return s;
 }
 
+Suite *testSuite_encodeFloat(void)
+{
+	Suite *s = suite_create("encodeFloat_test");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, encodeFloat_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
+Suite *testSuite_encodeDouble(void)
+{
+	Suite *s = suite_create("encodeDouble_test");
+	TCase *tc_core = tcase_create("Core");
+	tcase_add_test(tc_core, encodeDouble_test);
+	suite_add_tcase(s,tc_core);
+	return s;
+}
 
-
-Suite* testSuite_encodeUAString(void)
+Suite * testSuite_encodeUAString(void)
 {
 	Suite *s = suite_create("encodeUAString_test");
 	TCase *tc_core = tcase_create("Core");
@@ -282,7 +320,7 @@ Suite* testSuite_encodeUAString(void)
 	suite_add_tcase(s,tc_core);
 	return s;
 }
-Suite* testSuite_decodeUAString(void)
+Suite * testSuite_decodeUAString(void)
 {
 	Suite *s = suite_create("decodeUAString_test");
 	TCase *tc_core = tcase_create("Core");
@@ -348,6 +386,20 @@ int main (void)
 	number_failed += srunner_ntests_failed(sr);
 	srunner_free(sr);
 
+
+	s = testSuite_encodeFloat();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+	s = testSuite_encodeDouble();
+	sr = srunner_create(s);
+	srunner_run_all(sr,CK_NORMAL);
+	number_failed += srunner_ntests_failed(sr);
+	srunner_free(sr);
+
+
 	s = testSuite_encodeByte();
 	sr = srunner_create(s);
 	srunner_run_all(sr,CK_NORMAL);