23 #ifndef CANOPENCONTROLLER_HPP 24 #define CANOPENCONTROLLER_HPP 31 namespace canopen_schunk {
33 template <
typename GroupT>
41 #ifdef _IC_BUILDER_ICL_COMM_WEBSOCKET_ 43 #endif // _IC_BUILDER_ICL_COMM_WEBSOCKET_ 45 m_groups[sanitized_identifier] = group;
51 <<
" already exists. Not adding new group." <<
endl);
55 template <
typename GroupT>
62 group = boost::dynamic_pointer_cast<GroupT>(
m_groups[sanitized_index]);
71 ss <<
"No group with the given index " << sanitized_index
72 <<
" exists. Returning null pointer.";
79 template <
typename NodeT>
83 std::map<std::string, DS301Group::Ptr>::iterator group_it;
84 group_it =
m_groups.find(sanitized_identifier);
95 if (ds402_ptr = boost::dynamic_pointer_cast<DS402Group>(group_it->second))
104 #ifdef _IC_BUILDER_ICL_COMM_WEBSOCKET_ 106 #endif // _IC_BUILDER_ICL_COMM_WEBSOCKET_ 108 m_nodes.insert (std::pair<uint8_t, DS301Node::Ptr>(node_id, new_node));
113 <<
" exists. New node not added!" <<
endl);
119 <<
" already exists. Not adding new node." <<
endl);
123 template <
typename NodeT>
128 std::stringstream ss;
129 ss <<
"No node with the given id '" <<
static_cast<int>(node_id) <<
"' found.";
133 if (boost::dynamic_pointer_cast<NodeT>(
m_nodes[node_id]))
135 return boost::dynamic_pointer_cast<NodeT>(
m_nodes[node_id]);
139 throw std::bad_cast();
HeartBeatMonitor::Ptr m_heartbeat_monitor
std::map< uint8_t, DS301Node::Ptr > m_nodes
Map of all nodes with id identifier.
The CanOpenController class is the main entry point for any calls to the canOpen System.
std::map< std::string, DS301Group::Ptr > m_groups
Map of all node groups, with string identifier.
boost::shared_ptr< NodeT > getNode(const uint8_t node_id)
Returns a shared pointer handle to a node.
This exception is thrown if a requested node or node group does not exist.
ThreadStream & endl(ThreadStream &stream)
boost::shared_ptr< GroupT > getGroup(const std::string &index="default")
Returns a shared pointer to the group with a given index if possible.
boost::shared_ptr< icl_comm::websocket::WsBroadcaster > m_ws_broadcaster
Interface to send out diagnostics data. Only available if compiled with IC_BUILDER_ICL_COMM_WEBSOCKET...
CanDevPtr m_can_device
Handle for the can device.
std::string sanitizeString(const std::string &text)
This function removes all non-graphical characters from the given string.
void addNode(const uint8_t node_id, const std::string &group_name="default")
Adds a new node to a group. If the group is not found (e.g. it was not created before), nothing will be done.
void addGroup(const std::string &identifier)
Adds a new node group with a given identifier. The group's type is given as template parameter...
#define LOGGING_ERROR_C(streamname, classname, arg)