Showing preview only (674K chars total). Download the full file or copy to clipboard to get everything.
Repository: famez/J1939-Framework
Branch: master
Commit: 5153e5005995
Files: 187
Total size: 624.3 KB
Directory structure:
gitextract_rarda5g4/
├── .travis.yml
├── BinTest/
│ ├── AccelCCVS/
│ │ ├── CMakeLists.txt
│ │ └── src/
│ │ └── accelCCVS.cpp
│ └── FrameInject/
│ ├── CMakeLists.txt
│ └── src/
│ └── frame_inject.cpp
├── BinUtils/
│ ├── CMakeLists.txt
│ ├── TRCDumper/
│ │ ├── .cproject
│ │ ├── CMakeLists.txt
│ │ └── src/
│ │ └── TRCDumper.cpp
│ ├── TRCPlayer/
│ │ ├── CMakeLists.txt
│ │ ├── README.md
│ │ └── src/
│ │ └── TRCPlayer.cpp
│ ├── TRCToCap/
│ │ ├── .cproject
│ │ ├── CMakeLists.txt
│ │ ├── include/
│ │ │ ├── config.h
│ │ │ └── pcapio.h
│ │ └── src/
│ │ ├── TRCToCap.cpp
│ │ └── pcapio.c
│ ├── j1939AddrClaim/
│ │ ├── CMakeLists.txt
│ │ ├── Readme.md
│ │ └── j1939AddrClaim.cpp
│ ├── j1939AddressMapper/
│ │ ├── CMakeLists.txt
│ │ ├── Readme.md
│ │ └── j1939AddressMapper.cpp
│ ├── j1939Decoder/
│ │ ├── .cproject
│ │ ├── .settings/
│ │ │ ├── org.eclipse.cdt.codan.core.prefs
│ │ │ └── org.eclipse.cdt.core.prefs
│ │ ├── CMakeLists.txt
│ │ ├── README.md
│ │ └── src/
│ │ └── j1939Decoder.cpp
│ ├── j1939Sender/
│ │ ├── CMakeLists.txt
│ │ ├── README.md
│ │ └── src/
│ │ └── j1939Sender.cpp
│ └── j1939Sniffer/
│ ├── .cproject
│ ├── .gitignore
│ ├── .settings/
│ │ └── org.eclipse.cdt.codan.core.prefs
│ ├── CMakeLists.txt
│ └── src/
│ └── j1939Sniffer.cpp
├── CAN/
│ ├── .gitignore
│ ├── .settings/
│ │ └── org.eclipse.cdt.codan.core.prefs
│ ├── Backends/
│ │ ├── PeakCan/
│ │ │ ├── PeakCanChannels.cpp
│ │ │ ├── PeakCanHelper.cpp
│ │ │ ├── PeakCanReceiver.cpp
│ │ │ ├── PeakCanSender.cpp
│ │ │ └── PeakCanSymbols.cpp
│ │ └── Sockets/
│ │ ├── SocketCanHelper.cpp
│ │ ├── SocketCanReceiver.cpp
│ │ └── SocketCanSender.cpp
│ ├── CMakeLists.txt
│ ├── CanEasy.cpp
│ ├── CanFrame.cpp
│ ├── CanSniffer.cpp
│ ├── CommonCanReceiver.cpp
│ ├── CommonCanSender.cpp
│ ├── ICanHelper.cpp
│ ├── README.md
│ ├── TRCReader.cpp
│ ├── TRCWriter.cpp
│ └── include/
│ ├── Backends/
│ │ ├── PeakCan/
│ │ │ ├── PeakCanChannels.h
│ │ │ ├── PeakCanHelper.h
│ │ │ ├── PeakCanReceiver.h
│ │ │ ├── PeakCanSender.h
│ │ │ └── PeakCanSymbols.h
│ │ └── Sockets/
│ │ ├── SocketCanHelper.h
│ │ ├── SocketCanReceiver.h
│ │ └── SocketCanSender.h
│ ├── CanEasy.h
│ ├── CanFilter.h
│ ├── CanFrame.h
│ ├── CanSniffer.h
│ ├── CommonCanReceiver.h
│ ├── CommonCanSender.h
│ ├── ICanHelper.h
│ ├── ICanSender.h
│ ├── TRCReader.h
│ └── TRCWriter.h
├── CMakeLists.txt
├── Common/
│ ├── .cproject
│ ├── .gitignore
│ ├── CMakeLists.txt
│ ├── Utils.cpp
│ └── include/
│ ├── Assert.h
│ ├── ICloneable.h
│ ├── Singleton.h
│ ├── Types.h
│ └── Utils.h
├── Database/
│ ├── CMakeLists.txt
│ ├── README.md
│ └── frames.json
├── GUI_WEB/
│ ├── README.md
│ ├── backend/
│ │ ├── CMakeLists.txt
│ │ ├── graph.proto
│ │ └── src/
│ │ ├── J1939GUI.cpp
│ │ ├── graph.cpp
│ │ └── graph.h
│ └── frontend/
│ ├── graph.html
│ ├── index.html
│ └── js/
│ └── graph.js
├── J1939/
│ ├── .cproject
│ ├── .gitignore
│ ├── .settings/
│ │ └── org.eclipse.cdt.codan.core.prefs
│ ├── Addressing/
│ │ └── AddressClaimFrame.cpp
│ ├── CMakeLists.txt
│ ├── Diagnosis/
│ │ ├── DTC.cpp
│ │ └── Frames/
│ │ └── DM1.cpp
│ ├── FMS/
│ │ └── TellTale/
│ │ ├── FMS1Frame.cpp
│ │ └── TellTale.cpp
│ ├── Frames/
│ │ └── RequestFrame.cpp
│ ├── GenericFrame.cpp
│ ├── J1939Common.cpp
│ ├── J1939DataBase.cpp
│ ├── J1939Factory.cpp
│ ├── J1939Frame.cpp
│ ├── README.md
│ ├── SPN/
│ │ ├── SPN.cpp
│ │ ├── SPNHistory.cpp
│ │ ├── SPNNumeric.cpp
│ │ ├── SPNSpec/
│ │ │ ├── SPNNumericSpec.cpp
│ │ │ ├── SPNSpec.cpp
│ │ │ └── SPNStatusSpec.cpp
│ │ ├── SPNStatus.cpp
│ │ └── SPNString.cpp
│ ├── Transport/
│ │ ├── BAM/
│ │ │ ├── BamFragmenter.cpp
│ │ │ └── BamReassembler.cpp
│ │ ├── RTSCTS/
│ │ │ └── RTSCTSConnectionManager.cpp
│ │ ├── TPCMFrame.cpp
│ │ └── TPDTFrame.cpp
│ └── include/
│ ├── Addressing/
│ │ └── AddressClaimFrame.h
│ ├── Diagnosis/
│ │ ├── DTC.h
│ │ └── Frames/
│ │ └── DM1.h
│ ├── FMS/
│ │ └── TellTale/
│ │ ├── FMS1Frame.h
│ │ └── TellTale.h
│ ├── Frames/
│ │ └── RequestFrame.h
│ ├── GenericFrame.h
│ ├── J1939Common.h
│ ├── J1939DataBase.h
│ ├── J1939Factory.h
│ ├── J1939Frame.h
│ ├── SPN/
│ │ ├── SPN.h
│ │ ├── SPNHistory.h
│ │ ├── SPNNumeric.h
│ │ ├── SPNSpec/
│ │ │ ├── SPNNumericSpec.h
│ │ │ ├── SPNSpec.h
│ │ │ └── SPNStatusSpec.h
│ │ ├── SPNStatus.h
│ │ └── SPNString.h
│ └── Transport/
│ ├── BAM/
│ │ ├── BamFragmenter.h
│ │ └── BamReassembler.h
│ ├── RTSCTS/
│ │ └── RTSCTSConnectionManager.h
│ ├── TPCMFrame.h
│ └── TPDTFrame.h
├── LICENSE
├── README.md
├── Scripts/
│ ├── Readme.md
│ ├── define_frames.j1939
│ ├── gear_level.sh
│ ├── simulate_dtc.sh
│ ├── simulate_fuel_cons.sh
│ └── test_tco.sh
├── Tests/
│ ├── BAM_test.cpp
│ ├── CMakeLists.txt
│ ├── SPNNumeric_test.cpp
│ ├── SPNStatus_test.cpp
│ ├── SPNString_test.cpp
│ ├── TestFrame.cpp
│ ├── address_claim_frame_test.cpp
│ ├── database/
│ │ ├── test1.json
│ │ ├── test2.json
│ │ ├── test3.json
│ │ ├── test4.json
│ │ └── test5.json
│ ├── database_test.cpp
│ ├── fms1_frame_test.cpp
│ ├── genericframe_test.cpp
│ ├── include/
│ │ └── TestFrame.h
│ ├── j1939Factory_test.cpp
│ ├── main.cpp
│ └── request_frame.cpp
├── cmake/
│ ├── FindLibWebSockets.cmake
│ └── J1939FrameworkConfig.cmake
├── j1939AddressClaimer/
│ ├── AddressClaimer.cpp
│ ├── CMakeLists.txt
│ └── include/
│ └── AddressClaimer.h
└── wireshark/
└── dissector/
├── CMakeLists.txt
├── Readme.md
├── packet-j1939.cpp
└── plugin.c
================================================
FILE CONTENTS
================================================
================================================
FILE: .travis.yml
================================================
dist: trusty
sudo: required
language: cpp
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-6
- libgtest-dev
- protobuf-compiler
- libprotobuf-dev
install:
- pushd ~
- git clone https://github.com/open-source-parsers/jsoncpp.git
- pushd jsoncpp
- cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON
- sudo make install
- popd
- popd
- pushd ~
- git clone https://github.com/warmcat/libwebsockets.git
- pushd libwebsockets
- cmake .
- sudo make install
- popd
- popd
- pushd /usr/src/gtest
- sudo env "PATH=$PATH" cmake CMakeLists.txt
- sudo make
- sudo cp *.a /usr/lib
- popd
script:
- CXX=/usr/bin/g++-6 CC=/usr/bin/gcc-6 cmake .
- cmake --build .
- ./Tests/execTests
================================================
FILE: BinTest/AccelCCVS/CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.5)
project(accelCCVS)
set(CMAKE_BUILD_TYPE Debug) #For debug purposes
find_package(J1939Framework REQUIRED)
add_definitions(-DDATABASE_PATH="${J1939_Database}")
set(CMAKE_CXX_STANDARD 11)
add_executable(accelCCVS
src/accelCCVS.cpp
)
target_link_libraries(accelCCVS
PUBLIC
J1939 Can rt -rdynamic
)
install (TARGETS accelCCVS
DESTINATION bin)
================================================
FILE: BinTest/AccelCCVS/src/accelCCVS.cpp
================================================
#ifndef DATABASE_PATH
#define DATABASE_PATH "/etc/j1939/frames.json"
#endif
#include <getopt.h>
#include <memory>
#include <chrono>
#include <thread>
#include <CanEasy.h>
#include <SPN/SPNNumeric.h>
#include <J1939Frame.h>
#include <GenericFrame.h>
#include <J1939Factory.h>
#define BAUD_250K 250000
#define MAX_ACCEL_VALUE 2 /*m/s²*/
#define DIFF_ACCEL 0.5
using namespace J1939;
using namespace Can;
using namespace Utils;
int
main (int argc, char **argv)
{
CanEasy::initialize(BAUD_250K);
std::set<std::string> interfaces = CanEasy::getCanIfaces();
std::shared_ptr<ICanSender> sender = CanEasy::getSender("vcan0");
if(!sender) {
std::cerr << "Cannot send through the interface" << std::endl;
return -1;
}
//Read database if available
if(!J1939Factory::getInstance().registerDatabaseFrames(DATABASE_PATH)) {
std::cerr << "Database not found in " << DATABASE_PATH << std::endl;
exit(-2);
}
std::unique_ptr<J1939Frame> myFrame = J1939Factory::getInstance().getJ1939Frame("CCVS");
if(!myFrame) return -3;
GenericFrame *ccvsFrame = static_cast<GenericFrame *>(myFrame.get());
SPNNumeric *spnSpeed = static_cast<SPNNumeric*>(ccvsFrame->getSPN(84));
ccvsFrame->setPriority(3);
ccvsFrame->setSrcAddr(0x20);
CanFrame frame(true, ccvsFrame->getIdentifier());
sender->sendFrame(frame, 100, [ccvsFrame](u32 id, std::string& data) { //We need to modify speed dynamically
size_t length = ccvsFrame->getDataLength();
u8* buff = new u8[length];
ccvsFrame->encode(id, buff, length);
//Set data
data.append((char*)buff, length);
delete[] buff;
});
double diffAccel = DIFF_ACCEL;
bool inc = true;
double accel = /*0*/MAX_ACCEL_VALUE;
double speed = 2;
double coef = 1;
while(true) {
//Simulate acceleration
speed += accel*36/100;
std::cout << "Accel: " << accel << std::endl;
std::cout << "Speed: " << speed << std::endl;
spnSpeed->setFormattedValue(speed);
//modify accel
if(inc) {
accel += diffAccel * coef;
} else {
accel -= diffAccel * coef;
}
coef = MAX_ACCEL_VALUE - abs(accel);
if(coef < 0.1) coef = 0.1;
coef /= MAX_ACCEL_VALUE;
if(accel >= MAX_ACCEL_VALUE) inc = false;
if(accel <= -MAX_ACCEL_VALUE) inc = true;
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
return 0;
}
================================================
FILE: BinTest/FrameInject/CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.5)
project(frameInject)
set(CMAKE_BUILD_TYPE Debug) #For debug purposes
find_package(J1939Framework REQUIRED)
add_definitions(-DDATABASE_PATH="${J1939_Database}")
set(CMAKE_CXX_STANDARD 11)
add_executable(frameInject
src/frame_inject.cpp
)
target_link_libraries(frameInject
PUBLIC
J1939 Can rt -rdynamic
)
install (TARGETS frameInject
DESTINATION bin)
================================================
FILE: BinTest/FrameInject/src/frame_inject.cpp
================================================
#ifndef DATABASE_PATH
#define DATABASE_PATH "/etc/j1939/frames.json"
#endif
#include <getopt.h>
#include <memory>
#include <chrono>
#include <thread>
#include <CanEasy.h>
#include <SPN/SPNNumeric.h>
#include <J1939Frame.h>
#include <GenericFrame.h>
#include <J1939Factory.h>
#include <TRCReader.h>
#include <TRCWriter.h>
using namespace J1939;
using namespace Can;
using namespace Utils;
int
main (int argc, char **argv)
{
TRCReader trcReader;
TRCWriter writer;
//Read database if available
if(!J1939Factory::getInstance().registerDatabaseFrames(DATABASE_PATH)) {
std::cerr << "Database not found in " << DATABASE_PATH << std::endl;
exit(-2);
}
if(!trcReader.loadFile("input.trc")) {
std::cerr << "TRC file is corrupted or not readable by " << argv[0] << std::endl;
return -2;
}
if(trcReader.getNumberOfFrames() == 0) {
std::cerr << "TRC file is empty" << std::endl;
return -3;
}
int progress = 0, oldProgress = 0;
if(!writer.open("output.trc")) {
std::cerr << "File could not be opened for writing..." << std::endl;
return 2;
}
std::unique_ptr<J1939Frame> frame = J1939Factory::getInstance().getJ1939Frame("EEC1");
frame->setSrcAddr(0x15);
frame->setPriority(4);
GenericFrame *eec1Frame = static_cast<GenericFrame *>(frame.get());
SPNNumeric *rpm = static_cast<SPNNumeric *>(eec1Frame->getSPN(190));
rpm->setFormattedValue(310); //310 rpm
std::pair<u64, CanFrame> pairTStampFrame;
u64 eec1TimeStamp = 0;
do {
trcReader.readNextCanFrame();
pairTStampFrame = trcReader.getLastCanFrame();
u64 timeStamp = pairTStampFrame.first;
const CanFrame& frame = pairTStampFrame.second;
if(eec1TimeStamp < timeStamp) {
u32 id;
size_t length = eec1Frame->getDataLength();
u8* buff = new u8[length];
eec1Frame->encode(id, buff, length);
//Set data
std::string data;
data.append((char*)buff, length);
delete[] buff;
CanFrame frame(true, id, data);
writer.write(frame, TimeStamp(eec1TimeStamp/1000000, eec1TimeStamp % 1000000));
eec1TimeStamp += 100000; //100ms
}
writer.write(frame, TimeStamp(timeStamp/1000000, timeStamp % 1000000));
progress = 100 * trcReader.getCurrentPos() / trcReader.getNumberOfFrames();
if(progress != oldProgress) {
std::cout << "Progress: " << progress << " %" << std::endl;
}
} while(trcReader.getCurrentPos() < trcReader.getNumberOfFrames() - 1);
writer.close();
return 0;
}
================================================
FILE: BinUtils/CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.5)
project(BinUtils)
#set(PROPERTIES EXCLUDE_FROM_ALL TRUE)
add_subdirectory(j1939Decoder)
add_subdirectory(j1939Sender)
add_subdirectory(j1939Sniffer)
add_subdirectory(TRCDumper)
add_subdirectory(TRCPlayer)
add_subdirectory(TRCToCap)
add_subdirectory(j1939AddrClaim)
add_subdirectory(j1939AddressMapper)
================================================
FILE: BinUtils/TRCDumper/.cproject
================================================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.1330864580">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.1330864580" moduleId="org.eclipse.cdt.core.settings" name="Debug">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.debug.1330864580" name="Debug" parent="cdt.managedbuild.config.gnu.exe.debug">
<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.1330864580." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.1969173486" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.213112325" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
<builder buildPath="${workspace_loc:/TRCDumper}/Debug" id="cdt.managedbuild.target.gnu.builder.exe.debug.1594714072" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.1162142427" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.102738694" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.434953571" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.exe.debug.option.debugging.level.1569851892" name="Debug Level" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.dialect.std.852954257" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.cpp.compiler.dialect.c++11" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.include.paths.909966041" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value=""${workspace_loc:/CAN}""/>
<listOptionValue builtIn="false" value=""${workspace_loc:/Common}""/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.896935545" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.1861911242" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.exe.debug.option.optimization.level.1095799029" name="Optimization Level" superClass="gnu.c.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
<option id="gnu.c.compiler.exe.debug.option.debugging.level.227924340" name="Debug Level" superClass="gnu.c.compiler.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1310179622" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.1292486260" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.160984213" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
<option id="gnu.cpp.link.option.libs.1439875801" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" useByScannerDiscovery="false" valueType="libs">
<listOptionValue builtIn="false" value="CAN"/>
<listOptionValue builtIn="false" value="rt"/>
<listOptionValue builtIn="false" value="dl"/>
<listOptionValue builtIn="false" value="Common"/>
<listOptionValue builtIn="false" value="pthread"/>
</option>
<option id="gnu.cpp.link.option.paths.245495372" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" useByScannerDiscovery="false" valueType="libPaths">
<listOptionValue builtIn="false" value=""${workspace_loc:/CAN/Debug}""/>
<listOptionValue builtIn="false" value=""${workspace_loc:/Common/Debug}""/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1355917260" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.253399415" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.21780481" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="cdt.managedbuild.config.gnu.exe.release.521378321">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.release.521378321" moduleId="org.eclipse.cdt.core.settings" name="Release">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.release.521378321" name="Release" parent="cdt.managedbuild.config.gnu.exe.release">
<folderInfo id="cdt.managedbuild.config.gnu.exe.release.521378321." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.33465770" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.release">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.release.593486504" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.release"/>
<builder buildPath="${workspace_loc:/TRCDumper}/Release" id="cdt.managedbuild.target.gnu.builder.exe.release.858209272" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.release"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.287758658" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1678206868" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release">
<option id="gnu.cpp.compiler.exe.release.option.optimization.level.758901623" name="Optimization Level" superClass="gnu.cpp.compiler.exe.release.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
<option id="gnu.cpp.compiler.exe.release.option.debugging.level.741989058" name="Debug Level" superClass="gnu.cpp.compiler.exe.release.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.913889234" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.1073906800" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release">
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.exe.release.option.optimization.level.405994449" name="Optimization Level" superClass="gnu.c.compiler.exe.release.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
<option id="gnu.c.compiler.exe.release.option.debugging.level.234492977" name="Debug Level" superClass="gnu.c.compiler.exe.release.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.none" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.310719326" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.release.327648754" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.1662944550" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release">
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.483012504" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.1712517777" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.301397720" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="TRCDumper.cdt.managedbuild.target.gnu.exe.489844440" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1330864580;cdt.managedbuild.config.gnu.exe.debug.1330864580.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.102738694;cdt.managedbuild.tool.gnu.cpp.compiler.input.896935545">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1330864580;cdt.managedbuild.config.gnu.exe.debug.1330864580.;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.1861911242;cdt.managedbuild.tool.gnu.c.compiler.input.1310179622">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.521378321;cdt.managedbuild.config.gnu.exe.release.521378321.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1678206868;cdt.managedbuild.tool.gnu.cpp.compiler.input.913889234">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.521378321;cdt.managedbuild.config.gnu.exe.release.521378321.;cdt.managedbuild.tool.gnu.c.compiler.exe.release.1073906800;cdt.managedbuild.tool.gnu.c.compiler.input.310719326">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Debug">
<resource resourceType="PROJECT" workspacePath="/TRCDumper"/>
</configuration>
<configuration configurationName="Release">
<resource resourceType="PROJECT" workspacePath="/TRCDumper"/>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cproject>
================================================
FILE: BinUtils/TRCDumper/CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.5)
project(TRCDumper)
add_executable(TRCDumper
src/TRCDumper.cpp
)
target_include_directories(TRCDumper
PUBLIC
include ${Can_SOURCE_DIR}/include ${Common_SOURCE_DIR}/include
)
target_link_libraries(TRCDumper
PUBLIC
Can dl rt
)
install (TARGETS TRCDumper
DESTINATION bin)
================================================
FILE: BinUtils/TRCDumper/src/TRCDumper.cpp
================================================
//============================================================================
// Name : TRCDumper.cpp
// Author :
// Version :
// Copyright : MIT License
// Description : Application that reads frames from the can interface and writes them to a file in TRC format.
//============================================================================
#include <getopt.h>
#include <signal.h>
#include <iostream>
//Can includes
#include <TRCWriter.h>
#include <CanEasy.h>
//Bitrate for J1939 protocol
#define BAUD_250K 250000
using namespace Can;
using namespace Utils;
TRCWriter writer;
bool firstFrame;
TimeStamp initialTimeStamp;
void onRcv(const Can::CanFrame& frame, const TimeStamp&, const std::string& interface, void*);
bool onTimeout();
void onSignal(int);
std::string interface, file;
int main(int argc, char **argv) {
firstFrame = true;
static struct option long_options[] =
{
{"interface", required_argument, NULL, 'i'},
{"file", required_argument, NULL, 'f'},
{NULL, 0, NULL, 0}
};
while (1)
{
int c = getopt_long (argc, argv, "s:i:",
long_options, NULL);
/* Detect the end of the options. */
if (c == -1)
break;
switch (c)
{
case 'f':
file = optarg;
break;
case 'i':
interface = optarg;
break;
default:
break;
}
}
CanEasy::initialize(BAUD_250K, onRcv, onTimeout);
CanSniffer& sniffer = CanEasy::getSniffer();
if(sniffer.getNumberOfReceivers() == 0) {
std::cerr << "No interface available from to sniffer" << std::endl;
return 2;
}
if(!writer.open(file)) {
std::cerr << "File could not be opened for writing..." << std::endl;
return 2;
}
signal(SIGINT, onSignal);
sniffer.sniff(1000);
}
void onRcv(const Can::CanFrame& frame, const TimeStamp& timeStamp, const std::string& , void*) {
if(firstFrame) {
initialTimeStamp = timeStamp;
firstFrame = false;
}
writer.write(frame, timeStamp - initialTimeStamp);
}
bool onTimeout() {
return true;
}
void onSignal(int) {
std::cout << "Closing file..." << std::endl;
writer.close();
std::cout << "Done" << std::endl;
exit(0);
}
================================================
FILE: BinUtils/TRCPlayer/CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.5)
project(TRCPlayer)
find_package (Curses)
if(CURSES_FOUND)
message("-- NCURSES is available")
message("-- Project " ${PROJECT_NAME} " will be built")
add_executable(TRCPlayer
src/TRCPlayer.cpp
)
target_include_directories(TRCPlayer
PUBLIC
include ${J1939_SOURCE_DIR}/include ${Can_SOURCE_DIR}/include ${Common_SOURCE_DIR}/include
)
target_link_libraries(TRCPlayer
PUBLIC
J1939 Can ncurses dl rt
)
install (TARGETS TRCPlayer
DESTINATION bin)
endif(CURSES_FOUND)
================================================
FILE: BinUtils/TRCPlayer/README.md
================================================
## TRCPlayer
Let's play trc files.
```bash
TRCPlayer -i vcan0 -f file.trc
```

