GoPxL SDK

- Home
- Files
- Namespace

GoGdpClient.h
Go to the documentation of this file.
1
9 #ifndef GO_PXL_SDK_GOGDPCLIENT_H
10 #define GO_PXL_SDK_GOGDPCLIENT_H
11
12 #include <kApi/Io/kNetwork.h>
13 #include <kApi/Io/kTcpClient.h>
14
15 #include <kApi/Threads/kThread.h>
16 #include <kApi/Threads/kLock.h>
17 #include <kApi/Threads/kTimer.h>
18
19 #include <GoApi/GoApi.h>
20 #include <GoApi/Threads/MsgQueue.h>
21 #include <GoApi/Threads/Locker.h>
22
23 #include <GoPxLSdk/Def.h>
24 #include <GoPxLSdk/GoDataSet.h>
25 #include <GoPxLSdk/GoGdpMsg/GoGdpMsgDef.h>
26
27 namespace GoPxLSdk
28 {
29 class GoPxLSdkClass GoGdpClient
30 {
31 public:
39 GoGdpClient();
40 ~GoGdpClient();
41
42 const int CONNECT_TIMEOUT = 5000000;
43 const int CANCEL_QUERY_INTERVAL = 100000;
44
54 void Connect(kIpAddress ipAddr, k32u port = GO_PXL_SDK_DEFAULT_GDP_SERVER_PORT);
55
63 void Close();
64
72 bool IsConnected();
73
82 void ReceiveDataSync(k64u receiveTimeoutInMilliseconds);
83
92 void ReceiveDataAsync(std::function<void(const GoDataSet& receivedDataSet)>& func);
93
101 const GoDataSet& DataSet() const;
102
103 private:
112 void GetGdpMsgType(MessageType& type);
113
121 void InitTcpClient();
122
130 void InitThreadAndTimer();
131
141 static kStatus kCall OnDataReceive(void* context);
142
152 static kStatus kCall DataThreadEntry(void* context);
153
154 private:
155 std::function<void(const GoDataSet& pDataSet)> func;
156
157 GoDataSet dataSet;
158
159 bool isConnected = false;
160 bool async = false;
161 bool isCompleteSet;
162
163 Go::Object<kTcpClient> socket;
164 Go::Object<kSerializer> serializer;
165 Go::Object<kTimer> timer;
166 Go::Object<kThread> receiveThread;
167 Go::MsgQueue<GoDataSet> dataQueue;
168 Go::Object<kThread> dataThread;
169 };
170 }
171
172
173 #endif
174
175
GoPxLSdk::GoDataSet
Definition: GoDataSet.h:17
GoPxLSdkClass
#define GoPxLSdkClass
Definition: Def.h:35
GoGdpMsgDef.h
GoDataSet.h
GO_PXL_SDK_DEFAULT_GDP_SERVER_PORT
constexpr k32u GO_PXL_SDK_DEFAULT_GDP_SERVER_PORT
Definition: Def.h:40
GoPxLSdk::MessageType
MessageType
List of enums representing types available to be serialized out through GDP This list is essentially ...
Definition: GoGdpMsgDef.h:27
Def.h
Declares the general SDK definitions.
GoPxLSdk::GoGdpClient
Definition: GoGdpClient.h:29
GoPxLSdk
Definition: Def.h:46