-
Notifications
You must be signed in to change notification settings - Fork 0
/
GPIOWebService.h
64 lines (53 loc) · 1.65 KB
/
GPIOWebService.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
52
53
54
55
56
57
58
59
60
61
62
63
64
//
// GPIOWebService.h
// ThreadPool
//
// Created by Andrew Rose on 05.08.13.
// Copyright (c) 2013 Andrew Rose. All rights reserved.
//
#ifndef __ThreadPool__GPIOWebService__
#define __ThreadPool__GPIOWebService__
#include <iostream>
#include <iostream>
#include "BasicThread.h"
#include "DummyReciver.h"
#include "GpioReciver.h"
#include <sys/types.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <microhttpd.h>
#include <stdio.h>
#include <string.h>
#include <sstream>
#include "GpioPinReader.h"
#include "TemperatureReader.h"
#include <thread>
#include <condition_variable>
class GPIOWebService
{
private:
static int reciverSignalMethod(void *cls, struct MHD_Connection *connection,
const char *url, const char *method,
const char *version, const char *upload_data,
size_t *upload_data_size, void **con_cls);
MHD_Daemon* daemon;
std::string lastTemp;
TemperatureReader temperatureReader;
GpioReciver gpioReciverFunc1;
GpioPinReader gpioPinReader1;
IBasicThreads<GpioReciver> gpioReciver1;
GPIOWebService(const GPIOWebService&);
const GPIOWebService& operator=(const GPIOWebService&);
GPIOWebService& operator=(GPIOWebService&);
std::string getPage(std::string FileUrl);
std::condition_variable terminateServiceSignalCondition;
std::mutex terminateMutex;
bool terminateFlag;
const bool terminalPred();
public:
GPIOWebService();
~GPIOWebService();
void WaitForTerminate();
void StartListen(const int port);
};
#endif /* defined(__ThreadPool__GPIOWebService__) */