rllib  1
rlcanopen.h
Go to the documentation of this file.
1 /***************************************************************************
2  rlcanopen.cpp - description
3  -------------------
4  begin : Tue March 03 2004
5  copyright : (C) 2004 by Marc Br�tigam, Christian Wilmes, R. Lehrig
6  email : lehrig@t-online.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This library is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as *
13  * published by the Free Software Foundation *
14  * *
15  ***************************************************************************/
16 
32 #ifndef NODES
33 #define NODES
34 
35 #define err00 "no error, command executed"
36 #define err03 "DESCRIPT table not found. DEVICE is not configured by SyCon"
37 #define err57 "sequence error. Check requested DeviceAdr of continued message"
38 #define err58 "no entry found for requested DeviceAdr of request message."
39 #define err100 "Communication ERROR!!!"
40 
41 #include "rlwthread.h"
42 #include "rlcannode.h"
43 #include <qvaluevector.h>
44 #include <qptrvector.h>
45 
46 
48 
55 class rlCanOpen
56 {
57  public:
58  rlCanOpen();
59  rlCanOpen(char* _inifilename);
60  ~rlCanOpen();
61 
63  int getBoardCount();
64 
66  int getActiveBoard();
67 
69  bool showNodeConfiguration(int _boardnr,int _nodeid);
70 
72  bool showNodeConfiguration(); // show all nodes
73 
82  int sdo_read ( int _boardnr,
83  int _nodeid,
84  int _objectindex,
85  int _subindex,
86  rlCanOpenTypes &_sdo_data);
87 
96  int sdo_write ( int _boardnr,
97  int _nodeid,
98  int _objectindex,
99  int _subindex,
100  rlCanOpenTypes &_sdo_data);
101 
111  int pdo_receive( int _boardnr,
112  int _nodeid,
113  int _pdonr,
114  int _mappingnr,
115  rlCanOpenTypes &_pdo_data);
116 
117 
123  int pdo_receive( int _boardnr,
124  int _nodeid,
125  int _pdonr,
126  rlCanOpenTypes &_pdo_data);
127 
128 
129 
136  int pdo_transmit( int _boardnr,
137  int _nodeid,
138  int _pdonr,
139  int _mappingnr,
140  rlCanOpenTypes &_pdo_data);
141 
147  int pdo_transmit( int _boardnr,
148  int _nodeid,
149  int _pdonr,
150  rlCanOpenTypes &_pdo_data);
151 
155  int getNodeIndex( int _boardnr,
156  int _nodeid,
157  int & _index);
158 
164  int getObjectType( int _boardnr,
165  int _nodeid,
166  int _objectindex,
167  int _subindex);
168 
174  int getNodeState( int _boardnr,
175  int _nodeid,
176  rlCanOpenTypes &_data);
177 
184  int restartBoard( int _boardnr, int _restarttype);
185 
196  int sendNMTCommand( int _boardnr,
197  int _nodeid,
198  unsigned char _cmd);
199 
200 
201 
202  bool is_twisted_type(int _canopentype);
203 
204 
205  private:
206 
211  bool getNodeConfiguration(int _nodeID);
212 
216  int getPdoID(int _boardnr, int _nodeid, int _objektindex, int _direction);
217 
220 
223  void read_inifile(const char* _filename);
224 
226  bool ini();
227 
229  void delmsg();
230 
232  bool iniboards();
233 
235  char err_out_buf[255];
236 
238  short sRet;
239 
241  FILE* err_fp;
242 
244  QString logFileName;
245 
247  RCS_MESSAGETELEGRAM_10 message;
248 
250  QPtrVector <rlCanNode> nodelist;
251 
254 
256  unsigned char messagenr;
257 
259  short setBoardActive(int _boardnr);
260 
263  int refreshMappingList( int _boardnr,
264  int _nodeid,
265  int _pdoID,
266  int _pdoDirection);
267 
270  int createNodes();
271 
273  int createMappingObjects( int _boardid,
274  int _nodeid,
275  int _pdoDirection);
276 
277 
278 
282 
283 };
284 
285 #endif
int activeboard
the currently active board
Definition: rlcanopen.h:219
main class which provides canopen API functions and manages all nodes.
Definition: rlcanopen.h:55
int getActiveBoard()
returns the number of currently active board
Definition: rlcanopen.cpp:296
void delmsg()
clear message struct by setting all elements to zero
Definition: rlcanopen.cpp:859
int getBoardCount()
returns the number of available boards
Definition: rlcanopen.cpp:211
int boardcount
the current count of CanOpenMaster cards
Definition: rlcanopen.h:253
short setBoardActive(int _boardnr)
sets a desired CanOpenMaster active, so that it can be used
Definition: rlcanopen.cpp:285
QString logFileName
name of logfile stdout is redirected to
Definition: rlcanopen.h:244
class to handle CANopen types
int refreshMappingList(int _boardnr, int _nodeid, int _pdoID, int _pdoDirection)
Definition: rlcanopen.cpp:917
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
Definition: rlcanopen.cpp:332
bool ini()
initialize nodes and create nodelist
Definition: rlcanopen.cpp:71
void read_inifile(const char *_filename)
read properties of inifile
Definition: rlcanopen.cpp:1189
int getNodeIndex(int _boardnr, int _nodeid, int &_index)
this function returns the listindex of a desired node
Definition: rlcanopen.cpp:882
int sendNMTCommand(int _boardnr, int _nodeid, unsigned char _cmd)
send a NMT Command to one or all nodes (of one board)
Definition: rlcanopen.cpp:1132
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
Definition: rlcanopen.cpp:703
int restartBoard(int _boardnr, int _restarttype)
using this function you are able to restart a CanOpenMaster board
Definition: rlcanopen.cpp:1114
bool showNodeConfiguration()
prints out the configuration off all available nodes from all boards
Definition: rlcanopen.cpp:320
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
Definition: rlcanopen.cpp:544
char err_out_buf[255]
this string buffer is usually written with sprintf before sent to stdout
Definition: rlcanopen.h:235
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
Definition: rlcanopen.cpp:431
int getObjectType(int _boardnr, int _nodeid, int _objectindex, int _subindex)
returns daemontype number of a specific object
Definition: rlcanopen.cpp:897
int getPdoID(int _boardnr, int _nodeid, int _objektindex, int _direction)
return PdoId of mapped object.
Definition: rlcanopen.cpp:1015
bool enableLogging
Definition: rlcanopen.h:281
int createMappingObjects(int _boardid, int _nodeid, int _pdoDirection)
this function writes the mapping objects for each pdo of a node
Definition: rlcanopen.cpp:137
QPtrVector< rlCanNode > nodelist
this list contains all nodes from all boards
Definition: rlcanopen.h:250
bool is_twisted_type(int _canopentype)
Definition: rlcanopen.cpp:1226
unsigned char messagenr
message counter
Definition: rlcanopen.h:256
bool iniboards()
Read informations about installed devices.
Definition: rlcanopen.cpp:154
FILE * err_fp
Pointer to error logfile.
Definition: rlcanopen.h:241
int createNodes()
Search for nodes in all boards and append it into the nodelist.
Definition: rlcanopen.cpp:103
short sRet
return value for hilscher specific message functions
Definition: rlcanopen.h:238
int getNodeState(int _boardnr, int _nodeid, rlCanOpenTypes &_data)
use this function to get information about a specific node
Definition: rlcanopen.cpp:1045
bool getNodeConfiguration(int _nodeID)
Definition: rlcanopen.cpp:217
RCS_MESSAGETELEGRAM_10 message
hilscher specific message structur which will be sent to the master card
Definition: rlcanopen.h:247