SocketCan.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 SOCKETCAN_INCLUDEDEF_H
00019 #define SOCKETCAN_INCLUDEDEF_H
00020 //-----------------------------------------------
00021 #include <boost/shared_ptr.hpp>
00022 
00023 #include <cob_generic_can/CanItf.h>
00024 #include <socketcan_interface/socketcan.h>
00025 #include <socketcan_interface/threading.h>
00026 #include <socketcan_interface/reader.h>
00027 //-----------------------------------------------
00028 
00029 class SocketCan : public CanItf
00030 {
00031 public:
00032     // --------------- Interface
00033     SocketCan ( const char* device, int baudrate );
00034     SocketCan ( const char* device );
00035     ~SocketCan();
00036     bool init_ret();
00037     void init();
00038     bool transmitMsg ( CanMsg CMsg, bool bBlocking = true );
00039     bool receiveMsg ( CanMsg* pCMsg );
00040     bool receiveMsgRetry ( CanMsg* pCMsg, int iNrOfRetry );
00041     bool receiveMsgTimeout ( CanMsg* pCMsg, int nMicroSecTimeout );
00042     bool isObjectMode() {
00043         return false;
00044     }
00045 
00046 private:
00047     // --------------- Types
00048     boost::shared_ptr<can::ThreadedSocketCANInterface> m_handle;
00049     can::BufferedReader m_reader;
00050 
00051     bool m_bInitialized;
00052     const char* p_cDevice;
00053 
00054     void print_error ( const can::State& state );
00055 };
00056 //-----------------------------------------------
00057 #endif


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