library for C++ CANOpen implementation. mbed independant, but is easy to attach into with mbed.

Dependents:   ppCANOpen_Example DISCO-F746NG_rtos_test

Embed: (wiki syntax)

« Back to documentation index

Node Class Reference

Node Class to implement feature of a CANOpen NMT node. More...

#include <Node.h>

Data Structures

struct  State
 Node network management state. More...

Public Member Functions

 Node (int id, ServiceProvider *provider, int bLoop=0)
 Maintain the multitude of states for a node.
void FixedUpdate (uint32_t time)
 Call from ServiceProvider on an interrupt.
void Update (void)
 Call from ServiceProvider every loop of Run()
int DispatchMessage (CanOpenMessage *canOpenMsg)
 Handle message given by the ServiceProvider.

Data Fields

int nodeId
 Network id for the node.
int bLoopbackOn
 Loopback Mode.

Protected Member Functions

virtual void OnFixedUpdate (void)=0
 Perform actions every cycle (when in operational mode)
virtual void OnSync (uint8_t counter)=0
 Perform actions when state changed to stop.
virtual void OnInitialize (void)=0
 Perform actions when node reset.
virtual void OnPreoperational (void)=0
 Perform actions when state changed to pre-operational.
virtual void OnOperational (void)=0
 Perform actions when state changed to operational.
virtual void OnStopped (void)=0
 Perform actions when state changed to stop.
virtual ObjectDataScanIndex (IndexSize index)=0
 Abstract method to give access to the object entries of derived classes.

Protected Attributes

ObjectDatadictionary
 Array of ObjectData to contain all of the object dictionary data.
uint32_t timeCurrentTick
 Millisecond time stamp at this OnTick()
uint32_t timeSinceLastTick
 Millisecond difference between current OnTick() and the previous.
ServiceProviderpMyProvider
 Reference to Service Provider that this node is attached to.

Detailed Description

Node Class to implement feature of a CANOpen NMT node.

Definition at line 56 of file Node.h.


Constructor & Destructor Documentation

Node ( int  id,
ServiceProvider provider,
int  bLoop = 0 
)

Maintain the multitude of states for a node.

Definition at line 40 of file Node.cpp.


Member Function Documentation

int DispatchMessage ( CanOpenMessage canOpenMsg )

Handle message given by the ServiceProvider.

Definition at line 57 of file Node.cpp.

void FixedUpdate ( uint32_t  time )

Call from ServiceProvider on an interrupt.

Definition at line 415 of file Node.cpp.

virtual void OnFixedUpdate ( void   ) [protected, pure virtual]

Perform actions every cycle (when in operational mode)

Note:
Override to implement user application
The OnTick function should avoid modifying data in the object dictionary unless necessary, because there will almost certainly be a race condition.
virtual void OnInitialize ( void   ) [protected, pure virtual]

Perform actions when node reset.

Note:
Override to implement user application
virtual void OnOperational ( void   ) [protected, pure virtual]

Perform actions when state changed to operational.

Note:
Override to implement user application
virtual void OnPreoperational ( void   ) [protected, pure virtual]

Perform actions when state changed to pre-operational.

Note:
Override to implement user application
virtual void OnStopped ( void   ) [protected, pure virtual]

Perform actions when state changed to stop.

Note:
Override to implement user application
virtual void OnSync ( uint8_t  counter ) [protected, pure virtual]

Perform actions when state changed to stop.

Note:
Override to implement user application
virtual ObjectData* ScanIndex ( IndexSize  index ) [protected, pure virtual]

Abstract method to give access to the object entries of derived classes.

void Update ( void   )

Call from ServiceProvider every loop of Run()

Definition at line 426 of file Node.cpp.


Field Documentation

Loopback Mode.

Default off (0), if on (1) then will hear it's own messages

Definition at line 125 of file Node.h.

ObjectData* dictionary [protected]

Array of ObjectData to contain all of the object dictionary data.

Definition at line 242 of file Node.h.

int nodeId

Network id for the node.

Note:
Ref is held in object dictionary and upon setting, may need to update some other objects.

Definition at line 120 of file Node.h.

Reference to Service Provider that this node is attached to.

Definition at line 263 of file Node.h.

uint32_t timeCurrentTick [protected]

Millisecond time stamp at this OnTick()

Definition at line 246 of file Node.h.

uint32_t timeSinceLastTick [protected]

Millisecond difference between current OnTick() and the previous.

Definition at line 249 of file Node.h.