Vorlage für Projekt
Dependencies: EthernetInterface mbed-rtos
Fork of Telemetrie_eth_h2m by
Diff: Telemetry.h
- Revision:
- 0:c0179f2ad295
- Child:
- 1:2df3958877f2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Telemetry.h Sat May 02 11:02:37 2015 +0000 @@ -0,0 +1,48 @@ +/*------------------------------------------------*/ +/*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> + +class Telemetry +{ + public: + Telemetry(); + #ifdef DEBUG + void InitUSBSerialConnection(); + #endif + + bool InitEthernetConnection(); + bool InitEthernetConnection(const char* IPAdress, const char* SubNetMask, const char* GateWay); + void CloseEthernetConnection(); + + void ConnectSocket_tcp(char* Host); + void ConnectSocket_udp(); + void CloseSocket(); + + void TransmitDataoverUDP(char *Host, int Port, string Daten); + void TransmitDataoverTCP(char *Host, string Daten, string Username, string Passwort); + void ReadAnswerandTransmitoverSerial(); + string ReadAnswer(); +}; + +#endif \ No newline at end of file