6#include "../_cexports/c_gev_server.h"
8#include "../global.hpp"
10#include "_decl/decl_node.hpp"
13#include "_detail/iconfigurable_command_node.hpp"
14#include "_detail/iconfigurable_register_node.hpp"
15#include "_detail/iconfigurable_value_node.hpp"
16#include "_detail/ihas_value_config.hpp"
30 ,
public Private::IConfigurableValueNode
51 return CVB_CALL_CAPI(GSNUnregisterEvent(
Handle(), CExports::TGSNodeEvent::GSNE_Read, readCallbackID_));
55 return CVB_CALL_CAPI(GSNUnregisterEvent(
Handle(), CExports::TGSNodeEvent::GSNE_Write, writeCallbackID_));
75 return CVB_CALL_CAPI(GSNSetInfoAsInteger(
Handle(), CExports::TGSNodeInfo::GSNI_Streamable, (value ? 1 : 0)));
102 auto bufferSize = NativeCall<size_t>(
103 [&](
size_t &size) {
return CExports::GSNGetAsStringTyped(
Handle(),
reinterpret_cast<Char *
>(0), size); });
104 bufferSize +=
sizeof(
Char);
106 NativeCall([&]() {
return CExports::GSNGetAsStringTyped(
Handle(), buffer.data(), bufferSize); });
107 return buffer.data();
117 NativeCall([&]() {
return CExports::GSNSetAsStringTyped(
Handle(), value.data()); });
128 auto holder = Internal::CbCarrier<void(
ValueNode &)>::Create(handler);
129 return updatedCarrierContainerWritten_.Register(holder);
139 updatedCarrierContainerWritten_.Unregister(eventCookie);
150 auto holder = Internal::CbCarrier<void(
ValueNode &)>::Create(handler);
151 return updatedCarrierContainerOnRead_.Register(holder);
161 updatedCarrierContainerOnRead_.Unregister(eventCookie);
165 ValueNode(HandleGuard<Node> &&guard) noexcept :
Node(std::move(guard))
173 int resultRegister = CVB_CALL_CAPI(GSNRegisterEventWithStatus(
174 Handle(), CExports::TGSNodeEvent::GSNE_Read, &ValueNode::EventOnReadCallback,
this, readCallbackID_));
175 if (resultRegister < 0)
176 std::rethrow_exception(CvbException::FromCvbResult(resultRegister,
"failed to register updated handler"));
178 resultRegister = CVB_CALL_CAPI(GSNRegisterEventWithStatus(
179 Handle(), CExports::TGSNodeEvent::GSNE_Write, &ValueNode::EventWrittenCallback,
this, writeCallbackID_));
180 if (resultRegister < 0)
181 std::rethrow_exception(CvbException::FromCvbResult(resultRegister,
"failed to register updated handler"));
187 static void __stdcall EventWrittenCallback(CExports::cvbres_t &status,
void *pPrivate)
189 if (status == ReplyStatus::Success)
193 auto node =
reinterpret_cast<ValueNode *
>(pPrivate);
194 node->updatedCarrierContainerWritten_.Call<void(ValueNode &)>(*node);
202 case ReplyStatus::Success:
205 case ReplyStatus::AccessDenied:
208 case ReplyStatus::Busy:
211 case ReplyStatus::NotImplemented:
214 case ReplyStatus::DataOverrun:
217 case ReplyStatus::InvalidParameter:
220 case ReplyStatus::WrongConfig:
224 case ReplyStatus::LocalProblem:
230 static void __stdcall EventOnReadCallback(CExports::cvbres_t &status,
void *pPrivate)
232 if (status == ReplyStatus::Success)
236 auto node =
reinterpret_cast<ValueNode *
>(pPrivate);
237 node->updatedCarrierContainerOnRead_.Call<void(ValueNode &)>(*node);
246 case ReplyStatus::Success:
249 case ReplyStatus::AccessDenied:
252 case ReplyStatus::Busy:
255 case ReplyStatus::NotImplemented:
258 case ReplyStatus::DataOverrun:
261 case ReplyStatus::InvalidParameter:
264 case ReplyStatus::WrongConfig:
268 case ReplyStatus::LocalProblem:
274 Internal::CarrierContainer updatedCarrierContainerWritten_;
275 Internal::CarrierContainer updatedCarrierContainerOnRead_;
Cookie used to unregister event handlers.
Definition: global.hpp:535
Basic GevServer node for device feature access.
Definition: decl_node.hpp:41
static GevServer::NodeType NodeType(void *handle)
Gets the node type from the nodes native handle.
Definition: decl_node.hpp:643
void * Handle() const noexcept
Classic API node handle.
Definition: decl_node.hpp:101
Base class for all nodes that have a value.
Definition: value_node.hpp:32
virtual String ToString() const
Returns this node's value as a string representation.
Definition: value_node.hpp:100
void UnregisterEventOnReadUpdated(EventCookie eventCookie) noexcept
Manually unregister a listener to the node on read event.
Definition: value_node.hpp:159
EventCookie RegisterEventOnReadUpdated(std::function< void(ValueNode &)> handler)
Register a listener to node on read event.
Definition: value_node.hpp:148
virtual void SetIsStreamable(const std::int64_t &value)
Sets whether this node should be used when the camera settings are stored.
Definition: value_node.hpp:72
virtual void FromString(const String &value)
Sets this node's value from the string value.
Definition: value_node.hpp:115
virtual bool IsStreamable() const
Gets whether this node should be used when the camera settings are stored.
Definition: value_node.hpp:65
void UnregisterEventWrittenUpdated(EventCookie eventCookie) noexcept
Manually unregister a listener to the node written event.
Definition: value_node.hpp:137
EventCookie RegisterEventWrittenUpdated(std::function< void(ValueNode &)> handler)
Register a listener to node written event.
Definition: value_node.hpp:126
std::chrono::duration< Rep, Period > PollingTime() const
Gets the polling time of this value.
Definition: value_node.hpp:86
const int CVB_BUSY
Hardware busy.
Definition: exception.hpp:58
const int CVB_ERROR
Generic unspecified error.
Definition: exception.hpp:24
const int CVB_NOTENOUGHDATA
Too few data available for a calculation.
Definition: exception.hpp:66
const int CVB_OK
No error occurred.
Definition: exception.hpp:22
const int CVB_PARAMETER
Parameter error.
Definition: exception.hpp:26
const int CVB_ACCESS
Access error.
Definition: exception.hpp:112
const int CVB_NOTSUPPORTED
A certain feature is not supported.
Definition: exception.hpp:60
const int CVB_OVERFLOW
Input value was too big or did lead to a too big result.
Definition: exception.hpp:108
@ PollingTime
Gets the polling time in ms.
@ Streamable
Information on the streamability of the node.
@ Category
Node is a category node.
@ EnumEntry
Node is an enumeration entry node (no reg).
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24
char Char
Character type for wide characters or unicode characters.
Definition: string.hpp:59