![]() |
RMVL
1.2.1
Robotic Manipulation and Vision Library
|
OPC UA 服务器 更多...
#include <rmvl/opcua/server.hpp>
Public 成员函数 | |
| Server (uint16_t port, const std::vector< UserConfig > &users={}) | |
| 创建 OPC UA 服务器 | |
| Server (ServerUserConfig on_config, uint16_t port, const std::vector< UserConfig > &users={}) | |
| 从服务器配置函数指针创建 OPC UA 服务器 | |
| Server (const Server &)=delete | |
| Server (Server &&)=delete | |
| void | start () |
| 运行服务器,调用方线程不阻塞 | |
| void | stop () |
| 停止服务器 | |
| void | join () |
| 阻塞 | |
| ~Server () | |
| 释放服务器资源 | |
| FindNodeInServer | find (const std::string &browse_name) |
| 获取路径搜索必要信息 | |
| UA_NodeId | addVariableTypeNode (const VariableType &vtype) |
添加变量类型节点 VariableTypeNode 至 BaseDataVariableType 中 | |
| UA_NodeId | addVariableNode (const Variable &val, const UA_NodeId &parent_id=nodeObjectsFolder) |
| 添加变量节点 VariableNode 至指定父节点中,并指定引用类型 | |
| bool | addVariableNodeValueCallBack (UA_NodeId id, ValueCallBackBeforeRead before_read, ValueCallBackAfterWrite after_write) |
| 为既有的变量节点 VariableNode 添加值回调 | |
| UA_NodeId | addDataSourceVariableNode (const Variable &val, DataSourceRead on_read, DataSourceWrite on_write, UA_NodeId parent_id=nodeObjectsFolder) |
| 添加数据源变量节点 VariableNode 至指定父节点中 | |
| Variable | read (const UA_NodeId &node) |
| 从指定的变量节点读数据 | |
| bool | write (const UA_NodeId &node, const Variable &val) |
| 给指定的变量节点写数据 | |
| UA_NodeId | addMethodNode (const Method &method, const UA_NodeId &parent_id=nodeObjectsFolder) |
| 添加方法节点 MethodNode 至指定父节点中 | |
| void | setMethodNodeCallBack (const UA_NodeId &id, UA_MethodCallback on_method) |
| 为既有的方法节点 MethodNode 设置方法的回调函数 | |
| UA_NodeId | addObjectTypeNode (const ObjectType &otype) |
添加对象类型节点 ObjectTypeNode 至 rm::nodeBaseObjectType 中 | |
| UA_NodeId | addObjectNode (const Object &obj, UA_NodeId parent_id=nodeObjectsFolder) |
| 添加对象节点 ObjectNode 至指定的父节点中 | |
| UA_NodeId | addViewNode (const View &view) |
添加视图节点 ViewNode 至 rm::nodeViewsFolder 中 | |
| UA_NodeId | addEventTypeNode (const EventType &etype) |
添加事件类型至 BaseEventType 中 | |
| bool | triggerEvent (const UA_NodeId &node_id, const Event &event) |
| 创建并触发事件 | |
Protected 成员函数 | |
| void | deleteServer () |
| 释放服务器资源 | |
Protected 属性 | |
| UA_Server * | _server |
| OPC UA 服务器指针 | |
| bool | _running {} |
| 服务器运行状态 | |
| std::thread | _run |
| 服务器运行线程 | |
OPC UA 服务器
|
explicit |
| rm::Server::Server | ( | ServerUserConfig | on_config, |
| uint16_t | port, | ||
| const std::vector< UserConfig > & | users = {} ) |
从服务器配置函数指针创建 OPC UA 服务器
*.xml 文件,并由 nodeset_compiler 生成*.xml 文件的编写,参考 从 XML 配置 OPC UA| [in] | on_config | 服务器配置函数指针 |
| [in] | port | OPC UA 服务器端口号,一般设置为 4840U |
| [in] | users | 用户列表 |
|
delete |
|
delete |
|
inline |
释放服务器资源
| UA_NodeId rm::Server::addDataSourceVariableNode | ( | const Variable & | val, |
| DataSourceRead | on_read, | ||
| DataSourceWrite | on_write, | ||
| UA_NodeId | parent_id = nodeObjectsFolder ) |
添加数据源变量节点 VariableNode 至指定父节点中
数据源变量节点不同于变量节点的值回调
| [in] | val | rm::Variable 表示的变量,仅取 browse_name、description、display_name、access_level 字段,以及对应的变量类型节点 |
| [in] | on_read | 重定向的读取回调函数 |
| [in] | on_write | 重定向的写入回调函数 |
| [in] | parent_id | 指定父节点的 UA_NodeId,默认为 rm::nodeObjectsFolder |
UA_NodeId | UA_NodeId rm::Server::addEventTypeNode | ( | const EventType & | etype | ) |
| UA_NodeId rm::Server::addMethodNode | ( | const Method & | method, |
| const UA_NodeId & | parent_id = nodeObjectsFolder ) |
添加方法节点 MethodNode 至指定父节点中
| [in] | method | rm::Method 表示的方法 |
| [in] | parent_id | 指定父节点的 UA_NodeId,默认为 rm::nodeObjectsFolder |
UA_NodeId | UA_NodeId rm::Server::addObjectNode | ( | const Object & | obj, |
| UA_NodeId | parent_id = nodeObjectsFolder ) |
添加对象节点 ObjectNode 至指定的父节点中
| [in] | obj | rm::Object 表示的对象 |
| [in] | parent_id | 指定的父节点 UA_NodeId,默认为 rm::nodeObjectsFolder |
UA_NodeId | UA_NodeId rm::Server::addObjectTypeNode | ( | const ObjectType & | otype | ) |
添加对象类型节点 ObjectTypeNode 至 rm::nodeBaseObjectType 中
| [in] | otype | rm::ObjectType 表示的对象类型 |
UA_NodeId | UA_NodeId rm::Server::addVariableNode | ( | const Variable & | val, |
| const UA_NodeId & | parent_id = nodeObjectsFolder ) |
添加变量节点 VariableNode 至指定父节点中,并指定引用类型
| [in] | val | rm::Variable 表示的变量 |
| [in] | parent_id | 指定父节点的 UA_NodeId,默认为 rm::nodeObjectsFolder |
UA_NodeId | bool rm::Server::addVariableNodeValueCallBack | ( | UA_NodeId | id, |
| ValueCallBackBeforeRead | before_read, | ||
| ValueCallBackAfterWrite | after_write ) |
为既有的变量节点 VariableNode 添加值回调
值回调表示在对 服务器中的 变量节点进行读写的时候,会在读之前执行 beforeRead,在写之后执行 afterWrite
| [in] | id | 既有的变量节点的 UA_NodeId,因变量节点可能位于任意一个父节点下,因此可以使用 路径搜索 进行查找 |
| [in] | before_read | 可隐式转换为 ValueCallBackBeforeRead 函数指针类型的可调用对象 |
| [in] | after_write | 可隐式转换为 ValueCallBackAfterWrite 函数指针类型的可调用对象 |
| UA_NodeId rm::Server::addVariableTypeNode | ( | const VariableType & | vtype | ) |
添加变量类型节点 VariableTypeNode 至 BaseDataVariableType 中
| [in] | vtype | rm::VariableType 表示的变量 |
UA_NodeId | UA_NodeId rm::Server::addViewNode | ( | const View & | view | ) |
|
protected |
释放服务器资源
|
inline |
获取路径搜索必要信息
需要配合管道运算符 | 完成路径搜索
| [in] | browse_name | 浏览名 |
| fnis | [_client, browse_name] 元组 |
|
inline |
| Variable rm::Server::read | ( | const UA_NodeId & | node | ) |
| void rm::Server::setMethodNodeCallBack | ( | const UA_NodeId & | id, |
| UA_MethodCallback | on_method ) |
为既有的方法节点 MethodNode 设置方法的回调函数
| [in] | id | 既有的方法节点的 UA_NodeId,因方法节点可能位于任意一个父节点下,因此可以使用 路径搜索 进行查找 |
| [in] | on_method | 可隐式转换为 UA_MethodCallback 函数指针类型的可调用对象 |
| void rm::Server::start | ( | ) |
运行服务器,调用方线程不阻塞
|
inline |
停止服务器
| bool rm::Server::triggerEvent | ( | const UA_NodeId & | node_id, |
| const Event & | event ) |
创建并触发事件
| [in] | node_id | 触发事件的节点 UA_NodeId |
| [in] | event | rm::Event 表示的事件 |
Server 的 node_id 是 rm::nodeServer | bool rm::Server::write | ( | const UA_NodeId & | node, |
| const Variable & | val ) |
给指定的变量节点写数据
| [in] | node | 既存的变量节点的 UA_NodeId |
| [in] | val | 待写入的数据 |
|
protected |
服务器运行线程
|
protected |
服务器运行状态
|
protected |
OPC UA 服务器指针
1.11.0