rllib
1
|
Class performs API rlcanopen functions remotely through tcp sockets. More...
#include <rlcanopenclient.h>
Public Types | |
enum | rl_msg { MSG_SEND = 0, MSG_RECEIVE = 1, MSG_SDO_READ = 0, MSG_SDO_WRITE = 1, MSG_PDO_RECEIVE = 3, MSG_CONNECT = 5, MSG_DISCONNECT = 6, MSG_PDO_TRANSMIT = 4, MSG_NMT_TRANSMIT = 7, MSG_RESTART_BOARD = 8, MSG_GET_NODE_STATE = 9 } |
Public Member Functions | |
rlCanOpenClient () | |
initializes the client on localhost port 5000 More... | |
rlCanOpenClient (int _port, char *_remoteadress) | |
initializes the client on given port and remove server adress More... | |
~rlCanOpenClient () | |
destructor disconnects client More... | |
int | connect () |
opens a new connection to a running rlCanOpenDaemon More... | |
int | disconnect () |
disconnects from daemon More... | |
int | sdo_read (int _boardnr, int _nodeid, int _objectindex, int _subindex, rlCanOpenTypes &_sdo_data) |
remotely reads 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) |
remotely writes 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) |
receives single mapped pdo object from daemon. More... | |
int | pdo_receive (int _boardnr, int _nodeid, int _pdonr, rlCanOpenTypes &_pdo_data) |
receives an 8 byte pdo from daemon. More... | |
int | pdo_transmit (int _boardnr, int _nodeid, int _pdonr, int _mappingnr, rlCanOpenTypes &_pdo_data) |
sends a single mapped pdo object to daemon. More... | |
int | pdo_transmit (int _boardnr, int _nodeid, int _pdonr, rlCanOpenTypes &_pdo_data) |
sends an 8 byte pdo to daemon. More... | |
int | sendNMTCommand (int _boardnr, int _nodeid, unsigned char _cmd, bool &returnstate) |
sends a NMT command to daemon. More... | |
int | restartBoard (int _boardnr, int _restarttype, bool &returnstate) |
forces daemon to restart canopen device. More... | |
int | getNodeState (int _boardnr, int _nodeid, rlCanOpenTypes &_data) |
receives node state data of particular node from daemon. More... | |
void | setPort (int _port) |
setter for private port variable More... | |
void | setAdr (char *_adr) |
setter for private remoteadress variable More... | |
Private Attributes | |
int | pid |
variable contains process id More... | |
bool | connected |
flag indicates connection status More... | |
int | port |
variable contains port More... | |
char | remoteadress [40] |
string of remoteadress More... | |
rlSocket * | socket |
pointer to socket object More... | |
int | client_timeout |
timeout in ms More... | |
Class performs API rlcanopen functions remotely through tcp sockets.
this class provides the client API funcions which should be similar to the rlcanopen API. Main difference is that underlying code does not communicate with the canopen device itself but with a rlcanopendaemon, which should run in backbround or on an remote computer.
Definition at line 34 of file rlcanopenclient.h.
Enumerator | |
---|---|
MSG_SEND | |
MSG_RECEIVE | |
MSG_SDO_READ | |
MSG_SDO_WRITE | |
MSG_PDO_RECEIVE | |
MSG_CONNECT | |
MSG_DISCONNECT | |
MSG_PDO_TRANSMIT | |
MSG_NMT_TRANSMIT | |
MSG_RESTART_BOARD | |
MSG_GET_NODE_STATE |
Definition at line 38 of file rlcanopenclient.h.
rlCanOpenClient::rlCanOpenClient | ( | ) |
initializes the client on localhost port 5000
initializes the client on port 5000
Definition at line 96 of file rlcanopenclient.cpp.
rlCanOpenClient::rlCanOpenClient | ( | int | _port, |
char * | _remoteadress | ||
) |
initializes the client on given port and remove server adress
Definition at line 108 of file rlcanopenclient.cpp.
rlCanOpenClient::~rlCanOpenClient | ( | ) |
destructor disconnects client
Definition at line 120 of file rlcanopenclient.cpp.
int rlCanOpenClient::connect | ( | ) |
opens a new connection to a running rlCanOpenDaemon
Definition at line 132 of file rlcanopenclient.cpp.
int rlCanOpenClient::disconnect | ( | ) |
disconnects from daemon
Definition at line 151 of file rlcanopenclient.cpp.
int rlCanOpenClient::getNodeState | ( | int | _boardnr, |
int | _nodeid, | ||
rlCanOpenTypes & | _data | ||
) |
receives node state data of particular node from daemon.
receives node state data of particular node from daemon.
Definition at line 418 of file rlcanopenclient.cpp.
int rlCanOpenClient::pdo_receive | ( | int | _boardnr, |
int | _nodeid, | ||
int | _pdonr, | ||
int | _mappingnr, | ||
rlCanOpenTypes & | _pdo_data | ||
) |
receives single mapped pdo object from daemon.
receives single mapped pdo object from daemon. Function will return NULL if connection to daemon broke down. CanOpen interface related errors are accessable in _sdo_data.get_rlmsgerr()
Definition at line 242 of file rlcanopenclient.cpp.
int rlCanOpenClient::pdo_receive | ( | int | _boardnr, |
int | _nodeid, | ||
int | _pdonr, | ||
rlCanOpenTypes & | _pdo_data | ||
) |
receives an 8 byte pdo from daemon.
receives an 8 byte pdo from daemon.
Function will return NULL if connection to daemon broke down. CanOpen interface related errors are accessable in _sdo_data.get_rlmsgerr()
Definition at line 281 of file rlcanopenclient.cpp.
int rlCanOpenClient::pdo_transmit | ( | int | _boardnr, |
int | _nodeid, | ||
int | _pdonr, | ||
int | _mappingnr, | ||
rlCanOpenTypes & | _pdo_data | ||
) |
sends a single mapped pdo object to daemon.
sends a single mapped pdo object to daemon.
Function will return NULL if connection to daemon broke down. CanOpen interface related errors are accessable in _pdo_data.get_rlmsgerr()
Definition at line 292 of file rlcanopenclient.cpp.
int rlCanOpenClient::pdo_transmit | ( | int | _boardnr, |
int | _nodeid, | ||
int | _pdonr, | ||
rlCanOpenTypes & | _pdo_data | ||
) |
sends an 8 byte pdo to daemon.
sends an 8 byte pdo to daemon.
Function will return NULL if connection to daemon broke down. CanOpen interface related errors are accessable in _pdo_data.get_rlmsgerr()
Definition at line 333 of file rlcanopenclient.cpp.
int rlCanOpenClient::restartBoard | ( | int | _boardnr, |
int | _restarttype, | ||
bool & | returnstate | ||
) |
forces daemon to restart canopen device.
forces daemon to restart canopen device.
Definition at line 381 of file rlcanopenclient.cpp.
int rlCanOpenClient::sdo_read | ( | int | _boardnr, |
int | _nodeid, | ||
int | _objectindex, | ||
int | _subindex, | ||
rlCanOpenTypes & | _sdo_data | ||
) |
remotely reads 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. Function will return NULL if connection to daemon broke down. CanOpen interface related errors are accessable in _sdo_data.get_rlmsgerr()
Definition at line 163 of file rlcanopenclient.cpp.
int rlCanOpenClient::sdo_write | ( | int | _boardnr, |
int | _nodeid, | ||
int | _objectindex, | ||
int | _subindex, | ||
rlCanOpenTypes & | _sdo_data | ||
) |
remotely writes 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 Function will return NULL if connection to daemon broke down. CanOpen interface related errors are accessable in _sdo_data.get_rlmsgerr()
Definition at line 201 of file rlcanopenclient.cpp.
int rlCanOpenClient::sendNMTCommand | ( | int | _boardnr, |
int | _nodeid, | ||
unsigned char | _cmd, | ||
bool & | returnstate | ||
) |
sends a NMT command to daemon.
sends a NMT command to daemon.
Definition at line 342 of file rlcanopenclient.cpp.
void rlCanOpenClient::setAdr | ( | char * | _adr | ) |
setter for private remoteadress variable
Definition at line 458 of file rlcanopenclient.cpp.
void rlCanOpenClient::setPort | ( | int | _port | ) |
|
private |
timeout in ms
Definition at line 153 of file rlcanopenclient.h.
|
private |
flag indicates connection status
Definition at line 142 of file rlcanopenclient.h.
|
private |
variable contains process id
Definition at line 139 of file rlcanopenclient.h.
|
private |
variable contains port
Definition at line 145 of file rlcanopenclient.h.
|
private |
string of remoteadress
Definition at line 148 of file rlcanopenclient.h.
|
private |
pointer to socket object
Definition at line 151 of file rlcanopenclient.h.