A client for the SmartREST protocol from Cumulocity.

Dependencies:   SmartRest

Fork of MbedSmartRest by Vincent Wochnik

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MbedDataSource.h Source File

MbedDataSource.h

00001 #ifndef MBEDDATASOURCE_H
00002 #define MBEDDATASOURCE_H
00003 
00004 #include <stddef.h>
00005 #include "AbstractDataSource.h"
00006 #include "TCPSocketConnection.h"
00007 
00008 #define MBED_SOURCE_BUFFER_SIZE 60
00009 
00010 class MbedClient;
00011 
00012 class MbedDataSource : public AbstractDataSource
00013 {
00014 public:
00015     MbedDataSource(TCPSocketConnection& sock);
00016     ~MbedDataSource();
00017 
00018     char read();
00019     uint8_t status();
00020 
00021 protected:
00022     bool receive();
00023     void reset();
00024 
00025 private:
00026     TCPSocketConnection& _sock;
00027     char _buf[MBED_SOURCE_BUFFER_SIZE];
00028     size_t _len, _offset;
00029     bool _timeout;
00030 
00031 friend class MbedClient;
00032 };
00033 
00034 #endif