CI: Fix warnings
parent
0497b361ef
commit
bddbcfcf6d
|
|
@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.12)
|
||||||
project(libicsneo VERSION 0.3.0)
|
project(libicsneo VERSION 0.3.0)
|
||||||
|
|
||||||
cmake_policy(SET CMP0074 NEW)
|
cmake_policy(SET CMP0074 NEW)
|
||||||
|
if(POLICY CMP0135)
|
||||||
|
cmake_policy(SET CMP0135 NEW)
|
||||||
|
endif()
|
||||||
|
|
||||||
option(LIBICSNEO_BUILD_TESTS "Build all tests." OFF)
|
option(LIBICSNEO_BUILD_TESTS "Build all tests." OFF)
|
||||||
option(LIBICSNEO_BUILD_DOCS "Build documentation. Don't use in Visual Studio." OFF)
|
option(LIBICSNEO_BUILD_DOCS "Build documentation. Don't use in Visual Studio." OFF)
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,9 @@ std::shared_ptr<SupportedFeaturesMessage> SupportedFeaturesPacket::DecodeToMessa
|
||||||
}
|
}
|
||||||
// Get a reference to the payload to fully validate the length
|
// Get a reference to the payload to fully validate the length
|
||||||
const auto& response = *reinterpret_cast<const SupportedFeaturesResponse*>(bytes.data());
|
const auto& response = *reinterpret_cast<const SupportedFeaturesResponse*>(bytes.data());
|
||||||
|
if(response.cmdVersion != SupportedFeaturesCommandVersion) {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
// Expected size is the header, cmdVersion and numValidBits fields, plus the number of 32-bit bitfields in the response based on numValidBits
|
// Expected size is the header, cmdVersion and numValidBits fields, plus the number of 32-bit bitfields in the response based on numValidBits
|
||||||
auto expectedSize = sizeof(ExtendedResponseMessage::ResponseHeader) + 4 + ((response.numValidBits + 31) / 32) * 4;
|
auto expectedSize = sizeof(ExtendedResponseMessage::ResponseHeader) + 4 + ((response.numValidBits + 31) / 32) * 4;
|
||||||
// If the response is malformed (too small), return an empty message
|
// If the response is malformed (too small), return an empty message
|
||||||
|
|
|
||||||
|
|
@ -2980,7 +2980,6 @@ bool Device::parseVSA(
|
||||||
std::vector<uint8_t> buffer;
|
std::vector<uint8_t> buffer;
|
||||||
bool success = true;
|
bool success = true;
|
||||||
bool moreToRead = true;
|
bool moreToRead = true;
|
||||||
uint64_t numBytesRead = 0; // The number of bytes that have been read from the vsa buffer for this parse call
|
|
||||||
VSAParser::Settings parserSettings = VSAParser::Settings::messageRecords();
|
VSAParser::Settings parserSettings = VSAParser::Settings::messageRecords();
|
||||||
VSAParser parser(report, parserSettings);
|
VSAParser parser(report, parserSettings);
|
||||||
parser.setMessageFilter(filter);
|
parser.setMessageFilter(filter);
|
||||||
|
|
@ -3017,7 +3016,6 @@ bool Device::parseVSA(
|
||||||
++readAttempt;
|
++readAttempt;
|
||||||
}
|
}
|
||||||
|
|
||||||
numBytesRead += amount;
|
|
||||||
success = parser.parseBytes(buffer.data(), amount);
|
success = parser.parseBytes(buffer.data(), amount);
|
||||||
if(!success) {
|
if(!success) {
|
||||||
report(APIEvent::Type::VSAByteParseFailure, APIEvent::Severity::Error);
|
report(APIEvent::Type::VSAByteParseFailure, APIEvent::Severity::Error);
|
||||||
|
|
|
||||||
|
|
@ -545,7 +545,7 @@ bool IDeviceSettings::setBaudrateFor(Network net, int64_t baudrate) {
|
||||||
report(APIEvent::Type::BaudrateNotFound, APIEvent::Severity::Error);
|
report(APIEvent::Type::BaudrateNotFound, APIEvent::Severity::Error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
cfg->Baudrate = baudrate;
|
cfg->Baudrate = (uint32_t)baudrate;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,3 @@
|
||||||
cmake_minimum_required(VERSION 3.2)
|
|
||||||
project(libicsneoc-interactive-example VERSION 0.2.0)
|
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
|
|
||||||
# Include libicsneo's include directory
|
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../include)
|
|
||||||
|
|
||||||
if(UNIX)
|
|
||||||
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_executable(libicsneoc-interactive-example src/main.c)
|
add_executable(libicsneoc-interactive-example src/main.c)
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
target_link_libraries(libicsneoc-interactive-example ${CMAKE_DL_LIBS})
|
target_link_libraries(libicsneoc-interactive-example ${CMAKE_DL_LIBS})
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,9 @@ char getCharInput(int numArgs, ...) {
|
||||||
va_end(vaList);
|
va_end(vaList);
|
||||||
|
|
||||||
while(!found) {
|
while(!found) {
|
||||||
fgets(input, 99, stdin);
|
if(fgets(input, 99, stdin) == NULL) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
if(strlen(input) == 2) {
|
if(strlen(input) == 2) {
|
||||||
for(int i = 0; i < numArgs; ++i) {
|
for(int i = 0; i < numArgs; ++i) {
|
||||||
if(input[0] == *(list + i)) {
|
if(input[0] == *(list + i)) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
cmake_minimum_required(VERSION 3.2)
|
|
||||||
project(libicsneoc-legacy-lin-example VERSION 0.2.0)
|
|
||||||
|
|
||||||
add_executable(libicsneoc-legacy-lin-example lin/main.c)
|
add_executable(libicsneoc-legacy-lin-example lin/main.c)
|
||||||
add_executable(libicsneoc-legacy-device-settings-example deviceSettings/main.c)
|
add_executable(libicsneoc-legacy-device-settings-example deviceSettings/main.c)
|
||||||
target_link_libraries(libicsneoc-legacy-lin-example icsneolegacy)
|
target_link_libraries(libicsneoc-legacy-lin-example icsneolegacy)
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,3 @@
|
||||||
cmake_minimum_required(VERSION 3.2)
|
|
||||||
project(libicsneoc-simple-lin-example VERSION 0.2.0)
|
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
|
|
||||||
# Include libicsneo's include directory
|
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../include)
|
|
||||||
|
|
||||||
if(UNIX)
|
|
||||||
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_executable(libicsneoc-simple-lin-example lin/main.c)
|
add_executable(libicsneoc-simple-lin-example lin/main.c)
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
target_link_libraries(libicsneoc-simple-lin-example ${CMAKE_DL_LIBS})
|
target_link_libraries(libicsneoc-simple-lin-example ${CMAKE_DL_LIBS})
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,9 @@ char getCharInput(int numArgs, ...) {
|
||||||
va_end(vaList);
|
va_end(vaList);
|
||||||
|
|
||||||
while(!found) {
|
while(!found) {
|
||||||
fgets(input, 99, stdin);
|
if(fgets(input, 99, stdin) == NULL) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
if(strlen(input) == 2) {
|
if(strlen(input) == 2) {
|
||||||
for(int i = 0; i < numArgs; ++i) {
|
for(int i = 0; i < numArgs; ++i) {
|
||||||
if(input[0] == *(list + i)) {
|
if(input[0] == *(list + i)) {
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,2 @@
|
||||||
cmake_minimum_required(VERSION 3.2)
|
|
||||||
project(libicsneocpp-a2b VERSION 0.2.0)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED 11)
|
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
|
|
||||||
# Add an include directory like so if desired
|
|
||||||
#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
||||||
|
|
||||||
# Enable Warnings
|
|
||||||
if(MSVC)
|
|
||||||
# Force to always compile with W4
|
|
||||||
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
|
||||||
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
||||||
else()
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
|
|
||||||
endif()
|
|
||||||
else() #if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-switch -Wno-unknown-pragmas")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Add libicsneo, usually a git submodule within your project works well
|
|
||||||
#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../third-party/libicsneo ${CMAKE_CURRENT_BINARY_DIR}/third-party/libicsneo)
|
|
||||||
|
|
||||||
add_executable(libicsneocpp-a2b src/a2b.cpp)
|
add_executable(libicsneocpp-a2b src/a2b.cpp)
|
||||||
target_link_libraries(libicsneocpp-a2b icsneocpp)
|
target_link_libraries(libicsneocpp-a2b icsneocpp)
|
||||||
|
|
@ -1,27 +1,2 @@
|
||||||
cmake_minimum_required(VERSION 3.2)
|
|
||||||
project(libicsneocpp-coremini VERSION 0.2.0)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED 11)
|
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
|
|
||||||
# Add an include directory like so if desired
|
|
||||||
#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
||||||
|
|
||||||
# Enable Warnings
|
|
||||||
if(MSVC)
|
|
||||||
# Force to always compile with W4
|
|
||||||
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
|
||||||
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
||||||
else()
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
|
|
||||||
endif()
|
|
||||||
else() #if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-switch -Wno-unknown-pragmas")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Add libicsneo, usually a git submodule within your project works well
|
|
||||||
#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../third-party/libicsneo ${CMAKE_CURRENT_BINARY_DIR}/third-party/libicsneo)
|
|
||||||
|
|
||||||
add_executable(libicsneocpp-coremini src/coremini.cpp)
|
add_executable(libicsneocpp-coremini src/coremini.cpp)
|
||||||
target_link_libraries(libicsneocpp-coremini icsneocpp)
|
target_link_libraries(libicsneocpp-coremini icsneocpp)
|
||||||
|
|
@ -1,27 +1,2 @@
|
||||||
cmake_minimum_required(VERSION 3.2)
|
|
||||||
project(libicsneocpp-interactive-example VERSION 0.2.0)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED 11)
|
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
|
|
||||||
# Add an include directory like so if desired
|
|
||||||
#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
||||||
|
|
||||||
# Enable Warnings
|
|
||||||
if(MSVC)
|
|
||||||
# Force to always compile with W4
|
|
||||||
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
|
||||||
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
||||||
else()
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
|
|
||||||
endif()
|
|
||||||
else() #if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-switch -Wno-unknown-pragmas")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Add libicsneo, usually a git submodule within your project works well
|
|
||||||
#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../third-party/libicsneo ${CMAKE_CURRENT_BINARY_DIR}/third-party/libicsneo)
|
|
||||||
|
|
||||||
add_executable(libicsneocpp-interactive-example src/InteractiveExample.cpp)
|
add_executable(libicsneocpp-interactive-example src/InteractiveExample.cpp)
|
||||||
target_link_libraries(libicsneocpp-interactive-example icsneocpp)
|
target_link_libraries(libicsneocpp-interactive-example icsneocpp)
|
||||||
|
|
@ -1,27 +1,2 @@
|
||||||
cmake_minimum_required(VERSION 3.2)
|
|
||||||
project(libicsneocpp-lin VERSION 0.1.0)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED 11)
|
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
|
|
||||||
# Add an include directory like so if desired
|
|
||||||
#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
||||||
|
|
||||||
# Enable Warnings
|
|
||||||
if(MSVC)
|
|
||||||
# Force to always compile with W4
|
|
||||||
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
|
||||||
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
||||||
else()
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
|
|
||||||
endif()
|
|
||||||
else() #if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-switch -Wno-unknown-pragmas")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Add libicsneo, usually a git submodule within your project works well
|
|
||||||
#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../third-party/libicsneo ${CMAKE_CURRENT_BINARY_DIR}/third-party/libicsneo)
|
|
||||||
|
|
||||||
add_executable(libicsneocpp-lin src/LINExample.cpp)
|
add_executable(libicsneocpp-lin src/LINExample.cpp)
|
||||||
target_link_libraries(libicsneocpp-lin icsneocpp)
|
target_link_libraries(libicsneocpp-lin icsneocpp)
|
||||||
|
|
@ -55,6 +55,76 @@ int main() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
std::cout << "OK" << std::endl;
|
std::cout << "OK" << std::endl;
|
||||||
|
/*
|
||||||
|
std::cout << "\nApply default settings... ";
|
||||||
|
ret &= device->settings->applyDefaults();
|
||||||
|
if(!ret) {
|
||||||
|
std::cout << "FAIL\n" << std::endl;
|
||||||
|
device->close();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
std::cout << "OK" << std::endl;
|
||||||
|
*/
|
||||||
|
int64_t baud = 19200;
|
||||||
|
|
||||||
|
std::cout << "Enable LIN commander resistor... ";
|
||||||
|
ret &= device->settings->setCommanderResistorFor(icsneo::Network::NetID::LIN, true);
|
||||||
|
std::cout << (ret ? "OK" : "FAIL") << std::endl;
|
||||||
|
|
||||||
|
std::cout << "Disable LIN2 commander resistor... ";
|
||||||
|
ret &= device->settings->setCommanderResistorFor(icsneo::Network::NetID::LIN2, false);
|
||||||
|
std::cout << (ret ? "OK" : "FAIL") << std::endl;
|
||||||
|
|
||||||
|
std::cout << "Setting LIN to operate at " << baud << "bit/s... ";
|
||||||
|
ret = device->settings->setBaudrateFor(icsneo::Network::NetID::LIN, baud);
|
||||||
|
std::cout << (ret ? "OK" : "FAIL") << std::endl;
|
||||||
|
|
||||||
|
std::cout << "Setting LIN2 to operate at " << baud << "bit/s... ";
|
||||||
|
ret = device->settings->setBaudrateFor(icsneo::Network::NetID::LIN2, baud);
|
||||||
|
std::cout << (ret ? "OK" : "FAIL") << std::endl;
|
||||||
|
|
||||||
|
std::cout << "Setting LIN mode to NORMAL... ";
|
||||||
|
ret = device->settings->setLINModeFor(icsneo::Network::NetID::LIN, NORMAL_MODE);
|
||||||
|
std::cout << (ret ? "OK" : "FAIL") << std::endl;
|
||||||
|
|
||||||
|
std::cout << "Setting LIN2 mode to NORMAL... ";
|
||||||
|
ret = device->settings->setLINModeFor(icsneo::Network::NetID::LIN2, NORMAL_MODE);
|
||||||
|
std::cout << (ret ? "OK" : "FAIL") << std::endl;
|
||||||
|
|
||||||
|
std::cout << "Applying settings... ";
|
||||||
|
ret = device->settings->apply(true);
|
||||||
|
std::cout << (ret ? "OK" : "FAIL") << std::endl;
|
||||||
|
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
std::cout << "\tGetting LIN Baudrate... ";
|
||||||
|
int64_t readBaud = device->settings->getBaudrateFor(icsneo::Network::NetID::LIN);
|
||||||
|
if(readBaud < 0)
|
||||||
|
std::cout << "FAIL" << std::endl;
|
||||||
|
else
|
||||||
|
std::cout << "OK, " << (readBaud) << "bit/s" << std::endl;
|
||||||
|
|
||||||
|
readBaud = device->settings->getBaudrateFor(icsneo::Network::NetID::LIN2);
|
||||||
|
if(readBaud < 0)
|
||||||
|
std::cout << "FAIL" << std::endl;
|
||||||
|
else
|
||||||
|
std::cout << "OK, " << (readBaud) << "bit/s" << std::endl;
|
||||||
|
|
||||||
|
auto handler = device->addMessageCallback(std::make_shared<icsneo::MessageCallback>([&](std::shared_ptr<icsneo::Message> message) {
|
||||||
|
if(icsneo::Message::Type::Frame == message->type) {
|
||||||
|
auto frame = std::static_pointer_cast<icsneo::Frame>(message);
|
||||||
|
if(icsneo::Network::Type::LIN == frame->network.getType()) {
|
||||||
|
auto msg = std::static_pointer_cast<icsneo::LINMessage>(message);
|
||||||
|
std::cout << msg->network << " RX frame | ID: 0x" << std::hex << static_cast<int>(msg->ID) << " | ";
|
||||||
|
std::cout << "Protected ID: 0x" << static_cast<int>(msg->protectedID) << "\n" << "Data: ";
|
||||||
|
for(uint8_t& each : msg->data) {
|
||||||
|
std::cout << "0x" << static_cast<int>(each) << " ";
|
||||||
|
}
|
||||||
|
std::cout << "\nChecksum type: " << (msg->isEnhancedChecksum ? "Enhanced" : "Classic");
|
||||||
|
std::cout << "\nChecksum: 0x" << static_cast<int>(msg->checksum) << "\n";
|
||||||
|
std::cout << "Is checksum valid: " << ((!msg->errFlags.ErrChecksumMatch) ? "yes" : "no") << "\n\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
// The concept of going "online" tells the connected device to start listening, i.e. ACKing traffic and giving it to us
|
// The concept of going "online" tells the connected device to start listening, i.e. ACKing traffic and giving it to us
|
||||||
std::cout << "\tGoing online... ";
|
std::cout << "\tGoing online... ";
|
||||||
|
|
@ -77,54 +147,6 @@ int main() {
|
||||||
}
|
}
|
||||||
std::cout << "OK" << std::endl;
|
std::cout << "OK" << std::endl;
|
||||||
|
|
||||||
std::cout << "\tGetting LIN Baudrate... ";
|
|
||||||
int64_t baud = device->settings->getBaudrateFor(icsneo::Network::NetID::LIN);
|
|
||||||
if(baud < 0)
|
|
||||||
std::cout << "FAIL" << std::endl;
|
|
||||||
else
|
|
||||||
std::cout << "OK, " << (baud) << "bit/s" << std::endl;
|
|
||||||
|
|
||||||
std::cout << "Enable LIN commander resistor... ";
|
|
||||||
ret &= device->settings->setCommanderResistorFor(icsneo::Network::NetID::LIN, true);
|
|
||||||
std::cout << (ret ? "OK" : "FAIL") << std::endl;
|
|
||||||
|
|
||||||
std::cout << "Setting LIN2 to operate at " << baud << "bit/s... ";
|
|
||||||
ret = device->settings->setBaudrateFor(icsneo::Network::NetID::LIN2, baud);
|
|
||||||
std::cout << (ret ? "OK" : "FAIL") << std::endl;
|
|
||||||
|
|
||||||
std::cout << "Setting LIN mode to NORMAL... ";
|
|
||||||
ret = device->settings->setLINModeFor(icsneo::Network::NetID::LIN, NORMAL_MODE);
|
|
||||||
std::cout << (ret ? "OK" : "FAIL") << std::endl;
|
|
||||||
|
|
||||||
std::cout << "Setting LIN2 mode to NORMAL... ";
|
|
||||||
ret = device->settings->setLINModeFor(icsneo::Network::NetID::LIN2, NORMAL_MODE);
|
|
||||||
std::cout << (ret ? "OK" : "FAIL") << std::endl;
|
|
||||||
|
|
||||||
std::cout << "Disable LIN2 commander resistor... ";
|
|
||||||
ret &= device->settings->setCommanderResistorFor(icsneo::Network::NetID::LIN2, false);
|
|
||||||
std::cout << (ret ? "OK" : "FAIL") << std::endl;
|
|
||||||
|
|
||||||
std::cout << "Applying settings... ";
|
|
||||||
ret = device->settings->apply(true);
|
|
||||||
std::cout << (ret ? "OK" : "FAIL") << std::endl;
|
|
||||||
|
|
||||||
auto handler = device->addMessageCallback(std::make_shared<icsneo::MessageCallback>([&](std::shared_ptr<icsneo::Message> message) {
|
|
||||||
if(icsneo::Message::Type::Frame == message->type) {
|
|
||||||
auto frame = std::static_pointer_cast<icsneo::Frame>(message);
|
|
||||||
if(icsneo::Network::Type::LIN == frame->network.getType()) {
|
|
||||||
auto msg = std::static_pointer_cast<icsneo::LINMessage>(message);
|
|
||||||
std::cout << msg->network << " RX frame | ID: 0x" << std::hex << static_cast<int>(msg->ID) << " | ";
|
|
||||||
std::cout << "Protected ID: 0x" << static_cast<int>(msg->protectedID) << "\n" << "Data: ";
|
|
||||||
for(uint8_t& each : msg->data) {
|
|
||||||
std::cout << "0x" << static_cast<int>(each) << " ";
|
|
||||||
}
|
|
||||||
std::cout << "\nChecksum type: " << (msg->isEnhancedChecksum ? "Enhanced" : "Classic");
|
|
||||||
std::cout << "\nChecksum: 0x" << static_cast<int>(msg->checksum) << "\n";
|
|
||||||
std::cout << "Is checksum valid: " << ((!msg->errFlags.ErrChecksumMatch) ? "yes" : "no") << "\n\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
// We can transmit messages
|
// We can transmit messages
|
||||||
std::cout << "\tTransmitting a LIN responder data frame... ";
|
std::cout << "\tTransmitting a LIN responder data frame... ";
|
||||||
auto lin_r = std::make_shared<icsneo::LINMessage>();
|
auto lin_r = std::make_shared<icsneo::LINMessage>();
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,2 @@
|
||||||
cmake_minimum_required(VERSION 3.2)
|
|
||||||
project(libicsneocpp-livedata VERSION 0.1.0)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED 11)
|
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
|
|
||||||
# Add an include directory like so if desired
|
|
||||||
#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
||||||
|
|
||||||
# Enable Warnings
|
|
||||||
if(MSVC)
|
|
||||||
# Force to always compile with W4
|
|
||||||
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
|
||||||
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
||||||
else()
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
|
|
||||||
endif()
|
|
||||||
else() #if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-switch -Wno-unknown-pragmas")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Add libicsneo, usually a git submodule within your project works well
|
|
||||||
#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../third-party/libicsneo ${CMAKE_CURRENT_BINARY_DIR}/third-party/libicsneo)
|
|
||||||
|
|
||||||
add_executable(libicsneocpp-livedata src/LiveDataExample.cpp)
|
add_executable(libicsneocpp-livedata src/LiveDataExample.cpp)
|
||||||
target_link_libraries(libicsneocpp-livedata icsneocpp)
|
target_link_libraries(libicsneocpp-livedata icsneocpp)
|
||||||
|
|
@ -1,27 +1,2 @@
|
||||||
cmake_minimum_required(VERSION 3.2)
|
|
||||||
project(libicsneocpp-mdio VERSION 0.1.0)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED 11)
|
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
|
|
||||||
# Add an include directory like so if desired
|
|
||||||
#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
||||||
|
|
||||||
# Enable Warnings
|
|
||||||
if(MSVC)
|
|
||||||
# Force to always compile with W4
|
|
||||||
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
|
||||||
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
||||||
else()
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
|
|
||||||
endif()
|
|
||||||
else() #if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-switch -Wno-unknown-pragmas")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Add libicsneo, usually a git submodule within your project works well
|
|
||||||
#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../third-party/libicsneo ${CMAKE_CURRENT_BINARY_DIR}/third-party/libicsneo)
|
|
||||||
|
|
||||||
add_executable(libicsneocpp-mdio src/MDIOExample.cpp)
|
add_executable(libicsneocpp-mdio src/MDIOExample.cpp)
|
||||||
target_link_libraries(libicsneocpp-mdio icsneocpp)
|
target_link_libraries(libicsneocpp-mdio icsneocpp)
|
||||||
|
|
@ -1,27 +1,2 @@
|
||||||
cmake_minimum_required(VERSION 3.2)
|
|
||||||
project(libicsneocpp-simple-example VERSION 0.2.0)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED 11)
|
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
|
|
||||||
# Add an include directory like so if desired
|
|
||||||
#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
||||||
|
|
||||||
# Enable Warnings
|
|
||||||
if(MSVC)
|
|
||||||
# Force to always compile with W4
|
|
||||||
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
|
||||||
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
||||||
else()
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
|
|
||||||
endif()
|
|
||||||
else() #if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-switch -Wno-unknown-pragmas")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Add libicsneo, usually a git submodule within your project works well
|
|
||||||
#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../third-party/libicsneo ${CMAKE_CURRENT_BINARY_DIR}/third-party/libicsneo)
|
|
||||||
|
|
||||||
add_executable(libicsneocpp-simple-example src/SimpleExample.cpp)
|
add_executable(libicsneocpp-simple-example src/SimpleExample.cpp)
|
||||||
target_link_libraries(libicsneocpp-simple-example icsneocpp)
|
target_link_libraries(libicsneocpp-simple-example icsneocpp)
|
||||||
|
|
@ -1,27 +1,2 @@
|
||||||
cmake_minimum_required(VERSION 3.2)
|
|
||||||
project(libicsneocpp-vsa-example VERSION 0.1.0)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED 11)
|
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
|
||||||
|
|
||||||
# Add an include directory like so if desired
|
|
||||||
#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
||||||
|
|
||||||
# Enable Warnings
|
|
||||||
if(MSVC)
|
|
||||||
# Force to always compile with W4
|
|
||||||
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
|
||||||
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
||||||
else()
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
|
|
||||||
endif()
|
|
||||||
else() #if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-switch -Wno-unknown-pragmas")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Add libicsneo, usually a git submodule within your project works well
|
|
||||||
#add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../third-party/libicsneo ${CMAKE_CURRENT_BINARY_DIR}/third-party/libicsneo)
|
|
||||||
|
|
||||||
add_executable(libicsneocpp-vsa-example src/VSAExample.cpp)
|
add_executable(libicsneocpp-vsa-example src/VSAExample.cpp)
|
||||||
target_link_libraries(libicsneocpp-vsa-example icsneocpp)
|
target_link_libraries(libicsneocpp-vsa-example icsneocpp)
|
||||||
|
|
@ -536,8 +536,8 @@ enum
|
||||||
BPS117647
|
BPS117647
|
||||||
};
|
};
|
||||||
|
|
||||||
/* MasterResistor in LIN_SETTINGS */
|
/* CommanderResistor in LIN_SETTINGS */
|
||||||
enum
|
enum : uint8_t
|
||||||
{
|
{
|
||||||
RESISTOR_ON,
|
RESISTOR_ON,
|
||||||
RESISTOR_OFF
|
RESISTOR_OFF
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,7 @@ struct VSAExtractionSettings {
|
||||||
*/
|
*/
|
||||||
class VSA {
|
class VSA {
|
||||||
public:
|
public:
|
||||||
|
virtual ~VSA() = default;
|
||||||
static constexpr size_t StandardRecordSize = 32; // Size of most VSA records
|
static constexpr size_t StandardRecordSize = 32; // Size of most VSA records
|
||||||
static constexpr uint64_t RecordStartOffset = 0x06000000u; // Offset of VSA record ring buffer from start of VSA log file
|
static constexpr uint64_t RecordStartOffset = 0x06000000u; // Offset of VSA record ring buffer from start of VSA log file
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue