Vorlage für Projekt

Dependencies:   EthernetInterface mbed-rtos

Fork of Telemetrie_eth_h2m by Hochschule München

Revision:
6:abadad863420
Parent:
5:a96e4e59c710
Child:
7:a269ac8c3259
diff -r a96e4e59c710 -r abadad863420 Telemetry.h
--- a/Telemetry.h	Sun Nov 22 14:18:03 2015 +0000
+++ b/Telemetry.h	Sun Nov 22 21:31:55 2015 +0000
@@ -33,10 +33,67 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  *
  * @code
+ * #include "mbed.h"
+ * #include "Telemetry.h"
+ *
+ * #Telemetry Network;
+ * 
+ * uint8_t buffer[255];  
+ * int     SELF_PORT        = 8889;
+ * 
+ * typedef struct struct_system
+ *  {
+ *   struct_test()
+ *   :length(9), ID(0)
+ *   {}
+ *   uint8_t  length              ;//1
+ *   uint8_t  ID                  ;//2
+ *   uint8_t  flag_bit0      : 1  ;//3.0
+ *   uint8_t  flag_bit1      : 1  ;//3.1
+ *   uint8_t  flagbyte_2          ;//4 
+ *   uint16_t word                ;//6
+ *    int16_t counter             ;//8
+ *   uint8_t  cs                  ;//9
+ *} Tstruct_test;
+ *
+ *
+ * struct_test  test;
+ *
+ * uint8_t* struct_id[] {
+ *                         &test     //ID0
+ *                        };
+ *                        
+ * main
  * {
- * }
+ *  Network.InitEthernetConnection();
+ *  Network.ConnectSocket_udp_send();
+ *  Network.ConnectSocket_udp_rec(SELF_PORT);
+ *   
+ *  while(1) 
+ *   {
+ *    if (Rec_Struct_UDP(char *buffer))        // receive and CS check       
+ *      {
+ *       uint8_t* b_pointer;                
+ *
+ *       b_pointer = struct_id[buffer[1]];     // Pointer to received Struct   
+ * 
+ *       for(int i = 0; i < (buffer[0]); i++)  // Copy buffer to Struct
+ *       {
+ *        *b_pointer = buffer[i];
+ *         b_pointer++;
+ *       }
+ *       
+ *       b_pointer = struct_id[buffer[1]];     // Pointer to received Struct
+ *       
+ *       Send_Struct_UDP(Network.input_Host, b_pointer); // Send received Struct back to sender
+ *      } 
+ *
+ *    wait(1);
+ *   }        
+ *}          
+ * 
  * @endcode
-*/ 
+ */ 
 
 
 
@@ -95,13 +152,13 @@
 
         
         //! Struct Check Sum calc
-        uint8_t do_cs(char* buffer); 
+        uint8_t do_cs(uint8_t *buffer); 
         
         //! Read UDP Packet 
         int  Rec_Data_UDP(char *buffer, int size);
         
         //! Check UDP Packet of containing Struct 
-        bool Rec_Struct_UDP(char *buffer);
+        bool Rec_Struct_UDP(uint8_t *buffer);
         
         //! Read TCP Packet
         int  Rec_Data_TCP(char *buffer, int size);
@@ -111,7 +168,7 @@
         void Send_Data_UDP(Endpoint Server, char* Daten, int size);
         
         //! Send Struct as UDP Packet
-        void Send_Struct_UDP(Endpoint Server, char* Daten);
+        void Send_Struct_UDP(Endpoint Server, uint8_t* Daten);
         
         //! Send TCP Packet
         void Send_Data_TCP(char* Host, char* Daten);