Vorlage für Projekt

Dependencies:   EthernetInterface mbed-rtos

Fork of Telemetrie_eth_h2m by Hochschule München

Telemetry.h

Committer:
HMFK03LST1
Date:
2015-05-02
Revision:
1:2df3958877f2
Parent:
0:c0179f2ad295
Child:
2:e19b937a29c1

File content as of revision 1:2df3958877f2:

/*------------------------------------------------*/
/*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