rllib  1
rlcanopen.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                           rlcanopen.cpp  -  description
00003                              -------------------
00004     begin     : Tue March 03 2004
00005     copyright : (C) 2004 by Marc Br�tigam, Christian Wilmes, Rainer Lehrig
00006     email     : lehrig@t-online.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This library is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as        *
00013  *   published by the Free Software Foundation                             *
00014  *                                                                         *
00015  ***************************************************************************/
00016 
00032 #ifndef NODES
00033 #define NODES
00034 
00035 #define err00 "no error, command executed"
00036 #define err03 "DESCRIPT table not found. DEVICE is not configured by SyCon"
00037 #define err57 "sequence error. Check requested DeviceAdr of continued message"
00038 #define err58 "no entry found for requested DeviceAdr of request message."
00039 #define err100 "Communication ERROR!!!"
00040 
00041 #include "rlwthread.h"
00042 #include "rlcannode.h"
00043 #include <qvaluevector.h>
00044 #include <qptrvector.h>
00045 
00046         
00048 
00055 class rlCanOpen 
00056 {
00057   public:
00058   rlCanOpen();
00059   rlCanOpen(char* _inifilename);
00060   ~rlCanOpen();
00061   
00063   int getBoardCount();
00064   
00066   int getActiveBoard();
00067   
00069   bool showNodeConfiguration(int _boardnr,int _nodeid);
00070   
00072   bool showNodeConfiguration();  // show all nodes
00073   
00082   int sdo_read ( int _boardnr, 
00083                  int _nodeid,
00084                  int _objectindex, 
00085                  int _subindex, 
00086                  rlCanOpenTypes &_sdo_data);
00087   
00096   int sdo_write ( int _boardnr, 
00097                   int _nodeid,
00098                   int _objectindex, 
00099                   int _subindex, 
00100                   rlCanOpenTypes &_sdo_data); 
00101   
00111   int pdo_receive( int _boardnr, 
00112                    int _nodeid,
00113                    int _pdonr, 
00114                    int _mappingnr, 
00115                    rlCanOpenTypes &_pdo_data);
00116   
00117   
00123   int pdo_receive( int _boardnr, 
00124                    int _nodeid,
00125                    int _pdonr, 
00126                    rlCanOpenTypes &_pdo_data);
00127   
00128   
00129   
00136   int pdo_transmit( int _boardnr, 
00137                     int _nodeid,
00138                     int _pdonr, 
00139                     int _mappingnr, 
00140                     rlCanOpenTypes &_pdo_data);
00141   
00147   int pdo_transmit( int _boardnr, 
00148                     int _nodeid,
00149                     int _pdonr, 
00150                     rlCanOpenTypes &_pdo_data);
00151   
00155   int getNodeIndex( int _boardnr,
00156                     int _nodeid,
00157                     int & _index); 
00158   
00164   int getObjectType( int _boardnr, 
00165                      int _nodeid, 
00166                      int _objectindex, 
00167                      int _subindex);
00168   
00174   int getNodeState( int _boardnr, 
00175                     int _nodeid,
00176                     rlCanOpenTypes &_data);
00177   
00184   int restartBoard( int _boardnr, int _restarttype);
00185   
00196   int sendNMTCommand( int _boardnr, 
00197                       int _nodeid, 
00198                       unsigned char _cmd);
00199                       
00200                       
00201                       
00202   bool is_twisted_type(int _canopentype);
00203 
00204   
00205   private:
00206   
00211   bool getNodeConfiguration(int _nodeID); 
00212   
00216   int getPdoID(int _boardnr, int _nodeid, int _objektindex, int _direction);
00217   
00219   int activeboard;
00220   
00223   void read_inifile(const char* _filename);
00224   
00226   bool ini();
00227   
00229   void delmsg();
00230   
00232   bool iniboards();
00233   
00235   char err_out_buf[255];
00236   
00238   short sRet;
00239   
00241   FILE* err_fp; 
00242   
00244   QString logFileName;
00245   
00247   RCS_MESSAGETELEGRAM_10 message; 
00248   
00250   QPtrVector <rlCanNode> nodelist;
00251   
00253   int boardcount;
00254   
00256   unsigned char messagenr;
00257   
00259   short setBoardActive(int _boardnr);
00260   
00263   int refreshMappingList( int _boardnr, 
00264                           int _nodeid,
00265                           int _pdoID,
00266                           int _pdoDirection);
00267   
00270   int createNodes();
00271   
00273   int createMappingObjects( int _boardid,
00274                             int _nodeid,
00275                             int _pdoDirection);
00276                            
00277  
00278   
00281   bool enableLogging;
00282   
00283 };
00284                         
00285 #endif