Vorlage für Projekt
Dependencies: EthernetInterface mbed-rtos
Fork of Telemetrie_eth_h2m by
Telemetry.h@2:e19b937a29c1, 2015-10-31 (annotated)
- Committer:
- HMFK03LST1
- Date:
- Sat Oct 31 17:33:18 2015 +0000
- Revision:
- 2:e19b937a29c1
- Parent:
- 1:2df3958877f2
- Child:
- 3:94a735c744ff
stable
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
HMFK03LST1 | 0:c0179f2ad295 | 1 | /*------------------------------------------------*/ |
HMFK03LST1 | 0:c0179f2ad295 | 2 | /*Define LED: */ |
HMFK03LST1 | 0:c0179f2ad295 | 3 | /* LEDSerial = LED1 */ |
HMFK03LST1 | 0:c0179f2ad295 | 4 | /* LEDEthernet = LED2 */ |
HMFK03LST1 | 0:c0179f2ad295 | 5 | /* LEDSOCKET = LED3 */ |
HMFK03LST1 | 0:c0179f2ad295 | 6 | /* LEDWAITFORANSWER = LED4 */ |
HMFK03LST1 | 0:c0179f2ad295 | 7 | /* */ |
HMFK03LST1 | 0:c0179f2ad295 | 8 | /*Define DEBUG: */ |
HMFK03LST1 | 0:c0179f2ad295 | 9 | /* Ausgabe über Serielle Schnittstelle */ |
HMFK03LST1 | 0:c0179f2ad295 | 10 | /* (USBRX/USBTX) */ |
HMFK03LST1 | 0:c0179f2ad295 | 11 | /* */ |
HMFK03LST1 | 0:c0179f2ad295 | 12 | /*Autor: Sebastian Hauzenberger */ |
HMFK03LST1 | 0:c0179f2ad295 | 13 | /*------------------------------------------------*/ |
HMFK03LST1 | 0:c0179f2ad295 | 14 | |
HMFK03LST1 | 0:c0179f2ad295 | 15 | #ifndef TELEMETRY |
HMFK03LST1 | 0:c0179f2ad295 | 16 | #define TELEMETRY |
HMFK03LST1 | 0:c0179f2ad295 | 17 | |
HMFK03LST1 | 0:c0179f2ad295 | 18 | //#define LED |
HMFK03LST1 | 1:2df3958877f2 | 19 | //#define DEBUG |
HMFK03LST1 | 0:c0179f2ad295 | 20 | |
HMFK03LST1 | 0:c0179f2ad295 | 21 | #include "mbed.h" |
HMFK03LST1 | 0:c0179f2ad295 | 22 | #include "EthernetInterface.h" |
HMFK03LST1 | 0:c0179f2ad295 | 23 | #include <string> |
HMFK03LST1 | 0:c0179f2ad295 | 24 | #include <sstream> |
HMFK03LST1 | 0:c0179f2ad295 | 25 | |
HMFK03LST1 | 0:c0179f2ad295 | 26 | class Telemetry |
HMFK03LST1 | 0:c0179f2ad295 | 27 | { |
HMFK03LST1 | 0:c0179f2ad295 | 28 | public: |
HMFK03LST1 | 0:c0179f2ad295 | 29 | Telemetry(); |
HMFK03LST1 | 2:e19b937a29c1 | 30 | char* ip_self; |
HMFK03LST1 | 2:e19b937a29c1 | 31 | Endpoint db_server; |
HMFK03LST1 | 2:e19b937a29c1 | 32 | Endpoint controller; |
HMFK03LST1 | 2:e19b937a29c1 | 33 | Endpoint input_Host; |
HMFK03LST1 | 2:e19b937a29c1 | 34 | |
HMFK03LST1 | 0:c0179f2ad295 | 35 | #ifdef DEBUG |
HMFK03LST1 | 0:c0179f2ad295 | 36 | void InitUSBSerialConnection(); |
HMFK03LST1 | 0:c0179f2ad295 | 37 | #endif |
HMFK03LST1 | 2:e19b937a29c1 | 38 | //Struct Check Sum calc |
HMFK03LST1 | 2:e19b937a29c1 | 39 | char do_cs(char* buffer); |
HMFK03LST1 | 2:e19b937a29c1 | 40 | //init with DHCP |
HMFK03LST1 | 0:c0179f2ad295 | 41 | bool InitEthernetConnection(); |
HMFK03LST1 | 2:e19b937a29c1 | 42 | //init with Static |
HMFK03LST1 | 0:c0179f2ad295 | 43 | bool InitEthernetConnection(const char* IPAdress, const char* SubNetMask, const char* GateWay); |
HMFK03LST1 | 2:e19b937a29c1 | 44 | //Close Connection |
HMFK03LST1 | 0:c0179f2ad295 | 45 | void CloseEthernetConnection(); |
HMFK03LST1 | 0:c0179f2ad295 | 46 | |
HMFK03LST1 | 2:e19b937a29c1 | 47 | //Connect Ports |
HMFK03LST1 | 2:e19b937a29c1 | 48 | void ConnectSocket_tcp(Endpoint Host); |
HMFK03LST1 | 2:e19b937a29c1 | 49 | void ConnectSocket_udp_rec(int Port); |
HMFK03LST1 | 2:e19b937a29c1 | 50 | void ConnectSocket_udp_send(); |
HMFK03LST1 | 2:e19b937a29c1 | 51 | |
HMFK03LST1 | 2:e19b937a29c1 | 52 | //Close Ports |
HMFK03LST1 | 2:e19b937a29c1 | 53 | void CloseSocket_tcp(); |
HMFK03LST1 | 2:e19b937a29c1 | 54 | void CloseSocket_udp_rec(); |
HMFK03LST1 | 2:e19b937a29c1 | 55 | void CloseSocket_udp_send(); |
HMFK03LST1 | 2:e19b937a29c1 | 56 | |
HMFK03LST1 | 0:c0179f2ad295 | 57 | |
HMFK03LST1 | 2:e19b937a29c1 | 58 | int Rec_Data_UDP(char *buffer, int size); |
HMFK03LST1 | 2:e19b937a29c1 | 59 | bool Rec_Struct_UDP(char *buffer); |
HMFK03LST1 | 2:e19b937a29c1 | 60 | |
HMFK03LST1 | 2:e19b937a29c1 | 61 | int Rec_Data_TCP(char *buffer, int size); |
HMFK03LST1 | 2:e19b937a29c1 | 62 | |
HMFK03LST1 | 2:e19b937a29c1 | 63 | void Send_Data_UDP(Endpoint Server, char* Daten, int size); |
HMFK03LST1 | 2:e19b937a29c1 | 64 | void Send_Struct_UDP(Endpoint Server, char* Daten); |
HMFK03LST1 | 2:e19b937a29c1 | 65 | |
HMFK03LST1 | 2:e19b937a29c1 | 66 | void Send_Data_TCP(char* Host, string Daten, string Username, string Passwort); |
HMFK03LST1 | 2:e19b937a29c1 | 67 | |
HMFK03LST1 | 0:c0179f2ad295 | 68 | }; |
HMFK03LST1 | 0:c0179f2ad295 | 69 | |
HMFK03LST1 | 0:c0179f2ad295 | 70 | #endif |