Changeset 4 in pacpussensors for trunk/CanGateway
- Timestamp:
- Jun 7, 2013, 12:10:00 AM (11 years ago)
- Location:
- trunk/CanGateway
- Files:
-
- 13 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CanGateway/CMakeLists.txt
r2 r4 56 56 DbtRawCanReader.h 57 57 DbtRawCanReader.cpp 58 structureCan.h 58 59 ${PLUGIN_CPP} 59 60 ) … … 69 70 if(UNIX) 70 71 list(APPEND PROJECT_SRCS 71 driver/PeakCanDriver.cpp72 # driver/PeakCanDriver.cpp 72 73 driver/PeakCanDriver.h 74 driver/igepCanDriver.h 75 driver/igepCanDriver.cpp 73 76 ) 74 77 endif(UNIX) … … 126 129 set(LIBS 127 130 # add your specific libraries to link here 128 pcan131 # pcan 129 132 ) 130 133 endif(UNIX) … … 137 140 ${PACPUS_DEPENDENCIES_LIB} 138 141 ${LIBS} 139 PacpusTools142 # PacpusTools 140 143 ) 141 144 -
trunk/CanGateway/CanDecoderBase.h
r2 r4 19 19 #include "Pacpus/kernel/ComponentBase.h" 20 20 #include "CanFrame.h" 21 #include "structureCan.h" 21 22 22 23 namespace pacpus { -
trunk/CanGateway/CanGateway.cpp
r2 r4 85 85 qFatal("Failed to open the CAN interface port %s in %s mode",port_, accessMode_); 86 86 } 87 else if (source_ == "igep") 88 { 89 canIf_.setSource(Win32CanInterface::igepCard); 90 // open interface 91 if (canIf_.openInterface(port_, accessMode_)==0) 92 qFatal("Failed to open the CAN interface port %s in %s mode",port_, accessMode_); 93 } 87 94 else 88 95 { … … 107 114 counter_ = 0; 108 115 canIf_.stop(); 109 if ((source_ == "vector")||(source_=="peak")||(source_=="vectorXL") )116 if ((source_ == "vector")||(source_=="peak")||(source_=="vectorXL")||(source_=="igep")) 110 117 canIf_.closeInterface(channel_); 111 118 canIf_.wait(); … … 182 189 setState(ComponentBase::MONITOR_OK); 183 190 184 //printf("id:%x\n",incomingCanFrames_[counter_].frame.id);191 // printf("id:%x\n",incomingCanFrames_[counter_].frame.id); 185 192 186 193 /* switch (incomingCanFrames_[counter_].frame.id) -
trunk/CanGateway/CanGateway.h
r2 r4 46 46 virtual ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config); 47 47 48 virtual Win32CanInterface* getCanIf() 49 { 50 return &canIf_; 51 } 52 48 53 protected: 49 54 void run(); -
trunk/CanGateway/Win32CanInterface.cpp
r2 r4 109 109 peakLoop(); 110 110 break; 111 case igepCard: 112 igepLoop(); 113 break; 111 114 case XLVectorCard: 112 115 vectorXlLoop(); … … 200 203 201 204 /************************************************************************/ 205 /// The loop used for waiting CAN data from igep card 206 void Win32CanInterface::igepLoop() 207 { 208 std::cout << "In igep loop" << std::endl; 209 210 while(continue_) 211 { 212 // Wait incoming data from the CAN bus 213 if ( canDriver_->receiveFrame(frame_) == 0 ) { 214 receivedFrames_[counter_].time = road_time(); 215 receivedFrames_[counter_].timerange = 0; 216 memcpy(&(receivedFrames_[counter_].frame), &frame_, sizeof(CanFrame) ); 217 semaphore_->release(); 218 counter_++; 219 counter_ = counter_ % receivedFramesArraySize_; 220 } 221 } 222 } 223 /************************************************************************/ 202 224 /// Stops the thread 203 225 void Win32CanInterface::stop() -
trunk/CanGateway/Win32CanInterface.h
r2 r4 20 20 # define CAN_DRIVER_TYPE VECTOR_CANXL_DRIVER 21 21 #else 22 # define CAN_DRIVER_TYPE PEAK_CAN_DRIVER22 # define CAN_DRIVER_TYPE IGEP_CAN_DRIVER 23 23 #endif 24 24 … … 30 30 31 31 #include "driver/CanDriver.h" 32 #include "structureCan.h" 32 33 33 34 namespace pacpus { … … 42 43 ~Win32CanInterface(); 43 44 44 enum DataSource {VectorCard, SharedMemory, PeakCard, XLVectorCard };45 enum DataSource {VectorCard, SharedMemory, PeakCard, XLVectorCard, igepCard}; 45 46 46 47 bool openInterface(const int number, const unsigned int speed); … … 58 59 void shMemLoop(); 59 60 void peakLoop(); 61 void igepLoop(); 60 62 void vectorXlLoop(); 61 63 -
trunk/CanGateway/driver/CanDriver.h
r1 r4 23 23 #define NI_CAN_DRIVER 2 24 24 #define VECTOR_CANXL_DRIVER 3 25 #define PEAK_CAN_DRIVER 4 26 #define IGEP_CAN_DRIVER 5 25 27 26 28 … … 34 36 #include "PeakCanDriver.h" 35 37 #define CanDriverType PeakCanDriver 38 #elif CAN_DRIVER_TYPE == IGEP_CAN_DRIVER 39 #include "igepCanDriver.h" 40 #define CanDriverType igepCanDriver 36 41 #elif CAN_DRIVER_TYPE == VECTOR_CANXL_DRIVER 37 42 #include "XLVectorCanDriver.h" -
trunk/CanGateway/driver/CanDriverBase.h
r2 r4 20 20 #include "Pacpus/PacpusTools/BinaryDecoder.h" 21 21 22 #include "../structureCan.h" 22 23 23 24 /*
Note:
See TracChangeset
for help on using the changeset viewer.