6#include "../../internal/Conf.hpp"
10#include "../../internal/Common.hpp"
11#include "../../internal/Id.hpp"
12#include "../../internal/JavaObjectHandle.hpp"
14#include "../../entity/SharedEntity.hpp"
20
21
22
23
27 using Ptr = std::shared_ptr<InstrumentProfileConnection>;
30 using Unique = std::unique_ptr<InstrumentProfileConnection>;
33
34
37
38
39
43
44
48
49
53
54
58
59
64 Id<InstrumentProfileConnection> id_;
65 JavaObjectHandle<InstrumentProfileConnection> handle_;
66 JavaObjectHandle<IpfPropertyChangeListener> stateChangeListenerHandle_;
67 SimpleHandler<
void(State, State)> onStateChange_{};
69 InstrumentProfileConnection()
noexcept;
74 static std::string stateToString(
State state)
noexcept {
77 return "NOT_CONNECTED";
92
93
94
95
96
97
98
99
100
101
102
103
104
108
109
110
111
112
116
117
118
119
120
121
122
123
127
128
129
130
131
132
133
134
140
141
142
143
144
148
149
150
151
152
154 setUpdatePeriod(updatePeriod.count());
158
159
160
161
165
166
167
168
169
173
174
175
176
180
181
182
186
187
188
189
190
191
192
193
194
195 template <
typename StateChangeListener>
203 return onStateChange_ += listener;
207
208
209
210
211
212
214 onStateChange_ -= listenerId;
218
219
220
221
222
224 return onStateChange_;
228
229
230
231
232
233
237
238
239
240
241
242
244 return waitUntilCompleted(timeout.count());
#define DXFCXX_DISABLE_MSC_WARNINGS_POP()
Definition Conf.hpp:22
#define DXFCPP_END_NAMESPACE
Definition Conf.hpp:70
#define DXFCPP_BEGIN_NAMESPACE
Definition Conf.hpp:67
#define DXFCXX_DISABLE_MSC_WARNINGS_PUSH(warnings)
Definition Conf.hpp:21
#define DXFCPP_EXPORT
Definition api.h:35
auto & onStateChange()
Returns the onStateChange handler that can be used to add or remove listeners.
Definition InstrumentProfileConnection.hpp:223
bool waitUntilCompleted(std::chrono::milliseconds timeout) const
Synchronously waits for full first snapshot read with the specified timeout.
Definition InstrumentProfileConnection.hpp:243
static Ptr createConnection(const StringLikeWrapper &address, InstrumentProfileCollector::Ptr collector)
Creates instrument profile connection with a specified address and collector.
Definition InstrumentProfileConnection.cpp:67
State getState() const
Returns state of this instrument profile connections.
Definition InstrumentProfileConnection.cpp:97
void removeStateChangeListener(std::size_t listenerId)
Removes listener that is notified about changes in state property.
Definition InstrumentProfileConnection.hpp:213
void close() const
Closes this instrument profile connection.
Definition InstrumentProfileConnection.cpp:109
std::int64_t getLastModified() const
Returns last modification time (in milliseconds) of instrument profiles or zero if it is unknown.
Definition InstrumentProfileConnection.cpp:101
State
Instrument profile connection state.
Definition InstrumentProfileConnection.hpp:35
@ CLOSED
Instrument profile connection was closed.
Definition InstrumentProfileConnection.hpp:60
@ COMPLETED
Initial instrument profiles snapshot was fully read (this state is set only once).
Definition InstrumentProfileConnection.hpp:55
@ CONNECTING
Connection is being established.
Definition InstrumentProfileConnection.hpp:45
@ CONNECTED
Connection was established.
Definition InstrumentProfileConnection.hpp:50
@ NOT_CONNECTED
Instrument profile connection is not started yet.
Definition InstrumentProfileConnection.hpp:40
std::string getAddress() const
Returns the address of this instrument profile connection.
Definition InstrumentProfileConnection.cpp:85
std::int64_t getUpdatePeriod() const
Returns update period in milliseconds.
Definition InstrumentProfileConnection.cpp:89
void start() const
Starts this instrument profile connection.
Definition InstrumentProfileConnection.cpp:105
void setUpdatePeriod(std::int64_t updatePeriod) const
Changes the update period in milliseconds.
Definition InstrumentProfileConnection.cpp:93
std::size_t addStateChangeListener(StateChangeListener &&listener)
Adds listener that is notified about changes in state property.
Definition InstrumentProfileConnection.hpp:196
void setUpdatePeriod(std::chrono::milliseconds updatePeriod) const
Changes the update period in milliseconds as chrono::duration.
Definition InstrumentProfileConnection.hpp:153
std::chrono::milliseconds getUpdatePeriodAsDuration() const
Returns update period in milliseconds as chrono::duration It is period of an update check when the in...
Definition InstrumentProfileConnection.hpp:135
bool waitUntilCompleted(std::int64_t timeout) const
Synchronously waits for full first snapshot read with the specified timeout.
Definition InstrumentProfileConnection.cpp:113
Base abstract "shared entity" class. Has some helpers for dynamic polymorphism.
Definition SharedEntity.hpp:21
A simple wrapper around strings or something similar to strings to reduce the amount of code for meth...
Definition Common.hpp:794