Classes | Functions | Variables
opcua_client.cpp File Reference

This file implements OpcUa client based on FreeOpcUa implementation. More...

#include <ros/ros.h>
#include <signal.h>
#include <opcua_helpers.h>
#include "ros_opcua_msgs/Address.h"
#include "ros_opcua_msgs/TypeValue.h"
#include "ros_opcua_srvs/CallMethod.h"
#include "ros_opcua_srvs/Connect.h"
#include "ros_opcua_srvs/Disconnect.h"
#include "ros_opcua_srvs/ListNode.h"
#include "ros_opcua_srvs/Read.h"
#include "ros_opcua_srvs/Subscribe.h"
#include "ros_opcua_srvs/Write.h"
#include "ros_opcua_srvs/Unsubscribe.h"
#include <opc/ua/client/client.h>
#include <opc/ua/subscription.h>
Include dependency graph for opcua_client.cpp:

Go to the source code of this file.

Classes

class  SubClient
 Subscription client class handles subscription callbacks. More...
 

Functions

bool call_method (ros_opcua_srvs::CallMethod::Request &req, ros_opcua_srvs::CallMethod::Response &res)
 
bool connect (ros_opcua_srvs::Connect::Request &req, ros_opcua_srvs::Connect::Response &res)
 
bool disconnect (ros_opcua_srvs::Disconnect::Request &req, ros_opcua_srvs::Disconnect::Response &res)
 
bool list_node (ros_opcua_srvs::ListNode::Request &req, ros_opcua_srvs::ListNode::Response &res)
 
int main (int argc, char **argv)
 
void on_shutdown (int sig)
 
bool read (ros_opcua_srvs::Read::Request &req, ros_opcua_srvs::Read::Response &res)
 
bool subscribe (ros_opcua_srvs::Subscribe::Request &req, ros_opcua_srvs::Subscribe::Response &res)
 
bool unsubscribe (ros_opcua_srvs::Unsubscribe::Request &req, ros_opcua_srvs::Unsubscribe::Response &res)
 
bool write (ros_opcua_srvs::Write::Request &req, ros_opcua_srvs::Write::Response &res)
 

Variables

std::map< std::string, ros::Publisher_callback_publishers
 Callback publishers list. More...
 
OpcUa::UaClient _client (false)
 Client variable. More...
 
bool _connected = false
 Connected status variable. More...
 
SubClient _sclt
 Subscription client store. More...
 
std::map< std::string, uint32_t > _subscription_handles
 List of subscription handles. More...
 
std::map< std::string, std::shared_ptr< OpcUa::Subscription > > _subscriptions
 Subscription list. More...
 

Detailed Description

This file implements OpcUa client based on FreeOpcUa implementation.

Author
Denis Štogl
Todo:
Would be cool to have dignostic topic to write subscriptions and stuff

Definition in file opcua_client.cpp.

Function Documentation

bool call_method ( ros_opcua_srvs::CallMethod::Request &  req,
ros_opcua_srvs::CallMethod::Response &  res 
)

Definition at line 191 of file opcua_client.cpp.

bool connect ( ros_opcua_srvs::Connect::Request &  req,
ros_opcua_srvs::Connect::Response &  res 
)

ROS-service call: Connect. Connects to OpcUa server.

Parameters
reqservice request
resservice response
Returns
True, if service execution broken than False.

Definition at line 90 of file opcua_client.cpp.

bool disconnect ( ros_opcua_srvs::Disconnect::Request &  req,
ros_opcua_srvs::Disconnect::Response &  res 
)

ROS-service call: Disconnect. Disconnects from OpcUa server.

Parameters
reqservice request
resservice response
Returns
True, if service execution broken than False.

Definition at line 123 of file opcua_client.cpp.

bool list_node ( ros_opcua_srvs::ListNode::Request &  req,
ros_opcua_srvs::ListNode::Response &  res 
)

ROS-service call: ListNode. Gets list of Node children from OpcUa server.

Parameters
reqservice request
resservice response
Returns
True, if service execution broken than False.

Definition at line 153 of file opcua_client.cpp.

int main ( int  argc,
char **  argv 
)

Start function of ROS-Node with default name 'opcua_client_node'

Parameters
argcnumber of command line arguments
argvcommand line arguments
Returns
0 if programs ends successfully.

Definition at line 426 of file opcua_client.cpp.

void on_shutdown ( int  sig)

Handler for Shutdown of the node

Definition at line 413 of file opcua_client.cpp.

bool read ( ros_opcua_srvs::Read::Request &  req,
ros_opcua_srvs::Read::Response &  res 
)

ROS-service call: Read. Reads value from OpcUa server.

Parameters
reqservice request
resservice response
Returns
True, if service execution broken than False.

Definition at line 238 of file opcua_client.cpp.

bool subscribe ( ros_opcua_srvs::Subscribe::Request &  req,
ros_opcua_srvs::Subscribe::Response &  res 
)

ROS-service call: Subscribe. Subscribe to DataChange of Node on OpcUa server.

Parameters
reqservice request
resservice response
Returns
True, if service execution broken than False.
Todo:
can subscribe on only one node

Definition at line 327 of file opcua_client.cpp.

bool unsubscribe ( ros_opcua_srvs::Unsubscribe::Request &  req,
ros_opcua_srvs::Unsubscribe::Response &  res 
)

ROS-service call: Unsubscribe. Unsubscribe from Node on OpcUa server.

Parameters
reqservice request
resservice response
Returns
True, if service execution broken than False.

Definition at line 370 of file opcua_client.cpp.

bool write ( ros_opcua_srvs::Write::Request &  req,
ros_opcua_srvs::Write::Response &  res 
)

ROS-service call: Write. Writes value to OpcUa server.

Parameters
reqservice request
resservice response
Returns
True, if service execution broken than False.

Definition at line 277 of file opcua_client.cpp.

Variable Documentation

std::map<std::string, ros::Publisher> _callback_publishers

Callback publishers list.

Key is OpcUa string node identifier and value ROS publisher

Definition at line 52 of file opcua_client.cpp.

OpcUa::UaClient _client(false)

Client variable.

bool _connected = false

Connected status variable.

Definition at line 57 of file opcua_client.cpp.

SubClient _sclt

Subscription client store.

Todo:
Need checking for multiple subscriptions

Definition at line 82 of file opcua_client.cpp.

std::map<std::string, uint32_t> _subscription_handles

List of subscription handles.

Key is OpcUa string node identifier and value is node handle. This is needed for deteting of subscriptions

Definition at line 55 of file opcua_client.cpp.

std::map<std::string, std::shared_ptr<OpcUa::Subscription> > _subscriptions

Subscription list.

Key is OpcUa string node identifier and value subscription reference.

Definition at line 49 of file opcua_client.cpp.



ros_opcua_impl_freeopcua
Author(s): Denis Štogl
autogenerated on Tue Jan 19 2021 03:12:09