Compare commits
12 Commits
14cf054635
...
cb346d25ff
| Author | SHA1 | Date |
|---|---|---|
|
|
cb346d25ff | |
|
|
398d8cbb16 | |
|
|
2d99a30fe1 | |
|
|
b5c38dc5b9 | |
|
|
7e362ec6ff | |
|
|
bad0c70ad5 | |
|
|
02c04143d0 | |
|
|
fadeaec512 | |
|
|
e9b0cdae56 | |
|
|
bac4d86c57 | |
|
|
f58f478ddb | |
|
|
675842cf9c |
|
|
@ -12,10 +12,10 @@ option(LIBICSNEO_BUILD_DOCS "Build documentation. Don't use in Visual Studio." O
|
|||
option(LIBICSNEO_BUILD_EXAMPLES "Build examples." ON)
|
||||
option(LIBICSNEO_BUILD_ICSNEO "Build dynamic C library" ON)
|
||||
option(LIBICSNEO_BUILD_ICSNEO_STATIC "Build static C library" ON)
|
||||
option(LIBICSNEO_BUILD_ICSNEOC "Build dynamic C legacy library" OFF)
|
||||
option(LIBICSNEO_BUILD_ICSNEOC_STATIC "Build static C legacy library" OFF)
|
||||
option(LIBICSNEO_BUILD_ICSNEOLEGACY "Build icsnVC40 compatibility library" OFF)
|
||||
option(LIBICSNEO_BUILD_ICSNEOLEGACY_STATIC "Build static icsnVC40 compatibility library" OFF)
|
||||
option(LIBICSNEO_BUILD_ICSNEOC "Build dynamic C legacy library" ON)
|
||||
option(LIBICSNEO_BUILD_ICSNEOC_STATIC "Build static C legacy library" ON)
|
||||
option(LIBICSNEO_BUILD_ICSNEOLEGACY "Build icsnVC40 compatibility library" ON)
|
||||
option(LIBICSNEO_BUILD_ICSNEOLEGACY_STATIC "Build static icsnVC40 compatibility library" ON)
|
||||
set(LIBICSNEO_NPCAP_INCLUDE_DIR "" CACHE STRING "Npcap include directory; set to build with Npcap")
|
||||
|
||||
# Device Drivers
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include "icsneo/communication/message/canmessage.h"
|
||||
#include "icsneo/communication/message/linmessage.h"
|
||||
#include "icsneo/communication/message/ethernetmessage.h"
|
||||
#include "icsneo/communication/packet/canpacket.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
|
@ -499,6 +500,23 @@ ICSNEO_API icsneo_error_t icsneo_get_bus_type_name(icsneo_msg_bus_type_t* bus_ty
|
|||
return safe_str_copy(value, value_length, bus_type_str) ? icsneo_error_success : icsneo_error_string_copy_failed;
|
||||
}
|
||||
|
||||
ICSNEO_API icsneo_error_t icsneo_message_is_transmit(icsneo_device_t* device, icsneo_message_t* message, bool* value) {
|
||||
if (!device || !message || !value) {
|
||||
return icsneo_error_invalid_parameters;
|
||||
}
|
||||
// TODO: Check if message is valid
|
||||
|
||||
// Make sure the message is a bus message
|
||||
if (message->message->getMsgType() != icsneo_msg_type_bus) {
|
||||
return icsneo_error_invalid_type;
|
||||
}
|
||||
// We can static cast here because we are relying on the type being correct at this point
|
||||
auto bus_message = static_cast<BusMessage*>(message->message.get());
|
||||
*value = bus_message->transmitted;
|
||||
|
||||
return icsneo_error_success;
|
||||
}
|
||||
|
||||
ICSNEO_API icsneo_error_t icsneo_message_get_netid(icsneo_device_t* device, icsneo_message_t* message, icsneo_netid_t* netid) {
|
||||
if (!device || !message || !netid) {
|
||||
return icsneo_error_invalid_parameters;
|
||||
|
|
@ -619,7 +637,7 @@ ICSNEO_API icsneo_error_t icsneo_can_message_set_arbid(icsneo_device_t* device,
|
|||
return icsneo_error_success;
|
||||
}
|
||||
|
||||
ICSNEO_API icsneo_error_t icsneo_can_message_get_dlc_on_wire(icsneo_device_t* device, icsneo_message_t* message, uint32_t* value) {
|
||||
ICSNEO_API icsneo_error_t icsneo_can_message_get_dlc(icsneo_device_t* device, icsneo_message_t* message, int32_t* value) {
|
||||
if (!device || !message || !value) {
|
||||
return icsneo_error_invalid_parameters;
|
||||
}
|
||||
|
|
@ -635,7 +653,7 @@ ICSNEO_API icsneo_error_t icsneo_can_message_get_dlc_on_wire(icsneo_device_t* de
|
|||
return icsneo_error_success;
|
||||
}
|
||||
|
||||
ICSNEO_API icsneo_error_t icsneo_can_message_set_dlc_on_wire(icsneo_device_t* device, icsneo_message_t* message, uint32_t value) {
|
||||
ICSNEO_API icsneo_error_t icsneo_can_message_set_dlc(icsneo_device_t* device, icsneo_message_t* message, int32_t value) {
|
||||
if (!device || !message) {
|
||||
return icsneo_error_invalid_parameters;
|
||||
}
|
||||
|
|
@ -646,9 +664,14 @@ ICSNEO_API icsneo_error_t icsneo_can_message_set_dlc_on_wire(icsneo_device_t* de
|
|||
return icsneo_error_invalid_type;
|
||||
}
|
||||
|
||||
can_message->dlcOnWire = static_cast<uint8_t>(value);
|
||||
|
||||
return icsneo_error_success;
|
||||
if (value < 0) {
|
||||
auto res = CAN_LengthToDLC(static_cast<uint8_t>(can_message->data.size()), can_message->isCANFD);
|
||||
can_message->dlcOnWire = res.value_or(0);
|
||||
return res.has_value() ? icsneo_error_success : icsneo_error_invalid_parameters;
|
||||
} else {
|
||||
can_message->dlcOnWire = static_cast<uint8_t>(value);
|
||||
return icsneo_error_success;
|
||||
}
|
||||
}
|
||||
|
||||
ICSNEO_API icsneo_error_t icsneo_can_message_is_remote(icsneo_device_t* device, icsneo_message_t* message, bool* value) {
|
||||
|
|
@ -935,6 +958,66 @@ ICSNEO_API icsneo_error_t icsneo_device_load_default_settings(icsneo_device_t* d
|
|||
return icsneo_error_success;
|
||||
}
|
||||
|
||||
ICSNEO_API icsneo_error_t icsneo_device_get_baudrate(icsneo_device_t* device, icsneo_netid_t netid, uint64_t* baudrate) {
|
||||
if (!device || !baudrate) {
|
||||
return icsneo_error_invalid_parameters;
|
||||
}
|
||||
// TODO: Check if device is valid
|
||||
*baudrate = device->device->settings->getBaudrateFor(Network(netid));
|
||||
if (*baudrate < 0) {
|
||||
return icsneo_error_invalid_type;
|
||||
}
|
||||
|
||||
return icsneo_error_success;
|
||||
}
|
||||
|
||||
ICSNEO_API icsneo_error_t icsneo_device_set_baudrate(icsneo_device_t* device, icsneo_netid_t netid, uint64_t baudrate, bool save) {
|
||||
if (!device) {
|
||||
return icsneo_error_invalid_parameters;
|
||||
}
|
||||
// TODO: Check if device is valid
|
||||
if (!device->device->settings->setBaudrateFor(Network(netid), baudrate)) {
|
||||
return icsneo_error_set_settings_failure;
|
||||
}
|
||||
if (save) {
|
||||
if (!device->device->settings->apply()) {
|
||||
return icsneo_error_set_settings_failure;
|
||||
}
|
||||
}
|
||||
|
||||
return icsneo_error_success;
|
||||
}
|
||||
|
||||
ICSNEO_API icsneo_error_t icsneo_device_get_canfd_baudrate(icsneo_device_t* device, icsneo_netid_t netid, uint64_t* baudrate) {
|
||||
if (!device || !baudrate) {
|
||||
return icsneo_error_invalid_parameters;
|
||||
}
|
||||
// TODO: Check if device is valid
|
||||
*baudrate = device->device->settings->getFDBaudrateFor(Network(netid));
|
||||
if (*baudrate < 0) {
|
||||
return icsneo_error_invalid_type;
|
||||
}
|
||||
|
||||
return icsneo_error_success;
|
||||
}
|
||||
|
||||
ICSNEO_API icsneo_error_t icsneo_device_set_canfd_baudrate(icsneo_device_t* device, icsneo_netid_t netid, uint64_t baudrate, bool save) {
|
||||
if (!device) {
|
||||
return icsneo_error_invalid_parameters;
|
||||
}
|
||||
// TODO: Check if device is valid
|
||||
if (!device->device->settings->setFDBaudrateFor(Network(netid), baudrate)) {
|
||||
return icsneo_error_set_settings_failure;
|
||||
}
|
||||
if (save) {
|
||||
if (!device->device->settings->apply()) {
|
||||
return icsneo_error_set_settings_failure;
|
||||
}
|
||||
}
|
||||
|
||||
return icsneo_error_success;
|
||||
}
|
||||
|
||||
ICSNEO_API icsneo_error_t icsneo_device_supports_tc10(icsneo_device_t* device, bool* supported) {
|
||||
if (!device || !supported) {
|
||||
return icsneo_error_invalid_parameters;
|
||||
|
|
|
|||
|
|
@ -274,10 +274,10 @@ bool icsneo_removeMessageCallback(const neodevice_t* device, int id) {
|
|||
return device->device->removeMessageCallback(id);
|
||||
}
|
||||
|
||||
neonetid_t icsneo_getNetworkByNumber(const neodevice_t* device, icsneo_msg_bus_type_t type, unsigned int number) {
|
||||
icsneo_netid_t icsneo_getNetworkByNumber(const neodevice_t* device, icsneo_msg_bus_type_t type, unsigned int number) {
|
||||
if(!icsneo_isValidNeoDevice(device))
|
||||
return false;
|
||||
return neonetid_t(device->device->getNetworkByNumber(icsneo::icsneo_msg_bus_type_t(type), size_t(number)).getNetID());
|
||||
return icsneo_netid_t(device->device->getNetworkByNumber(icsneo_msg_bus_type_t(type), size_t(number)).getNetID());
|
||||
}
|
||||
|
||||
bool icsneo_getProductName(const neodevice_t* device, char* str, size_t* maxLength) {
|
||||
|
|
@ -430,28 +430,28 @@ bool icsneo_settingsApplyStructureTemporary(const neodevice_t* device, const voi
|
|||
return icsneo_settingsWriteStructure(device, structure, structureSize) && icsneo_settingsApplyTemporary(device);
|
||||
}
|
||||
|
||||
int64_t icsneo_getBaudrate(const neodevice_t* device, neonetid_t netid) {
|
||||
int64_t icsneo_getBaudrate(const neodevice_t* device, icsneo_netid_t netid) {
|
||||
if(!icsneo_isValidNeoDevice(device))
|
||||
return -1;
|
||||
|
||||
return device->device->settings->getBaudrateFor(netid);
|
||||
}
|
||||
|
||||
bool icsneo_setBaudrate(const neodevice_t* device, neonetid_t netid, int64_t newBaudrate) {
|
||||
bool icsneo_setBaudrate(const neodevice_t* device, icsneo_netid_t netid, int64_t newBaudrate) {
|
||||
if(!icsneo_isValidNeoDevice(device))
|
||||
return false;
|
||||
|
||||
return device->device->settings->setBaudrateFor(netid, newBaudrate);
|
||||
}
|
||||
|
||||
int64_t icsneo_getFDBaudrate(const neodevice_t* device, neonetid_t netid) {
|
||||
int64_t icsneo_getFDBaudrate(const neodevice_t* device, icsneo_netid_t netid) {
|
||||
if(!icsneo_isValidNeoDevice(device))
|
||||
return -1;
|
||||
|
||||
return device->device->settings->getFDBaudrateFor(netid);
|
||||
}
|
||||
|
||||
bool icsneo_setFDBaudrate(const neodevice_t* device, neonetid_t netid, int64_t newBaudrate) {
|
||||
bool icsneo_setFDBaudrate(const neodevice_t* device, icsneo_netid_t netid, int64_t newBaudrate) {
|
||||
if(!icsneo_isValidNeoDevice(device))
|
||||
return false;
|
||||
|
||||
|
|
@ -628,7 +628,7 @@ bool icsneo_getSupportedDevices(icsneo_devicetype_t* devices, size_t* count) {
|
|||
}
|
||||
|
||||
for(size_t i = 0; i < len; i++)
|
||||
devices[i] = supported[i];
|
||||
devices[i] = supported[i].getDeviceType();
|
||||
*count = len;
|
||||
|
||||
return true;
|
||||
|
|
@ -671,28 +671,28 @@ bool icsneo_setDigitalIO(const neodevice_t* device, neoio_t type, uint32_t numbe
|
|||
return device->device->setDigitalIO(static_cast<icsneo::IO>(type), number, value);
|
||||
}
|
||||
|
||||
bool icsneo_isTerminationSupportedFor(const neodevice_t* device, neonetid_t netid) {
|
||||
bool icsneo_isTerminationSupportedFor(const neodevice_t* device, icsneo_netid_t netid) {
|
||||
if(!icsneo_isValidNeoDevice(device))
|
||||
return false;
|
||||
|
||||
return device->device->settings->isTerminationSupportedFor(Network(netid));
|
||||
}
|
||||
|
||||
bool icsneo_canTerminationBeEnabledFor(const neodevice_t* device, neonetid_t netid) {
|
||||
bool icsneo_canTerminationBeEnabledFor(const neodevice_t* device, icsneo_netid_t netid) {
|
||||
if(!icsneo_isValidNeoDevice(device))
|
||||
return false;
|
||||
|
||||
return device->device->settings->canTerminationBeEnabledFor(Network(netid));
|
||||
}
|
||||
|
||||
bool icsneo_isTerminationEnabledFor(const neodevice_t* device, neonetid_t netid) {
|
||||
bool icsneo_isTerminationEnabledFor(const neodevice_t* device, icsneo_netid_t netid) {
|
||||
if(!icsneo_isValidNeoDevice(device))
|
||||
return false;
|
||||
|
||||
return device->device->settings->isTerminationEnabledFor(Network(netid)).value_or(false);
|
||||
}
|
||||
|
||||
bool icsneo_setTerminationFor(const neodevice_t* device, neonetid_t netid, bool enabled) {
|
||||
bool icsneo_setTerminationFor(const neodevice_t* device, icsneo_netid_t netid, bool enabled) {
|
||||
if(!icsneo_isValidNeoDevice(device))
|
||||
return false;
|
||||
|
||||
|
|
@ -733,13 +733,13 @@ int icsneo_getDeviceStatus(const neodevice_t* device, void* status, size_t* size
|
|||
|
||||
std::shared_ptr<Message> msg = device->device->com->waitForMessageSync([&]() {
|
||||
return device->device->com->sendCommand(Command::RequestStatusUpdate);
|
||||
}, std::make_shared<MessageFilter>(Network::NetID::DeviceStatus), std::chrono::milliseconds(100));
|
||||
}, std::make_shared<MessageFilter>(icsneo_netid_device_status), std::chrono::milliseconds(100));
|
||||
|
||||
if(!msg) // Did not receive a message
|
||||
return false;
|
||||
|
||||
auto rawMessage = std::static_pointer_cast<InternalMessage>(msg);
|
||||
if(!rawMessage || (rawMessage->network.getNetID() != Network::NetID::DeviceStatus))
|
||||
if(!rawMessage || (rawMessage->network.getNetID() != icsneo_netid_device_status))
|
||||
return false;
|
||||
|
||||
if(*size < rawMessage->data.size())
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ static bool NeoMessageToSpyMessage(const neodevice_t* device, const neomessage_t
|
|||
copyStatusData();
|
||||
};
|
||||
|
||||
switch (Network::Type(frame.type))
|
||||
switch (frame.type)
|
||||
{
|
||||
case icsneo_msg_bus_type_can:
|
||||
case icsneo_msg_bus_type_swcan:
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
using namespace icsneo;
|
||||
|
||||
static std::optional<uint8_t> CAN_DLCToLength(uint8_t length, bool fd) {
|
||||
std::optional<uint8_t> icsneo::CAN_DLCToLength(uint8_t length, bool fd) {
|
||||
if (length <= 8)
|
||||
return length;
|
||||
|
||||
|
|
@ -29,8 +29,7 @@ static std::optional<uint8_t> CAN_DLCToLength(uint8_t length, bool fd) {
|
|||
return std::nullopt;
|
||||
}
|
||||
|
||||
static std::optional<uint8_t> CAN_LengthToDLC(size_t dataLength, bool fd)
|
||||
{
|
||||
std::optional<uint8_t> icsneo::CAN_LengthToDLC(size_t dataLength, bool fd) {
|
||||
if (dataLength <= 8)
|
||||
return uint8_t(dataLength);
|
||||
|
||||
|
|
|
|||
|
|
@ -36,9 +36,9 @@ the arbitration ID.
|
|||
std::cout << "We got " << messages.size() << " messages!" << std::endl;
|
||||
for(auto& msg : messages) {
|
||||
switch(msg->network.getType()) {
|
||||
case icsneo::icsneo_msg_bus_type_can:
|
||||
case icsneo::icsneo_msg_bus_type_swcan:
|
||||
case icsneo::icsneo_msg_bus_type_lsftcan: {
|
||||
case icsneo_msg_bus_type_can:
|
||||
case icsneo_msg_bus_type_swcan:
|
||||
case icsneo_msg_bus_type_lsftcan: {
|
||||
// A message of type CAN is guaranteed to be a CANMessage, so we can static cast safely
|
||||
auto canmsg = std::static_pointer_cast<icsneo::CANMessage>(msg);
|
||||
// canmsg->arbid is valid here
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
option(LIBICSNEO_BUILD_C_SIMPLE_EXAMPLE "Build the command-line simple C example." ON)
|
||||
option(LIBICSNEO_BUILD_C_LEGACY_INTERACTIVE_EXAMPLE "Build the command-line interactive C example." OFF)
|
||||
option(LIBICSNEO_BUILD_C_LEGACY_SIMPLE_EXAMPLE "Build the command-line simple C example." OFF)
|
||||
option(LIBICSNEO_BUILD_C_LEGACY_LEGACY_EXAMPLE "Build the command-line simple C example." OFF)
|
||||
option(LIBICSNEO_BUILD_C_OLD_INTERACTIVE_EXAMPLE "Build the command-line interactive C example." ON)
|
||||
option(LIBICSNEO_BUILD_C_OLD_SIMPLE_EXAMPLE "Build the command-line simple C example." ON)
|
||||
option(LIBICSNEO_BUILD_C_LEGACY_EXAMPLE "Build the command-line simple C example." ON)
|
||||
option(LIBICSNEO_BUILD_CPP_SIMPLE_EXAMPLE "Build the simple C++ example." ON)
|
||||
option(LIBICSNEO_BUILD_CPP_INTERACTIVE_EXAMPLE "Build the command-line interactive C++ example." ON)
|
||||
option(LIBICSNEO_BUILD_CPP_A2B_EXAMPLE "Build the A2B example." ON)
|
||||
|
|
@ -20,16 +20,16 @@ if(LIBICSNEO_BUILD_C_SIMPLE_EXAMPLE)
|
|||
add_subdirectory(c/simple)
|
||||
endif()
|
||||
|
||||
if(LIBICSNEO_BUILD_C_LEGACY_INTERACTIVE_EXAMPLE)
|
||||
add_subdirectory(c_legacy/interactive)
|
||||
if(LIBICSNEO_BUILD_C_OLD_INTERACTIVE_EXAMPLE)
|
||||
add_subdirectory(c_old/interactive)
|
||||
endif()
|
||||
|
||||
if(LIBICSNEO_BUILD_C_LEGACY_SIMPLE_EXAMPLE)
|
||||
add_subdirectory(c_legacy/simple)
|
||||
if(LIBICSNEO_BUILD_C_OLD_SIMPLE_EXAMPLE)
|
||||
add_subdirectory(c_old/simple)
|
||||
endif()
|
||||
|
||||
if(LIBICSNEO_BUILD_C_LEGACY_LEGACY_EXAMPLE)
|
||||
add_subdirectory(c_legacy/legacy)
|
||||
if(LIBICSNEO_BUILD_C_OLD_LEGACY_EXAMPLE)
|
||||
add_subdirectory(c_old/legacy)
|
||||
endif()
|
||||
|
||||
if(LIBICSNEO_BUILD_CPP_SIMPLE_EXAMPLE)
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@ int process_messages(icsneo_device_t* device, icsneo_message_t** messages, uint3
|
|||
|
||||
void print_device_events(icsneo_device_t* device, const char* device_description);
|
||||
|
||||
int transmit_can_messages(icsneo_device_t* device);
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
|
@ -116,6 +118,29 @@ int main(int argc, char* argv[]) {
|
|||
print_device_events(device, description);
|
||||
return print_error_code("Failed to open device", res);
|
||||
};
|
||||
// Get/Set baudrate for HSCAN
|
||||
uint64_t baudrate = 0;
|
||||
res = icsneo_device_get_baudrate(device, icsneo_netid_hscan, &baudrate);
|
||||
res += icsneo_device_set_baudrate(device, icsneo_netid_hscan, baudrate, true);
|
||||
if (res != icsneo_error_success) {
|
||||
print_device_events(device, description);
|
||||
return print_error_code("Failed to transmit CAN messages", res);
|
||||
};
|
||||
printf("HSCAN baudrate: %llu\n", baudrate);
|
||||
// Get/Set CAN FD baudrate for HSCAN
|
||||
res = icsneo_device_get_canfd_baudrate(device, icsneo_netid_hscan, &baudrate);
|
||||
res += icsneo_device_set_canfd_baudrate(device, icsneo_netid_hscan, baudrate, true);
|
||||
if (res != icsneo_error_success) {
|
||||
print_device_events(device, description);
|
||||
return print_error_code("Failed to transmit CAN messages", res);
|
||||
};
|
||||
printf("HSCAN CANFD baudrate: %llu\n", baudrate);
|
||||
// Transmit CAN messages
|
||||
res = transmit_can_messages(device);
|
||||
if (res != icsneo_error_success) {
|
||||
print_device_events(device, description);
|
||||
return print_error_code("Failed to transmit CAN messages", res);
|
||||
}
|
||||
// Wait for the bus to collect some messages, requires an active bus to get messages
|
||||
printf("Waiting 1 second for messages...\n");
|
||||
sleep_ms(1000);
|
||||
|
|
@ -192,8 +217,8 @@ void print_device_events(icsneo_device_t* device, const char* device_description
|
|||
}
|
||||
|
||||
int process_messages(icsneo_device_t* device, icsneo_message_t** messages, uint32_t messages_count) {
|
||||
printf("Received %u messages\n", messages_count);
|
||||
// Print the type and bus type of each message
|
||||
uint32_t tx_count = 0;
|
||||
for (uint32_t i = 0; i < messages_count; i++) {
|
||||
icsneo_message_t* message = messages[i];
|
||||
icsneo_msg_type_t msg_type = 0;
|
||||
|
|
@ -212,6 +237,15 @@ int process_messages(icsneo_device_t* device, icsneo_message_t** messages, uint3
|
|||
if (res != icsneo_error_success) {
|
||||
return print_error_code("Failed to get message bus type name", res);
|
||||
}
|
||||
bool is_tx = false;
|
||||
res = icsneo_message_is_transmit(device, message, &is_tx);
|
||||
if (res != icsneo_error_success) {
|
||||
return print_error_code("Failed to get message is transmit", res);
|
||||
}
|
||||
if (is_tx) {
|
||||
tx_count++;
|
||||
continue;
|
||||
}
|
||||
|
||||
printf("\t%d) Message type: %u bus type: %s (%u)\n", i, msg_type, bus_name, bus_type);
|
||||
if (bus_type == icsneo_msg_bus_type_can) {
|
||||
|
|
@ -221,6 +255,7 @@ int process_messages(icsneo_device_t* device, icsneo_message_t** messages, uint3
|
|||
bool is_remote = false;
|
||||
bool is_canfd = false;
|
||||
bool is_extended = false;
|
||||
bool is_tx = false;
|
||||
uint8_t data[64] = {0};
|
||||
uint32_t data_length = 64;
|
||||
const char netid_name[128] = {0};
|
||||
|
|
@ -228,24 +263,81 @@ int process_messages(icsneo_device_t* device, icsneo_message_t** messages, uint3
|
|||
uint32_t result = icsneo_message_get_netid(device, message, &netid);
|
||||
result += icsneo_get_netid_name(netid, netid_name, &netid_name_length);
|
||||
result += icsneo_can_message_get_arbid(device, message, &arbid);
|
||||
result += icsneo_can_message_get_dlc_on_wire(device, message, &dlc);
|
||||
result += icsneo_can_message_get_dlc(device, message, &dlc);
|
||||
result += icsneo_can_message_is_remote(device, message, &is_remote);
|
||||
result += icsneo_can_message_is_canfd(device, message, &is_canfd);
|
||||
result += icsneo_can_message_is_extended(device, message, &is_extended);
|
||||
result += icsneo_message_get_data(device, message, data, &data_length);
|
||||
result += icsneo_message_is_transmit(device, message, &is_tx);
|
||||
if (result != icsneo_error_success) {
|
||||
printf("\tFailed get get CAN parameters (error: %u) for index %u\n", result, i);
|
||||
continue;
|
||||
}
|
||||
printf("\t NetID: %s (0x%x)\tArbID: 0x%x\t DLC: %u\t Remote: %d\t CANFD: %d\t Extended: %d\t Data length: %u\n", netid_name, netid, arbid, dlc, is_remote, is_canfd, is_extended, data_length);
|
||||
printf("\t NetID: %s (0x%x)\tArbID: 0x%x\t DLC: %u\t TX: %d\t Remote: %d\t CANFD: %d\t Extended: %d\t Data length: %u\n", netid_name, netid, arbid, dlc, is_tx, is_remote, is_canfd, is_extended, data_length);
|
||||
printf("\t Data: [");
|
||||
for (uint32_t x = 0; x < data_length; x++) {
|
||||
printf(" 0x%x", data[x]);
|
||||
}
|
||||
printf(" ]\n");
|
||||
// Lets transmit the message back with an Arbitration ID 1 higher than the original.
|
||||
result = icsneo_can_message_set_arbid(device, message, arbid + 1);
|
||||
if (result != icsneo_error_success) {
|
||||
printf("\tFailed to set CAN Arbitration ID (error: %u) for index %u\n", result, i);
|
||||
continue;
|
||||
}
|
||||
uint32_t tx_msg_count = 1;
|
||||
result = icsneo_device_transmit_messages(device, &message, &tx_msg_count);
|
||||
if (result != icsneo_error_success) {
|
||||
printf("\tFailed to transmit CAN message (error: %u) for index %u\n", result, i);
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
printf("Received %u messages total, %u were TX messages\n", messages_count, tx_count);
|
||||
|
||||
return icsneo_error_success;
|
||||
}
|
||||
|
||||
int transmit_can_messages(icsneo_device_t* device) {
|
||||
uint64_t counter = 0;
|
||||
|
||||
for (uint32_t i = 0; i < 100; i++) {
|
||||
// Create the message
|
||||
icsneo_message_t* message = NULL;
|
||||
uint32_t message_count = 1;
|
||||
icsneo_error_t res = icsneo_can_messages_create(device, &message, message_count);
|
||||
if (res != icsneo_error_success) {
|
||||
return print_error_code("Failed to create messages", res);
|
||||
}
|
||||
// Set the message attributes
|
||||
res = icsneo_message_set_netid(device, message, icsneo_netid_hscan);
|
||||
res += icsneo_can_message_set_arbid(device, message, 0x10);
|
||||
res += icsneo_can_message_set_canfd(device, message, true);
|
||||
res += icsneo_can_message_set_extended(device, message, true);
|
||||
res += icsneo_can_message_set_baudrate_switch(device, message, true);
|
||||
// Create the payload
|
||||
uint8_t data[8] = {0};
|
||||
data[0] = (uint8_t)(counter >> 56);
|
||||
data[1] = (uint8_t)(counter >> 48);
|
||||
data[2] = (uint8_t)(counter >> 40);
|
||||
data[3] = (uint8_t)(counter >> 32);
|
||||
data[4] = (uint8_t)(counter >> 24);
|
||||
data[5] = (uint8_t)(counter >> 16);
|
||||
data[6] = (uint8_t)(counter >> 8);
|
||||
data[7] = (uint8_t)(counter >> 0);
|
||||
res += icsneo_message_set_data(device, message, data, sizeof(data));
|
||||
res += icsneo_can_message_set_dlc(device, message, -1);
|
||||
if (res != icsneo_error_success) {
|
||||
return print_error_code("Failed to modify message", res);
|
||||
}
|
||||
res = icsneo_device_transmit_messages(device, &message, &message_count);
|
||||
res += icsneo_can_message_free(device, message);
|
||||
if (res != icsneo_error_success) {
|
||||
return print_error_code("Failed to transmit messages", res);
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
|
||||
return icsneo_error_success;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -525,7 +525,7 @@ int main() {
|
|||
/** Example of CAN FD
|
||||
std::cout << "Transmitting an extended CAN FD frame... " << std::endl;
|
||||
auto txMessage = std::make_shared<icsneo::CANMessage>();
|
||||
txMessage->network = icsneo::Network::NetID::HSCAN;
|
||||
txMessage->network = icsneo_netid_hscan;
|
||||
txMessage->arbid = 0x1C5001C5;
|
||||
txMessage->data.insert(txMessage->data.end(), {0xaa, 0xbb, 0xcc});
|
||||
// The DLC will come from the length of the data vector
|
||||
|
|
|
|||
|
|
@ -78,7 +78,11 @@ public:
|
|||
|
||||
virtual const icsneo_msg_bus_type_t getBusType() const = 0;
|
||||
|
||||
// Description ID of the message. This is used for filtering / tracking in firmware and driver.
|
||||
// This is equivalent to icsSpyMessage::DescriptionID
|
||||
uint16_t description = 0;
|
||||
// weather the message was originally transmitted on the bus. This is equivalent to
|
||||
// SPY_STATUS_TX_MSG bit field in icsSpyMessage::StatusBitField
|
||||
bool transmitted = false;
|
||||
bool error = false;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ namespace icsneo {
|
|||
|
||||
typedef uint16_t icscm_bitfield;
|
||||
|
||||
std::optional<uint8_t> CAN_DLCToLength(uint8_t length, bool fd);
|
||||
std::optional<uint8_t> CAN_LengthToDLC(size_t dataLength, bool fd);
|
||||
|
||||
struct HardwareCANPacket {
|
||||
static std::shared_ptr<Message> DecodeToMessage(const std::vector<uint8_t>& bytestream);
|
||||
static bool EncodeFromMessage(const CANMessage& message, std::vector<uint8_t>& bytestream, const device_eventhandler_t& report);
|
||||
|
|
|
|||
|
|
@ -5,9 +5,12 @@
|
|||
#define ICSNEO_DEVICETYPE_LONGEST_NAME (35 + 1) // Add 1 so that if someone forgets, they still have space for null terminator
|
||||
#define ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION (ICSNEO_DEVICETYPE_LONGEST_NAME + 7) // 6 character serial, plus space
|
||||
|
||||
|
||||
#include <icsneo/icsneotypes.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <icsneo/icsneotypes.h>
|
||||
|
||||
|
||||
namespace icsneo {
|
||||
|
|
@ -147,3 +150,5 @@ private:
|
|||
};
|
||||
|
||||
}; // namespace icsneo
|
||||
|
||||
#endif // __cplusplus
|
||||
|
|
@ -365,6 +365,19 @@ ICSNEO_API icsneo_error_t icsneo_message_get_bus_type(icsneo_device_t* device, i
|
|||
*/
|
||||
ICSNEO_API icsneo_error_t icsneo_get_bus_type_name(icsneo_msg_bus_type_t* bus_type, const char* value, uint32_t* value_length);
|
||||
|
||||
/** @brief Get the transmission status of a message.
|
||||
*
|
||||
* When a message is transmitted from the device, It will be returned in the receive buffer.
|
||||
* @see icsneo_device_transmit_messages
|
||||
*
|
||||
* @param[in] icsneo_device_t* device The device to check against.
|
||||
* @param[in] icsneo_message_t* message The message to modify.
|
||||
* @param[out] bool value Pointer to a bool to copy the tranmission status into.
|
||||
*
|
||||
* @return icsneo_error_t icsneo_error_success if successful, icsneo_error_invalid_parameters otherwise.
|
||||
*/
|
||||
ICSNEO_API icsneo_error_t icsneo_message_is_transmit(icsneo_device_t* device, icsneo_message_t* message, bool* value);
|
||||
|
||||
/** @brief Get the Network ID (netid) of a bus message
|
||||
*
|
||||
* @param[in] icsneo_device_t* device The device to check against.
|
||||
|
|
@ -398,6 +411,8 @@ ICSNEO_API icsneo_error_t icsneo_get_netid_name(icsneo_netid_t netid, const char
|
|||
ICSNEO_API icsneo_error_t icsneo_message_set_netid(icsneo_device_t* device, icsneo_message_t* message, icsneo_netid_t netid);
|
||||
|
||||
/** @brief Set the data bytes of a message
|
||||
*
|
||||
* @note This function will not set the DLC of the message. @see icsneo_message_set_dlc
|
||||
*
|
||||
* @param[in] icsneo_device_t* device The device to check against.
|
||||
* @param[in] icsneo_message_t* message The message to copy the data into.
|
||||
|
|
@ -447,23 +462,24 @@ ICSNEO_API icsneo_error_t icsneo_can_message_set_arbid(icsneo_device_t* device,
|
|||
*
|
||||
* @return icsneo_error_t icsneo_error_success if successful, icsneo_error_invalid_parameters otherwise.
|
||||
*/
|
||||
ICSNEO_API icsneo_error_t icsneo_can_message_get_dlc_on_wire(icsneo_device_t* device, icsneo_message_t* message, uint32_t* value);
|
||||
ICSNEO_API icsneo_error_t icsneo_can_message_get_dlc(icsneo_device_t* device, icsneo_message_t* message, int32_t* value);
|
||||
|
||||
/** @brief Set the DLC on wire of a CAN message
|
||||
*
|
||||
* @param[in] icsneo_device_t* device The device to check against.
|
||||
* @param[in] icsneo_message_t* message The message to check.
|
||||
* @param[out] uint32_t value DLC to set.
|
||||
* @param[out] int32_t value DLC to set. Set to a negative value to auto calculate. Auto setting assumes data and
|
||||
* canfd parameters are correct. Set to 0 on failure. @see icsneo_can_message_set_data and icsneo_can_message_set_canfd
|
||||
*
|
||||
* @return icsneo_error_t icsneo_error_success if successful, icsneo_error_invalid_parameters otherwise.
|
||||
*/
|
||||
ICSNEO_API icsneo_error_t icsneo_can_message_set_dlc_on_wire(icsneo_device_t* device, icsneo_message_t* message, uint32_t value);
|
||||
ICSNEO_API icsneo_error_t icsneo_can_message_set_dlc(icsneo_device_t* device, icsneo_message_t* message, int32_t value);
|
||||
|
||||
/** @brief Get the Remote Transmission Request (RTR) status of a CAN message
|
||||
*
|
||||
* @param[in] icsneo_device_t* device The device to check against.
|
||||
* @param[in] icsneo_message_t* message The message to check.
|
||||
* @param[out] bool* value Pointer to a uint32_t to copy the remote status into.
|
||||
* @param[in] int32_t value DLC to get.
|
||||
*
|
||||
* @return icsneo_error_t icsneo_error_success if successful, icsneo_error_invalid_parameters otherwise.
|
||||
*/
|
||||
|
|
@ -625,12 +641,57 @@ ICSNEO_API icsneo_error_t icsneo_device_set_rtc(icsneo_device_t* device, int64_t
|
|||
/** @brief Load the default settings for a device
|
||||
*
|
||||
* @param[in] icsneo_device_t device The device to load the settings for.
|
||||
* @param[in] bool save True to make the settings permanent, false settings will be reverted on next boot.
|
||||
* @param[in] bool save True to make the settings permanent, false will be reverted on power cycle.
|
||||
*
|
||||
* @return icsneo_error_t icsneo_error_success if successful, icsneo_error_invalid_parameters otherwise.
|
||||
*/
|
||||
ICSNEO_API icsneo_error_t icsneo_device_load_default_settings(icsneo_device_t* device, bool save);
|
||||
|
||||
/** @brief Get the baudrate for a network
|
||||
*
|
||||
* @note @see icsneo_device_get_canfd_baudrate for CANFD.
|
||||
*
|
||||
* @param[in] icsneo_device_t* device The device to get the baudrate value.
|
||||
* @param[in] icsneo_netid_t netid The network to get the baudrate value.
|
||||
* @param[in] uint64_t* baudrate The baudrate to get the network value.
|
||||
*
|
||||
* @return icsneo_error_t icsneo_error_success if successful, icsneo_error_invalid_parameters otherwise.
|
||||
*/
|
||||
ICSNEO_API icsneo_error_t icsneo_device_get_baudrate(icsneo_device_t* device, icsneo_netid_t netid, uint64_t* baudrate);
|
||||
|
||||
/** @brief Set the baudrate for a network
|
||||
*
|
||||
* @note @see icsneo_device_set_canfd_baudrate for CANFD.
|
||||
*
|
||||
* @param[in] icsneo_device_t* device The device to set the baudrate for.
|
||||
* @param[in] icsneo_netid_t netid The network to set the baudrate for.
|
||||
* @param[in] uint64_t baudrate The baudrate to set the network to.
|
||||
* @param[in] bool save True to make the settings permanent, false will be reverted on power cycle.
|
||||
*
|
||||
* @return icsneo_error_t icsneo_error_success if successful, icsneo_error_invalid_parameters otherwise.
|
||||
*/
|
||||
ICSNEO_API icsneo_error_t icsneo_device_set_baudrate(icsneo_device_t* device, icsneo_netid_t netid, uint64_t baudrate, bool save);
|
||||
|
||||
/** @brief Get the baudrate for a CAN FD network
|
||||
*
|
||||
* @param[in] icsneo_device_t* device The device to get the baudrate value.
|
||||
* @param[in] icsneo_netid_t netid The network to get the baudrate value.
|
||||
* @param[in] uint64_t* baudrate The baudrate to get the network value.
|
||||
*
|
||||
* @return icsneo_error_t icsneo_error_success if successful, icsneo_error_invalid_parameters otherwise.
|
||||
*/
|
||||
ICSNEO_API icsneo_error_t icsneo_device_get_canfd_baudrate(icsneo_device_t* device, icsneo_netid_t netid, uint64_t* baudrate);
|
||||
|
||||
/** @brief Set the baudrate for a CANFD network
|
||||
*
|
||||
* @param[in] icsneo_device_t* device The device to set the baudrate for.
|
||||
* @param[in] icsneo_netid_t netid The network to set the baudrate for.
|
||||
* @param[in] uint64_t baudrate The baudrate to set the network to.
|
||||
*
|
||||
* @return icsneo_error_t icsneo_error_success if successful, icsneo_error_invalid_parameters otherwise.
|
||||
*/
|
||||
ICSNEO_API icsneo_error_t icsneo_device_set_canfd_baudrate(icsneo_device_t* device, icsneo_netid_t netid, uint64_t baudrate, bool save);
|
||||
|
||||
/** @brief Check if the device supports TC10.
|
||||
*
|
||||
* @param[in] icsneo_device_t* device The device to check against.
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ TEST_F(A2BEncoderDecoderTest, PacketEncoderTest)
|
|||
true
|
||||
);
|
||||
|
||||
messagePtr->network = icsneo::Network::NetID::A2B2;
|
||||
messagePtr->network = icsneo_netid_a2b2;
|
||||
A2BMessage& message = *messagePtr.get();
|
||||
|
||||
message.setChannelSample(
|
||||
|
|
@ -99,7 +99,7 @@ TEST_F(A2BEncoderDecoderTest, PacketDecoderTest)
|
|||
true
|
||||
);
|
||||
|
||||
message->network = icsneo::Network::NetID::A2B1;
|
||||
message->network = icsneo_netid_a2b1;
|
||||
message->txmsg = false;
|
||||
message->monitor = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -46,10 +46,10 @@ TEST_F(REDAppErrorDecoderTest, PacketDecoderTest) {
|
|||
|
||||
auto msg1 = std::make_shared<icsneo::AppErrorMessage>();
|
||||
msg1->errorType = static_cast<uint16_t>(AppErrorType::AppErrorNetworkNotEnabled);
|
||||
msg1->errorNetID = Network::NetID::HSCAN;
|
||||
msg1->errorNetID = icsneo_netid_hscan;
|
||||
msg1->timestamp10us = 0x66554433;
|
||||
msg1->timestamp10usMSB = 0xAA998877;
|
||||
msg1->network = icsneo::Network::NetID::RED_App_Error;
|
||||
msg1->network = icsneo_netid_red_app_error;
|
||||
|
||||
ringBuffer.clear();
|
||||
ringBuffer.write(testErrorData);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ protected:
|
|||
TEST_F(I2CEncoderDecoderTest, PacketEncoderTest) {
|
||||
std::vector<uint8_t> bytestream;
|
||||
auto message = std::make_shared<icsneo::I2CMessage>();
|
||||
message->network = icsneo::Network::NetID::I2C;
|
||||
message->network = icsneo_netid_i2c;
|
||||
message->controlBytes.push_back(static_cast<uint8_t>(0x12u)); //Product ID register address
|
||||
message->dataBytes.push_back(static_cast<uint8_t>(0x00u));
|
||||
message->address = 0x68u; //7 bit addressing, BASE_ADDR
|
||||
|
|
@ -66,7 +66,7 @@ TEST_F(I2CEncoderDecoderTest, PacketDecoderTest) {
|
|||
std::shared_ptr<icsneo::Message> decodeMsg;
|
||||
std::shared_ptr<icsneo::I2CMessage> message = std::make_shared<icsneo::I2CMessage>();
|
||||
|
||||
message->network = icsneo::Network::NetID::I2C;
|
||||
message->network = icsneo_netid_i2c;
|
||||
message->controlBytes.push_back(static_cast<uint8_t>(0x12u)); //Product ID register address
|
||||
message->dataBytes.push_back(static_cast<uint8_t>(0x80u));
|
||||
message->address = 0x68u; //7 bit addressing, BASE_ADDR
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ std::vector<uint8_t> testControllerWithData =
|
|||
TEST_F(LINEncoderDecoderTest, ProtectedIDCalcTest) {
|
||||
std::vector<uint8_t> bytestream;
|
||||
auto message = std::make_shared<icsneo::LINMessage>(static_cast<uint8_t>(0x22u));
|
||||
message->network = icsneo::Network::NetID::LIN;
|
||||
message->network = icsneo_netid_lin;
|
||||
message->linMsgType = icsneo::LINMessage::Type::LIN_UPDATE_RESPONDER;
|
||||
message->isEnhancedChecksum = false;
|
||||
packetEncoder->encode(*packetizer, bytestream, message);
|
||||
|
|
@ -99,7 +99,7 @@ TEST_F(LINEncoderDecoderTest, ProtectedIDCalcTest) {
|
|||
TEST_F(LINEncoderDecoderTest, ChecksumCalcTestClassic) {
|
||||
std::vector<uint8_t> bytestream;
|
||||
auto message = std::make_shared<icsneo::LINMessage>(static_cast<uint8_t>(0x22u));
|
||||
message->network = icsneo::Network::NetID::LIN2;
|
||||
message->network = icsneo_netid_lin2;
|
||||
message->linMsgType = icsneo::LINMessage::Type::LIN_UPDATE_RESPONDER;
|
||||
message->isEnhancedChecksum = false;
|
||||
message->data = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88};
|
||||
|
|
@ -110,7 +110,7 @@ TEST_F(LINEncoderDecoderTest, ChecksumCalcTestClassic) {
|
|||
TEST_F(LINEncoderDecoderTest, ChecksumCalcTestEnhanced) {
|
||||
std::vector<uint8_t> bytestream;
|
||||
auto message = std::make_shared<icsneo::LINMessage>(static_cast<uint8_t>(0x22u));
|
||||
message->network = icsneo::Network::NetID::LIN2;
|
||||
message->network = icsneo_netid_lin2;
|
||||
message->linMsgType = icsneo::LINMessage::Type::LIN_UPDATE_RESPONDER;
|
||||
message->isEnhancedChecksum = true;
|
||||
message->data = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88};
|
||||
|
|
@ -121,7 +121,7 @@ TEST_F(LINEncoderDecoderTest, ChecksumCalcTestEnhanced) {
|
|||
TEST_F(LINEncoderDecoderTest, PacketEncoderResponderLoadTest) {
|
||||
std::vector<uint8_t> bytestream;
|
||||
auto message = std::make_shared<icsneo::LINMessage>(static_cast<uint8_t>(0x22u));
|
||||
message->network = icsneo::Network::NetID::LIN2;
|
||||
message->network = icsneo_netid_lin2;
|
||||
message->linMsgType = icsneo::LINMessage::Type::LIN_UPDATE_RESPONDER;
|
||||
message->isEnhancedChecksum = false;
|
||||
message->data = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88};
|
||||
|
|
@ -132,7 +132,7 @@ TEST_F(LINEncoderDecoderTest, PacketEncoderResponderLoadTest) {
|
|||
TEST_F(LINEncoderDecoderTest, PacketEncoderControllerHeaderTest) {
|
||||
std::vector<uint8_t> bytestream;
|
||||
auto message = std::make_shared<icsneo::LINMessage>(static_cast<uint8_t>(0x22u));
|
||||
message->network = icsneo::Network::NetID::LIN;
|
||||
message->network = icsneo_netid_lin;
|
||||
message->linMsgType = icsneo::LINMessage::Type::LIN_HEADER_ONLY;
|
||||
message->isEnhancedChecksum = false;
|
||||
packetEncoder->encode(*packetizer, bytestream, message);
|
||||
|
|
@ -142,7 +142,7 @@ TEST_F(LINEncoderDecoderTest, PacketEncoderControllerHeaderTest) {
|
|||
TEST_F(LINEncoderDecoderTest, PacketEncoderControllerWithDataTest) {
|
||||
std::vector<uint8_t> bytestream;
|
||||
auto message = std::make_shared<icsneo::LINMessage>(static_cast<uint8_t>(0x11u));
|
||||
message->network = icsneo::Network::NetID::LIN;
|
||||
message->network = icsneo_netid_lin;
|
||||
message->linMsgType = icsneo::LINMessage::Type::LIN_COMMANDER_MSG;
|
||||
message->isEnhancedChecksum = false;
|
||||
message->data = {0xaa, 0xbb, 0xcc};
|
||||
|
|
@ -154,14 +154,14 @@ TEST_F(LINEncoderDecoderTest, PacketDecoderTest) {
|
|||
std::shared_ptr<icsneo::Message> decodeMsg;
|
||||
|
||||
auto msg1 = std::make_shared<icsneo::LINMessage>(static_cast<uint8_t>(0x22u));
|
||||
msg1->network = icsneo::Network::NetID::LIN2;
|
||||
msg1->network = icsneo_netid_lin2;
|
||||
msg1->linMsgType = icsneo::LINMessage::Type::LIN_COMMANDER_MSG;
|
||||
msg1->isEnhancedChecksum = false;
|
||||
msg1->data = {0xaa, 0xbb, 0xcc};
|
||||
msg1->checksum = 0xcc;
|
||||
|
||||
auto msg2 = std::make_shared<icsneo::LINMessage>(static_cast<uint8_t>(0x22u));
|
||||
msg2->network = icsneo::Network::NetID::LIN;
|
||||
msg2->network = icsneo_netid_lin;
|
||||
msg2->linMsgType = icsneo::LINMessage::Type::LIN_COMMANDER_MSG;
|
||||
msg2->isEnhancedChecksum = false;
|
||||
msg2->data = {0xaa, 0xbb, 0xcc};
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ protected:
|
|||
TEST_F(MDIOEncoderDecoderTest, PacketEncoderClause22Test) {
|
||||
std::vector<uint8_t> bytestream;
|
||||
auto message = std::make_shared<icsneo::MDIOMessage>();
|
||||
message->network = icsneo::Network::NetID::MDIO1;
|
||||
message->network = icsneo_netid_mdio1;
|
||||
message->description = 0xABCD;
|
||||
message->phyAddress = 0x18u;
|
||||
message->devAddress = 0x13u;
|
||||
|
|
@ -98,7 +98,7 @@ TEST_F(MDIOEncoderDecoderTest, PacketEncoderClause22Test) {
|
|||
TEST_F(MDIOEncoderDecoderTest, PacketEncoderClause45Test) {
|
||||
std::vector<uint8_t> bytestream;
|
||||
auto message = std::make_shared<icsneo::MDIOMessage>();
|
||||
message->network = icsneo::Network::NetID::MDIO1;
|
||||
message->network = icsneo_netid_mdio1;
|
||||
message->description = 0xABCD;
|
||||
message->phyAddress = 0x06u;
|
||||
message->devAddress = 0x14u;
|
||||
|
|
@ -114,7 +114,7 @@ TEST_F(MDIOEncoderDecoderTest, PacketEncoderClause45Test) {
|
|||
TEST_F(MDIOEncoderDecoderTest, PacketEncoderClause22MaskTest) {
|
||||
std::vector<uint8_t> bytestream;
|
||||
auto message = std::make_shared<icsneo::MDIOMessage>();
|
||||
message->network = icsneo::Network::NetID::MDIO1;
|
||||
message->network = icsneo_netid_mdio1;
|
||||
message->description = 0xFFFFu;
|
||||
message->phyAddress = 0xFFu;
|
||||
message->devAddress = 0xFFu;
|
||||
|
|
@ -130,7 +130,7 @@ TEST_F(MDIOEncoderDecoderTest, PacketEncoderClause22MaskTest) {
|
|||
TEST_F(MDIOEncoderDecoderTest, PacketEncoderClause45MaskTest) {
|
||||
std::vector<uint8_t> bytestream;
|
||||
auto message = std::make_shared<icsneo::MDIOMessage>();
|
||||
message->network = icsneo::Network::NetID::MDIO1;
|
||||
message->network = icsneo_netid_mdio1;
|
||||
message->description = 0xFFFFu;
|
||||
message->phyAddress = 0xFFu;
|
||||
message->devAddress = 0xFFu;
|
||||
|
|
@ -147,7 +147,7 @@ TEST_F(MDIOEncoderDecoderTest, PacketDecoderClause22Test) {
|
|||
std::shared_ptr<icsneo::Message> decodeMsg;
|
||||
std::shared_ptr<icsneo::MDIOMessage> message = std::make_shared<icsneo::MDIOMessage>();
|
||||
|
||||
message->network = icsneo::Network::NetID::MDIO1;
|
||||
message->network = icsneo_netid_mdio1;
|
||||
message->description = 0xABCD;
|
||||
message->phyAddress = 0x06u;
|
||||
message->devAddress = 0x00u;
|
||||
|
|
@ -188,7 +188,7 @@ TEST_F(MDIOEncoderDecoderTest, PacketDecoderClause45Test) {
|
|||
std::shared_ptr<icsneo::Message> decodeMsg;
|
||||
std::shared_ptr<icsneo::MDIOMessage> message = std::make_shared<icsneo::MDIOMessage>();
|
||||
|
||||
message->network = icsneo::Network::NetID::MDIO1;
|
||||
message->network = icsneo_netid_mdio1;
|
||||
message->description = 0xABCD;
|
||||
message->phyAddress = 0x12u;
|
||||
message->devAddress = 0x03u;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
cmake_minimum_required(VERSION 3.2)
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
project(fatfs VERSION 0.14.1) # R0.14b
|
||||
|
||||
add_library(fatfs
|
||||
|
|
|
|||
Loading…
Reference in New Issue