RadarFX API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
radarFxConnector.h
Go to the documentation of this file.
1 // ******************************************************************************
2 // ** Copyright (c) 2016 MAK Technologies, Inc.
3 // ** All rights reserved.
4 // ******************************************************************************
5 
9 
10 
11 #pragma once
12 
14 
18 
19 #include <vlutil/vlInetTcpSocket.h>
20 
21 #include <list>
22 #include <string>
23 
24 class DtExerciseConnection;
25 class DtThread;
26 
27 namespace makRadarFx
28 {
30  const int DtRadarFXPort = 4567;
31 
32  class DtBaseMessage;
33 
34  template <typename Ret, typename Param0>
35  class DtDelegate;
36 
40  {
41  public:
44 
47  virtual ~DtRadarFxConnector();
48 
52  virtual void connect(const std::string& address, int port = DtRadarFXPort, bool attemptRetry=true);
53 
55  virtual void disconnect();
56 
58  virtual bool isOk();
59 
61  virtual void tick();
62 
65  virtual void sendMessage(DtBaseMessage& request);
66 
70  virtual DtMessageHandler& messageHandler() {return myMessageHandler;}
71 
73  virtual void addConnectedCallback(const DtConnectionDelegate& delegate);
75  virtual void removeConnectedCallback(const DtConnectionDelegate& delegate);
76 
78  virtual void addDisconnectedCallback(const DtConnectionDelegate& delegate);
80  virtual void removeDisconnectedCallback(const DtConnectionDelegate& delegate);
81 
84  virtual DtMessageFactory& messageFactory() { return myMessageFactory; }
85 
88  virtual unsigned int nextId();
89 
92  virtual std::string& requesterName();
93 
95  static double defaultRetryTimeout();
97  static void setDefaultRetryTimeout(double val);
98 
100  static double defaultHeartbeatTimeout();
102  static void setDefaultHeatbeatTimeout(double val);
103 
104  protected:
105  DtInetAddr findFirstNetworkDeviceAddress(bool& found) const;
106 
108 
109  std::list<DtConnectionDelegate> myConnectionCallbacks;
110  std::list<DtConnectionDelegate> myDisconnectionCallbacks;
111 
113  unsigned int myNextId;
114  std::string myRequestorName;
115 
118  DtThread* myWorkerThread;
119  DtInetTcpSocket* mySocket;
120 
123  std::string myAddress;
124  int myPort;
125 
126  static void workerFunction(void* data, volatile bool* stop);
128 
130  static double theDefaultRetryTimeout;
131  };
132 }

Document ID: 1.0
Copyright © 2017 VT MAK Inc. All Rights Reserved (www.mak.com)