Virtual Acoustics (VA) C++ API  v2018a
Virtual Acoustics is a real-time auralization framework devoted to Virtual Reality.
VANetClient.h
Go to the documentation of this file.
1 /*
2  * --------------------------------------------------------------------------------------------
3  *
4  * VVV VVV A Virtual Acoustics (VA) | http://www.virtualacoustics.org
5  * VVV VVV AAA Licensed under the Apache License, Version 2.0
6  * VVV VVV AAA
7  * VVV VVV AAA Copyright 2015-2018
8  * VVVVVV AAA Institute of Technical Acoustics (ITA)
9  * VVVV AAA RWTH Aachen University
10  *
11  * --------------------------------------------------------------------------------------------
12  */
13 
14 #ifndef IW_VANET_CLIENT
15 #define IW_VANET_CLIENT
16 
17 #include <VANetDefinitions.h>
18 #include <string>
19 
20 class IVAInterface;
22 
24 
37 {
38 public:
40  enum ErrorType
41  {
42  VA_NO_ERROR = 0,
49  };
50 
53  {
54  VA_HC_USE_EXISTING = 0,
56  VA_HC_SEPARATE_UDP
57  };
58 
61  {
64  };
65 
67 
70  static IVANetClient* Create();
71 
73  virtual ~IVANetClient();
74 
76 
79  virtual IVAInterface* GetCoreInstance() const = 0;
80 
82 
85  virtual bool IsConnected() const = 0;
86 
88 
91  virtual std::string GetServerAddress() const = 0;
92 
94 
104  virtual int Initialize( const std::string& sServerAddress, const int iServerPort = VANET_DEFAULT_PORT, const int iHeadChannelMode = VA_HC_USE_EXISTING, const int iExceptionHandlingMode = EXC_CLIENT_THROW, const bool bBufferSynchronizedCommands = true ) = 0;
105 
107 
110  virtual void SetExceptionHandlingMode( const int nMode ) = 0;
111 
113 
116  virtual int GetExceptionhandlingMode() const = 0;
117 
119 
122  virtual int Disconnect() = 0;
123 
125  class CEvent
126  {
127  public:
130  {
131  EVENT_NOTHING = 0,
133  EVENT_SERVER_LOST //<! Unintended connection loss
134  };
135 
136  std::string sServer;
137  int iType;
138 
140  inline CEvent()
141  : iType( EVENT_NOTHING )
142  {
143  };
144 
146 
150  inline CEvent( const int iInitType, const std::string& sInitServer )
151  : iType( iInitType )
152  , sServer( sInitServer )
153  {
154  };
155  };
156 
159  {
160  public:
162  inline virtual ~IEventHandler() {};
163 
165 
168  virtual void HandleEvent( const IVANetClient::CEvent& oEvent ) = 0;
169  };
170 
172 
176  virtual bool AttachEventHandler( IVANetClient::IEventHandler* pHandler ) = 0;
177 
179 
183  virtual bool DetachEventHandler( IVANetClient::IEventHandler* pHandler ) = 0;
184 
185 protected:
187  IVANetClient();
188 };
189 
190 #endif // IW_VANET_CLIENT
for all functions, immediately transmit exception and throws it
Definition: VANetClient.h:62
#define VANET_DEFAULT_PORT
Connection established, but server is not responding.
Definition: VANetClient.h:44
Networked transparend calls to VA interface view TCP/IP as a client.
Definition: VANetClient.h:36
int iType
Event type.
Definition: VANetClient.h:137
Unknown network error occurred.
Definition: VANetClient.h:46
ErrorType
Error types.
Definition: VANetClient.h:40
Network service is already used by another client.
Definition: VANetClient.h:45
virtual ~IEventHandler()
Destructor.
Definition: VANetClient.h:162
#define VANET_API
CEvent(const int iInitType, const std::string &sInitServer)
Constructor of special type.
Definition: VANetClient.h:150
CEvent()
Default constructor with no event type.
Definition: VANetClient.h:140
Connection event class.
Definition: VANetClient.h:125
std::string sServer
Event server.
Definition: VANetClient.h:136
EventTypes
Event types.
Definition: VANetClient.h:129
Incompatible network protocol versions (declined connection)
Definition: VANetClient.h:47
Any other unrecognized error.
Definition: VANetClient.h:48
ExceptionHandlingMode
Exception handling modi.
Definition: VANetClient.h:60
HeadChannelMode
Head channel modi.
Definition: VANetClient.h:52
functions without return value immediately return, and the exception is printed on the server ...
Definition: VANetClient.h:63
Connection faild - wrong address or no server running.
Definition: VANetClient.h:43
Interface of Virtual Acoustics (VA)
Definition: VAInterface.h:50
Interface for handling conection events using the provided hook / callback.
Definition: VANetClient.h:158
Virtual Acoustics (VA) | http://www.virtualacoustics.org
Source code licensed under the Apache License, Version 2.0
C++ API documentation auto generated and licensed under Creative Commons Attribution License 4.0
© 2017-2018 Institute of Technical Acoustics (ITA)
RWTH Aachen University, Germany.