Own fork of MbedSmartRestMain

Dependencies:   C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed

Fork of MbedSmartRestMain by Cumulocity Official

operation/ReportThread.h

Committer:
xinlei
Date:
2015-04-20
Revision:
93:61d44636f020
Child:
96:ea056f6be2e8

File content as of revision 93:61d44636f020:

#ifndef REPORTTHREAD_H
#define REPORTTHREAD_H
#include "SmartRestSocket.h"
#include "Operation.h"
#include "SmartRestConf.h"

class ReportThread
{
public:
        ReportThread(OperationPool& pool, MDMSerial& m) : ipool(pool), sock(m),
                thread(ReportThread::threadWrapper, this) {
                strncpy(uri, "/s", sizeof(uri));
        }
        virtual ~ReportThread() { sock.close(); }
        void threadFunc();
        static void threadWrapper(const void *p) { ((ReportThread*)p)->threadFunc(); }
private:
        char uri[4];
        OperationPool& ipool;
        char buf[SMARTREST_SIZE];
        char buf2[SMARRESTBODY_SIZE];
        SmartRestSocket sock;
        Thread thread;
};

#endif /* REPORTTHREAD_H */