12 #include <boost/thread/locks.hpp> 21 for (
int i = 0; i < 8; i++)
23 int32_t val = rand() % std::numeric_limits<int32_t>::max();
24 str.
Data.push_back(val);
63 boost::shared_lock<boost::shared_mutex> lock(
DbMutex);
72 boost::unique_lock<boost::shared_mutex> lock(
DbMutex);
74 std::vector<StatusCode> result;
76 for (
const uint32_t & subid : subscriptions)
82 LOG_ERROR(
Logger,
"subscription_service | got request to delete non existing SubscriptionId: {}", subid);
88 LOG_DEBUG(
Logger,
"subscription_service | delete SubscriptionId: {}", subid);
90 itsub->second->Stop();
101 boost::unique_lock<boost::shared_mutex> lock(
DbMutex);
110 LOG_ERROR(
Logger,
"subscription_service | got request to modify non existing SubscriptionId: {}", subid);
115 LOG_DEBUG(
Logger,
"subscription_service | modify SubscriptionId: {}", subid);
117 std::shared_ptr<InternalSubscription>
sub = itsub->second;
118 response.
Parameters = sub->ModifySubscription(parameters);
124 boost::unique_lock<boost::shared_mutex> lock(
DbMutex);
142 boost::unique_lock<boost::shared_mutex> lock(
DbMutex);
144 std::vector<MonitoredItemCreateResult> data;
163 data.push_back(result);
172 boost::unique_lock<boost::shared_mutex> lock(
DbMutex);
174 std::vector<StatusCode> results;
194 boost::unique_lock<boost::shared_mutex> lock(
DbMutex);
211 sub_it->second->NewAcknowlegment(ack);
218 boost::shared_lock<boost::shared_mutex> lock(
DbMutex);
229 return sub_it->second->Republish(params);
239 LOG_ERROR(
Logger,
"subscription_service | attempt to pop publish request for unknown session: {}", node);
245 Logger->debug(
"subscription_service | available session: {}", i.first);
253 if (queue_it->second == 0)
255 LOG_ERROR(
Logger,
"subscription_service | unable to send response: no publish request for session: {}", node);
261 LOG_DEBUG(
Logger,
"subscription_service | pop PublishRequest for session: {}: available requests: {}", node, queue_it->second);
270 boost::shared_lock<boost::shared_mutex> lock(
DbMutex);
276 event.EventId = GenerateEventId();
281 sub.second->TriggerEvent(node, event);
291 SubscriptionService::UniquePtr
CreateSubscriptionService(std::shared_ptr<Server::AddressSpace> addressspace, boost::asio::io_service &
io,
const Common::Logger::SharedPtr & logger)
std::map< NodeId, uint32_t > PublishRequestQueues
~SubscriptionServiceInternal()
bool PopPublishRequest(NodeId node)
OpcUa::CreateSubscriptionParameters Parameters
virtual SubscriptionData CreateSubscription(const CreateSubscriptionRequest &request, std::function< void(PublishResult)> callback)
double RequestedPublishingInterval
#define LOG_ERROR(__logger__,...)
uint32_t LastSubscriptionId
#define LOG_DEBUG(__logger__,...)
std::vector< uint8_t > Data
uint32_t RevisedLifetimeCount
uint32_t RequestedMaxKeepAliveCount
SubscriptionService::UniquePtr CreateSubscriptionService(std::shared_ptr< Server::AddressSpace > addressspace, boost::asio::io_service &io, const Common::Logger::SharedPtr &logger)
SubscriptionServiceInternal(Server::AddressSpace::SharedPtr addressspace, boost::asio::io_service &io, const Common::Logger::SharedPtr &logger)
virtual RepublishResponse Republish(const RepublishParameters &request)
Common::Logger::SharedPtr Logger
boost::asio::io_service & GetIOService()
double RevisedPublishingInterval
uint32_t RequestedLifetimeCount
OpcUa::ResponseHeader Header
Server::AddressSpace::SharedPtr AddressSpace
SubscriptionsIdMap SubscriptionsMap
OpcUa::ModifySubscriptionResult Parameters
OPC UA Address space part. GNU LGPL.
uint32_t RevisedMaxKeepAliveCount
virtual std::vector< StatusCode > DeleteSubscriptions(const std::vector< uint32_t > &subscriptions)
boost::asio::io_service & io
OpcUa::RequestHeader Header
std::vector< uint32_t > MonitoredItemIds
void TriggerEvent(NodeId node, Event event)
virtual std::vector< MonitoredItemCreateResult > CreateMonitoredItems(const MonitoredItemsParameters ¶ms)
void DeleteAllSubscriptions()
virtual std::vector< StatusCode > DeleteMonitoredItems(const DeleteMonitoredItemsParameters ¶ms)
boost::shared_mutex DbMutex
OpcUa::ResponseHeader Header
std::vector< OpcUa::SubscriptionAcknowledgement > SubscriptionAcknowledgements
virtual ModifySubscriptionResponse ModifySubscription(const ModifySubscriptionParameters ¶meters)
virtual void Publish(const PublishRequest &request)
OpcUa::RequestHeader Header
Server::AddressSpace & GetAddressSpace()
std::vector< OpcUa::MonitoredItemCreateRequest > ItemsToCreate