-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathComunicateWithSimulator.h
More file actions
41 lines (35 loc) · 978 Bytes
/
ComunicateWithSimulator.h
File metadata and controls
41 lines (35 loc) · 978 Bytes
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
//
// Created by ofir8 on 12/19/18.
//
#ifndef PROJECTDEMO_COMUNICATEWITHSIMULATOR_H
#define PROJECTDEMO_COMUNICATEWITHSIMULATOR_H
#include <string>
using namespace std;
class ComunicateWithSimulator {
public:
static int sockfd;
static int DataServerSocket;
static pthread_t* th;
static bool isServerOpen;
static void setSocketNumber(int num) {
sockfd = num;
}
/**
* the method gets the info about the thread and socket we created
*/
static void setOpenDataServer (int* socket, pthread_t* thread) {
DataServerSocket = *socket;
th = thread;
isServerOpen = true;
}
/**
* the method refurns true if the server is open and false otherwise
*/
static bool isOpen() {
return isServerOpen;
}
static bool sendToServer(string st, double val);
static double getFromServer(string address);
static void closeAll();
};
#endif //PROJECTDEMO_COMUNICATEWITHSIMULATOR_H