CanItf.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *   http://www.apache.org/licenses/LICENSE-2.0
00009 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 
00018 #ifndef CANITF_INCLUDEDEF_H
00019 #define CANITF_INCLUDEDEF_H
00020 //-----------------------------------------------
00021 #include <cob_generic_can/CanMsg.h>
00022 //-----------------------------------------------
00023 
00024 // for types and baudrates see: https://github.com/ipa320/cob_robots/blob/hydro_dev/cob_hardware_config/raw3-5/config/base/CanCtrl.ini
00025 #define CANITFTYPE_CAN_PEAK     0
00026 #define CANITFTYPE_CAN_PEAK_USB 1
00027 #define CANITFTYPE_CAN_ESD      2
00028 #define CANITFTYPE_CAN_DUMMY    3
00029 #define CANITFTYPE_CAN_BECKHOFF 4
00030 #define CANITFTYPE_SOCKET_CAN 5
00031 
00032 #define CANITFBAUD_1M   0x0
00033 #define CANITFBAUD_500K 0x2
00034 #define CANITFBAUD_250K 0x4
00035 #define CANITFBAUD_125K 0x6
00036 #define CANITFBAUD_50K  0x9
00037 #define CANITFBAUD_20K  0xB
00038 #define CANITFBAUD_10K  0xD
00039 
00044 class CanItf
00045 {
00046 public:
00047         enum CanItfType {
00048                 CAN_PEAK = 0,
00049                 CAN_PEAK_USB = 1,
00050                 CAN_ESD = 2,
00051                 CAN_DUMMY = 3,
00052                 CAN_BECKHOFF = 4,
00053                 CAN_SOCKETCAN = 5
00054         };
00055 
00060         virtual ~CanItf() {
00061         }
00062 
00066         virtual bool init_ret() = 0;
00067 
00071         virtual void init() = 0;
00072 
00078         virtual bool transmitMsg(CanMsg CMsg, bool bBlocking = true) = 0;
00079 
00084         virtual bool receiveMsg(CanMsg* pCMsg) = 0;
00085 
00093         virtual bool receiveMsgRetry(CanMsg* pCMsg, int iNrOfRetry) = 0;
00094 
00101         virtual bool receiveMsgTimeout(CanMsg* pCMsg, int nMicroSecTimeout) = 0;
00102 
00107         virtual bool isObjectMode() = 0;
00108 
00114         void setCanItfType(CanItfType iType) { m_iCanItfType = iType; }
00115 
00121         CanItfType getCanItfType() { return m_iCanItfType; }
00122 
00123 private:
00125         CanItfType m_iCanItfType;
00126 };
00127 //-----------------------------------------------
00128 
00129 #endif


cob_generic_can
Author(s): Christian Connette
autogenerated on Sat Jun 8 2019 21:02:26