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-27
Revision:
96:ea056f6be2e8
Parent:
93:61d44636f020
Child:
100:dbcd3bc51758

File content as of revision 96:ea056f6be2e8:

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

class ReportThread
{
public:
        ReportThread(OperationPool& pool) : ipool(pool), sock(),
                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 */