00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*- 00002 00003 // -- BEGIN LICENSE BLOCK ---------------------------------------------- 00004 // This file is part of FZIs ic_workspace. 00005 // 00006 // This program is free software licensed under the LGPL 00007 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3). 00008 // You can find a copy of this license in LICENSE folder in the top 00009 // directory of the source code. 00010 // 00011 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany 00012 // 00013 // -- END LICENSE BLOCK ------------------------------------------------ 00014 00015 //---------------------------------------------------------------------- 00025 //---------------------------------------------------------------------- 00026 #ifndef _icl_hardware_can_UseDummyCan_h_ 00027 #define _icl_hardware_can_UseDummyCan_h_ 00028 00029 #include "icl_hardware_can/Logging.h" 00030 #include "icl_hardware_can/tCanMessage.h" 00031 00032 namespace icl_hardware { 00033 namespace can { 00034 00035 typedef int tCanDescriptor; 00036 static tCanDescriptor no_can_instances = 0; 00037 00038 inline bool CanDescriptorValid(tCanDescriptor can_device) 00039 { 00040 return can_device != 0; 00041 } 00042 00043 inline tCanDescriptor InvalidCanDescriptor() 00044 { 00045 return 0; 00046 } 00047 00048 inline const char* CanDriverName() 00049 { 00050 return "DummyCAN"; 00051 } 00052 00053 inline tCanDescriptor CanDeviceOpen(const char* /*device_name*/, int /*flags*/, 00054 unsigned char /*acceptance_code*/, unsigned char /*acceptance_mask*/, unsigned int /*baud_rate*/, 00055 unsigned /*send_fifo_size*/, unsigned /*receive_fifo_size*/) 00056 { 00057 tCanDescriptor can_device = no_can_instances++; 00058 LOGGING_INFO(CAN, "Opening DummyCAN (" << can_device << ")" << endl); 00059 return can_device; 00060 } 00061 00062 inline int CanDeviceClose(tCanDescriptor /*_can_device*/) 00063 { 00064 return 0; 00065 } 00066 00067 inline int CanDeviceSend(tCanDescriptor /*_can_device*/, const tCanMessage& /*msg*/) 00068 { 00069 return 0; 00070 } 00071 00072 inline int CanDeviceReceive(tCanDescriptor /*_can_device*/, tCanMessage& /*msg*/) 00073 { 00074 return 0; 00075 } 00076 00077 inline int CanDeviceReset(tCanDescriptor /*_can_device*/) 00078 { 00079 return 0; 00080 } 00081 00082 } 00083 } 00084 00085 #endif