1.0

Dependencies:   EthernetInterface mbed-rtos

Revision:
3:94a735c744ff
Parent:
2:e19b937a29c1
Child:
5:a96e4e59c710
--- a/Telemetry.h	Sat Oct 31 17:33:18 2015 +0000
+++ b/Telemetry.h	Sun Nov 22 13:48:21 2015 +0000
@@ -1,69 +1,124 @@
-/*------------------------------------------------*/
-/*Define LED:                                     */
-/*  LEDSerial = LED1                              */
-/*  LEDEthernet = LED2                            */
-/*  LEDSOCKET = LED3                              */
-/*  LEDWAITFORANSWER = LED4                       */
-/*                                                */
-/*Define DEBUG:                                   */
-/*   Ausgabe über Serielle Schnittstelle          */
-/*   (USBRX/USBTX)                                */
-/*                                                */
-/*Autor: Sebastian Hauzenberger                   */
-/*------------------------------------------------*/
 
 #ifndef TELEMETRY
 #define TELEMETRY
 
-//#define LED
 //#define DEBUG
 
 #include "mbed.h"
 #include "EthernetInterface.h"
-#include <string>
-#include <sstream>
+
+/** Ethernet Interface for send/receive Datastructs over udp 
+ *
+ * By Sebastian Donner
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * @code
+ * {
+ * }
+ * @endcode
+*/ 
+
+
 
 class Telemetry
 {
     public:
+        //! Create Ethernet Interface
         Telemetry();
+
+        //! IP Address of mbed Interface
         char* ip_self;
+
+        //! IP Addess and Port of databank Server
         Endpoint db_server;
+
+        //! IP Addess and Port of controll Server
         Endpoint controller;
+
+        //! IP Addess and Port of incoming MSG
         Endpoint input_Host;
+
         
         #ifdef DEBUG
         void InitUSBSerialConnection();
         #endif
-        //Struct Check Sum calc
-        char do_cs(char* buffer); 
-        //init with DHCP
+
+        //! init with DHCP
         bool InitEthernetConnection();
-        //init with Static
+
+        //! init with Static IP
         bool InitEthernetConnection(const char* IPAdress, const char* SubNetMask, const char* GateWay);
-        //Close Connection
+
+
+        //! Close Connection
         void CloseEthernetConnection();
+
+        
+        //! Connect Port TCP 
+        void ConnectSocket_tcp(Endpoint Host);
+        
+        //! Connect Port UDP receive 
+        void ConnectSocket_udp_rec(int Port);
+        
+        //! Connect Port UDP send
+        void ConnectSocket_udp_send();
+
+        
+        //! Close Port TCP
+        void CloseSocket_tcp();
         
-        //Connect Ports
-        void ConnectSocket_tcp(Endpoint Host);
-        void ConnectSocket_udp_rec(int Port);
-        void ConnectSocket_udp_send();
+        //! Close Port UDP receive
+        void CloseSocket_udp_rec();
+        
+        //! Close Port UDP send
+        void CloseSocket_udp_send();
+
+        
+        //! Struct Check Sum calc
+        char do_cs(char* buffer); 
+        
+        //! Read UDP Packet 
+        int  Rec_Data_UDP(char *buffer, int size);
         
-        //Close Ports
-        void CloseSocket_tcp();
-        void CloseSocket_udp_rec();
-        void CloseSocket_udp_send();
+        //! Check UDP Packet of containing Struct 
+        bool Rec_Struct_UDP(char *buffer);
+        
+        //! Read TCP Packet
+        int  Rec_Data_TCP(char *buffer, int size);
+
+        
+        //! Send UDP Packet
+        void Send_Data_UDP(Endpoint Server, char* Daten, int size);
+        
+        //! Send Struct as UDP Packet
+        void Send_Struct_UDP(Endpoint Server, char* Daten);
+        
+        //! Send TCP Packet
+        void Send_Data_TCP(char* Host, char* Daten);
         
         
-        int  Rec_Data_UDP(char *buffer, int size);
-        bool Rec_Struct_UDP(char *buffer);
-        
-        int  Rec_Data_TCP(char *buffer, int size);
-        
-        void Send_Data_UDP(Endpoint Server, char* Daten, int size);
-        void Send_Struct_UDP(Endpoint Server, char* Daten);
-        
-        void Send_Data_TCP(char* Host, string Daten, string Username, string Passwort);
+    private:
+        bool InitSucceed;    
         
 };