CanItf.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9 
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
18 #ifndef CANITF_INCLUDEDEF_H
19 #define CANITF_INCLUDEDEF_H
20 //-----------------------------------------------
21 #include <cob_generic_can/CanMsg.h>
22 //-----------------------------------------------
23 
24 // for types and baudrates see: https://github.com/ipa320/cob_robots/blob/hydro_dev/cob_hardware_config/raw3-5/config/base/CanCtrl.ini
25 #define CANITFTYPE_CAN_PEAK 0
26 #define CANITFTYPE_CAN_PEAK_USB 1
27 #define CANITFTYPE_CAN_ESD 2
28 #define CANITFTYPE_CAN_DUMMY 3
29 #define CANITFTYPE_CAN_BECKHOFF 4
30 #define CANITFTYPE_SOCKET_CAN 5
31 
32 #define CANITFBAUD_1M 0x0
33 #define CANITFBAUD_500K 0x2
34 #define CANITFBAUD_250K 0x4
35 #define CANITFBAUD_125K 0x6
36 #define CANITFBAUD_50K 0x9
37 #define CANITFBAUD_20K 0xB
38 #define CANITFBAUD_10K 0xD
39 
44 class CanItf
45 {
46 public:
47  enum CanItfType {
48  CAN_PEAK = 0,
50  CAN_ESD = 2,
51  CAN_DUMMY = 3,
54  };
55 
60  virtual ~CanItf() {
61  }
62 
66  virtual bool init_ret() = 0;
67 
71  virtual void init() = 0;
72 
78  virtual bool transmitMsg(CanMsg CMsg, bool bBlocking = true) = 0;
79 
84  virtual bool receiveMsg(CanMsg* pCMsg) = 0;
85 
93  virtual bool receiveMsgRetry(CanMsg* pCMsg, int iNrOfRetry) = 0;
94 
101  virtual bool receiveMsgTimeout(CanMsg* pCMsg, int nMicroSecTimeout) = 0;
102 
107  virtual bool isObjectMode() = 0;
108 
114  void setCanItfType(CanItfType iType) { m_iCanItfType = iType; }
115 
122 
123 private:
126 };
127 //-----------------------------------------------
128 
129 #endif
CanItfType getCanItfType()
Definition: CanItf.h:121
CanItfType
Definition: CanItf.h:47
CanItfType m_iCanItfType
The CAN interface type.
Definition: CanItf.h:125
void setCanItfType(CanItfType iType)
Definition: CanItf.h:114
Definition: CanMsg.h:28
Definition: CanItf.h:44
virtual void init()=0
virtual bool isObjectMode()=0
virtual bool receiveMsgTimeout(CanMsg *pCMsg, int nMicroSecTimeout)=0
virtual bool init_ret()=0
virtual bool receiveMsg(CanMsg *pCMsg)=0
virtual bool receiveMsgRetry(CanMsg *pCMsg, int iNrOfRetry)=0
virtual ~CanItf()
Definition: CanItf.h:60
virtual bool transmitMsg(CanMsg CMsg, bool bBlocking=true)=0


cob_generic_can
Author(s): Christian Connette
autogenerated on Wed Apr 7 2021 02:11:52