8#include "../../exception.hpp"
9#include "../../global.hpp"
10#include "../../size_2d.hpp"
11#include "../../utilities/system_info.hpp"
12#include "../logical_network_interface.hpp"
14#include "../../driver/driver.hpp"
15#include "../gevserver.hpp"
16#include "../../pfnc_format.hpp"
50 virtual void *
Handle() const noexcept = 0;
181 explicit ServerBase(
bool hasStream)
182 : state_{GevServer::State::Configuration}
183 , hasStream_{hasStream}
187 void RegisterEvents();
192 auto res = CVB_CALL_CAPI(GSGetLastErrorString(
nullptr, messageSize));
193 if (res || messageSize < 2)
195 std::vector<char> message(messageSize);
196 if (CVB_CALL_CAPI(GSGetLastErrorString(message.data(), messageSize)))
198 return std::string(message.data());
201 void NativeCall(std::function<CExports::cvbres_t()> fn)
const
206 auto message = GetLastGSErrorMessage();
210 std::stringstream stream;
211 stream <<
"ServerBase " << message;
212 std::rethrow_exception(CvbException::FromCvbResult(result, stream.str()));
217 T NativeCall(std::function<CExports::cvbres_t(T &value)> fn)
const
220 auto result = fn(value);
227 std::stringstream stream;
228 stream <<
"ServerBase " << message;
229 std::rethrow_exception(CvbException::FromCvbResult(result, stream.str()));
236 static void __stdcall OnConnected(
void *pPrivate)
238 auto server =
reinterpret_cast<ServerBase *
>(pPrivate);
239 server->SetState(GevServer::State::Connected);
242 static void __stdcall OnDisconnected(
void *pPrivate)
244 auto server =
reinterpret_cast<ServerBase *
>(pPrivate);
245 server->SetState(GevServer::State::Disconnected);
248 static void __stdcall OnAcquisitionStart(
void *pPrivate)
250 auto server =
reinterpret_cast<ServerBase *
>(pPrivate);
251 server->SetState(GevServer::State::AcquisitionEnabled);
254 static void __stdcall OnAcquisitionStop(
void *pPrivate)
256 auto server =
reinterpret_cast<ServerBase *
>(pPrivate);
257 server->SetState(GevServer::State::Connected);
262 const bool hasStream_;
265 std::atomic<GevServer::State> state_;
266 mutable Internal::AsyncRef<GevServer::NodeMap> nodeMap_;
virtual String UserVersion() const
Gets the user defined version that is appended to the device version.
Definition detail_server_base.hpp:35
virtual void Stop()
Stops this server.
Definition detail_server_base.hpp:77
virtual void SetUserVersion(const String &value)
Sets the user defined version that is appended to the device version.
Definition detail_server_base.hpp:40
virtual GevServer::DriverType DriverType()
Gets the GigE Vision driver used by this server object.
Definition detail_server_base.hpp:28
virtual Cvb::NetworkConnection LocalEndpoint() const
Gets the local end point this server is bound to.
Definition detail_server_base.hpp:46
virtual void * Handle() const noexcept=0
Returns the internal handle of this server object.
virtual void Start(const Cvb::NetworkConnection::IPAddress &address)
Starts this server and binds it to the given address .
Definition detail_server_base.hpp:62
virtual GevServer::State State()
Gets the the current state this server is in.
Definition detail_server_base.hpp:23
virtual NodeMapPtr NodeMap() const
Returns the GenApi node map of this server.
Definition detail_server_base.hpp:16
virtual Cvb::NetworkConnection RemoteEndpoint() const
Gets the remote end point this server is connected to.
Definition detail_server_base.hpp:54
Namespace for GevServer based device configuration.
Definition decl_int_swiss_knife_node.hpp:11
Info
General version and acquisition information.
Definition gevserver.hpp:231
State
These enum entries model the states the server can be in.
Definition decl_server_base.hpp:28
std::shared_ptr< NodeMap > NodeMapPtr
Convenience shared pointer for NodeMap.
Definition gevserver.hpp:56
@ String
Node is a string node (no reg).
Definition gevserver.hpp:218
std::string GetLastErrorMessage()
Returns the last error message.
Definition system_info.hpp:167
Root namespace for the Image Manager interface.
Definition version.hpp:11
Basic network connection operations.
Definition network_connection.hpp:15