rllib
1
|
main class which provides canopen API functions and manages all nodes. More...
#include <rlcanopen.h>
Public Member Functions | |
rlCanOpen () | |
rlCanOpen (char *_inifilename) | |
~rlCanOpen () | |
int | getBoardCount () |
returns the number of available boards More... | |
int | getActiveBoard () |
returns the number of currently active board More... | |
bool | showNodeConfiguration (int _boardnr, int _nodeid) |
prints out the configuration of a specific node More... | |
bool | showNodeConfiguration () |
prints out the configuration off all available nodes from all boards More... | |
int | sdo_read (int _boardnr, int _nodeid, int _objectindex, int _subindex, rlCanOpenTypes &_sdo_data) |
read a certain object from the object dictionary of a node More... | |
int | sdo_write (int _boardnr, int _nodeid, int _objectindex, int _subindex, rlCanOpenTypes &_sdo_data) |
write data into a certain object from the object dictionary of a node More... | |
int | pdo_receive (int _boardnr, int _nodeid, int _pdonr, int _mappingnr, rlCanOpenTypes &_pdo_data) |
using the pdo_receive function you can receive a mapped object within PDO More... | |
int | pdo_receive (int _boardnr, int _nodeid, int _pdonr, rlCanOpenTypes &_pdo_data) |
using the pdo_receive function you can receive a PDO (Process Data Object) More... | |
int | pdo_transmit (int _boardnr, int _nodeid, int _pdonr, int _mappingnr, rlCanOpenTypes &_pdo_data) |
transmit a mapped object within a PDO to a specific node More... | |
int | pdo_transmit (int _boardnr, int _nodeid, int _pdonr, rlCanOpenTypes &_pdo_data) |
transmit a 8 Byte PDO to a specific node More... | |
int | getNodeIndex (int _boardnr, int _nodeid, int &_index) |
this function returns the listindex of a desired node More... | |
int | getObjectType (int _boardnr, int _nodeid, int _objectindex, int _subindex) |
returns daemontype number of a specific object More... | |
int | getNodeState (int _boardnr, int _nodeid, rlCanOpenTypes &_data) |
use this function to get information about a specific node More... | |
int | restartBoard (int _boardnr, int _restarttype) |
using this function you are able to restart a CanOpenMaster board More... | |
int | sendNMTCommand (int _boardnr, int _nodeid, unsigned char _cmd) |
send a NMT Command to one or all nodes (of one board) More... | |
bool | is_twisted_type (int _canopentype) |
Private Member Functions | |
bool | getNodeConfiguration (int _nodeID) |
int | getPdoID (int _boardnr, int _nodeid, int _objektindex, int _direction) |
return PdoId of mapped object. More... | |
void | read_inifile (const char *_filename) |
read properties of inifile More... | |
bool | ini () |
initialize nodes and create nodelist More... | |
void | delmsg () |
clear message struct by setting all elements to zero More... | |
bool | iniboards () |
Read informations about installed devices. More... | |
short | setBoardActive (int _boardnr) |
sets a desired CanOpenMaster active, so that it can be used More... | |
int | refreshMappingList (int _boardnr, int _nodeid, int _pdoID, int _pdoDirection) |
int | createNodes () |
Search for nodes in all boards and append it into the nodelist. More... | |
int | createMappingObjects (int _boardid, int _nodeid, int _pdoDirection) |
this function writes the mapping objects for each pdo of a node More... | |
Private Attributes | |
int | activeboard |
the currently active board More... | |
char | err_out_buf [255] |
this string buffer is usually written with sprintf before sent to stdout More... | |
short | sRet |
return value for hilscher specific message functions More... | |
FILE * | err_fp |
Pointer to error logfile. More... | |
QString | logFileName |
name of logfile stdout is redirected to More... | |
RCS_MESSAGETELEGRAM_10 | message |
hilscher specific message structur which will be sent to the master card More... | |
QPtrVector< rlCanNode > | nodelist |
this list contains all nodes from all boards More... | |
int | boardcount |
the current count of CanOpenMaster cards More... | |
unsigned char | messagenr |
message counter More... | |
bool | enableLogging |
main class which provides canopen API functions and manages all nodes.
This class contains a canopen specific API which accesses the canopen bus through the bus-independ Hilscher device API. It reads the configuration which has to be written previously to the device by SyCon. Based on this configuration data it searches node corresponding EDS files to create object directories. These help to enshure type security and cast warnings when users try to write incorrect data types to can nodes.
Definition at line 55 of file rlcanopen.h.
rlCanOpen::rlCanOpen | ( | ) |
Definition at line 40 of file rlcanopen.cpp.
rlCanOpen::rlCanOpen | ( | char * | _inifilename | ) |
Definition at line 29 of file rlcanopen.cpp.
rlCanOpen::~rlCanOpen | ( | ) |
Definition at line 54 of file rlcanopen.cpp.
|
private |
this function writes the mapping objects for each pdo of a node
creates the mappings for each pdo
Definition at line 137 of file rlcanopen.cpp.
|
private |
Search for nodes in all boards and append it into the nodelist.
this function checks the bus for available nodes and creates a corresponding nodelist
Definition at line 103 of file rlcanopen.cpp.
|
private |
clear message struct by setting all elements to zero
this function resets all elements of global message struct to zero
Definition at line 859 of file rlcanopen.cpp.
int rlCanOpen::getActiveBoard | ( | ) |
returns the number of currently active board
returns the currently active board
Definition at line 296 of file rlcanopen.cpp.
int rlCanOpen::getBoardCount | ( | ) |
returns the number of available boards
returns the current count of available CanOpenMaster cards
Definition at line 211 of file rlcanopen.cpp.
|
private |
This function reads out the configuration of a specific node using special Hilscher commands (CMDCODE_GET_CONFIGURATION). If the master board isn't configurated by SyCon it is not possibly to use this function with success. It returns false if the node is not available
Device Number
Pointer to user buffer
Timeout
Definition at line 217 of file rlcanopen.cpp.
int rlCanOpen::getNodeIndex | ( | int | _boardnr, |
int | _nodeid, | ||
int & | _index | ||
) |
this function returns the listindex of a desired node
Because the nodes of all boards are stored in one list, the listindex is not equal to the nodeID(1-127). Use this function to get the listindex of a desired node
Definition at line 882 of file rlcanopen.cpp.
int rlCanOpen::getNodeState | ( | int | _boardnr, |
int | _nodeid, | ||
rlCanOpenTypes & | _data | ||
) |
use this function to get information about a specific node
Use this function to get information about a specific node. The nodestate, nodeerror and a nodestateFlag will be written to the rlCanOpenTypes. Read the rlCanOpenTypes.h header to get further information about these variables. Hilscher specific function (so no CanOpoen services) are used to receive the information
Definition at line 1045 of file rlcanopen.cpp.
int rlCanOpen::getObjectType | ( | int | _boardnr, |
int | _nodeid, | ||
int | _objectindex, | ||
int | _subindex | ||
) |
returns daemontype number of a specific object
returns daemontype number of an object. The type is retrieved from the node's objectdir. When no objectdir exists (e.g. because of a missing EDS file) or when the requested object does not exist, this function will return 0xFF (the corresponding value to rlCanOpenTypes::RL_NOTYPE)
Definition at line 897 of file rlcanopen.cpp.
|
private |
return PdoId of mapped object.
this function iterates through the recieve/tramsmit pdo lists and returns the ID number of the pdo that fits the given objektindex. The PdoId identifies the send/receive PDO on the given node
Definition at line 1015 of file rlcanopen.cpp.
|
private |
initialize nodes and create nodelist
Definition at line 71 of file rlcanopen.cpp.
|
private |
Read informations about installed devices.
Definition at line 154 of file rlcanopen.cpp.
bool rlCanOpen::is_twisted_type | ( | int | _canopentype | ) |
Definition at line 1226 of file rlcanopen.cpp.
int rlCanOpen::pdo_receive | ( | int | _boardnr, |
int | _nodeid, | ||
int | _pdonr, | ||
int | _mappingnr, | ||
rlCanOpenTypes & | _pdo_data | ||
) |
using the pdo_receive function you can receive a mapped object within PDO
using the pdo_receive function you can receive a PDO (Process Data Object), which is send from the specific node to the device. The enquired object will be written to the rlCanOpenTypes class. The mapping is only available if mapping is configurated during the node creation of the rlcanopen constructer. Therefore a eds file (electronic data sheet) is needed. Use the cannode::hasMapping() function to check if mapping is available. To read out the correct value from this class use one of the get_TYPE() {e.g. get_int() } functions you can assert the type in the class using rlCanOpenTypes::get_DaemonType();
Definition at line 544 of file rlcanopen.cpp.
int rlCanOpen::pdo_receive | ( | int | _boardnr, |
int | _nodeid, | ||
int | _pdonr, | ||
rlCanOpenTypes & | _pdo_data | ||
) |
using the pdo_receive function you can receive a PDO (Process Data Object)
using the pdo_receive function you can receive a PDO (Process Data Object), which is send from the specific node to the canOpen master card. The data will be written to the rlCanOpenTypes class. This function doesn't use mapping. So the whole 8Byte PDO data, will be received. To read out use the rlCanOpenTypes::get_buffer({0-7}) function
Definition at line 637 of file rlcanopen.cpp.
int rlCanOpen::pdo_transmit | ( | int | _boardnr, |
int | _nodeid, | ||
int | _pdonr, | ||
int | _mappingnr, | ||
rlCanOpenTypes & | _pdo_data | ||
) |
transmit a mapped object within a PDO to a specific node
Using the pdo_transmit function you can transmit a PDO (Process Data Object) to a specific node. The desired data must be written to the rlCanOpenTypes class. The mapping is only available if mapping is configurated during the node creation of the rlcanopen constructer. Therefore an eds file (electronic data sheet) is needed. Use the cannode::hasMapping() function to check if mapping is available
Definition at line 703 of file rlcanopen.cpp.
int rlCanOpen::pdo_transmit | ( | int | _boardnr, |
int | _nodeid, | ||
int | _pdonr, | ||
rlCanOpenTypes & | _pdo_data | ||
) |
transmit a 8 Byte PDO to a specific node
Using the pdo_transmit function you can transmit a PDO (Process Data Object) to a specific node. The desired data must be written to the rlCanOpenTypes class. This function does not support mapping. So the whole 8byte PDO data, will be send to write to the rlCanOpenTypes use the rlCanOpenTypes::set_buffer({0-7}) function
Definition at line 806 of file rlcanopen.cpp.
|
private |
read properties of inifile
read properties of inifile. EDS path, logfile location and user-specific options are set on startup
Definition at line 1189 of file rlcanopen.cpp.
|
private |
if the user changes the mapping of a node using SDO functions, the internal mapping list should be changed
Definition at line 917 of file rlcanopen.cpp.
int rlCanOpen::restartBoard | ( | int | _boardnr, |
int | _restarttype | ||
) |
using this function you are able to restart a CanOpenMaster board
Using this function you are able to restart a CanOpenMaster board (device). There are 3 possibly kinds of restarting the master: coldstart, warmstart, bootstart. The corresponding '#defines' are declared in canopenstructs.h Hilscher specific function (so no CanOpoen services) are used to execute this command
Definition at line 1114 of file rlcanopen.cpp.
int rlCanOpen::sdo_read | ( | int | _boardnr, |
int | _nodeid, | ||
int | _objectindex, | ||
int | _subindex, | ||
rlCanOpenTypes & | _sdo_data | ||
) |
read a certain object from the object dictionary of a node
using the sdo_read function you can read a certain object from the object dictionary of a node. For this the SDO (Service Data Object) service will be used. The enquired object will be written to the rlCanOpenTypes class. To read out the correct value from this class use one of the get_TYPE() {e.g. get_int() } functions. You can assert the type in the class using rlCanOpenTypes::get_DaemonType(); if sdo_read failures the current error can be read out using rlCanOpenTypes::get_rlmsgerr()
Definition at line 332 of file rlcanopen.cpp.
int rlCanOpen::sdo_write | ( | int | _boardnr, |
int | _nodeid, | ||
int | _objectindex, | ||
int | _subindex, | ||
rlCanOpenTypes & | _sdo_data | ||
) |
write data into a certain object from the object dictionary of a node
using the sdo_write function you can write to a certain object from the object dictionary of a node. For this the SDO (Service Data Object) Service will be used. The relevant data must be written into the rlCanOpenTypes class before. To write the data into the rlCanOpenTypes class use one of the datatype depending functions like rlCanOpenTypes::set_int(int _value); if sdo_write failures the current error can be read out using rlCanOpenTypes::get_rlmsgerr()
Definition at line 431 of file rlcanopen.cpp.
int rlCanOpen::sendNMTCommand | ( | int | _boardnr, |
int | _nodeid, | ||
unsigned char | _cmd | ||
) |
send a NMT Command to one or all nodes (of one board)
Using this function you can send a NMT Command to one or all nodes (of one board). NMT (Network Management) is a CanOpen service. Because of the device there are constrictions for the user. You can only execute the follow NMT commands: START_REMOTE_NODE, STOP_REMOTE_NODE, ENTER_PREOPERATIONAL, RESET_NODE, RESET_COMMUNICATION The corresponding '#defines' are declared in canopenstructs.h
Definition at line 1132 of file rlcanopen.cpp.
|
private |
sets a desired CanOpenMaster active, so that it can be used
Definition at line 285 of file rlcanopen.cpp.
bool rlCanOpen::showNodeConfiguration | ( | int | _boardnr, |
int | _nodeid | ||
) |
prints out the configuration of a specific node
Definition at line 303 of file rlcanopen.cpp.
bool rlCanOpen::showNodeConfiguration | ( | ) |
prints out the configuration off all available nodes from all boards
Definition at line 320 of file rlcanopen.cpp.
|
private |
the currently active board
Definition at line 219 of file rlcanopen.h.
|
private |
the current count of CanOpenMaster cards
Definition at line 253 of file rlcanopen.h.
|
private |
this indicator is true when stdout is redirected to file. it is set in the ini-file
Definition at line 281 of file rlcanopen.h.
|
private |
Pointer to error logfile.
Definition at line 241 of file rlcanopen.h.
|
private |
this string buffer is usually written with sprintf before sent to stdout
Definition at line 235 of file rlcanopen.h.
|
private |
name of logfile stdout is redirected to
Definition at line 244 of file rlcanopen.h.
|
private |
hilscher specific message structur which will be sent to the master card
Definition at line 247 of file rlcanopen.h.
|
private |
message counter
Definition at line 256 of file rlcanopen.h.
|
private |
this list contains all nodes from all boards
Definition at line 250 of file rlcanopen.h.
|
private |
return value for hilscher specific message functions
Definition at line 238 of file rlcanopen.h.