Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
canopen::Node Class Reference

#include <canopen.h>

Inheritance diagram for canopen::Node:
Inheritance graph
[legend]

Public Types

enum  State {
  Unknown = 255, BootUp = 0, Stopped = 4, Operational = 5,
  PreOperational = 127
}
 
typedef fastdelegate::FastDelegate1< const State & > StateDelegate
 
typedef can::Listener< const StateDelegate, const State & > StateListener
 
typedef StateListener::ListenerConstSharedPtr StateListenerConstSharedPtr
 
- Public Types inherited from canopen::Layer
enum  LayerState {
  Off, Init, Shutdown, Error,
  Halt, Recover, Ready
}
 

Public Member Functions

StateListenerConstSharedPtr addStateListener (const StateDelegate &s)
 
void enterState (const State &s)
 
template<typename T >
get (const ObjectDict::Key &k)
 
const State getState ()
 
const ObjectStorageSharedPtr getStorage ()
 
 Node (const can::CommInterfaceSharedPtr interface, const ObjectDictSharedPtr dict, uint8_t node_id, const SyncCounterSharedPtr sync=SyncCounterSharedPtr())
 
bool prepare ()
 
bool reset ()
 
bool reset_com ()
 
bool start ()
 
bool stop ()
 
- Public Member Functions inherited from canopen::Layer
void diag (LayerReport &report)
 
LayerState getLayerState ()
 
void halt (LayerStatus &status)
 
void init (LayerStatus &status)
 
 Layer (const std::string &n)
 
void read (LayerStatus &status)
 
void recover (LayerStatus &status)
 
void shutdown (LayerStatus &status)
 
void write (LayerStatus &status)
 
virtual ~Layer ()
 

Public Attributes

const uint8_t node_id_
 
- Public Attributes inherited from canopen::Layer
const std::string name
 

Private Member Functions

bool checkHeartbeat ()
 
uint16_t getHeartbeatInterval ()
 
virtual void handleDiag (LayerReport &report)
 
virtual void handleHalt (LayerStatus &status)
 
virtual void handleInit (LayerStatus &status)
 
void handleNMT (const can::Frame &msg)
 
virtual void handleRead (LayerStatus &status, const LayerState &current_state)
 
virtual void handleRecover (LayerStatus &status)
 
virtual void handleShutdown (LayerStatus &status)
 
virtual void handleWrite (LayerStatus &status, const LayerState &current_state)
 
void setHeartbeatInterval ()
 
void switchState (const uint8_t &s)
 
template<typename T >
int wait_for (const State &s, const T &timeout)
 

Private Attributes

boost::condition_variable cond
 
boost::mutex cond_mutex
 
ObjectStorage::Entry< ObjectStorage::DataType< ObjectDict::DEFTYPE_UNSIGNED16 >::type > heartbeat_
 
boost::chrono::high_resolution_clock::time_point heartbeat_timeout_
 
const can::CommInterfaceSharedPtr interface_
 
boost::timed_mutex mutex
 
can::FrameListenerConstSharedPtr nmt_listener_
 
PDOMapper pdo_
 
SDOClient sdo_
 
State state_
 
can::SimpleDispatcher< StateListenerstate_dispatcher_
 
const SyncCounterSharedPtr sync_
 

Additional Inherited Members

Detailed Description

Definition at line 184 of file canopen.h.

Member Typedef Documentation

Definition at line 203 of file canopen.h.

Definition at line 204 of file canopen.h.

Definition at line 205 of file canopen.h.

Member Enumeration Documentation

Enumerator
Unknown 
BootUp 
Stopped 
Operational 
PreOperational 

Definition at line 186 of file canopen.h.

Constructor & Destructor Documentation

Node::Node ( const can::CommInterfaceSharedPtr  interface,
const ObjectDictSharedPtr  dict,
uint8_t  node_id,
const SyncCounterSharedPtr  sync = SyncCounterSharedPtr() 
)

Definition at line 30 of file node.cpp.

Member Function Documentation

