-
Notifications
You must be signed in to change notification settings - Fork 1
/
LedModule.h
51 lines (41 loc) · 1.12 KB
/
LedModule.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
* @file LedModule.h
* @Author BeeeOn team - Richard Wolfert ([email protected])
* @date 9/2016
* @brief
*/
#pragma once
extern bool quit_global_flag;
#include <iostream>
#include <memory>
#include <string>
#include <cstdlib>
#include <ctime>
#include <unistd.h>
#include <Poco/Logger.h>
#include <Poco/Net/DatagramSocket.h>
#include <Poco/Runnable.h>
#include "IODaemonMsg.h"
#include "device_table.h"
#include "ModuleADT.h"
#include "utils.h"
class Aggregator;
class LedModule : public ModuleADT {
private:
Poco::Net::DatagramSocket socket;
int ioDaemonPort;
int receivePort;
IODaemonMsg ioDaemonMsg;
long long int getEUID(std::string adapter_id);
void threadFunction() override;
void sendToDaemon(const IODaemonMsg &ioMessage);
IODaemonMsg receiveFromDaemon();
bool createServerMsg(const IODaemonMsg &ioMessage);
IODaemonMsg createDaemonMsg();
bool createMsg();
bool recoverLastValue(struct ledConfiguration &new_config);
bool obtainLastValue(int module_id, int &value);
public:
LedModule(IOTMessage _msg, std::shared_ptr<Aggregator> _agg);
void parseCmdFromServer(const Command& cmd) override;
};