6#include "../../internal/Conf.hpp"
10#include "../../entity/SharedEntity.hpp"
11#include "../../internal/Common.hpp"
12#include "../../internal/Id.hpp"
13#include "../../internal/JavaObjectHandle.hpp"
14#include "./InstrumentProfileCollector.hpp"
17
18
19
24
25
26
27
31 using Ptr = std::shared_ptr<InstrumentProfileConnection>;
34 using Unique = std::unique_ptr<InstrumentProfileConnection>;
37
38
41
42
43
47
48
52
53
57
58
62
63
68 Id<InstrumentProfileConnection> id_;
69 JavaObjectHandle<InstrumentProfileConnection> handle_{};
70 JavaObjectHandle<IpfPropertyChangeListener> stateChangeListenerHandle_{};
71 SimpleHandler<
void(State, State)> onStateChange_{};
73 InstrumentProfileConnection()
noexcept;
78 static std::string stateToString(
State state)
noexcept;
81
82
83
84
85
86
87
88
89
90
91
92
93
97
98
99
100
101
105
106
107
108
109
110
111
112
116
117
118
119
120
121
122
123
127
128
129
130
131
135
136
137
138
139
143
144
145
146
150
151
152
153
154
158
159
160
161
165
166
167
171
172
173
174
175
176
177
178
179
180 template <
typename StateChangeListener>
188 return onStateChange_ += listener;
192
193
194
195
196
197
201
202
203
204
205
209
210
211
212
213
214
218
219
220
221
222
223
#define DXFCXX_DISABLE_MSC_WARNINGS_POP()
Definition Conf.hpp:31
#define DXFCPP_END_NAMESPACE
Definition Conf.hpp:97
#define DXFCPP_BEGIN_NAMESPACE
Definition Conf.hpp:94
#define DXFCXX_DISABLE_MSC_WARNINGS_PUSH(warnings)
Definition Conf.hpp:30
#define DXFCPP_EXPORT
Definition api.h:35
static Ptr createConnection(const StringLike &address, InstrumentProfileCollector::Ptr collector)
Creates instrument profile connection with a specified address and collector.
Definition InstrumentProfileConnection.cpp:78
bool waitUntilCompleted(std::chrono::milliseconds timeout) const
Synchronously waits for full first snapshot read with the specified timeout.
Definition InstrumentProfileConnection.cpp:145
State getState() const
Returns state of this instrument profile connections.
Definition InstrumentProfileConnection.cpp:116
void removeStateChangeListener(std::size_t listenerId)
Removes listener that is notified about changes in state property.
Definition InstrumentProfileConnection.cpp:132
void close() const
Closes this instrument profile connection.
Definition InstrumentProfileConnection.cpp:128
std::int64_t getLastModified() const
Returns last modification time (in milliseconds) of instrument profiles or zero if it is unknown.
Definition InstrumentProfileConnection.cpp:120
State
Instrument profile connection state.
Definition InstrumentProfileConnection.hpp:39
@ CLOSED
Instrument profile connection was closed.
Definition InstrumentProfileConnection.hpp:64
@ COMPLETED
Initial instrument profiles snapshot was fully read (this state is set only once).
Definition InstrumentProfileConnection.hpp:59
@ CONNECTING
Connection is being established.
Definition InstrumentProfileConnection.hpp:49
@ CONNECTED
Connection was established.
Definition InstrumentProfileConnection.hpp:54
@ NOT_CONNECTED
Instrument profile connection is not started yet.
Definition InstrumentProfileConnection.hpp:44
std::string getAddress() const
Returns the address of this instrument profile connection.
Definition InstrumentProfileConnection.cpp:96
std::int64_t getUpdatePeriod() const
Returns update period in milliseconds.
Definition InstrumentProfileConnection.cpp:100
void start() const
Starts this instrument profile connection.
Definition InstrumentProfileConnection.cpp:124
void setUpdatePeriod(std::int64_t updatePeriod) const
Changes the update period in milliseconds.
Definition InstrumentProfileConnection.cpp:108
std::size_t addStateChangeListener(StateChangeListener &&listener)
Adds listener that is notified about changes in state property.
Definition InstrumentProfileConnection.hpp:181
void setUpdatePeriod(std::chrono::milliseconds updatePeriod) const
Changes the update period in milliseconds as chrono::duration.
Definition InstrumentProfileConnection.cpp:112
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.cpp:104
SimpleHandler< void(State, State)> & onStateChange()
Returns the onStateChange handler that can be used to add or remove listeners.
Definition InstrumentProfileConnection.cpp:137
bool waitUntilCompleted(std::int64_t timeout) const
Synchronously waits for full first snapshot read with the specified timeout.
Definition InstrumentProfileConnection.cpp:141
A base abstract "shared entity" class. Has some helpers for dynamic polymorphism.
Definition SharedEntity.hpp:25
A lightweight wrapper around strings or string-like inputs.
Definition StringUtils.hpp:27