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.
OpcUa::UaClient _client (false)
 Client variable.
bool _connected = false
 Connected status variable.
SubClient _sclt
 Subscription client store.
std::map< std::string, uint32_t > _subscription_handles
 List of subscription handles.
std::map< std::string,
std::unique_ptr
< OpcUa::Subscription > > 
_subscriptions
 Subscription list.

Detailed Description

This file implements OpcUa client based on FreeOpcUa implementation.

Author:
Denis Štogl

This file is part of SkillPro-Framework.

SkillPro-Framework is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

SkillPro-Framework is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with SkillPro-Framework. If not, see <http://www.gnu.org/licenses/>.

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 193 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 154 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 436 of file opcua_client.cpp.

void on_shutdown ( int  sig)

Handler for Shutdown of the node

Definition at line 423 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 241 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 335 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 379 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 283 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.

Client variable.

bool _connected = false

Connected status variable.

Definition at line 57 of file opcua_client.cpp.

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::unique_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 Sat Jun 8 2019 18:24:58