-
Notifications
You must be signed in to change notification settings - Fork 0
/
sonda.hh
50 lines (44 loc) · 1.17 KB
/
sonda.hh
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
#ifndef SONDA_HH
#define SONDA_HH
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <string>
#include <sstream>
#include <vector>
const unsigned int MAXSIZE = 512;
class sonda{
private:
int socketSonda;
FILE *log; // File log
pthread_t _send,_recv; // thread
std::string sendBuf;
char recvBuf[MAXSIZE];
std::string newLine="\n";
bool Save=false;
public:
//thread functions
void startSendThread();//start thread
void startRecvThread();//start thread
void sendFunc();//send function for thread
void recvFunc();//recv function for thread
static void *sendThread(void *This);
static void *recvThread(void *This);
//communication functions
void ReciveCommunication();
void DataCsv(std::string name,std::string year,std::string month,std::string day);
void TaskConfiguration(int numTask,std::string type,int period,int record);
void CreateTask();
void taskExecute(int n);
void Time();
void saveData();
//constructor and desctructor
sonda();
~sonda();
};
#endif