-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdataServer.h
65 lines (59 loc) · 1.45 KB
/
dataServer.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
65
#ifndef DATASERVER_H
#define DATASERVER_H
#include <iostream>
#include <string>
#include <cstring>
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#pragma comment(lib, "ws2_32.lib")
#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#define SOCKET int
#define INVALID_SOCKET -1
#define closesocket close
#endif
#include <thread>
#include <sstream>
#include <json.hpp>
#include <QGraphicsItem>
#include <QList>
#include <QDebug>
#include <vector>
#include <QPointF>
void sendJsonToServer(const char *json_data, const char *path);
void sendShotDataToServer();
void sendTurnDataToServer();
void updateData(const std::string& value, const std::string &dataTypeInfo, const std::string &path);
void resetData();
void updateDoubleData(const double &value, const std::string &dataTypeInfo, const std::string &path);
void updateIntData(const int& value, const std::string& dataTypeInfo, const std::string& path);
class HoleClass
{
public:
std::string name;
std::string courseName;
std::string holeNum;
int shots;
int score;
int par;
int aimTime;
int ranking;
std::string path = "hole";
void clear()
{
name = "";
courseName = "";
holeNum = "";
shots = 0;
score = 0;
par = 0;
aimTime = 0;
ranking = 0;
};
};
void sendHoleDataToServer(HoleClass& hole);
#endif