StateListenerConstSharedPtr canopen::Node::addStateListener ( const StateDelegate s)
inline

Definition at line 207 of file canopen.h.

bool Node::checkHeartbeat ( )
private

Definition at line 141 of file node.cpp.

void canopen::Node::enterState ( const State s)
template<typename T >
T canopen::Node::get ( const ObjectDict::Key k)
inline

Definition at line 211 of file canopen.h.

uint16_t canopen::Node::getHeartbeatInterval ( )
inlineprivate

Definition at line 247 of file canopen.h.

const Node::State Node::getState ( )

Definition at line 39 of file node.cpp.

const ObjectStorageSharedPtr canopen::Node::getStorage ( )
inline

Definition at line 195 of file canopen.h.

void Node::handleDiag ( LayerReport report)
privatevirtual

Implements canopen::Layer.

Definition at line 167 of file node.cpp.

void Node::handleHalt ( LayerStatus status)
privatevirtual

Implements canopen::Layer.

Definition at line 216 of file node.cpp.

void Node::handleInit ( LayerStatus status)
privatevirtual

Implements canopen::Layer.

Definition at line 176 of file node.cpp.

void Node::handleNMT ( const can::Frame msg)
private

Definition at line 115 of file node.cpp.

void Node::handleRead ( LayerStatus status,
const LayerState current_state 
)
privatevirtual

Implements canopen::Layer.

Definition at line 148 of file node.cpp.

void Node::handleRecover ( LayerStatus status)
privatevirtual

Implements canopen::Layer.

Definition at line 202 of file node.cpp.

void Node::handleShutdown ( LayerStatus status)
privatevirtual

Implements canopen::Layer.

Definition at line 210 of file node.cpp.

void Node::handleWrite ( LayerStatus status,
const LayerState current_state 
)
privatevirtual

Implements canopen::Layer.

Definition at line 159 of file node.cpp.

bool Node::prepare ( )

Definition at line 68 of file node.cpp.

bool Node::reset ( )

Definition at line 55 of file node.cpp.

bool Node::reset_com ( )

Definition at line 44 of file node.cpp.

void canopen::Node::setHeartbeatInterval ( )
inlineprivate

Definition at line 248 of file canopen.h.

bool Node::start ( )

Definition at line 76 of file node.cpp.

bool Node::stop ( )

Definition at line 84 of file node.cpp.

void Node::switchState ( const uint8_t &  s)
private

Definition at line 94 of file node.cpp.

template<typename T >
int Node::wait_for ( const State s,
const T &  timeout 
)
private

Definition at line 122 of file node.cpp.

Member Data Documentation

boost::condition_variable canopen::Node::cond
private

Definition at line 229 of file canopen.h.

boost::mutex canopen::Node::cond_mutex
private

Definition at line 228 of file canopen.h.

Definition at line 235 of file canopen.h.

boost::chrono::high_resolution_clock::time_point canopen::Node::heartbeat_timeout_
private

Definition at line 246 of file canopen.h.

const can::CommInterfaceSharedPtr canopen::Node::interface_
private

Definition at line 231 of file canopen.h.

boost::timed_mutex canopen::Node::mutex
private

Definition at line 227 of file canopen.h.

can::FrameListenerConstSharedPtr canopen::Node::nmt_listener_
private

Definition at line 233 of file canopen.h.

const uint8_t canopen::Node::node_id_

Definition at line 189 of file canopen.h.

PDOMapper canopen::Node::pdo_
private

Definition at line 244 of file canopen.h.

SDOClient canopen::Node::sdo_
private

Definition at line 243 of file canopen.h.

State canopen::Node::state_
private

Definition at line 242 of file canopen.h.

can::SimpleDispatcher<StateListener> canopen::Node::state_dispatcher_
private

Definition at line 237 of file canopen.h.

const SyncCounterSharedPtr canopen::Node::sync_
private

Definition at line 232 of file canopen.h.


The documentation for this class was generated from the following files:


canopen_master
Author(s): Mathias Lüdtke
autogenerated on Fri May 14 2021 02:59:41