-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSensor.h
More file actions
54 lines (42 loc) · 1.05 KB
/
Sensor.h
File metadata and controls
54 lines (42 loc) · 1.05 KB
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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: Sensor.h
* Author: tim
*
* Created on 20. April 2017, 10:28
*/
#ifndef SENSOR_H
#define SENSOR_H
#include <thread>
#include <iostream>
#include <string>
#include <vector>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
class Sensor {
public:
Sensor(std::string, sockaddr_in addr);
Sensor(std::string, sockaddr_in addr, unsigned int startingValue, int steps);
virtual ~Sensor();
void send();
std::string getItem() const { return item; }
std::vector<std::string> getSentMessages() const { return sentMessages; }
struct ItemInfo {
char* name;
unsigned int reading;
};
private:
sockaddr_in serverAddr;
int sockfd;
std::string item;
unsigned int reading;
int steps;
std::vector<std::string> sentMessages;
const bool manual;
};
#endif /* SENSOR_H */