================================================
FILE: BinUtils/TRCPlayer/src/TRCPlayer.cpp
================================================
//============================================================================
// Name : TRCDumper.cpp
// Author :
// Version :
// Copyright : MIT License
// Description : Application that reads frames from the can interface and writes them to a file in TRC format.
//============================================================================
#include <getopt.h>
#include <signal.h>
#include <ncurses.h>
#include <iostream>
#include <thread>
#include <chrono>
#include <unordered_map>
#include <vector>
//Can includes
#include <TRCReader.h>
#include <CanEasy.h>
//J1939 includes
#include <J1939Frame.h>
#include <J1939Factory.h>
#include <Transport/BAM/BamReassembler.h>
//Bitrate for J1939 protocol
#define BAUD_250K 250000
#define SELECT_COLOR 1
using namespace Can;
using namespace Utils;
using namespace J1939;
TRCReader reader;
TimeStamp start;
std::string interface, file;
//Vector to show the parsed frames from trc file
std::vector< std::pair<bool/*show_details*/, J1939Frame*> > vectorFrames;
//Same as the vector but useful for fast access by id (To check if frame exeist or copy frame in case that it exists)
std::unordered_map<u32/*id*/, J1939Frame*> mapFrames;
//To reassemble frames fragmented by means of Broadcast Announce Message protocol
BamReassembler reassembler;
//Selected frame
size_t currentSel = 0;
//KEY
int key;
u32 progress = 0;
void printFrames();
int main(int argc, char **argv) {
static struct option long_options[] =
{
{"interface", required_argument, NULL, 'i'},
{"file", required_argument, NULL, 'f'},
{NULL, 0, NULL, 0}
};
while (1)
{
int c = getopt_long (argc, argv, "f:i:",
long_options, NULL);
/* Detect the end of the options. */
if (c == -1)
break;
switch (c)
{
case 'f':
file = optarg;
break;
case 'i':
interface = optarg;
break;
default:
break;
}
}
CanEasy::initialize(BAUD_250K);
std::shared_ptr<ICanSender> sender = CanEasy::getSender(interface);
if(!sender) {
std::cerr << "Cannot send through the interface" << std::endl;
return 1;
}
std::cout << "Loading file..." << std::endl;
if(!reader.loadFile(file)) {
std::cerr << "File could not be opened for reading..." << std::endl;
return 2;
}
if(reader.getNumberOfFrames() == 0) {
std::cerr << "TRC file is empty" << std::endl;
return 3;
}
std::pair<u64, CanFrame> pairTStampFrame;
if(!J1939Factory::getInstance().registerDatabaseFrames(DATABASE_PATH)) {
std::cerr << "Database not found in " << DATABASE_PATH << std::endl;
return 4;
}
//Initialize ncurses
initscr();
cbreak();
timeout(1);
keypad(stdscr, true);
start_color();
init_pair(SELECT_COLOR, COLOR_BLACK, COLOR_WHITE);
int width = getmaxx(stdscr);
//End of initialization
start = TimeStamp::now();
TimeStamp lastPrintTime = TimeStamp::now();
do {
reader.readNextCanFrame();
pairTStampFrame = reader.getLastCanFrame();
const CanFrame& frame = pairTStampFrame.second;
TimeStamp aux(pairTStampFrame.first / 1000000, pairTStampFrame.first % 1000000);
TimeStamp lastTs(start + aux);
//While waiting, we try to read arrow keys
while(TimeStamp::now() < lastTs) {
//Blocks during one millisecond
key = getch();
switch(key) {
case KEY_UP:
if(currentSel > 0) --currentSel;
break;
case KEY_DOWN:
if(currentSel + 1 < vectorFrames.size()) ++currentSel;
break;
case '\n': //Key Enter. Show details of frame when it is selected (or hide them)
if(!vectorFrames.empty()) {
vectorFrames[currentSel].first = !vectorFrames[currentSel].first;
}
break;
default: //To skip printFrames if key not detected
continue;
}
//If one of the valid keys was pressed, repaint
printFrames();
}
sender->sendFrameOnce(frame);
progress = width * reader.getCurrentPos() / reader.getNumberOfFrames();
try {
//Try to print frames
std::unique_ptr<J1939Frame> j1939Frame = J1939Factory::getInstance().
getJ1939Frame(frame.getId(), (const u8*)(frame.getData().c_str()), frame.getData().size());
if(j1939Frame) { //Frame registered in the factory?
if(reassembler.toBeHandled(*j1939Frame)) { //Check if the frame is part of a fragmented frame (BAM protocol)
//Actually it is, reassembler will handle it.
reassembler.handleFrame(*j1939Frame);
if(reassembler.reassembledFramesPending()) {
j1939Frame = reassembler.dequeueReassembledFrame();
} else {
continue; //Frame handled by reassembler but the original frame to be reassembled is not complete.
}
}
//Check if it is already added.
auto iter = mapFrames.find(j1939Frame->getIdentifier());
if(iter != mapFrames.end()) {
iter->second->copy(*j1939Frame); //Update frame
} else {
//Add frame to the list
mapFrames[j1939Frame->getIdentifier()] = j1939Frame.get();
vectorFrames.push_back(std::make_pair(false, j1939Frame.release()));
}
}
} catch (J1939DecodeException &) {
//Decode exception, skip frame. Add handler so that the program keeps running.
}
TimeStamp elapsed = TimeStamp::now() - lastPrintTime;
//Every 100 ms print frames
if(elapsed.getMicroSec() > 100000 || elapsed.getSeconds() > 0) {
printFrames();
lastPrintTime = TimeStamp::now();
}
} while(reader.getCurrentPos() < reader.getNumberOfFrames() - 1);
//Finalize ncurses
endwin();
//Free frames
for(auto iter = vectorFrames.begin(); iter != vectorFrames.end(); ++iter) {
delete iter->second;
}
//Finalize CanEasy
CanEasy::finalize();
}
void printFrames() {
clear();
//Print progress
std::string progressBar = std::string(progress, '#') + "\n";
printw(progressBar.c_str());
for(size_t i = 0; i < vectorFrames.size(); ++i) {
//If currentSel then print black over white
if(currentSel == i) {
attron(COLOR_PAIR(SELECT_COLOR));
}
if(vectorFrames[i].first) { //Show details of frame when it is selected
printw(vectorFrames[i].second->toString().c_str());
} else {
printw(vectorFrames[i].second->getHeader().c_str());
}
if(currentSel == i) {
attroff(COLOR_PAIR(SELECT_COLOR));
}
}
refresh();
}
================================================
FILE: BinUtils/TRCToCap/.cproject
================================================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.2041120065">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.2041120065" moduleId="org.eclipse.cdt.core.settings" name="Debug">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" errorParsers="org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.CWDLocator;org.eclipse.cdt.core.GCCErrorParser" id="cdt.managedbuild.config.gnu.exe.debug.2041120065" name="Debug" parent="cdt.managedbuild.config.gnu.exe.debug" postannouncebuildStep="" postbuildStep="" preannouncebuildStep="" prebuildStep="">
<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.2041120065." name="/" resourcePath="">
<toolChain errorParsers="" id="cdt.managedbuild.toolchain.gnu.exe.debug.375070960" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
<targetPlatform binaryParser="org.eclipse.cdt.core.GNU_ELF" id="cdt.managedbuild.target.gnu.platform.exe.debug.1544984790" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
<builder buildPath="${workspace_loc:/TRCToCap}/Debug" errorParsers="org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.CWDLocator" id="cdt.managedbuild.target.gnu.builder.exe.debug.1039576123" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.463441508" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool command="g++" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GCCErrorParser" id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.652316822" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.1231659337" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.exe.debug.option.debugging.level.451115225" name="Debug Level" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.include.paths.2021315473" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="/home/fernado/wireshark-2.6.1/writecap"/>
<listOptionValue builtIn="false" value="/usr/lib/x86_64-linux-gnu/glib-2.0/include"/>
<listOptionValue builtIn="false" value="/usr/include/glib-2.0"/>
<listOptionValue builtIn="false" value=""${workspace_loc:/CAN}""/>
<listOptionValue builtIn="false" value=""${workspace_loc:/Common}""/>
</option>
<option id="gnu.cpp.compiler.option.include.files.1641527207" name="Include files (-include)" superClass="gnu.cpp.compiler.option.include.files" useByScannerDiscovery="false"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.406755612" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool command="gcc" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GCCErrorParser" id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.197837162" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.exe.debug.option.optimization.level.1809481422" name="Optimization Level" superClass="gnu.c.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
<option id="gnu.c.compiler.exe.debug.option.debugging.level.2019851804" name="Debug Level" superClass="gnu.c.compiler.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1009854519" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.483796641" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/>
<tool command="g++" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GLDErrorParser" id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.511293932" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
<option id="gnu.cpp.link.option.libs.252791330" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" useByScannerDiscovery="false" valueType="libs">
<listOptionValue builtIn="false" value="writecap"/>
<listOptionValue builtIn="false" value="CAN"/>
<listOptionValue builtIn="false" value="Common"/>
</option>
<option id="gnu.cpp.link.option.paths.539167547" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" useByScannerDiscovery="false" valueType="libPaths">
<listOptionValue builtIn="false" value="/home/fernado/wireshark-2.6.1/run/"/>
<listOptionValue builtIn="false" value=""${workspace_loc:/CAN/Debug}""/>
<listOptionValue builtIn="false" value=""${workspace_loc:/Common/Debug}""/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1378090319" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool command="as" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GASErrorParser" id="cdt.managedbuild.tool.gnu.assembler.exe.debug.1463918392" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1583152031" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="cdt.managedbuild.config.gnu.exe.release.573803866">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.release.573803866" moduleId="org.eclipse.cdt.core.settings" name="Release">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.release.573803866" name="Release" parent="cdt.managedbuild.config.gnu.exe.release">
<folderInfo id="cdt.managedbuild.config.gnu.exe.release.573803866." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.1541028182" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.release">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.release.1405444378" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.release"/>
<builder buildPath="${workspace_loc:/TRCToCap}/Release" id="cdt.managedbuild.target.gnu.builder.exe.release.314812515" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.release"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.1734797118" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.2119085636" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release">
<option id="gnu.cpp.compiler.exe.release.option.optimization.level.701219793" name="Optimization Level" superClass="gnu.cpp.compiler.exe.release.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
<option id="gnu.cpp.compiler.exe.release.option.debugging.level.75043303" name="Debug Level" superClass="gnu.cpp.compiler.exe.release.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1167837724" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.617041756" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release">
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.exe.release.option.optimization.level.1869811454" name="Optimization Level" superClass="gnu.c.compiler.exe.release.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
<option id="gnu.c.compiler.exe.release.option.debugging.level.307832572" name="Debug Level" superClass="gnu.c.compiler.exe.release.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.none" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1056140120" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.release.1924034509" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.1506807661" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release">
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.402950265" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.1667769140" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1558534570" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="TRCToCap.cdt.managedbuild.target.gnu.exe.1109455932" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.573803866;cdt.managedbuild.config.gnu.exe.release.573803866.;cdt.managedbuild.tool.gnu.c.compiler.exe.release.617041756;cdt.managedbuild.tool.gnu.c.compiler.input.1056140120">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.573803866;cdt.managedbuild.config.gnu.exe.release.573803866.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.2119085636;cdt.managedbuild.tool.gnu.cpp.compiler.input.1167837724">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.2041120065;cdt.managedbuild.config.gnu.exe.debug.2041120065.;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.197837162;cdt.managedbuild.tool.gnu.c.compiler.input.1009854519">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.2041120065;cdt.managedbuild.config.gnu.exe.debug.2041120065.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.652316822;cdt.managedbuild.tool.gnu.cpp.compiler.input.406755612">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Debug">
<resource resourceType="PROJECT" workspacePath="/TRCToCap"/>
</configuration>
<configuration configurationName="Release">
<resource resourceType="PROJECT" workspacePath="/TRCToCap"/>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cproject>
================================================
FILE: BinUtils/TRCToCap/CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.5)
project(TRCToCap)
find_package (PkgConfig)
if(PKGCONFIG_FOUND)
pkg_check_modules (GLIB2 glib-2.0)
if(GLIB2_FOUND)
message("-- GLIB2 is available")
message("-- Project " ${PROJECT_NAME} " will be built")
add_executable(TRCToCap
src/TRCToCap.cpp
src/pcapio.c
)
target_include_directories(TRCToCap
PUBLIC
include ${Can_SOURCE_DIR}/include ${Common_SOURCE_DIR}/include ${GLIB2_INCLUDE_DIRS}
)
target_link_libraries(TRCToCap
PUBLIC
Can
)
install (TARGETS TRCToCap
DESTINATION bin)
else(GLIB2_FOUND)
message(WARNING "-- GLIB2 is not available")
message(WARNING "-- Project " ${PROJECT_NAME} " is skipped...")
message(WARNING "-- Try to install GLIB2 and run cmake again...")
endif(GLIB2_FOUND)
endif(PKGCONFIG_FOUND)
================================================
FILE: BinUtils/TRCToCap/include/config.h
================================================
/* cmakeconfig.h.in */
#ifndef __CONFIG_H__
#define __CONFIG_H__
/* Note: You cannot use earlier #defines in later #cmakedefines (cmake 2.6.2). */
/* Name of package */
#define PACKAGE "wireshark"
#define VERSION_EXTRA ""
/* Version number of package */
#define VERSION "2.6.1"
#define VERSION_MAJOR 2
#define VERSION_MINOR 6
#define VERSION_MICRO 1
#define VERSION_RELEASE "2.6"
#define VERSION_FLAVOR ""
/* FIXME: Move the path stuff to the CMakeInstallDirs.cmake file */
/* Directory for data */
#define DATAFILE_DIR "/usr/local/share/wireshark"
/* Build wsutil with SIMD optimization */
#define HAVE_SSE4_2 1
/* Directory where extcap hooks reside */
#define EXTCAP_DIR "/usr/local/lib/wireshark/extcap"
/* Define to 1 if we want to enable plugins */
#define HAVE_PLUGINS 1
/* Define to 1 if we check hf conflict */
/* #undef ENABLE_CHECK_FILTER */
/* Link Wireshark libraries statically */
/* #undef ENABLE_STATIC */
/* Enable AirPcap */
/* #undef HAVE_AIRPCAP */
/* Define to 1 if you have the <alloca.h> header file. */
/* #undef HAVE_ALLOCA_H */
/* Define to 1 if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1
/* Define to 1 if you have the `bpf_image' function. */
#define HAVE_BPF_IMAGE 1
/* Define to use c-ares library */
/* #undef HAVE_C_ARES */
/* Define to 1 if you have the `dladdr' function. */
/* #undef HAVE_DLADDR */
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to use the MaxMind DB library */
/* #undef HAVE_MAXMINDDB */
/* Define to 1 if you have the <ifaddrs.h> header file. */
#define HAVE_IFADDRS_H 1
/* Define to 1 if you have the `getexecname' function. */
/* #undef HAVE_GETEXECNAME */
/* Define to 1 if you have the `getifaddrs' function. */
#define HAVE_GETIFADDRS 1
/* Define if LIBSSH support is enabled */
/* #undef HAVE_LIBSSH */
/* Define if LIBSSH has ssh_userauth_agent() function */
/* #undef HAVE_SSH_USERAUTH_AGENT */
/* Define if you have the 'floorl' function. */
#define HAVE_FLOORL 1
/* Define if you have the 'lrint' function. */
#define HAVE_LRINT 1
/* Define to 1 if you have the getopt_long function. */
#define HAVE_GETOPT_LONG 1
/* Define to 1 if you have the <getopt.h> header file. */
#define HAVE_GETOPT_H 1
/* Define to 1 if you have the <grp.h> header file. */
#define HAVE_GRP_H 1
/* Define to use heimdal kerberos */
/* #undef HAVE_HEIMDAL_KERBEROS */
/* Define to 1 if you have the `inflatePrime' function. */
#define HAVE_INFLATEPRIME 1
/* Define to 1 if you have the `issetugid' function. */
/* #undef HAVE_ISSETUGID */
/* Define to use kerberos */
/* #undef HAVE_KERBEROS */
/* Define to use nghttp2 */
/* #undef HAVE_NGHTTP2 */
/* Define to use the libcap library */
/* #undef HAVE_LIBCAP */
/* Define to use GnuTLS library */
/* #undef HAVE_LIBGNUTLS */
/* Enable libnl support */
/* #undef HAVE_LIBNL */
/* libnl version 1 */
/* #undef HAVE_LIBNL1 */
/* libnl version 2 */
/* #undef HAVE_LIBNL2 */
/* libnl version 3 */
/* #undef HAVE_LIBNL3 */
/* Define to use libpcap library */
#define HAVE_LIBPCAP 1
/* Define to 1 if you have the `smi' library (-lsmi). */
/* #undef HAVE_LIBSMI */
/* Define to use zlib library */
#define HAVE_ZLIB 1
/* Define to use lz4 library */
/* #undef HAVE_LZ4 */
/* Define to use snappy library */
/* #undef HAVE_SNAPPY */
/* Define to 1 if you have the <linux/sockios.h> header file. */
#define HAVE_LINUX_SOCKIOS_H 1
/* Define to 1 if you have the <linux/if_bonding.h> header file. */
#define HAVE_LINUX_IF_BONDING_H 1
/* Define to use Lua */
/* #undef HAVE_LUA */
/* Define to 1 if you have the <lua.h> header file. */
/* #undef HAVE_LUA_H */
/* Define to 1 if you have the <memory.h> header file. */
/* #undef HAVE_MEMORY_H */
/* Define to use MIT kerberos */
/* #undef HAVE_MIT_KERBEROS */
/* Define to 1 if you have the `mkstemps' function. */
#define HAVE_MKSTEMPS 1
/* Define to 1 if you have the `mmap' function. */
/* #undef HAVE_MMAP */
/* Define to 1 if you have the `mprotect' function. */
/* #undef HAVE_MPROTECT */
/* Define to 1 if you have the <netdb.h> header file. */
#define HAVE_NETDB_H 1
/* Define to 1 if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1
/* nl80211.h is new enough */
/* #undef HAVE_NL80211 */
/* SET_CHANNEL is supported */
/* #undef HAVE_NL80211_CMD_SET_CHANNEL */
/* SPLIT_WIPHY_DUMP is supported */
/* #undef HAVE_NL80211_SPLIT_WIPHY_DUMP */
/* VHT_CAPABILITY is supported */
/* #undef HAVE_NL80211_VHT_CAPABILITY */
/* Define to 1 if you have macOS frameworks */
/* #undef HAVE_MACOS_FRAMEWORKS */
/* Define to 1 if you have the macOS CFPropertyListCreateWithStream function */
/* #undef HAVE_CFPROPERTYLISTCREATEWITHSTREAM */
/* Define if pcap_breakloop is known */
#define HAVE_PCAP_BREAKLOOP 1
/* Define to 1 if you have the `pcap_create' function. */
#define HAVE_PCAP_CREATE 1
/* Define to 1 if the capture buffer size can be set. */
#define CAN_SET_CAPTURE_BUFFER_SIZE 1
/* Define to 1 if you have the `pcap_datalink_name_to_val' function. */
#define HAVE_PCAP_DATALINK_NAME_TO_VAL 1
/* Define to 1 if you have the `pcap_datalink_val_to_description' function. */
#define HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION 1
/* Define to 1 if you have the `pcap_datalink_val_to_name' function. */
#define HAVE_PCAP_DATALINK_VAL_TO_NAME 1
/* Define to 1 if you have the `pcap_findalldevs' function and a pcap.h that
declares pcap_if_t. */
#define HAVE_PCAP_FINDALLDEVS 1
/* Define to 1 if you have the `pcap_freecode' function. */
#define HAVE_PCAP_FREECODE 1
/* Define to 1 if you have the `pcap_free_datalinks' function. */
#define HAVE_PCAP_FREE_DATALINKS 1
/* Define to 1 if you have the `pcap_get_selectable_fd' function. */
#define HAVE_PCAP_GET_SELECTABLE_FD 1
/* Define to 1 if you have the `pcap_lib_version' function. */
#define HAVE_PCAP_LIB_VERSION 1
/* Define to 1 if you have the `pcap_list_datalinks' function. */
#define HAVE_PCAP_LIST_DATALINKS 1
/* Define to 1 if you have the `pcap_open' function. */
/* #undef HAVE_PCAP_OPEN */
/* Define to 1 if you have the `pcap_open_dead' function. */
#define HAVE_PCAP_OPEN_DEAD 1
/* Define to 1 if you have libpcap/WinPcap remote capturing support. */
/* #undef HAVE_PCAP_REMOTE */
/* Define to 1 if you have the `pcap_set_datalink' function. */
#define HAVE_PCAP_SET_DATALINK 1
/* Define to 1 if you have the `pcap_setsampling' function. */
/* #undef HAVE_PCAP_SETSAMPLING */
/* Define to 1 if you have the `pcap_set_tstamp_precision' function. */
#define HAVE_PCAP_SET_TSTAMP_PRECISION 1
/* Define to 1 if you have the `pcap_set_tstamp_type' function. */
#define HAVE_PCAP_SET_TSTAMP_TYPE 1
/* Define to 1 if you have the <pwd.h> header file. */
#define HAVE_PWD_H 1
/* Define to 1 if you have the optreset variable */
/* #undef HAVE_OPTRESET */
/* Define if sa_len field exists in struct sockaddr */
/* #undef HAVE_STRUCT_SOCKADDR_SA_LEN */
/* Define to 1 if you want to playing SBC by standalone BlueZ SBC library */
/* #undef HAVE_SBC */
/* Define to 1 if you have the SpanDSP library. */
/* #undef HAVE_SPANDSP */
/* Define to 1 if you have the bcg729 library. */
/* #undef HAVE_BCG729 */
/* Define to 1 if you have the lixbml2 library. */
/* #undef HAVE_LIBXML2 */
/* Define to 1 if you have the `setresgid' function. */
#define HAVE_SETRESGID 1
/* Define to 1 if you have the `setresuid' function. */
#define HAVE_SETRESUID 1
/* Define to 1 if you have the WinSparkle library */
/* #undef HAVE_SOFTWARE_UPDATE */
/* Define if you have the 'strptime' function. */
#define HAVE_STRPTIME 1
/* Define to 1 if `st_birthtime' is a member of `struct stat'. */
/* #undef HAVE_STRUCT_STAT_ST_BIRTHTIME */
/* Define if st_flags field exists in struct stat */
/* #undef HAVE_STRUCT_STAT_ST_FLAGS */
/* Define to 1 if `__st_birthtime' is a member of `struct stat'. */
/* #undef HAVE_STRUCT_STAT___ST_BIRTHTIME */
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/sockio.h> header file. */
/* #undef HAVE_SYS_SOCKIO_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/utsname.h> header file. */
#define HAVE_SYS_UTSNAME_H 1
/* Define to 1 if you have the <sys/wait.h> header file. */
#define HAVE_SYS_WAIT_H 1
/* Define if tm_zone field exists in struct tm */
#define HAVE_STRUCT_TM_TM_ZONE 1
/* Define if tzname array exists */
#define HAVE_TZNAME 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Name of package */
/* #undef PACKAGE */
/* Define to the address where bug reports for this package should be sent. */
/* #undef PACKAGE_BUGREPORT */
/* Define to the full name of this package. */
/* #undef PACKAGE_NAME */
/* Define to the full name and version of this package. */
/* #undef PACKAGE_STRING */
/* Define to the one symbol short name of this package. */
/* #undef PACKAGE_TARNAME */
/* Define to the version of this package. */
/* #undef PACKAGE_VERSION */
/* Support for pcapng */
#define PCAP_NG_DEFAULT 1
/* Define if we are using version of of the Portaudio library API */
/* #undef PORTAUDIO_API_1 */
/* Define if we have QtMultimedia */
#define QT_MULTIMEDIA_LIB 1
/* Define if we have QtMacExtras */
/* #undef QT_MACEXTRAS_LIB */
/* Define if we have QtWinExtras */
/* #undef QT_WINEXTRAS_LIB */
/* Build androiddump with libpcap instead of wireshark stuff */
/* #undef ANDROIDDUMP_USE_LIBPCAP */
/* Large file support */
/* #undef _LARGEFILE_SOURCE */
/* #undef _LARGEFILE64_SOURCE */
/* #undef _LARGE_FILES */
/* #undef _FILE_OFFSET_BITS */
/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
`char[]'. */
/* Note: not use in the code */
/* #undef YYTEXT_POINTER */
#if defined(_WIN32)
/*
* Make sure everyone is using the same API and that it's sufficient
* for our needs.
* This should match the following:
* - The <compatibility><application> section in image\wireshark.exe.manifest.in
* - The GetWindowsVersion parts of packaging\nsis\wireshark.nsi
* - The VersionNT parts of packaging\wix\Prerequisites.wxi
*/
# if defined(NTDDI_VERSION)
# error NTDDI_VERSION already defined.
# endif
# define NTDDI_VERSION NTDDI_WIN7
# if defined(_WIN32_WINNT)
# error _WIN32_WINNT already defined.
# endif
# define _WIN32_WINNT _WIN32_WINNT_WIN7
/* WpdPack/INclude/pcap/pcap.h checks for "#if defined(WIN32)" */
# ifndef WIN32
# define WIN32 1
# endif
# if !defined(QT_VERSION) || !defined(_SSIZE_T_DEFINED)
typedef int ssize_t;
# endif
/*
* Flex (v 2.5.35) uses this symbol to "exclude" unistd.h
*/
# define YY_NO_UNISTD_H
# define strncasecmp strnicmp
# define popen _popen
# define pclose _pclose
# ifndef __STDC__
# define __STDC__ 0
# endif
/* Use Unicode in Windows runtime functions. */
# define UNICODE 1
# define _UNICODE 1
# define NEED_STRPTIME_H 1
#endif
#if defined(__APPLE__)
/* This is to trigger the integration of objective-c
* code builds for removing unnecessary menu entries
* in 10.12 > and Qt 5.3 >
*/
# define CMAKE_BUILD 1
#endif
#endif /* __CONFIG_H__ */
================================================
FILE: BinUtils/TRCToCap/include/pcapio.h
================================================
/* pcapio.h
* Declarations of our own routines for writing libpcap files.
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* Derived from code in the Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
/* Writing pcap files */
/** Write the file header to a dump file.
Returns TRUE on success, FALSE on failure.
Sets "*err" to an error code, or 0 for a short write, on failure*/
extern gboolean
libpcap_write_file_header(FILE* pfile, int linktype, int snaplen,
gboolean ts_nsecs, guint64 *bytes_written, int *err);
/** Write a record for a packet to a dump file.
Returns TRUE on success, FALSE on failure. */
extern gboolean
libpcap_write_packet(FILE* pfile,
time_t sec, guint32 usec,
guint32 caplen, guint32 len,
const guint8 *pd,
guint64 *bytes_written, int *err);
/* Writing pcapng files */
/* Write a pre-formatted pcapng block */
extern gboolean
pcapng_write_block(FILE* pfile,
const guint8 *data,
guint32 block_total_length,
guint64 *bytes_written,
int *err);
/** Write a section header block (SHB)
*
*/
extern gboolean
pcapng_write_session_header_block(FILE* pfile, /**< Write information */
const char *comment, /**< Comment on the section, Optinon 1 opt_comment
* A UTF-8 string containing a comment that is associated to the current block.
*/
const char *hw, /**< HW, Optinon 2 shb_hardware
* An UTF-8 string containing the description of the hardware used to create this section.
*/
const char *os, /**< Operating system name, Optinon 3 shb_os
* An UTF-8 string containing the name of the operating system used to create this section.
*/
const char *appname, /**< Application name, Optinon 4 shb_userappl
* An UTF-8 string containing the name of the application used to create this section.
*/
guint64 section_length, /**< Length of section */
guint64 *bytes_written, /**< Number of written bytes */
int *err /**< Error type */
);
extern gboolean
pcapng_write_interface_description_block(FILE* pfile,
const char *comment, /* OPT_COMMENT 1 */
const char *name, /* IDB_NAME 2 */
const char *descr, /* IDB_DESCRIPTION 3 */
const char *filter, /* IDB_FILTER 11 */
const char *os, /* IDB_OS 12 */
int link_type,
int snap_len,
guint64 *bytes_written,
guint64 if_speed, /* IDB_IF_SPEED 8 */
guint8 tsresol, /* IDB_TSRESOL 9 */
int *err);
extern gboolean
pcapng_write_interface_statistics_block(FILE* pfile,
guint32 interface_id,
guint64 *bytes_written,
const char *comment, /* OPT_COMMENT 1 */
guint64 isb_starttime, /* ISB_STARTTIME 2 */
guint64 isb_endtime, /* ISB_ENDTIME 3 */
guint64 isb_ifrecv, /* ISB_IFRECV 4 */
guint64 isb_ifdrop, /* ISB_IFDROP 5 */
int *err);
extern gboolean
pcapng_write_enhanced_packet_block(FILE* pfile,
const char *comment,
time_t sec, guint32 usec,
guint32 caplen, guint32 len,
guint32 interface_id,
guint ts_mul,
const guint8 *pd,
guint32 flags,
guint64 *bytes_written,
int *err);
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
================================================
FILE: BinUtils/TRCToCap/src/TRCToCap.cpp
================================================
//============================================================================
// Name : TRCToCap.cpp
// Author : Fernando Ámez García
// Version :
// Copyright :
// Description : A tool to convert TRC files to CAP files so that it can be analyzed by wireshark
//============================================================================
extern "C" {
#include <stdio.h>
#include <getopt.h>
#include <glib.h>
#include <pcapio.h> //To write cap files
}
#include <iostream>
#include <TRCReader.h> //To read TRC files
#define CAN_LINKTYPE 0xE3
#define CAN_ID_LENGTH 4
#define LENGTH_LENGTH 1
#define RESERVED_LENGTH 3
using namespace Can;
int main(int argc, char **argv) {
//Get options
int c;
std::string input, output;
static struct option long_options[] =
{
{"input", required_argument, NULL, 'i'},
{"output", required_argument, NULL, 'o'},
{NULL, 0, NULL, 0}
};
while (1)
{
c = getopt_long (argc, argv, "i:o:",
long_options, NULL);
/* Detect the end of the options. */
if (c == -1)
break;
switch (c)
{
case 'i':
input = optarg;
break;
case 'o':
output = optarg;
break;
default:
break;
}
}
if(input.empty()) {
std::cerr << "No input specified" << std::endl;
return -1;
}
if(output.empty()) {
std::cerr << "No output specified" << std::endl;
return -1;
}
TRCReader trcReader;
if(!trcReader.loadFile(input)) {
std::cerr << "TRC file is corrupted or not readable by " << argv[0] << std::endl;
return -2;
}
if(trcReader.getNumberOfFrames() == 0) {
std::cerr << "TRC file is empty" << std::endl;
return -3;
}
std::cout << "TRC file loaded" << std::endl;
FILE *fd = fopen(output.c_str(), "wb");
if(!fd) {
std::cerr << "Output file could not be open" << std::endl;
}
std::cout << "Cap file open" << std::endl;
guint64 bytes_written;
int err;
std::pair<u64, CanFrame> pairTStampFrame;
libpcap_write_file_header(fd, CAN_LINKTYPE, 0xFFFF, TRUE, &bytes_written, &err);
std::cout << "Header written" << std::endl;
int progress = 0, oldProgress = 0;
//Iterate over the frames
do {
trcReader.readNextCanFrame();
pairTStampFrame = trcReader.getLastCanFrame();
u64 timeStamp = pairTStampFrame.first;
const CanFrame& frame = pairTStampFrame.second;
size_t length = CAN_ID_LENGTH + LENGTH_LENGTH + RESERVED_LENGTH + frame.getData().size();
std::string data;
//Add the ID
data += (((frame.getId() >> 24) & 0xFF) | (frame.isExtendedFormat() ? 0x80 : 0x00)); //Extended flag present?
data += ((frame.getId() >> 16) & 0xFF);
data += ((frame.getId() >> 8) & 0xFF);
data += (frame.getId() & 0xFF);
//Add the length
data += frame.getData().size();
//Add the reserved characters
data += (char)0;
data += (char)0;
data += (char)0;
//Append the DLC of the frame
data += frame.getData();
libpcap_write_packet(fd, timeStamp / 1000000, timeStamp % 1000000, length, length, (const guint8 *)(data.c_str()),
&bytes_written, &err);
progress = 100 * trcReader.getCurrentPos() / trcReader.getNumberOfFrames();
if(progress != oldProgress) {
std::cout << "Progress: " << progress << " %" << std::endl;
}
oldProgress = progress;
} while(trcReader.getCurrentPos() < trcReader.getNumberOfFrames() - 1);
fclose(fd);
std::cout << "Cap file correctly generated" << std::endl;
}
================================================
FILE: BinUtils/TRCToCap/src/pcapio.c
================================================
/* pcapio.c
* Our own private code for writing libpcap files when capturing.
*
* We have these because we want a way to open a stream for output given
* only a file descriptor. libpcap 0.9[.x] has "pcap_dump_fopen()", which
* provides that, but
*
* 1) earlier versions of libpcap doesn't have it
*
* and
*
* 2) WinPcap doesn't have it, because a file descriptor opened
* by code built for one version of the MSVC++ C library
* can't be used by library routines built for another version
* (e.g., threaded vs. unthreaded).
*
* Libpcap's pcap_dump() also doesn't return any error indications.
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* Derived from code in the Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef _WIN32
#include <Windows.h>
#endif
#include <glib.h>
#include "pcapio.h"
/* Magic numbers in "libpcap" files.
"libpcap" file records are written in the byte order of the host that
writes them, and the reader is expected to fix this up.
PCAP_MAGIC is the magic number, in host byte order; PCAP_SWAPPED_MAGIC
is a byte-swapped version of that.
PCAP_NSEC_MAGIC is for Ulf Lamping's modified "libpcap" format,
which uses the same common file format as PCAP_MAGIC, but the
timestamps are saved in nanosecond resolution instead of microseconds.
PCAP_SWAPPED_NSEC_MAGIC is a byte-swapped version of that. */
#define PCAP_MAGIC 0xa1b2c3d4
#define PCAP_SWAPPED_MAGIC 0xd4c3b2a1
#define PCAP_NSEC_MAGIC 0xa1b23c4d
#define PCAP_SWAPPED_NSEC_MAGIC 0x4d3cb2a1
/* "libpcap" file header. */
struct pcap_hdr {
guint32 magic; /* magic number */
guint16 version_major; /* major version number */
guint16 version_minor; /* minor version number */
gint32 thiszone; /* GMT to local correction */
guint32 sigfigs; /* accuracy of timestamps */
guint32 snaplen; /* max length of captured packets, in octets */
guint32 network; /* data link type */
};
/* "libpcap" record header. */
struct pcaprec_hdr {
guint32 ts_sec; /* timestamp seconds */
guint32 ts_usec; /* timestamp microseconds (nsecs for PCAP_NSEC_MAGIC) */
guint32 incl_len; /* number of octets of packet saved in file */
guint32 orig_len; /* actual length of packet */
};
/* Magic numbers in ".pcapng" files.
*
* .pcapng file records are written in the byte order of the host that
* writes them, and the reader is expected to fix this up.
* PCAPNG_MAGIC is the magic number, in host byte order;
* PCAPNG_SWAPPED_MAGIC is a byte-swapped version of that.
*/
#define PCAPNG_MAGIC 0x1A2B3C4D
#define PCAPNG_SWAPPED_MAGIC 0xD4C3B2A1
/* Currently we are only supporting the initial version of
the file format. */
#define PCAPNG_MAJOR_VERSION 1
#define PCAPNG_MINOR_VERSION 0
/* Section Header Block without options and trailing Block Total Length */
struct shb {
guint32 block_type;
guint32 block_total_length;
guint32 byte_order_magic;
guint16 major_version;
guint16 minor_version;
guint64 section_length;
};
#define SECTION_HEADER_BLOCK_TYPE 0x0A0D0D0A
/* Interface Description Block without options and trailing Block Total Length */
struct idb {
guint32 block_type;
guint32 block_total_length;
guint16 link_type;
guint16 reserved;
guint32 snap_len;
};
#define INTERFACE_DESCRIPTION_BLOCK_TYPE 0x00000001
/* Interface Statistics Block without actual packet, options, and trailing
Block Total Length */
struct isb {
guint32 block_type;
guint32 block_total_length;
guint32 interface_id;
guint32 timestamp_high;
guint32 timestamp_low;
};
#define INTERFACE_STATISTICS_BLOCK_TYPE 0x00000005
/* Enhanced Packet Block without actual packet, options, and trailing
Block Total Length */
struct epb {
guint32 block_type;
guint32 block_total_length;
guint32 interface_id;
guint32 timestamp_high;
guint32 timestamp_low;
guint32 captured_len;
guint32 packet_len;
};
#define ENHANCED_PACKET_BLOCK_TYPE 0x00000006
struct option {
guint16 type;
guint16 value_length;
};
#define OPT_ENDOFOPT 0
#define OPT_COMMENT 1
#define EPB_FLAGS 2
#define SHB_HARDWARE 2 /* currently not used */
#define SHB_OS 3
#define SHB_USERAPPL 4
#define IDB_NAME 2
#define IDB_DESCRIPTION 3
#define IDB_IF_SPEED 8
#define IDB_TSRESOL 9
#define IDB_FILTER 11
#define IDB_OS 12
#define ISB_STARTTIME 2
#define ISB_ENDTIME 3
#define ISB_IFRECV 4
#define ISB_IFDROP 5
#define ISB_FILTERACCEPT 6
#define ISB_OSDROP 7
#define ISB_USRDELIV 8
#define ADD_PADDING(x) ((((x) + 3) >> 2) << 2)
/* Write to capture file */
static gboolean
write_to_file(FILE* pfile, const guint8* data, size_t data_length,
guint64 *bytes_written, int *err)
{
size_t nwritten;
nwritten = fwrite(data, data_length, 1, pfile);
if (nwritten != 1) {
if (ferror(pfile)) {
*err = errno;
} else {
*err = 0;
}
return FALSE;
}
(*bytes_written) += data_length;
return TRUE;
}
/* Writing pcap files */
/* Write the file header to a dump file.
Returns TRUE on success, FALSE on failure.
Sets "*err" to an error code, or 0 for a short write, on failure*/
gboolean
libpcap_write_file_header(FILE* pfile, int linktype, int snaplen, gboolean ts_nsecs, guint64 *bytes_written, int *err)
{
struct pcap_hdr file_hdr;
file_hdr.magic = ts_nsecs ? PCAP_NSEC_MAGIC : PCAP_MAGIC;
/* current "libpcap" format is 2.4 */
file_hdr.version_major = 2;
file_hdr.version_minor = 4;
file_hdr.thiszone = 0; /* XXX - current offset? */
file_hdr.sigfigs = 0; /* unknown, but also apparently unused */
file_hdr.snaplen = snaplen;
file_hdr.network = linktype;
return write_to_file(pfile, (const guint8*)&file_hdr, sizeof(file_hdr), bytes_written, err);
}
/* Write a record for a packet to a dump file.
Returns TRUE on success, FALSE on failure. */
gboolean
libpcap_write_packet(FILE* pfile,
time_t sec, guint32 usec,
guint32 caplen, guint32 len,
const guint8 *pd,
guint64 *bytes_written, int *err)
{
struct pcaprec_hdr rec_hdr;
rec_hdr.ts_sec = (guint32)sec; /* Y2.038K issue in pcap format.... */
rec_hdr.ts_usec = usec;
rec_hdr.incl_len = caplen;
rec_hdr.orig_len = len;
if (!write_to_file(pfile, (const guint8*)&rec_hdr, sizeof(rec_hdr), bytes_written, err))
return FALSE;
return write_to_file(pfile, pd, caplen, bytes_written, err);
}
/* Writing pcapng files */
static guint32
pcapng_count_string_option(const char *option_value)
{
if ((option_value != NULL) && (strlen(option_value) > 0) && (strlen(option_value) < G_MAXUINT16)) {
/* There's a value to write; get its length */
return (guint32)(sizeof(struct option) +
(guint16)ADD_PADDING(strlen(option_value)));
}
return 0; /* nothing to write */
}
static gboolean
pcapng_write_string_option(FILE* pfile,
guint16 option_type, const char *option_value,
guint64 *bytes_written, int *err)
{
size_t option_value_length;
struct option option;
const guint32 padding = 0;
if (option_value == NULL)
return TRUE; /* nothing to write */
option_value_length = strlen(option_value);
if ((option_value_length > 0) && (option_value_length < G_MAXUINT16)) {
/* something to write */
option.type = option_type;
option.value_length = (guint16)option_value_length;
if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
return FALSE;
if (!write_to_file(pfile, (const guint8*)option_value, (int) option_value_length, bytes_written, err))
return FALSE;
if (option_value_length % 4) {
if (!write_to_file(pfile, (const guint8*)&padding, 4 - option_value_length % 4, bytes_written, err))
return FALSE;
}
}
return TRUE;
}
/* Write a pre-formatted pcapng block directly to the output file */
gboolean
pcapng_write_block(FILE* pfile,
const guint8 *data,
guint32 length,
guint64 *bytes_written,
int *err)
{
guint32 block_length, end_lenth;
/* Check
* - length and data are aligned to 4 bytes
* - block_total_length field is the same at the start and end of the block
*
* The block_total_length is not checked against the provided length but
* getting the trailing block_total_length from the length argument gives
* us an implicit check of correctness without needing to do an endian swap
*/
if (((length & 3) != 0) || (((gintptr)data & 3) != 0)) {
return FALSE;
}
memcpy(&block_length, data+sizeof(guint32), sizeof(guint32));
memcpy(&end_lenth, data+length-sizeof(guint32), sizeof(guint32));
if (block_length != end_lenth) {
return FALSE;
}
return write_to_file(pfile, data, length, bytes_written, err);
}
gboolean
pcapng_write_session_header_block(FILE* pfile,
const char *comment,
const char *hw,
const char *os,
const char *appname,
guint64 section_length,
guint64 *bytes_written,
int *err)
{
struct shb shb;
struct option option;
guint32 block_total_length;
guint32 options_length;
/* Size of base header */
block_total_length = sizeof(struct shb) +
sizeof(guint32);
options_length = 0;
options_length += pcapng_count_string_option(comment);
options_length += pcapng_count_string_option(hw);
options_length += pcapng_count_string_option(os);
options_length += pcapng_count_string_option(appname);
/* If we have options add size of end-of-options */
if (options_length != 0) {
options_length += (guint32)sizeof(struct option);
}
block_total_length += options_length;
/* write shb header */
shb.block_type = SECTION_HEADER_BLOCK_TYPE;
shb.block_total_length = block_total_length;
shb.byte_order_magic = PCAPNG_MAGIC;
shb.major_version = PCAPNG_MAJOR_VERSION;
shb.minor_version = PCAPNG_MINOR_VERSION;
shb.section_length = section_length;
if (!write_to_file(pfile, (const guint8*)&shb, sizeof(struct shb), bytes_written, err))
return FALSE;
if (!pcapng_write_string_option(pfile, OPT_COMMENT, comment,
bytes_written, err))
return FALSE;
if (!pcapng_write_string_option(pfile, SHB_HARDWARE, hw,
bytes_written, err))
return FALSE;
if (!pcapng_write_string_option(pfile, SHB_OS, os,
bytes_written, err))
return FALSE;
if (!pcapng_write_string_option(pfile, SHB_USERAPPL, appname,
bytes_written, err))
return FALSE;
if (options_length != 0) {
/* write end of options */
option.type = OPT_ENDOFOPT;
option.value_length = 0;
if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
return FALSE;
}
/* write the trailing block total length */
return write_to_file(pfile, (const guint8*)&block_total_length, sizeof(guint32), bytes_written, err);
}
gboolean
pcapng_write_interface_description_block(FILE* pfile,
const char *comment, /* OPT_COMMENT 1 */
const char *name, /* IDB_NAME 2 */
const char *descr, /* IDB_DESCRIPTION 3 */
const char *filter, /* IDB_FILTER 11 */
const char *os, /* IDB_OS 12 */
int link_type,
int snap_len,
guint64 *bytes_written,
guint64 if_speed, /* IDB_IF_SPEED 8 */
guint8 tsresol, /* IDB_TSRESOL 9 */
int *err)
{
struct idb idb;
struct option option;
guint32 block_total_length;
guint32 options_length;
const guint32 padding = 0;
block_total_length = (guint32)(sizeof(struct idb) + sizeof(guint32));
options_length = 0;
/* 01 - OPT_COMMENT */
options_length += pcapng_count_string_option(comment);
/* 02 - IDB_NAME */
options_length += pcapng_count_string_option(name);
/* 03 - IDB_DESCRIPTION */
options_length += pcapng_count_string_option(descr);
/* 08 - IDB_IF_SPEED */
if (if_speed != 0) {
options_length += (guint32)(sizeof(struct option) +
sizeof(guint64));
}
/* 09 - IDB_TSRESOL */
if (tsresol != 0) {
options_length += (guint32)(sizeof(struct option) +
sizeof(struct option));
}
/* 11 - IDB_FILTER */
if ((filter != NULL) && (strlen(filter) > 0) && (strlen(filter) < G_MAXUINT16)) {
/* No, this isn't a string, it has an extra type byte */
options_length += (guint32)(sizeof(struct option) +
(guint16)(ADD_PADDING(strlen(filter)+ 1)));
}
/* 12 - IDB_OS */
options_length += pcapng_count_string_option(os);
/* If we have options add size of end-of-options */
if (options_length != 0) {
options_length += (guint32)sizeof(struct option);
}
block_total_length += options_length;
/* write block header */
idb.block_type = INTERFACE_DESCRIPTION_BLOCK_TYPE;
idb.block_total_length = block_total_length;
idb.link_type = link_type;
idb.reserved = 0;
idb.snap_len = snap_len;
if (!write_to_file(pfile, (const guint8*)&idb, sizeof(struct idb), bytes_written, err))
return FALSE;
/* 01 - OPT_COMMENT - write comment string if applicable */
if (!pcapng_write_string_option(pfile, OPT_COMMENT, comment,
bytes_written, err))
return FALSE;
/* 02 - IDB_NAME - write interface name string if applicable */
if (!pcapng_write_string_option(pfile, IDB_NAME, name,
bytes_written, err))
return FALSE;
/* 03 - IDB_DESCRIPTION */
/* write interface description string if applicable */
if (!pcapng_write_string_option(pfile, IDB_DESCRIPTION, descr,
bytes_written, err))
return FALSE;
/* 08 - IDB_IF_SPEED */
if (if_speed != 0) {
option.type = IDB_IF_SPEED;
option.value_length = sizeof(guint64);
if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
return FALSE;
if (!write_to_file(pfile, (const guint8*)&if_speed, sizeof(guint64), bytes_written, err))
return FALSE;
}
/* 09 - IDB_TSRESOL */
if (tsresol != 0) {
option.type = IDB_TSRESOL;
option.value_length = sizeof(guint8);
if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
return FALSE;
if (!write_to_file(pfile, (const guint8*)&tsresol, sizeof(guint8), bytes_written, err))
return FALSE;
if (!write_to_file(pfile, (const guint8*)&padding, 3, bytes_written, err))
return FALSE;
}
/* 11 - IDB_FILTER - write filter string if applicable
* We only write version 1 of the filter, pcapng string
*/
if ((filter != NULL) && (strlen(filter) > 0) && (strlen(filter) < G_MAXUINT16 - 1)) {
option.type = IDB_FILTER;
option.value_length = (guint16)(strlen(filter) + 1 );
if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
return FALSE;
/* The first byte of the Option Data keeps a code of the filter used, 0 = lipbpcap filter string */
if (!write_to_file(pfile, (const guint8*)&padding, 1, bytes_written, err))
return FALSE;
if (!write_to_file(pfile, (const guint8*)filter, (int) strlen(filter), bytes_written, err))
return FALSE;
if ((strlen(filter) + 1) % 4) {
if (!write_to_file(pfile, (const guint8*)&padding, 4 - (strlen(filter) + 1) % 4, bytes_written, err))
return FALSE;
}
}
/* 12 - IDB_OS - write os string if applicable */
if (!pcapng_write_string_option(pfile, IDB_OS, os,
bytes_written, err))
return FALSE;
if (options_length != 0) {
/* write end of options */
option.type = OPT_ENDOFOPT;
option.value_length = 0;
if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
return FALSE;
}
/* write the trailing Block Total Length */
return write_to_file(pfile, (const guint8*)&block_total_length, sizeof(guint32), bytes_written, err);
}
/* Write a record for a packet to a dump file.
Returns TRUE on success, FALSE on failure. */
gboolean
pcapng_write_enhanced_packet_block(FILE* pfile,
const char *comment,
time_t sec, guint32 usec,
guint32 caplen, guint32 len,
guint32 interface_id,
guint ts_mul,
const guint8 *pd,
guint32 flags,
guint64 *bytes_written,
int *err)
{
struct epb epb;
struct option option;
guint32 block_total_length;
guint64 timestamp;
guint32 options_length;
const guint32 padding = 0;
guint8 buff[8];
guint8 i;
guint8 pad_len = 0;
block_total_length = (guint32)(sizeof(struct epb) +
ADD_PADDING(caplen) +
sizeof(guint32));
options_length = 0;
options_length += pcapng_count_string_option(comment);
if (flags != 0) {
options_length += (guint32)(sizeof(struct option) +
sizeof(guint32));
}
/* If we have options add size of end-of-options */
if (options_length != 0) {
options_length += (guint32)sizeof(struct option);
}
block_total_length += options_length;
timestamp = (guint64)sec * ts_mul + (guint64)usec;
epb.block_type = ENHANCED_PACKET_BLOCK_TYPE;
epb.block_total_length = block_total_length;
epb.interface_id = interface_id;
epb.timestamp_high = (guint32)((timestamp>>32) & 0xffffffff);
epb.timestamp_low = (guint32)(timestamp & 0xffffffff);
epb.captured_len = caplen;
epb.packet_len = len;
if (!write_to_file(pfile, (const guint8*)&epb, sizeof(struct epb), bytes_written, err))
return FALSE;
if (!write_to_file(pfile, pd, caplen, bytes_written, err))
return FALSE;
/* Use more efficient write in case of no "extras" */
if(caplen % 4) {
pad_len = 4 - (caplen % 4);
}
/*
* If we have no options to write, just write out the padding and
* the block total length with one fwrite() call.
*/
if(!comment && flags == 0 && options_length==0){
/* Put padding in the buffer */
for (i = 0; i < pad_len; i++) {
buff[i] = 0;
}
/* Write the total length */
memcpy(&buff[i], &block_total_length, sizeof(guint32));
i += sizeof(guint32);
return write_to_file(pfile, (const guint8*)&buff, i, bytes_written, err);
}
if (pad_len) {
if (!write_to_file(pfile, (const guint8*)&padding, pad_len, bytes_written, err))
return FALSE;
}
if (!pcapng_write_string_option(pfile, OPT_COMMENT, comment,
bytes_written, err))
return FALSE;
if (flags != 0) {
option.type = EPB_FLAGS;
option.value_length = sizeof(guint32);
if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
return FALSE;
if (!write_to_file(pfile, (const guint8*)&flags, sizeof(guint32), bytes_written, err))
return FALSE;
}
if (options_length != 0) {
/* write end of options */
option.type = OPT_ENDOFOPT;
option.value_length = 0;
if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
return FALSE;
}
return write_to_file(pfile, (const guint8*)&block_total_length, sizeof(guint32), bytes_written, err);
}
gboolean
pcapng_write_interface_statistics_block(FILE* pfile,
guint32 interface_id,
guint64 *bytes_written,
const char *comment, /* OPT_COMMENT 1 */
guint64 isb_starttime, /* ISB_STARTTIME 2 */
guint64 isb_endtime, /* ISB_ENDTIME 3 */
guint64 isb_ifrecv, /* ISB_IFRECV 4 */
guint64 isb_ifdrop, /* ISB_IFDROP 5 */
int *err)
{
struct isb isb;
#ifdef _WIN32
FILETIME now;
#else
struct timeval now;
#endif
struct option option;
guint32 block_total_length;
guint32 options_length;
guint64 timestamp;
#ifdef _WIN32
/*
* Current time, represented as 100-nanosecond intervals since
* January 1, 1601, 00:00:00 UTC.
*
* I think DWORD might be signed, so cast both parts of "now"
* to guint32 so that the sign bit doesn't get treated specially.
*
* Windows 8 provides GetSystemTimePreciseAsFileTime which we
* might want to use instead.
*/
GetSystemTimeAsFileTime(&now);
timestamp = (((guint64)(guint32)now.dwHighDateTime) << 32) +
(guint32)now.dwLowDateTime;
/*
* Convert to same thing but as 1-microsecond, i.e. 1000-nanosecond,
* intervals.
*/
timestamp /= 10;
/*
* Subtract difference, in microseconds, between January 1, 1601
* 00:00:00 UTC and January 1, 1970, 00:00:00 UTC.
*/
timestamp -= G_GUINT64_CONSTANT(11644473600000000);
#else
/*
* Current time, represented as seconds and microseconds since
* January 1, 1970, 00:00:00 UTC.
*/
gettimeofday(&now, NULL);
/*
* Convert to delta in microseconds.
*/
timestamp = (guint64)(now.tv_sec) * 1000000 +
(guint64)(now.tv_usec);
#endif
block_total_length = (guint32)(sizeof(struct isb) + sizeof(guint32));
options_length = 0;
if (isb_ifrecv != G_MAXUINT64) {
options_length += (guint32)(sizeof(struct option) +
sizeof(guint64));
}
if (isb_ifdrop != G_MAXUINT64) {
options_length += (guint32)(sizeof(struct option) +
sizeof(guint64));
}
/* OPT_COMMENT */
options_length += pcapng_count_string_option(comment);
if (isb_starttime !=0) {
options_length += (guint32)(sizeof(struct option) +
sizeof(guint64)); /* ISB_STARTTIME */
}
if (isb_endtime !=0) {
options_length += (guint32)(sizeof(struct option) +
sizeof(guint64)); /* ISB_ENDTIME */
}
/* If we have options add size of end-of-options */
if (options_length != 0) {
options_length += (guint32)sizeof(struct option);
}
block_total_length += options_length;
isb.block_type = INTERFACE_STATISTICS_BLOCK_TYPE;
isb.block_total_length = block_total_length;
isb.interface_id = interface_id;
isb.timestamp_high = (guint32)((timestamp>>32) & 0xffffffff);
isb.timestamp_low = (guint32)(timestamp & 0xffffffff);
if (!write_to_file(pfile, (const guint8*)&isb, sizeof(struct isb), bytes_written, err))
return FALSE;
/* write comment string if applicable */
if (!pcapng_write_string_option(pfile, OPT_COMMENT, comment,
bytes_written, err))
return FALSE;
if (isb_starttime !=0) {
guint32 high, low;
option.type = ISB_STARTTIME;
option.value_length = sizeof(guint64);
high = (guint32)((isb_starttime>>32) & 0xffffffff);
low = (guint32)(isb_starttime & 0xffffffff);
if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
return FALSE;
if (!write_to_file(pfile, (const guint8*)&high, sizeof(guint32), bytes_written, err))
return FALSE;
if (!write_to_file(pfile, (const guint8*)&low, sizeof(guint32), bytes_written, err))
return FALSE;
}
if (isb_endtime !=0) {
guint32 high, low;
option.type = ISB_ENDTIME;
option.value_length = sizeof(guint64);
high = (guint32)((isb_endtime>>32) & 0xffffffff);
low = (guint32)(isb_endtime & 0xffffffff);
if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
return FALSE;
if (!write_to_file(pfile, (const guint8*)&high, sizeof(guint32), bytes_written, err))
return FALSE;
if (!write_to_file(pfile, (const guint8*)&low, sizeof(guint32), bytes_written, err))
return FALSE;
}
if (isb_ifrecv != G_MAXUINT64) {
option.type = ISB_IFRECV;
option.value_length = sizeof(guint64);
if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
return FALSE;
if (!write_to_file(pfile, (const guint8*)&isb_ifrecv, sizeof(guint64), bytes_written, err))
return FALSE;
}
if (isb_ifdrop != G_MAXUINT64) {
option.type = ISB_IFDROP;
option.value_length = sizeof(guint64);
if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
return FALSE;
if (!write_to_file(pfile, (const guint8*)&isb_ifdrop, sizeof(guint64), bytes_written, err))
return FALSE;
}
if (options_length != 0) {
/* write end of options */
option.type = OPT_ENDOFOPT;
option.value_length = 0;
if (!write_to_file(pfile, (const guint8*)&option, sizeof(struct option), bytes_written, err))
return FALSE;
}
return write_to_file(pfile, (const guint8*)&block_total_length, sizeof(guint32), bytes_written, err);
}
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* vi: set shiftwidth=8 tabstop=8 expandtab:
* :indentSize=8:tabSize=8:noTabs=true:
*/
================================================
FILE: BinUtils/j1939AddrClaim/CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.5)
project(j1939AddrClaim)
add_executable(j1939AddrClaim
j1939AddrClaim.cpp
)
target_include_directories(j1939AddrClaim
PUBLIC
include ${J1939_SOURCE_DIR}/include ${Can_SOURCE_DIR}/include ${Common_SOURCE_DIR}/include ${J1939AddressClaimer_SOURCE_DIR}/include
)
target_link_libraries(j1939AddrClaim
PUBLIC
J1939 Can J1939AddressClaimer rt jsoncpp -rdynamic
)
install (TARGETS j1939AddrClaim
DESTINATION bin)
================================================
FILE: BinUtils/j1939AddrClaim/Readme.md
================================================
Used to simulate the Address Claiming Process
Usage:
```bash
./j1939AddrClaim -n <identity_number> -i <interface> -p "[<preferred_addr1>,<preferred_addr2>,<preferred_addr3>,...]"
```
================================================
FILE: BinUtils/j1939AddrClaim/j1939AddrClaim.cpp
================================================
/*
* AddressClaim.cpp
*
* Created on: Jan 13, 2019
* Author: famez
*/
#ifndef DATABASE_PATH
#define DATABASE_PATH "/etc/j1939/frames.json"
#endif
#include <getopt.h>
#include <memory>
#include <chrono>
#include <thread>
#include <json/json.h>
#include <CanEasy.h>
#include <J1939Factory.h>
#include <AddressClaimer.h>
#define BAUD_250K 250000
namespace J1939 {
class MyAddressClaimer : public AddressClaimer {
private:
std::shared_ptr<Can::ICanSender> mSender;
protected:
void onSrcAddrChanged(u8 newAddr) {
if(newAddr == J1939_INVALID_ADDRESS) {
std::cout << "No address!!!" << std::endl;
} else {
std::cout << "New address obtained " << static_cast<u32>(newAddr) << std::endl;
}
}
void sendFrame(const J1939Frame& frame) {
size_t length = frame.getDataLength();
u32 id;
u8 *buff = new u8[length];
frame.encode(id, buff, length);
Can::CanFrame canFrame;
//J1939 data is always transmitted in extended format
canFrame.setExtendedFormat(true);
//Set identifier
canFrame.setId(id);
//Set data
std::string data;
data.append((char*)buff, length);
canFrame.setData(data);
mSender->sendFrameOnce(canFrame);
delete[] buff;
}
public:
MyAddressClaimer(const EcuName& name, const std::queue<u8>& preferred, std::shared_ptr<Can::ICanSender> sender) : AddressClaimer(name, preferred), mSender(sender) {}
~MyAddressClaimer() {}
};
}
using namespace J1939;
using namespace Can;
using namespace Utils;
std::unique_ptr<MyAddressClaimer> addresClaimer;
void onRcv(const CanFrame& frame, const TimeStamp&, const std::string& interface, void*);
bool onTimeout();
int
main (int argc, char **argv)
{
//Get options
int c;
std::string interface;
std::string preferredAddr;
std::string idNumberStr;
static struct option long_options[] =
{
{"interface", required_argument, NULL, 'i'},
{"preferred", required_argument, NULL, 'p'},
{"identity_number", required_argument, NULL, 'n'},
{NULL, 0, NULL, 0}
};
while (1)
{
c = getopt_long (argc, argv, "i:p:n:",
long_options, NULL);
/* Detect the end of the options. */
if (c == -1)
break;
switch (c)
{
case 'i':
interface = optarg;
break;
case 'p':
preferredAddr = optarg;
break;
case 'n':
idNumberStr = optarg;
break;
default:
break;
}
}
u32 idNumber;
try {
idNumber = std::stoul(idNumberStr);
} catch (std::invalid_argument& ) {
std::cerr << "identity_number is not a number..." << std::endl;
return -1;
}
CanEasy::initialize(BAUD_250K, onRcv, onTimeout);
std::set<std::string> interfaces = CanEasy::getCanIfaces();
if(interfaces.find(interface) == interfaces.end()) {
std::cerr << "Interface not available" << std::endl;
std::cerr << "Interfaces: " << std::endl;
for(auto iter = interfaces.begin(); iter != interfaces.end(); ++iter) {
std::cerr << *iter << std::endl;
}
return -2;
}
std::shared_ptr<ICanSender> sender = CanEasy::getSender(interface);
if(!sender) {
std::cerr << "Cannot send through the interface" << std::endl;
return -3;
}
EcuName name;
name.setIdNumber(idNumber);
Json::Value addresses;
Json::CharReaderBuilder builder;
Json::CharReader *jSonReader = builder.newCharReader();
std::string errs;
if(!jSonReader->parse(preferredAddr.c_str(), preferredAddr.c_str() + preferredAddr.size(), &addresses, &errs)) {
std::cerr << "No json format for preferred" << std::endl;
return -4;
}
std::queue<u8> preferred;
if(!addresses.isArray()) {
std::cerr << "preferred is not an array" << std::endl;
return -5;
}
for(unsigned int i = 0; i < addresses.size(); ++i) {
if(addresses[i].isUInt() && (addresses[i].asUInt() == addresses[i].asUInt() & J1939_SRC_ADDR_MASK)) {
preferred.push(addresses[i].asUInt());
}
}
if(addresses.empty()) {
std::cerr << "No addresses passed to argument preferred" << std::endl;
return -6;
}
addresClaimer = std::unique_ptr<MyAddressClaimer>(new MyAddressClaimer(name, preferred, sender));
const CanSniffer& canSniffer = CanEasy::getSniffer();
canSniffer.sniff(1000);
return 0;
}
void onRcv(const CanFrame& frame, const TimeStamp&, const std::string& interface, void*) {
std::unique_ptr<J1939Frame> j1939Frame = J1939Factory::getInstance().
getJ1939Frame(frame.getId(), (const u8*)(frame.getData().c_str()), frame.getData().size());
if(j1939Frame) {
if(addresClaimer->toBeHandled(*j1939Frame)) {
addresClaimer->receive(*j1939Frame);
}
}
}
bool onTimeout() {
return true;
}
================================================
FILE: BinUtils/j1939AddressMapper/CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.5)
project(j1939AddressMapper)
add_executable(j1939AddressMapper
j1939AddressMapper.cpp
)
target_include_directories(j1939AddressMapper
PUBLIC
include ${J1939_SOURCE_DIR}/include ${Can_SOURCE_DIR}/include ${Common_SOURCE_DIR}/include
)
target_link_libraries(j1939AddressMapper
PUBLIC
J1939 Can rt jsoncpp -rdynamic
)
install (TARGETS j1939AddressMapper
DESTINATION bin)
================================================
FILE: BinUtils/j1939AddressMapper/Readme.md
================================================
To detect the ECUs in the Can Network, their Sources Address and Ecu Names
Usage:
```bash
j1939AddressMapper
```
================================================
FILE: BinUtils/j1939AddressMapper/j1939AddressMapper.cpp
================================================
/*
* j1939AddressMapper.cpp
*
* Created on: Jan 25, 2019
* Author: famez
*/
#ifndef DATABASE_PATH
#define DATABASE_PATH "/etc/j1939/frames.json"
#endif
#include <memory>
#include <chrono>
#include <thread>
#include <json/json.h>
#include <CanEasy.h>
#include <J1939Factory.h>
#include <Frames/RequestFrame.h>
#include <Addressing/AddressClaimFrame.h>
#define BAUD_250K 250000
using namespace J1939;
using namespace Can;
using namespace Utils;
std::set<EcuName> names;
void onRcv(const CanFrame& frame, const TimeStamp&, const std::string& interface, void*);
bool onTimeout();
int
main (int argc, char **argv)
{
//Initialize can
CanEasy::initialize(BAUD_250K, onRcv, onTimeout);
const std::set<std::string>& ifaces = CanEasy::getInitializedCanIfaces();
if(ifaces.empty()) {
std::cerr << "No interfaces initialized" << std::endl;
return 1;
}
/*
* Create request frame to request the PGN corresponding to the Address Claim
*/
RequestFrame reqFrame(ADDRESS_CLAIM_PGN);
reqFrame.setSrcAddr(J1939_INVALID_ADDRESS);
reqFrame.setDstAddr(J1939_BROADCAST_ADDRESS);
CanFrame canFrame;
size_t length = reqFrame.getDataLength();
u32 id;
u8 *buff = new u8[length];
reqFrame.encode(id, buff, length);
//J1939 data is always transmitted in extended format
canFrame.setExtendedFormat(true);
//Set identifier
canFrame.setId(id);
//Set data
std::string data;
data.append((char*)buff, length);
canFrame.setData(data);
delete[] buff;
for(auto iface = ifaces.begin(); iface != ifaces.end(); ++iface) {
std::shared_ptr<ICanSender> sender = CanEasy::getSender(*iface);
sender->sendFrame(canFrame, 1000); //Send the frame every second
}
CanSniffer& canSniffer = CanEasy::getSniffer();
std::set<CanFilter> filters;
//Receive only frames with the ADDRESS_CLAIM_PGN
CanFilter filter(ADDRESS_CLAIM_PGN << J1939_PGN_OFFSET
, ((J1939_PDU_FMT_MASK << J1939_PDU_FMT_OFFSET) << J1939_PGN_OFFSET), true, false);
filters.insert(filter);
canSniffer.setFilters(filters);
std::cout << "Interface\tSource Address\tIN\tMC\tEI\tFI"
"\tF\tVS\tVSI\tIG\tAAC" << std::endl << std::endl;
canSniffer.sniff(1000);
return 0;
}
void onRcv(const CanFrame& frame, const TimeStamp&, const std::string& interface, void*) {
std::unique_ptr<J1939Frame> j1939Frame = J1939Factory::getInstance().
getJ1939Frame(frame.getId(), (const u8*)(frame.getData().c_str()), frame.getData().size());
if(j1939Frame && j1939Frame->getPGN() == ADDRESS_CLAIM_PGN) {
AddressClaimFrame *addrClaimFrame = static_cast<AddressClaimFrame*>(j1939Frame.get());
const EcuName &name = addrClaimFrame->getEcuName();
if(names.find(name) == names.end()) { //Check if we have already shown the frame
std::cout << interface << '\t' << '\t' << static_cast<u32>(j1939Frame->getSrcAddr()) << '\t' << '\t' << name.getIdNumber() << '\t'
<< static_cast<u32>(name.getManufacturerCode()) << '\t' << static_cast<u32>(name.getEcuInstance()) << '\t'
<< static_cast<u32>(name.getFunctionInstance()) << '\t'
<< static_cast<u32>(name.getFunction()) << '\t' << static_cast<u32>(name.getVehicleSystem()) << '\t'
<< static_cast<u32>(name.getVehicleSystemInstance()) << '\t'
<< static_cast<u32>(name.getIndustryGroup()) << '\t' << (name.isArbitraryAddressCapable() ? "Address Capable" : "No address capable") << std::endl;
names.insert(name);
}
}
}
bool onTimeout() {
return true;
}
================================================
FILE: BinUtils/j1939Decoder/.cproject
================================================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.1861074874">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.1861074874" moduleId="org.eclipse.cdt.core.settings" name="Debug">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.debug.1861074874" name="Debug" parent="cdt.managedbuild.config.gnu.exe.debug">
<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.1861074874." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.41297790" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.13883019" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
<builder buildPath="${workspace_loc:/j1939Encoder}/Debug" id="cdt.managedbuild.target.gnu.builder.exe.debug.292210226" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.1889993658" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1543165477" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.728948622" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.exe.debug.option.debugging.level.1882222916" name="Debug Level" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.include.paths.472704876" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value=""${workspace_loc:/J1939}""/>
<listOptionValue builtIn="false" value=""${workspace_loc:/Common}""/>
</option>
<option id="gnu.cpp.compiler.option.dialect.std.497669387" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" value="gnu.cpp.compiler.dialect.c++11" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.269450500" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.2037226843" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.exe.debug.option.optimization.level.542025320" name="Optimization Level" superClass="gnu.c.compiler.exe.debug.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.exe.debug.option.debugging.level.2029967667" name="Debug Level" superClass="gnu.c.compiler.exe.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<option id="gnu.c.compiler.option.dialect.std.1946434284" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" value="gnu.c.compiler.dialect.default" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.590237086" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.415907468" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.280908848" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
<option id="gnu.cpp.link.option.libs.114738467" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="J1939"/>
</option>
<option id="gnu.cpp.link.option.paths.1184525820" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" valueType="libPaths">
<listOptionValue builtIn="false" value=""${workspace_loc:/J1939/Debug}""/>
</option>
<option id="gnu.cpp.link.option.flags.784585019" name="Linker flags" superClass="gnu.cpp.link.option.flags" value="-rdynamic" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1601160676" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.1117711655" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1493080121" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="cdt.managedbuild.config.gnu.exe.release.1740876316">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.release.1740876316" moduleId="org.eclipse.cdt.core.settings" name="Release">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.release.1740876316" name="Release" parent="cdt.managedbuild.config.gnu.exe.release">
<folderInfo id="cdt.managedbuild.config.gnu.exe.release.1740876316." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.1331478304" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.release">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.release.1241502955" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.release"/>
<builder buildPath="${workspace_loc:/j1939Encoder}/Release" id="cdt.managedbuild.target.gnu.builder.exe.release.1330907601" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.release"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.1987214766" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.488040747" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release">
<option id="gnu.cpp.compiler.exe.release.option.optimization.level.1122889053" name="Optimization Level" superClass="gnu.cpp.compiler.exe.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
<option id="gnu.cpp.compiler.exe.release.option.debugging.level.1443593314" name="Debug Level" superClass="gnu.cpp.compiler.exe.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.971739607" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.1153223945" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release">
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.exe.release.option.optimization.level.1534366200" name="Optimization Level" superClass="gnu.c.compiler.exe.release.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.exe.release.option.debugging.level.2082751618" name="Debug Level" superClass="gnu.c.compiler.exe.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.821619422" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.release.1830197936" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.1189973488" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release">
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1531319115" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.49455526" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.118685022" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="j1939Encoder.cdt.managedbuild.target.gnu.exe.1404579584" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.1740876316;cdt.managedbuild.config.gnu.exe.release.1740876316.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.488040747;cdt.managedbuild.tool.gnu.cpp.compiler.input.971739607">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.1740876316;cdt.managedbuild.config.gnu.exe.release.1740876316.;cdt.managedbuild.tool.gnu.c.compiler.exe.release.1153223945;cdt.managedbuild.tool.gnu.c.compiler.input.821619422">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1861074874;cdt.managedbuild.config.gnu.exe.debug.1861074874.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1543165477;cdt.managedbuild.tool.gnu.cpp.compiler.input.269450500">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1861074874;cdt.managedbuild.config.gnu.exe.debug.1861074874.;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.2037226843;cdt.managedbuild.tool.gnu.c.compiler.input.590237086">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Release">
<resource resourceType="PROJECT" workspacePath="/j1939Encoder"/>
</configuration>
<configuration configurationName="Debug">
<resource resourceType="PROJECT" workspacePath="/j1939Encoder"/>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
</cproject>
================================================
FILE: BinUtils/j1939Decoder/.settings/org.eclipse.cdt.codan.core.prefs
================================================
eclipse.preferences.version=1
org.eclipse.cdt.codan.checkers.errnoreturn=Warning
org.eclipse.cdt.codan.checkers.errnoreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},implicit\=>false}
org.eclipse.cdt.codan.checkers.errreturnvalue=Error
org.eclipse.cdt.codan.checkers.errreturnvalue.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.checkers.noreturn=Error
org.eclipse.cdt.codan.checkers.noreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},implicit\=>false}
org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=-Error
org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=-Error
org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=Warning
org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem=Error
org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=Warning
org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},no_break_comment\=>"no break",last_case_param\=>false,empty_case_param\=>false}
org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning
org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},unknown\=>false,exceptions\=>()}
org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=-Error
org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization=Warning
org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},skip\=>true}
org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=-Error
org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=-Error
org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.InvalidArguments=-Error
org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=-Error
org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=-Error
org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=-Error
org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=-Error
org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info
org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},pattern\=>"^[a-z]",macro\=>true,exceptions\=>()}
org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=Warning
org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.OverloadProblem=-Error
org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=-Error
org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=-Error
org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=-Warning
org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=-Warning
org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=Warning
org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true,exceptions\=>()}
org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=Warning
org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},paramNot\=>false}
org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=Warning
org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},else\=>false,afterelse\=>false}
org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=-Error
org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=Warning
org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true}
org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=Warning
org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true}
org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=Warning
org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true,exceptions\=>("@(\#)","$Id")}
org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=-Error
org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
useParentScope=false
================================================
FILE: BinUtils/j1939Decoder/.settings/org.eclipse.cdt.core.prefs
================================================
eclipse.preferences.version=1
environment/project/cdt.managedbuild.config.gnu.exe.debug.1861074874/append=true
environment/project/cdt.managedbuild.config.gnu.exe.debug.1861074874/appendContributed=true
================================================
FILE: BinUtils/j1939Decoder/CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.5)
project(j1939Decoder)
add_executable(j1939Decoder
src/j1939Decoder.cpp
)
target_include_directories(j1939Decoder
PUBLIC
include ${J1939_SOURCE_DIR}/include ${Common_SOURCE_DIR}/include
)
target_link_libraries(j1939Decoder
PUBLIC
J1939
)
install (TARGETS j1939Decoder
DESTINATION bin)
================================================
FILE: BinUtils/j1939Decoder/README.md
================================================
To decode frames. For example:
```bash
./j1939Decoder --id 00febffe --data "00 c4 00 00 00 00 00 00"
Name PGN Source Address PDU format Priority
EBC2 FEBF FE 2 0
SPN 904: Front Axe Speed -> Value: 196 kph
SPN 905: Relative Speed; Front Axle, Left Wheel -> Value: -7 kph
SPN 906: Relative Speed; Front Axle, Right Wheel -> Value: -7 kph
SPN 907: Relative Speed; Rear Axle 1, Left Wheel -> Value: -7 kph
SPN 908: Relative Speed; Rear Axle 1, Right Wheel -> Value: -7 kph
SPN 909: Relative Speed; Rear Axle 2, Left Wheel -> Value: -7 kph
SPN 910: Relative Speed; Rear Axle 2, Right Wheel -> Value: -7 kph
```
================================================
FILE: BinUtils/j1939Decoder/src/j1939Decoder.cpp
================================================
//============================================================================
// Name : j1939Encoder.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <regex.h>
#include <iterator>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string.h>
#include <Types.h>
#include <memory>
//J1939 libraries
#include <J1939DataBase.h>
#include <J1939Factory.h>
#include <GenericFrame.h>
#include <Transport/BAM/BamReassembler.h>
#ifndef DATABASE_PATH
#define DATABASE_PATH "/etc/j1939/frames.json"
#endif
using namespace J1939;
std::basic_string<u8> decodeData(const std::string &data) {
//At this point we have the options, we build regular expressions to validate them
//Data regex will match the format XXXXXXXXXXXXXXXX where X is an hexadecimal digit.
std::string dataRegex("^(\\s{0,1}([0-9a-fA-F][0-9a-fA-F]))+$");
regex_t regex;
int retVal;
retVal = regcomp(®ex, dataRegex.c_str(), REG_EXTENDED);
if (retVal) {
std::cerr << "Problem compiling reg expression for data" << std::endl;
exit(2);
}
retVal = regexec(®ex, data.c_str(), 0, NULL, 0);
if (retVal == REG_NOMATCH) {
std::cerr << "The introduced data has wrong format..." << std::endl;
exit(3);
}
else if(retVal){
std::cerr << "Problem executing reg expression for ID"<< std::endl;
exit(2);
}
regfree(®ex);
std::stringstream dataStream;
dataStream << std::hex << data;
//String where to store the data of the frame ready to be passed to the frame factory with the correct format.
std::basic_string<u8> formattedData;
std::string token;
do {
dataStream >> std::ws >> std::setw(2) >> token;
formattedData.push_back(static_cast<u8>(std::stoul(token, nullptr, 16)));
} while(!(dataStream.rdstate() & std::ios_base::eofbit)); //End of file
return formattedData;
}
u32 decodeID(const std::string& id) {
//ID regex will match the format XXXXXXXX where X is an hexadecimal digit. The id in extended format in CAN has a length of 29 bits. It must be at least 8 digits.
std::string idRegex("^[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]"
"[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]$");
regex_t regex;
int retVal;
retVal = regcomp(®ex, idRegex.c_str(), 0);
if (retVal) {
std::cerr << "Problem compiling reg expression for ID"<< std::endl;
exit(2);
}
retVal = regexec(®ex, id.c_str(), 0, NULL, 0);
if (retVal == REG_NOMATCH) {
std::cerr << "The introduced ID has wrong format..." << std::endl;
exit(3);
}
else if(retVal){
std::cerr << "Problem executing reg expression for ID" << std::endl;
exit(2);
}
regfree(®ex);
//Convert the introduced string to a number to be interpreted by the frame factory when using it.
u32 formattedId = std::stoul(id, nullptr, 16);
return formattedId;
}
int
main (int argc, char **argv)
{
int c;
//In case of BAM decoding
BamReassembler reassembler;
std::string id, data;
static struct option long_options[] =
{
{"id", required_argument, NULL, 'i'},
{"data", required_argument, NULL, 'd'},
{NULL, 0, NULL, 0}
};
while (1)
{
c = getopt_long (argc, argv, "i:d:",
long_options, NULL);
/* Detect the end of the options. */
if (c == -1)
break;
switch (c)
{
case 'i':
id = optarg;
break;
case 'd':
data = optarg;
break;
}
}
if(id.empty() || data.empty()) {
std::cerr << "Id or data of J1939 frame not specified";
exit(1);
}
//At this point we have the options, we build regular expressions to validate them
u32 formattedId = decodeID(id);
std::basic_string<u8> formattedData = decodeData(data);
if(!J1939Factory::getInstance().registerDatabaseFrames(DATABASE_PATH)) {
std::cerr << "Database not found in " << DATABASE_PATH << std::endl;
exit(4);
}
//The rest is easy
std::unique_ptr<J1939Frame> frame;
try {
frame = J1939Factory::getInstance().getJ1939Frame(formattedId,
formattedData.c_str(), formattedData.size());
} catch(J1939DecodeException& e) {
std::cerr << "Error decoding frame: " << e.getMessage() << std::endl;
exit(6);
}
if(!frame) {
std::cerr << "Frame not identified" << std::endl;
exit(5);
}
//Check if it is part of the BAM protocol
if(reassembler.toBeHandled(*frame)) {
std::cout << "Bam frame detected... Waiting for the rest of frames to be received..." << std::endl;
//First frame should be CM frame, otherwise, it is likely that we remain in the loop forever
reassembler.handleFrame(*frame);
while(!reassembler.reassembledFramesPending()) {
std::cout << "Id: " << std::endl;
std::getline(std::cin, id);
formattedId = decodeID(id);
std::cout << "Data: " << std::endl;
std::getline(std::cin, data);
formattedData = decodeData(data);
try {
frame = J1939Factory::getInstance().getJ1939Frame(formattedId,
formattedData.c_str(), formattedData.size());
if(frame) {
reassembler.handleFrame(*frame);
} else {
std::cerr << "Frame not identified" << std::endl;
exit(5);
}
} catch(J1939DecodeException& e) {
std::cerr << "Error decoding frame: " << e.getMessage() << std::endl;
exit(6);
}
}
frame = reassembler.dequeueReassembledFrame();
//Check again if the frame is well decoded
if(!frame) {
std::cerr << "Frame not identified" << std::endl;
exit(5);
}
}
std::cout << frame->toString();
exit (0);
}
================================================
FILE: BinUtils/j1939Sender/CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.5)
project(j1939Sender)
add_executable(j1939Sender
src/j1939Sender.cpp
)
target_include_directories(j1939Sender
PUBLIC
include ${J1939_SOURCE_DIR}/include ${Can_SOURCE_DIR}/include ${Common_SOURCE_DIR}/include
)
target_link_libraries(j1939Sender
PUBLIC
J1939 Can rt -rdynamic
)
install (TARGETS j1939Sender
DESTINATION bin)
================================================
FILE: BinUtils/j1939Sender/README.md
================================================
A CLI utility to create frames, configure them and send them through the CAN bus.
```bash
j1939Sender
Version: 1.0
Interfaces:
can0
Initialized: can0
j1939Sender>
j1939Sender> create frame name: my_frame title: CCVS
Frame correctly created
j1939Sender> create frame name: my_frame1 pgn: FEF1
Frame correctly created
j1939Sender> list frames
my_frame: 00fef1fe ff ff ff ff ff ff ff ff
my_frame1: 00fef1fe ff ff ff ff ff ff ff ff
set frame my_frame period: 100
set frame my_frame source: 45
set frame my_frame spn: 84 value: 15
print frame my_frame
send frame my_frame interface: can0
```
# Commands
## Create frame
```bash
create frame name: <name> title: <pgn_name>
create frame name: <name> pgn: <pgn_number>
```
Example:
```bash
create frame name: my_frame title: CCVS
create frame name: my_frame1 pgn: FEF1
```
## List frames
```bash
list frames
```
## Set frame values
```bash
set frame <name> [period: <millis>] [source: <src_addr_hex>] [source: <src_addr_hex>] [priority: <prio>] [spn: <spn> value: <value>] [spn: <spn> value: <value>]...
```
Example:
```bash
set frame my_frame period: 100 source: 2C
set frame my_frame spn: 84 value: 15 priority: 4
```
## Print frame
```bash
print frame <name>
```
Example:
```bash
print frame my_frame
```
## List interfaces
```bash
list interfaces
```
## Send frame
```bash
send frame <name> interface: <interface>
```
Example:
```bash
send frame my_frame interface: can0
```
## Unsend frame
```bash
unsend frame <name> [interface: <interface>]
```
Example:
```bash
unsend frame my_frame
unsend frame my_frame interface: can0
```
## List TTS
```bash
list tts all
list tts number: <number>
```
Example:
```bash
list tts number: 18
```
## Set TTS
```bash
set tts number: <number> status: <status>
```
Example:
```bash
set tts number: 3 status: 2
```
## Send TTS
```bash
send tts interface: <interface> period: <millis>
```
Example:
```bash
send tts interface: can0 period: 4000
```
## Add dtc
```bash
add dtc <name> oc: <occurrence_code> fmi: <failure_mode_identidier> spn: <suspect_number_parameter>
```
Example:
```bash
create frame name: dm1 title: DM1
add dtc dm1 oc: 2 fmi: 6 spn: 84
```
## Set dtc
```bash
set dtc <name> <pos> oc: <occurrence_code> fmi: <failure_mode_identidier> spn: <suspect_number_parameter>
```
Example:
```bash
set dtc dm1 0 oc: 3 fmi: 5 spn: 84
```
## Delete dtc
```bash
delete dtc <name> <pos>
```
Example:
```bash
delete dtc dm1 0
```
## Quit
```bash
quit
```
================================================
FILE: BinUtils/j1939Sender/src/j1939Sender.cpp
================================================
//============================================================================
// Name : j1939Sender.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <getopt.h>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <list>
#include <sstream>
#include <iomanip>
#include <functional>
#include <stdlib.h>
#include <stdexcept>
//J1939 includes
#include <J1939Factory.h>
#include <J1939DataBase.h>
#include <GenericFrame.h>
#include <SPN/SPNNumeric.h>
#include <SPN/SPNStatus.h>
#include <SPN/SPNString.h>
#include <FMS/TellTale/FMS1Frame.h>
#include <Transport/BAM/BamFragmenter.h>
#include <Diagnosis/Frames/DM1.h>
//CAN includes
#include <CanEasy.h>
#define VERSION_STR "1.0"
//Bitrate for J1939 protocol
#define BAUD_250K 250000
#define SENDER_PROMPT "j1939Sender> "
#define CREATE_TOKEN "create"
#define QUIT_TOKEN "quit"
#define SEND_TOKEN "send"
#define UNSEND_TOKEN "unsend"
#define EXEC_TOKEN "exec"
#define LIST_TOKEN "list"
#define PRINT_TOKEN "print"
#define SET_TOKEN "set"
#define FRAME_TOKEN "frame"
#define FRAMES_TOKEN "frames"
#define COMMANDS_TOKEN "commands"
#define INTERFACE_TOKEN "interface"
#define INTERFACES_TOKEN "interfaces"
#define ADD_TOKEN "add"
#define CHANGE_TOKEN "change"
#define DELETE_TOKEN "delete"
#define DTC_TOKEN "dtc"
#define OC_TOKEN "oc"
#define FMI_TOKEN "fmi"
#define NAME_TOKEN "name"
#define PGN_TOKEN "pgn"
#define TITLE_TOKEN "title"
#define PRIORITY_TOKEN "priority"
#define SOURCE_TOKEN "source"
#define PERIOD_TOKEN "period"
#define SPN_TOKEN "spn"
#define VALUE_TOKEN "value"
#define VIN_TOKEN "vin"
#define TTS_TOKEN "tts"
#define TTS_NUMBER "number"
#define TTS_STATUS "status"
#define TTS_ALL "all"
#ifndef DATABASE_PATH
#define DATABASE_PATH "/etc/j1939/frames.json"
#endif
typedef std::function<void(const std::string&, const std::string&)> ParamParserFunc;
using namespace Can;
using namespace J1939;
class CommandHelper {
public:
typedef void (*CmdFunc)(void);
typedef void (*CmdFuncWithArgs)(std::list<std::string>);
private:
std::string mCommand;
CmdFunc mCmdFunc;
CmdFuncWithArgs mCmdFuncWithArgs;
std::vector<CommandHelper> mSubCommands;
public:
CommandHelper(const std::string& command = "") : mCommand(command), mCmdFunc(nullptr), mCmdFuncWithArgs(nullptr) {}
CommandHelper(const std::string& command, CmdFunc func) : mCommand(command), mCmdFunc(func), mCmdFuncWithArgs(nullptr) {}
CommandHelper(const std::string& command, CmdFuncWithArgs func) : mCommand(command), mCmdFunc(nullptr), mCmdFuncWithArgs(func) {}
CmdFunc getCmdFunc() const { return mCmdFunc; }
CmdFuncWithArgs getCmdFuncWithArgs() const { return mCmdFuncWithArgs; }
const std::string& getCommand() const { return mCommand; }
CommandHelper& addSubCommand(const CommandHelper& command) { mSubCommands.push_back(command); return *this; }
const std::vector<CommandHelper>& getSubCommands() const { return mSubCommands; }
};
//Command that will hold the other commands
CommandHelper baseCommand;
//Map of the created frames to be sent to the CAN interface
std::map<std::string, J1939Frame*> framesToSend;
//Map to specify the period for the different frames (in millis)
std::map<std::string, u32> framePeriods;
//Take all the tokens from a line (separated by spaces) and introduces them in the list
std::list<std::string> splitTokens(std::string);
//TTS
std::vector<FMS1Frame> fms1Frames;
u32 ttsPeriod;
bool silent;
void registerCommands();
const CommandHelper& findSubCommand(const CommandHelper&, std::list<std::string>&);
std::list<std::string> getSubCommandNames(const CommandHelper&);
void parseLine(const std::string& line);
//Functions to interpret the different commands
void parseSetFrameCommand(std::list<std::string> arguments);
void parseSetTTSCommand(std::list<std::string> arguments);
void parseListCommandsCommand();
void parseListTTSCommand(std::list<std::string> arguments);
void processCommandParameters(std::list<std::string> arguments, ParamParserFunc func);
void parsePrintFrameCommand(std::list<std::string> arguments);
void parseQuitCommand();
void parseCreateFrameCommand(std::list<std::string> arguments);
void parseListFramesCommand();
void parseListInterfacesCommand();
void parseSendFrameCommand(std::list<std::string> arguments);
void parseSendTTSCommand(std::list<std::string> arguments);
void parseUnsendTTSCommand();
void parseExecCommand(std::list<std::string> arguments);
void parseUnsendFrameCommand(std::list<std::string> arguments);
void parseAddDtcCommand(std::list<std::string> arguments);
void parseSetDtcCommand(std::list<std::string> arguments);
void parseDeleteDtcCommand(std::list<std::string> arguments);
bool parseDtcCommand(std::list<std::string> arguments, DTC& dtc);
std::vector<CanFrame> ttsFramesToCanFrames(const std::vector<FMS1Frame>& ttsFrames);
void execScript(const std::string& file);
void uninitializeVariables();
bool parseSetGenericParams(const std::string& name, J1939Frame* frame, const std::string& key, const std::string& value);
void sendFrameThroughInterface(const J1939Frame* frame, u32 period, const std::string& interface);
void unsendFrameThroughInterface(const J1939Frame* frame, const std::string& interface);
bool isFrameSent(const J1939Frame* frame, const std::string& interface);
int main(int argc, char **argv) {
//Get options
int c;
std::string file;
silent = false;
static struct option long_options[] =
{
{"file", required_argument, NULL, 'f'},
{"silent", no_argument, NULL, 's'},
{NULL, 0, NULL, 0}
};
while (1)
{
c = getopt_long (argc, argv, "f:s:",
long_options, NULL);
/* Detect the end of the options. */
if (c == -1)
break;
switch (c)
{
case 'f':
file = optarg;
break;
case 's':
silent = true;
break;
default:
break;
}
}
std::string line;
//Print the version
if(!silent) {
std::cout << "Version: " << VERSION_STR << std::endl;
}
//Register possible commands to execute by the user
registerCommands();
//Load database
J1939DataBase ddbb;
if(!ddbb.parseJsonFile(DATABASE_PATH)) {
switch (ddbb.getLastError()) {
case J1939DataBase::ERROR_FILE_NOT_FOUND:
std::cerr << "Json database not found in " DATABASE_PATH << std::endl;
break;
case J1939DataBase::ERROR_JSON_SYNTAX:
std::cerr << "Json file has syntax errors" << std::endl;
break;
case J1939DataBase::ERROR_UNEXPECTED_TOKENS:
std::cerr << "Json file has tokens not identified by the application" << std::endl;
break;
case J1939DataBase::ERROR_OUT_OF_RANGE:
std::cerr << "Json file has some values that exceed the permitted ranges" << std::endl;
break;
case J1939DataBase::ERROR_UNKNOWN_SPN_TYPE:
std::cerr << "Json file has undefined type for SPN" << std::endl;
break;
default:
std::cerr << "Something in the database is not working" << std::endl;
break;
}
return -1;
}
//Register frames in the factory
const std::vector<GenericFrame>& frames = ddbb.getParsedFrames();
for(auto iter = frames.begin(); iter != frames.end(); ++iter) {
J1939Factory::getInstance().registerFrame(*iter);
}
//Generate frames for the TTSs
fms1Frames.push_back(FMS1Frame(0));
fms1Frames.push_back(FMS1Frame(1));
fms1Frames.push_back(FMS1Frame(2));
fms1Frames.push_back(FMS1Frame(3));
//Determine the possible backends
std::set<std::string> ifaces = CanEasy::getCanIfaces();
if(!silent) std::cout << "Interfaces: " << std::endl;
for(auto iter = ifaces.begin(); iter != ifaces.end(); ++iter) {
if(!silent) std::cout << *iter << " ";
}
if(!silent) std::cout << std::endl;
CanEasy::initialize(BAUD_250K);
ifaces = CanEasy::getInitializedCanIfaces();
if(!silent) std::cout << "Initialized: ";
for(auto iter = ifaces.begin(); iter != ifaces.end(); ++iter) {
if(!silent) std::cout << *iter << " ";
}
if(!silent) std::cout << std::endl;
//If any file is defined, first execute commands from it
if(!file.empty()) {
execScript(file);
}
//Read from standard input
if(!silent) std::cout << SENDER_PROMPT;
while (std::getline(std::cin, line)) {
parseLine(line);
if(!silent) std::cout << SENDER_PROMPT;
}
return 0;
}
void registerCommands() {
baseCommand.addSubCommand(
CommandHelper(CREATE_TOKEN).addSubCommand(CommandHelper(FRAME_TOKEN, parseCreateFrameCommand))
).addSubCommand(
CommandHelper(QUIT_TOKEN, parseQuitCommand)
).addSubCommand(
CommandHelper(LIST_TOKEN).addSubCommand(CommandHelper(FRAMES_TOKEN, parseListFramesCommand)).
addSubCommand(CommandHelper(COMMANDS_TOKEN, parseListCommandsCommand)).
addSubCommand(CommandHelper(INTERFACES_TOKEN, parseListInterfacesCommand)).
addSubCommand(CommandHelper(TTS_TOKEN, parseListTTSCommand))
).addSubCommand(
CommandHelper(PRINT_TOKEN).addSubCommand(CommandHelper(FRAME_TOKEN, parsePrintFrameCommand))
).addSubCommand(
CommandHelper(SET_TOKEN).addSubCommand(CommandHelper(FRAME_TOKEN, parseSetFrameCommand)).
addSubCommand(CommandHelper(TTS_TOKEN, parseSetTTSCommand)).
addSubCommand(CommandHelper(DTC_TOKEN, parseSetDtcCommand))
).addSubCommand(
CommandHelper(SEND_TOKEN).addSubCommand(CommandHelper(FRAME_TOKEN, parseSendFrameCommand)).
addSubCommand(CommandHelper(TTS_TOKEN, parseSendTTSCommand))
).addSubCommand(
CommandHelper(EXEC_TOKEN, parseExecCommand)
).addSubCommand(
CommandHelper(UNSEND_TOKEN).addSubCommand(CommandHelper(FRAME_TOKEN, parseUnsendFrameCommand)).
addSubCommand(CommandHelper(TTS_TOKEN, parseUnsendTTSCommand))
).addSubCommand(
CommandHelper(ADD_TOKEN).addSubCommand(CommandHelper(DTC_TOKEN, parseAddDtcCommand))
).addSubCommand(
CommandHelper(DELETE_TOKEN).addSubCommand(CommandHelper(DTC_TOKEN, parseDeleteDtcCommand))
);
}
void parseLine(const std::string& line) {
std::string command;
std::list<std::string> arguments;
if(line.empty()) {
return; //Nothing to do
}
//If there is the character #, omit every character until the end of line (including the # character)
size_t found = line.find_first_of('#');
if(found == 0) {
return;
}
std::list<std::string> tokens = splitTokens(line.substr(0, found));
const CommandHelper& cmd = findSubCommand(baseCommand, tokens);
if(cmd.getCmdFuncWithArgs() == nullptr && cmd.getCmdFunc() == nullptr) {
std::cerr << "This command does not exist" << std::endl;
return;
}
if(!tokens.empty() && cmd.getCmdFuncWithArgs()) {
(cmd.getCmdFuncWithArgs())(tokens);
} else if(tokens.empty() && cmd.getCmdFunc()) {
(cmd.getCmdFunc())();
} else {
std::cerr << "This command does " << (arguments.empty() ? "" : "not ") << "need arguments" << std::endl;
}
}
std::list<std::string> splitTokens(std::string arguments) {
std::list<std::string> retVal;
size_t startArgPos = 0, endArgPos = 0;
while(startArgPos != std::string::npos) {
endArgPos = arguments.find_first_of(' ', startArgPos);
if(endArgPos == std::string::npos) {
endArgPos = arguments.size();
}
retVal.push_back(arguments.substr(startArgPos, endArgPos - startArgPos));
startArgPos = arguments.find_first_not_of(' ', endArgPos);
}
return retVal;
}
//To have some introspection...
void parseListCommandsCommand() {
std::list<std::string> commands = getSubCommandNames(baseCommand);
for(auto iter = commands.begin(); iter != commands.end(); ++iter) {
std::cout << *iter << std::endl;
}
}
void parseCreateFrameCommand(std::list<std::string> arguments) {
std::string name;
std::string pgn;
std::string title;
auto func = [&name, &pgn, &title](const std::string& key, const std::string& value) {
if(key == NAME_TOKEN) {
name = value;
} else if(key == PGN_TOKEN) {
pgn = value;
} else if(key == TITLE_TOKEN) {
title = value;
}
};
processCommandParameters(arguments, func);
if(name.empty()) {
std::cerr << "No name defined for this frame" << std::endl;
return;
}
if(pgn.empty() == title.empty()) {
std::cerr << "Define either pgn or title of frame" << std::endl;
return;
}
if(framesToSend.find(name) != framesToSend.end()) {
std::cerr << "Name already in use..." << std::endl;
return;
}
std::unique_ptr<J1939Frame> frameToAdd(nullptr);
if(!title.empty()) { //Title was specified
frameToAdd = J1939Factory::getInstance().getJ1939Frame(title);
}
if(!pgn.empty()) { //PGN was defined
try {
u32 pgnNumber = std::stoul(pgn, nullptr, 16);
frameToAdd = J1939Factory::getInstance().getJ1939Frame(pgnNumber);
} catch (std::invalid_argument& e) {
std::cerr << "PGN is not a number..." << std::endl;
}
}
if(frameToAdd.get()) {
framesToSend[name] = frameToAdd.release();
std::cout << "Frame correctly created" << std::endl;
} else {
std::cerr << "Frame not recognized..." << std::endl;
}
}
void parseListFramesCommand() {
std::stringstream str;
for(auto iter = framesToSend.begin(); iter != framesToSend.end(); ++iter) {
J1939Frame* frame = iter->second;
size_t size = frame->getDataLength();
std::vector<std::string> txInterfaces;
//Add the given name when the frame was created
str << iter->first << ": ";
//Encode the frame to raw data
u32 id;
u8* buff = new u8[size];
try {
frame->encode(id, buff, size);
//Add identifier to the stream
str << std::setfill('0') << std::setw(8) << std::hex << static_cast<u32>(id) << " ";
//Add the raw data, but before, we format it
for(unsigned int i = 0; i < size; ++i) {
str << std::setfill('0') << std::setw(2) << std::hex << static_cast<u32>(buff[i]) << " ";
}
//Check if the frame is being sent through an interface
const std::set<std::string>& ifaces = CanEasy::getInitializedCanIfaces();
for(auto iter = ifaces.begin(); iter != ifaces.end(); ++iter) {
if(isFrameSent(frame, *iter)) {
txInterfaces.push_back(*iter);
}
}
} catch (J1939EncodeException& e) {
std::cerr << e.getMessage() << std::endl;
}
//Print period if defined
auto periodIter = framePeriods.find(iter->first);
if(periodIter != framePeriods.end()) {
str << " Period: " << std::dec << periodIter->second << " ms";
}
//Print if the frame is being sent
if(!txInterfaces.empty()) {
str << " Sent from: ";
for(auto iter = txInterfaces.begin(); iter != txInterfaces.end(); ++iter) {
str << *iter << " ";
}
}
str << std::endl;
delete[] buff;
}
std::cout << str.str();
}
void parseListTTSCommand(std::list<std::string> arguments) {
std::vector<u32> ids;
u8 number = 0;
auto paramParser = [&number](const std::string& key, const std::string& value) {
if(key == TTS_NUMBER) {
try {
u32 ttsNumber = std::stoul(value);
if(ttsNumber == (ttsNumber & 0xFF)) {
number = static_cast<u8>(ttsNumber);
} else {
std::cerr << "number out of range..." << std::endl;
}
} catch (std::invalid_argument&) {
std::cerr << "number is not a number..." << std::endl;
}
}
};
if(arguments.front() != TTS_ALL) {
processCommandParameters(arguments, paramParser);
}
bool somePrinted = false;
for(auto iter = fms1Frames.begin(); iter != fms1Frames.end(); ++iter) {
if(number == 0) {
somePrinted = true;
std::cout << iter->toString();
} else {
if(iter->hasTTS(number)) {
std::cout << iter->getTTS(number).toString();
somePrinted = true;
}
}
ids.push_back(iter->getIdentifier());
}
if(somePrinted) {
const std::set<std::string>& ifaces = CanEasy::getInitializedCanIfaces();
for(auto iter = ifaces.begin(); iter != ifaces.end(); ++iter) {
//Print the interface from which tts are sent
std::shared_ptr<ICanSender> sender = CanEasy::getSender(*iter);
if(sender->isSent(ids)) {
std::cout << "Sent from interface " << *iter << std::endl;
}
}
}
}
void parseUnsendTTSCommand() {
std::vector<u32> ids;
for(auto iter = fms1Frames.begin(); iter != fms1Frames.end(); ++iter) {
ids.push_back(iter->getIdentifier());
}
const std::set<std::string>& ifaces = CanEasy::getInitializedCanIfaces();
for(auto iter = ifaces.begin(); iter != ifaces.end(); ++iter) {
std::shared_ptr<ICanSender> sender = CanEasy::getSender(*iter);
sender->unSendFrames(ids);
}
}
void parseSendTTSCommand(std::list<std::string> arguments) {
std::string interface;
bool periodValid = false;
auto paramParser = [&interface, &periodValid](const std::string& key, const std::string& value) {
if(key == INTERFACE_TOKEN) {
const std::set<std::string>& ifaces = CanEasy::getInitializedCanIfaces();
for(auto iter = ifaces.begin(); iter != ifaces.end(); ++iter) {
if(*iter == value) {
interface = value;
return;
}
}
} else if(key == PERIOD_TOKEN) {
try {
ttsPeriod = std::stoul(value);
periodValid = true;
} catch (std::invalid_argument& e) {
std::cerr << "Period is not a number..." << std::endl;
}
}
};
processCommandParameters(arguments, paramParser);
if(!periodValid) {
std::cerr << "Period not defined..." << std::endl;
return;
}
if(interface.empty()) {
std::cerr << "Interface not defined or not initialized..." << std::endl;
return;
}
std::vector<CanFrame> frames = ttsFramesToCanFrames(fms1Frames);
std::shared_ptr<ICanSender> sender = CanEasy::getSender(interface);
sender->sendFrames(frames, ttsPeriod);
}
void parseSetTTSCommand(std::list<std::string> arguments) {
u8 number = 0xFF, status = 0xFF;
auto paramParser = [&number, &status](const std::string& key, const std::string& value) {
if(key == TTS_NUMBER) {
try {
u32 ttsNumber = std::stoul(value);
if(ttsNumber == (ttsNumber & 0xFF)) {
number = static_cast<u8>(ttsNumber);
} else {
std::cerr << "Number out of range..." << std::endl;
number = 0xFF;
}
} catch (std::invalid_argument&) {
std::cerr << "Number is not a number..." << std::endl;
number = 0xFF;
}
} else if(key == TTS_STATUS) {
try {
u32 ttsStatus = std::stoul(value);
if(ttsStatus == (ttsStatus & 0xFF)) {
status = static_cast<u8>(ttsStatus);
} else {
std::cerr << "Status out of range..." << std::endl;
status = 0xFF;
}
} catch (std::invalid_argument&) {
std::cerr << "Status is not a number..." << std::endl;
status = 0xFF;
}
}
};
processCommandParameters(arguments, paramParser);
if(number != 0xFF && status != 0xFF) {
bool ttsSet = false;
for(auto iter = fms1Frames.begin(); iter != fms1Frames.end(); ++iter) {
if(iter->hasTTS(number)) {
iter->setTTS(number, status);
if(!silent) std::cout << "TTS " << static_cast<u32>(number) << " set to " << TellTale::getSatusname(status) << std::endl;
ttsSet = true;
break;
}
}
if(!ttsSet) {
std::cerr << "TTS not found";
} else {
std::vector<u32> ids;
for(auto iter = fms1Frames.begin(); iter != fms1Frames.end(); ++iter) {
ids.push_back(iter->getIdentifier());
}
const std::set<std::string>& ifaces = CanEasy::getInitializedCanIfaces();
for(auto iter = ifaces.begin(); iter != ifaces.end(); ++iter) {
std::shared_ptr<ICanSender> sender = CanEasy::getSender(*iter);
if(sender->isSent(ids)) {
std::vector<CanFrame> frames = ttsFramesToCanFrames(fms1Frames);
sender->sendFrames(frames, ttsPeriod);
}
}
}
}
}
void parsePrintFrameCommand(std::list<std::string> arguments) {
std::string name = arguments.back();
auto frameIter = framesToSend.find(name);
if(frameIter != framesToSend.end()) {
std::cout << frameIter->second->toString() << std::endl;
} else {
std::cerr << "Frame not defined..." << std::endl;
}
}
void parseSetFrameCommand(std::list<std::string> arguments) {
std::string name = arguments.front();
arguments.pop_front();
auto frameIter = framesToSend.find(name);
if(frameIter == framesToSend.end()) {
std::cerr << "Frame not defined..." << std::endl;
return;
}
J1939Frame* frame = frameIter->second;
SPN* spn = nullptr;
auto paramParser = [name, &frame, &spn](const std::string& key, const std::string& value) {
if(key == SPN_TOKEN) { //Setting a SPN
if(!frame->isGenericFrame()) {
std::cerr << "This frame does not have standard SPNs..." << std::endl;
}
GenericFrame* genFrame = static_cast<GenericFrame*>(frame);
try {
u32 spnNumber = std::stoul(value);
if(!genFrame->hasSPN(spnNumber)) {
std::cerr << "This spn does not belong to the given frame..." << std::endl;
return;
}
spn = genFrame->getSPN(spnNumber);
} catch (std::invalid_argument& e) {
std::cerr << "spn is not a number..." << std::endl;
}
} else if(key == VALUE_TOKEN) { //The value used to set the SPN
if(!spn) {
std::cerr << "Not spn to which assign this value..." << std::endl;
return;
}
try {
switch(spn->getType()) {
case SPN::SPN_NUMERIC:
{
double valueNumber = std::stod(value);
SPNNumeric* spnNum = static_cast<SPNNumeric*>(spn);
if(spnNum->setFormattedValue(valueNumber)) {
std::cout << "Spn " << spn->getSpnNumber() << " from frame " << frame->getName() << " set to value " << spnNum->getFormattedValue() << std::endl;
}
} break;
case SPN::SPN_STATUS:
{
u32 valueNumber = std::stoul(value);
u8 status = static_cast<u8>(valueNumber);
if((status & 0xFF) == valueNumber) {
SPNStatus* spnStat = static_cast<SPNStatus*>(spn);
if(!spnStat->setValue(status)) {
std::cerr << "Value out of range" << std::endl;
} else {
std::cout << "SPN " << spn->getSpnNumber() << " set to (" << valueNumber << ") " << spnStat->getValueDescription(status) << std::endl;
}
} else {
std::cerr << "Value out of range" << std::endl;
}
} break;
case SPN::SPN_STRING:
{
SPNString* spnStr = static_cast<SPNString*>(spn);
spnStr->setValue(value);
} break;
default:
break;
}
} catch (std::invalid_argument& e) {
std::cerr << "value is not a number..." << std::endl;
}
spn = nullptr;
} else { //If we are not setting a SPN, maybe we are setting generic parameters of a frame...
//Parse generic parameters as the period to send the frames, the priority, the source address, dst address and so on
if(!parseSetGenericParams(name, frame, key, value)) {
//If this function returns false, it means that the given key is not a generic parameter, but it is particular of certain frame
std::cerr << "Unknown parameter..." << std::endl;
}
}
};
processCommandParameters(arguments, paramParser);
auto period = framePeriods.find(name);
if(period == framePeriods.end()) {
return;
}
u32 id;
size_t length = frame->getDataLength();
u8* buff = new u8[length];
frame->encode(id, buff, length);
CanFrame canFrame;
//J1939 data is always transmitted in extended format
canFrame.setExtendedFormat(true);
//Set identifier
canFrame.setId(id);
//Set data
std::string data;
data.append((char*)buff, length);
canFrame.setData(data);
delete[] buff;
//If the frame is being sent, refresh the information to the sender
const std::set<std::string>& ifaces = CanEasy::getInitializedCanIfaces();
for(auto iter = ifaces.begin(); iter != ifaces.end(); ++iter) {
std::shared_ptr<ICanSender> sender = CanEasy::getSender(*iter);
if(isFrameSent(frame, *iter)) {
sendFrameThroughInterface(frame, period->second, *iter);
}
}
}
void processCommandParameters(std::list<std::string> arguments, ParamParserFunc parserFunc) {
while(!arguments.empty()) {
std::string key = arguments.front();
arguments.pop_front();
if(key.find(':') == key.size() - 1) {
key = key.substr(0, key.size() - 1);
} else {
std::cerr << "Necessary to add a colon at the end" << std::endl;
return;
}
if(arguments.empty()) {
std::cerr << "Incomplete arguments for this command" << std::endl;
return;
}
std::string value = arguments.front();
arguments.pop_front();
parserFunc(key, value);
}
}
void parseQuitCommand() {
uninitializeVariables();
std::cout << "Exiting..." << std::endl;
exit(0);
}
const CommandHelper& findSubCommand(const CommandHelper& cmd, std::list<std::string>& args) {
if(args.empty()) { //No more tokens, return the cmd itself
return cmd;
}
std::string arg = args.front();
for(auto iter = cmd.getSubCommands().begin(); iter != cmd.getSubCommands().end(); ++iter) {
if(iter->getCommand() == arg) {
args.pop_front();
return findSubCommand(*iter, args);
}
}
return cmd;
}
std::list<std::string> getSubCommandNames(const CommandHelper& command) {
std::list<std::string> retVal;
for(auto iter = command.getSubCommands().begin(); iter != command.getSubCommands().end(); ++iter) {
std::list<std::string> aux = getSubCommandNames(*iter);
for(auto name = aux.begin(); name != aux.end(); ++name) {
retVal.push_back(command.getCommand() + (command.getCommand().empty() ? "" : " ") + *name);
}
}
if(retVal.empty()) {
retVal.push_back(command.getCommand());
}
return retVal;
}
void parseListInterfacesCommand() {
const std::set<std::string>& ifaces = CanEasy::getInitializedCanIfaces();
for(auto iter = ifaces.begin(); iter != ifaces.end(); ++iter) {
std::cout << *iter << std::endl;
}
}
void parseSendFrameCommand(std::list<std::string> arguments) {
std::string interface;
std::string name = arguments.front();
arguments.pop_front();
auto frameIter = framesToSend.find(name);
if(frameIter == framesToSend.end()) {
std::cerr << "Frame not defined..." << std::endl;
return;
}
const J1939Frame* j1939Frame = frameIter->second;
auto func = [&interface](const std::string& key, const std::string& value) {
if(key == INTERFACE_TOKEN) {
const std::set<std::string>& ifaces = CanEasy::getInitializedCanIfaces();
for(auto iface = ifaces.begin(); iface != ifaces.end(); ++iface) {
//Check that the corresponding interface really exists
if(*iface == value) {
interface = value;
return;
}
}
}
};
processCommandParameters(arguments, func);
if(interface.empty()) {
std::cerr << "Interface not defined or not initialized..." << std::endl;
return;
}
//The frame has a periodicity associated?
auto period = framePeriods.find(name);
if(period == framePeriods.end()) {
std::cerr << "Period not defined..." << std::endl;
return;
}
sendFrameThroughInterface(j1939Frame, period->second, interface);
}
void sendFrameThroughInterface(const J1939Frame* j1939Frame, u32 period, const std::string& interface) {
//Send the frame with the configured period
std::shared_ptr<ICanSender> sender = CanEasy::getSender(interface);
size_t length = j1939Frame->getDataLength();
CanFrame canFrame;
u32 id;
u8* buff;
std::string data;
//J1939 data is always transmitted in extended format
canFrame.setExtendedFormat(true);
//If the frame is bigger than 8 bytes, we use BAM
if(length > MAX_CAN_DATA_SIZE) {
std::vector<CanFrame> canFrames;
BamFragmenter fragmenter;
fragmenter.fragment(*j1939Frame);
const TPCMFrame& connFrame = fragmenter.getConnFrame();
length = connFrame.getDataLength();
buff = new u8[length];
connFrame.encode(id, buff, length);
//Set identifier
canFrame.setId(id);
//Set data
std::string data;
data.append((char*)buff, length);
canFrame.setData(data);
delete[] buff;
canFrames.push_back(canFrame);
std::vector<TPDTFrame> dataFrames = fragmenter.getDataFrames();
for(auto iter = dataFrames.begin(); iter != dataFrames.end(); ++iter) {
length = iter->getDataLength();
buff = new u8[length];
iter->encode(id, buff, length);
//Set identifier
canFrame.setId(id);
//Set data
std::string data;
data.append((char*)buff, length);
canFrame.setData(data);
delete[] buff;
canFrames.push_back(canFrame);
}
sender->sendFrames(canFrames, period);
} else { //Can be sent in one frame
buff = new u8[length];
j1939Frame->encode(id, buff, length);
//Set identifier
canFrame.setId(id);
//Set data
std::string data;
data.append((char*)buff, length);
canFrame.setData(data);
delete[] buff;
sender->sendFrame(canFrame, period);
}
}
void unsendFrameThroughInterface(const J1939Frame* j1939Frame, const std::string& interface) {
std::vector<u32> ids;
bool found = false;
//If the frame is bigger than 8 bytes, we use BAM
if(j1939Frame->getDataLength() > MAX_CAN_DATA_SIZE) {
BamFragmenter fragmenter;
fragmenter.fragment(*j1939Frame);
const TPCMFrame& connFrame = fragmenter.getConnFrame();
ids.push_back(connFrame.getIdentifier());
std::vector<TPDTFrame> dataFrames = fragmenter.getDataFrames();
for(auto iter = dataFrames.begin(); iter != dataFrames.end(); ++iter) {
ids.push_back(iter->getIdentifier());
}
} else { //Can be sent in one frame
ids.push_back(j1939Frame->getIdentifier());
}
const std::set<std::string>& ifaces = CanEasy::getInitializedCanIfaces();
for(auto iter = ifaces.begin(); iter != ifaces.end(); ++iter) {
std::shared_ptr<ICanSender> sender = CanEasy::getSender(*iter);
if(interface.empty() || interface == *iter) {
sender->unSendFrames(ids);
found = true;
}
}
if(!found) {
std::cerr << "Frame not sent through the given interface..." << std::endl;
}
}
bool isFrameSent(const J1939Frame* frame, const std::string& interface) {
std::vector<u32> ids;
std::shared_ptr<ICanSender> sender = CanEasy::getSender(interface);
//If the frame is bigger than 8 bytes, we use BAM
if(frame->getDataLength() > MAX_CAN_DATA_SIZE) {
BamFragmenter fragmenter;
fragmenter.fragment(*frame);
const TPCMFrame& connFrame = fragmenter.getConnFrame();
ids.push_back(connFrame.getIdentifier());
std::vector<TPDTFrame> dataFrames = fragmenter.getDataFrames();
for(auto iter = dataFrames.begin(); iter != dataFrames.end(); ++iter) {
ids.push_back(iter->getIdentifier());
}
} else { //Can be sent in one frame
ids.push_back(frame->getIdentifier());
}
return sender->isSent(ids);
}
void execScript(const std::string& file) {
std::string line;
std::ifstream fileScript;
fileScript.open(file);
if(fileScript.is_open()) {
if(!silent) std::cout << "Executing commands..." << std::endl;
while (std::getline(fileScript, line)) {
std::cout << (!silent ? SENDER_PROMPT : "") << line << std::endl; //Feedback of read command in the file
parseLine(line);
}
} else {
std::cerr << "Could not open the script file..." << std::endl;
}
}
void parseUnsendFrameCommand(std::list<std::string> arguments) {
std::string name = arguments.front();
arguments.pop_front();
auto frameIter = framesToSend.find(name);
if(frameIter == framesToSend.end()) {
std::cerr << "Frame not defined..." << std::endl;
return;
}
J1939Frame* frame = frameIter->second;
std::string interface;
auto func = [&interface](const std::string& key, const std::string& value) {
if(key == INTERFACE_TOKEN) {
interface = value;
}
};
processCommandParameters(arguments, func);
unsendFrameThroughInterface(frame, interface);
}
void parseExecCommand(std::list<std::string> arguments) {
std::string file = arguments.front();
arguments.pop_front();
if(arguments.empty()) {
execScript(file);
} else {
std::cerr << "Too many arguments..." << std::endl;
}
}
void uninitializeVariables() {
//Dealloc allocated frames
for(auto iter = framesToSend.begin(); iter != framesToSend.end(); ++iter) {
delete iter->second;
}
//Finalize Can Backends...
CanEasy::finalize();
//Deallocate frames
J1939Factory::getInstance().releaseInstance();
}
bool parseSetGenericParams(const std::string& name, J1939Frame* frame, const std::string& key, const std::string& value) {
bool retVal = true;
if(key == PRIORITY_TOKEN) {
try {
u32 priority = std::stoul(value);
if(priority == (priority & J1939_PRIORITY_MASK)) {
frame->setPriority(static_cast<u8>(priority));
} else {
std::cerr << "Priority out of range" << std::endl;
}
} catch (std::invalid_argument& e) {
std::cerr << "Priority is not a number..." << std::endl;
}
} else if(key == PERIOD_TOKEN) {
try {
u32 period = std::stoul(value);
framePeriods[name] = period;
} catch (std::invalid_argument& e) {
std::cerr << "Period is not a number..." << std::endl;
}
} else if(key == SOURCE_TOKEN) {
try {
u32 src = std::stoul(value, nullptr, 16);
if(src == (src & J1939_SRC_ADDR_MASK)) {
frame->setSrcAddr(static_cast<u8>(src));
} else {
std::cerr << "Source address out of range" << std::endl;
}
} catch (std::invalid_argument& e) {
std::cerr << "Source address is not a number..." << std::endl;
}
} else {
retVal = false;
}
return retVal;
}
std::vector<CanFrame> ttsFramesToCanFrames(const std::vector<FMS1Frame>& ttsFrames) {
std::vector<CanFrame> frames;
size_t length;
CanFrame canFrame;
u32 id;
u8* buff;
std::string data;
for(auto frame = fms1Frames.begin(); frame != fms1Frames.end(); ++frame) {
length = frame->getDataLength();
buff = new u8[length];
frame->encode(id, buff, length);
canFrame.setId(id);
canFrame.setExtendedFormat(true);
std::string data;
data.append((char*)buff, length);
canFrame.setData(data);
delete[] buff;
frames.push_back(canFrame);
}
return frames;
}
bool parseDtcCommand(std::list<std::string> arguments, DTC& dtc) {
u32 spn = 0;
u8 oc = 0xFF;
u8 fmi = 0xFF;
auto func = [&spn, &oc, &fmi](const std::string& key, const std::string& value) {
if(key == SPN_TOKEN) {
try {
spn = std::stoul(value);
} catch (std::invalid_argument& e) {
std::cerr << "Spn is not a number..." << std::endl;
}
} else if(key == OC_TOKEN) {
try {
u32 ocNumber = std::stoul(value);
if(ocNumber == (ocNumber & DTC_OC_MASK)) {
oc = static_cast<u8>(ocNumber);
} else {
std::cerr << "Occurrence Count is out of range..." << std::endl;
}
} catch (std::invalid_argument& e) {
std::cerr << "Occurrence Count is not a number..." << std::endl;
}
} else if(key == FMI_TOKEN) {
try {
u32 fmiNumber = std::stoul(value);
if(fmiNumber == (fmiNumber & DTC_FMI_MASK)) {
fmi = static_cast<u8>(fmiNumber);
} else {
std::cerr << "Failure Mode Identifier is out of range..." << std::endl;
}
} catch (std::invalid_argument& e) {
std::cerr << "Failure Mode Identifier is not a number..." << std::endl;
}
}
};
processCommandParameters(arguments, func);
if(spn == 0) {
std::cerr << "SPN not set..." << std::endl;
return false;
}
if(oc == 0xFF) {
std::cerr << "Occurrence Count not set..." << std::endl;
return false;
}
if(fmi == 0xFF) {
std::cerr << "Failure Mode Identifier not set..." << std::endl;
return false;
}
dtc = DTC(spn, fmi, oc);
return true;
}
//Example: add dtc abb spn: 87 oc: 3 fmi: 8 (To add a dtc to frame aaa to the tail).
void parseAddDtcCommand(std::list<std::string> arguments) {
std::string name = arguments.front();
arguments.pop_front();
auto frameIter = framesToSend.find(name);
if(frameIter == framesToSend.end()) {
std::cerr << "Frame not defined..." << std::endl;
return;
}
J1939Frame* frame = frameIter->second;
if(frame->getPGN() != DM1_PGN) {
std::cerr << "Not a DM1 frame..." << std::endl;
return;
}
DTC dtc;
if(parseDtcCommand(arguments, dtc)) {
DM1* dm1Frame = static_cast<DM1*>(frame);
dm1Frame->addDTC(std::move(dtc));
}
}
//Example: set dtc aaa 1 spn: 14 oc: 2 fmi: 5 (To set second dtc for frame aaa).
void parseSetDtcCommand(std::list<std::string> arguments) {
//Take frame name from arguments
std::string name = arguments.front();
arguments.pop_front();
auto frameIter = framesToSend.find(name);
if(frameIter == framesToSend.end()) {
std::cerr << "Frame not defined..." << std::endl;
return;
}
J1939Frame* frame = frameIter->second;
if(frame->getPGN() != DM1_PGN) {
std::cerr << "Not a DM1 frame..." << std::endl;
return;
}
//Take dtc postion from arguments
std::string posStr = arguments.front();
arguments.pop_front();
size_t pos;
try {
pos = std::stoul(posStr);
} catch (std::invalid_argument& e) {
std::cerr << "Position is not a number..." << std::endl;
}
DTC dtc;
if(parseDtcCommand(arguments, dtc)) {
DM1* dm1Frame = static_cast<DM1*>(frame);
dm1Frame->setDTC(pos, std::move(dtc));
}
}
//Example: delete dtc abb 0 (To delete first dtc from frame abb).
void parseDeleteDtcCommand(std::list<std::string> arguments) {
//Take frame name from arguments
std::string name = arguments.front();
arguments.pop_front();
auto frameIter = framesToSend.find(name);
if(frameIter == framesToSend.end()) {
std::cerr << "Frame not defined..." << std::endl;
return;
}
J1939Frame* frame = frameIter->second;
if(frame->getPGN() != DM1_PGN) {
std::cerr << "Not a DM1 frame..." << std::endl;
return;
}
//Take dtc postion from arguments
std::string posStr = arguments.front();
arguments.pop_front();
size_t pos;
try {
pos = std::stoul(posStr);
} catch (std::invalid_argument& e) {
std::cerr << "Position is not a number..." << std::endl;
}
DM1* dm1Frame = static_cast<DM1*>(frame);
dm1Frame->deleteDTC(pos);
}
================================================
FILE: BinUtils/j1939Sniffer/.cproject
================================================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.1823270490">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.1823270490" moduleId="org.eclipse.cdt.core.settings" name="Debug">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.debug.1823270490" name="Debug" parent="cdt.managedbuild.config.gnu.exe.debug">
<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.1823270490." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.1897798032" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.1415164888" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
<builder buildPath="${workspace_loc:/j1939Sniffer}/Debug" id="cdt.managedbuild.target.gnu.builder.exe.debug.1480028597" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.140688525" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.944164048" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.1474975970" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.exe.debug.option.debugging.level.942411302" name="Debug Level" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.include.paths.1434142944" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value=""${workspace_loc:/CAN}""/>
<listOptionValue builtIn="false" value=""${workspace_loc:/Common}""/>
<listOptionValue builtIn="false" value=""${workspace_loc:/J1939}""/>
</option>
<option id="gnu.cpp.compiler.option.dialect.std.518867606" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.cpp.compiler.dialect.c++11" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1305411185" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.1019824305" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug">
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.exe.debug.option.optimization.level.571359833" name="Optimization Level" superClass="gnu.c.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
<option id="gnu.c.compiler.exe.debug.option.debugging.level.1569476303" name="Debug Level" superClass="gnu.c.compiler.exe.debug.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1639232821" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.1852645664" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.274171196" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
<option id="gnu.cpp.link.option.paths.985479177" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" useByScannerDiscovery="false" valueType="libPaths">
<listOptionValue builtIn="false" value=""${workspace_loc:/CAN/Debug}""/>
<listOptionValue builtIn="false" value=""${workspace_loc:/Common/Debug}""/>
<listOptionValue builtIn="false" value=""${workspace_loc:/J1939/Debug}""/>
</option>
<option id="gnu.cpp.link.option.libs.393837245" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" useByScannerDiscovery="false" valueType="libs">
<listOptionValue builtIn="false" value="CAN"/>
<listOptionValue builtIn="false" value="ncurses"/>
<listOptionValue builtIn="false" value="dl"/>
<listOptionValue builtIn="false" value="Common"/>
<listOptionValue builtIn="false" value="J1939"/>
<listOptionValue builtIn="false" value="pthread"/>
</option>
<option id="gnu.cpp.link.option.flags.79458475" name="Linker flags" superClass="gnu.cpp.link.option.flags" useByScannerDiscovery="false" value="-rdynamic" valueType="string"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.113497849" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.1780139637" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.284107585" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
<cconfiguration id="cdt.managedbuild.config.gnu.exe.release.1257976290">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.release.1257976290" moduleId="org.eclipse.cdt.core.settings" name="Release">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.release.1257976290" name="Release" parent="cdt.managedbuild.config.gnu.exe.release">
<folderInfo id="cdt.managedbuild.config.gnu.exe.release.1257976290." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.589196453" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.release">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.release.1018521427" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.release"/>
<builder buildPath="${workspace_loc:/j1939Sniffer}/Release" id="cdt.managedbuild.target.gnu.builder.exe.release.1798508598" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.exe.release"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.1094973440" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1059403163" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release">
<option id="gnu.cpp.compiler.exe.release.option.optimization.level.1483235521" name="Optimization Level" superClass="gnu.cpp.compiler.exe.release.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
<option id="gnu.cpp.compiler.exe.release.option.debugging.level.2038881296" name="Debug Level" superClass="gnu.cpp.compiler.exe.release.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1304422705" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.1689728863" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release">
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.exe.release.option.optimization.level.548713967" name="Optimization Level" superClass="gnu.c.compiler.exe.release.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
<option id="gnu.c.compiler.exe.release.option.debugging.level.1662928989" name="Debug Level" superClass="gnu.c.compiler.exe.release.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.none" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.819103258" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.exe.release.1880607432" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release"/>
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.1328092022" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release">
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1518738130" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
<tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.703854502" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release">
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1111746818" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="j1939Sniffer.cdt.managedbuild.target.gnu.exe.197305081" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.1257976290;cdt.managedbuild.config.gnu.exe.release.1257976290.;cdt.managedbuild.tool.gnu.c.compiler.exe.release.1689728863;cdt.managedbuild.tool.gnu.c.compiler.input.819103258">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1823270490;cdt.managedbuild.config.gnu.exe.debug.1823270490.;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.1019824305;cdt.managedbuild.tool.gnu.c.compiler.input.1639232821">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.1257976290;cdt.managedbuild.config.gnu.exe.release.1257976290.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1059403163;cdt.managedbuild.tool.gnu.cpp.compiler.input.1304422705">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1823270490;cdt.managedbuild.config.gnu.exe.debug.1823270490.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.944164048;cdt.managedbuild.tool.gnu.cpp.compiler.input.1305411185">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Debug">
<resource resourceType="PROJECT" workspacePath="/j1939Sniffer"/>
</configuration>
<configuration configurationName="Release">
<resource resourceType="PROJECT" workspacePath="/j1939Sniffer"/>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
</cproject>
================================================
FILE: BinUtils/j1939Sniffer/.gitignore
================================================
/Debug/
================================================
FILE: BinUtils/j1939Sniffer/.settings/org.eclipse.cdt.codan.core.prefs
================================================
eclipse.preferences.version=1
org.eclipse.cdt.codan.checkers.errnoreturn=Warning
org.eclipse.cdt.codan.checkers.errnoreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No return\\")",implicit\=>false}
org.eclipse.cdt.codan.checkers.errreturnvalue=Error
org.eclipse.cdt.codan.checkers.errreturnvalue.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused return value\\")"}
org.eclipse.cdt.codan.checkers.nocommentinside=-Error
org.eclipse.cdt.codan.checkers.nocommentinside.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,R
gitextract_rarda5g4/
├── .travis.yml
├── BinTest/
│ ├── AccelCCVS/
│ │ ├── CMakeLists.txt
│ │ └── src/
│ │ └── accelCCVS.cpp
│ └── FrameInject/
│ ├── CMakeLists.txt
│ └── src/
│ └── frame_inject.cpp
├── BinUtils/
│ ├── CMakeLists.txt
│ ├── TRCDumper/
│ │ ├── .cproject
│ │ ├── CMakeLists.txt
│ │ └── src/
│ │ └── TRCDumper.cpp
│ ├── TRCPlayer/
│ │ ├── CMakeLists.txt
│ │ ├── README.md
│ │ └── src/
│ │ └── TRCPlayer.cpp
│ ├── TRCToCap/
│ │ ├── .cproject
│ │ ├── CMakeLists.txt
│ │ ├── include/
│ │ │ ├── config.h
│ │ │ └── pcapio.h
│ │ └── src/
│ │ ├── TRCToCap.cpp
│ │ └── pcapio.c
│ ├── j1939AddrClaim/
│ │ ├── CMakeLists.txt
│ │ ├── Readme.md
│ │ └── j1939AddrClaim.cpp
│ ├── j1939AddressMapper/
│ │ ├── CMakeLists.txt
│ │ ├── Readme.md
│ │ └── j1939AddressMapper.cpp
│ ├── j1939Decoder/
│ │ ├── .cproject
│ │ ├── .settings/
│ │ │ ├── org.eclipse.cdt.codan.core.prefs
│ │ │ └── org.eclipse.cdt.core.prefs
│ │ ├── CMakeLists.txt
│ │ ├── README.md
│ │ └── src/
│ │ └── j1939Decoder.cpp
│ ├── j1939Sender/
│ │ ├── CMakeLists.txt
│ │ ├── README.md
│ │ └── src/
│ │ └── j1939Sender.cpp
│ └── j1939Sniffer/
│ ├── .cproject
│ ├── .gitignore
│ ├── .settings/
│ │ └── org.eclipse.cdt.codan.core.prefs
│ ├── CMakeLists.txt
│ └── src/
│ └── j1939Sniffer.cpp
├── CAN/
│ ├── .gitignore
│ ├── .settings/
│ │ └── org.eclipse.cdt.codan.core.prefs
│ ├── Backends/
│ │ ├── PeakCan/
│ │ │ ├── PeakCanChannels.cpp
│ │ │ ├── PeakCanHelper.cpp
│ │ │ ├── PeakCanReceiver.cpp
│ │ │ ├── PeakCanSender.cpp
│ │ │ └── PeakCanSymbols.cpp
│ │ └── Sockets/
│ │ ├── SocketCanHelper.cpp
│ │ ├── SocketCanReceiver.cpp
│ │ └── SocketCanSender.cpp
│ ├── CMakeLists.txt
│ ├── CanEasy.cpp
│ ├── CanFrame.cpp
│ ├── CanSniffer.cpp
│ ├── CommonCanReceiver.cpp
│ ├── CommonCanSender.cpp
│ ├── ICanHelper.cpp
│ ├── README.md
│ ├── TRCReader.cpp
│ ├── TRCWriter.cpp
│ └── include/
│ ├── Backends/
│ │ ├── PeakCan/
│ │ │ ├── PeakCanChannels.h
│ │ │ ├── PeakCanHelper.h
│ │ │ ├── PeakCanReceiver.h
│ │ │ ├── PeakCanSender.h
│ │ │ └── PeakCanSymbols.h
│ │ └── Sockets/
│ │ ├── SocketCanHelper.h
│ │ ├── SocketCanReceiver.h
│ │ └── SocketCanSender.h
│ ├── CanEasy.h
│ ├── CanFilter.h
│ ├── CanFrame.h
│ ├── CanSniffer.h
│ ├── CommonCanReceiver.h
│ ├── CommonCanSender.h
│ ├── ICanHelper.h
│ ├── ICanSender.h
│ ├── TRCReader.h
│ └── TRCWriter.h
├── CMakeLists.txt
├── Common/
│ ├── .cproject
│ ├── .gitignore
│ ├── CMakeLists.txt
│ ├── Utils.cpp
│ └── include/
│ ├── Assert.h
│ ├── ICloneable.h
│ ├── Singleton.h
│ ├── Types.h
│ └── Utils.h
├── Database/
│ ├── CMakeLists.txt
│ ├── README.md
│ └── frames.json
├── GUI_WEB/
│ ├── README.md
│ ├── backend/
│ │ ├── CMakeLists.txt
│ │ ├── graph.proto
│ │ └── src/
│ │ ├── J1939GUI.cpp
│ │ ├── graph.cpp
│ │ └── graph.h
│ └── frontend/
│ ├── graph.html
│ ├── index.html
│ └── js/
│ └── graph.js
├── J1939/
│ ├── .cproject
│ ├── .gitignore
│ ├── .settings/
│ │ └── org.eclipse.cdt.codan.core.prefs
│ ├── Addressing/
│ │ └── AddressClaimFrame.cpp
│ ├── CMakeLists.txt
│ ├── Diagnosis/
│ │ ├── DTC.cpp
│ │ └── Frames/
│ │ └── DM1.cpp
│ ├── FMS/
│ │ └── TellTale/
│ │ ├── FMS1Frame.cpp
│ │ └── TellTale.cpp
│ ├── Frames/
│ │ └── RequestFrame.cpp
│ ├── GenericFrame.cpp
│ ├── J1939Common.cpp
│ ├── J1939DataBase.cpp
│ ├── J1939Factory.cpp
│ ├── J1939Frame.cpp
│ ├── README.md
│ ├── SPN/
│ │ ├── SPN.cpp
│ │ ├── SPNHistory.cpp
│ │ ├── SPNNumeric.cpp
│ │ ├── SPNSpec/
│ │ │ ├── SPNNumericSpec.cpp
│ │ │ ├── SPNSpec.cpp
│ │ │ └── SPNStatusSpec.cpp
│ │ ├── SPNStatus.cpp
│ │ └── SPNString.cpp
│ ├── Transport/
│ │ ├── BAM/
│ │ │ ├── BamFragmenter.cpp
│ │ │ └── BamReassembler.cpp
│ │ ├── RTSCTS/
│ │ │ └── RTSCTSConnectionManager.cpp
│ │ ├── TPCMFrame.cpp
│ │ └── TPDTFrame.cpp
│ └── include/
│ ├── Addressing/
│ │ └── AddressClaimFrame.h
│ ├── Diagnosis/
│ │ ├── DTC.h
│ │ └── Frames/
│ │ └── DM1.h
│ ├── FMS/
│ │ └── TellTale/
│ │ ├── FMS1Frame.h
│ │ └── TellTale.h
│ ├── Frames/
│ │ └── RequestFrame.h
│ ├── GenericFrame.h
│ ├── J1939Common.h
│ ├── J1939DataBase.h
│ ├── J1939Factory.h
│ ├── J1939Frame.h
│ ├── SPN/
│ │ ├── SPN.h
│ │ ├── SPNHistory.h
│ │ ├── SPNNumeric.h
│ │ ├── SPNSpec/
│ │ │ ├── SPNNumericSpec.h
│ │ │ ├── SPNSpec.h
│ │ │ └── SPNStatusSpec.h
│ │ ├── SPNStatus.h
│ │ └── SPNString.h
│ └── Transport/
│ ├── BAM/
│ │ ├── BamFragmenter.h
│ │ └── BamReassembler.h
│ ├── RTSCTS/
│ │ └── RTSCTSConnectionManager.h
│ ├── TPCMFrame.h
│ └── TPDTFrame.h
├── LICENSE
├── README.md
├── Scripts/
│ ├── Readme.md
│ ├── define_frames.j1939
│ ├── gear_level.sh
│ ├── simulate_dtc.sh
│ ├── simulate_fuel_cons.sh
│ └── test_tco.sh
├── Tests/
│ ├── BAM_test.cpp
│ ├── CMakeLists.txt
│ ├── SPNNumeric_test.cpp
│ ├── SPNStatus_test.cpp
│ ├── SPNString_test.cpp
│ ├── TestFrame.cpp
│ ├── address_claim_frame_test.cpp
│ ├── database/
│ │ ├── test1.json
│ │ ├── test2.json
│ │ ├── test3.json
│ │ ├── test4.json
│ │ └── test5.json
│ ├── database_test.cpp
│ ├── fms1_frame_test.cpp
│ ├── genericframe_test.cpp
│ ├── include/
│ │ └── TestFrame.h
│ ├── j1939Factory_test.cpp
│ ├── main.cpp
│ └── request_frame.cpp
├── cmake/
│ ├── FindLibWebSockets.cmake
│ └── J1939FrameworkConfig.cmake
├── j1939AddressClaimer/
│ ├── AddressClaimer.cpp
│ ├── CMakeLists.txt
│ └── include/
│ └── AddressClaimer.h
└── wireshark/
└── dissector/
├── CMakeLists.txt
├── Readme.md
├── packet-j1939.cpp
└── plugin.c
SYMBOL INDEX (308 symbols across 117 files)
FILE: BinTest/AccelCCVS/src/accelCCVS.cpp
function main (line 29) | int
FILE: BinTest/FrameInject/src/frame_inject.cpp
function main (line 28) | int
FILE: BinUtils/TRCDumper/src/TRCDumper.cpp
function main (line 39) | int main(int argc, char **argv) {
function onRcv (line 96) | void onRcv(const Can::CanFrame& frame, const TimeStamp& timeStamp, const...
function onTimeout (line 108) | bool onTimeout() {
function onSignal (line 114) | void onSignal(int) {
FILE: BinUtils/TRCPlayer/src/TRCPlayer.cpp
function main (line 71) | int main(int argc, char **argv) {
function printFrames (line 259) | void printFrames() {
FILE: BinUtils/TRCToCap/src/TRCToCap.cpp
function main (line 30) | int main(int argc, char **argv) {
FILE: BinUtils/TRCToCap/src/pcapio.c
type pcap_hdr (line 64) | struct pcap_hdr {
type pcaprec_hdr (line 75) | struct pcaprec_hdr {
type shb (line 98) | struct shb {
type idb (line 109) | struct idb {
type isb (line 120) | struct isb {
type epb (line 131) | struct epb {
type option (line 142) | struct option {
function gboolean (line 168) | static gboolean
function gboolean (line 193) | gboolean
function gboolean (line 212) | gboolean
function guint32 (line 233) | static guint32
function gboolean (line 244) | static gboolean
function gboolean (line 276) | gboolean
function gboolean (line 303) | gboolean
function gboolean (line 367) | gboolean
function gboolean (line 517) | gboolean
function gboolean (line 609) | gboolean
FILE: BinUtils/j1939AddrClaim/j1939AddrClaim.cpp
type J1939 (line 30) | namespace J1939 {
class MyAddressClaimer (line 32) | class MyAddressClaimer : public AddressClaimer {
method onSrcAddrChanged (line 37) | void onSrcAddrChanged(u8 newAddr) {
method sendFrame (line 46) | void sendFrame(const J1939Frame& frame) {
method MyAddressClaimer (line 76) | MyAddressClaimer(const EcuName& name, const std::queue<u8>& preferre...
function main (line 94) | int
function onRcv (line 214) | void onRcv(const CanFrame& frame, const TimeStamp&, const std::string& i...
function onTimeout (line 230) | bool onTimeout() {
FILE: BinUtils/j1939AddressMapper/j1939AddressMapper.cpp
function main (line 41) | int
function onRcv (line 117) | void onRcv(const CanFrame& frame, const TimeStamp&, const std::string& i...
function onTimeout (line 144) | bool onTimeout() {
FILE: BinUtils/j1939Decoder/src/j1939Decoder.cpp
function decodeData (line 42) | std::basic_string<u8> decodeData(const std::string &data) {
function u32 (line 88) | u32 decodeID(const std::string& id) {
function main (line 124) | int
FILE: BinUtils/j1939Sender/src/j1939Sender.cpp
class CommandHelper (line 113) | class CommandHelper {
method CommandHelper (line 127) | CommandHelper(const std::string& command = "") : mCommand(command), mC...
method CommandHelper (line 128) | CommandHelper(const std::string& command, CmdFunc func) : mCommand(com...
method CommandHelper (line 129) | CommandHelper(const std::string& command, CmdFuncWithArgs func) : mCom...
method CmdFunc (line 131) | CmdFunc getCmdFunc() const { return mCmdFunc; }
method CmdFuncWithArgs (line 132) | CmdFuncWithArgs getCmdFuncWithArgs() const { return mCmdFuncWithArgs; }
method CommandHelper (line 134) | CommandHelper& addSubCommand(const CommandHelper& command) { mSubComma...
function main (line 208) | int main(int argc, char **argv) {
function registerCommands (line 347) | void registerCommands() {
function parseLine (line 383) | void parseLine(const std::string& line) {
function splitTokens (line 424) | std::list<std::string> splitTokens(std::string arguments) {
function parseListCommandsCommand (line 452) | void parseListCommandsCommand() {
function parseCreateFrameCommand (line 463) | void parseCreateFrameCommand(std::list<std::string> arguments) {
function parseListFramesCommand (line 535) | void parseListFramesCommand() {
function parseListTTSCommand (line 614) | void parseListTTSCommand(std::list<std::string> arguments) {
function parseUnsendTTSCommand (line 688) | void parseUnsendTTSCommand() {
function parseSendTTSCommand (line 710) | void parseSendTTSCommand(std::list<std::string> arguments) {
function parseSetTTSCommand (line 768) | void parseSetTTSCommand(std::list<std::string> arguments) {
function parsePrintFrameCommand (line 867) | void parsePrintFrameCommand(std::list<std::string> arguments) {
function parseSetFrameCommand (line 881) | void parseSetFrameCommand(std::list<std::string> arguments) {
function processCommandParameters (line 1036) | void processCommandParameters(std::list<std::string> arguments, ParamPar...
function parseQuitCommand (line 1065) | void parseQuitCommand() {
function CommandHelper (line 1071) | const CommandHelper& findSubCommand(const CommandHelper& cmd, std::list<...
method CommandHelper (line 127) | CommandHelper(const std::string& command = "") : mCommand(command), mC...
method CommandHelper (line 128) | CommandHelper(const std::string& command, CmdFunc func) : mCommand(com...
method CommandHelper (line 129) | CommandHelper(const std::string& command, CmdFuncWithArgs func) : mCom...
method CmdFunc (line 131) | CmdFunc getCmdFunc() const { return mCmdFunc; }
method CmdFuncWithArgs (line 132) | CmdFuncWithArgs getCmdFuncWithArgs() const { return mCmdFuncWithArgs; }
method CommandHelper (line 134) | CommandHelper& addSubCommand(const CommandHelper& command) { mSubComma...
function getSubCommandNames (line 1090) | std::list<std::string> getSubCommandNames(const CommandHelper& command) {
function parseListInterfacesCommand (line 1113) | void parseListInterfacesCommand() {
function parseSendFrameCommand (line 1123) | void parseSendFrameCommand(std::list<std::string> arguments) {
function sendFrameThroughInterface (line 1176) | void sendFrameThroughInterface(const J1939Frame* j1939Frame, u32 period,...
function unsendFrameThroughInterface (line 1270) | void unsendFrameThroughInterface(const J1939Frame* j1939Frame, const std...
function isFrameSent (line 1320) | bool isFrameSent(const J1939Frame* frame, const std::string& interface) {
function execScript (line 1352) | void execScript(const std::string& file) {
function parseUnsendFrameCommand (line 1376) | void parseUnsendFrameCommand(std::list<std::string> arguments) {
function parseExecCommand (line 1406) | void parseExecCommand(std::list<std::string> arguments) {
function uninitializeVariables (line 1419) | void uninitializeVariables() {
function parseSetGenericParams (line 1437) | bool parseSetGenericParams(const std::string& name, J1939Frame* frame, c...
function ttsFramesToCanFrames (line 1495) | std::vector<CanFrame> ttsFramesToCanFrames(const std::vector<FMS1Frame>&...
function parseDtcCommand (line 1530) | bool parseDtcCommand(std::list<std::string> arguments, DTC& dtc) {
function parseAddDtcCommand (line 1609) | void parseAddDtcCommand(std::list<std::string> arguments) {
function parseSetDtcCommand (line 1637) | void parseSetDtcCommand(std::list<std::string> arguments) {
function parseDeleteDtcCommand (line 1682) | void parseDeleteDtcCommand(std::list<std::string> arguments) {
FILE: BinUtils/j1939Sniffer/src/j1939Sniffer.cpp
function main (line 52) | int main (int argc, char **argv)
function onRcv (line 293) | void onRcv(const Can::CanFrame& frame, const TimeStamp&, const std::stri...
function onTimeout (line 352) | bool onTimeout() {
FILE: CAN/Backends/PeakCan/PeakCanChannels.cpp
type Can (line 10) | namespace Can {
type PeakCan (line 11) | namespace PeakCan {
function Channel (line 38) | Channel PeakCanChannels::getChannel(const std::string& name) const {
FILE: CAN/Backends/PeakCan/PeakCanHelper.cpp
type BitrateItem (line 16) | struct BitrateItem
type Can (line 39) | namespace Can {
type PeakCan (line 40) | namespace PeakCan {
function ICanSender (line 162) | ICanSender* PeakCanHelper::allocateCanSender() {
function CommonCanReceiver (line 166) | CommonCanReceiver* PeakCanHelper::allocateCanReceiver() {
FILE: CAN/Backends/PeakCan/PeakCanReceiver.cpp
type Can (line 14) | namespace Can {
type PeakCan (line 15) | namespace PeakCan {
FILE: CAN/Backends/PeakCan/PeakCanSender.cpp
type Can (line 20) | namespace Can {
type PeakCan (line 21) | namespace PeakCan {
FILE: CAN/Backends/PeakCan/PeakCanSymbols.cpp
type Can (line 13) | namespace Can {
type PeakCan (line 14) | namespace PeakCan {
FILE: CAN/Backends/Sockets/SocketCanHelper.cpp
type Can (line 40) | namespace Can {
type Sockets (line 41) | namespace Sockets {
type ifaddrs (line 66) | struct ifaddrs
type sockaddr_can (line 68) | struct sockaddr_can
type ifreq (line 85) | struct ifreq
type sockaddr (line 228) | struct sockaddr
function ICanSender (line 271) | ICanSender* SocketCanHelper::allocateCanSender() {
function CommonCanReceiver (line 275) | CommonCanReceiver* SocketCanHelper::allocateCanReceiver() {
FILE: CAN/Backends/Sockets/SocketCanReceiver.cpp
type Can (line 25) | namespace Can {
type Sockets (line 26) | namespace Sockets {
type timespec (line 120) | struct timespec
FILE: CAN/Backends/Sockets/SocketCanSender.cpp
type Can (line 23) | namespace Can {
type Sockets (line 24) | namespace Sockets {
type can_frame (line 47) | struct can_frame
type can_frame (line 48) | struct can_frame
FILE: CAN/CanEasy.cpp
type Can (line 10) | namespace Can {
FILE: CAN/CanFrame.cpp
type Can (line 13) | namespace Can {
FILE: CAN/CanSniffer.cpp
type Can (line 13) | namespace Can {
FILE: CAN/CommonCanReceiver.cpp
type Can (line 4) | namespace Can {
FILE: CAN/CommonCanSender.cpp
type Can (line 14) | namespace Can {
function u32 (line 39) | u32 CommonCanSender::CanFrameRing::getCurrentPeriod() const {
FILE: CAN/ICanHelper.cpp
type Can (line 13) | namespace Can {
FILE: CAN/TRCReader.cpp
type Can (line 31) | namespace Can {
FILE: CAN/TRCWriter.cpp
type Can (line 16) | namespace Can {
FILE: CAN/include/Backends/PeakCan/PeakCanChannels.h
function namespace (line 21) | namespace Can {
FILE: CAN/include/Backends/PeakCan/PeakCanHelper.h
function namespace (line 19) | namespace Can {
FILE: CAN/include/Backends/PeakCan/PeakCanReceiver.h
function namespace (line 15) | namespace Can {
FILE: CAN/include/Backends/PeakCan/PeakCanSender.h
function namespace (line 16) | namespace Can {
FILE: CAN/include/Backends/PeakCan/PeakCanSymbols.h
type u16 (line 272) | typedef u16 TPCANHandle;
type u32 (line 273) | typedef u32 TPCANStatus;
type u8 (line 274) | typedef u8 TPCANParameter;
type u8 (line 275) | typedef u8 TPCANDevice;
type u8 (line 276) | typedef u8 TPCANMessageType;
type u8 (line 277) | typedef u8 TPCANType;
type u8 (line 278) | typedef u8 TPCANMode;
type u16 (line 279) | typedef u16 TPCANBaudrate;
type TPCANMsg (line 283) | typedef struct tagTPCANMsg
type TPCANTimestamp (line 292) | typedef struct tagTPCANTimestamp
type TPCANStatus (line 299) | typedef TPCANStatus (*CAN_InitializePtr)(TPCANHandle, TPCANBaudrate, TPC...
type TPCANStatus (line 300) | typedef TPCANStatus (*CAN_UninitializePtr) (TPCANHandle);
type TPCANStatus (line 301) | typedef TPCANStatus (*CAN_ResetPtr) (TPCANHandle);
type TPCANStatus (line 302) | typedef TPCANStatus (*CAN_ReadPtr) (TPCANHandle, TPCANMsg *, TPCANTimest...
type TPCANStatus (line 303) | typedef TPCANStatus (*CAN_WritePtr) (TPCANHandle, TPCANMsg *);
type TPCANStatus (line 304) | typedef TPCANStatus (*CAN_FilterMessagesPtr) (TPCANHandle, u32, u32, TPC...
type TPCANStatus (line 305) | typedef TPCANStatus (*CAN_GetValuePtr) (TPCANHandle, TPCANParameter, voi...
type TPCANStatus (line 306) | typedef TPCANStatus (*CAN_SetValuePtr) (TPCANHandle, TPCANParameter, voi...
type TPCANStatus (line 307) | typedef TPCANStatus (*CAN_GetErrorTextPtr) (TPCANStatus, u16, char *);
function namespace (line 310) | namespace Can {
FILE: CAN/include/Backends/Sockets/SocketCanHelper.h
function namespace (line 16) | namespace Can {
FILE: CAN/include/Backends/Sockets/SocketCanReceiver.h
function namespace (line 13) | namespace Can {
FILE: CAN/include/Backends/Sockets/SocketCanSender.h
function namespace (line 14) | namespace Can {
FILE: CAN/include/CanEasy.h
function namespace (line 20) | namespace Can {
FILE: CAN/include/CanFilter.h
function namespace (line 14) | namespace Can {
FILE: CAN/include/CanFrame.h
function namespace (line 16) | namespace Can {
FILE: CAN/include/CanSniffer.h
function namespace (line 19) | namespace Can {
FILE: CAN/include/CommonCanReceiver.h
function namespace (line 18) | namespace Can {
FILE: CAN/include/CommonCanSender.h
function namespace (line 25) | namespace Can {
FILE: CAN/include/ICanHelper.h
function namespace (line 17) | namespace Can {
FILE: CAN/include/ICanSender.h
function namespace (line 21) | namespace Can {
FILE: CAN/include/TRCReader.h
function namespace (line 26) | namespace Can {
FILE: CAN/include/TRCWriter.h
function namespace (line 18) | namespace Can {
FILE: Common/Utils.cpp
type Utils (line 13) | namespace Utils {
function u32 (line 15) | u32 getElapsedMillis(timespec* start, timespec* end)
function timespec (line 20) | timespec addMillis(timespec* time, u32 millis) {
function TimeStamp (line 31) | TimeStamp TimeStamp::operator-(const TimeStamp& other) const {
function TimeStamp (line 56) | TimeStamp TimeStamp::operator+(const TimeStamp& other) const {
function TimeStamp (line 99) | TimeStamp TimeStamp::operator-(u32 millis) const {
function TimeStamp (line 107) | TimeStamp TimeStamp::operator+(u32 millis) const {
function TimeStamp (line 115) | TimeStamp TimeStamp::now() {
FILE: Common/include/ICloneable.h
function virtual (line 21) | virtual ~ICloneable() {}
FILE: Common/include/Singleton.h
function T (line 32) | inline static T& getInstance()
function T (line 51) | inline static T* getInstancePtr()
function releaseInstance (line 72) | inline static void releaseInstance()
FILE: Common/include/Types.h
type u8 (line 15) | typedef unsigned char u8;
type u16 (line 16) | typedef uint16_t u16;
type u32 (line 17) | typedef uint32_t u32;
type u64 (line 18) | typedef uint64_t u64;
type s32 (line 20) | typedef int32_t s32;
FILE: Common/include/Utils.h
function namespace (line 19) | namespace Utils {
FILE: GUI_WEB/backend/src/J1939GUI.cpp
type lws (line 63) | struct lws
type lws_callback_reasons (line 63) | enum lws_callback_reasons
type lws (line 66) | struct lws
type lws_callback_reasons (line 66) | enum lws_callback_reasons
type lws_protocols (line 78) | struct lws_protocols
function callback_http (line 141) | int callback_http(lws *wsi, enum lws_callback_reasons reason,
function callback_j1939 (line 153) | int callback_j1939(lws *wsi, enum lws_callback_reasons reason,
function processRequest (line 261) | bool processRequest(const Json::Value& request, Json::Value& response) {
function main (line 569) | int main(int argc, char *argv[]) {
function sentFramesToJson (line 645) | bool sentFramesToJson(Json::Value& jsonVal) {
function listInterfaces (line 677) | bool listInterfaces(Json::Value& response) {
function isFrameSent (line 694) | bool isFrameSent(const J1939Frame* frame, const std::string& interface) {
function sendFrameThroughInterface (line 730) | void sendFrameThroughInterface(const J1939Frame* j1939Frame, u32 period,...
function unsendFrameThroughInterface (line 825) | void unsendFrameThroughInterface(const J1939Frame* j1939Frame, const std...
function onRcv (line 877) | void onRcv(const CanFrame& frame, const TimeStamp& ts, const std::string...
function onTimeout (line 956) | bool onTimeout() {
function frameToJson (line 963) | Json::Value frameToJson(const J1939Frame* frame) {
function resetReceiver (line 1064) | void resetReceiver() {
FILE: GUI_WEB/backend/src/graph.cpp
function saveToHistory (line 24) | void saveToHistory(u32 id, const SPN& spn, const TimeStamp& timestamp) {
function callback_graph (line 36) | int callback_graph(struct lws *wsi, enum lws_callback_reasons reason,
function Graph (line 150) | Graph getGraphFromSPN(u32 id, u32 spn, u32 number, u32 period, double ti...
FILE: GUI_WEB/backend/src/graph.h
function namespace (line 10) | namespace J1939 {
function namespace (line 14) | namespace Utils {
type lws (line 20) | struct lws
type lws_callback_reasons (line 20) | enum lws_callback_reasons
FILE: GUI_WEB/frontend/js/graph.js
function spn_graph (line 3) | function spn_graph(margin, dom_canvas_id) {
FILE: J1939/Addressing/AddressClaimFrame.cpp
type J1939 (line 16) | namespace J1939 {
FILE: J1939/Diagnosis/DTC.cpp
type J1939 (line 14) | namespace J1939 {
FILE: J1939/Diagnosis/Frames/DM1.cpp
type J1939 (line 16) | namespace J1939 {
FILE: J1939/FMS/TellTale/FMS1Frame.cpp
type J1939 (line 19) | namespace J1939 {
function TellTale (line 131) | TellTale FMS1Frame::getTTS(u8 number) {
FILE: J1939/Frames/RequestFrame.cpp
type J1939 (line 18) | namespace J1939 {
FILE: J1939/GenericFrame.cpp
type J1939 (line 18) | namespace J1939 {
function SPN (line 121) | SPN *GenericFrame::registerSPN(const SPN& spn) {
function SPN (line 147) | SPN* GenericFrame::getSPN(u32 number) {
function SPN (line 161) | const SPN* GenericFrame::getSPN(u32 number) const {
FILE: J1939/J1939DataBase.cpp
type J1939 (line 46) | namespace J1939 {
FILE: J1939/J1939Factory.cpp
type J1939 (line 23) | namespace J1939 {
FILE: J1939/J1939Frame.cpp
type std (line 20) | namespace std {
type J1939 (line 28) | namespace J1939 {
function u32 (line 99) | u32 J1939Frame::getIdentifier() const {
FILE: J1939/SPN/SPN.cpp
type J1939 (line 22) | namespace J1939 {
FILE: J1939/SPN/SPNHistory.cpp
type J1939 (line 16) | namespace J1939 {
FILE: J1939/SPN/SPNNumeric.cpp
type J1939 (line 21) | namespace J1939 {
FILE: J1939/SPN/SPNSpec/SPNNumericSpec.cpp
type J1939 (line 21) | namespace J1939 {
function u32 (line 35) | u32 SPNNumericSpec::getMaxValue() const {
FILE: J1939/SPN/SPNSpec/SPNSpec.cpp
type J1939 (line 22) | namespace J1939 {
FILE: J1939/SPN/SPNSpec/SPNStatusSpec.cpp
type J1939 (line 20) | namespace J1939 {
FILE: J1939/SPN/SPNStatus.cpp
type J1939 (line 20) | namespace J1939 {
FILE: J1939/SPN/SPNString.cpp
type J1939 (line 19) | namespace J1939 {
FILE: J1939/Transport/BAM/BamFragmenter.cpp
type J1939 (line 12) | namespace J1939 {
FILE: J1939/Transport/BAM/BamReassembler.cpp
type J1939 (line 18) | namespace J1939 {
function u8 (line 20) | u8 BamReassembler::BAMFragments::getLastSQ() const{
FILE: J1939/Transport/RTSCTS/RTSCTSConnectionManager.cpp
type J1939 (line 10) | namespace J1939 {
FILE: J1939/Transport/TPCMFrame.cpp
type J1939 (line 17) | namespace J1939 {
FILE: J1939/Transport/TPDTFrame.cpp
type J1939 (line 16) | namespace J1939 {
FILE: J1939/include/Addressing/AddressClaimFrame.h
function namespace (line 38) | namespace J1939 {
function class (line 165) | class AddressClaimFrame: public J1939Frame {
FILE: J1939/include/Diagnosis/DTC.h
function namespace (line 19) | namespace J1939 {
FILE: J1939/include/Diagnosis/Frames/DM1.h
function namespace (line 19) | namespace J1939 {
FILE: J1939/include/FMS/TellTale/FMS1Frame.h
function namespace (line 28) | namespace J1939 {
FILE: J1939/include/FMS/TellTale/TellTale.h
function class (line 18) | class TellTale {
FILE: J1939/include/Frames/RequestFrame.h
function namespace (line 16) | namespace J1939 {
FILE: J1939/include/GenericFrame.h
function namespace (line 17) | namespace J1939 {
FILE: J1939/include/J1939Common.h
function namespace (line 52) | namespace J1939 {
FILE: J1939/include/J1939DataBase.h
function namespace (line 15) | namespace Json {
function namespace (line 20) | namespace J1939 {
FILE: J1939/include/J1939Factory.h
function namespace (line 46) | namespace J1939 {
FILE: J1939/include/J1939Frame.h
function namespace (line 51) | namespace J1939 {
FILE: J1939/include/SPN/SPN.h
function namespace (line 19) | namespace J1939 {
FILE: J1939/include/SPN/SPNHistory.h
function namespace (line 25) | namespace J1939 {
FILE: J1939/include/SPN/SPNNumeric.h
function namespace (line 15) | namespace J1939 {
FILE: J1939/include/SPN/SPNSpec/SPNNumericSpec.h
function namespace (line 16) | namespace J1939 {
FILE: J1939/include/SPN/SPNSpec/SPNSpec.h
function namespace (line 15) | namespace J1939 {
FILE: J1939/include/SPN/SPNSpec/SPNStatusSpec.h
function namespace (line 15) | namespace J1939 {
FILE: J1939/include/SPN/SPNStatus.h
function namespace (line 17) | namespace J1939 {
FILE: J1939/include/SPN/SPNString.h
function namespace (line 15) | namespace J1939 {
FILE: J1939/include/Transport/BAM/BamFragmenter.h
function namespace (line 17) | namespace J1939 {
FILE: J1939/include/Transport/BAM/BamReassembler.h
function namespace (line 33) | namespace J1939 {
FILE: J1939/include/Transport/RTSCTS/RTSCTSConnectionManager.h
function namespace (line 21) | namespace J1939 {
FILE: J1939/include/Transport/TPCMFrame.h
function namespace (line 129) | namespace J1939 {
FILE: J1939/include/Transport/TPDTFrame.h
function namespace (line 18) | namespace J1939 {
FILE: Tests/BAM_test.cpp
function TEST (line 18) | TEST(BAM_test, BamFragmenter) {
function TEST (line 133) | TEST(BAM_test, BamReassembler_ok) {
function TEST (line 245) | TEST(BAM_test, BamReassembler_ko1) {
function TEST (line 308) | TEST(BAM_test, BamReassembler_ko2) {
function TEST (line 434) | TEST(BAM_test, BamReassembler_ko3) {
function TEST (line 525) | TEST(BAM_test, BamReassembler_ko4) {
function TEST (line 630) | TEST(BAM_test, BamReassembler_ko5) {
FILE: Tests/SPNNumeric_test.cpp
function TEST (line 9) | TEST(SPNNumeric_test, constructor) {
function TEST (line 27) | TEST(SPNNumeric_test, copy_constructor) {
function TEST (line 52) | TEST(SPNNumeric_test, encode) {
function TEST (line 148) | TEST(SPNNumeric_test, decode) {
FILE: Tests/SPNStatus_test.cpp
function TEST (line 9) | TEST(SPNStatus_test, constructor) {
function TEST (line 38) | TEST(SPNStatus_test, copy_constructor) {
function TEST (line 75) | TEST(SPNStatus_test, encode) {
FILE: Tests/SPNString_test.cpp
function TEST (line 9) | TEST(SPNString_test, constructor) {
function TEST (line 23) | TEST(SPNString_test, copy_constructor) {
function TEST (line 44) | TEST(SPNString_test, offset) {
function TEST (line 56) | TEST(SPNString_test, encode) {
function TEST (line 105) | TEST(SPNString_test, decode) {
FILE: Tests/TestFrame.cpp
type J1939 (line 11) | namespace J1939 {
FILE: Tests/address_claim_frame_test.cpp
function TEST (line 7) | TEST(AddressClaimFrame_test, encode) {
function TEST (line 40) | TEST(AddressClaimFrame_test, decode) {
FILE: Tests/database_test.cpp
function TEST (line 11) | TEST(J1939DataBase_test, readDataBase) {
FILE: Tests/fms1_frame_test.cpp
function TEST (line 7) | TEST(FMS1Frame_test, encode) {
function TEST (line 154) | TEST(FMS1Frame_test, decode) {
FILE: Tests/genericframe_test.cpp
class GenericFrame_test (line 10) | class GenericFrame_test : public testing::Test
method GenericFrame_test (line 15) | GenericFrame_test() : ccvs(0xFEF1), vin(0xFEEC) {}
method SetUp (line 17) | virtual void SetUp()
method TearDown (line 76) | virtual void TearDown()
function TEST_F (line 81) | TEST_F(GenericFrame_test, spn) {
function TEST_F (line 98) | TEST_F(GenericFrame_test, encode) {
function TEST_F (line 185) | TEST_F(GenericFrame_test, decode) {
FILE: Tests/include/TestFrame.h
function namespace (line 7) | namespace J1939 {
FILE: Tests/j1939Factory_test.cpp
class J1939Factory_test (line 8) | class J1939Factory_test : public testing::Test
method J1939Factory_test (line 12) | J1939Factory_test() {}
method SetUp (line 14) | virtual void SetUp()
method TearDown (line 28) | virtual void TearDown()
function TEST_F (line 39) | TEST_F(J1939Factory_test, getJ1939Frame) {
FILE: Tests/main.cpp
function main (line 3) | int main(int argc, char **argv) {
FILE: Tests/request_frame.cpp
function TEST (line 7) | TEST(RequestFrame_test, encode) {
function TEST (line 50) | TEST(RequestFrame_test, decode) {
FILE: j1939AddressClaimer/AddressClaimer.cpp
type J1939 (line 17) | namespace J1939 {
function FrameSharedPtr (line 70) | FrameSharedPtr AddressClaimer::read(u32 timeout) {
FILE: j1939AddressClaimer/include/AddressClaimer.h
function namespace (line 28) | namespace J1939 {
FILE: wireshark/dissector/packet-j1939.cpp
function proto_register_j1939 (line 110) | void proto_register_j1939(void) {
function proto_reg_handoff_j1939 (line 206) | void proto_reg_handoff_j1939(void) {
function dissect_J1939 (line 338) | int dissect_J1939(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v...
function dissect_generic_frame (line 532) | void dissect_generic_frame(tvbuff_t *tvb, proto_tree *j1939_tree, proto_...
function dissect_fms1_frame (line 582) | void dissect_fms1_frame(tvbuff_t *tvb, proto_tree *j1939_tree, proto_ite...
function dissect_dm1_frame (line 596) | void dissect_dm1_frame(tvbuff_t *tvb, proto_tree *j1939_tree, proto_item...
FILE: wireshark/dissector/plugin.c
function plugin_register (line 21) | void plugin_register(void)
Condensed preview — 187 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (712K chars).
[
{
"path": ".travis.yml",
"chars": 771,
"preview": "dist: trusty\nsudo: required\nlanguage: cpp\n\naddons:\n apt:\n sources:\n - ubuntu-toolchain-r-test\n packages:\n "
},
{
"path": "BinTest/AccelCCVS/CMakeLists.txt",
"chars": 408,
"preview": "cmake_minimum_required(VERSION 3.5)\n\nproject(accelCCVS)\n\nset(CMAKE_BUILD_TYPE Debug) #For debug purposes\n\nfind_packag"
},
{
"path": "BinTest/AccelCCVS/src/accelCCVS.cpp",
"chars": 2321,
"preview": "#ifndef DATABASE_PATH\n#define DATABASE_PATH\t\t\"/etc/j1939/frames.json\"\n#endif\n\n#include <getopt.h>\n\n#include <memory>\n#in"
},
{
"path": "BinTest/FrameInject/CMakeLists.txt",
"chars": 419,
"preview": "cmake_minimum_required(VERSION 3.5)\n\nproject(frameInject)\n\nset(CMAKE_BUILD_TYPE Debug) #For debug purposes\n\nfind_pack"
},
{
"path": "BinTest/FrameInject/src/frame_inject.cpp",
"chars": 2435,
"preview": "#ifndef DATABASE_PATH\n#define DATABASE_PATH\t\t\"/etc/j1939/frames.json\"\n#endif\n\n#include <getopt.h>\n\n#include <memory>\n#in"
},
{
"path": "BinUtils/CMakeLists.txt",
"chars": 341,
"preview": "cmake_minimum_required(VERSION 3.5)\n\nproject(BinUtils)\n\n#set(PROPERTIES EXCLUDE_FROM_ALL TRUE)\n\nadd_subdirectory(j1939De"
},
{
"path": "BinUtils/TRCDumper/.cproject",
"chars": 14526,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<?fileVersion 4.0.0?><cproject storage_type_id=\"org.eclipse.cdt.c"
},
{
"path": "BinUtils/TRCDumper/CMakeLists.txt",
"chars": 344,
"preview": "cmake_minimum_required(VERSION 3.5)\n\nproject(TRCDumper)\n\nadd_executable(TRCDumper \n src/TRCDumper.cpp\n)\n\ntarget_inclu"
},
{
"path": "BinUtils/TRCDumper/src/TRCDumper.cpp",
"chars": 2126,
"preview": "//============================================================================\n// Name : TRCDumper.cpp\n// Author "
},
{
"path": "BinUtils/TRCPlayer/CMakeLists.txt",
"chars": 542,
"preview": "cmake_minimum_required(VERSION 3.5)\n\nproject(TRCPlayer)\n\nfind_package (Curses)\n\nif(CURSES_FOUND)\n\nmessage(\"-- NCURSES is"
},
{
"path": "BinUtils/TRCPlayer/README.md",
"chars": 181,
"preview": "\n## TRCPlayer\n\nLet's play trc files.\n\n```bash\nTRCPlayer -i vcan0 -f file.trc\n```\n\n\n\nproject(TRCToCap)\n\nfind_package (PkgConfig)\n\nif(PKGCONFIG_FOUND)\n\npkg_check_modules"
},
{
"path": "BinUtils/TRCToCap/include/config.h",
"chars": 11488,
"preview": "/* cmakeconfig.h.in */\n\n#ifndef __CONFIG_H__\n#define __CONFIG_H__\n\n/* Note: You cannot use earlier #defines in later #cm"
},
{
"path": "BinUtils/TRCToCap/include/pcapio.h",
"chars": 5419,
"preview": "/* pcapio.h\n * Declarations of our own routines for writing libpcap files.\n *\n * Wireshark - Network traffic analyzer\n *"
},
{
"path": "BinUtils/TRCToCap/src/TRCToCap.cpp",
"chars": 3364,
"preview": "//============================================================================\n// Name : TRCToCap.cpp\n// Author "
},
{
"path": "BinUtils/TRCToCap/src/pcapio.c",
"chars": 30484,
"preview": "/* pcapio.c\n * Our own private code for writing libpcap files when capturing.\n *\n * We have these because we want a way "
},
{
"path": "BinUtils/j1939AddrClaim/CMakeLists.txt",
"chars": 480,
"preview": "cmake_minimum_required(VERSION 3.5)\n\nproject(j1939AddrClaim)\n\nadd_executable(j1939AddrClaim \n j1939AddrClaim.cpp\n)\n\nt"
},
{
"path": "BinUtils/j1939AddrClaim/Readme.md",
"chars": 190,
"preview": "Used to simulate the Address Claiming Process\n\nUsage:\n\n```bash\n ./j1939AddrClaim -n <identity_number> -i <interface> "
},
{
"path": "BinUtils/j1939AddrClaim/j1939AddrClaim.cpp",
"chars": 4520,
"preview": "/*\n * AddressClaim.cpp\n *\n * Created on: Jan 13, 2019\n * Author: famez\n */\n\n\n\n#ifndef DATABASE_PATH\n#define DATABA"
},
{
"path": "BinUtils/j1939AddressMapper/CMakeLists.txt",
"chars": 442,
"preview": "cmake_minimum_required(VERSION 3.5)\n\nproject(j1939AddressMapper)\n\nadd_executable(j1939AddressMapper \n j1939AddressMap"
},
{
"path": "BinUtils/j1939AddressMapper/Readme.md",
"chars": 119,
"preview": "To detect the ECUs in the Can Network, their Sources Address and Ecu Names\n\nUsage:\n\n```bash\n j1939AddressMapper \n```\n"
},
{
"path": "BinUtils/j1939AddressMapper/j1939AddressMapper.cpp",
"chars": 3450,
"preview": "/*\n * j1939AddressMapper.cpp\n *\n * Created on: Jan 25, 2019\n * Author: famez\n */\n\n\n\n#ifndef DATABASE_PATH\n#define "
},
{
"path": "BinUtils/j1939Decoder/.cproject",
"chars": 14341,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<?fileVersion 4.0.0?><cproject storage_type_id=\"org.eclipse.cdt.c"
},
{
"path": "BinUtils/j1939Decoder/.settings/org.eclipse.cdt.codan.core.prefs",
"chars": 10364,
"preview": "eclipse.preferences.version=1\norg.eclipse.cdt.codan.checkers.errnoreturn=Warning\norg.eclipse.cdt.codan.checkers.errnoret"
},
{
"path": "BinUtils/j1939Decoder/.settings/org.eclipse.cdt.core.prefs",
"chars": 203,
"preview": "eclipse.preferences.version=1\nenvironment/project/cdt.managedbuild.config.gnu.exe.debug.1861074874/append=true\nenvironme"
},
{
"path": "BinUtils/j1939Decoder/CMakeLists.txt",
"chars": 359,
"preview": "cmake_minimum_required(VERSION 3.5)\n\nproject(j1939Decoder)\n\nadd_executable(j1939Decoder \n src/j1939Decoder.cpp\n)\n\ntar"
},
{
"path": "BinUtils/j1939Decoder/README.md",
"chars": 655,
"preview": "To decode frames. For example:\n \n```bash\n ./j1939Decoder --id 00febffe --data \"00 c4 00 00 00 00 00 00\"\n Name\tP"
},
{
"path": "BinUtils/j1939Decoder/src/j1939Decoder.cpp",
"chars": 5586,
"preview": "//============================================================================\n// Name : j1939Encoder.cpp\n// Auth"
},
{
"path": "BinUtils/j1939Sender/CMakeLists.txt",
"chars": 397,
"preview": "cmake_minimum_required(VERSION 3.5)\n\nproject(j1939Sender)\n\nadd_executable(j1939Sender \n src/j1939Sender.cpp\n)\n\ntarget"
},
{
"path": "BinUtils/j1939Sender/README.md",
"chars": 2607,
"preview": "A CLI utility to create frames, configure them and send them through the CAN bus.\n \n```bash\n j1939Sender\n Versi"
},
{
"path": "BinUtils/j1939Sender/src/j1939Sender.cpp",
"chars": 37504,
"preview": "//============================================================================\n// Name : j1939Sender.cpp\n// Autho"
},
{
"path": "BinUtils/j1939Sniffer/.cproject",
"chars": 14832,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<?fileVersion 4.0.0?><cproject storage_type_id=\"org.eclipse.cdt.c"
},
{
"path": "BinUtils/j1939Sniffer/.gitignore",
"chars": 8,
"preview": "/Debug/\n"
},
{
"path": "BinUtils/j1939Sniffer/.settings/org.eclipse.cdt.codan.core.prefs",
"chars": 13236,
"preview": "eclipse.preferences.version=1\norg.eclipse.cdt.codan.checkers.errnoreturn=Warning\norg.eclipse.cdt.codan.checkers.errnoret"
},
{
"path": "BinUtils/j1939Sniffer/CMakeLists.txt",
"chars": 763,
"preview": "cmake_minimum_required(VERSION 3.5)\n\nproject(j1939Sniffer)\n\nfind_package (Curses)\n\nif(CURSES_FOUND)\n\nmessage(\"-- NCURSES"
},
{
"path": "BinUtils/j1939Sniffer/src/j1939Sniffer.cpp",
"chars": 7915,
"preview": "/*\n * j1939Sniffer.cpp\n *\n * Created on: May 7, 2018\n * Author: fernado\n */\n\n\n#include <ncurses.h>\n\n#include <geto"
},
{
"path": "CAN/.gitignore",
"chars": 8,
"preview": "/Debug/\n"
},
{
"path": "CAN/.settings/org.eclipse.cdt.codan.core.prefs",
"chars": 10364,
"preview": "eclipse.preferences.version=1\norg.eclipse.cdt.codan.checkers.errnoreturn=Warning\norg.eclipse.cdt.codan.checkers.errnoret"
},
{
"path": "CAN/Backends/PeakCan/PeakCanChannels.cpp",
"chars": 1188,
"preview": "/*\n * PeakCanChannels.cpp\n *\n * Created on: Apr 4, 2018\n * Author: famez\n */\n\n#include <Backends/PeakCan/PeakCanCh"
},
{
"path": "CAN/Backends/PeakCan/PeakCanHelper.cpp",
"chars": 3758,
"preview": "/*\n * CanHelper.cpp\n *\n * Created on: Sep 28, 2017\n * Author: famez\n */\n\n#include <Backends/PeakCan/PeakCanHelper."
},
{
"path": "CAN/Backends/PeakCan/PeakCanReceiver.cpp",
"chars": 1312,
"preview": "/*\n * PeakCanReceiver.cpp\n *\n * Created on: May 10, 2018\n * Author: fernado\n */\n\n#include <Backends/PeakCan/PeakCa"
},
{
"path": "CAN/Backends/PeakCan/PeakCanSender.cpp",
"chars": 975,
"preview": "/*\n * CanSender.cpp\n *\n * Created on: Apr 1, 2018\n * Author: famez\n */\n\n\n#include <unistd.h>\n#include <string.h>\n\n"
},
{
"path": "CAN/Backends/PeakCan/PeakCanSymbols.cpp",
"chars": 1553,
"preview": "/*\n * PeakCanSymbols.cpp\n *\n * Created on: Apr 3, 2018\n * Author: famez\n */\n\n#include <dlfcn.h>\n\n\n#include <Backen"
},
{
"path": "CAN/Backends/Sockets/SocketCanHelper.cpp",
"chars": 5207,
"preview": "/*\n * CanHelper.cpp\n *\n * Created on: Sep 28, 2017\n * Author: famez\n */\n\n#include <unistd.h>\n#include <stdio.h>\n#i"
},
{
"path": "CAN/Backends/Sockets/SocketCanReceiver.cpp",
"chars": 3307,
"preview": "/*\n * SocketCanReceiver.cpp\n *\n * Created on: May 10, 2018\n * Author: fernado\n */\n\n\n#include <stdio.h>\n#include <s"
},
{
"path": "CAN/Backends/Sockets/SocketCanSender.cpp",
"chars": 1106,
"preview": "/*\n * CanSender.cpp\n *\n * Created on: Apr 1, 2018\n * Author: famez\n */\n\n\n\n#include <stdio.h>\n#include <string.h>\n#"
},
{
"path": "CAN/CMakeLists.txt",
"chars": 810,
"preview": "cmake_minimum_required(VERSION 3.5)\n\nproject(Can)\n\nadd_library(Can SHARED \n \t./CanFrame.cpp\n\t./TRCWriter.cpp\n\t./CanSn"
},
{
"path": "CAN/CanEasy.cpp",
"chars": 1858,
"preview": "/*\n * CanEasy.cpp\n *\n * Created on: Jan 13, 2019\n * Author: famez\n */\n\n#include <CanEasy.h>\n\nnamespace Can {\n\nstd:"
},
{
"path": "CAN/CanFrame.cpp",
"chars": 493,
"preview": "/*\n * CanFrame.cpp\n *\n * Created on: Oct 15, 2017\n * Author: famez\n */\n\n#include <sstream>\n#include <iomanip>\n\n#in"
},
{
"path": "CAN/CanSniffer.cpp",
"chars": 1835,
"preview": "/*\n * CanSniffer.cpp\n *\n * Created on: Jun 5, 2018\n * Author: fernado\n */\n\n#include <CanSniffer.h>\n#include <Asser"
},
{
"path": "CAN/CommonCanReceiver.cpp",
"chars": 624,
"preview": "#include <CommonCanReceiver.h>\n\n\nnamespace Can {\n\nbool CommonCanReceiver::setInterface(const std::string& interface) {\n\n"
},
{
"path": "CAN/CommonCanSender.cpp",
"chars": 5743,
"preview": "/*\n * CommonCanSender.cpp\n *\n * Created on: Apr 1, 2018\n * Author: famez\n */\n\n#include <unistd.h>\n\n#include <Utils"
},
{
"path": "CAN/ICanHelper.cpp",
"chars": 1719,
"preview": "/*\n * ICanHelper.cpp\n *\n * Created on: Apr 19, 2018\n * Author: famez\n */\n\n#include <ICanHelper.h>\n\n#include <Backe"
},
{
"path": "CAN/README.md",
"chars": 4807,
"preview": "# Developing with libCAN\n\n## Sending frames\n\n```c++\n\n#include <CanEasy.h>\nusing namespace Can;\n\nvoid main() {\n\n\t//Initia"
},
{
"path": "CAN/TRCReader.cpp",
"chars": 5027,
"preview": "/*\n * TRCReader.cpp\n *\n * Created on: Oct 24, 2017\n * Author: root\n */\n\n#include <limits>\n#include <vector>\n\n#incl"
},
{
"path": "CAN/TRCWriter.cpp",
"chars": 1892,
"preview": "/*\n * TRCWriter.cpp\n *\n * Created on: Jun 8, 2018\n * Author: fernado\n */\n\n#include <iomanip>\n#include <sstream>\n\n#"
},
{
"path": "CAN/include/Backends/PeakCan/PeakCanChannels.h",
"chars": 1171,
"preview": "/*\n * PeakCanChannels.h\n *\n * Created on: Apr 4, 2018\n * Author: famez\n */\n\n#ifndef BACKENDS_PEAKCAN_PEAKCANCHANNE"
},
{
"path": "CAN/include/Backends/PeakCan/PeakCanHelper.h",
"chars": 781,
"preview": "/*\n * CanHelper.h\n *\n * Created on: Sep 28, 2017\n * Author: famez\n */\n\n#ifndef PEAKCANHELPER_H_\n#define PEAKCANHEL"
},
{
"path": "CAN/include/Backends/PeakCan/PeakCanReceiver.h",
"chars": 650,
"preview": "/*\n * PeakCanReceiver.h\n *\n * Created on: May 10, 2018\n * Author: fernado\n */\n\n#ifndef BACKENDS_PEAKCAN_PEAKCANREC"
},
{
"path": "CAN/include/Backends/PeakCan/PeakCanSender.h",
"chars": 661,
"preview": "/*\n * CanSender.h\n *\n * Created on: Apr 1, 2018\n * Author: famez\n * Implementation of can sender for the linu"
},
{
"path": "CAN/include/Backends/PeakCan/PeakCanSymbols.h",
"chars": 20892,
"preview": "/*\n * PeakCanSymbols.h\n *\n * Created on: Apr 3, 2018\n * Author: famez\n */\n\n#ifndef BACKENDS_PEAKCAN_PEAKCANSYMBOLS"
},
{
"path": "CAN/include/Backends/Sockets/SocketCanHelper.h",
"chars": 925,
"preview": "/*\n * CanHelper.h\n *\n * Created on: Sep 28, 2017\n * Author: famez\n */\n\n#ifndef SOCKETCANHELPER_H_\n#define SOCKETCA"
},
{
"path": "CAN/include/Backends/Sockets/SocketCanReceiver.h",
"chars": 1009,
"preview": "/*\n * SocketCanReceiver.h\n *\n * Created on: May 10, 2018\n * Author: fernado\n */\n\n#ifndef BACKENDS_SOCKETS_SOCKETCA"
},
{
"path": "CAN/include/Backends/Sockets/SocketCanSender.h",
"chars": 679,
"preview": "/*\n * CanSender.h\n *\n * Created on: Apr 1, 2018\n * Author: famez\n * Implementation of can sender for the linu"
},
{
"path": "CAN/include/CanEasy.h",
"chars": 1062,
"preview": "/*\n * CanEasy.h\n *\n * Created on: Jan 13, 2019\n * Author: famez\n */\n\n#ifndef CANEASY_H_\n#define CANEASY_H_\n\n#inclu"
},
{
"path": "CAN/include/CanFilter.h",
"chars": 1334,
"preview": "/*\n * CanFilter.h\n *\n * Created on: Oct 15, 2017\n * Author: famez\n */\n\n#ifndef CANFILTER_H_\n#define CANFILTER_H_\n\n"
},
{
"path": "CAN/include/CanFrame.h",
"chars": 1098,
"preview": "/*\n * CanFrame.h\n *\n * Created on: Oct 15, 2017\n * Author: famez\n */\n\n#ifndef CANFRAME_H_\n#define CANFRAME_H_\n\n#in"
},
{
"path": "CAN/include/CanSniffer.h",
"chars": 1600,
"preview": "/*\n * CanSniffer.h\n *\n * Created on: Jun 5, 2018\n * Author: fernado\n */\n\n#ifndef CANSNIFFER_H_\n#define CANSNIFFER_"
},
{
"path": "CAN/include/CommonCanReceiver.h",
"chars": 996,
"preview": "/*\n * ICanReceiver.h\n *\n * Created on: May 7, 2018\n * Author: fernado\n */\n\n#ifndef COMMONCANRECEIVER_H_\n#define CO"
},
{
"path": "CAN/include/CommonCanSender.h",
"chars": 2401,
"preview": "/*\n * CommonCanSender.h\n *\n * Created on: Apr 1, 2018\n * Author: famez\n * Implementation of can sender for th"
},
{
"path": "CAN/include/ICanHelper.h",
"chars": 1236,
"preview": "/*\n * CanHelper.h\n *\n * Created on: Sep 28, 2017\n * Author: famez\n */\n\n#ifndef ICANHELPER_H_\n#define ICANHELPER_H_"
},
{
"path": "CAN/include/ICanSender.h",
"chars": 1523,
"preview": "/*\n * ICanSender.h\n *\n * Created on: Apr 1, 2018\n * Author: famez\n */\n\n#ifndef ICANSENDER_H_\n#define ICANSENDER_H_"
},
{
"path": "CAN/include/TRCReader.h",
"chars": 1207,
"preview": "/*\n * TRCReader.h\n *\n * Created on: Oct 24, 2017\n * Author: root\n */\n\n#ifndef TRCREADER_H_\n#define TRCREADER_H_\n\n\n"
},
{
"path": "CAN/include/TRCWriter.h",
"chars": 620,
"preview": "/*\n * TRCWriter.h\n *\n * Created on: Jun 8, 2018\n * Author: fernado\n */\n\n#ifndef TRCWRITER_H_\n#define TRCWRITER_H_\n"
},
{
"path": "CMakeLists.txt",
"chars": 2378,
"preview": "cmake_minimum_required(VERSION 3.5)\n\nproject(J1939Framework)\n\nset(CMAKE_BUILD_TYPE Debug) #For debug purposes\n\nset(J1"
},
{
"path": "Common/.cproject",
"chars": 11698,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<?fileVersion 4.0.0?><cproject storage_type_id=\"org.eclipse.cdt.c"
},
{
"path": "Common/.gitignore",
"chars": 8,
"preview": "/Debug/\n"
},
{
"path": "Common/CMakeLists.txt",
"chars": 294,
"preview": "cmake_minimum_required(VERSION 3.5)\n\nproject(Common)\n\nadd_library(Common STATIC \n Utils.cpp\n)\n\ntarget_include_directo"
},
{
"path": "Common/Utils.cpp",
"chars": 2380,
"preview": "/*\n * Utils.cpp\n *\n * Created on: Apr 5, 2018\n * Author: famez\n */\n\n#include <chrono>\n\n#include \"Utils.h\"\n\n\nnamesp"
},
{
"path": "Common/include/Assert.h",
"chars": 298,
"preview": "/*\n * Assert.h\n *\n * Created on: Apr 14, 2018\n * Author: famez\n */\n\n#ifndef ASSERT_H_\n#define ASSERT_H_\n\n#define A"
},
{
"path": "Common/include/ICloneable.h",
"chars": 404,
"preview": "/*\n * ICloneable.h\n *\n * Created on: Oct 10, 2017\n * Author: famez\n */\n\n#ifndef ICLONEABLE_H_\n#define ICLONEABLE_H"
},
{
"path": "Common/include/Singleton.h",
"chars": 1673,
"preview": "/*\n * Singleton.h\n *\n * Created on: Mar 15, 2016\n * Author: famez\n * Interfaz para crear una clase singleton."
},
{
"path": "Common/include/Types.h",
"chars": 314,
"preview": "/*\n * Types.h\n *\n * Created on: Sep 23, 2017\n * Author: famez\n */\n\n#ifndef TYPES_H_\n#define TYPES_H_\n\n#include <st"
},
{
"path": "Common/include/Utils.h",
"chars": 1346,
"preview": "/*\n * Utils.h\n *\n * Created on: Mar 11, 2018\n * Author: famez\n */\n\n#ifndef UTILS_H_\n#define UTILS_H_\n\n#include <io"
},
{
"path": "Database/CMakeLists.txt",
"chars": 111,
"preview": "cmake_minimum_required(VERSION 3.5)\n\nproject(Database)\n\ninstall (FILES frames.json\n DESTINATION etc/j1939/)\n"
},
{
"path": "Database/README.md",
"chars": 102,
"preview": "Contains a database with some frames defined in FMS standard. This database is used by the utilities.\n"
},
{
"path": "Database/frames.json",
"chars": 18566,
"preview": "[\n\t{\n\t\t\"name\" : \"VI\",\n\t\t\"pgn\" : 65260,\n\t\t\"length\" : 0,\n\t\t\"spns\" : \n\t\t[\n\t\t\t{\n\t\t\t\t\"name\" : \"Vehicle Number Identifier\",\n\t\t"
},
{
"path": "GUI_WEB/README.md",
"chars": 87,
"preview": "\n"
},
{
"path": "GUI_WEB/backend/CMakeLists.txt",
"chars": 889,
"preview": "cmake_minimum_required(VERSION 3.5)\n\nproject(j1939GUI)\n\nset (GUI_SERVER_DIR \"/var/www/j1939gui\")\n\nadd_definitions(-DHTTP"
},
{
"path": "GUI_WEB/backend/graph.proto",
"chars": 267,
"preview": "syntax = \"proto3\";\n\nmessage Graph {\n\n\tstring title = 1;\n\tint32 number = 2;\n\tAxis axisX = 3;\n\tAxis axisY = 4;\n\trepeated S"
},
{
"path": "GUI_WEB/backend/src/J1939GUI.cpp",
"chars": 23527,
"preview": "extern \"C\" {\n\n#include <stdio.h>\n#include <libwebsockets.h>\n\n}\n\n\n#include <string>\n#include <iostream>\n#include <sstream"
},
{
"path": "GUI_WEB/backend/src/graph.cpp",
"chars": 5516,
"preview": "#include <SPN/SPNHistory.h>\n#include <Utils.h>\n\n#include <unordered_map>\n#include <json/json.h>\n\n#include \"graph.h\"\n#inc"
},
{
"path": "GUI_WEB/backend/src/graph.h",
"chars": 357,
"preview": "#ifndef GRAPH_H_\n#define GRAPH_H_\n\nextern \"C\" {\n\n#include <libwebsockets.h>\n\n}\n\nnamespace J1939 {\n\tclass SPN;\n};\n\nnamesp"
},
{
"path": "GUI_WEB/frontend/graph.html",
"chars": 5492,
"preview": "<!doctype html>\r\n<html lang=en>\r\n<head>\r\n\t<meta charset=\"utf-8\">\r\n\t<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,c"
},
{
"path": "GUI_WEB/frontend/index.html",
"chars": 13893,
"preview": "<!doctype html>\r\n<html lang=en>\r\n<head>\r\n\t<meta charset=\"utf-8\">\r\n\t<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,c"
},
{
"path": "GUI_WEB/frontend/js/graph.js",
"chars": 3553,
"preview": "var max_plots = 5000;\n\nfunction spn_graph(margin, dom_canvas_id) {\n\n\t\n\tthis.graphRect = { x: margin, y: margin, w: windo"
},
{
"path": "J1939/.cproject",
"chars": 16160,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<?fileVersion 4.0.0?><cproject storage_type_id=\"org.eclipse.cdt.c"
},
{
"path": "J1939/.gitignore",
"chars": 8,
"preview": "/Debug/\n"
},
{
"path": "J1939/.settings/org.eclipse.cdt.codan.core.prefs",
"chars": 10364,
"preview": "eclipse.preferences.version=1\norg.eclipse.cdt.codan.checkers.errnoreturn=Warning\norg.eclipse.cdt.codan.checkers.errnoret"
},
{
"path": "J1939/Addressing/AddressClaimFrame.cpp",
"chars": 3290,
"preview": "/*\n * AdressClaimFrame.cpp\n *\n * Created on: Oct 17, 2017\n * Author: famez\n */\n\n#include <string>\n#include <sstrea"
},
{
"path": "J1939/CMakeLists.txt",
"chars": 1041,
"preview": "cmake_minimum_required(VERSION 3.5)\n\nproject(J1939)\n\nadd_library(J1939 SHARED \n \t./J1939Common.cpp\n\t./Diagnosis/Frame"
},
{
"path": "J1939/Diagnosis/DTC.cpp",
"chars": 1140,
"preview": "/*\n * DTC.cpp\n *\n * Created on: Sep 2, 2018\n * Author: fernado\n */\n\n#include <sstream>\n#include <iostream>\n\n#inclu"
},
{
"path": "J1939/Diagnosis/Frames/DM1.cpp",
"chars": 3004,
"preview": "/*\n * DM1.cpp\n *\n * Created on: Oct 15, 2017\n * Author: famez\n */\n\n#include <string.h>\n\n#include <Diagnosis/Frames"
},
{
"path": "J1939/FMS/TellTale/FMS1Frame.cpp",
"chars": 4111,
"preview": "/*\n * FMS1Frame.cpp\n *\n * Created on: Mar 11, 2018\n * Author: famez\n */\n\n#include <string>\n#include <sstream>\n#inc"
},
{
"path": "J1939/FMS/TellTale/TellTale.cpp",
"chars": 3424,
"preview": "/*\n * TellTale.cpp\n *\n * Created on: Mar 11, 2018\n * Author: famez\n */\n\n#include <sstream>\n\n#include <FMS/TellTale"
},
{
"path": "J1939/Frames/RequestFrame.cpp",
"chars": 1601,
"preview": "/*\n * RequestFrame.cpp\n *\n * Created on: Dec 20, 2018\n * Author: famez\n */\n\n#include <string>\n#include <sstream>\n#"
},
{
"path": "J1939/GenericFrame.cpp",
"chars": 5517,
"preview": "/*\n * GenericFrame.cpp\n *\n * Created on: Nov 3, 2017\n * Author: root\n */\n\n#include <string.h>\n#include <string>\n#i"
},
{
"path": "J1939/J1939Common.cpp",
"chars": 25,
"preview": "#include \"J1939Common.h\"\n"
},
{
"path": "J1939/J1939DataBase.cpp",
"chars": 9180,
"preview": "/*\n * JsonParser.cpp\n *\n * Created on: Nov 7, 2017\n * Author: root\n */\n\n#include \"J1939DataBase.h\"\n\n#include <stri"
},
{
"path": "J1939/J1939Factory.cpp",
"chars": 3722,
"preview": "/*\n * J1939Factory.cpp\n *\n * Created on: Sep 23, 2017\n * Author: famez\n */\n\n#include <J1939Factory.h>\n#include <J1"
},
{
"path": "J1939/J1939Frame.cpp",
"chars": 3676,
"preview": "/*\n * J1939Frame.cpp\n *\n * Created on: Sep 23, 2017\n * Author: famez\n */\n\n#include <string.h>\n#include <string>\n#i"
},
{
"path": "J1939/README.md",
"chars": 4269,
"preview": "# Developing with libJ1939\n\n\n## Loading the database\n\n```c++\n\n#include <J1939Factory.h>\nusing namespace J1939;\n\n#ifndef "
},
{
"path": "J1939/SPN/SPN.cpp",
"chars": 784,
"preview": "/*\n * ISPN.cpp\n *\n * Created on: Oct 24, 2017\n * Author: root\n */\n\n\n#include <string.h>\n#include <string>\n#include"
},
{
"path": "J1939/SPN/SPNHistory.cpp",
"chars": 2763,
"preview": "/*\n * SPNHistory.cpp\n *\n * Created on: 12 Feb 2019\n * Author: fernando\n */\n\n#include <algorithm>\n\n#include <SPN/SP"
},
{
"path": "J1939/SPN/SPNNumeric.cpp",
"chars": 2280,
"preview": "/*\n * SPNNumeric.cpp\n *\n * Created on: Oct 24, 2017\n * Author: root\n */\n\n\n#include <string.h>\n#include <string>\n#i"
},
{
"path": "J1939/SPN/SPNSpec/SPNNumericSpec.cpp",
"chars": 873,
"preview": "/*\n * SPNNumericSpec.cpp\n *\n * Created on: Oct 24, 2017\n * Author: root\n */\n\n\n#include <string.h>\n#include <string"
},
{
"path": "J1939/SPN/SPNSpec/SPNSpec.cpp",
"chars": 481,
"preview": "/*\n * SPNSpec.cpp\n *\n * Created on: Oct 24, 2017\n * Author: root\n */\n\n\n#include <string.h>\n#include <string>\n#incl"
},
{
"path": "J1939/SPN/SPNSpec/SPNStatusSpec.cpp",
"chars": 1101,
"preview": "/*\n * SPNStatusSpec.cpp\n *\n * Created on: Oct 24, 2017\n * Author: root\n */\n\n#include <stdio.h>\n#include <string.h>"
},
{
"path": "J1939/SPN/SPNStatus.cpp",
"chars": 2291,
"preview": "/*\n * SPNStatus.cpp\n *\n * Created on: Oct 24, 2017\n * Author: root\n */\n\n#include <stdio.h>\n#include <string.h>\n#in"
},
{
"path": "J1939/SPN/SPNString.cpp",
"chars": 2118,
"preview": "/*\n * SPNString.cpp\n *\n * Created on: 6 juil. 2018\n * Author: fernando\n */\n\n#include <string.h>\n#include <string>\n"
},
{
"path": "J1939/Transport/BAM/BamFragmenter.cpp",
"chars": 1668,
"preview": "/*\n * BamFragmenter.cpp\n *\n * Created on: Apr 22, 2018\n * Author: fernado\n */\n\n#include <Utils.h>\n#include <Transp"
},
{
"path": "J1939/Transport/BAM/BamReassembler.cpp",
"chars": 4341,
"preview": "/*\n * BamFrameSet.cpp\n *\n * Created on: Oct 2, 2017\n * Author: famez\n */\n\n#include <string.h>\n\n//Common\n#include <"
},
{
"path": "J1939/Transport/RTSCTS/RTSCTSConnectionManager.cpp",
"chars": 438,
"preview": "/*\n * RTSCTSConnectionManager.cpp\n *\n * Created on: Oct 15, 2017\n * Author: famez\n */\n\n#include \"RTSCTSConnectionM"
},
{
"path": "J1939/Transport/TPCMFrame.cpp",
"chars": 3512,
"preview": "/*\n * BAMHeaderFrame.cpp\n *\n * Created on: Oct 2, 2017\n * Author: famez\n */\n\n#include <string.h>\n\n#include <Transp"
},
{
"path": "J1939/Transport/TPDTFrame.cpp",
"chars": 1029,
"preview": "/*\n * BamDataframe.cpp\n *\n * Created on: Oct 2, 2017\n * Author: famez\n */\n\n#include <string.h>\n#include <Utils.h>\n"
},
{
"path": "J1939/include/Addressing/AddressClaimFrame.h",
"chars": 4640,
"preview": "/*\n * AdressClaimFrame.h\n *\n * Created on: Oct 17, 2017\n * Author: famez\n */\n\n#ifndef ADDRESSING_ADRESSCLAIMFRAME_"
},
{
"path": "J1939/include/Diagnosis/DTC.h",
"chars": 1438,
"preview": "/*\n * DTC.h\n *\n * Created on: Sep 2, 2018\n * Author: fernado\n */\n\n#ifndef DIAGNOSIS_DTC_H_\n#define DIAGNOSIS_DTC_H"
},
{
"path": "J1939/include/Diagnosis/Frames/DM1.h",
"chars": 1069,
"preview": "/*\n * DM1.h\n *\n * Created on: Oct 15, 2017\n * Author: famez\n */\n\n#ifndef DIAGNOSIS_FRAMES_DM1_H_\n#define DIAGNOSIS"
},
{
"path": "J1939/include/FMS/TellTale/FMS1Frame.h",
"chars": 1108,
"preview": "/*\n * FMS1Frame.h\n *\n * Created on: Mar 11, 2018\n * Author: famez\n */\n\n#ifndef TELLTALE_FMS1FRAME_H_\n#define TELLT"
},
{
"path": "J1939/include/FMS/TellTale/TellTale.h",
"chars": 1212,
"preview": "/*\n * TellTale.h\n *\n * Created on: Mar 11, 2018\n * Author: famez\n */\n\n#ifndef TELLTALE_TELLTALE_H_\n#define TELLTAL"
},
{
"path": "J1939/include/Frames/RequestFrame.h",
"chars": 870,
"preview": "/*\n * RequestFrame.h\n *\n * Created on: Dec 20, 2018\n * Author: famez\n */\n\n#ifndef ADDRESSING_REQUESTFRAME_H_\n#defi"
},
{
"path": "J1939/include/GenericFrame.h",
"chars": 1793,
"preview": "/*\n * GenericFrame.h\n *\n * Created on: Nov 3, 2017\n * Author: root\n */\n\n#ifndef GENERICFRAME_H_\n#define GENERICFRA"
},
{
"path": "J1939/include/J1939Common.h",
"chars": 1512,
"preview": "#ifndef J1939COMMON_H\n#define J1939COMMON_H\n\n\n#include <exception>\n#include <string>\n\n#define J1939_MAX_SIZE\t\t\t\t8\n\n#defi"
},
{
"path": "J1939/include/J1939DataBase.h",
"chars": 1815,
"preview": "/*\n * JsonParser.h\n *\n * Created on: Nov 7, 2017\n * Author: root\n */\n\n#ifndef SRC_J1939DATABASE_H_\n#define SRC_J19"
},
{
"path": "J1939/include/J1939Factory.h",
"chars": 2576,
"preview": "/*\n * J1939Factory.h\n *\n * Created on: Sep 23, 2017\n * Author: famez\n */\n\n\n/*\nMIT License\n\nCopyright (c) 2018 Fern"
},
{
"path": "J1939/include/J1939Frame.h",
"chars": 5022,
"preview": "/*\n * J1939Frame.h\n *\n * Created on: Sep 23, 2017\n * Author: famez\n *\n *\n *\n */\n\n/*\nMIT License\n\nCopyright (c) 201"
},
{
"path": "J1939/include/SPN/SPN.h",
"chars": 1328,
"preview": "/*\n * SPN.h\n *\n * Created on: Oct 24, 2017\n * Author: root\n */\n\n#ifndef SPN_H_\n#define SPN_H_\n\n#include <memory>\n#"
},
{
"path": "J1939/include/SPN/SPNHistory.h",
"chars": 2307,
"preview": "/*\n * SPNHistory.h\n *\n * Created on: 12 Feb 2019\n * Author: fernando\n *\n * For the moment, it only supports h"
},
{
"path": "J1939/include/SPN/SPNNumeric.h",
"chars": 1558,
"preview": "/*\n * SPNNumeric.h\n *\n * Created on: Oct 24, 2017\n * Author: root\n */\n\n#ifndef SPN_SPNNUMERIC_H_\n#define SPN_SPNNU"
},
{
"path": "J1939/include/SPN/SPNSpec/SPNNumericSpec.h",
"chars": 1312,
"preview": "/*\n * SPNNumericSpec.h\n *\n * Created on: Oct 24, 2017\n * Author: root\n */\n\n#ifndef SPN_SPNNUMERIC_SPEC_H_\n#define "
},
{
"path": "J1939/include/SPN/SPNSpec/SPNSpec.h",
"chars": 749,
"preview": "/*\n * SPNSpec.h\n *\n * Created on: Oct 24, 2017\n * Author: root\n */\n\n#ifndef SPN_SPEC_H_\n#define SPN_SPEC_H_\n\n#incl"
},
{
"path": "J1939/include/SPN/SPNSpec/SPNStatusSpec.h",
"chars": 1195,
"preview": "/*\n * SPNStatusSpec.h\n *\n * Created on: Oct 24, 2017\n * Author: root\n */\n\n#ifndef SPN_SPNSTATUS_SPEC_H_\n#define SP"
},
{
"path": "J1939/include/SPN/SPNStatus.h",
"chars": 1453,
"preview": "\n/*\n * SPNStatus.h\n *\n * Created on: Oct 24, 2017\n * Author: root\n */\n\n#ifndef SPN_SPNSTATUS_H_\n#define SPN_SPNSTA"
},
{
"path": "J1939/include/SPN/SPNString.h",
"chars": 1028,
"preview": "/*\n * SPNString.h\n *\n * Created on: 6 juil. 2018\n * Author: fernando\n */\n\n#ifndef SPN_SPNSTRING_H_\n#define SPN_SPN"
},
{
"path": "J1939/include/Transport/BAM/BamFragmenter.h",
"chars": 709,
"preview": "/*\n * BamFragmenter.h\n *\n * Created on: Apr 22, 2018\n * Author: fernado\n */\n\n#ifndef TRANSPORT_BAM_BAMFRAGMENTER_H"
},
{
"path": "J1939/include/Transport/BAM/BamReassembler.h",
"chars": 2167,
"preview": "/*\n *\n * Created on: Oct 2, 2017\n * Author: famez\n *\n *\n * Global communication – Broadcast Announce Message (BAM)"
},
{
"path": "J1939/include/Transport/RTSCTS/RTSCTSConnectionManager.h",
"chars": 1023,
"preview": "/*\n * RTSCTSConnectionManager.h\n *\n * Created on: Oct 15, 2017\n * Author: famez\n *\n * Specific communication – Con"
},
{
"path": "J1939/include/Transport/TPCMFrame.h",
"chars": 8746,
"preview": "/*\n * BAMHeaderFrame.h\n *\n * Created on: Oct 2, 2017\n * Author: famez\n */\n\n#ifndef FRAMES_BAMHEADERFRAME_H_\n#defin"
},
{
"path": "J1939/include/Transport/TPDTFrame.h",
"chars": 924,
"preview": "/*\n * BamDataframe.h\n *\n * Created on: Oct 2, 2017\n * Author: famez\n */\n\n#ifndef FRAMES_BAMDATAFRAME_H_\n#define FR"
},
{
"path": "LICENSE",
"chars": 1085,
"preview": "MIT License\n\nCopyright (c) 2018 Fernando Ámez García (famez)\n\nPermission is hereby granted, free of charge, to any perso"
},
{
"path": "README.md",
"chars": 3816,
"preview": "[](https://travis-ci.com/famez/J193"
},
{
"path": "Scripts/Readme.md",
"chars": 127,
"preview": "To run a script (i.e gear_level.sh):\n\n```bash\n ./gear_level.sh vcan0 | j1939Sender --silent --file define_frames.j193"
},
{
"path": "Scripts/define_frames.j1939",
"chars": 2209,
"preview": "create frame name: ccvs title: CCVS\ncreate frame name: eec1 title: EEC1\ncreate frame name: lfc title: LFC\ncreate frame n"
},
{
"path": "Scripts/gear_level.sh",
"chars": 476,
"preview": "echo \"set frame etc2 spn: 523 value: 0\"\necho \"send frame etc2 interface: ${1}\"\nsleep 5\necho \"set frame etc2 spn: 523 val"
},
{
"path": "Scripts/simulate_dtc.sh",
"chars": 480,
"preview": "#!/bin/bash\n\necho \"create frame name: dm1 title: DM1\"\n\necho \"set frame dm1 period: 1000 source: 10\"\n\necho \"add dtc dm1 o"
},
{
"path": "Scripts/simulate_fuel_cons.sh",
"chars": 397,
"preview": "#!/bin/bash\n\n\ncat <<EOF\n\n\nset frame vin vin: abcde012345678901\nset frame ccvs spn: 84 value: 40\nset frame eec1 spn: 190 "
},
{
"path": "Scripts/test_tco.sh",
"chars": 943,
"preview": "#!/bin/bash\n\n\necho \"set frame tco1 spn: 1615 value: 0\"\necho \"set frame tco1 spn: 1616 value: 0\"\n\necho \"set frame tco1 sp"
},
{
"path": "Tests/BAM_test.cpp",
"chars": 13825,
"preview": "#include <vector>\n\n\n#include <gtest/gtest.h>\n\n#include <TestFrame.h>\n\n#include <Transport/BAM/BamReassembler.h>\n#include"
},
{
"path": "Tests/CMakeLists.txt",
"chars": 625,
"preview": "cmake_minimum_required(VERSION 3.5)\n\n# Locate GTest\nfind_package(GTest REQUIRED)\n\n\ninclude_directories(\n\t\t\tinclude\n\t\t\t${"
},
{
"path": "Tests/SPNNumeric_test.cpp",
"chars": 4176,
"preview": "#include <gtest/gtest.h>\n\n#include <J1939Common.h>\n#include <SPN/SPNNumeric.h>\n\nusing namespace J1939;\n\n\nTEST(SPNNumeric"
},
{
"path": "Tests/SPNStatus_test.cpp",
"chars": 2866,
"preview": "#include <gtest/gtest.h>\n\n#include <J1939Common.h>\n#include <SPN/SPNStatus.h>\n\nusing namespace J1939;\n\n\nTEST(SPNStatus_t"
},
{
"path": "Tests/SPNString_test.cpp",
"chars": 2064,
"preview": "#include <gtest/gtest.h>\n\n#include <J1939Common.h>\n#include <SPN/SPNString.h>\n\nusing namespace J1939;\n\n\nTEST(SPNString_t"
},
{
"path": "Tests/TestFrame.cpp",
"chars": 334,
"preview": "/*\n * TestFrame.cpp\n */\n\n\n\n#include <TestFrame.h>\n#include <string.h>\n\n\nnamespace J1939 {\n\nvoid TestFrame::decodeData(co"
},
{
"path": "Tests/address_claim_frame_test.cpp",
"chars": 1492,
"preview": "#include <gtest/gtest.h>\n\n#include <Addressing/AddressClaimFrame.h>\n\nusing namespace J1939;\n\nTEST(AddressClaimFrame_test"
},
{
"path": "Tests/database/test1.json",
"chars": 2089,
"preview": "[\n\t{\n\t\t\"name\" : \"Frame1\",\n\t\t\"pgn\" : 65000,\n\t\t\"length\" : 0,\n\t\t\"spns\" : \n\t\t[\n\t\t\t{\n\t\t\t\t\"name\" : \"spn_string1\",\n\t\t\t\t\"number\""
},
{
"path": "Tests/database/test2.json",
"chars": 1869,
"preview": "[\n\t{\n\t\t\"name\" : \"Frame1\",\n\t\t\"pgn\" : 65000,\n\t\t\"length\" : 0,\n\t\t\"spns\" : \n\t\t[\n\t\t\t{\n\t\t\t\t\"name\" : \"spn_string1\",\n\t\t\t\t\"number\""
},
{
"path": "Tests/database/test3.json",
"chars": 2089,
"preview": "[\n\t{\n\t\t\"name\" : \"Frame1\",\n\t\t\"pgn\" : 65000,\n\t\t\"length\" : 0,\n\t\t\"spns\" : \n\t\t[\n\t\t\t{\n\t\t\t\t\"name\" : \"spn_string1\",\n\t\t\t\t\"number\""
},
{
"path": "Tests/database/test4.json",
"chars": 2089,
"preview": "[\n\t{\n\t\t\"name\" : \"Frame1\",\n\t\t\"pgn\" : 65000,\n\t\t\"length\" : 0,\n\t\t\"spns\" : \n\t\t[\n\t\t\t{\n\t\t\t\t\"name\" : \"spn_string1\",\n\t\t\t\t\"number\""
},
{
"path": "Tests/database/test5.json",
"chars": 2089,
"preview": "[\n\t{\n\t\t\"name\" : \"Frame1\",\n\t\t\"pgn\" : 65000,\n\t\t\"length\" : 0,\n\t\t\"spns\" : \n\t\t[\n\t\t\t{\n\t\t\t\t\"name\" : \"spn_string1\",\n\t\t\t\t\"number\""
},
{
"path": "Tests/database_test.cpp",
"chars": 7080,
"preview": "#include <gtest/gtest.h>\n\n#include <GenericFrame.h>\n#include <J1939DataBase.h>\n#include <SPN/SPNNumeric.h>\n#include <SPN"
},
{
"path": "Tests/fms1_frame_test.cpp",
"chars": 5532,
"preview": "#include <gtest/gtest.h>\n\n#include <FMS/TellTale/FMS1Frame.h>\n\nusing namespace J1939;\n\nTEST(FMS1Frame_test, encode) {\n\n\t"
},
{
"path": "Tests/genericframe_test.cpp",
"chars": 4982,
"preview": "#include <gtest/gtest.h>\n\n#include <GenericFrame.h>\n#include <SPN/SPNNumeric.h>\n#include <SPN/SPNStatus.h>\n#include <SPN"
},
{
"path": "Tests/include/TestFrame.h",
"chars": 603,
"preview": "#ifndef TESTFRAME_H_\n#define TESTFRAME_H_\n\n#include <J1939Frame.h>\n\n\nnamespace J1939 {\n\n\nclass TestFrame : public J1939F"
},
{
"path": "Tests/j1939Factory_test.cpp",
"chars": 2242,
"preview": "#include <gtest/gtest.h>\n\n#include <J1939Factory.h>\n#include <TestFrame.h>\n\nusing namespace J1939;\n\nclass J1939Factory_t"
},
{
"path": "Tests/main.cpp",
"chars": 132,
"preview": "#include <gtest/gtest.h>\n\nint main(int argc, char **argv) {\n testing::InitGoogleTest(&argc, argv);\n return RUN_ALL"
},
{
"path": "Tests/request_frame.cpp",
"chars": 1318,
"preview": "#include <gtest/gtest.h>\n\n#include <Frames/RequestFrame.h>\n\nusing namespace J1939;\n\nTEST(RequestFrame_test, encode) {\n\n\t"
},
{
"path": "cmake/FindLibWebSockets.cmake",
"chars": 962,
"preview": "# This module tries to find libWebsockets library and include files\n#\n# LIBWEBSOCKETS_INCLUDE_DIR, path where to find li"
},
{
"path": "cmake/J1939FrameworkConfig.cmake",
"chars": 131,
"preview": "include(\"${CMAKE_CURRENT_LIST_DIR}/J1939FrameworkTargets.cmake\")\nset(J1939_Database ${CMAKE_INSTALL_PREFIX}/etc/j1939/fr"
},
{
"path": "j1939AddressClaimer/AddressClaimer.cpp",
"chars": 5360,
"preview": "/*\n * AddressClaimer.cpp\n *\n * Created on: Jan 7, 2019\n * Author: famez\n */\n\n#include <AddressClaimer.h>\n\n#include"
},
{
"path": "j1939AddressClaimer/CMakeLists.txt",
"chars": 473,
"preview": "cmake_minimum_required(VERSION 3.5)\n\nproject(J1939AddressClaimer)\n\nadd_library(J1939AddressClaimer SHARED \n \t./Addres"
},
{
"path": "j1939AddressClaimer/include/AddressClaimer.h",
"chars": 1559,
"preview": "/*\n * AddressClaimer.h\n *\n * Created on: Jan 7, 2019\n * Author: famez\n */\n\n#ifndef ADDRESSCLAIMER_H_\n#define ADDRE"
},
{
"path": "wireshark/dissector/CMakeLists.txt",
"chars": 1305,
"preview": "# CMakeLists.txt\n#\n# Wireshark - Network traffic analyzer\n# By Gerald Combs <gerald@wireshark.org>\n# Copyright 1998 Gera"
},
{
"path": "wireshark/dissector/Readme.md",
"chars": 1030,
"preview": "### J1939 Dissector for wireshark\n\n#### To install the plugin\n\n```\nsudo apt-get install glib2.0 libgcrypt11-dev qt5-defa"
},
{
"path": "wireshark/dissector/packet-j1939.cpp",
"chars": 16541,
"preview": "extern \"C\" {\n\n#include \"config.h\"\n\n#include <epan/packet.h>\n#include <epan/address_types.h>\n#include <wsutil/pint.h>\n\n\n\n"
},
{
"path": "wireshark/dissector/plugin.c",
"chars": 600,
"preview": "\n\n#include \"config.h\"\n\n#include <gmodule.h>\n\n/* plugins are DLLs */\n#define WS_BUILD_DLL\n#include \"ws_symbol_export.h\"\n\n"
}
]
About this extraction
This page contains the full source code of the famez/J1939-Framework GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 187 files (624.3 KB), approximately 190.9k tokens, and a symbol index with 308 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.