Author SHA1 Message Date
Paul Hollinsky b09f85693f v0.2.0
This update has breaking changes for the event/error subsystem, see
Usage within the documentation for details on the workings of the new
system.
2020-08-06 16:17:28 -04:00
Paul Hollinsky 6218a5cc7e Fix documentation building 2020-08-06 16:09:29 -04:00
Paul Hollinsky 8566f9d57d Update copyright date 2020-08-06 16:06:31 -04:00
Paul Hollinsky f49f65c3ed Move examples into tree
See history at https://github.com/intrepidcs/libicsneo-examples/tree/v0.2.0-dev
2020-08-06 15:41:48 -04:00
Paul Hollinsky 2079037ae4 POSIX FTDI: Nicer error message for when device is in use
Commonly, the device is being used by another libicsneo program
(icsscand, maybe) or passed through to a VM.
2020-06-24 22:15:22 -04:00
Paul Hollinsky a759c1faa9 Communication: Fix issue where driver failing to open leaves dangling thread 2020-06-24 22:03:31 -04:00
Paul Hollinsky 67bd1e616a MultiChannelCommunication: Fix issue where initial open fails 2020-06-24 21:38:57 -04:00
Paul Hollinsky 25f079b5c6 POSIX FTDI: Fix a bug where closing device successfully returned an error 2020-06-24 20:59:53 -04:00
Paul Hollinsky dcc44d99ea Fix an issue where the FIRE could not be opened 2020-06-17 15:11:57 -04:00
Jeffrey Quesnelle 7a71a35848 add option to build with Npcap on Windows 2020-06-16 12:14:46 -04:00
Jeffrey Quesnelle 8f6ff86448 Load pcap_sendqueue functions on Windows 2020-06-12 13:55:47 -04:00
Paul Hollinsky 8260149cb8 Add bridging between neomessage_eth_t and EthernetMessage
This allows transmitting Ethernet from the C API
2020-05-18 17:23:40 -04:00
Jeffrey Quesnelle d2019c24df reuse discovered pcap interfaces in DeviceFinder::FindAll() 2020-05-11 16:17:56 -04:00
Jeffrey Quesnelle 99879c9021 turn PCAPDLL into a singleton 2020-03-24 13:15:26 -04:00
Paul Hollinsky 38e24d7641 Refactor ICommunication/Transport => Driver 2020-03-09 14:09:27 -04:00
Paul Hollinsky d8798acaa7 Communication: MultiChannel: Properly mask out communication from non-main VNETs
This also makes it possible for Communication to create more instances of Packetizer
This is necessary because Packetizer is not thread safe,
so when we support more VNETs we will need to create more Packetizers.
2020-03-09 13:56:18 -04:00
Paul Hollinsky 42780dc610 Add ReaderWriterQueue and update ConcurrentQueue 2020-03-09 13:38:14 -04:00
Paul Hollinsky 9ac3fd56bd FlexRay: Don't check for POCReady when writing configuration
It is not needed and this gives a good speedup to configuration
2020-02-28 20:10:31 -05:00
Paul Hollinsky 8ae3317930 FlexRay: Rework controller register reading for reliability 2020-02-28 20:09:33 -05:00
Paul Hollinsky 1cd817a16b Fix race conditions with Communication::waitForMessageSync 2020-02-28 20:00:08 -05:00
Paul Hollinsky 9fcba2eb13 Notify extensions we're going offline before we actually do 2020-02-28 19:57:43 -05:00
Paul Hollinsky 0c330f734b Fix typo 2020-02-28 19:57:16 -05:00
Paul Hollinsky a2fecb7621 Support for EtherBADGE 2020-02-20 14:43:10 -05:00
Jeffrey Quesnelle 98bd7e9c55 add decoding of transmitted, error, and description fields for CAN packets 2020-02-19 09:36:28 -05:00
Paul Hollinsky ef34959c91 STM32 device finder for Darwin 2020-02-14 23:18:34 -05:00
Jeffrey Quesnelle 57fb55b686 fix uninitialized memory which may cause Windows to not properly enumerate devices 2020-01-24 13:32:35 -05:00
Paul Hollinsky 724cc428d9 Properly specify the FlexRay CC registers 2019-11-20 16:24:20 +01:00
Paul Hollinsky 52b0b4c586 Properly set up transmit buffers 2019-11-19 17:07:48 +01:00
Paul Hollinsky fe7c50f8a3 Correctly shift received data 2019-11-19 17:07:26 +01:00
Paul Hollinsky 4821a957dd Properly decode incoming FlexRayPackets 2019-11-18 06:09:25 +01:00
Paul Hollinsky 31062dd928 For now, assume VNET Z is in coldstart mode 2019-11-12 20:48:30 -05:00
Paul Hollinsky 37778d7891 Implement FlexRay transmit, configuration, and cold start 2019-11-12 20:38:47 -05:00
Paul Hollinsky 3396f5dcce Refining the FlexRay API 2019-11-09 15:34:58 -05:00
1751 changed files with 328229 additions and 1353 deletions
+31 -9
View File
@@ -3,9 +3,11 @@ project(libicsneo VERSION 0.2.0)
option(LIBICSNEO_BUILD_TESTS "Build all tests." OFF)
option(LIBICSNEO_BUILD_DOCS "Build documentation. Don't use in Visual Studio." OFF)
option(LIBICSNEO_BUILD_EXAMPLES "Build examples." ON)
option(LIBICSNEO_BUILD_ICSNEOC "Build dynamic C library" ON)
option(LIBICSNEO_BUILD_ICSNEOC_STATIC "Build static C library" ON)
option(LIBICSNEO_BUILD_ICSNEOLEGACY "Build icsnVC40 compatibility library" ON)
set(LIBICSNEO_NPCAP_INCLUDE_DIR "" CACHE STRING "Npcap include directory; set to build with Npcap")
set(CMAKE_CXX_STANDARD 11)
@@ -39,7 +41,7 @@ if(LIBICSNEO_BUILD_DOCS)
if(DOXYGEN_FOUND)
message("Will build Doxygen based documentation")
add_custom_target(libicsneo_doxygen ALL
add_custom_target(libicsneo_doxygen
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating API documentation with Doxygen"
@@ -67,7 +69,7 @@ if(LIBICSNEO_BUILD_DOCS)
"${ICSNEO_DOCS_DIR}/conf.py"
@ONLY)
add_custom_target(libicsneo_sphinx
add_custom_target(libicsneo_sphinx ALL
${SPHINX_EXECUTABLE}
-q -b html
-c "${ICSNEO_DOCS_DIR}"
@@ -80,13 +82,28 @@ if(LIBICSNEO_BUILD_DOCS)
endif()
endif()
if(WIN32)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
file(GLOB PLATFORM_SRC_EXTERNAL ${CMAKE_CURRENT_SOURCE_DIR}/platform/windows/*.cpp)
file(GLOB PLATFORM_SRC_INTERNAL ${CMAKE_CURRENT_SOURCE_DIR}/platform/windows/internal/*.cpp)
set(PLATFORM_SRC ${PLATFORM_SRC_EXTERNAL} ${PLATFORM_SRC_INTERNAL})
else()
file(GLOB PLATFORM_SRC ${CMAKE_CURRENT_SOURCE_DIR}/platform/posix/*.cpp)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
file(GLOB PLATFORM_SRC_DARWIN ${CMAKE_CURRENT_SOURCE_DIR}/platform/posix/darwin/*.cpp)
file(GLOB PLATFORM_SRC_POSIX ${CMAKE_CURRENT_SOURCE_DIR}/platform/posix/*.cpp)
set(PLATFORM_SRC ${PLATFORM_SRC_POSIX} ${PLATFORM_SRC_DARWIN})
else() # elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
file(GLOB PLATFORM_SRC_LINUX ${CMAKE_CURRENT_SOURCE_DIR}/platform/posix/linux/*.cpp)
file(GLOB PLATFORM_SRC_POSIX ${CMAKE_CURRENT_SOURCE_DIR}/platform/posix/*.cpp)
set(PLATFORM_SRC ${PLATFORM_SRC_POSIX} ${PLATFORM_SRC_LINUX})
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
message(WARNING
"There is no platform port defined for ${CMAKE_SYSTEM_NAME}!\n"
"The Linux platform code will be used, as it will generally allow building, but some devices may not enumerate properly."
)
endif()
endif()
if(LIBICSNEO_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
set(COMMON_SRC
@@ -100,7 +117,7 @@ set(COMMON_SRC
communication/packetizer.cpp
communication/multichannelcommunication.cpp
communication/communication.cpp
communication/icommunication.cpp
communication/driver.cpp
device/extensions/flexray/extension.cpp
device/extensions/flexray/controller.cpp
device/idevicesettings.cpp
@@ -171,8 +188,13 @@ endif(NOT WIN32)
# winpcap
if(WIN32)
target_include_directories(icsneocpp PUBLIC AFTER third-party/winpcap/include)
add_definitions(-DWPCAP -DHAVE_REMOTE -DWIN32_LEAN_AND_MEAN)
if(LIBICSNEO_NPCAP_INCLUDE_DIR STREQUAL "")
target_include_directories(icsneocpp PUBLIC AFTER third-party/winpcap/include)
add_definitions(-DWPCAP -DHAVE_REMOTE -DWIN32_LEAN_AND_MEAN)
else()
target_include_directories(icsneocpp PUBLIC AFTER ${LIBICSNEO_NPCAP_INCLUDE_DIR})
add_definitions(-DNPCAP -DWIN32_LEAN_AND_MEAN)
endif()
endif(WIN32)
if(LIBICSNEO_BUILD_ICSNEOC)
+1 -1
View File
@@ -1,4 +1,4 @@
Copyright 2019-2020 Intrepid Control Systems, Inc.
Copyright 2018-2020 Intrepid Control Systems, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+3
View File
@@ -101,6 +101,7 @@ static constexpr const char* DRIVER_FAILED_TO_OPEN = "The device driver encounte
static constexpr const char* DRIVER_FAILED_TO_CLOSE = "The device driver encountered a low-level error while closing the device.";
static constexpr const char* PACKET_CHECKSUM_ERROR = "There was a checksum error while decoding a packet. The packet was dropped.";
static constexpr const char* TRANSMIT_BUFFER_FULL = "The transmit buffer is full and the device is set to non-blocking.";
static constexpr const char* DEVICE_IN_USE = "The device is currently in use by another program.";
static constexpr const char* PCAP_COULD_NOT_START = "The PCAP driver could not be started. Ethernet devices will not be found.";
static constexpr const char* PCAP_COULD_NOT_FIND_DEVICES = "The PCAP driver failed to find devices. Ethernet devices will not be found.";
static constexpr const char* PACKET_DECODING = "The packet could not be decoded.";
@@ -197,6 +198,8 @@ const char* APIEvent::DescriptionForType(Type type) {
return PACKET_CHECKSUM_ERROR;
case Type::TransmitBufferFull:
return TRANSMIT_BUFFER_FULL;
case Type::DeviceInUse:
return DEVICE_IN_USE;
case Type::PCAPCouldNotStart:
return PCAP_COULD_NOT_START;
case Type::PCAPCouldNotFindDevices:
+29 -17
View File
@@ -23,8 +23,10 @@ bool Communication::open() {
return false;
}
if(!driver->open())
return false;
spawnThreads();
return impl->open();
return true;
}
void Communication::spawnThreads() {
@@ -39,18 +41,18 @@ void Communication::joinThreads() {
}
bool Communication::close() {
joinThreads();
if(!isOpen()) {
report(APIEvent::Type::DeviceCurrentlyClosed, APIEvent::Severity::Error);
return false;
}
joinThreads();
return impl->close();
return driver->close();
}
bool Communication::isOpen() {
return impl->isOpen();
return driver->isOpen();
}
bool Communication::sendPacket(std::vector<uint8_t>& bytes) {
@@ -60,15 +62,16 @@ bool Communication::sendPacket(std::vector<uint8_t>& bytes) {
bool Communication::sendCommand(Command cmd, std::vector<uint8_t> arguments) {
std::vector<uint8_t> packet;
if(!encoder->encode(packet, cmd, arguments))
if(!encoder->encode(*packetizer, packet, cmd, arguments))
return false;
return sendPacket(packet);
}
bool Communication::getSettingsSync(std::vector<uint8_t>& data, std::chrono::milliseconds timeout) {
sendCommand(Command::ReadSettings, { 0, 0, 0, 1 /* Get Global Settings */, 0, 1 /* Subversion 1 */ });
std::shared_ptr<Message> msg = waitForMessageSync(MessageFilter(Network::NetID::ReadSettings), timeout);
std::shared_ptr<Message> msg = waitForMessageSync([this]() {
return sendCommand(Command::ReadSettings, { 0, 0, 0, 1 /* Get Global Settings */, 0, 1 /* Subversion 1 */ });
}, MessageFilter(Network::NetID::ReadSettings), timeout);
if(!msg)
return false;
@@ -89,7 +92,9 @@ bool Communication::getSettingsSync(std::vector<uint8_t>& data, std::chrono::mil
std::shared_ptr<SerialNumberMessage> Communication::getSerialNumberSync(std::chrono::milliseconds timeout) {
sendCommand(Command::RequestSerialNumber);
std::shared_ptr<Message> msg = waitForMessageSync(std::make_shared<Main51MessageFilter>(Command::RequestSerialNumber), timeout);
std::shared_ptr<Message> msg = waitForMessageSync([this]() {
return sendCommand(Command::RequestSerialNumber);
}, Main51MessageFilter(Command::RequestSerialNumber), timeout);
if(!msg) // Did not receive a message
return std::shared_ptr<SerialNumberMessage>();
@@ -117,25 +122,32 @@ bool Communication::removeMessageCallback(int id) {
}
}
std::shared_ptr<Message> Communication::waitForMessageSync(std::shared_ptr<MessageFilter> f, std::chrono::milliseconds timeout) {
std::shared_ptr<Message> Communication::waitForMessageSync(std::function<bool(void)> onceWaitingDo, MessageFilter f, std::chrono::milliseconds timeout) {
std::mutex m;
std::condition_variable cv;
std::shared_ptr<Message> returnedMessage;
std::unique_lock<std::mutex> lk(m); // Don't let the callback fire until we're waiting for it
int cb = addMessageCallback(MessageCallback([&m, &returnedMessage, &cv](std::shared_ptr<Message> message) {
{
std::lock_guard<std::mutex> lk(m);
returnedMessage = message;
}
cv.notify_one();
cv.notify_all();
}, f));
// We have now added the callback, wait for it to return from the other thread
std::unique_lock<std::mutex> lk(m);
cv.wait_for(lk, timeout, [&returnedMessage] { return !!returnedMessage; }); // `!!shared_ptr` checks if the ptr has a value
lk.unlock();
// We have now added the callback, do whatever the caller wanted to do
bool fail = !onceWaitingDo();
if(!fail)
cv.wait_for(lk, timeout, [&returnedMessage] { return !!returnedMessage; }); // `!!shared_ptr` checks if the ptr has a value
lk.unlock(); // Ensure callbacks can complete even if we didn't wait for them
// We don't actually check that we got a message, because either way we want to remove the callback (since it should only happen once)
removeMessageCallback(cb);
// We are now guaranteed that no more callbacks will happen
if(fail) // The caller's function failed, so don't return a message
returnedMessage.reset();
// Then we either will return the message we got or we will return the empty shared_ptr, caller responsible for checking
return returnedMessage;
@@ -164,9 +176,9 @@ void Communication::readTask() {
while(!closing) {
readBytes.clear();
if(impl->readWait(readBytes)) {
if(driver->readWait(readBytes)) {
if(packetizer->input(readBytes)) {
for(auto& packet : packetizer->output()) {
for(const auto& packet : packetizer->output()) {
std::shared_ptr<Message> msg;
if(!decoder->decode(msg, packet))
continue;
@@ -1,8 +1,8 @@
#include "icsneo/communication/icommunication.h"
#include "icsneo/communication/driver.h"
using namespace icsneo;
bool ICommunication::read(std::vector<uint8_t>& bytes, size_t limit) {
bool Driver::read(std::vector<uint8_t>& bytes, size_t limit) {
// A limit of zero indicates no limit
if(limit == 0)
limit = (size_t)-1;
@@ -21,7 +21,7 @@ bool ICommunication::read(std::vector<uint8_t>& bytes, size_t limit) {
return true;
}
bool ICommunication::readWait(std::vector<uint8_t>& bytes, std::chrono::milliseconds timeout, size_t limit) {
bool Driver::readWait(std::vector<uint8_t>& bytes, std::chrono::milliseconds timeout, size_t limit) {
// A limit of zero indicates no limit
if(limit == 0)
limit = (size_t)-1;
@@ -38,7 +38,7 @@ bool ICommunication::readWait(std::vector<uint8_t>& bytes, std::chrono::millisec
return actuallyRead > 0;
}
bool ICommunication::write(const std::vector<uint8_t>& bytes) {
bool Driver::write(const std::vector<uint8_t>& bytes) {
if(!isOpen()) {
report(APIEvent::Type::DeviceCurrentlyClosed, APIEvent::Severity::Error);
return false;
+35 -12
View File
@@ -1,11 +1,12 @@
#include "icsneo/communication/encoder.h"
#include "icsneo/communication/message/ethernetmessage.h"
#include "icsneo/communication/message/main51message.h"
#include "icsneo/communication/packet/ethernetpacket.h"
#include "icsneo/communication/packet/canpacket.h"
using namespace icsneo;
bool Encoder::encode(std::vector<uint8_t>& result, const std::shared_ptr<Message>& message) {
bool Encoder::encode(const Packetizer& packetizer, std::vector<uint8_t>& result, const std::shared_ptr<Message>& message) {
bool shortFormat = false;
bool useResultAsBuffer = false; // Otherwise it's expected that we use message->data
result.clear();
@@ -49,24 +50,34 @@ bool Encoder::encode(std::vector<uint8_t>& result, const std::shared_ptr<Message
case Network::NetID::Device:
shortFormat = true;
break;
case Network::NetID::Main51:
if(message->data.size() > 0xF) {
case Network::NetID::Main51: {
auto m51msg = std::dynamic_pointer_cast<Main51Message>(message);
if(!m51msg) {
report(APIEvent::Type::MessageFormattingError, APIEvent::Severity::Error);
return false; // The message was not a properly formed Main51Message
}
if(!m51msg->forceShortFormat) {
// Main51 can be sent as a long message without setting the NetID to RED first
// Size in long format is the size of the entire packet
// So +1 for AA header, +1 for short format header, and +2 for long format size
uint16_t size = uint16_t(message->data.size()) + 1 + 1 + 2;
size += 1; // Even though we are not including the NetID bytes, the device expects them to be counted in the length
size += 1; // Main51 Command
message->data.insert(message->data.begin(), {
(uint8_t)Network::NetID::Main51, // 0x0B for long message
(uint8_t)size, // Size, little endian 16-bit
(uint8_t)(size >> 8)
(uint8_t)(size >> 8),
(uint8_t)m51msg->command
});
result = packetizer->packetWrap(message->data, shortFormat);
result = packetizer.packetWrap(message->data, shortFormat);
return true;
} else {
message->data.insert(message->data.begin(), { uint8_t(m51msg->command) });
shortFormat = true;
}
break;
}
case Network::NetID::RED_OLDFORMAT: {
// See the decoder for an explanation
// We expect the network byte to be populated already in data, but not the length
@@ -97,19 +108,20 @@ bool Encoder::encode(std::vector<uint8_t>& result, const std::shared_ptr<Message
});
}
result = packetizer->packetWrap(buffer, shortFormat);
result = packetizer.packetWrap(buffer, shortFormat);
return true;
}
bool Encoder::encode(std::vector<uint8_t>& result, Command cmd, std::vector<uint8_t> arguments) {
auto msg = std::make_shared<Message>();
bool Encoder::encode(const Packetizer& packetizer, std::vector<uint8_t>& result, Command cmd, std::vector<uint8_t> arguments) {
std::shared_ptr<Message> msg;
if(cmd == Command::UpdateLEDState) {
/* NetID::Device is a super old command type.
* It has a leading 0x00 byte, a byte for command, and a byte for an argument.
* In this case, command 0x06 is SetLEDState.
* This old command type is not really used anywhere else.
*/
if (arguments.empty()) {
msg = std::make_shared<Message>();
if(arguments.empty()) {
report(APIEvent::Type::MessageFormattingError, APIEvent::Severity::Error);
return false;
}
@@ -119,11 +131,22 @@ bool Encoder::encode(std::vector<uint8_t>& result, Command cmd, std::vector<uint
msg->data.push_back(0x06); // SetLEDState
msg->data.push_back(arguments.at(0)); // See Device::LEDState
} else {
auto m51msg = std::make_shared<Main51Message>();
msg = m51msg;
msg->network = Network::NetID::Main51;
msg->data.reserve(arguments.size() + 1);
msg->data.push_back((uint8_t)cmd);
m51msg->command = cmd;
switch(cmd) {
case Command::RequestSerialNumber:
case Command::EnableNetworkCommunication:
case Command::EnableNetworkCommunicationEx:
// There is a firmware handling idiosyncrasy with these commands
// They must be encoded in the short format
m51msg->forceShortFormat = true;
default:
break;
}
msg->data.insert(msg->data.end(), std::make_move_iterator(arguments.begin()), std::make_move_iterator(arguments.end()));
}
return encode(result, msg);
return encode(packetizer, result, msg);
}
@@ -2,10 +2,11 @@
#include <cstring> // memcpy
#include <limits>
#include <algorithm>
#include <iostream>
using namespace icsneo;
std::vector<uint8_t> FlexRayControlMessage::BuildBaseControlArgs(uint8_t controller, FlexRay::Opcode op, std::initializer_list<uint8_t> args) {
std::vector<uint8_t> FlexRayControlMessage::BuildBaseControlArgs(uint8_t controller, FlexRay::Opcode op, const std::vector<uint8_t>& args) {
std::vector<uint8_t> ret;
ret.reserve(args.size() + 4);
ret.push_back(controller);
@@ -28,7 +29,7 @@ std::vector<uint8_t> FlexRayControlMessage::BuildReadCCRegsArgs(uint8_t controll
std::vector<uint8_t> FlexRayControlMessage::BuildWriteCCRegArgs(uint8_t controller, uint16_t address, uint32_t value) {
address /= 4;
return BuildBaseControlArgs(controller, FlexRay::Opcode::ReadCCRegs, {
return BuildBaseControlArgs(controller, FlexRay::Opcode::WriteCCReg, {
uint8_t(address),
uint8_t(address >> 8),
uint8_t(value),
@@ -38,11 +39,38 @@ std::vector<uint8_t> FlexRayControlMessage::BuildWriteCCRegArgs(uint8_t controll
});
}
std::vector<uint8_t> FlexRayControlMessage::BuildAddConfiguredTxMessageArgs(
uint8_t controller, uint16_t descriptionId, uint16_t slotId, uint8_t baseCycle, uint8_t cycleReps, FlexRay::Channel channel) {
return BuildBaseControlArgs(controller, FlexRay::Opcode::AddConfiguredTxMessage, {
uint8_t(descriptionId),
uint8_t(descriptionId >> 8),
uint8_t(slotId),
uint8_t(slotId >> 8),
uint8_t(baseCycle + cycleReps),
uint8_t(channel)
});
}
std::vector<uint8_t> FlexRayControlMessage::BuildWriteMessageBufferArgs(
uint8_t controller, uint16_t bufferId, const std::vector<uint8_t>& data, uint16_t desiredSize) {
desiredSize += desiredSize % 4; // Must be a multiple of 4
std::vector<uint8_t> args = {
uint8_t(bufferId),
uint8_t(desiredSize / 4)
};
args.insert(args.end(), data.begin(), data.end());
if(args.size() != desiredSize + 2)
args.resize(desiredSize + 2);
return BuildBaseControlArgs(controller, FlexRay::Opcode::WriteMessageBuffer, args);
}
FlexRayControlMessage::FlexRayControlMessage(const Packet& packet) : Message() {
network = Network::NetID::FlexRayControl;
if(packet.data.size() < 2)
return; // huh?
controller = packet.data[0];
if(controller < 2)
if(controller >= 2)
return; // Invalid controller
// Opcode is only ReadCCStatus or ReadCCRegs for the moment
+7
View File
@@ -70,6 +70,13 @@ std::shared_ptr<Message> icsneo::CreateMessageFromNeoMessage(const neomessage_t*
canmsg->errorStateIndicator = can.status.canfdESI;
return canmsg;
}
case Network::Type::Ethernet: {
neomessage_eth_t& eth = *(neomessage_eth_t*)neomessage;
auto ethmsg = std::make_shared<EthernetMessage>();
ethmsg->network = network;
ethmsg->data.insert(ethmsg->data.end(), eth.data, eth.data + eth.length);
return ethmsg;
}
default:
// TODO Implement others
return std::shared_ptr<Message>();
+70 -19
View File
@@ -2,19 +2,25 @@
#include "icsneo/communication/command.h"
#include "icsneo/communication/decoder.h"
#include "icsneo/communication/packetizer.h"
#include <iostream>
#include <iomanip>
using namespace icsneo;
void MultiChannelCommunication::spawnThreads() {
mainChannelReadThread = std::thread(&MultiChannelCommunication::readTask, this);
for(size_t i = 0; i < NUM_SUPPORTED_VNETS; i++) {
while(vnetQueues[i].pop()) {} // Ensure the queue is empty
vnetThreads[i] = std::thread(&MultiChannelCommunication::vnetReadTask, this, i);
}
hidReadThread = std::thread(&MultiChannelCommunication::hidReadTask, this);
}
void MultiChannelCommunication::joinThreads() {
closing = true;
if(mainChannelReadThread.joinable())
mainChannelReadThread.join();
if(hidReadThread.joinable())
hidReadThread.join();
for(auto& thread : vnetThreads) {
if(thread.joinable())
thread.join();
}
closing = false;
}
@@ -23,7 +29,7 @@ bool MultiChannelCommunication::sendPacket(std::vector<uint8_t>& bytes) {
return rawWrite(bytes);
}
void MultiChannelCommunication::readTask() {
void MultiChannelCommunication::hidReadTask() {
bool readMore = true;
bool gotPacket = false; // Have we got the first valid packet (don't flag errors otherwise)
std::deque<uint8_t> usbReadFifo;
@@ -35,7 +41,7 @@ void MultiChannelCommunication::readTask() {
while(!closing) {
if(readMore) {
readBytes.clear();
if(impl->readWait(readBytes)) {
if(driver->readWait(readBytes)) {
readMore = false;
usbReadFifo.insert(usbReadFifo.end(), std::make_move_iterator(readBytes.begin()), std::make_move_iterator(readBytes.end()));
}
@@ -51,7 +57,8 @@ void MultiChannelCommunication::readTask() {
if(!CommandTypeIsValid(currentCommandType)) {
// Device to host bytes discarded
EventManager::GetInstance().add(APIEvent(APIEvent::Type::FailedToRead, APIEvent::Severity::Error));
if(gotPacket)
EventManager::GetInstance().add(APIEvent(APIEvent::Type::FailedToRead, APIEvent::Severity::Error));
usbReadFifo.pop_front();
continue;
}
@@ -91,7 +98,7 @@ void MultiChannelCommunication::readTask() {
case PreprocessState::GetData:
state = PreprocessState::GetData; // Set state in case we've fallen through, but later need to go around again
if(usbReadFifo.size() <= currentReadIndex + currentCommandLength) { // Come back we have more data
if(usbReadFifo.size() < currentReadIndex + currentCommandLength) { // Come back when we have more data
readMore = true;
continue;
}
@@ -105,21 +112,65 @@ void MultiChannelCommunication::readTask() {
payloadBytes[i] = usbReadFifo[0];
usbReadFifo.pop_front();
}
if(packetizer->input(payloadBytes)) {
for(auto& packet : packetizer->output()) {
std::shared_ptr<Message> msg;
if(!decoder->decode(msg, packet))
continue; // Error will have been reported from within decoder
gotPacket = true;
dispatchMessage(msg);
}
moodycamel::BlockingReaderWriterQueue< std::vector<uint8_t> >* currentQueue = nullptr;
switch(currentCommandType) {
case CommandType::Vnet1_to_HostPC:
currentQueue = &vnetQueues[0];
break;
case CommandType::Vnet2_to_HostPC:
if(NUM_SUPPORTED_VNETS >= 2)
currentQueue = &vnetQueues[1];
break;
case CommandType::Vnet3_to_HostPC:
if(NUM_SUPPORTED_VNETS >= 3)
currentQueue = &vnetQueues[2];
break;
}
if(currentQueue == nullptr) {
state = PreprocessState::SearchForCommand;
break;
}
if(!currentQueue->enqueue(std::move(payloadBytes)) && gotPacket)
EventManager::GetInstance().add(APIEvent(APIEvent::Type::FailedToRead, APIEvent::Severity::Error));
payloadBytes.clear();
gotPacket = true;
state = PreprocessState::SearchForCommand;
break;
}
}
}
}
void MultiChannelCommunication::vnetReadTask(size_t vnetIndex) {
moodycamel::BlockingReaderWriterQueue< std::vector<uint8_t> >& queue = vnetQueues[vnetIndex];
std::vector<uint8_t> payloadBytes;
std::unique_ptr<Packetizer> packetizerLifetime;
Packetizer* vnetPacketizer;
if(vnetIndex == 0)
vnetPacketizer = packetizer.get();
else {
packetizerLifetime = makeConfiguredPacketizer();
vnetPacketizer = packetizerLifetime.get();
}
EventManager::GetInstance().downgradeErrorsOnCurrentThread();
while(!closing) {
if(queue.wait_dequeue_timed(payloadBytes, std::chrono::milliseconds(250))) {
if(closing)
break;
if(vnetPacketizer->input(payloadBytes)) {
for(const auto& packet : vnetPacketizer->output()) {
std::shared_ptr<Message> msg;
if(!decoder->decode(msg, packet))
continue; // Error will have been reported from within decoder
dispatchMessage(msg);
}
}
}
}
}
+4
View File
@@ -76,6 +76,10 @@ std::shared_ptr<CANMessage> HardwareCANPacket::DecodeToMessage(const std::vector
}
}
msg->transmitted = data->eid.TXMSG;
msg->error = data->eid.TXAborted || data->eid.TXError || data->eid.TXLostArb;
msg->description = data->stats;
return msg;
}
+17 -7
View File
@@ -16,13 +16,20 @@ std::shared_ptr<FlexRayMessage> HardwareFlexRayPacket::DecodeToMessage(const std
// Always get the frame length, even for a symbol
msg->framelen = data->frame_length_12_5ns * 12.5e-9;
msg->channel = data->statusBits.bits.chb ? icsneo::FlexRay::Channel::B : icsneo::FlexRay::Channel::A;
if(data->tss_length_12_5ns == 0xffff) {// Flag value meaning this is a symbol
msg->symbol = FlexRay::Symbol::Unknown; // We can't know the symbol yet because this will depend on the baudrate
// Eventually we'll have to get this from the framelen
// These values are only for 10Mbit
// That's the only baudrate supported for now
if (data->frame_length_12_5ns > 480)
msg->symbol = FlexRay::Symbol::Wakeup;
else if (data->frame_length_12_5ns > 264)
msg->symbol = FlexRay::Symbol::CAS;
else
msg->symbol = FlexRay::Symbol::Unknown;
} else {
msg->tsslen = data->tss_length_12_5ns * 12.5e-9;
msg->channelB = data->statusBits.bits.chb;
if(data->statusBits.bits.bytesRxed >= 5) {
if(data->statusBits.bits.hcrc_error)
msg->headerCRCStatus = FlexRay::CRCStatus::Error;
@@ -43,14 +50,17 @@ std::shared_ptr<FlexRayMessage> HardwareFlexRayPacket::DecodeToMessage(const std
if(msg->headerCRCStatus != FlexRay::CRCStatus::Error) {
msg->reserved0was1 = data->reserved_0;
msg->payloadPreamble = data->payload_preamble;
msg->nullFrame = data->null_frame;
msg->nullFrame = !data->null_frame;
msg->sync = data->sync;
msg->startup = data->startup;
msg->slotid = data->slotid;
msg->cycle = data->cycle;
msg->dynamic = data->statusBits.bits.dynamic;
if(int64_t(numBytes) != int64_t(data->Length) - 4) {
} else {
// This is an error, probably need to flag it
} else {
const uint8_t* dataStart = (const uint8_t*)(data) - 4 + sizeof(HardwareFlexRayPacket);
msg->data = std::vector<uint8_t>(dataStart, dataStart + numBytes);
}
}
}
+1 -1
View File
@@ -13,7 +13,7 @@ uint8_t Packetizer::ICSChecksum(const std::vector<uint8_t>& data) {
return (uint8_t)checksum;
}
std::vector<uint8_t>& Packetizer::packetWrap(std::vector<uint8_t>& data, bool shortFormat) {
std::vector<uint8_t>& Packetizer::packetWrap(std::vector<uint8_t>& data, bool shortFormat) const {
if(shortFormat) {
// Some devices don't use the checksum, so might as well not calculate it if that's the case
// Either way the byte is still expected to be present in the bytestream for short messages
+50 -12
View File
@@ -168,6 +168,14 @@ bool Device::open() {
return false;
}
if(!afterCommunicationOpen()) {
// Very unlikely, at the time of writing this only fails if rawWrite does.
// If you're looking for this error, you're probably looking for if(!serial) below.
report(APIEvent::Type::NoSerialNumber, APIEvent::Severity::Error); // Communication could not be established with the device. Perhaps it is not powered with 12 volts?
com->close();
return false;
}
auto serial = com->getSerialNumberSync();
int i = 0;
while(!serial) {
@@ -197,6 +205,7 @@ bool Device::open() {
handleInternalMessage(message);
}));
forEachExtension([](const std::shared_ptr<DeviceExtension>& ext) { ext->onDeviceOpen(); return true; });
return true;
}
@@ -213,7 +222,8 @@ bool Device::close() {
com->removeMessageCallback(internalHandlerCallbackID);
internalHandlerCallbackID = 0;
forEachExtension([](const std::shared_ptr<DeviceExtension>& ext) { ext->onDeviceClose(); return true; });
return com->close();
}
@@ -234,19 +244,28 @@ bool Device::goOnline() {
while((std::chrono::system_clock::now() - startTime) < std::chrono::seconds(5)) {
if(latestResetStatus && latestResetStatus->comEnabled)
break;
if(!com->sendCommand(Command::RequestStatusUpdate))
return false;
com->waitForMessageSync(filter, std::chrono::milliseconds(100));
bool failOut = false;
com->waitForMessageSync([this, &failOut]() {
if(!com->sendCommand(Command::RequestStatusUpdate)) {
failOut = true;
return false;
}
return true;
}, filter, std::chrono::milliseconds(100));
if(failOut)
return false;
}
online = true;
forEachExtension([](const std::shared_ptr<DeviceExtension>& ext) { ext->onGoOnline(); return true; });
return true;
}
bool Device::goOffline() {
forEachExtension([](const std::shared_ptr<DeviceExtension>& ext) { ext->onGoOffline(); return true; });
if(!com->sendCommand(Command::EnableNetworkCommunication, false))
return false;
@@ -259,7 +278,7 @@ bool Device::goOffline() {
MessageFilter filter(Network::NetID::Reset_Status);
filter.includeInternalInAny = true;
// wait until communication is disabled or 10 seconds, whichever comes first
// Wait until communication is disabled or 5 seconds, whichever comes first
while((std::chrono::system_clock::now() - startTime) < std::chrono::seconds(5)) {
if(latestResetStatus && !latestResetStatus->comEnabled)
break;
@@ -293,8 +312,18 @@ bool Device::transmit(std::shared_ptr<Message> message) {
return false;
}
bool extensionHookedTransmit = false;
bool transmitStatusFromExtension = false;
forEachExtension([&](const std::shared_ptr<DeviceExtension>& ext) {
if(!ext->transmitHook(message, transmitStatusFromExtension))
extensionHookedTransmit = true;
return !extensionHookedTransmit; // false breaks out of the loop early
});
if(extensionHookedTransmit)
return transmitStatusFromExtension;
std::vector<uint8_t> packet;
if(!com->encoder->encode(packet, message))
if(!com->encoder->encode(*com->packetizer, packet, message))
return false;
return com->sendPacket(packet);
@@ -338,10 +367,18 @@ void Device::addExtension(std::shared_ptr<DeviceExtension>&& extension) {
extensions.push_back(extension);
}
void Device::forEachExtension(std::function<void(const std::shared_ptr<DeviceExtension>&)> fn) {
std::lock_guard<std::mutex> lk(extensionsLock);
for(const auto& ext : extensions)
fn(ext);
void Device::forEachExtension(std::function<bool(const std::shared_ptr<DeviceExtension>&)> fn) {
std::vector<std::shared_ptr<DeviceExtension>> extensionsCopy;
{
std::lock_guard<std::mutex> lk(extensionsLock);
extensionsCopy = extensions;
}
for(const auto& ext : extensionsCopy) {
if(!fn(ext))
break;
}
}
void Device::handleInternalMessage(std::shared_ptr<Message> message) {
@@ -354,6 +391,7 @@ void Device::handleInternalMessage(std::shared_ptr<Message> message) {
}
forEachExtension([&](const std::shared_ptr<DeviceExtension>& ext) {
ext->handleMessage(message);
return true; // false breaks out early
});
}
+15 -3
View File
@@ -6,6 +6,10 @@ using namespace icsneo;
static bool supportedDevicesCached = false;
static std::vector<DeviceType> supportedDevices = {
#ifdef __ETHERBADGE_H_
EtherBADGE::DEVICE_TYPE,
#endif
#ifdef __NEOOBD2PRO_H_
NeoOBD2PRO::DEVICE_TYPE,
#endif
@@ -83,6 +87,14 @@ static std::vector<DeviceType> supportedDevices = {
std::vector<std::shared_ptr<Device>> DeviceFinder::FindAll() {
std::vector<std::shared_ptr<Device>> foundDevices;
std::vector<std::vector<std::shared_ptr<Device>>> findResults;
#if defined(LIBICSNEO_HAVE_PCAP) && LIBICSNEO_HAVE_PCAP == 1
auto pcapDevices = PCAP::FindAll();
#endif
#ifdef __ETHERBADGE_H_
findResults.push_back(EtherBADGE::Find());
#endif
#ifdef __NEOOBD2PRO_H_
findResults.push_back(NeoOBD2PRO::Find());
@@ -97,7 +109,7 @@ std::vector<std::shared_ptr<Device>> DeviceFinder::FindAll() {
#endif
#ifdef __NEOVIFIRE2ETH_H_
findResults.push_back(NeoVIFIRE2ETH::Find());
findResults.push_back(NeoVIFIRE2ETH::Find(pcapDevices));
#endif
#ifdef __NEOVIFIRE2USB_H_
@@ -113,7 +125,7 @@ std::vector<std::shared_ptr<Device>> DeviceFinder::FindAll() {
#endif
#ifdef __RADGALAXY_H_
findResults.push_back(RADGalaxy::Find());
findResults.push_back(RADGalaxy::Find(pcapDevices));
#endif
#ifdef __RADPLUTOUSB_H_
@@ -121,7 +133,7 @@ std::vector<std::shared_ptr<Device>> DeviceFinder::FindAll() {
#endif
#ifdef __RADSTAR2ETH_H_
findResults.push_back(RADStar2ETH::Find());
findResults.push_back(RADStar2ETH::Find(pcapDevices));
#endif
#ifdef __RADSTAR2USB_H_
+598 -31
View File
@@ -3,28 +3,460 @@
using namespace icsneo;
std::shared_ptr<FlexRayControlMessage> FlexRay::Controller::getStatus() const {
std::lock_guard<std::mutex> lk(statusLock);
return status;
}
void FlexRay::Controller::_setStatus(std::shared_ptr<FlexRayControlMessage> msg) {
std::lock_guard<std::mutex> lk(statusLock);
status = msg;
}
void FlexRay::Controller::getReady() {
std::shared_ptr<FlexRayControlMessage> FlexRay::Controller::getStatus() const {
std::lock_guard<std::mutex> lk(statusLock);
return status;
}
void FlexRay::Controller::start() {
if(true) // TODO something
getReady();
if(wakeupBeforeStart)
setCurrentPOCCommand(FlexRay::POCCommand::Wakeup);
if(allowColdstart)
setCurrentPOCCommand(FlexRay::POCCommand::AllowColdstart);
setCurrentPOCCommand(FlexRay::POCCommand::Run);
std::pair<const FlexRay::Cluster::Configuration&, const FlexRay::Controller::Configuration&> FlexRay::Controller::getConfiguration() const {
return { clusterConfig, controllerConfig };
}
void FlexRay::Controller::setConfiguration(Cluster::Configuration clConfig, Controller::Configuration coConfig) {
configDirty = true;
clusterConfig = clConfig;
controllerConfig = coConfig;
}
void FlexRay::Controller::addMessageBuffer(MessageBuffer buffer) {
configDirty = true;
messageBuffers.emplace_back(std::make_shared<MessageBuffer>(buffer));
}
void FlexRay::Controller::clearMessageBuffers() {
configDirty = true;
messageBuffers.clear();
}
bool FlexRay::Controller::wakeup(std::chrono::milliseconds timeout) {
return setCurrentPOCCommand(FlexRay::POCCommand::Wakeup, true, timeout);
}
bool FlexRay::Controller::configure(std::chrono::milliseconds timeout) {
const auto initialTimeout = timeout;
const auto functionBegin = std::chrono::steady_clock::now();
const auto updateTimeout = [&initialTimeout, &functionBegin, &timeout]() {
timeout = std::chrono::duration_cast<std::chrono::milliseconds>(initialTimeout - (std::chrono::steady_clock::now() - functionBegin));
};
auto statusPair = getCurrentPOCStatus(timeout);
const auto& status = statusPair.second;
if(!statusPair.first)
return false;
updateTimeout();
if(status != POCStatus::Config) {
if(!enterConfig(timeout))
return false;
updateTimeout();
}
if(!setCurrentPOCCommand(POCCommand::ClearRAMs, true, timeout))
return false;
const auto start = std::chrono::steady_clock::now();
bool carbusy = isClearAllRAMBusy();
while(carbusy && (std::chrono::steady_clock::now() - start) < timeout) {
carbusy = isClearAllRAMBusy();
}
if(carbusy) // timeout
return false;
updateTimeout();
std::vector<std::pair<ERAYRegister, uint32_t>> registerWrites;
registerWrites.reserve(18);
registerWrites.push_back({ ERAYRegister::SUCC1,
((controllerConfig.KeySlotUsedForStartup & 0x1) << 8) | // TXST
((controllerConfig.KeySlotUsedForSync & 0x1) << 9) | // TXSY
((clusterConfig.ColdStartAttempts & 0x1f) << 11) | // CSA
((controllerConfig.AllowPassiveToActiveCyclePairs & 0x1f) << 16) | // PTA
((controllerConfig.WakeupOnChannelB & 0x1) << 21) | // WUCS
((controllerConfig.KeySlotOnlyEnabled & 0x1) << 22) | // TSM
((controllerConfig.AllowHaltDueToClock & 0x1) << 23) | // HCSE
((controllerConfig.MTSOnA & 0x1) << 24) | // MTSA
((controllerConfig.MTSOnB & 0x1) << 25) | // MTSB
((controllerConfig.ChannelA & 0x1) << 26) | // CCHA
((controllerConfig.ChannelB & 0x1) << 27) // CCHB
});
registerWrites.push_back({ ERAYRegister::SUCC2,
((controllerConfig.ListenTimeout & 0x1fffff)) |
((clusterConfig.ListenNoiseMacroticks - 1) << 24)
});
registerWrites.push_back({ ERAYRegister::SUCC3,
(clusterConfig.MaxWithoutClockCorrectionPassive & 0xF) |
((clusterConfig.MaxWithoutClockCorrectionFatal) << 4)
});
registerWrites.push_back({ ERAYRegister::NEMC,
clusterConfig.NetworkManagementVectorLengthBytes
});
registerWrites.push_back({ ERAYRegister::PRTC1,
(clusterConfig.TransmissionStartSequenceDurationBits & 0xF) |
((clusterConfig.CASRxLowMax & 0x3F) << 4) |
((clusterConfig.StrobePointPosition & 0x3) << 12) |
((clusterConfig.Speed & 0x3) << 14) |
((clusterConfig.WakeupRxWindowBits & 0x1ff) << 16) |
((controllerConfig.WakeupPattern) << 26)
});
registerWrites.push_back({ ERAYRegister::PRTC2,
(clusterConfig.WakeupRxIdleBits) |
((clusterConfig.WakeupRxLowBits) << 8) |
((clusterConfig.WakeupTxIdleBits) << 16) |
((clusterConfig.WakeupTxActiveBits) << 24)
});
registerWrites.push_back({ ERAYRegister::MHDC,
(clusterConfig.PayloadLengthOfStaticSlotInWords) |
((controllerConfig.LatestTxMinislot) << 16)
});
registerWrites.push_back({ ERAYRegister::GTUC1,
controllerConfig.MicroPerCycle
});
registerWrites.push_back({ ERAYRegister::GTUC2,
(clusterConfig.SyncFrameIDCountMax << 16) |
clusterConfig.MacroticksPerCycle
});
registerWrites.push_back({ ERAYRegister::GTUC3,
(controllerConfig.MicroInitialOffsetA) |
((controllerConfig.MicroInitialOffsetB) << 8) |
((controllerConfig.MacroInitialOffsetA) << 16) |
((controllerConfig.MacroInitialOffsetB) << 24)
});
registerWrites.push_back({ ERAYRegister::GTUC4,
((clusterConfig.MacroticksPerCycle - clusterConfig.NetworkIdleTimeMacroticks - 1) & 0xFFFF) |
((clusterConfig.OffsetCorrectionStartMacroticks - 1) << 16)
});
registerWrites.push_back({ ERAYRegister::GTUC5,
controllerConfig.DelayCompensationAMicroticks |
(controllerConfig.DelayCompensationBMicroticks << 8) |
(controllerConfig.ClusterDriftDamping << 16) |
(controllerConfig.DecodingCorrectionMicroticks << 24)
});
registerWrites.push_back({ ERAYRegister::GTUC6,
controllerConfig.AcceptStartupRangeMicroticks |
(controllerConfig.RateCorrectionOutMicroticks << 16)
});
registerWrites.push_back({ ERAYRegister::GTUC7,
(clusterConfig.StaticSlotMacroticks) |
(clusterConfig.NumberOfStaticSlots << 16)
});
registerWrites.push_back({ ERAYRegister::GTUC8,
clusterConfig.MinislotDurationMacroticks |
(clusterConfig.NumberOfMinislots << 16)
});
registerWrites.push_back({ ERAYRegister::GTUC9,
clusterConfig.ActionPointOffset |
(clusterConfig.MinislotActionPointOffsetMacroticks << 8) |
(clusterConfig.DynamicSlotIdlePhaseMinislots << 16)
});
registerWrites.push_back({ ERAYRegister::GTUC10,
controllerConfig.OffsetCorrectionOutMicroticks |
(controllerConfig.RateCorrectionOutMicroticks << 16)
});
registerWrites.push_back({ ERAYRegister::GTUC11,
controllerConfig.ExternOffsetCorrectionControl |
(controllerConfig.ExternRateCorrectionControl << 8) |
(controllerConfig.ExternOffsetCorrectionMicroticks << 16) |
(controllerConfig.ExternRateCorrectionMicroticks << 24)
});
std::vector<std::shared_ptr<MessageBuffer>> staticTx;
std::vector<std::shared_ptr<MessageBuffer>> dynamicTx;
// Add key slot messages
std::shared_ptr<MessageBuffer> first = std::make_shared<MessageBuffer>();
bool firstIsInMessageBuffers = false;
bool firstUsed = false;
std::shared_ptr<MessageBuffer> second = std::make_shared<MessageBuffer>();
bool secondIsInMessageBuffers = false;
bool secondUsed = false;
if(controllerConfig.KeySlotUsedForSync || controllerConfig.KeySlotOnlyEnabled) {
first->isStartup = controllerConfig.KeySlotUsedForStartup;
first->isSync = controllerConfig.KeySlotUsedForSync;
first->isTransmit = true;
first->channelA = true;
first->channelB = !controllerConfig.TwoKeySlotMode && controllerConfig.ChannelB;
first->frameID = controllerConfig.KeySlotID;
first->frameLengthBytes = clusterConfig.PayloadLengthOfStaticSlotInWords * 2;
first->baseCycle = 0;
first->cycleRepetition = 1;
first->continuousMode = true;
staticTx.push_back(first);
firstUsed = true;
if(controllerConfig.TwoKeySlotMode) {
second->isStartup = controllerConfig.KeySlotUsedForStartup;
second->isSync = controllerConfig.KeySlotUsedForSync;
second->isTransmit = true;
second->channelB =true;
second->frameID = controllerConfig.SecondKeySlotID;
second->frameLengthBytes = clusterConfig.PayloadLengthOfStaticSlotInWords * 2;
second->baseCycle = 0;
second->cycleRepetition = 1;
second->continuousMode = true;
staticTx.push_back(second);
secondUsed = true;
}
}
for(auto& buf : messageBuffers) {
if(!buf->isTransmit)
continue; // Only transmit frames need to be written to the controller
if(buf->frameID == controllerConfig.KeySlotID) {
first = buf;
staticTx[0] = buf;
// Enforce keyslot rules
first->isStartup = controllerConfig.KeySlotUsedForStartup;
first->isSync = controllerConfig.KeySlotUsedForSync;
first->isDynamic = false;
// Suppress default buffer
firstIsInMessageBuffers = true;
continue;
}
else if(controllerConfig.TwoKeySlotMode && buf->frameID == controllerConfig.SecondKeySlotID) {
second = buf;
staticTx[1] = buf;
buf->isDynamic = false;
// Enforce keyslot rules
second->isStartup = controllerConfig.KeySlotUsedForStartup;
second->isSync = controllerConfig.KeySlotUsedForSync;
second->isDynamic = false;
// Suppress default buffer
secondIsInMessageBuffers = true;
continue;
}
if(buf->isDynamic)
dynamicTx.push_back(buf);
else
staticTx.push_back(buf);
}
// If the user is using the default coldstart messages, they need to be added to the list for transmit
if(firstUsed && !firstIsInMessageBuffers)
messageBuffers.push_back(first);
if(secondUsed && !secondIsInMessageBuffers)
messageBuffers.push_back(second);
int64_t totalBuffers = staticTx.size() + dynamicTx.size();
if(totalBuffers > 128) // TODO warn
totalBuffers = 128;
registerWrites.push_back({ ERAYRegister::MRC,
(uint8_t(staticTx.size())) | // FDB[7:0] message buffers exclusively for the static segment
// FFB[7:0] set to 0x80, No message buffer assigned to the FIFO
(0x80 << 8) |
(uint8_t(totalBuffers - 1) << 16) |
(controllerConfig.TwoKeySlotMode << 26)
});
for(const auto& regpair : registerWrites) {
if(!writeRegister(regpair.first, regpair.second, false, timeout))
return false;
updateTimeout();
}
uint16_t dataPointer = (totalBuffers + 1) * 4;
for(auto i = 0; i < totalBuffers; i++) {
MessageBuffer& buf = *(i < staticTx.size() ? staticTx[i] : dynamicTx[i - staticTx.size()]);
if(buf.frameID == 0)
buf.frameID = i | (1 << 10);
uint32_t hs1 = (
(buf.frameID) |
(CalculateCycleFilter(buf.baseCycle, buf.cycleRepetition) << 16) |
((buf.channelA & 0x1) << 24) |
((buf.channelB & 0x1) << 25) |
((buf.isTransmit & 0x1) << 26) | // CFG
((buf.isNMFrame & 0x1) << 27) | // PPIT
((!buf.continuousMode & 0x1) << 28) | // TXM
((0 & 0x1) << 29) // MBI, disabled for now but we might want confirmations in the future
);
uint32_t hs2 = (
CalculateHCRC(buf) |
(((buf.frameLengthBytes + 1) / 2) << 16)
);
uint32_t hs3 = dataPointer;
buf._dataPointer = dataPointer;
buf._id = i;
dataPointer += buf.frameLengthBytes / 4;
dataPointer += dataPointer % 4; // must be a 4 byte boundary
if(!writeRegister(ERAYRegister::WRHS1, hs1, true, timeout))
return false;
updateTimeout();
if(!writeRegister(ERAYRegister::WRHS2, hs2, true, timeout))
return false;
updateTimeout();
if(!writeRegister(ERAYRegister::WRHS3, hs3, true, timeout))
return false;
updateTimeout();
if(!writeRegister(ERAYRegister::IBCM, 1, true, timeout))
return false;
const auto ibcmstart = std::chrono::steady_clock::now();
bool ibcmbusy = isInputBufferHostBusy();
while(ibcmbusy && (std::chrono::steady_clock::now() - ibcmstart) < timeout) {
ibcmbusy = isInputBufferHostBusy();
}
if(ibcmbusy) // timeout
return false;
updateTimeout();
if(!writeRegister(ERAYRegister::IBCR, i, true, timeout))
return false;
updateTimeout();
}
configDirty = false;
return true;
}
bool FlexRay::Controller::getReady(std::chrono::milliseconds timeout) {
const auto initialTimeout = timeout;
const auto functionBegin = std::chrono::steady_clock::now();
const auto updateTimeout = [&initialTimeout, &functionBegin, &timeout]() {
timeout = std::chrono::duration_cast<std::chrono::milliseconds>(initialTimeout - (std::chrono::steady_clock::now() - functionBegin));
};
// Initial sanity check that we have communication with the controller
auto endian = readRegister(ERAYRegister::ENDN, timeout);
if (!endian.first || endian.second != 0x87654321)
return false;
updateTimeout();
auto statusPair = getCurrentPOCStatus(timeout);
const auto& status = statusPair.second;
if(!statusPair.first)
return false;
updateTimeout();
if(status == POCStatus::Ready && !configDirty) {
// Already in the desired state
if(allowColdstart && !setCurrentPOCCommand(FlexRay::POCCommand::AllowColdstart, true, timeout))
return false;
return true;
}
if(status != POCStatus::Config) {
// Must enter config before continuing
if(!enterConfig(timeout))
return false;
updateTimeout();
// Reconfigure if necessary
if(configDirty && !configure(timeout))
return false;
updateTimeout();
}
// Enter the READY state
if(!lockConfiguration(timeout))
return false;
updateTimeout();
// Signal that we'd like to coldstart, if necessary
if(allowColdstart && !setCurrentPOCCommand(FlexRay::POCCommand::AllowColdstart, true, timeout))
return false;
return true;
}
bool FlexRay::Controller::start(std::chrono::milliseconds timeout) {
const auto initialTimeout = timeout;
const auto functionBegin = std::chrono::steady_clock::now();
const auto updateTimeout = [&initialTimeout, &functionBegin, &timeout]() {
timeout = std::chrono::duration_cast<std::chrono::milliseconds>(initialTimeout - (std::chrono::steady_clock::now() - functionBegin));
};
// First make sure we're ready to start (configured/ready state)
if(!getReady(timeout))
return false;
updateTimeout();
// Wakeup the network if necessary
if(wakeupBeforeStart && !wakeup(timeout))
return false;
updateTimeout();
// And finally run
if(!setCurrentPOCCommand(FlexRay::POCCommand::Run, false, timeout))
return false;
return true;
}
bool FlexRay::Controller::transmit(const std::shared_ptr<FlexRayMessage>& frmsg) {
bool success = false;
for(const auto& buf : messageBuffers) {
if(!buf->isTransmit)
continue;
if(frmsg->slotid != buf->frameID)
continue;
if(CalculateCycleFilter(frmsg->cycle, frmsg->cycleRepetition) != CalculateCycleFilter(buf->baseCycle, buf->cycleRepetition))
continue;
FlexRay::Channel bufChannel = FlexRay::Channel::None;
if(buf->channelA && buf->channelB)
bufChannel = FlexRay::Channel::AB;
else if(buf->channelA)
bufChannel = FlexRay::Channel::A;
else if(buf->channelB)
bufChannel = FlexRay::Channel::B;
if(frmsg->channel != bufChannel)
continue;
// This is a message buffer we want to fill
if(!device.com->sendCommand(Command::FlexRayControl, FlexRayControlMessage::BuildWriteMessageBufferArgs(index, buf->_id, frmsg->data, buf->frameLengthBytes)))
continue;
success = true;
}
return success;
}
bool FlexRay::Controller::halt(std::chrono::milliseconds timeout) {
return setCurrentPOCCommand(POCCommand::Halt, true, timeout);
}
bool FlexRay::Controller::freeze(std::chrono::milliseconds timeout) {
return setCurrentPOCCommand(POCCommand::Freeze, true, timeout);
}
bool FlexRay::Controller::triggerMTS(std::chrono::milliseconds timeout) {
// triggerMTS will do nothing unless either MTSOnA or MTSOnB (or both) are set at configure time
return setCurrentPOCCommand(POCCommand::SendMTS, true, timeout);
}
std::pair<bool, FlexRay::POCCommand> FlexRay::Controller::getCurrentPOCCommand(std::chrono::milliseconds timeout) const {
@@ -34,38 +466,162 @@ std::pair<bool, FlexRay::POCCommand> FlexRay::Controller::getCurrentPOCCommand(s
bool FlexRay::Controller::setCurrentPOCCommand(FlexRay::POCCommand cmd, bool checkForSuccess, std::chrono::milliseconds timeout) {
const auto beforeWrite = std::chrono::steady_clock::now();
if(!writeRegister(ERAYRegister::SUCC1, uint32_t(cmd), true, timeout))
if(!writeRegister(ERAYRegister::SUCC1, uint32_t(cmd), 0xF, true, timeout))
return false;
if(!checkForSuccess)
return true;
const auto writeDuration = std::chrono::steady_clock::now() - beforeWrite;
timeout = std::chrono::duration_cast<std::chrono::milliseconds>(writeDuration - timeout);
if(timeout.count() <= 0)
return false; // Out of time!
timeout = std::chrono::duration_cast<std::chrono::milliseconds>(timeout - writeDuration);
return wasCommandSuccessful(timeout);
}
bool FlexRay::Controller::wasCommandSuccessful(std::chrono::milliseconds timeout) const {
const auto start = std::chrono::steady_clock::now();
bool pocBusy = isPOCBusy();
while(pocBusy && (std::chrono::steady_clock::now() - start) < timeout) {
pocBusy = isPOCBusy();
}
if(pocBusy) // timeout
return false;
timeout = std::chrono::duration_cast<std::chrono::milliseconds>(timeout - (std::chrono::steady_clock::now() - start));
const auto val = getCurrentPOCCommand(timeout);
return val.first && val.second != FlexRay::POCCommand::CommandNotAccepted;
}
std::pair<bool, FlexRay::POCStatus> FlexRay::Controller::getCurrentPOCStatus(std::chrono::milliseconds timeout) const {
auto regpair = readRegister(ERAYRegister::CCSV, timeout);
return { regpair.first, FlexRay::POCStatus(regpair.second & 0x3F) };
}
bool FlexRay::Controller::lockConfiguration(std::chrono::milliseconds timeout) {
// This is not anything super special, just the way to get the ERAY out of POC:config
// See the ERAY Users Manaual section 4.3.1
auto beforeWrite = std::chrono::steady_clock::now();
if(!writeRegister(ERAYRegister::LCK, 0xCE, true, timeout))
return false;
timeout = std::chrono::duration_cast<std::chrono::milliseconds>(timeout - (std::chrono::steady_clock::now() - beforeWrite));
if(timeout.count() <= 0)
return false; // Out of time!
beforeWrite = std::chrono::steady_clock::now();
if(!writeRegister(ERAYRegister::LCK, 0x31, true, timeout))
return false;
timeout = std::chrono::duration_cast<std::chrono::milliseconds>(timeout - (std::chrono::steady_clock::now() - beforeWrite));
return setCurrentPOCCommand(POCCommand::Ready, true, timeout);
}
bool FlexRay::Controller::enterConfig(std::chrono::milliseconds timeout) {
const auto initialTimeout = timeout;
const auto functionBegin = std::chrono::steady_clock::now();
const auto updateTimeout = [&initialTimeout, &functionBegin, &timeout]() {
timeout = std::chrono::duration_cast<std::chrono::milliseconds>(initialTimeout - (std::chrono::steady_clock::now() - functionBegin));
};
auto statusPair = getCurrentPOCStatus(timeout);
const auto& status = statusPair.second;
if(!statusPair.first)
return false;
updateTimeout();
if(status != FlexRay::POCStatus::Ready &&
status != FlexRay::POCStatus::Config &&
status != FlexRay::POCStatus::DefaultConfig &&
status != FlexRay::POCStatus::Halt) {
if(!setCurrentPOCCommand(FlexRay::POCCommand::Freeze, true, timeout))
return false;
updateTimeout();
}
// If we're halted, we first go into DEFAULT_CONFIG before entering CONFIG
// Unintuitively, this enters DEFAULT_CONFIG
if(!setCurrentPOCCommand(FlexRay::POCCommand::Config, true, timeout))
return false;
updateTimeout();
// Now this enters CONFIG
return setCurrentPOCCommand(FlexRay::POCCommand::Config, true, timeout);
}
uint16_t FlexRay::Controller::CalculateHCRC(const MessageBuffer& buf) {
uint16_t ret = 0x1A;
auto addBit = [&ret](uint8_t bit) {
bit = bit ? 1 : 0;
int crcNxt; //CRCNXT = NXTBIT EXOR CRC_RG(14);
if (ret & (1<<10))
crcNxt = bit ^ 1;
else
crcNxt = bit ^ 0;
crcNxt &= 0x01;
// CRC_RG(14:1) = CRC_RG(13:0); // shift left by
ret <<= 1;
ret &= 0x7FE; // clear first bit
if (crcNxt) //CRC_RG(14:0) = CRC_RG(14:0) EXOR (4599hex);
ret ^= 0x385;
};
addBit(buf.isStartup);
addBit(buf.isSync);
for(auto i = 0; i < 11; i++)
addBit(buf.frameID & (1 << (10 - i)));
for(auto i = 0; i < 7; i++)
addBit(((buf.frameLengthBytes + 1) / 2) & (1 << (6 - i)));
return ret;
}
uint16_t FlexRay::Controller::CalculateCycleFilter(uint8_t baseCycle, uint8_t cycleRepetition) {
uint8_t cycleRepCode = 0;
switch(cycleRepetition) {
case 1: cycleRepCode = 0b1; break;
case 2: cycleRepCode = 0b10; break;
case 4: cycleRepCode = 0b100; break;
case 8: cycleRepCode = 0b1000; break;
case 16: cycleRepCode = 0b10000; break;
case 32: cycleRepCode = 0b100000; break;
case 64: cycleRepCode = 0b1000000; break;
}
return (cycleRepCode | baseCycle);
}
std::pair<bool, uint32_t> FlexRay::Controller::readRegister(ERAYRegister reg, std::chrono::milliseconds timeout) const {
if(timeout.count() <= 20)
return {false, 0}; // Out of time!
std::lock_guard<std::mutex> lk(readRegisterLock);
device.com->sendCommand(Command::FlexRayControl, FlexRayControlMessage::BuildReadCCRegsArgs(index, uint16_t(reg)));
std::shared_ptr<FlexRayControlMessage> resp;
const auto start = std::chrono::steady_clock::now();
while(!resp && (std::chrono::steady_clock::now() - start) < timeout) {
auto msg = device.com->waitForMessageSync(MessageFilter(icsneo::Network::NetID::FlexRayControl), timeout);
std::chrono::steady_clock::time_point lastSent;
do {
const auto waitTime = std::chrono::steady_clock::now();
auto msg = device.com->waitForMessageSync([this, &lastSent, &reg, &timeout]() {
if(timeout.count() < 20)
return true; // Might not have time to receive the response, so don't request
if(std::chrono::steady_clock::now() - lastSent < std::chrono::milliseconds(40))
return true; // Don't send too fast
if(!device.com->sendCommand(Command::FlexRayControl, FlexRayControlMessage::BuildReadCCRegsArgs(index, uint16_t(reg))))
return false; // Command failed to send
lastSent = std::chrono::steady_clock::now();
return true;
}, MessageFilter(icsneo::Network::NetID::FlexRayControl), timeout);
if(auto frmsg = std::dynamic_pointer_cast<FlexRayControlMessage>(msg)) {
if(frmsg->decoded && frmsg->controller == index && frmsg->opcode == FlexRay::Opcode::ReadCCRegs)
resp = frmsg;
}
}
if(resp)
if(resp)
break;
timeout -= std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - waitTime);
} while(timeout.count() > 0);
if(resp && !resp->registers.empty())
return {true, resp->registers[0]};
else
return {false, 0};
@@ -83,15 +639,23 @@ bool FlexRay::Controller::writeRegister(
bool waitForPOCReady,
std::chrono::milliseconds timeout) {
if(waitForPOCReady) {
const auto start = std::chrono::steady_clock::now();
bool pocBusy = isPOCBusy();
while(pocBusy && (std::chrono::steady_clock::now() - start) < timeout) {
pocBusy = isPOCBusy();
}
if(pocBusy) // timeout
return false;
}
if(mask != 0xffffffff) {
const auto beforeRead = std::chrono::steady_clock::now();
auto pair = readRegister(reg, timeout);
if(!pair.first)
return false; // Couldn't read, so we don't want to try to write anything
auto readDuration = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - beforeRead);
timeout = readDuration - timeout;
if(timeout.count() <= 0)
return false; // Out of time!
timeout -= readDuration;
pair.second &= ~mask;
pair.second |= value & mask;
value = pair.second;
@@ -104,6 +668,8 @@ bool FlexRay::Controller::writeRegister(
uint32_t value,
bool waitForPOCReady,
std::chrono::milliseconds timeout) {
if(timeout.count() <= 0)
return false; // Out of time!
if(waitForPOCReady) {
const auto start = std::chrono::steady_clock::now();
@@ -115,6 +681,7 @@ bool FlexRay::Controller::writeRegister(
return false;
}
device.com->sendCommand(Command::FlexRayControl, FlexRayControlMessage::BuildWriteCCRegArgs(index, uint16_t(reg), value));
return true; // Does the device send anything back to tell us this actually happened?
if(!device.com->sendCommand(Command::FlexRayControl, FlexRayControlMessage::BuildWriteCCRegArgs(index, uint16_t(reg), value)))
return false;
return true; // The device does not confirm the the command, if it did we'd put that here
}
+39 -3
View File
@@ -1,11 +1,28 @@
#include "icsneo/device/extensions/flexray/extension.h"
#include "icsneo/device/device.h"
#include "icsneo/communication/message/flexray/flexraymessage.h"
using namespace icsneo;
FlexRay::Extension::Extension(Device& device, uint8_t controllerCount) : DeviceExtension(device) {
for(uint8_t i = 0; i < controllerCount; i++)
controllers.emplace_back(std::make_shared<FlexRay::Controller>(device, i));
FlexRay::Extension::Extension(Device& device, const std::vector<Network>& controllerNetworks) : DeviceExtension(device) {
for(uint8_t i = 0; i < controllerNetworks.size(); i++)
controllers.emplace_back(std::make_shared<FlexRay::Controller>(device, i, controllerNetworks[i]));
}
void FlexRay::Extension::onGoOnline() {
for(auto& controller : controllers) {
if(controller->getStartWhenGoingOnline())
controller->getReady();
}
for(auto& controller : controllers) {
if(controller->getStartWhenGoingOnline())
controller->start();
}
}
void FlexRay::Extension::onGoOffline() {
for(auto& controller : controllers)
controller->halt();
}
void FlexRay::Extension::handleMessage(const std::shared_ptr<Message>& message) {
@@ -28,4 +45,23 @@ void FlexRay::Extension::handleMessage(const std::shared_ptr<Message>& message)
default:
break;
}
}
bool FlexRay::Extension::transmitHook(const std::shared_ptr<Message>& message, bool& success) {
if(!message || message->network.getType() != Network::Type::FlexRay)
return true; // Don't hook non-FlexRay messages
success = false;
std::shared_ptr<FlexRayMessage> frmsg = std::dynamic_pointer_cast<FlexRayMessage>(message);
if(!frmsg)
return false;
for(auto& controller : controllers) {
if(controller->getNetwork() != message->network)
continue;
success |= controller->transmit(frmsg);
}
return false;
}
+19 -12
View File
@@ -210,8 +210,10 @@ bool IDeviceSettings::apply(bool temporary) {
bytestream[6] = (uint8_t)(gs_checksum >> 8);
memcpy(bytestream.data() + 7, getMutableRawStructurePointer(), settings.size());
com->sendCommand(Command::SetSettings, bytestream);
std::shared_ptr<Message> msg = com->waitForMessageSync(std::make_shared<Main51MessageFilter>(Command::SetSettings), std::chrono::milliseconds(1000));
std::shared_ptr<Message> msg = com->waitForMessageSync([this, &bytestream]() {
return com->sendCommand(Command::SetSettings, bytestream);
}, Main51MessageFilter(Command::SetSettings), std::chrono::milliseconds(1000));
if(!msg || msg->data[0] != 1) { // We did not receive a response
// Attempt to get the settings from the device so we're up to date if possible
@@ -230,8 +232,9 @@ bool IDeviceSettings::apply(bool temporary) {
bytestream[6] = (uint8_t)(gs_checksum >> 8);
memcpy(bytestream.data() + 7, getMutableRawStructurePointer(), settings.size());
com->sendCommand(Command::SetSettings, bytestream);
msg = com->waitForMessageSync(std::make_shared<Main51MessageFilter>(Command::SetSettings), std::chrono::milliseconds(1000));
msg = com->waitForMessageSync([this, &bytestream]() {
return com->sendCommand(Command::SetSettings, bytestream);
}, Main51MessageFilter(Command::SetSettings), std::chrono::milliseconds(1000));
if(!msg || msg->data[0] != 1) {
// Attempt to get the settings from the device so we're up to date if possible
if(refresh()) {
@@ -242,8 +245,9 @@ bool IDeviceSettings::apply(bool temporary) {
}
if(!temporary) {
com->sendCommand(Command::SaveSettings);
msg = com->waitForMessageSync(std::make_shared<Main51MessageFilter>(Command::SaveSettings), std::chrono::milliseconds(5000));
msg = com->waitForMessageSync([this]() {
return com->sendCommand(Command::SaveSettings);
}, Main51MessageFilter(Command::SaveSettings), std::chrono::milliseconds(5000));
}
refresh(); // Refresh our buffer with what the device has, whether we were successful or not
@@ -266,8 +270,9 @@ bool IDeviceSettings::applyDefaults(bool temporary) {
return false;
}
com->sendCommand(Command::SetDefaultSettings);
std::shared_ptr<Message> msg = com->waitForMessageSync(std::make_shared<Main51MessageFilter>(Command::SetDefaultSettings), std::chrono::milliseconds(1000));
std::shared_ptr<Message> msg = com->waitForMessageSync([this]() {
return com->sendCommand(Command::SetDefaultSettings);
}, Main51MessageFilter(Command::SetDefaultSettings), std::chrono::milliseconds(1000));
if(!msg || msg->data[0] != 1) {
// Attempt to get the settings from the device so we're up to date if possible
if(refresh()) {
@@ -295,8 +300,9 @@ bool IDeviceSettings::applyDefaults(bool temporary) {
bytestream[6] = (uint8_t)(gs_checksum >> 8);
memcpy(bytestream.data() + 7, getMutableRawStructurePointer(), settings.size());
com->sendCommand(Command::SetSettings, bytestream);
msg = com->waitForMessageSync(std::make_shared<Main51MessageFilter>(Command::SetSettings), std::chrono::milliseconds(1000));
msg = com->waitForMessageSync([this, &bytestream]() {
return com->sendCommand(Command::SetSettings, bytestream);
}, Main51MessageFilter(Command::SetSettings), std::chrono::milliseconds(1000));
if(!msg || msg->data[0] != 1) {
// Attempt to get the settings from the device so we're up to date if possible
if(refresh()) {
@@ -307,8 +313,9 @@ bool IDeviceSettings::applyDefaults(bool temporary) {
}
if(!temporary) {
com->sendCommand(Command::SaveSettings);
msg = com->waitForMessageSync(std::make_shared<Main51MessageFilter>(Command::SaveSettings), std::chrono::milliseconds(5000));
msg = com->waitForMessageSync([this]() {
return com->sendCommand(Command::SaveSettings);
}, Main51MessageFilter(Command::SaveSettings), std::chrono::milliseconds(5000));
}
refresh(); // Refresh our buffer with what the device has, whether we were successful or not
+3 -3
View File
@@ -19,7 +19,7 @@ Additionally, `event callbacks`_ can be registered, which may remove the need to
.. _events:
Events
Events
~~~~~~~~~~~~~~~~~~~~
The API stores events in a single buffer that can has a default size of 10,000 events.
@@ -67,7 +67,7 @@ In order to access device functionality, the device must first be opened, which
The exception to this is setting the message polling status of the device.
Trying to open/close the device when the device is already open/closed will result in an error being logged on the calling thread.
Online/Offline Status
Online/Offline Status
~~~~~~~~~~~~~~~~~~~~~~~
Going online begins communication between the device and the rest of the network. In order to be online, the device must also be open.
@@ -99,4 +99,4 @@ Write Blocking Status
The write blocking status of the device determines the behavior of attempting to transmit to the device (likely via sending messages) with a large backlog of messages.
If write blocking is enabled, then the transmitting thread will wait for the entire buffer to be transmitted.
If write blocking is disabled, then the attempt to transmit will simply fail and an error will be logged on the calling thread.
If write blocking is disabled, then the attempt to transmit will simply fail and an error will be logged on the calling thread.
+1 -1
View File
@@ -64,7 +64,7 @@ master_doc = 'index'
# General information about the project.
project = 'libicsneo'
copyright = '2019, Intrepid Control Systems, Inc'
copyright = '2018-2020, Intrepid Control Systems, Inc.'
author = 'Intrepid Control Systems, Inc.'
# The version info for the project you're documenting, acts as replacement for
+1 -1
View File
@@ -64,7 +64,7 @@ master_doc = 'index'
# General information about the project.
project = 'libicsneo'
copyright = '2019, Intrepid Control Systems, Inc'
copyright = '2018-2020, Intrepid Control Systems, Inc.'
author = 'Intrepid Control Systems, Inc.'
# The version info for the project you're documenting, acts as replacement for
+1 -1
View File
@@ -1 +1 @@
breathe>=4.11.0
breathe==4.12.0
+27
View File
@@ -0,0 +1,27 @@
option(LIBICSNEO_BUILD_C_INTERACTIVE_EXAMPLE "Build the command-line interactive 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)
# Disabled until we properly build these in-tree
# option(LIBICSNEO_BUILD_CSHARP_INTERACTIVE_EXAMPLE "Build the command-line interactive C# example." OFF)
# option(LIBICSNEO_BUILD_JAVA_INTERACTIVE_EXAMPLE "Build the command-line interactive Java example." OFF)
if(LIBICSNEO_BUILD_C_INTERACTIVE_EXAMPLE)
add_subdirectory(c/interactive)
endif()
if(LIBICSNEO_BUILD_CPP_SIMPLE_EXAMPLE)
add_subdirectory(cpp/simple)
endif()
if(LIBICSNEO_BUILD_CPP_INTERACTIVE_EXAMPLE)
add_subdirectory(cpp/interactive)
endif()
# if(LIBICSNEO_BUILD_CSHARP_INTERACTIVE_EXAMPLE)
# add_subdirectory(csharp)
# endif()
# if(LIBICSNEO_BUILD_JAVA_INTERACTIVE_EXAMPLE)
# add_subdirectory(java)
# endif()
+16
View File
@@ -0,0 +1,16 @@
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)
if(UNIX)
target_link_libraries(libicsneoc-interactive-example ${CMAKE_DL_LIBS})
endif()
+80
View File
@@ -0,0 +1,80 @@
# libicsneo C Example
This is an example console application that uses the icsneoc library to control an Intrepid Control Systems hardware device.
## Cloning
This will create a copy of the repository on your local machine.
Run:
```shell
git clone https://github.com/intrepidcs/libicsneo-examples -b v0.2.0-dev --recursive
```
Alternatively, if you cloned without the `--recursive` flag, you must enter the `libicsneo-examples` folder and run the following:
```shell
git submodule update --recursive --init
```
If you haven't done this, `third-party/libicsneo` will be empty and you won't be able to build!
## Windows using Visual Studio 2017+
### Building the DLL
First, we are going to build the icsneoc library into a .dll file that we can later use in order to access the library functions.
1. Launch Visual Studio and open the `libicsneo-examples` folder.
2. Choose `File->Open->Cmake...`
3. Navigate to `third-party/libicsneo` and select the `CMakeLists.txt` there.
4. Visual Studio will process the CMake project.
5. Select `Build->Rebuild All`
6. Visual Studio will generate the `icsneoc.dll` file, which can then be found by selecting `Project->Cmake Cache (x64-Debug Only)->Open in Explorer`. If the file cannot be found, search in `libicsneo-examples/third-party/libicsneo/out/build/x64-Debug` and double-check that the build succeeded in step 5.
7. Move the `icsneoc.dll` file to the `/C/Windows/System32` folder. This will allow it to be found by icsneo_init(), which loads all the library functions.
* Alternatively, the `icsneoc.dll` file can be placed in the same directory as `libicsneoc-example.exe`, which is typically `libicsneo-examples/libicsneoc-example/out/build/x64-Debug`, although this is not recommended. For more information, refer to [the Microsoft documentation](https://docs.microsoft.com/en-us/windows/desktop/dlls/dynamic-link-library-search-order).
### Building the example program
Although the example program will build without successfully completing the steps above, it will exit immediately upon running due to a failure to load any library functions.
1. Choose `File->Open->Cmake...`
2. Navigate to `libicsneo-examples/libicsneoc-example` and select the `CMakeLists.txt` there.
3. Visual Studio will process the CMake project.
4. Select `Build->Rebuild All`
5. Click on the dropdown arrow attached to the green play button (labelled "Select Startup Item") and select `libicsneoc-example.exe`
6. Click on the green play button to run the example.
## Ubuntu 18.04 LTS
### Building the .so
First, we are going to build the icsneoc library into a .so file that we can later use in order to access the library functions.
1. Install dependencies with `sudo apt update` then `sudo apt install build-essential cmake libusb-1.0-0-dev libpcap0.8-dev`
2. Change directories to `libicsneo-examples/third-party/libicsneo` and create a build directory by running `mkdir -p build`
3. Enter the build directory with `cd build`
4. Run `cmake ..` to generate your Makefile.
* Hint! Running `cmake -DCMAKE_BUILD_TYPE=Debug ..` will generate the proper scripts to build debug, and `cmake -DCMAKE_BUILD_TYPE=Release ..` will generate the proper scripts to build with all optimizations on.
5. Run `make` to build the library.
* Hint! Speed up your build by using multiple processors! Use `make -j#` where `#` is the number of cores/threads your system has plus one. For instance, on a standard 8 thread Intel i7, you might use `-j9` for an ~8x speedup.
6. Run `sudo cp libicsneoc.so /usr/lib` so that it can be found via the default ubuntu .so search path. For more information, see the [ld.so.8 man page](http://man7.org/linux/man-pages/man8/ld.so.8.html).
### Building the example program
Although the example program will build without successfully completing the steps above, it will exit immediately upon running due to a failure to load any library functions.
1. Change directories to `libicsneo-examples/libicsneoc-example`
2. Create a build directory by running `mkdir -p build`
3. Enter the build directory with `cd build`
4. Run `cmake ..` to generate your Makefile.
* Hint! Running `cmake -DCMAKE_BUILD_TYPE=Debug ..` will generate the proper scripts to build debug, and `cmake -DCMAKE_BUILD_TYPE=Release ..` will generate the proper scripts to build with all optimizations on.
5. Run `make` to build the library.
* Hint! Speed up your build by using multiple processors! Use `make -j#` where `#` is the number of cores/threads your system has plus one. For instance, on a standard 8 thread Intel i7, you might use `-j9` for an ~8x speedup.
6. Run `sudo ./libicsneoc-example` to run the example.
* Hint! In order to run without sudo, you will need to set up the udev rules. Copy `libicsneo-examples/third-party/libicsneo/99-intrepidcs.rules` to `/etc/udev/rules.d`, then run `udevadm control --reload-rules && udevadm trigger` afterwards. While the program will still run without setting up these rules, it will fail to open any devices.
## macOS
Instructions coming soon&trade;
+610
View File
@@ -0,0 +1,610 @@
// Signal to dynamically load the library
#define ICSNEOC_DYNAMICLOAD
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <ctype.h>
// Get the PRIu64 macro for timestamps
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
// Include icsneo/icsneoc.h to access library functions
#include "icsneo/icsneoc.h"
size_t msgLimit = 50000;
size_t numDevices = 0;
neodevice_t devices[99];
const neodevice_t* selectedDevice = NULL;
/**
* \brief Prints all current known devices to output in the following format:
* [num] DeviceType SerialNum Connected: Yes/No Online: Yes/No Msg Polling: On/Off
*
* If any devices could not be described due to an error, they will appear in the following format:
* Description for device num not available!
*/
void printAllDevices() {
if(numDevices == 0) {
printf("No devices found! Please scan for new devices.\n");
}
for(int i = 0; i < numDevices; i++) {
char productDescription[ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION];
size_t descriptionLength = ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION;
// Updates productDescription and descriptionLength for each device
if(icsneo_describeDevice(devices + i, productDescription, &descriptionLength)) {
printf("[%d] %s\tConnected: ", i + 1, productDescription);
if(icsneo_isOpen(devices + i)) {
printf("Yes\t");
} else printf("No\t");
printf("Online: ");
if(icsneo_isOnline(devices + i)) {
printf("Yes\t");
} else printf("No\t");
printf("Msg Polling: ");
if(icsneo_isMessagePollingEnabled(devices + i)) {
printf("On\n");
} else printf("Off\n");
} else {
printf("Description for device %d not available!\n", i + 1);
}
}
}
/**
* \brief Scans for any new devices, adding them to devices and updating numDevices accordingly
* A total of 99 devices may be stored at once
*/
size_t scanNewDevices() {
neodevice_t newDevices[99];
size_t numNewDevices = 99;
icsneo_findAllDevices(newDevices, &numNewDevices);
for(int i = 0; i < numNewDevices; ++i) {
devices[numDevices + i] = newDevices[i];
}
numDevices += numNewDevices;
return numNewDevices;
}
// Prints the main menu options to output
void printMainMenu() {
printf("Press the letter next to the function you want to use:\n");
printf("A - List all devices\n");
printf("B - Scan for new devices\n");
printf("C - Open/close\n");
printf("D - Go online/offline\n");
printf("E - Enable/disable message polling\n");
printf("F - Get messages\n");
printf("G - Send message\n");
printf("H - Get events\n");
printf("I - Set HS CAN to 250K\n");
printf("J - Set HS CAN to 500K\n");
printf("X - Exit\n");
}
void printLastError() {
neoevent_t error;
if(icsneo_getLastError(&error))
printf("Error 0x%u: %s\n", error.eventNumber, error.description);
else
printf("No errors found!\n");
}
/**
* \brief Gets all current API events and prints them to output
* Flushes the API event cache, meaning future calls (barring any new events) will not detect any further API events
*/
void printAPIEvents() {
neoevent_t events[99];
size_t eventCount = 99;
if(icsneo_getEvents(events, &eventCount)) {
if(eventCount == 1) {
printf("1 API event found!\n");
printf("Event 0x%u: %s\n", events[0].eventNumber, events[0].description);
} else {
printf("%d API events found!\n", (int) eventCount);
for(int i = 0; i < eventCount; ++i) {
printf("Event 0x%u: %s\n", events[i].eventNumber, events[i].description);
}
}
} else {
printf("Failed to get API events!\n");
}
}
/**
* \brief Gets all current device events and prints them to output. If no device events were found, printAPIEvents() is called
* Flushes the device event cache, meaning future calls (barring any new events) will not detect any further device events for this device
*/
void printDeviceEvents(neodevice_t* device) {
neoevent_t events[99];
size_t eventCount = 99;
if(icsneo_getDeviceEvents(selectedDevice, events, &eventCount)) {
if(eventCount == 1) {
printf("1 device event found!\n");
printf("Event 0x%x: %s\n", events[0].eventNumber, events[0].description);
} else {
printf("%d device events found!\n", (int) eventCount);
for(int i = 0; i < eventCount; ++i) {
printf("Event 0x%x: %s\n", events[i].eventNumber, events[i].description);
}
}
}
}
/**
* \brief Used to check character inputs for correctness (if they are found in an expected list)
* \param[in] numArgs the number of possible options for the expected character
* \param[in] ... the possible options for the expected character
* \returns the entered character
*
* This function repeatedly prompts the user for input until a matching input is entered
* Example usage: char input = getCharInput(5, 'F', 'u', 'b', 'a', 'r');
*/
char getCharInput(int numArgs, ...) {
// 99 chars shold be more than enough to catch any typos
char input[99];
bool found = false;
va_list vaList;
va_start(vaList, numArgs);
char* list = (char*) calloc(numArgs, sizeof(char));
for(int i = 0; i < numArgs; ++i) {
*(list + i) = va_arg(vaList, int);
}
va_end(vaList);
while(!found) {
fgets(input, 99, stdin);
if(strlen(input) == 2) {
for(int i = 0; i < numArgs; ++i) {
if(input[0] == *(list + i)) {
found = true;
break;
}
}
}
if(!found) {
printf("Input did not match expected options. Please try again.\n");
}
}
free(list);
return input[0];
}
/**
* \brief Prompts the user to select a device from the list of currently known devices
* \returns a pointer to the device in devices[] selected by the user
* Requires an input from 1-9, so a maximum of 9 devices are supported
*/
const neodevice_t* selectDevice() {
printf("Please select a device:\n");
printAllDevices();
printf("\n");
int selectedDeviceNum = 10;
while(selectedDeviceNum > numDevices) {
char deviceSelection = getCharInput(9, '1', '2', '3', '4', '5', '6', '7', '8', '9');
selectedDeviceNum = deviceSelection - '0';
if(selectedDeviceNum > numDevices) {
printf("Selected device out of range!\n");
}
}
printf("\n");
return devices + selectedDeviceNum - 1;
}
int main() {
// Attempt to initialize the library and access its functions
// This call searches for icsneoc.dll according to the standard dynamic-link library search order
int ret = icsneo_init();
if(ret == 1) {
printf("The library was already initialized!\n");
return ret;
}
if(ret == 2) {
printf("The library could not be found!\n");
return ret;
}
if(ret == 3) {
printf("The library is missing functions!\n");
return ret;
}
neoversion_t ver = icsneo_getVersion();
printf("ICS icsneoc.dll version %u.%u.%u\n\n", ver.major, ver.minor, ver.patch);
while(true) {
printMainMenu();
printf("\n");
char input = getCharInput(22, 'A', 'a', 'B', 'b', 'C', 'c', 'D', 'd', 'E', 'e', 'F', 'f', 'G', 'g', 'H', 'h', 'I', 'i', 'J', 'j', 'X', 'x');
printf("\n");
switch(input) {
// List current devices
case 'A':
case 'a':
printAllDevices();
printf("\n");
break;
// Scan for new devices
case 'B':
case 'b':
{
size_t numNewDevices = scanNewDevices();
if(numNewDevices == 1) {
printf("1 new device found!\n");
} else {
printf("%d new devices found!\n", (int) numNewDevices);
}
printAllDevices();
printf("\n");
break;
}
// Open/close a device
case 'C':
case 'c':
{
// Select a device and get its description
if(numDevices == 0) {
printf("No devices found! Please scan for new devices.\n\n");
break;
}
selectedDevice = selectDevice();
// Get the product description for the device
char productDescription[ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION];
size_t descriptionLength = ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION;
icsneo_describeDevice(selectedDevice, productDescription, &descriptionLength);
printf("Would you like to open or close %s?\n", productDescription);
printf("[1] Open\n[2] Close\n[3] Cancel\n\n");
char input = getCharInput(3, '1', '2', '3');
printf("\n");
switch(input) {
case '1':
// Attempt to open the selected device
if(icsneo_openDevice(selectedDevice)) {
printf("%s successfully opened!\n\n", productDescription);
} else {
printf("%s failed to open!\n\n", productDescription);
printLastError();
printf("\n");
}
break;
case '2':
// Attempt to close the device
if(icsneo_closeDevice(selectedDevice)) {
numDevices--;
printf("Successfully closed %s!\n\n", productDescription);
// Shifts everything after the removed device 1 index to the left
bool startResizing = false;
for(int i = 0; i < numDevices; ++i) {
if(selectedDevice == devices + i)
startResizing = true;
if(startResizing)
devices[i] = devices[i + 1];
}
selectedDevice = NULL;
} else {
printf("Failed to close %s!\n\n", productDescription);
printLastError();
printf("\n");
}
break;
default:
printf("Canceling!\n\n");
}
}
break;
// Go online/offline
case 'D':
case 'd':
{
// Select a device and get its description
if(numDevices == 0) {
printf("No devices found! Please scan for new devices.\n\n");
break;
}
selectedDevice = selectDevice();
// Get the product description for the device
char productDescription[ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION];
size_t descriptionLength = ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION;
icsneo_describeDevice(selectedDevice, productDescription, &descriptionLength);
printf("Would you like to have %s go online or offline?\n", productDescription);
printf("[1] Online\n[2] Offline\n[3] Cancel\n\n");
char input = getCharInput(3, '1', '2', '3');
printf("\n");
switch(input) {
case '1':
// Attempt to go online
if(icsneo_goOnline(selectedDevice)) {
printf("%s successfully went online!\n\n", productDescription);
} else {
printf("%s failed to go online!\n\n", productDescription);
printLastError();
printf("\n");
}
break;
case '2':
// Attempt to go offline
if(icsneo_goOffline(selectedDevice)) {
printf("%s successfully went offline!\n\n", productDescription);
} else {
printf("%s failed to go offline!\n\n", productDescription);
printLastError();
printf("\n");
}
break;
default:
printf("Canceling!\n\n");
}
}
break;
// Enable/disable message polling
case 'E':
case 'e':
{
// Select a device and get its description
if(numDevices == 0) {
printf("No devices found! Please scan for new devices.\n\n");
break;
}
selectedDevice = selectDevice();
// Get the product description for the device
char productDescription[ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION];
size_t descriptionLength = ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION;
icsneo_describeDevice(selectedDevice, productDescription, &descriptionLength);
printf("Would you like to enable or disable message polling for %s?\n", productDescription);
printf("[1] Enable\n[2] Disable\n[3] Cancel\n\n");
char input = getCharInput(3, '1', '2', '3');
printf("\n");
switch(input) {
case '1':
// Attempt to enable message polling
if(icsneo_enableMessagePolling(selectedDevice)) {
printf("Successfully enabled message polling for %s!\n\n", productDescription);
} else {
printf("Failed to enable message polling for %s!\n\n", productDescription);
printLastError();
printf("\n");
}
// Manually setting the polling message limit as done below is optional
// It will default to 20k if not set
// Attempt to set the polling message limit
if(icsneo_setPollingMessageLimit(selectedDevice, msgLimit)) {
printf("Successfully set message polling limit for %s!\n\n", productDescription);
} else {
printf("Failed to set polling message limit for %s!\n\n", productDescription);
printLastError();
printf("\n");
}
break;
case '2':
// Attempt to disable message polling
if(icsneo_disableMessagePolling(selectedDevice)) {
printf("Successfully disabled message polling for %s!\n\n", productDescription);
} else {
printf("Failed to disable message polling limit for %s!\n\n", productDescription);
printLastError();
printf("\n");
}
break;
default:
printf("Canceling!\n\n");
}
}
break;
// Get messages
case 'F':
case 'f':
{
// Select a device and get its description
if(numDevices == 0) {
printf("No devices found! Please scan for new devices.\n\n");
break;
}
selectedDevice = selectDevice();
// Get the product description for the device
char productDescription[ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION];
size_t descriptionLength = ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION;
icsneo_describeDevice(selectedDevice, productDescription, &descriptionLength);
// Prepare the array of neomessage_t ptrs for reading in the messages
neomessage_t* msgs = (neomessage_t*) malloc(msgLimit * sizeof(neomessage_t*));
// Get messages
size_t msgCount = msgLimit;
// Attempt to get messages
if(!icsneo_getMessages(selectedDevice, msgs, &msgCount, (uint64_t) 0)) {
printf("Failed to get messages for %s!\n\n", productDescription);
printLastError();
free(msgs);
printf("\n");
break;
}
if(msgCount == 1) {
printf("1 message received from %s!\n", productDescription);
} else {
printf("%d messages received from %s!\n", (int) msgCount, productDescription);
}
// Print out the received messages
for(size_t i = 0; i < msgCount; i++) {
neomessage_t* msg = &msgs[i];
switch(msg->type) {
case ICSNEO_NETWORK_TYPE_CAN: // CAN
{
neomessage_can_t* canMsg = (neomessage_can_t*) msg;
printf("\t0x%03x [%zu] ", canMsg->arbid, canMsg->length);
for(size_t i = 0; i < canMsg->length; i++) {
printf("%02x ", canMsg->data[i]);
}
printf("(%"PRIu64")\n", canMsg->timestamp);
break;
}
default:
if(msg->netid != 0)
printf("\tMessage on netid %d with length %zu\n", msg->netid, msg->length);
break;
}
}
printf("\n");
free(msgs);
}
break;
// Send message
case 'G':
case 'g':
{
// Select a device and get its description
if(numDevices == 0) {
printf("No devices found! Please scan for new devices.\n\n");
break;
}
selectedDevice = selectDevice();
// Get the product description for the device
char productDescription[ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION];
size_t descriptionLength = ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION;
icsneo_describeDevice(selectedDevice, productDescription, &descriptionLength);
// Start generating sample msg
uint8_t sendMessageData[6];
sendMessageData[0] = 0xaa;
sendMessageData[1] = 0xbb;
sendMessageData[2] = 0xcc;
sendMessageData[3] = 0xdd;
sendMessageData[4] = 0xee;
sendMessageData[5] = 0xff;
neomessage_can_t msg = {0};
msg.arbid = 0x120;
msg.length = 6;
msg.netid = ICSNEO_NETID_HSCAN;
msg.data = sendMessageData;
msg.status.canfdFDF = false;
msg.status.extendedFrame = false;
msg.status.canfdBRS = false;
// End generating sample msg
// Attempt to transmit the sample msg
if(icsneo_transmit(selectedDevice, (const neomessage_t*) &msg)) {
printf("Message transmit successful!\n\n");
} else {
printf("Failed to transmit message to %s!\n\n", productDescription);
printLastError();
printf("\n");
}
}
break;
// Get events
case 'H':
case 'h':
{
// All API events
printAPIEvents();
printf("\n");
}
break;
// Set HS CAN to 250k
case 'I':
case 'i':
{
// Select a device and get its description
if(numDevices == 0) {
printf("No devices found! Please scan for new devices.\n\n");
break;
}
selectedDevice = selectDevice();
// Get the product description for the device
char productDescription[ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION];
size_t descriptionLength = ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION;
icsneo_describeDevice(selectedDevice, productDescription, &descriptionLength);
// Attempt to set baudrate and apply settings
if(icsneo_setBaudrate(selectedDevice, ICSNEO_NETID_HSCAN, 250000) && icsneo_settingsApply(selectedDevice)) {
printf("Successfully set HS CAN baudrate for %s to 250k!\n\n", productDescription);
} else {
printf("Failed to set HS CAN for %s to 250k!\n\n", productDescription);
printLastError();
printf("\n");
}
}
break;
// Set HS CAN to 500k
case 'J':
case 'j':
{
// Select a device and get its description
if(numDevices == 0) {
printf("No devices found! Please scan for new devices.\n\n");
break;
}
selectedDevice = selectDevice();
// Get the product description for the device
char productDescription[ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION];
size_t descriptionLength = ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION;
icsneo_describeDevice(selectedDevice, productDescription, &descriptionLength);
// Attempt to set baudrate and apply settings
if(icsneo_setBaudrate(selectedDevice, ICSNEO_NETID_HSCAN, 500000) && icsneo_settingsApply(selectedDevice)) {
printf("Successfully set HS CAN baudrate for %s to 500k!\n\n", productDescription);
} else {
printf("Failed to set HS CAN for %s to 500k!\n\n", productDescription);
printLastError();
printf("\n");
}
}
break;
// Exit
case 'X':
case 'x':
printf("Exiting program\n");
return !icsneo_close();
default:
printf("Unexpected input, exiting!\n");
return 1;
}
}
return 0;
}
+27
View File
@@ -0,0 +1,27 @@
cmake_minimum_required(VERSION 3.2)
project(libicsneocpp-interactive-example VERSION 0.2.0)
set(CMAKE_CXX_STANDARD 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)
target_link_libraries(libicsneocpp-interactive-example icsneocpp)
+48
View File
@@ -0,0 +1,48 @@
# libicsneo C++ Example
This is an example console application which uses libicsneo to connect to an Intrepid Control Systems hardware device. It has both interactive and simple examples for sending and receiving CAN & CAN FD traffic.
## Building
This example shows how to use the C++ version of libicsneo with CMake. It will build libicsneo along with your project.
First, you need to clone the repository onto your local machine. Run:
```shell
git clone https://github.com/intrepidcs/libicsneo-examples --recursive
```
Alternatively, if you cloned without the `--recursive flag`, you must enter the `libicsneo-examples` folder and run the following:
```shell
git submodule update --recursive --init
```
If you haven't done this, `third-party/libicsneo` will be empty and you won't be able to build!
### Windows using Visual Studio 2017+
1. Launch Visual Studio and open the `libicsneo-examples` folder.
2. Choose `File->Open->CMake...`
3. Navigate to the `libicsneocpp-example` folder and select the `CMakeLists.txt` there.
4. Visual Studio will process the CMake project.
5. Choose the dropdown attached to the green play button (labelled "select startup item...") in the toolbar.
6. Select `libicsneocpp-interactive-example.exe` or `libicsneocpp-simple-example.exe`
7. Press the green play button to compile and run the example.
### Ubuntu 18.04 LTS
1. Install dependencies with `sudo apt update` then `sudo apt install build-essential cmake libusb-1.0-0-dev libpcap0.8-dev`
2. Change directories to your `libicsneo-examples/libicsneocpp-example` folder and create a build directory by running `mkdir -p build`
3. Enter the build directory with `cd build`
4. Run `cmake ..` to generate your Makefile.
* Hint! Running `cmake -DCMAKE_BUILD_TYPE=Debug ..` will generate the proper scripts to build debug, and `cmake -DCMAKE_BUILD_TYPE=Release ..` will generate the proper scripts to build with all optimizations on.
5. Run `make libicsneocpp-interactive-example` to build.
* Hint! Speed up your build by using multiple processors! Use `make libicsneocpp-interactive-example -j#` where `#` is the number of cores/threads your system has plus one. For instance, on a standard 8 thread Intel i7, you might use `-j9` for an ~8x speedup.
6. Now run `sudo ./libicsneocpp-interactive-example` to run the example.
* Hint! In order to run without sudo, you will need to set up the udev rules. Copy `libicsneo-examples/third-party/libicsneo/99-intrepidcs.rules` to `/etc/udev/rules.d`, then run `udevadm control --reload-rules && udevadm trigger` afterwards. While the program will still run without setting up these rules, it will fail to open any devices.
7. If you wish to run the simple example instead, replace any instances of "interactive" with "simple" in steps 5 and 6.
### macOS
Instructions coming soon&trade;
@@ -0,0 +1,618 @@
#include <iostream>
#include <string>
#include <ctype.h>
#include <vector>
#include <map>
// Include icsneo/icsneocpp.h to access library functions
#include "icsneo/icsneocpp.h"
/**
* \brief Prints all current known devices to output in the following format:
* [num] DeviceType SerialNum Connected: Yes/No Online: Yes/No Msg Polling: On/Off
*
* If any devices could not be described due to an error, they will appear in the following format:
* Description for device num not available!
*/
void printAllDevices(const std::vector<std::shared_ptr<icsneo::Device>>& devices) {
if(devices.size() == 0) {
std::cout << "No devices found! Please scan for new devices." << std::endl;
}
int index = 1;
for(auto device : devices) {
std::cout << "[" << index << "] " << device->describe() << "\tConnected: " << (device->isOpen() ? "Yes\t" : "No\t");
std::cout << "Online: " << (device->isOnline() ? "Yes\t" : "No\t");
std::cout << "Msg Polling: " << (device->isMessagePollingEnabled() ? "On" : "Off") << std::endl;
index++;
}
}
// Prints the main menu options to output
void printMainMenu() {
std::cout << "Press the letter next to the function you want to use:" << std::endl;
std::cout << "A - List all devices" << std::endl;
std::cout << "B - Find all devices" << std::endl;
std::cout << "C - Open/close" << std::endl;
std::cout << "D - Go online/offline" << std::endl;
std::cout << "E - Enable/disable message polling" << std::endl;
std::cout << "F - Get messages" << std::endl;
std::cout << "G - Send messages" << std::endl;
std::cout << "H - Get events" << std::endl;
std::cout << "I - Set HS CAN to 250K" << std::endl;
std::cout << "J - Set LSFT CAN to 250K" << std::endl;
std::cout << "K - Add/Remove a message callback" << std::endl;
std::cout << "X - Exit" << std::endl;
}
/**
* \brief Gets all current API events (info and warning level) and prints them to output
* Flushes all current API events, meaning future calls (barring any new events) will not detect any further API events
*/
void printAPIEvents() {
// Match all events
auto events = icsneo::GetEvents(icsneo::EventFilter());
if(events.size() == 1) {
std::cout << "1 API event found!" << std::endl;
} else {
std::cout << events.size() << " API events found!" << std::endl;
}
for(auto event : events) {
std::cout << event << std::endl;
}
}
/**
* \brief Gets all current API warnings and prints them to output
* Flushes all current API warnings, meaning future calls (barring any new warnings) will not detect any further API warnings
*/
void printAPIWarnings() {
// Match all warning events, regardless of device
auto warnings = icsneo::GetEvents(icsneo::EventFilter(nullptr, icsneo::APIEvent::Severity::EventWarning));
if(warnings.size() == 1) {
std::cout << "1 API warning found!" << std::endl;
} else {
std::cout << warnings.size() << " API warnings found!" << std::endl;
}
for(auto warning : warnings) {
std::cout << warning << std::endl;
}
}
/**
* \brief Gets all current device events and prints them to output.
* Flushes all current device events, meaning future calls (barring any new events) will not detect any further device events for this device
*/
void printDeviceEvents(std::shared_ptr<icsneo::Device> device) {
// Match all events for the specified device
auto events = icsneo::GetEvents(icsneo::EventFilter(device.get()));
if(events.size() == 1) {
std::cout << "1 device event found!" << std::endl;
} else {
std::cout << events.size() << " device events found!" << std::endl;
}
for(auto event : events) {
std::cout << event << std::endl;
}
}
/**
* \brief Gets all current device warnings and prints them to output.
* Flushes all current device warnings, meaning future calls (barring any new warnings) will not detect any further device warnings for this device
*/
void printDeviceWarnings(std::shared_ptr<icsneo::Device> device) {
// Match all warning events for the specified device
auto events = icsneo::GetEvents(icsneo::EventFilter(device.get(), icsneo::APIEvent::Severity::EventWarning));
if(events.size() == 1) {
std::cout << "1 device warning found!" << std::endl;
} else {
std::cout << events.size() << " device warnings found!" << std::endl;
}
for(auto event : events) {
std::cout << event << std::endl;
}
}
/**
* \brief Used to check character inputs for correctness (if they are found in an expected list)
* \param[in] numArgs the number of possible options for the expected character
* \param[in] ... the possible options for the expected character
* \returns the entered character
*
* This function repeatedly prompts the user for input until a matching input is entered
* Example usage:
* char input = getCharInput(std::vector<char> {'F', 'u', 'b', 'a', 'r'});
*/
char getCharInput(std::vector<char> allowed) {
bool found = false;
std::string input;
while(!found) {
std::cin >> input;
if(input.length() == 1) {
for(char compare : allowed) {
if(compare == input.c_str()[0]) {
found = true;
break;
}
}
}
if(!found) {
std::cout << "Input did not match expected options. Please try again." << std::endl;
}
}
return input.c_str()[0];
}
/**
* \brief Prompts the user to select a device from the list of currently known devices
* \returns a pointer to the device in devices[] selected by the user
* Requires an input from 1-9, so a maximum of 9 devices are supported
*/
std::shared_ptr<icsneo::Device> selectDevice(const std::vector<std::shared_ptr<icsneo::Device>>& from) {
printf("Please select a device:\n");
printAllDevices(from);
printf("\n");
int selectedDeviceNum = 10;
while((size_t) selectedDeviceNum > from.size()) {
char deviceSelection = getCharInput(std::vector<char> {'1', '2', '3', '4', '5', '6', '7', '8', '9'});
selectedDeviceNum = deviceSelection - '0';
if((size_t) selectedDeviceNum > from.size()) {
std::cout << "Selected device out of range!" << std::endl;
}
}
std::cout << std::endl;
return from.at(selectedDeviceNum - 1);
}
int main() {
std::cout << "Running libicsneo " << icsneo::GetVersion() << std::endl << std::endl;
size_t msgLimit = 50000;
std::vector<std::shared_ptr<icsneo::Device>> devices;
std::map<std::shared_ptr<icsneo::Device>, std::vector<int>> callbacks;
std::shared_ptr<icsneo::Device> selectedDevice;
while(true) {
printMainMenu();
std::cout << std::endl;
char input = getCharInput(std::vector<char> {'A', 'a', 'B', 'b', 'C', 'c', 'D', 'd', 'E', 'e', 'F', 'f', 'G', 'g', 'H', 'h', 'I', 'i', 'J', 'j', 'K', 'k', 'X', 'x'});
std::cout << std::endl;
switch(input) {
// List current devices
case 'A':
case 'a':
printAllDevices(devices);
std::cout << std::endl;
break;
// Find all devices
case 'B':
case 'b':
{
devices = icsneo::FindAllDevices();
for(auto device : devices) {
callbacks.insert({device, std::vector<int>()});
}
if(devices.size() == 1) {
std::cout << "1 device found!" << std::endl;
} else {
std::cout << devices.size() << " devices found!" << std::endl;
}
printAllDevices(devices);
std::cout << std::endl;
break;
}
// Open/Close
case 'C':
case 'c':
{
// Select a device and get its description
if(devices.size() == 0) {
std::cout << "No devices found! Please scan for new devices." << std::endl << std::endl;
break;
}
selectedDevice = selectDevice(devices);
std::cout << "Would you like to open or close " << selectedDevice->describe() << "?" << std::endl;
std::cout << "[1] Open" << std::endl << "[2] Close" << std::endl << "[3] Cancel" << std::endl << std::endl;
char selection = getCharInput(std::vector<char> {'1', '2', '3'});
std::cout << std::endl;
switch(selection) {
case '1':
if(selectedDevice->open()) {
std::cout << selectedDevice->describe() << " successfully opened!" << std::endl << std::endl;
} else {
std::cout << selectedDevice->describe() << " failed to open!" << std::endl << std::endl;
std::cout << icsneo::GetLastError() << std::endl;
std::cout << std::endl;
}
break;
case '2':
// Attempt to close the device
if(selectedDevice->close()) {
std::cout << "Successfully closed " << selectedDevice->describe() << "!" << std::endl << std::endl;
selectedDevice = NULL;
} else {
std::cout << "Failed to close " << selectedDevice->describe() << "!" << std::endl << std::endl;
std::cout << icsneo::GetLastError() << std::endl;;
std::cout << std::endl;
}
break;
default:
std::cout << "Canceling!" << std::endl << std::endl;
break;
}
}
break;
// Go online/offline
case 'D':
case 'd':
{
// Select a device and get its description
if(devices.size() == 0) {
std::cout << "No devices found! Please scan for new devices." << std::endl << std::endl;
break;
}
selectedDevice = selectDevice(devices);
std::cout << "Would you like to have " << selectedDevice->describe() << " go online or offline?" << std::endl;
std::cout << "[1] Online" << std::endl << "[2] Offline" << std::endl << "[3] Cancel" << std::endl << std::endl;
char selection = getCharInput(std::vector<char> {'1', '2', '3'});
std::cout << std::endl;
switch(selection) {
case '1':
// Attempt to have the selected device go online
if(selectedDevice->goOnline()) {
std::cout << selectedDevice->describe() << " successfully went online!" << std::endl << std::endl;
} else {
std::cout << selectedDevice->describe() << " failed to go online!" << std::endl << std::endl;
std::cout << icsneo::GetLastError() << std::endl;;
std::cout << std::endl;
}
break;
case '2':
// Attempt to go offline
if(selectedDevice->goOffline()) {
std::cout << selectedDevice->describe() << " successfully went offline!" << std::endl << std::endl;
} else {
std::cout << selectedDevice->describe() << " failed to go offline!" << std::endl << std::endl;
std::cout << icsneo::GetLastError() << std::endl;;
std::cout << std::endl;
}
break;
default:
std::cout << "Canceling!" << std::endl << std::endl;
break;
}
}
break;
// Enable/disable message polling
case 'E':
case 'e':
{
// Select a device and get its description
if(devices.size() == 0) {
std::cout << "No devices found! Please scan for new devices." << std::endl << std::endl;
break;
}
selectedDevice = selectDevice(devices);
std::cout << "Would you like to enable or disable message polling for " << selectedDevice->describe() << "?" << std::endl;
std::cout << "[1] Enable" << std::endl << "[2] Disable" << std::endl << "[3] Cancel" << std::endl << std::endl;
char selection = getCharInput(std::vector<char> {'1', '2', '3'});
std::cout << std::endl;
switch(selection) {
case '1':
// Attempt to enable message polling
if(selectedDevice->enableMessagePolling()) {
std::cout << "Successfully enabled message polling for " << selectedDevice->describe() << "!" << std::endl << std::endl;
} else {
std::cout << "Failed to enable message polling for " << selectedDevice->describe() << "!" << std::endl << std::endl;
std::cout << icsneo::GetLastError() << std::endl;;
std::cout << std::endl;
}
// Manually setting the polling message limit as done below is optional
// It will default to 20k if not set
selectedDevice->setPollingMessageLimit(50000);
if(selectedDevice->getPollingMessageLimit() == 50000) {
std::cout << "Successfully set polling message limit for " << selectedDevice->describe() << "!" << std::endl << std::endl;
} else {
std::cout << "Failed to set polling message limit for " << selectedDevice->describe() << "!" << std::endl << std::endl;
std::cout << icsneo::GetLastError() << std::endl;;
std::cout << std::endl;
}
break;
case '2':
// Attempt to disable message polling
if(selectedDevice->disableMessagePolling()) {
std::cout << "Successfully disabled message polling for " << selectedDevice->describe() << "!" << std::endl;
} else {
std::cout << "Failed to disable message polling for " << selectedDevice->describe() << "!" << std::endl << std::endl;
std::cout << icsneo::GetLastError() << std::endl;;
std::cout << std::endl;
}
break;
default:
std::cout << "Canceling!" << std::endl << std::endl;
break;
}
}
break;
// Get messages
case 'F':
case 'f':
{
// Select a device and get its description
if(devices.size() == 0) {
std::cout << "No devices found! Please scan for new devices." << std::endl << std::endl;
break;
}
selectedDevice = selectDevice(devices);
std::vector<std::shared_ptr<icsneo::Message>> msgs;
// Attempt to get messages, limiting the number of messages at once to 50,000
// A third parameter of type std::chrono::milliseconds is also accepted if a timeout is desired
if(!selectedDevice->getMessages(msgs, msgLimit)) {
std::cout << "Failed to get messages for " << selectedDevice->describe() << "!" << std::endl << std::endl;
std::cout << icsneo::GetLastError() << std::endl;;
std::cout << std::endl;
break;
}
if(msgs.size() == 1) {
std::cout << "1 message received from " << selectedDevice->describe() << "!" << std::endl;
} else {
std::cout << msgs.size() << " messages received from " << selectedDevice->describe() << "!" << std::endl;
}
// Print out the received messages
for(auto msg : msgs) {
switch(msg->network.getType()) {
case icsneo::Network::Type::CAN:
{
// 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);
std::cout << "\t0x" << std::setfill('0') << std::setw(3) << std::hex << (int) canMsg->arbid << " [" << canMsg->data.size() << "] " << std::dec;
for(auto data : canMsg->data) {
std::cout << std::setfill('0') << std::setw(2) << std::hex << (int) data << " " << std::dec;
}
std::cout << canMsg->timestamp << std::endl;
break;
}
default:
if(msg->network.getNetID() != icsneo::Network::NetID::Device) {
std::cout << "\tMessage on netid " << msg->network.GetNetIDString(msg->network.getNetID()) << " with length " << msg->data.size() << std::endl;
}
break;
}
}
std::cout << std::endl;
}
break;
// Send messages
case 'G':
case 'g':
{
// Select a device and get its description
if(devices.size() == 0) {
std::cout << "No devices found! Please scan for new devices." << std::endl << std::endl;
break;
}
selectedDevice = selectDevice(devices);
std::cout << "Transmitting a normal CAN frame..." << std::endl;
auto msg = std::make_shared<icsneo::CANMessage>();
msg->network = icsneo::Network::NetID::HSCAN;
msg->arbid = 0x120;
msg->data.insert(msg->data.end(), {0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff});
msg->isExtended = false;
msg->isCANFD = false;
// Attempt to transmit the sample msg
if(selectedDevice->transmit(msg)) {
std::cout << "Message transmit successful!" << std::endl;
} else {
std::cout << "Failed to transmit message to " << selectedDevice->describe() << "!" << std::endl << std::endl;
std::cout << icsneo::GetLastError() << std::endl;;
}
/** 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->arbid = 0x1C5001C5;
txMessage->data.insert(txMessage->data.end(), {0xaa, 0xbb, 0xcc});
// The DLC will come from the length of the data vector
txMessage->isExtended = true;
txMessage->isCANFD = true;
// Attempt to transmit the sample msg
if(selectedDevice->transmit(txMessage)) {
std::cout << "Extended CAN FD frame transmit successful!" << std::endl;
} else {
std::cout << "Failed to transmit extended CAN FD frame to " << selectedDevice->describe() << "!" << std::endl << std::endl;
std::cout << icsneo::GetLastError() << std::endl;;
}
*/
std::cout << std::endl;
}
break;
// Get events
case 'H':
case 'h':
{
// Prints all events
printAPIEvents();
std::cout << std::endl;
}
break;
// Set HS CAN to 250k
case 'I':
case 'i':
{
// Select a device and get its description
if(devices.size() == 0) {
std::cout << "No devices found! Please scan for new devices." << std::endl << std::endl;
break;
}
selectedDevice = selectDevice(devices);
// Attempt to set baudrate and apply settings
if(selectedDevice->settings->setBaudrateFor(icsneo::Network::NetID::HSCAN, 250000) && selectedDevice->settings->apply()) {
std::cout << "Successfully set HS CAN baudrate for " << selectedDevice->describe() << " to 250k!" << std::endl;
} else {
std::cout << "Failed to set HS CAN baudrate for " << selectedDevice->describe() << " to 250k!" << std::endl << std::endl;
std::cout << icsneo::GetLastError() << std::endl;;
}
std::cout << std::endl;
}
break;
// Set LSFT CAN to 250k
case 'J':
case 'j':
{
// Select a device and get its description
if(devices.size() == 0) {
std::cout << "No devices found! Please scan for new devices." << std::endl << std::endl;
break;
}
selectedDevice = selectDevice(devices);
// Attempt to set baudrate and apply settings
if(selectedDevice->settings->setBaudrateFor(icsneo::Network::NetID::LSFTCAN, 250000) && selectedDevice->settings->apply()) {
std::cout << "Successfully set LSFT CAN baudrate for " << selectedDevice->describe() << " to 250k!" << std::endl;
} else {
std::cout << "Failed to set LSFT CAN baudrate for " << selectedDevice->describe() << " to 250k!" << std::endl << std::endl;
std::cout << icsneo::GetLastError() << std::endl;;
}
std::cout << std::endl;
}
break;
// Add/Remove a message callback
case 'K':
case 'k':
{
// Select a device and get its description
if(devices.size() == 0) {
std::cout << "No devices found! Please scan for new devices." << std::endl << std::endl;
break;
}
selectedDevice = selectDevice(devices);
std::cout << "Would you like to add or remove a message callback for " << selectedDevice->describe() << "?" << std::endl;
std::cout << "[1] Add" << std::endl << "[2] Remove" << std::endl << "[3] Cancel" << std::endl << std::endl;
char selection = getCharInput(std::vector<char> {'1', '2', '3'});
std::cout << std::endl;
switch(selection) {
case '1':
{
// Shameless copy-paste from get messages above, demonstrating a callback
int callbackID = selectedDevice->addMessageCallback(icsneo::MessageCallback([](std::shared_ptr<icsneo::Message> msg){
switch(msg->network.getType()) {
case icsneo::Network::Type::CAN:
{
// 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);
std::cout << "\t0x" << std::setfill('0') << std::setw(3) << std::hex << (int) canMsg->arbid << " [" << canMsg->data.size() << "] " << std::dec;
for(auto data : canMsg->data) {
std::cout << std::setfill('0') << std::setw(2) << std::hex << (int) data << " " << std::dec;
}
std::cout << canMsg->timestamp << std::endl;
break;
}
default:
if(msg->network.getNetID() != icsneo::Network::NetID::Device) {
std::cout << "\tMessage on netid " << msg->network.GetNetIDString(msg->network.getNetID()) << " with length " << msg->data.size() << std::endl;
}
break;
}
}));
if(callbackID != -1) {
std::cout << "Successfully added message callback to " << selectedDevice->describe() << "!" << std::endl;
callbacks.find(selectedDevice)->second.push_back(callbackID);
} else {
std::cout << "Failed to add message callback to " << selectedDevice->describe() << "!" << std::endl << std::endl;
std::cout << icsneo::GetLastError() << std::endl;;
}
}
break;
case '2':
{
if(callbacks.find(selectedDevice)->second.size() == 0) {
std::cout << "No callbacks found for " << selectedDevice->describe() << "!" << std::endl;
break;
} else {
std::vector<char> allowed;
std::cout << "Which id would you like to remove?" << std::endl;
for(int id : callbacks.find(selectedDevice)->second) {
allowed.push_back(static_cast<char>(id) + '0');
std::cout << "[" << id << "]" << std::endl;
}
std::cout << std::endl;
int removeID = getCharInput(allowed) - '0';
std::cout << std::endl;
if(selectedDevice->removeMessageCallback(removeID)) {
std::cout << "Successfully removed callback id " << removeID << " from " << selectedDevice->describe() << "!" << std::endl;
} else {
std::cout << "Failed to remove message callback id " << removeID << " from " << selectedDevice->describe() << "!" << std::endl << std::endl;
std::cout << icsneo::GetLastError() << std::endl;;
}
}
}
break;
default:
std::cout << "Canceling!" << std::endl << std::endl;
break;
}
}
break;
// Exit
case 'X':
case 'x':
printf("Exiting program\n");
return 0;
default:
printf("Unexpected input, exiting!\n");
return 1;
}
}
return 0;
}
+27
View File
@@ -0,0 +1,27 @@
cmake_minimum_required(VERSION 3.2)
project(libicsneocpp-simple-example VERSION 0.2.0)
set(CMAKE_CXX_STANDARD 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)
target_link_libraries(libicsneocpp-simple-example icsneocpp)
+48
View File
@@ -0,0 +1,48 @@
# libicsneo C++ Example
This is an example console application which uses libicsneo to connect to an Intrepid Control Systems hardware device. It has both interactive and simple examples for sending and receiving CAN & CAN FD traffic.
## Building
This example shows how to use the C++ version of libicsneo with CMake. It will build libicsneo along with your project.
First, you need to clone the repository onto your local machine. Run:
```shell
git clone https://github.com/intrepidcs/libicsneo-examples --recursive
```
Alternatively, if you cloned without the `--recursive flag`, you must enter the `libicsneo-examples` folder and run the following:
```shell
git submodule update --recursive --init
```
If you haven't done this, `third-party/libicsneo` will be empty and you won't be able to build!
### Windows using Visual Studio 2017+
1. Launch Visual Studio and open the `libicsneo-examples` folder.
2. Choose `File->Open->CMake...`
3. Navigate to the `libicsneocpp-example` folder and select the `CMakeLists.txt` there.
4. Visual Studio will process the CMake project.
5. Choose the dropdown attached to the green play button (labelled "select startup item...") in the toolbar.
6. Select `libicsneocpp-simple-example.exe`
7. Press the green play button to compile and run the example.
### Ubuntu 18.04 LTS
1. Install dependencies with `sudo apt update` then `sudo apt install build-essential cmake libusb-1.0-0-dev libpcap0.8-dev`
2. Change directories to your `libicsneo-examples/libicsneocpp-example` folder and create a build directory by running `mkdir -p build`
3. Enter the build directory with `cd build`
4. Run `cmake ..` to generate your Makefile.
* Hint! Running `cmake -DCMAKE_BUILD_TYPE=Debug ..` will generate the proper scripts to build debug, and `cmake -DCMAKE_BUILD_TYPE=Release ..` will generate the proper scripts to build with all optimizations on.
5. Run `make libicsneocpp-interactive-example` to build.
* Hint! Speed up your build by using multiple processors! Use `make libicsneocpp-interactive-example -j#` where `#` is the number of cores/threads your system has plus one. For instance, on a standard 8 thread Intel i7, you might use `-j9` for an ~8x speedup.
6. Now run `sudo ./libicsneocpp-interactive-example` to run the example.
* Hint! In order to run without sudo, you will need to set up the udev rules. Copy `libicsneo-examples/third-party/libicsneo/99-intrepidcs.rules` to `/etc/udev/rules.d`, then run `udevadm control --reload-rules && udevadm trigger` afterwards. While the program will still run without setting up these rules, it will fail to open any devices.
7. If you wish to run the simple example instead, replace any instances of "interactive" with "simple" in steps 5 and 6.
### macOS
Instructions coming soon&trade;
+248
View File
@@ -0,0 +1,248 @@
#include <iostream>
#include <iomanip>
#include <thread>
#include <chrono>
#include "icsneo/icsneocpp.h"
int main() {
// Print version
std::cout << "Running libicsneo " << icsneo::GetVersion() << std::endl;
std::cout<< "Supported devices:" << std::endl;
for(auto& dev : icsneo::GetSupportedDevices())
std::cout << '\t' << dev << std::endl;
std::cout << "\nFinding devices... " << std::flush;
auto devices = icsneo::FindAllDevices(); // This is type std::vector<std::shared_ptr<icsneo::Device>>
// You now hold the shared_ptrs for these devices, you are considered to "own" these devices from a memory perspective
std::cout << "OK, " << devices.size() << " device" << (devices.size() == 1 ? "" : "s") << " found" << std::endl;
// List off the devices
for(auto& device : devices)
std::cout << '\t' << device->getType() << " - " << device->getSerial() << " @ Handle " << device->getNeoDevice().handle << std::endl;
std::cout << std::endl;
for(auto& device : devices) {
std::cout << "Connecting to " << device->getType() << ' ' << device->getSerial() << "... ";
bool ret = device->open();
if(!ret) { // Failed to open
std::cout << "FAIL" << std::endl;
std::cout << icsneo::GetLastError() << std::endl << std::endl;
continue;
}
std::cout << "OK" << std::endl;
std::cout << "\tGetting HSCAN Baudrate... ";
int64_t baud = device->settings->getBaudrateFor(icsneo::Network::NetID::HSCAN);
if(baud < 0)
std::cout << "FAIL" << std::endl;
else
std::cout << "OK, " << (baud/1000) << "kbit/s" << std::endl;
std::cout << "\tSetting HSCAN to operate at 125kbit/s... ";
ret = device->settings->setBaudrateFor(icsneo::Network::NetID::HSCAN, 125000);
std::cout << (ret ? "OK" : "FAIL") << std::endl;
// Changes to the settings do not take affect until you call settings->apply()!
// When you get the baudrate here, you're reading what the device is currently operating on
std::cout << "\tGetting HSCAN Baudrate... (expected to be unchanged) ";
baud = device->settings->getBaudrateFor(icsneo::Network::NetID::HSCAN);
if(baud < 0)
std::cout << "FAIL" << std::endl;
else
std::cout << "OK, " << (baud/1000) << "kbit/s" << std::endl;
std::cout << "\tGetting HSCANFD Baudrate... ";
baud = device->settings->getFDBaudrateFor(icsneo::Network::NetID::HSCAN);
if(baud < 0)
std::cout << "FAIL" << std::endl;
else
std::cout << "OK, " << (baud/1000) << "kbit/s" << std::endl;
std::cout << "\tSetting HSCANFD to operate at 8Mbit/s... ";
ret = device->settings->setFDBaudrateFor(icsneo::Network::NetID::HSCAN, 8000000);
std::cout << (ret ? "OK" : "FAIL") << std::endl;
std::cout << "\tGetting HSCANFD Baudrate... (expected to be unchanged) ";
baud = device->settings->getFDBaudrateFor(icsneo::Network::NetID::HSCAN);
if(baud < 0)
std::cout << "FAIL" << std::endl;
else
std::cout << "OK, " << (baud/1000) << "kbit/s" << std::endl;
// Setting settings temporarily does not need to be done before committing to device EEPROM
// It's done here to test both functionalities
// Setting temporarily will keep these settings until another send/commit is called or a power cycle occurs
std::cout << "\tSetting settings temporarily... ";
ret = device->settings->apply(true);
std::cout << (ret ? "OK" : "FAIL") << std::endl;
// Now that we have applied, we expect that our operating baudrates have changed
std::cout << "\tGetting HSCAN Baudrate... ";
baud = device->settings->getBaudrateFor(icsneo::Network::NetID::HSCAN);
if(baud < 0)
std::cout << "FAIL" << std::endl;
else
std::cout << "OK, " << (baud/1000) << "kbit/s" << std::endl;
std::cout << "\tGetting HSCANFD Baudrate... ";
baud = device->settings->getFDBaudrateFor(icsneo::Network::NetID::HSCAN);
if(baud < 0)
std::cout << "FAIL" << std::endl;
else
std::cout << "OK, " << (baud/1000) << "kbit/s" << std::endl;
std::cout << "\tSetting settings permanently... ";
ret = device->settings->apply();
std::cout << (ret ? "OK\n\n" : "FAIL\n\n");
// 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... ";
ret = device->goOnline();
if(!ret) {
std::cout << "FAIL" << std::endl;
device->close();
continue;
}
std::cout << "OK" << std::endl;
// A real application would just check the result of icsneo_goOnline() rather than calling this
// This function is intended to be called later on if needed
std::cout << "\tChecking online status... ";
ret = device->isOnline();
if(!ret) {
std::cout << "FAIL\n" << std::endl;
device->close();
continue;
}
std::cout << "OK" << std::endl;
// Now we can either register a handler (or multiple) for messages coming in
// or we can enable message polling, and then call device->getMessages periodically
// We're actually going to do both here, so first enable message polling
device->enableMessagePolling();
device->setPollingMessageLimit(100000); // Feel free to set a limit if you like, the default is a conservative 20k
// Keep in mind that 20k messages comes quickly at high bus loads!
// We can also register a handler
std::cout << "\tStreaming messages in for 3 seconds... " << std::endl;
// MessageCallbacks are powerful, and can filter on things like ArbID for you. See the documentation
auto handler = device->addMessageCallback(icsneo::MessageCallback([](std::shared_ptr<icsneo::Message> message) {
switch(message->network.getType()) {
case icsneo::Network::Type::CAN: {
// A message of type CAN is guaranteed to be a CANMessage, so we can static cast safely
auto canMessage = std::static_pointer_cast<icsneo::CANMessage>(message);
std::cout << "\t\tCAN ";
if(canMessage->isCANFD) {
std::cout << "FD ";
if(!canMessage->baudrateSwitch)
std::cout << "(No BRS) ";
}
// Print the Arbitration ID
std::cout << "0x" << std::hex << std::setw(canMessage->isExtended ? 8 : 3) << std::setfill('0') << canMessage->arbid;
// Print the DLC
std::cout << std::dec << " [" << canMessage->data.size() << "] ";
// Print the data
for(auto& databyte : canMessage->data)
std::cout << std::hex << std::setw(2) << (uint32_t)databyte << ' ';
// Print the timestamp
std::cout << std::dec << '(' << canMessage->timestamp << " ns since 1/1/2007)\n";
break;
}
case icsneo::Network::Type::Ethernet: {
auto ethMessage = std::static_pointer_cast<icsneo::EthernetMessage>(message);
std::cout << "\t\t" << ethMessage->network << " Frame - " << std::dec << ethMessage->data.size() << " bytes on wire\n";
std::cout << "\t\t Timestamped:\t"<< ethMessage->timestamp << " ns since 1/1/2007\n";
// The MACAddress may be printed directly or accessed with the `data` member
std::cout << "\t\t Source:\t" << ethMessage->getSourceMAC() << "\n";
std::cout << "\t\t Destination:\t" << ethMessage->getDestinationMAC();
// Print the data
for(size_t i = 0; i < ethMessage->data.size(); i++) {
if(i % 8 == 0)
std::cout << "\n\t\t " << std::hex << std::setw(4) << std::setfill('0') << i << '\t';
std::cout << std::hex << std::setw(2) << (uint32_t)ethMessage->data[i] << ' ';
}
std::cout << std::dec << std::endl;
break;
}
default:
// Ignoring non-network messages
break;
}
}));
std::this_thread::sleep_for(std::chrono::seconds(3));
device->removeMessageCallback(handler); // Removing the callback means it will not be called anymore
// Since we're using message polling, we can also get the messages which have come in for the past 3 seconds that way
// We could simply call getMessages and it would return a vector of message pointers to us
//auto messages = device->getMessages();
// For speed when calling repeatedly, we can also preallocate and continually reuse a vector
std::vector<std::shared_ptr<icsneo::Message>> messages;
messages.reserve(100000);
device->getMessages(messages);
std::cout << "\t\tGot " << messages.size() << " messages while polling" << std::endl;
// If we wanted to make sure it didn't grow and reallocate, we could also pass in a limit
// If there are more messages than the limit, we can call getMessages repeatedly
//device->getMessages(messages, 100);
// You are now the owner (or one of the owners, if multiple handlers are registered) of the shared_ptrs to the messages
// This means that when you let them go out of scope or reuse the vector, the messages will be freed automatically
// We can transmit messages
std::cout << "\tTransmitting an extended CAN FD frame... ";
auto txMessage = std::make_shared<icsneo::CANMessage>();
txMessage->network = icsneo::Network::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
txMessage->isExtended = true;
txMessage->isCANFD = true;
ret = device->transmit(txMessage); // This will return false if the device does not support CAN FD, or does not have HSCAN
std::cout << (ret ? "OK" : "FAIL") << std::endl;
std::cout << "\tTransmitting an ethernet frame on OP (BR) Ethernet 2... ";
auto ethTxMessage = std::make_shared<icsneo::EthernetMessage>();
ethTxMessage->network = icsneo::Network::NetID::OP_Ethernet2;
ethTxMessage->data.insert(ethTxMessage->data.end(), {
0x00, 0xFC, 0x70, 0x00, 0x01, 0x02, /* Destination MAC */
0x00, 0xFC, 0x70, 0x00, 0x01, 0x01, /* Source MAC */
0x00, 0x00, /* Ether Type */
0x01, 0xC5, 0x01, 0xC5 /* Payload (will automatically be padded on transmit unless you set `ethTxMessage->noPadding`) */
});
ret = device->transmit(ethTxMessage); // This will return false if the device does not support OP (BR) Ethernet 2
std::cout << (ret ? "OK" : "FAIL") << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(50));
// Go offline, stop sending and receiving traffic
std::cout << "\tGoing offline... ";
ret = device->goOffline();
std::cout << (ret ? "OK" : "FAIL") << std::endl;
// Apply default settings
std::cout << "\tSetting default settings... ";
ret = device->settings->applyDefaults(); // This will also write to the device
std::cout << (ret ? "OK" : "FAIL") << std::endl;
std::cout << "\tDisconnecting... ";
ret = device->close();
std::cout << (ret ? "OK\n" : "FAIL\n") << std::endl;
}
std::cout << "Press any key to continue..." << std::endl;
std::cin.get();
return 0;
}
+26
View File
@@ -0,0 +1,26 @@
cmake_minimum_required(VERSION 3.2)
project(icsneocsharp VERSION 0.2.0)
set(CMAKE_CXX_STANDARD 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_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../third-party/libicsneo ${CMAKE_CURRENT_BINARY_DIR}/third-party/libicsneo)
add_library(icsneocsharp SHARED ${CMAKE_CURRENT_SOURCE_DIR}/csharp_wrap.c)
target_link_libraries(icsneocsharp icsneoc)
+520
View File
@@ -0,0 +1,520 @@
using System.Collections.Generic;
namespace libicsneocsharp_example {
class InteractiveExample {
private uint msgLimit = 50000;
private neodevice_t selectedDevice;
private List<neodevice_t> devices = new List<neodevice_t>();
private uint numDevices = 0;
private void PrintAllDevices() {
if(numDevices == 0) {
System.Console.WriteLine("No devices found! Please scan for new devices.");
}
for(int i = 0; i < numDevices; i++) {
System.Text.StringBuilder description = new System.Text.StringBuilder(icsneocsharp.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION);
int maxLength = icsneocsharp.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION;
if(icsneocsharp.icsneo_describeDevice(devices[i], description, ref maxLength)) {
System.Console.Write("[" + (i + 1) + "] " + description.ToString() + "\tConnected: ");
if(icsneocsharp.icsneo_isOpen(devices[i])) {
System.Console.Write("Yes\t");
} else System.Console.Write("No\t");
System.Console.Write("Online: ");
if(icsneocsharp.icsneo_isOnline(devices[i])) {
System.Console.Write("Yes\t");
} else System.Console.Write("No\t");
System.Console.Write("Msg Polling: ");
if(icsneocsharp.icsneo_isMessagePollingEnabled(devices[i])) {
System.Console.Write("On\n");
} else System.Console.Write("Off\n");
} else {
System.Console.WriteLine("Description for device " + (i + 1) + " not available!");
}
}
}
private uint ScanNewDevices() {
neodevice_t newDevices = icsneocsharp.new_neodevice_t_array(99);
int count = 10;
icsneocsharp.icsneo_findAllDevices(newDevices, ref count);
numDevices += (uint) count;
for(int i = 0; i < numDevices; i++) {
devices.Add(icsneocsharp.neodevice_t_array_getitem(newDevices, i));
}
icsneocsharp.delete_neodevice_t_array(newDevices);
return (uint) count;
}
private void PrintMainMenu() {
System.Console.WriteLine("Press the letter next to the function you want to use:");
System.Console.WriteLine("A - List all devices");
System.Console.WriteLine("B - Scan for new devices");
System.Console.WriteLine("C - Open/close");
System.Console.WriteLine("D - Go online/offline");
System.Console.WriteLine("E - Enable/disable message polling");
System.Console.WriteLine("F - Get messages");
System.Console.WriteLine("G - Send message");
System.Console.WriteLine("H - Get events");
System.Console.WriteLine("I - Set HS CAN to 250K");
System.Console.WriteLine("J - Set HS CAN to 500K");
System.Console.WriteLine("X - Exit");
}
void PrintLastError() {
neoevent_t error = new neoevent_t();
if(icsneocsharp.icsneo_getLastError(error))
System.Console.WriteLine("Error 0x" + error.eventNumber + ": " + error.description);
else
System.Console.WriteLine("No errors found!");
}
void PrintAPIEvents() {
neoevent_t events = icsneocsharp.new_neoevent_t_array(99);
int eventCount = 99;
if(icsneocsharp.icsneo_getEvents(events, ref eventCount)) {
if(eventCount == 1) {
neoevent_t evt = icsneocsharp.neoevent_t_array_getitem(events, 0);
System.Console.WriteLine("1 API event found!");
System.Console.WriteLine("Event 0x" + evt.eventNumber + ": " + evt.description);
} else {
System.Console.WriteLine(eventCount + " API events found!");
for(var i = 0; i < eventCount; ++i) {
neoevent_t evt = icsneocsharp.neoevent_t_array_getitem(events, i);
System.Console.WriteLine("Event 0x" + evt.eventNumber + ": " + evt.description);
}
}
} else {
System.Console.WriteLine("Failed to get API events!");
}
icsneocsharp.delete_neoevent_t_array(events);
}
void PrintDeviceEvents(neodevice_t device) {
neoevent_t events = icsneocsharp.new_neoevent_t_array(99);
int eventCount = 99;
if(icsneocsharp.icsneo_getDeviceEvents(device, events, ref eventCount)) {
if(eventCount == 1) {
neoevent_t evt = icsneocsharp.neoevent_t_array_getitem(events, 0);
System.Console.WriteLine("1 device event found!");
System.Console.WriteLine("Event 0x" + evt.eventNumber + ": " + evt.description);
} else {
System.Console.WriteLine(eventCount + " device events found!");
for(var i = 0; i < eventCount; ++i) {
neoevent_t evt = icsneocsharp.neoevent_t_array_getitem(events, i);
System.Console.WriteLine("Event 0x" + evt.eventNumber + ": " + evt.description);
}
}
} else {
System.Console.WriteLine("Failed to get API events!");
}
icsneocsharp.delete_neoevent_t_array(events);
}
private char GetCharInput(List<char> allowed) {
bool found = false;
char key = '0';
while(!found) {
key = System.Console.ReadKey().KeyChar;
System.Console.WriteLine();
foreach(char compare in allowed) {
if(compare == key) {
found = true;
break;
}
}
if(!found) {
System.Console.WriteLine("Input did not match expected options. Please try again.");
}
}
return key;
}
neodevice_t SelectDevice() {
System.Console.WriteLine("Please select a device:");
PrintAllDevices();
System.Console.WriteLine();
int selectedDeviceNum = 10;
while(selectedDeviceNum > numDevices) {
char deviceSelection = GetCharInput(new List<char> { '1', '2', '3', '4', '5', '6', '7', '8', '9' });
selectedDeviceNum = (int)char.GetNumericValue(deviceSelection);
if(selectedDeviceNum > numDevices) {
System.Console.WriteLine("Selected device out of range!");
}
}
System.Console.WriteLine();
return devices[selectedDeviceNum - 1];
}
public void Run() {
neoversion_t version = icsneocsharp.icsneo_getVersion();
System.Console.WriteLine("ICS icsneocsharp.dll version " + version.major + "." + version.minor + "." + version.patch);
System.Console.WriteLine();
while(true) {
PrintMainMenu();
System.Console.WriteLine();
char input = GetCharInput(new List<char> { 'A', 'a', 'B', 'b', 'C', 'c', 'D', 'd', 'E', 'e', 'F', 'f', 'G', 'g', 'H', 'h', 'I', 'i', 'J', 'j', 'X', 'x' });
System.Console.WriteLine();
switch(input) {
// List current devices
case 'A':
goto case 'a';
case 'a':
PrintAllDevices();
System.Console.WriteLine();
break;
// Scan for new devices
case 'B':
goto case 'b';
case 'b': {
var numNewDevices = ScanNewDevices();
if(numNewDevices == 1) {
System.Console.WriteLine("1 new device found!");
} else {
System.Console.WriteLine(numNewDevices + " new devices found!");
}
PrintAllDevices();
System.Console.WriteLine();
break;
}
// Open/close a device
case 'C':
goto case 'c';
case 'c': {
// Select a device and get its description
if(numDevices == 0) {
System.Console.WriteLine("No devices found! Please scan for new devices.\n");
break;
}
selectedDevice = SelectDevice();
// Get the product description for the device
System.Text.StringBuilder description = new System.Text.StringBuilder(icsneocsharp.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION);
int maxLength = icsneocsharp.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION;
icsneocsharp.icsneo_describeDevice(selectedDevice, description, ref maxLength);
System.Console.WriteLine("Would you like to open or close " + description + "?");
System.Console.WriteLine("[1] Open\n[2] Close\n[3] Cancel\n");
char option = GetCharInput(new List<char> { '1', '2', '3' });
System.Console.WriteLine();
switch(option) {
case '1':
// Attempt to open the selected device
if(icsneocsharp.icsneo_openDevice(selectedDevice)) {
System.Console.WriteLine(description + " successfully opened!\n");
} else {
System.Console.WriteLine(description + " failed to open!\n");
PrintLastError();
System.Console.WriteLine();
}
break;
case '2':
// Attempt to close the device
if(icsneocsharp.icsneo_closeDevice(selectedDevice)) {
numDevices--;
System.Console.WriteLine("Successfully closed " + description + "!\n");
devices.Remove(selectedDevice);
selectedDevice = null;
} else {
System.Console.WriteLine("Failed to close " + description.ToString() + "!\n");
PrintLastError();
System.Console.WriteLine();
}
break;
default:
System.Console.WriteLine("Canceling!\n");
break;
}
break;
}
// Go online/offline
case 'D':
goto case 'd';
case 'd': {
// Select a device and get its description
if(numDevices == 0) {
System.Console.WriteLine("No devices found! Please scan for new devices.\n");
break;
}
selectedDevice = SelectDevice();
// Get the product description for the device
System.Text.StringBuilder description = new System.Text.StringBuilder(icsneocsharp.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION);
int maxLength = icsneocsharp.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION;
icsneocsharp.icsneo_describeDevice(selectedDevice, description, ref maxLength);
System.Console.WriteLine("Would you like to have " + description.ToString() + " go online or offline?");
System.Console.WriteLine("[1] Online\n[2] Offline\n[3] Cancel\n");
char option = GetCharInput(new List<char> { '1', '2', '3' });
System.Console.WriteLine();
switch(option) {
case '1':
// Attempt to go online
if(icsneocsharp.icsneo_goOnline(selectedDevice)) {
System.Console.WriteLine(description + " successfully went online!\n");
} else {
System.Console.WriteLine(description + " failed to go online!\n");
PrintLastError();
System.Console.WriteLine();
}
break;
case '2':
// Attempt to go offline
if(icsneocsharp.icsneo_goOffline(selectedDevice)) {
System.Console.WriteLine(description + " successfully went offline!\n");
} else {
System.Console.WriteLine(description + " failed to go offline!\n");
PrintLastError();
System.Console.WriteLine();
}
break;
default:
System.Console.WriteLine("Canceling!\n");
break;
}
break;
}
// Enable/disable message polling
case 'E':
goto case 'e';
case 'e': {
// Select a device and get its description
if(numDevices == 0) {
System.Console.WriteLine("No devices found! Please scan for new devices.\n");
break;
}
selectedDevice = SelectDevice();
// Get the product description for the device
System.Text.StringBuilder description = new System.Text.StringBuilder(icsneocsharp.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION);
int maxLength = icsneocsharp.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION;
icsneocsharp.icsneo_describeDevice(selectedDevice, description, ref maxLength);
System.Console.WriteLine("Would you like to enable or disable message polling for " + description.ToString() + "?");
System.Console.WriteLine("[1] Enable\n[2] Disable\n[3] Cancel\n");
char option = GetCharInput(new List<char> { '1', '2', '3' });
System.Console.WriteLine();
switch(option) {
case '1':
// Attempt to enable message polling
if(icsneocsharp.icsneo_enableMessagePolling(selectedDevice)) {
System.Console.WriteLine("Successfully enabled message polling for " + description.ToString() + "!\n");
} else {
System.Console.WriteLine("Failed to enable message polling for " + description.ToString() + "!\n");
PrintLastError();
System.Console.WriteLine();
}
// Manually setting the polling message limit as done below is optional
// It will default to 20k if not set
// Attempt to set the polling message limit
if(icsneocsharp.icsneo_setPollingMessageLimit(selectedDevice, msgLimit)) {
System.Console.WriteLine("Successfully set message polling limit for " + description.ToString() + "!\n");
} else {
System.Console.WriteLine("Failed to set polling message limit for " + description.ToString() + "!\n");
PrintLastError();
System.Console.WriteLine();
}
break;
case '2':
// Attempt to disable message polling
if(icsneocsharp.icsneo_disableMessagePolling(selectedDevice)) {
System.Console.WriteLine("Successfully disabled message polling for " + description.ToString() + "!\n");
} else {
System.Console.WriteLine("Failed to disable message polling for " + description.ToString() + "!\n");
PrintLastError();
System.Console.WriteLine();
}
break;
default:
System.Console.WriteLine("Canceling!\n");
break;
}
}
break;
case 'F':
goto case 'f';
case 'f': {
// Select a device and get its description
if(numDevices == 0) {
System.Console.WriteLine("No devices found! Please scan for new devices.\n");
break;
}
selectedDevice = SelectDevice();
// Get the product description for the device
System.Text.StringBuilder description = new System.Text.StringBuilder(icsneocsharp.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION);
int maxLength = icsneocsharp.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION;
icsneocsharp.icsneo_describeDevice(selectedDevice, description, ref maxLength);
// Prepare the neomessage_t array and size for reading in the messages
neomessage_t msgs = icsneocsharp.new_neomessage_t_array((int)msgLimit);
int msgCount = (int)msgLimit;
if(!icsneocsharp.icsneo_getMessages(selectedDevice, msgs, ref msgCount, 0)) {
System.Console.WriteLine("Failed to get messages for " + description.ToString() + "!\n");
PrintLastError();
icsneocsharp.delete_neomessage_t_array(msgs);
System.Console.WriteLine();
break;
}
if(msgCount == 1) {
System.Console.WriteLine("1 message received from " + description.ToString() + "!");
} else {
System.Console.WriteLine(msgCount + " messages received from " + description.ToString() + "!");
}
// Print out the received messages
for(int i = 0; i < msgCount; i++) {
neomessage_t msg = icsneocsharp.neomessage_t_array_getitem(msgs, i);
if(msg.type == icsneocsharp.ICSNEO_NETWORK_TYPE_CAN) {
System.Console.Write("\t0x" + "{0:x}" + " [" + msg.length + "] ", icsneocsharp.neomessage_can_t_cast(msg).arbid);
for(int j = 0; j < msg.length; j++) {
System.Console.Write("{0:x} ", icsneocsharp.neomessage_can_t_cast(msg).data[j]);
}
System.Console.WriteLine("(" + msg.timestamp + ")");
} else {
if(msg.netid != 0)
System.Console.WriteLine("\tMessage on netid " + msg.netid + " with length " + msg.length);
}
}
icsneocsharp.delete_neomessage_t_array(msgs);
break;
}
// Send message
case 'G':
goto case 'g';
case 'g': {
// Select a device and get its description
if(numDevices == 0) {
System.Console.WriteLine("No devices found! Please scan for new devices.\n");
break;
}
selectedDevice = SelectDevice();
// Get the product description for the device
System.Text.StringBuilder description = new System.Text.StringBuilder(icsneocsharp.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION);
int maxLength = icsneocsharp.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION;
icsneocsharp.icsneo_describeDevice(selectedDevice, description, ref maxLength);
// Start generating sample msg
neomessage_can_t msg = new neomessage_can_t();
msg.arbid = 0x120;
msg.length = 6;
msg.netid = (ushort)icsneocsharp.ICSNEO_NETID_HSCAN;
msg.data = new byte[6] { 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff };
msg.status.canfdFDF = 0;
msg.status.extendedFrame = 0;
msg.status.canfdBRS = 0;
// End generating sample msg
// Attempt to transmit the sample msg
if(icsneocsharp.icsneo_transmit(selectedDevice, icsneocsharp.from_can_neomessage_t_cast(msg))) {
System.Console.WriteLine("Message transmit successful!");
} else {
System.Console.WriteLine("Failed to transmit message to " + description.ToString() + "!\n");
PrintLastError();
System.Console.WriteLine();
}
break;
}
// Get events
case 'H':
goto case 'h';
case 'h':
PrintAPIEvents();
System.Console.WriteLine();
break;
// Set HS CAN to 250k
case 'I':
goto case 'i';
case 'i': {
// Select a device and get its description
if(numDevices == 0) {
System.Console.WriteLine("No devices found! Please scan for new devices.\n");
break;
}
selectedDevice = SelectDevice();
// Get the product description for the device
System.Text.StringBuilder description = new System.Text.StringBuilder(icsneocsharp.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION);
int maxLength = icsneocsharp.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION;
icsneocsharp.icsneo_describeDevice(selectedDevice, description, ref maxLength);
// Attempt to set baudrate and apply settings
if(icsneocsharp.icsneo_setBaudrate(selectedDevice, (ushort)icsneocsharp.ICSNEO_NETID_HSCAN, 250000) && icsneocsharp.icsneo_settingsApply(selectedDevice)) {
System.Console.WriteLine("Successfully set HS CAN baudrate for " + description.ToString() + "to 250k!\n");
} else {
System.Console.WriteLine("Failed to set HS CAN for " + description.ToString() + " to 250k!\n");
PrintLastError();
System.Console.WriteLine();
}
break;
}
// Set HS CAN to 500k
case 'J':
goto case 'j';
case 'j': {
// Select a device and get its description
if(numDevices == 0) {
System.Console.WriteLine("No devices found! Please scan for new devices.\n");
break;
}
selectedDevice = SelectDevice();
// Get the product description for the device
System.Text.StringBuilder description = new System.Text.StringBuilder(icsneocsharp.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION);
int maxLength = icsneocsharp.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION;
icsneocsharp.icsneo_describeDevice(selectedDevice, description, ref maxLength);
// Attempt to set baudrate and apply settings
if(icsneocsharp.icsneo_setBaudrate(selectedDevice, (ushort)icsneocsharp.ICSNEO_NETID_HSCAN, 500000) && icsneocsharp.icsneo_settingsApply(selectedDevice)) {
System.Console.WriteLine("Successfully set HS CAN baudrate for " + description.ToString() + "to 500k!\n");
} else {
System.Console.WriteLine("Failed to set HS CAN for " + description.ToString() + " to 500k!\n");
PrintLastError();
System.Console.WriteLine();
}
break;
}
case 'X':
goto case 'x';
case 'x':
System.Console.WriteLine("Exiting program");
return;
default:
System.Console.WriteLine("Unexpected input, exiting!");
return;
}
}
}
}
}
+8
View File
@@ -0,0 +1,8 @@
namespace libicsneocsharp_example {
class Program {
static void Main(string[] args) {
InteractiveExample example = new InteractiveExample();
example.Run();
}
}
}
+57
View File
@@ -0,0 +1,57 @@
# libicsneo C# Example
This is an example console application that uses the icsneocsharp library to control an Intrepid Control Systems hardware device.
## Cloning
This will create a copy of the repository on your local machine.
Run:
```shell
git clone https://github.com/intrepidcs/libicsneo-examples --recursive
```
Alternatively, if you cloned without the `--recursive` flag, you must enter the `libicsneo-examples` folder and run the following:
```shell
git submodule update --recursive --init
```
If you haven't done this, `third-party/libicsneo` will be empty and you won't be able to build!
## Windows using Visual Studio 2017+
### Building the DLLs
#### icsneoc
First, we are going to build the icsneoc library into a .dll file that is used by the C# wrapper to access the library functions.
1. Launch Visual Studio and open the `libicsneo-examples` folder.
2. Choose `File->Open->Cmake...`
3. Navigate to `third-party/libicsneo` and select the `CMakeLists.txt` there.
4. Visual Studio will process the CMake project.
5. Select `Build->Rebuild All`
6. Visual Studio will generate the `icsneoc.dll` file, which can then be found by selecting `Project->Cmake Cache (x64-Debug Only)->Open in Explorer`. If the file cannot be found, search in `libicsneo-examples/third-party/libicsneo/out/build/x64-Debug` and double-check that the build succeeded in step 5.
7. Move the `icsneoc.dll` file to the `/C/Windows/System32` folder.
#### icsneocsharp
Next, we are going to build the wrapper functions into a .dll file that is used to access the library functions in C#.
1. Launch a terminal window and change directories into `libicsneo-examples/libicsneocsharp-example`, then create a build directory by running `mkdir -p build`
2. Enter the build directory with `cd build`
3. Run `cmake ..`
4. Run `cmake --build .`
5. The `icsneocsharp.dll` file will be generated in `libicsneo-examples/libicsneocsharp-example/build/Debug`
6. Move the `icsneocsharp.dll` file to the `/C/Windows/System32` folder.
### Building the example program
1. Choose `File->Open->Project/Solution...`
2. Navigate to `libicsneo-examples/libicsneocsharp-example` and select the `libicsneocsharp-example.sln` there.
3. Visual Studio will process the project.
4. Select `Build->Rebuild Solution`
5. Click on the dropdown arrow attached to the green play button (labelled "Select Startup Item") and select `libicsneocsharp-example`
6. Click on the green play button to run the example.
+26
View File
@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated />
//
// This file was automatically generated by SWIG (http://www.swig.org).
// Version 4.0.0
//
// Do not make changes to this file unless you know what you are doing--modify
// the SWIG interface file instead.
//------------------------------------------------------------------------------
public class SWIGTYPE_p_time_t {
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
internal SWIGTYPE_p_time_t(global::System.IntPtr cPtr, bool futureUse) {
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
protected SWIGTYPE_p_time_t() {
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_time_t obj) {
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
}
@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated />
//
// This file was automatically generated by SWIG (http://www.swig.org).
// Version 4.0.0
//
// Do not make changes to this file unless you know what you are doing--modify
// the SWIG interface file instead.
//------------------------------------------------------------------------------
public class SWIGTYPE_p_unsigned_char {
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
internal SWIGTYPE_p_unsigned_char(global::System.IntPtr cPtr, bool futureUse) {
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
protected SWIGTYPE_p_unsigned_char() {
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_unsigned_char obj) {
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
}
@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated />
//
// This file was automatically generated by SWIG (http://www.swig.org).
// Version 4.0.0
//
// Do not make changes to this file unless you know what you are doing--modify
// the SWIG interface file instead.
//------------------------------------------------------------------------------
public class SWIGTYPE_p_unsigned_int {
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
internal SWIGTYPE_p_unsigned_int(global::System.IntPtr cPtr, bool futureUse) {
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
protected SWIGTYPE_p_unsigned_int() {
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_unsigned_int obj) {
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
}
@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated />
//
// This file was automatically generated by SWIG (http://www.swig.org).
// Version 4.0.0
//
// Do not make changes to this file unless you know what you are doing--modify
// the SWIG interface file instead.
//------------------------------------------------------------------------------
public class SWIGTYPE_p_unsigned_short {
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
internal SWIGTYPE_p_unsigned_short(global::System.IntPtr cPtr, bool futureUse) {
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
protected SWIGTYPE_p_unsigned_short() {
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_unsigned_short obj) {
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
}
+26
View File
@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated />
//
// This file was automatically generated by SWIG (http://www.swig.org).
// Version 4.0.0
//
// Do not make changes to this file unless you know what you are doing--modify
// the SWIG interface file instead.
//------------------------------------------------------------------------------
public class SWIGTYPE_p_void {
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
internal SWIGTYPE_p_void(global::System.IntPtr cPtr, bool futureUse) {
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
protected SWIGTYPE_p_void() {
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_void obj) {
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
}
+76
View File
@@ -0,0 +1,76 @@
%module icsneocsharp
%include <windows.i>
%include <typemaps.i>
%include <stdint.i>
%include <carrays.i>
%include <arrays_csharp.i>
#define DLLExport
%typemap(ctype) uint8_t const *data "unsigned char *"
%typemap(imtype, out="System.IntPtr") uint8_t const *data "byte[]"
%typemap(cstype) uint8_t const *data "byte[]"
%typemap(in) uint8_t const *data %{
$1 = $input;
%}
%typemap(csvarin) uint8_t const *data %{
set {
icsneocsharpPINVOKE.$csclazznamedata_set(swigCPtr, value);
}
%}
%typemap(csvarout, excode=SWIGEXCODE2) uint8_t const *data %{
get {
byte[] ret = new byte[this.length];
System.IntPtr data = $imcall;
System.Runtime.InteropServices.Marshal.Copy(data, ret, 0, (int)this.length)$excode;
return ret;
}
%}
%typemap(ctype) char *str "char *"
%typemap(imtype) char *str "System.Text.StringBuilder"
%typemap(cstype) char *str "System.Text.StringBuilder"
%{
#include "icsneo/icsneoc.h"
%}
%apply int *INOUT {size_t *};
%ignore icsneo_addMessageCallback;
%ignore icsneo_removeMessageCallback;
%ignore icsneo_addEventCallback;
%ignore icsneo_removeEventCallback;
%include "icsneo/icsneoc.h"
%include "icsneo/device/neodevice.h"
%include "icsneo/communication/message/neomessage.h"
%include "icsneo/device/devicetype.h"
%include "icsneo/api/version.h"
%include "icsneo/api/event.h"
%include "icsneo/communication/network.h"
%inline %{
static neomessage_can_t* neomessage_can_t_cast(neomessage_t* msg) {
return (neomessage_can_t*) msg;
}
static neomessage_eth_t* neomessage_eth_t_cast(neomessage_t* msg) {
return (neomessage_eth_t*) msg;
}
static neomessage_t* from_can_neomessage_t_cast(neomessage_can_t* msg) {
return (neomessage_t*) msg;
}
static neomessage_t* from_eth_neomessage_t_cast(neomessage_eth_t* msg) {
return (neomessage_t*) msg;
}
%}
%array_functions(neodevice_t, neodevice_t_array);
%array_functions(neoevent_t, neoevent_t_array);
%array_functions(neomessage_t, neomessage_t_array);
File diff suppressed because it is too large Load Diff
+426
View File
@@ -0,0 +1,426 @@
//------------------------------------------------------------------------------
// <auto-generated />
//
// This file was automatically generated by SWIG (http://www.swig.org).
// Version 4.0.0
//
// Do not make changes to this file unless you know what you are doing--modify
// the SWIG interface file instead.
//------------------------------------------------------------------------------
public class icsneocsharp {
public static void icsneo_findAllDevices(neodevice_t devices, ref int count) {
icsneocsharpPINVOKE.icsneo_findAllDevices(neodevice_t.getCPtr(devices), ref count);
}
public static void icsneo_freeUnconnectedDevices() {
icsneocsharpPINVOKE.icsneo_freeUnconnectedDevices();
}
public static bool icsneo_serialNumToString(uint num, System.Text.StringBuilder str, ref int count) {
bool ret = icsneocsharpPINVOKE.icsneo_serialNumToString(num, str, ref count);
return ret;
}
public static uint icsneo_serialStringToNum(System.Text.StringBuilder str) {
uint ret = icsneocsharpPINVOKE.icsneo_serialStringToNum(str);
return ret;
}
public static bool icsneo_isValidNeoDevice(neodevice_t device) {
bool ret = icsneocsharpPINVOKE.icsneo_isValidNeoDevice(neodevice_t.getCPtr(device));
return ret;
}
public static bool icsneo_openDevice(neodevice_t device) {
bool ret = icsneocsharpPINVOKE.icsneo_openDevice(neodevice_t.getCPtr(device));
return ret;
}
public static bool icsneo_closeDevice(neodevice_t device) {
bool ret = icsneocsharpPINVOKE.icsneo_closeDevice(neodevice_t.getCPtr(device));
return ret;
}
public static bool icsneo_isOpen(neodevice_t device) {
bool ret = icsneocsharpPINVOKE.icsneo_isOpen(neodevice_t.getCPtr(device));
return ret;
}
public static bool icsneo_goOnline(neodevice_t device) {
bool ret = icsneocsharpPINVOKE.icsneo_goOnline(neodevice_t.getCPtr(device));
return ret;
}
public static bool icsneo_goOffline(neodevice_t device) {
bool ret = icsneocsharpPINVOKE.icsneo_goOffline(neodevice_t.getCPtr(device));
return ret;
}
public static bool icsneo_isOnline(neodevice_t device) {
bool ret = icsneocsharpPINVOKE.icsneo_isOnline(neodevice_t.getCPtr(device));
return ret;
}
public static bool icsneo_enableMessagePolling(neodevice_t device) {
bool ret = icsneocsharpPINVOKE.icsneo_enableMessagePolling(neodevice_t.getCPtr(device));
return ret;
}
public static bool icsneo_disableMessagePolling(neodevice_t device) {
bool ret = icsneocsharpPINVOKE.icsneo_disableMessagePolling(neodevice_t.getCPtr(device));
return ret;
}
public static bool icsneo_isMessagePollingEnabled(neodevice_t device) {
bool ret = icsneocsharpPINVOKE.icsneo_isMessagePollingEnabled(neodevice_t.getCPtr(device));
return ret;
}
public static bool icsneo_getMessages(neodevice_t device, neomessage_t messages, ref int items, ulong timeout) {
bool ret = icsneocsharpPINVOKE.icsneo_getMessages(neodevice_t.getCPtr(device), neomessage_t.getCPtr(messages), ref items, timeout);
return ret;
}
public static uint icsneo_getPollingMessageLimit(neodevice_t device) {
uint ret = icsneocsharpPINVOKE.icsneo_getPollingMessageLimit(neodevice_t.getCPtr(device));
return ret;
}
public static bool icsneo_setPollingMessageLimit(neodevice_t device, uint newLimit) {
bool ret = icsneocsharpPINVOKE.icsneo_setPollingMessageLimit(neodevice_t.getCPtr(device), newLimit);
return ret;
}
public static bool icsneo_getProductName(neodevice_t device, System.Text.StringBuilder str, ref int maxLength) {
bool ret = icsneocsharpPINVOKE.icsneo_getProductName(neodevice_t.getCPtr(device), str, ref maxLength);
return ret;
}
public static bool icsneo_getProductNameForType(uint type, System.Text.StringBuilder str, ref int maxLength) {
bool ret = icsneocsharpPINVOKE.icsneo_getProductNameForType(type, str, ref maxLength);
return ret;
}
public static bool icsneo_settingsRefresh(neodevice_t device) {
bool ret = icsneocsharpPINVOKE.icsneo_settingsRefresh(neodevice_t.getCPtr(device));
return ret;
}
public static bool icsneo_settingsApply(neodevice_t device) {
bool ret = icsneocsharpPINVOKE.icsneo_settingsApply(neodevice_t.getCPtr(device));
return ret;
}
public static bool icsneo_settingsApplyTemporary(neodevice_t device) {
bool ret = icsneocsharpPINVOKE.icsneo_settingsApplyTemporary(neodevice_t.getCPtr(device));
return ret;
}
public static bool icsneo_settingsApplyDefaults(neodevice_t device) {
bool ret = icsneocsharpPINVOKE.icsneo_settingsApplyDefaults(neodevice_t.getCPtr(device));
return ret;
}
public static bool icsneo_settingsApplyDefaultsTemporary(neodevice_t device) {
bool ret = icsneocsharpPINVOKE.icsneo_settingsApplyDefaultsTemporary(neodevice_t.getCPtr(device));
return ret;
}
public static int icsneo_settingsReadStructure(neodevice_t device, SWIGTYPE_p_void structure, uint structureSize) {
int ret = icsneocsharpPINVOKE.icsneo_settingsReadStructure(neodevice_t.getCPtr(device), SWIGTYPE_p_void.getCPtr(structure), structureSize);
return ret;
}
public static bool icsneo_settingsApplyStructure(neodevice_t device, SWIGTYPE_p_void structure, uint structureSize) {
bool ret = icsneocsharpPINVOKE.icsneo_settingsApplyStructure(neodevice_t.getCPtr(device), SWIGTYPE_p_void.getCPtr(structure), structureSize);
return ret;
}
public static bool icsneo_settingsApplyStructureTemporary(neodevice_t device, SWIGTYPE_p_void structure, uint structureSize) {
bool ret = icsneocsharpPINVOKE.icsneo_settingsApplyStructureTemporary(neodevice_t.getCPtr(device), SWIGTYPE_p_void.getCPtr(structure), structureSize);
return ret;
}
public static long icsneo_getBaudrate(neodevice_t device, ushort netid) {
long ret = icsneocsharpPINVOKE.icsneo_getBaudrate(neodevice_t.getCPtr(device), netid);
return ret;
}
public static bool icsneo_setBaudrate(neodevice_t device, ushort netid, long newBaudrate) {
bool ret = icsneocsharpPINVOKE.icsneo_setBaudrate(neodevice_t.getCPtr(device), netid, newBaudrate);
return ret;
}
public static long icsneo_getFDBaudrate(neodevice_t device, ushort netid) {
long ret = icsneocsharpPINVOKE.icsneo_getFDBaudrate(neodevice_t.getCPtr(device), netid);
return ret;
}
public static bool icsneo_setFDBaudrate(neodevice_t device, ushort netid, long newBaudrate) {
bool ret = icsneocsharpPINVOKE.icsneo_setFDBaudrate(neodevice_t.getCPtr(device), netid, newBaudrate);
return ret;
}
public static bool icsneo_transmit(neodevice_t device, neomessage_t message) {
bool ret = icsneocsharpPINVOKE.icsneo_transmit(neodevice_t.getCPtr(device), neomessage_t.getCPtr(message));
return ret;
}
public static bool icsneo_transmitMessages(neodevice_t device, neomessage_t messages, uint count) {
bool ret = icsneocsharpPINVOKE.icsneo_transmitMessages(neodevice_t.getCPtr(device), neomessage_t.getCPtr(messages), count);
return ret;
}
public static void icsneo_setWriteBlocks(neodevice_t device, bool blocks) {
icsneocsharpPINVOKE.icsneo_setWriteBlocks(neodevice_t.getCPtr(device), blocks);
}
public static bool icsneo_describeDevice(neodevice_t device, System.Text.StringBuilder str, ref int maxLength) {
bool ret = icsneocsharpPINVOKE.icsneo_describeDevice(neodevice_t.getCPtr(device), str, ref maxLength);
return ret;
}
public static neoversion_t icsneo_getVersion() {
neoversion_t ret = new neoversion_t(icsneocsharpPINVOKE.icsneo_getVersion(), true);
return ret;
}
public static bool icsneo_getEvents(neoevent_t events, ref int size) {
bool ret = icsneocsharpPINVOKE.icsneo_getEvents(neoevent_t.getCPtr(events), ref size);
return ret;
}
public static bool icsneo_getDeviceEvents(neodevice_t device, neoevent_t events, ref int size) {
bool ret = icsneocsharpPINVOKE.icsneo_getDeviceEvents(neodevice_t.getCPtr(device), neoevent_t.getCPtr(events), ref size);
return ret;
}
public static bool icsneo_getLastError(neoevent_t error) {
bool ret = icsneocsharpPINVOKE.icsneo_getLastError(neoevent_t.getCPtr(error));
return ret;
}
public static void icsneo_discardAllEvents() {
icsneocsharpPINVOKE.icsneo_discardAllEvents();
}
public static void icsneo_discardDeviceEvents(neodevice_t device) {
icsneocsharpPINVOKE.icsneo_discardDeviceEvents(neodevice_t.getCPtr(device));
}
public static void icsneo_setEventLimit(uint newLimit) {
icsneocsharpPINVOKE.icsneo_setEventLimit(newLimit);
}
public static uint icsneo_getEventLimit() {
uint ret = icsneocsharpPINVOKE.icsneo_getEventLimit();
return ret;
}
public static bool icsneo_getSupportedDevices(SWIGTYPE_p_unsigned_int devices, ref int count) {
bool ret = icsneocsharpPINVOKE.icsneo_getSupportedDevices(SWIGTYPE_p_unsigned_int.getCPtr(devices), ref count);
return ret;
}
public static bool icsneo_getTimestampResolution(neodevice_t device, SWIGTYPE_p_unsigned_short resolution) {
bool ret = icsneocsharpPINVOKE.icsneo_getTimestampResolution(neodevice_t.getCPtr(device), SWIGTYPE_p_unsigned_short.getCPtr(resolution));
return ret;
}
public static neomessage_can_t neomessage_can_t_cast(neomessage_t msg) {
global::System.IntPtr cPtr = icsneocsharpPINVOKE.neomessage_can_t_cast(neomessage_t.getCPtr(msg));
neomessage_can_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new neomessage_can_t(cPtr, false);
return ret;
}
public static neomessage_eth_t neomessage_eth_t_cast(neomessage_t msg) {
global::System.IntPtr cPtr = icsneocsharpPINVOKE.neomessage_eth_t_cast(neomessage_t.getCPtr(msg));
neomessage_eth_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new neomessage_eth_t(cPtr, false);
return ret;
}
public static neomessage_t from_can_neomessage_t_cast(neomessage_can_t msg) {
global::System.IntPtr cPtr = icsneocsharpPINVOKE.from_can_neomessage_t_cast(neomessage_can_t.getCPtr(msg));
neomessage_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new neomessage_t(cPtr, false);
return ret;
}
public static neomessage_t from_eth_neomessage_t_cast(neomessage_eth_t msg) {
global::System.IntPtr cPtr = icsneocsharpPINVOKE.from_eth_neomessage_t_cast(neomessage_eth_t.getCPtr(msg));
neomessage_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new neomessage_t(cPtr, false);
return ret;
}
public static neodevice_t new_neodevice_t_array(int nelements) {
global::System.IntPtr cPtr = icsneocsharpPINVOKE.new_neodevice_t_array(nelements);
neodevice_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new neodevice_t(cPtr, false);
return ret;
}
public static void delete_neodevice_t_array(neodevice_t ary) {
icsneocsharpPINVOKE.delete_neodevice_t_array(neodevice_t.getCPtr(ary));
}
public static neodevice_t neodevice_t_array_getitem(neodevice_t ary, int index) {
neodevice_t ret = new neodevice_t(icsneocsharpPINVOKE.neodevice_t_array_getitem(neodevice_t.getCPtr(ary), index), true);
return ret;
}
public static void neodevice_t_array_setitem(neodevice_t ary, int index, neodevice_t value) {
icsneocsharpPINVOKE.neodevice_t_array_setitem(neodevice_t.getCPtr(ary), index, neodevice_t.getCPtr(value));
if (icsneocsharpPINVOKE.SWIGPendingException.Pending) throw icsneocsharpPINVOKE.SWIGPendingException.Retrieve();
}
public static neoevent_t new_neoevent_t_array(int nelements) {
global::System.IntPtr cPtr = icsneocsharpPINVOKE.new_neoevent_t_array(nelements);
neoevent_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new neoevent_t(cPtr, false);
return ret;
}
public static void delete_neoevent_t_array(neoevent_t ary) {
icsneocsharpPINVOKE.delete_neoevent_t_array(neoevent_t.getCPtr(ary));
}
public static neoevent_t neoevent_t_array_getitem(neoevent_t ary, int index) {
neoevent_t ret = new neoevent_t(icsneocsharpPINVOKE.neoevent_t_array_getitem(neoevent_t.getCPtr(ary), index), true);
return ret;
}
public static void neoevent_t_array_setitem(neoevent_t ary, int index, neoevent_t value) {
icsneocsharpPINVOKE.neoevent_t_array_setitem(neoevent_t.getCPtr(ary), index, neoevent_t.getCPtr(value));
if (icsneocsharpPINVOKE.SWIGPendingException.Pending) throw icsneocsharpPINVOKE.SWIGPendingException.Retrieve();
}
public static neomessage_t new_neomessage_t_array(int nelements) {
global::System.IntPtr cPtr = icsneocsharpPINVOKE.new_neomessage_t_array(nelements);
neomessage_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new neomessage_t(cPtr, false);
return ret;
}
public static void delete_neomessage_t_array(neomessage_t ary) {
icsneocsharpPINVOKE.delete_neomessage_t_array(neomessage_t.getCPtr(ary));
}
public static neomessage_t neomessage_t_array_getitem(neomessage_t ary, int index) {
neomessage_t ret = new neomessage_t(icsneocsharpPINVOKE.neomessage_t_array_getitem(neomessage_t.getCPtr(ary), index), true);
return ret;
}
public static void neomessage_t_array_setitem(neomessage_t ary, int index, neomessage_t value) {
icsneocsharpPINVOKE.neomessage_t_array_setitem(neomessage_t.getCPtr(ary), index, neomessage_t.getCPtr(value));
if (icsneocsharpPINVOKE.SWIGPendingException.Pending) throw icsneocsharpPINVOKE.SWIGPendingException.Retrieve();
}
public static readonly int ICSNEO_DEVICETYPE_LONGEST_NAME = icsneocsharpPINVOKE.ICSNEO_DEVICETYPE_LONGEST_NAME_get();
public static readonly int ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION = icsneocsharpPINVOKE.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION_get();
public static readonly int ICSNEO_NETID_DEVICE = icsneocsharpPINVOKE.ICSNEO_NETID_DEVICE_get();
public static readonly int ICSNEO_NETID_HSCAN = icsneocsharpPINVOKE.ICSNEO_NETID_HSCAN_get();
public static readonly int ICSNEO_NETID_MSCAN = icsneocsharpPINVOKE.ICSNEO_NETID_MSCAN_get();
public static readonly int ICSNEO_NETID_SWCAN = icsneocsharpPINVOKE.ICSNEO_NETID_SWCAN_get();
public static readonly int ICSNEO_NETID_LSFTCAN = icsneocsharpPINVOKE.ICSNEO_NETID_LSFTCAN_get();
public static readonly int ICSNEO_NETID_FORDSCP = icsneocsharpPINVOKE.ICSNEO_NETID_FORDSCP_get();
public static readonly int ICSNEO_NETID_J1708 = icsneocsharpPINVOKE.ICSNEO_NETID_J1708_get();
public static readonly int ICSNEO_NETID_AUX = icsneocsharpPINVOKE.ICSNEO_NETID_AUX_get();
public static readonly int ICSNEO_NETID_J1850VPW = icsneocsharpPINVOKE.ICSNEO_NETID_J1850VPW_get();
public static readonly int ICSNEO_NETID_ISO = icsneocsharpPINVOKE.ICSNEO_NETID_ISO_get();
public static readonly int ICSNEO_NETID_ISOPIC = icsneocsharpPINVOKE.ICSNEO_NETID_ISOPIC_get();
public static readonly int ICSNEO_NETID_MAIN51 = icsneocsharpPINVOKE.ICSNEO_NETID_MAIN51_get();
public static readonly int ICSNEO_NETID_RED = icsneocsharpPINVOKE.ICSNEO_NETID_RED_get();
public static readonly int ICSNEO_NETID_SCI = icsneocsharpPINVOKE.ICSNEO_NETID_SCI_get();
public static readonly int ICSNEO_NETID_ISO2 = icsneocsharpPINVOKE.ICSNEO_NETID_ISO2_get();
public static readonly int ICSNEO_NETID_ISO14230 = icsneocsharpPINVOKE.ICSNEO_NETID_ISO14230_get();
public static readonly int ICSNEO_NETID_LIN = icsneocsharpPINVOKE.ICSNEO_NETID_LIN_get();
public static readonly int ICSNEO_NETID_OP_ETHERNET1 = icsneocsharpPINVOKE.ICSNEO_NETID_OP_ETHERNET1_get();
public static readonly int ICSNEO_NETID_OP_ETHERNET2 = icsneocsharpPINVOKE.ICSNEO_NETID_OP_ETHERNET2_get();
public static readonly int ICSNEO_NETID_OP_ETHERNET3 = icsneocsharpPINVOKE.ICSNEO_NETID_OP_ETHERNET3_get();
public static readonly int ICSNEO_NETID_RED_EXT_MEMORYREAD = icsneocsharpPINVOKE.ICSNEO_NETID_RED_EXT_MEMORYREAD_get();
public static readonly int ICSNEO_NETID_RED_INT_MEMORYREAD = icsneocsharpPINVOKE.ICSNEO_NETID_RED_INT_MEMORYREAD_get();
public static readonly int ICSNEO_NETID_RED_DFLASH_READ = icsneocsharpPINVOKE.ICSNEO_NETID_RED_DFLASH_READ_get();
public static readonly int ICSNEO_NETID_RED_SDCARD_READ = icsneocsharpPINVOKE.ICSNEO_NETID_RED_SDCARD_READ_get();
public static readonly int ICSNEO_NETID_CAN_ERRBITS = icsneocsharpPINVOKE.ICSNEO_NETID_CAN_ERRBITS_get();
public static readonly int ICSNEO_NETID_RED_DFLASH_WRITE_DONE = icsneocsharpPINVOKE.ICSNEO_NETID_RED_DFLASH_WRITE_DONE_get();
public static readonly int ICSNEO_NETID_RED_WAVE_CAN1_LOGICAL = icsneocsharpPINVOKE.ICSNEO_NETID_RED_WAVE_CAN1_LOGICAL_get();
public static readonly int ICSNEO_NETID_RED_WAVE_CAN2_LOGICAL = icsneocsharpPINVOKE.ICSNEO_NETID_RED_WAVE_CAN2_LOGICAL_get();
public static readonly int ICSNEO_NETID_RED_WAVE_LIN1_LOGICAL = icsneocsharpPINVOKE.ICSNEO_NETID_RED_WAVE_LIN1_LOGICAL_get();
public static readonly int ICSNEO_NETID_RED_WAVE_LIN2_LOGICAL = icsneocsharpPINVOKE.ICSNEO_NETID_RED_WAVE_LIN2_LOGICAL_get();
public static readonly int ICSNEO_NETID_RED_WAVE_LIN1_ANALOG = icsneocsharpPINVOKE.ICSNEO_NETID_RED_WAVE_LIN1_ANALOG_get();
public static readonly int ICSNEO_NETID_RED_WAVE_LIN2_ANALOG = icsneocsharpPINVOKE.ICSNEO_NETID_RED_WAVE_LIN2_ANALOG_get();
public static readonly int ICSNEO_NETID_RED_WAVE_MISC_ANALOG = icsneocsharpPINVOKE.ICSNEO_NETID_RED_WAVE_MISC_ANALOG_get();
public static readonly int ICSNEO_NETID_RED_WAVE_MISCDIO2_LOGICAL = icsneocsharpPINVOKE.ICSNEO_NETID_RED_WAVE_MISCDIO2_LOGICAL_get();
public static readonly int ICSNEO_NETID_RED_NETWORK_COM_ENABLE_EX = icsneocsharpPINVOKE.ICSNEO_NETID_RED_NETWORK_COM_ENABLE_EX_get();
public static readonly int ICSNEO_NETID_RED_NEOVI_NETWORK = icsneocsharpPINVOKE.ICSNEO_NETID_RED_NEOVI_NETWORK_get();
public static readonly int ICSNEO_NETID_RED_READ_BAUD_SETTINGS = icsneocsharpPINVOKE.ICSNEO_NETID_RED_READ_BAUD_SETTINGS_get();
public static readonly int ICSNEO_NETID_RED_OLDFORMAT = icsneocsharpPINVOKE.ICSNEO_NETID_RED_OLDFORMAT_get();
public static readonly int ICSNEO_NETID_RED_SCOPE_CAPTURE = icsneocsharpPINVOKE.ICSNEO_NETID_RED_SCOPE_CAPTURE_get();
public static readonly int ICSNEO_NETID_RED_HARDWARE_EXCEP = icsneocsharpPINVOKE.ICSNEO_NETID_RED_HARDWARE_EXCEP_get();
public static readonly int ICSNEO_NETID_RED_GET_RTC = icsneocsharpPINVOKE.ICSNEO_NETID_RED_GET_RTC_get();
public static readonly int ICSNEO_NETID_ISO3 = icsneocsharpPINVOKE.ICSNEO_NETID_ISO3_get();
public static readonly int ICSNEO_NETID_HSCAN2 = icsneocsharpPINVOKE.ICSNEO_NETID_HSCAN2_get();
public static readonly int ICSNEO_NETID_HSCAN3 = icsneocsharpPINVOKE.ICSNEO_NETID_HSCAN3_get();
public static readonly int ICSNEO_NETID_OP_ETHERNET4 = icsneocsharpPINVOKE.ICSNEO_NETID_OP_ETHERNET4_get();
public static readonly int ICSNEO_NETID_OP_ETHERNET5 = icsneocsharpPINVOKE.ICSNEO_NETID_OP_ETHERNET5_get();
public static readonly int ICSNEO_NETID_ISO4 = icsneocsharpPINVOKE.ICSNEO_NETID_ISO4_get();
public static readonly int ICSNEO_NETID_LIN2 = icsneocsharpPINVOKE.ICSNEO_NETID_LIN2_get();
public static readonly int ICSNEO_NETID_LIN3 = icsneocsharpPINVOKE.ICSNEO_NETID_LIN3_get();
public static readonly int ICSNEO_NETID_LIN4 = icsneocsharpPINVOKE.ICSNEO_NETID_LIN4_get();
public static readonly int ICSNEO_NETID_RED_APP_ERROR = icsneocsharpPINVOKE.ICSNEO_NETID_RED_APP_ERROR_get();
public static readonly int ICSNEO_NETID_CGI = icsneocsharpPINVOKE.ICSNEO_NETID_CGI_get();
public static readonly int ICSNEO_NETID_RESET_STATUS = icsneocsharpPINVOKE.ICSNEO_NETID_RESET_STATUS_get();
public static readonly int ICSNEO_NETID_FB_STATUS = icsneocsharpPINVOKE.ICSNEO_NETID_FB_STATUS_get();
public static readonly int ICSNEO_NETID_APP_SIGNAL_STATUS = icsneocsharpPINVOKE.ICSNEO_NETID_APP_SIGNAL_STATUS_get();
public static readonly int ICSNEO_NETID_READ_DATALINK_CM_TX_MSG = icsneocsharpPINVOKE.ICSNEO_NETID_READ_DATALINK_CM_TX_MSG_get();
public static readonly int ICSNEO_NETID_READ_DATALINK_CM_RX_MSG = icsneocsharpPINVOKE.ICSNEO_NETID_READ_DATALINK_CM_RX_MSG_get();
public static readonly int ICSNEO_NETID_LOGGING_OVERFLOW = icsneocsharpPINVOKE.ICSNEO_NETID_LOGGING_OVERFLOW_get();
public static readonly int ICSNEO_NETID_READ_SETTINGS = icsneocsharpPINVOKE.ICSNEO_NETID_READ_SETTINGS_get();
public static readonly int ICSNEO_NETID_HSCAN4 = icsneocsharpPINVOKE.ICSNEO_NETID_HSCAN4_get();
public static readonly int ICSNEO_NETID_HSCAN5 = icsneocsharpPINVOKE.ICSNEO_NETID_HSCAN5_get();
public static readonly int ICSNEO_NETID_RS232 = icsneocsharpPINVOKE.ICSNEO_NETID_RS232_get();
public static readonly int ICSNEO_NETID_UART = icsneocsharpPINVOKE.ICSNEO_NETID_UART_get();
public static readonly int ICSNEO_NETID_UART2 = icsneocsharpPINVOKE.ICSNEO_NETID_UART2_get();
public static readonly int ICSNEO_NETID_UART3 = icsneocsharpPINVOKE.ICSNEO_NETID_UART3_get();
public static readonly int ICSNEO_NETID_UART4 = icsneocsharpPINVOKE.ICSNEO_NETID_UART4_get();
public static readonly int ICSNEO_NETID_SWCAN2 = icsneocsharpPINVOKE.ICSNEO_NETID_SWCAN2_get();
public static readonly int ICSNEO_NETID_ETHERNET_DAQ = icsneocsharpPINVOKE.ICSNEO_NETID_ETHERNET_DAQ_get();
public static readonly int ICSNEO_NETID_DATA_TO_HOST = icsneocsharpPINVOKE.ICSNEO_NETID_DATA_TO_HOST_get();
public static readonly int ICSNEO_NETID_TEXTAPI_TO_HOST = icsneocsharpPINVOKE.ICSNEO_NETID_TEXTAPI_TO_HOST_get();
public static readonly int ICSNEO_NETID_OP_ETHERNET6 = icsneocsharpPINVOKE.ICSNEO_NETID_OP_ETHERNET6_get();
public static readonly int ICSNEO_NETID_RED_VBAT = icsneocsharpPINVOKE.ICSNEO_NETID_RED_VBAT_get();
public static readonly int ICSNEO_NETID_OP_ETHERNET7 = icsneocsharpPINVOKE.ICSNEO_NETID_OP_ETHERNET7_get();
public static readonly int ICSNEO_NETID_OP_ETHERNET8 = icsneocsharpPINVOKE.ICSNEO_NETID_OP_ETHERNET8_get();
public static readonly int ICSNEO_NETID_OP_ETHERNET9 = icsneocsharpPINVOKE.ICSNEO_NETID_OP_ETHERNET9_get();
public static readonly int ICSNEO_NETID_OP_ETHERNET10 = icsneocsharpPINVOKE.ICSNEO_NETID_OP_ETHERNET10_get();
public static readonly int ICSNEO_NETID_OP_ETHERNET11 = icsneocsharpPINVOKE.ICSNEO_NETID_OP_ETHERNET11_get();
public static readonly int ICSNEO_NETID_FLEXRAY1A = icsneocsharpPINVOKE.ICSNEO_NETID_FLEXRAY1A_get();
public static readonly int ICSNEO_NETID_FLEXRAY1B = icsneocsharpPINVOKE.ICSNEO_NETID_FLEXRAY1B_get();
public static readonly int ICSNEO_NETID_FLEXRAY2A = icsneocsharpPINVOKE.ICSNEO_NETID_FLEXRAY2A_get();
public static readonly int ICSNEO_NETID_FLEXRAY2B = icsneocsharpPINVOKE.ICSNEO_NETID_FLEXRAY2B_get();
public static readonly int ICSNEO_NETID_LIN5 = icsneocsharpPINVOKE.ICSNEO_NETID_LIN5_get();
public static readonly int ICSNEO_NETID_FLEXRAY = icsneocsharpPINVOKE.ICSNEO_NETID_FLEXRAY_get();
public static readonly int ICSNEO_NETID_FLEXRAY2 = icsneocsharpPINVOKE.ICSNEO_NETID_FLEXRAY2_get();
public static readonly int ICSNEO_NETID_OP_ETHERNET12 = icsneocsharpPINVOKE.ICSNEO_NETID_OP_ETHERNET12_get();
public static readonly int ICSNEO_NETID_MOST25 = icsneocsharpPINVOKE.ICSNEO_NETID_MOST25_get();
public static readonly int ICSNEO_NETID_MOST50 = icsneocsharpPINVOKE.ICSNEO_NETID_MOST50_get();
public static readonly int ICSNEO_NETID_MOST150 = icsneocsharpPINVOKE.ICSNEO_NETID_MOST150_get();
public static readonly int ICSNEO_NETID_ETHERNET = icsneocsharpPINVOKE.ICSNEO_NETID_ETHERNET_get();
public static readonly int ICSNEO_NETID_GMFSA = icsneocsharpPINVOKE.ICSNEO_NETID_GMFSA_get();
public static readonly int ICSNEO_NETID_TCP = icsneocsharpPINVOKE.ICSNEO_NETID_TCP_get();
public static readonly int ICSNEO_NETID_HSCAN6 = icsneocsharpPINVOKE.ICSNEO_NETID_HSCAN6_get();
public static readonly int ICSNEO_NETID_HSCAN7 = icsneocsharpPINVOKE.ICSNEO_NETID_HSCAN7_get();
public static readonly int ICSNEO_NETID_LIN6 = icsneocsharpPINVOKE.ICSNEO_NETID_LIN6_get();
public static readonly int ICSNEO_NETID_LSFTCAN2 = icsneocsharpPINVOKE.ICSNEO_NETID_LSFTCAN2_get();
public static readonly int ICSNEO_NETID_HW_COM_LATENCY_TEST = icsneocsharpPINVOKE.ICSNEO_NETID_HW_COM_LATENCY_TEST_get();
public static readonly int ICSNEO_NETID_DEVICE_STATUS = icsneocsharpPINVOKE.ICSNEO_NETID_DEVICE_STATUS_get();
public static readonly int ICSNEO_NETID_ANY = icsneocsharpPINVOKE.ICSNEO_NETID_ANY_get();
public static readonly int ICSNEO_NETID_INVALID = icsneocsharpPINVOKE.ICSNEO_NETID_INVALID_get();
public static readonly int ICSNEO_NETWORK_TYPE_INVALID = icsneocsharpPINVOKE.ICSNEO_NETWORK_TYPE_INVALID_get();
public static readonly int ICSNEO_NETWORK_TYPE_INTERNAL = icsneocsharpPINVOKE.ICSNEO_NETWORK_TYPE_INTERNAL_get();
public static readonly int ICSNEO_NETWORK_TYPE_CAN = icsneocsharpPINVOKE.ICSNEO_NETWORK_TYPE_CAN_get();
public static readonly int ICSNEO_NETWORK_TYPE_LIN = icsneocsharpPINVOKE.ICSNEO_NETWORK_TYPE_LIN_get();
public static readonly int ICSNEO_NETWORK_TYPE_FLEXRAY = icsneocsharpPINVOKE.ICSNEO_NETWORK_TYPE_FLEXRAY_get();
public static readonly int ICSNEO_NETWORK_TYPE_MOST = icsneocsharpPINVOKE.ICSNEO_NETWORK_TYPE_MOST_get();
public static readonly int ICSNEO_NETWORK_TYPE_ETHERNET = icsneocsharpPINVOKE.ICSNEO_NETWORK_TYPE_ETHERNET_get();
public static readonly int ICSNEO_NETWORK_TYPE_ANY = icsneocsharpPINVOKE.ICSNEO_NETWORK_TYPE_ANY_get();
public static readonly int ICSNEO_NETWORK_TYPE_OTHER = icsneocsharpPINVOKE.ICSNEO_NETWORK_TYPE_OTHER_get();
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
<RootNamespace>libicsneocsharp_example</RootNamespace>
</PropertyGroup>
</Project>
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28922.388
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "libicsneocsharp-example", "libicsneocsharp-example.csproj", "{391FCF02-39BB-4C81-AE99-6785A7EA13A1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{391FCF02-39BB-4C81-AE99-6785A7EA13A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{391FCF02-39BB-4C81-AE99-6785A7EA13A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{391FCF02-39BB-4C81-AE99-6785A7EA13A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{391FCF02-39BB-4C81-AE99-6785A7EA13A1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9610ED61-57FA-46BD-A071-DC7DB7BAC3A9}
EndGlobalSection
EndGlobal
+90
View File
@@ -0,0 +1,90 @@
//------------------------------------------------------------------------------
// <auto-generated />
//
// This file was automatically generated by SWIG (http://www.swig.org).
// Version 4.0.0
//
// Do not make changes to this file unless you know what you are doing--modify
// the SWIG interface file instead.
//------------------------------------------------------------------------------
public class neodevice_t : global::System.IDisposable {
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
protected bool swigCMemOwn;
internal neodevice_t(global::System.IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(neodevice_t obj) {
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
~neodevice_t() {
Dispose(false);
}
public void Dispose() {
Dispose(true);
global::System.GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing) {
lock(this) {
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
icsneocsharpPINVOKE.delete_neodevice_t(swigCPtr);
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
}
}
public SWIGTYPE_p_void device {
set {
icsneocsharpPINVOKE.neodevice_t_device_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
}
get {
global::System.IntPtr cPtr = icsneocsharpPINVOKE.neodevice_t_device_get(swigCPtr);
SWIGTYPE_p_void ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
return ret;
}
}
public int handle {
set {
icsneocsharpPINVOKE.neodevice_t_handle_set(swigCPtr, value);
}
get {
int ret = icsneocsharpPINVOKE.neodevice_t_handle_get(swigCPtr);
return ret;
}
}
public uint type {
set {
icsneocsharpPINVOKE.neodevice_t_type_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neodevice_t_type_get(swigCPtr);
return ret;
}
}
public string serial {
set {
icsneocsharpPINVOKE.neodevice_t_serial_set(swigCPtr, value);
}
get {
string ret = icsneocsharpPINVOKE.neodevice_t_serial_get(swigCPtr);
return ret;
}
}
public neodevice_t() : this(icsneocsharpPINVOKE.new_neodevice_t(), true) {
}
}
+112
View File
@@ -0,0 +1,112 @@
//------------------------------------------------------------------------------
// <auto-generated />
//
// This file was automatically generated by SWIG (http://www.swig.org).
// Version 4.0.0
//
// Do not make changes to this file unless you know what you are doing--modify
// the SWIG interface file instead.
//------------------------------------------------------------------------------
public class neoevent_t : global::System.IDisposable {
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
protected bool swigCMemOwn;
internal neoevent_t(global::System.IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(neoevent_t obj) {
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
~neoevent_t() {
Dispose(false);
}
public void Dispose() {
Dispose(true);
global::System.GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing) {
lock(this) {
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
icsneocsharpPINVOKE.delete_neoevent_t(swigCPtr);
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
}
}
public string description {
set {
icsneocsharpPINVOKE.neoevent_t_description_set(swigCPtr, value);
}
get {
string ret = icsneocsharpPINVOKE.neoevent_t_description_get(swigCPtr);
return ret;
}
}
public SWIGTYPE_p_time_t timestamp {
set {
icsneocsharpPINVOKE.neoevent_t_timestamp_set(swigCPtr, SWIGTYPE_p_time_t.getCPtr(value));
if (icsneocsharpPINVOKE.SWIGPendingException.Pending) throw icsneocsharpPINVOKE.SWIGPendingException.Retrieve();
}
get {
SWIGTYPE_p_time_t ret = new SWIGTYPE_p_time_t(icsneocsharpPINVOKE.neoevent_t_timestamp_get(swigCPtr), true);
if (icsneocsharpPINVOKE.SWIGPendingException.Pending) throw icsneocsharpPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
}
public uint eventNumber {
set {
icsneocsharpPINVOKE.neoevent_t_eventNumber_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neoevent_t_eventNumber_get(swigCPtr);
return ret;
}
}
public byte severity {
set {
icsneocsharpPINVOKE.neoevent_t_severity_set(swigCPtr, value);
}
get {
byte ret = icsneocsharpPINVOKE.neoevent_t_severity_get(swigCPtr);
return ret;
}
}
public string serial {
set {
icsneocsharpPINVOKE.neoevent_t_serial_set(swigCPtr, value);
}
get {
string ret = icsneocsharpPINVOKE.neoevent_t_serial_get(swigCPtr);
return ret;
}
}
public SWIGTYPE_p_unsigned_char reserved {
set {
icsneocsharpPINVOKE.neoevent_t_reserved_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value));
}
get {
global::System.IntPtr cPtr = icsneocsharpPINVOKE.neoevent_t_reserved_get(swigCPtr);
SWIGTYPE_p_unsigned_char ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
return ret;
}
}
public neoevent_t() : this(icsneocsharpPINVOKE.new_neoevent_t(), true) {
}
}
+155
View File
@@ -0,0 +1,155 @@
//------------------------------------------------------------------------------
// <auto-generated />
//
// This file was automatically generated by SWIG (http://www.swig.org).
// Version 4.0.0
//
// Do not make changes to this file unless you know what you are doing--modify
// the SWIG interface file instead.
//------------------------------------------------------------------------------
public class neomessage_can_t : global::System.IDisposable {
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
protected bool swigCMemOwn;
internal neomessage_can_t(global::System.IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(neomessage_can_t obj) {
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
~neomessage_can_t() {
Dispose(false);
}
public void Dispose() {
Dispose(true);
global::System.GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing) {
lock(this) {
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
icsneocsharpPINVOKE.delete_neomessage_can_t(swigCPtr);
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
}
}
public neomessage_statusbitfield_t status {
set {
icsneocsharpPINVOKE.neomessage_can_t_status_set(swigCPtr, neomessage_statusbitfield_t.getCPtr(value));
}
get {
global::System.IntPtr cPtr = icsneocsharpPINVOKE.neomessage_can_t_status_get(swigCPtr);
neomessage_statusbitfield_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new neomessage_statusbitfield_t(cPtr, false);
return ret;
}
}
public ulong timestamp {
set {
icsneocsharpPINVOKE.neomessage_can_t_timestamp_set(swigCPtr, value);
}
get {
ulong ret = icsneocsharpPINVOKE.neomessage_can_t_timestamp_get(swigCPtr);
return ret;
}
}
public ulong timestampReserved {
set {
icsneocsharpPINVOKE.neomessage_can_t_timestampReserved_set(swigCPtr, value);
}
get {
ulong ret = icsneocsharpPINVOKE.neomessage_can_t_timestampReserved_get(swigCPtr);
return ret;
}
}
public byte[] data {
set {
icsneocsharpPINVOKE.neomessage_can_t_data_set(swigCPtr, value);
}
get {
byte[] ret = new byte[this.length];
System.IntPtr data = icsneocsharpPINVOKE.neomessage_can_t_data_get(swigCPtr);
System.Runtime.InteropServices.Marshal.Copy(data, ret, 0, (int)this.length);
return ret;
}
}
public uint length {
set {
icsneocsharpPINVOKE.neomessage_can_t_length_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_can_t_length_get(swigCPtr);
return ret;
}
}
public uint arbid {
set {
icsneocsharpPINVOKE.neomessage_can_t_arbid_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_can_t_arbid_get(swigCPtr);
return ret;
}
}
public ushort netid {
set {
icsneocsharpPINVOKE.neomessage_can_t_netid_set(swigCPtr, value);
}
get {
ushort ret = icsneocsharpPINVOKE.neomessage_can_t_netid_get(swigCPtr);
return ret;
}
}
public byte type {
set {
icsneocsharpPINVOKE.neomessage_can_t_type_set(swigCPtr, value);
}
get {
byte ret = icsneocsharpPINVOKE.neomessage_can_t_type_get(swigCPtr);
return ret;
}
}
public byte dlcOnWire {
set {
icsneocsharpPINVOKE.neomessage_can_t_dlcOnWire_set(swigCPtr, value);
}
get {
byte ret = icsneocsharpPINVOKE.neomessage_can_t_dlcOnWire_get(swigCPtr);
return ret;
}
}
public SWIGTYPE_p_unsigned_char reserved {
set {
icsneocsharpPINVOKE.neomessage_can_t_reserved_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value));
}
get {
global::System.IntPtr cPtr = icsneocsharpPINVOKE.neomessage_can_t_reserved_get(swigCPtr);
SWIGTYPE_p_unsigned_char ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
return ret;
}
}
public neomessage_can_t() : this(icsneocsharpPINVOKE.new_neomessage_can_t(), true) {
}
}
+156
View File
@@ -0,0 +1,156 @@
//------------------------------------------------------------------------------
// <auto-generated />
//
// This file was automatically generated by SWIG (http://www.swig.org).
// Version 4.0.0
//
// Do not make changes to this file unless you know what you are doing--modify
// the SWIG interface file instead.
//------------------------------------------------------------------------------
public class neomessage_eth_t : global::System.IDisposable {
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
protected bool swigCMemOwn;
internal neomessage_eth_t(global::System.IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(neomessage_eth_t obj) {
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
~neomessage_eth_t() {
Dispose(false);
}
public void Dispose() {
Dispose(true);
global::System.GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing) {
lock(this) {
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
icsneocsharpPINVOKE.delete_neomessage_eth_t(swigCPtr);
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
}
}
public neomessage_statusbitfield_t status {
set {
icsneocsharpPINVOKE.neomessage_eth_t_status_set(swigCPtr, neomessage_statusbitfield_t.getCPtr(value));
}
get {
global::System.IntPtr cPtr = icsneocsharpPINVOKE.neomessage_eth_t_status_get(swigCPtr);
neomessage_statusbitfield_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new neomessage_statusbitfield_t(cPtr, false);
return ret;
}
}
public ulong timestamp {
set {
icsneocsharpPINVOKE.neomessage_eth_t_timestamp_set(swigCPtr, value);
}
get {
ulong ret = icsneocsharpPINVOKE.neomessage_eth_t_timestamp_get(swigCPtr);
return ret;
}
}
public ulong timestampReserved {
set {
icsneocsharpPINVOKE.neomessage_eth_t_timestampReserved_set(swigCPtr, value);
}
get {
ulong ret = icsneocsharpPINVOKE.neomessage_eth_t_timestampReserved_get(swigCPtr);
return ret;
}
}
public byte[] data {
set {
icsneocsharpPINVOKE.neomessage_eth_t_data_set(swigCPtr, value);
}
get {
byte[] ret = new byte[this.length];
System.IntPtr data = icsneocsharpPINVOKE.neomessage_eth_t_data_get(swigCPtr);
System.Runtime.InteropServices.Marshal.Copy(data, ret, 0, (int)this.length);
return ret;
}
}
public uint length {
set {
icsneocsharpPINVOKE.neomessage_eth_t_length_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_eth_t_length_get(swigCPtr);
return ret;
}
}
public byte preemptionFlags {
set {
icsneocsharpPINVOKE.neomessage_eth_t_preemptionFlags_set(swigCPtr, value);
}
get {
byte ret = icsneocsharpPINVOKE.neomessage_eth_t_preemptionFlags_get(swigCPtr);
return ret;
}
}
public SWIGTYPE_p_unsigned_char reservedHeader {
set {
icsneocsharpPINVOKE.neomessage_eth_t_reservedHeader_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value));
}
get {
global::System.IntPtr cPtr = icsneocsharpPINVOKE.neomessage_eth_t_reservedHeader_get(swigCPtr);
SWIGTYPE_p_unsigned_char ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
return ret;
}
}
public ushort netid {
set {
icsneocsharpPINVOKE.neomessage_eth_t_netid_set(swigCPtr, value);
}
get {
ushort ret = icsneocsharpPINVOKE.neomessage_eth_t_netid_get(swigCPtr);
return ret;
}
}
public byte type {
set {
icsneocsharpPINVOKE.neomessage_eth_t_type_set(swigCPtr, value);
}
get {
byte ret = icsneocsharpPINVOKE.neomessage_eth_t_type_get(swigCPtr);
return ret;
}
}
public SWIGTYPE_p_unsigned_char reserved {
set {
icsneocsharpPINVOKE.neomessage_eth_t_reserved_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value));
}
get {
global::System.IntPtr cPtr = icsneocsharpPINVOKE.neomessage_eth_t_reserved_get(swigCPtr);
SWIGTYPE_p_unsigned_char ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
return ret;
}
}
public neomessage_eth_t() : this(icsneocsharpPINVOKE.new_neomessage_eth_t(), true) {
}
}
@@ -0,0 +1,610 @@
//------------------------------------------------------------------------------
// <auto-generated />
//
// This file was automatically generated by SWIG (http://www.swig.org).
// Version 4.0.0
//
// Do not make changes to this file unless you know what you are doing--modify
// the SWIG interface file instead.
//------------------------------------------------------------------------------
public class neomessage_statusbitfield_t : global::System.IDisposable {
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
protected bool swigCMemOwn;
internal neomessage_statusbitfield_t(global::System.IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(neomessage_statusbitfield_t obj) {
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
~neomessage_statusbitfield_t() {
Dispose(false);
}
public void Dispose() {
Dispose(true);
global::System.GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing) {
lock(this) {
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
icsneocsharpPINVOKE.delete_neomessage_statusbitfield_t(swigCPtr);
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
}
}
public uint globalError {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_globalError_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_globalError_get(swigCPtr);
return ret;
}
}
public uint transmitMessage {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_transmitMessage_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_transmitMessage_get(swigCPtr);
return ret;
}
}
public uint extendedFrame {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_extendedFrame_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_extendedFrame_get(swigCPtr);
return ret;
}
}
public uint remoteFrame {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_remoteFrame_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_remoteFrame_get(swigCPtr);
return ret;
}
}
public uint crcError {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_crcError_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_crcError_get(swigCPtr);
return ret;
}
}
public uint canErrorPassive {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_canErrorPassive_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_canErrorPassive_get(swigCPtr);
return ret;
}
}
public uint incompleteFrame {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_incompleteFrame_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_incompleteFrame_get(swigCPtr);
return ret;
}
}
public uint lostArbitration {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_lostArbitration_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_lostArbitration_get(swigCPtr);
return ret;
}
}
public uint undefinedError {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_undefinedError_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_undefinedError_get(swigCPtr);
return ret;
}
}
public uint canBusOff {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_canBusOff_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_canBusOff_get(swigCPtr);
return ret;
}
}
public uint canErrorWarning {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_canErrorWarning_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_canErrorWarning_get(swigCPtr);
return ret;
}
}
public uint canBusShortedPlus {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_canBusShortedPlus_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_canBusShortedPlus_get(swigCPtr);
return ret;
}
}
public uint canBusShortedGround {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_canBusShortedGround_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_canBusShortedGround_get(swigCPtr);
return ret;
}
}
public uint checksumError {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_checksumError_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_checksumError_get(swigCPtr);
return ret;
}
}
public uint badMessageBitTimeError {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_badMessageBitTimeError_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_badMessageBitTimeError_get(swigCPtr);
return ret;
}
}
public uint ifrData {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_ifrData_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_ifrData_get(swigCPtr);
return ret;
}
}
public uint hardwareCommError {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_hardwareCommError_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_hardwareCommError_get(swigCPtr);
return ret;
}
}
public uint expectedLengthError {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_expectedLengthError_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_expectedLengthError_get(swigCPtr);
return ret;
}
}
public uint incomingNoMatch {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_incomingNoMatch_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_incomingNoMatch_get(swigCPtr);
return ret;
}
}
public uint statusBreak {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_statusBreak_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_statusBreak_get(swigCPtr);
return ret;
}
}
public uint avsiRecOverflow {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_avsiRecOverflow_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_avsiRecOverflow_get(swigCPtr);
return ret;
}
}
public uint testTrigger {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_testTrigger_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_testTrigger_get(swigCPtr);
return ret;
}
}
public uint audioComment {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_audioComment_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_audioComment_get(swigCPtr);
return ret;
}
}
public uint gpsData {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_gpsData_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_gpsData_get(swigCPtr);
return ret;
}
}
public uint analogDigitalInput {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_analogDigitalInput_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_analogDigitalInput_get(swigCPtr);
return ret;
}
}
public uint textComment {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_textComment_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_textComment_get(swigCPtr);
return ret;
}
}
public uint networkMessageType {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_networkMessageType_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_networkMessageType_get(swigCPtr);
return ret;
}
}
public uint vsiTXUnderrun {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_vsiTXUnderrun_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_vsiTXUnderrun_get(swigCPtr);
return ret;
}
}
public uint vsiIFRCRCBit {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_vsiIFRCRCBit_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_vsiIFRCRCBit_get(swigCPtr);
return ret;
}
}
public uint initMessage {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_initMessage_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_initMessage_get(swigCPtr);
return ret;
}
}
public uint flexraySecondStartupFrame {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_flexraySecondStartupFrame_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_flexraySecondStartupFrame_get(swigCPtr);
return ret;
}
}
public uint extended {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_extended_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_extended_get(swigCPtr);
return ret;
}
}
public uint hasValue {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_hasValue_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_hasValue_get(swigCPtr);
return ret;
}
}
public uint valueIsBoolean {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_valueIsBoolean_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_valueIsBoolean_get(swigCPtr);
return ret;
}
}
public uint highVoltage {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_highVoltage_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_highVoltage_get(swigCPtr);
return ret;
}
}
public uint longMessage {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_longMessage_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_longMessage_get(swigCPtr);
return ret;
}
}
public uint globalChange {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_globalChange_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_globalChange_get(swigCPtr);
return ret;
}
}
public uint errorFrame {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_errorFrame_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_errorFrame_get(swigCPtr);
return ret;
}
}
public uint endOfLongMessage {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_endOfLongMessage_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_endOfLongMessage_get(swigCPtr);
return ret;
}
}
public uint linErrorRXBreakNotZero {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_linErrorRXBreakNotZero_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_linErrorRXBreakNotZero_get(swigCPtr);
return ret;
}
}
public uint linErrorRXBreakTooShort {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_linErrorRXBreakTooShort_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_linErrorRXBreakTooShort_get(swigCPtr);
return ret;
}
}
public uint linErrorRXSyncNot55 {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_linErrorRXSyncNot55_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_linErrorRXSyncNot55_get(swigCPtr);
return ret;
}
}
public uint linErrorRXDataGreaterEight {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_linErrorRXDataGreaterEight_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_linErrorRXDataGreaterEight_get(swigCPtr);
return ret;
}
}
public uint linErrorTXRXMismatch {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_linErrorTXRXMismatch_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_linErrorTXRXMismatch_get(swigCPtr);
return ret;
}
}
public uint linErrorMessageIDParity {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_linErrorMessageIDParity_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_linErrorMessageIDParity_get(swigCPtr);
return ret;
}
}
public uint linSyncFrameError {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_linSyncFrameError_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_linSyncFrameError_get(swigCPtr);
return ret;
}
}
public uint linIDFrameError {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_linIDFrameError_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_linIDFrameError_get(swigCPtr);
return ret;
}
}
public uint linSlaveByteError {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_linSlaveByteError_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_linSlaveByteError_get(swigCPtr);
return ret;
}
}
public uint rxTimeoutError {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_rxTimeoutError_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_rxTimeoutError_get(swigCPtr);
return ret;
}
}
public uint linNoSlaveData {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_linNoSlaveData_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_linNoSlaveData_get(swigCPtr);
return ret;
}
}
public uint canfdESI {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_canfdESI_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_canfdESI_get(swigCPtr);
return ret;
}
}
public uint canfdIDE {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_canfdIDE_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_canfdIDE_get(swigCPtr);
return ret;
}
}
public uint canfdRTR {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_canfdRTR_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_canfdRTR_get(swigCPtr);
return ret;
}
}
public uint canfdFDF {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_canfdFDF_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_canfdFDF_get(swigCPtr);
return ret;
}
}
public uint canfdBRS {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_canfdBRS_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_statusbitfield_t_canfdBRS_get(swigCPtr);
return ret;
}
}
public SWIGTYPE_p_unsigned_int statusBitfield {
set {
icsneocsharpPINVOKE.neomessage_statusbitfield_t_statusBitfield_set(swigCPtr, SWIGTYPE_p_unsigned_int.getCPtr(value));
}
get {
global::System.IntPtr cPtr = icsneocsharpPINVOKE.neomessage_statusbitfield_t_statusBitfield_get(swigCPtr);
SWIGTYPE_p_unsigned_int ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_int(cPtr, false);
return ret;
}
}
public neomessage_statusbitfield_t() : this(icsneocsharpPINVOKE.new_neomessage_statusbitfield_t(), true) {
}
}
+146
View File
@@ -0,0 +1,146 @@
//------------------------------------------------------------------------------
// <auto-generated />
//
// This file was automatically generated by SWIG (http://www.swig.org).
// Version 4.0.0
//
// Do not make changes to this file unless you know what you are doing--modify
// the SWIG interface file instead.
//------------------------------------------------------------------------------
public class neomessage_t : global::System.IDisposable {
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
protected bool swigCMemOwn;
internal neomessage_t(global::System.IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(neomessage_t obj) {
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
~neomessage_t() {
Dispose(false);
}
public void Dispose() {
Dispose(true);
global::System.GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing) {
lock(this) {
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
icsneocsharpPINVOKE.delete_neomessage_t(swigCPtr);
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
}
}
public neomessage_statusbitfield_t status {
set {
icsneocsharpPINVOKE.neomessage_t_status_set(swigCPtr, neomessage_statusbitfield_t.getCPtr(value));
}
get {
global::System.IntPtr cPtr = icsneocsharpPINVOKE.neomessage_t_status_get(swigCPtr);
neomessage_statusbitfield_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new neomessage_statusbitfield_t(cPtr, false);
return ret;
}
}
public ulong timestamp {
set {
icsneocsharpPINVOKE.neomessage_t_timestamp_set(swigCPtr, value);
}
get {
ulong ret = icsneocsharpPINVOKE.neomessage_t_timestamp_get(swigCPtr);
return ret;
}
}
public ulong timestampReserved {
set {
icsneocsharpPINVOKE.neomessage_t_timestampReserved_set(swigCPtr, value);
}
get {
ulong ret = icsneocsharpPINVOKE.neomessage_t_timestampReserved_get(swigCPtr);
return ret;
}
}
public byte[] data {
set {
icsneocsharpPINVOKE.neomessage_t_data_set(swigCPtr, value);
}
get {
byte[] ret = new byte[this.length];
System.IntPtr data = icsneocsharpPINVOKE.neomessage_t_data_get(swigCPtr);
System.Runtime.InteropServices.Marshal.Copy(data, ret, 0, (int)this.length);
return ret;
}
}
public uint length {
set {
icsneocsharpPINVOKE.neomessage_t_length_set(swigCPtr, value);
}
get {
uint ret = icsneocsharpPINVOKE.neomessage_t_length_get(swigCPtr);
return ret;
}
}
public SWIGTYPE_p_unsigned_char header {
set {
icsneocsharpPINVOKE.neomessage_t_header_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value));
}
get {
global::System.IntPtr cPtr = icsneocsharpPINVOKE.neomessage_t_header_get(swigCPtr);
SWIGTYPE_p_unsigned_char ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
return ret;
}
}
public ushort netid {
set {
icsneocsharpPINVOKE.neomessage_t_netid_set(swigCPtr, value);
}
get {
ushort ret = icsneocsharpPINVOKE.neomessage_t_netid_get(swigCPtr);
return ret;
}
}
public byte type {
set {
icsneocsharpPINVOKE.neomessage_t_type_set(swigCPtr, value);
}
get {
byte ret = icsneocsharpPINVOKE.neomessage_t_type_get(swigCPtr);
return ret;
}
}
public SWIGTYPE_p_unsigned_char reserved {
set {
icsneocsharpPINVOKE.neomessage_t_reserved_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value));
}
get {
global::System.IntPtr cPtr = icsneocsharpPINVOKE.neomessage_t_reserved_get(swigCPtr);
SWIGTYPE_p_unsigned_char ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
return ret;
}
}
public neomessage_t() : this(icsneocsharpPINVOKE.new_neomessage_t(), true) {
}
}
+119
View File
@@ -0,0 +1,119 @@
//------------------------------------------------------------------------------
// <auto-generated />
//
// This file was automatically generated by SWIG (http://www.swig.org).
// Version 4.0.0
//
// Do not make changes to this file unless you know what you are doing--modify
// the SWIG interface file instead.
//------------------------------------------------------------------------------
public class neoversion_t : global::System.IDisposable {
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
protected bool swigCMemOwn;
internal neoversion_t(global::System.IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
}
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(neoversion_t obj) {
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
~neoversion_t() {
Dispose(false);
}
public void Dispose() {
Dispose(true);
global::System.GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing) {
lock(this) {
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwn) {
swigCMemOwn = false;
icsneocsharpPINVOKE.delete_neoversion_t(swigCPtr);
}
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
}
}
}
public ushort major {
set {
icsneocsharpPINVOKE.neoversion_t_major_set(swigCPtr, value);
}
get {
ushort ret = icsneocsharpPINVOKE.neoversion_t_major_get(swigCPtr);
return ret;
}
}
public ushort minor {
set {
icsneocsharpPINVOKE.neoversion_t_minor_set(swigCPtr, value);
}
get {
ushort ret = icsneocsharpPINVOKE.neoversion_t_minor_get(swigCPtr);
return ret;
}
}
public ushort patch {
set {
icsneocsharpPINVOKE.neoversion_t_patch_set(swigCPtr, value);
}
get {
ushort ret = icsneocsharpPINVOKE.neoversion_t_patch_get(swigCPtr);
return ret;
}
}
public string metadata {
set {
icsneocsharpPINVOKE.neoversion_t_metadata_set(swigCPtr, value);
}
get {
string ret = icsneocsharpPINVOKE.neoversion_t_metadata_get(swigCPtr);
return ret;
}
}
public string buildBranch {
set {
icsneocsharpPINVOKE.neoversion_t_buildBranch_set(swigCPtr, value);
}
get {
string ret = icsneocsharpPINVOKE.neoversion_t_buildBranch_get(swigCPtr);
return ret;
}
}
public string buildTag {
set {
icsneocsharpPINVOKE.neoversion_t_buildTag_set(swigCPtr, value);
}
get {
string ret = icsneocsharpPINVOKE.neoversion_t_buildTag_get(swigCPtr);
return ret;
}
}
public string reserved {
set {
icsneocsharpPINVOKE.neoversion_t_reserved_set(swigCPtr, value);
}
get {
string ret = icsneocsharpPINVOKE.neoversion_t_reserved_get(swigCPtr);
return ret;
}
}
public neoversion_t() : this(icsneocsharpPINVOKE.new_neoversion_t(), true) {
}
}
+13
View File
@@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.2)
project(icsneojava VERSION 0.2.0)
find_package(Java REQUIRED)
find_package(JNI REQUIRED)
include(UseJava)
include_directories(${JNI_INCLUDE_DIRS})
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../third-party/libicsneo ${CMAKE_CURRENT_BINARY_DIR}/third-party/libicsneo)
add_library(icsneojava SHARED ${CMAKE_CURRENT_SOURCE_DIR}/java_wrap.c)
target_link_libraries(icsneojava icsneoc)
+91
View File
@@ -0,0 +1,91 @@
# libicsneo Java Example
This is an example console application which uses icsneojava to connect to an Intrepid Control Systems hardware device. It has both interactive and simple examples for sending and receiving CAN & CAN FD traffic.
## Cloning
This will create a copy of the repository on your local machine.
Run:
```shell
git clone https://github.com/intrepidcs/libicsneo-examples -b v0.2.0-dev --recursive
```
Alternatively, if you cloned without the `--recursive flag`, you must enter the `libicsneo-examples` folder and run the following:
```shell
git submodule update --recursive --init
```
If you haven't done this, `third-party/libicsneo` will be empty and you won't be able to build!
## Windows
### Building the DLL's
#### icsneoc
First, we are going to build the icsneoc library into a .dll file that is used by the Java wrapper to access the library functions.
1. Change directories to the `libicsneo-examples/third-party/libicsneo` folder.
2. Create a build directory by running `mkdir -p build`
3. Enter the build directory with `cd build`
4. Run `cmake ..` to generate your Makefile.
* Hint! Running `cmake -DCMAKE_BUILD_TYPE=Debug ..` will generate the proper scripts to build debug, and `cmake -DCMAKE_BUILD_TYPE=Release ..` will generate the proper scripts to build with all optimizations on.
5. Run `cmake --build .` to build the library.
* Hint! Speed up your build by using multiple processors! Use `make -j#` where `#` is the number of cores/threads your system has plus one. For instance, on a standard 8 thread Intel i7, you might use `-j9` for an ~8x speedup.
6. The `icsneoc.dll` file will be generated in `libicsneo-examples/third-party/libicsneo/build/Debug`. Move this file to the `/C/Windows/System32` folder.
#### icsneojava
Next, we are going to build the wrapper functions into a .dll file that is used to access the library functions in Java.
1. Change directories to the `libicsneo-examples/libicsneojava-example` folder.
2. Create a build directory by running `mkdir -p build`
3. Enter the build directory with `cd build`
4. Run `cmake ..` to generate your Makefile.
* Hint! Running `cmake -DCMAKE_BUILD_TYPE=Debug ..` will generate the proper scripts to build debug, and `cmake -DCMAKE_BUILD_TYPE=Release ..` will generate the proper scripts to build with all optimizations on.
5. Run `cmake --build .` to build the library.
* Hint! Speed up your build by using multiple processors! Use `make -j#` where `#` is the number of cores/threads your system has plus one. For instance, on a standard 8 thread Intel i7, you might use `-j9` for an ~8x speedup.
6. The `icsneojava.dll` file will be generated in `libicsneo-examples/libicsneojava-example/build/Debug`. Move this file to the `/C/Windows/System32` folder.
### Building and running the example program
1. Change directories to the `libicsneo-examples/libicsneojava-example/src` folder.
2. Run `javac Run.java`
3. Run `java Run`
## Ubuntu 18.04 LTS
### Building the .so's
#### icsneoc
1. Install dependencies with `sudo apt update` then `sudo apt install build-essential cmake libusb-1.0-0-dev libpcap0.8-dev`
2. Change directories to `libicsneo-examples/third-party/libicsneo` and create a build directory by running `mkdir -p build`
3. Enter the build directory with `cd build`
4. Run `cmake ..` to generate your Makefile.
* Hint! Running `cmake -DCMAKE_BUILD_TYPE=Debug ..` will generate the proper scripts to build debug, and `cmake -DCMAKE_BUILD_TYPE=Release ..` will generate the proper scripts to build with all optimizations on.
5. Run `make` to build the library.
* Hint! Speed up your build by using multiple processors! Use `make -j#` where `#` is the number of cores/threads your system has plus one. For instance, on a standard 8 thread Intel i7, you might use `-j9` for an ~8x speedup.
6. Run `sudo cp libicsneoc.so /usr/lib` so that it can be found via the default ubuntu .so search path. For more information, see the [ld.so.8 man page](http://man7.org/linux/man-pages/man8/ld.so.8.html).
#### icsneojava
Next, we are going to build the wrapper functions into a .so file that is used to access the library functions in Java.
1. Change directories to the `libicsneo-examples/libicsneojava-example` folder.
2. Create a build directory by running `mkdir -p build`
3. Enter the build directory with `cd build`
4. Run `cmake ..` to generate your Makefile.
* Hint! Running `cmake -DCMAKE_BUILD_TYPE=Debug ..` will generate the proper scripts to build debug, and `cmake -DCMAKE_BUILD_TYPE=Release ..` will generate the proper scripts to build with all optimizations on.
5. Run `cmake --build .` to build the library.
* Hint! Speed up your build by using multiple processors! Use `make -j#` where `#` is the number of cores/threads your system has plus one. For instance, on a standard 8 thread Intel i7, you might use `-j9` for an ~8x speedup.
6. The `icsneojava.so` file will be generated in `libicsneo-examples/libicsneojava-example/build/Debug`. Run `sudo cp libicsneojava.so /usr/lib` so that it can be found via the default ubuntu .so search path. For more information, see the [ld.so.8 man page](http://man7.org/linux/man-pages/man8/ld.so.8.html).
### Building and running the example program
1. Change directories to the `libicsneo-examples/libicsneojava-example/src` folder.
2. Run `javac Run.java`
3. Run `java Run`
+125
View File
@@ -0,0 +1,125 @@
%module icsneojava
%include <windows.i>
%include <typemaps.i>
%include <stdint.i>
%include <carrays.i>
%include <various.i>
%include <java.i>
%include <arrays_java.i>
#define DLLExport
%typemap(jni) uint8_t const *data "jbyteArray"
%typemap(jtype) uint8_t const *data "byte[]"
%typemap(jstype) uint8_t const *data "byte[]"
%typemap(javain) uint8_t const *data "$javainput"
%typemap(javaout) uint8_t const *data {
return $jnicall;
}
%typemap(out) uint8_t const *data %{
$result = (*jenv)->NewByteArray(jenv, (int) arg1->length);
(*jenv)->SetByteArrayRegion(jenv, $result, 0, (int) arg1->length, $1);
%}
%typemap(in) uint8_t const *data %{
bool isCopy;
arg2 = (*jenv)->GetByteArrayElements(jenv, jarg2, &isCopy);
%}
%typemap(jni) char *str "jobject"
%typemap(jtype) char *str "StringBuffer"
%typemap(jstype) char *str "StringBuffer"
/* How to convert Java(JNI) type to requested C type */
%typemap(in) char *str {
$1 = NULL;
if($input != NULL) {
/* Get the String from the StringBuffer */
jmethodID setLengthID;
jclass strClass = (*jenv)->GetObjectClass(jenv, $input);
jmethodID toStringID = (*jenv)->GetMethodID(jenv, strClass, "toString", "()Ljava/lang/String;");
jstring js = (jstring) (*jenv)->CallObjectMethod(jenv, $input, toStringID);
/* Convert the String to a C string */
const char *pCharStr = (*jenv)->GetStringUTFChars(jenv, js, 0);
/* Take a copy of the C string as the typemap is for a non const C string */
jmethodID capacityID = (*jenv)->GetMethodID(jenv, strClass, "capacity", "()I");
jint capacity = (*jenv)->CallIntMethod(jenv, $input, capacityID);
$1 = (char *) malloc(capacity+1);
strcpy($1, pCharStr);
/* Release the UTF string we obtained with GetStringUTFChars */
(*jenv)->ReleaseStringUTFChars(jenv, js, pCharStr);
/* Zero the original StringBuffer, so we can replace it with the result */
setLengthID = (*jenv)->GetMethodID(jenv, strClass, "setLength", "(I)V");
(*jenv)->CallVoidMethod(jenv, $input, setLengthID, (jint) 0);
}
}
/* How to convert the C type to the Java(JNI) type */
%typemap(argout) char *str {
if($1 != NULL) {
/* Append the result to the empty StringBuffer */
jstring newString = (*jenv)->NewStringUTF(jenv, $1);
jclass strClass = (*jenv)->GetObjectClass(jenv, $input);
jmethodID appendStringID = (*jenv)->GetMethodID(jenv, strClass, "append", "(Ljava/lang/String;)Ljava/lang/StringBuffer;");
(*jenv)->CallObjectMethod(jenv, $input, appendStringID, newString);
/* Clean up the string object, no longer needed */
free($1);
$1 = NULL;
}
}
/* Prevent the default freearg typemap from being used */
%typemap(freearg) char *str ""
/* Convert the jstype to jtype typemap type */
%typemap(javain) char *str "$javainput"
%{
#include "icsneo/icsneoc.h"
%}
%apply int *INOUT {size_t *};
%ignore icsneo_addMessageCallback;
%ignore icsneo_removeMessageCallback;
%ignore icsneo_addEventCallback;
%ignore icsneo_removeEventCallback;
%include "icsneo/icsneoc.h"
%include "icsneo/device/neodevice.h"
%include "icsneo/communication/message/neomessage.h"
%include "icsneo/device/devicetype.h"
%include "icsneo/api/version.h"
%include "icsneo/api/event.h"
%include "icsneo/communication/network.h"
%inline %{
static neomessage_can_t* neomessage_can_t_cast(neomessage_t* msg) {
return (neomessage_can_t*) msg;
}
static neomessage_eth_t* neomessage_eth_t_cast(neomessage_t* msg) {
return (neomessage_eth_t*) msg;
}
static neomessage_t* from_can_neomessage_t_cast(neomessage_can_t* msg) {
return (neomessage_t*) msg;
}
static neomessage_t* from_eth_neomessage_t_cast(neomessage_eth_t* msg) {
return (neomessage_t*) msg;
}
%}
%array_functions(neodevice_t, neodevice_t_array);
%array_functions(neoevent_t, neoevent_t_array);
%array_functions(neomessage_t, neomessage_t_array);
File diff suppressed because it is too large Load Diff
+511
View File
@@ -0,0 +1,511 @@
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Scanner;
public class InteractiveExample {
private int msgLimit = 50000;
private neodevice_t selectedDevice;
private ArrayList<neodevice_t> devices = new ArrayList<neodevice_t>();
private int numDevices = 0;
private void printAllDevices() {
if(numDevices == 0) {
System.out.println("No devices found! Please scan for new devices.");
}
for(int i = 0; i < numDevices; i++) {
StringBuffer description = new StringBuffer(icsneojava.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION);
int[] maxLength = {icsneojava.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION};
if(icsneojava.icsneo_describeDevice(devices.get(i), description, maxLength)) {
System.out.print("[" + (i + 1) + "] " + description + "\tConnected: ");
if(icsneojava.icsneo_isOpen(devices.get(i))) {
System.out.print("Yes\t");
} else System.out.print("No\t");
System.out.print("Online: ");
if(icsneojava.icsneo_isOnline(devices.get(i))) {
System.out.print("Yes\t");
} else System.out.print("No\t");
System.out.print("Msg Polling: ");
if(icsneojava.icsneo_isMessagePollingEnabled(devices.get(i))) {
System.out.print("On\n");
} else System.out.print("Off\n");
} else {
System.out.println("Description for device " + (i + 1) + " not available!");
}
}
}
private int scanNewDevices() {
neodevice_t newDevices = icsneojava.new_neodevice_t_array(99);
int[] count = {10};
icsneojava.icsneo_findAllDevices(newDevices, count);
numDevices += count[0];
for(int i = 0; i < numDevices; i++) {
devices.add(icsneojava.neodevice_t_array_getitem(newDevices, i));
}
icsneojava.delete_neodevice_t_array(newDevices);
return count[0];
}
private void printMainMenu() {
System.out.println("Press the letter next to the function you want to use:");
System.out.println("A - List all devices");
System.out.println("B - Scan for new devices");
System.out.println("C - Open/close");
System.out.println("D - Go online/offline");
System.out.println("E - Enable/disable message polling");
System.out.println("F - Get messages");
System.out.println("G - Send message");
System.out.println("H - Get events");
System.out.println("I - Set HS CAN to 250K");
System.out.println("J - Set HS CAN to 500K");
System.out.println("X - Exit");
}
private void printLastError() {
neoevent_t error = new neoevent_t();
if(icsneojava.icsneo_getLastError(error))
System.out.println("Error 0x" + error.getEventNumber() + ": " + error.getDescription());
else
System.out.println("No errors found!");
}
private void printAPIEvents() {
neoevent_t events = icsneojava.new_neoevent_t_array(99);
int[] eventCount = {99};
if(icsneojava.icsneo_getEvents(events, eventCount)) {
if(eventCount[0] == 1) {
neoevent_t evt = icsneojava.neoevent_t_array_getitem(events, 0);
System.out.println("1 API event found!");
System.out.println("Event 0x" + evt.getEventNumber() + ": " + evt.getDescription());
} else {
System.out.println(eventCount[0] + " API events found!");
for(var i = 0; i < eventCount[0]; ++i) {
neoevent_t evt = icsneojava.neoevent_t_array_getitem(events, i);
System.out.println("Event 0x" + evt.getEventNumber() + ": " + evt.getDescription());
}
}
} else {
System.out.println("Failed to get API events!");
}
icsneojava.delete_neoevent_t_array(events);
}
private void printDeviceEvents(neodevice_t device) {
neoevent_t events = icsneojava.new_neoevent_t_array(99);
int[] eventCount = {99};
if(icsneojava.icsneo_getDeviceEvents(device, events, eventCount)) {
if(eventCount[0] == 1) {
neoevent_t evt = icsneojava.neoevent_t_array_getitem(events, 0);
System.out.println("1 device event found!");
System.out.println("Event 0x" + evt.getEventNumber() + ": " + evt.getDescription());
} else {
System.out.println(eventCount[0] + " device events found!");
for(int i = 0; i < eventCount[0]; ++i) {
neoevent_t evt = icsneojava.neoevent_t_array_getitem(events, i);
System.out.println("Event 0x" + evt.getEventNumber() + ": " + evt.getDescription());
}
}
} else {
System.out.println("Failed to get API events!");
}
icsneojava.delete_neoevent_t_array(events);
}
private char getCharInput(char[] allowed) {
boolean found = false;
char key = '0';
Scanner sc = new Scanner(System.in);
while(!found) {
key = sc.next().charAt(0);
System.out.println();
for(char compare : allowed) {
if(compare == key) {
found = true;
break;
}
}
if(!found) {
System.out.println("Input did not match expected options. Please try again.");
}
}
return key;
}
private neodevice_t selectDevice() {
System.out.println("Please select a device:");
printAllDevices();
System.out.println();
int selectedDeviceNum = 10;
while(selectedDeviceNum > numDevices) {
char deviceSelection = getCharInput(new char[] { '1', '2', '3', '4', '5', '6', '7', '8', '9' });
selectedDeviceNum = deviceSelection - '0';
if(selectedDeviceNum > numDevices) {
System.out.println("Selected device out of range!");
}
}
System.out.println();
return devices.get(selectedDeviceNum - 1);
}
public void run() {
neoversion_t version = icsneojava.icsneo_getVersion();
System.out.println("ICS libicsneojava.dll version " + version.getMajor() + "." + version.getMinor() + "." + version.getPatch());
System.out.println();
while(true) {
printMainMenu();
System.out.println();
char input = getCharInput(new char[] { 'A', 'a', 'B', 'b', 'C', 'c', 'D', 'd', 'E', 'e', 'F', 'f', 'G', 'g', 'H', 'h', 'I', 'i', 'J', 'j', 'X', 'x' });
System.out.println();
switch(input) {
// List current devices
case 'A':
case 'a':
printAllDevices();
System.out.println();
break;
// Scan for new devices
case 'B':
case 'b': {
var numNewDevices = scanNewDevices();
if(numNewDevices == 1) {
System.out.println("1 new device found!");
} else {
System.out.println(numNewDevices + " new devices found!");
}
printAllDevices();
System.out.println();
break;
}
// Open/close a device
case 'C':
case 'c': {
// Select a device and get its description
if(numDevices == 0) {
System.out.println("No devices found! Please scan for new devices.\n");
break;
}
selectedDevice = selectDevice();
// Get the product description for the device
StringBuffer description = new StringBuffer(icsneojava.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION);
int[] maxLength = {icsneojava.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION};
icsneojava.icsneo_describeDevice(selectedDevice, description, maxLength);
System.out.println("Would you like to open or close " + description + "?");
System.out.println("[1] Open\n[2] Close\n[3] Cancel\n");
char option = getCharInput(new char[] { '1', '2', '3' });
System.out.println();
switch(option) {
case '1':
// Attempt to open the selected device
if(icsneojava.icsneo_openDevice(selectedDevice)) {
System.out.println(description + " successfully opened!\n");
} else {
System.out.println(description + " failed to open!\n");
printLastError();
System.out.println();
}
break;
case '2':
// Attempt to close the device
if(icsneojava.icsneo_closeDevice(selectedDevice)) {
numDevices--;
System.out.println("Successfully closed " + description + "!\n");
devices.remove(selectedDevice);
selectedDevice = null;
} else {
System.out.println("Failed to close " + description + "!\n");
printLastError();
System.out.println();
}
break;
default:
System.out.println("Canceling!\n");
break;
}
break;
}
// Go online/offline
case 'D':
case 'd': {
// Select a device and get its description
if(numDevices == 0) {
System.out.println("No devices found! Please scan for new devices.\n");
break;
}
selectedDevice = selectDevice();
// Get the product description for the device
StringBuffer description = new StringBuffer(icsneojava.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION);
int[] maxLength = {icsneojava.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION};
icsneojava.icsneo_describeDevice(selectedDevice, description, maxLength);
System.out.println("Would you like to have " + description + " go online or offline?");
System.out.println("[1] Online\n[2] Offline\n[3] Cancel\n");
char option = getCharInput(new char[] { '1', '2', '3' });
System.out.println();
switch(option) {
case '1':
// Attempt to go online
if(icsneojava.icsneo_goOnline(selectedDevice)) {
System.out.println(description + " successfully went online!\n");
} else {
System.out.println(description + " failed to go online!\n");
printLastError();
System.out.println();
}
break;
case '2':
// Attempt to go offline
if(icsneojava.icsneo_goOffline(selectedDevice)) {
System.out.println(description + " successfully went offline!\n");
} else {
System.out.println(description + " failed to go offline!\n");
printLastError();
System.out.println();
}
break;
default:
System.out.println("Canceling!\n");
break;
}
break;
}
// Enable/disable message polling
case 'E':
case 'e': {
// Select a device and get its description
if(numDevices == 0) {
System.out.println("No devices found! Please scan for new devices.\n");
break;
}
selectedDevice = selectDevice();
// Get the product description for the device
StringBuffer description = new StringBuffer(icsneojava.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION);
int[] maxLength = {icsneojava.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION};
icsneojava.icsneo_describeDevice(selectedDevice, description, maxLength);
System.out.println("Would you like to enable or disable message polling for " + description + "?");
System.out.println("[1] Enable\n[2] Disable\n[3] Cancel\n");
char option = getCharInput(new char[] { '1', '2', '3' });
System.out.println();
switch(option) {
case '1':
// Attempt to enable message polling
if(icsneojava.icsneo_enableMessagePolling(selectedDevice)) {
System.out.println("Successfully enabled message polling for " + description + "!\n");
} else {
System.out.println("Failed to enable message polling for " + description + "!\n");
printLastError();
System.out.println();
}
// Manually setting the polling message limit as done below is optional
// It will default to 20k if not set
// Attempt to set the polling message limit
if(icsneojava.icsneo_setPollingMessageLimit(selectedDevice, msgLimit)) {
System.out.println("Successfully set message polling limit for " + description + "!\n");
} else {
System.out.println("Failed to set polling message limit for " + description + "!\n");
printLastError();
System.out.println();
}
break;
case '2':
// Attempt to disable message polling
if(icsneojava.icsneo_disableMessagePolling(selectedDevice)) {
System.out.println("Successfully disabled message polling for " + description + "!\n");
} else {
System.out.println("Failed to disable message polling for " + description + "!\n");
printLastError();
System.out.println();
}
break;
default:
System.out.println("Canceling!\n");
break;
}
}
break;
case 'F':
case 'f': {
// Select a device and get its description
if(numDevices == 0) {
System.out.println("No devices found! Please scan for new devices.\n");
break;
}
selectedDevice = selectDevice();
// Get the product description for the device
StringBuffer description = new StringBuffer(icsneojava.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION);
int[] maxLength = {icsneojava.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION};
icsneojava.icsneo_describeDevice(selectedDevice, description, maxLength);
// Prepare the neomessage_t array and size for reading in the messages
neomessage_t msgs = icsneojava.new_neomessage_t_array((int)msgLimit);
int[] msgCount = {msgLimit};
if(!icsneojava.icsneo_getMessages(selectedDevice, msgs, msgCount, BigInteger.ZERO)) {
System.out.println("Failed to get messages for " + description + "!\n");
icsneojava.delete_neomessage_t_array(msgs);
printLastError();
System.out.println();
break;
}
if(msgCount[0] == 1) {
System.out.println("1 message received from " + description + "!");
} else {
System.out.println(msgCount[0] + " messages received from " + description + "!");
}
// Print out the received messages
for(int i = 0; i < msgCount[0]; i++) {
neomessage_t msg = icsneojava.neomessage_t_array_getitem(msgs, i);
if(msg.getType() == icsneojava.ICSNEO_NETWORK_TYPE_CAN) {
System.out.print("\t0x" + String.format("%03x", icsneojava.neomessage_can_t_cast(msg).getArbid()) + " [" + msg.getLength() + "] ");
for(int j = 0; j < msg.getLength(); j++) {
System.out.print(String.format("%02x ", icsneojava.neomessage_can_t_cast(msg).getData()[j]));
}
System.out.println("(" + msg.getTimestamp() + ")");
} else {
if(msg.getNetid() != 0)
System.out.println("\tMessage on netid " + msg.getNetid() + " with length " + msg.getLength());
}
}
icsneojava.delete_neomessage_t_array(msgs);
break;
}
// Send message
case 'G':
case 'g': {
// Select a device and get its description
if(numDevices == 0) {
System.out.println("No devices found! Please scan for new devices.\n");
break;
}
selectedDevice = selectDevice();
// Get the product description for the device
StringBuffer description = new StringBuffer(icsneojava.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION);
int[] maxLength = {icsneojava.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION};
icsneojava.icsneo_describeDevice(selectedDevice, description, maxLength);
// Start generating sample msg
neomessage_can_t msg = new neomessage_can_t();
msg.setArbid(0x120);
msg.setLength(6);
msg.setNetid(icsneojava.ICSNEO_NETID_HSCAN);
msg.setData(new byte[] { (byte) 0xaa, (byte) 0xbb, (byte) 0xcc, (byte) 0xdd, (byte) 0xee, (byte) 0xff});
msg.getStatus().setCanfdFDF(0);
msg.getStatus().setExtendedFrame(0);
msg.getStatus().setCanfdBRS(0);
// End generating sample msg
// Attempt to transmit the sample msg
if(icsneojava.icsneo_transmit(selectedDevice, icsneojava.from_can_neomessage_t_cast(msg))) {
System.out.println("Message transmit successful!");
} else {
System.out.println("Failed to transmit message to " + description + "!\n");
printLastError();
System.out.println();
}
break;
}
// Get events
case 'H':
case 'h':
printAPIEvents();
System.out.println();
break;
// Set HS CAN to 250k
case 'I':
case 'i': {
// Select a device and get its description
if(numDevices == 0) {
System.out.println("No devices found! Please scan for new devices.\n");
break;
}
selectedDevice = selectDevice();
// Get the product description for the device
StringBuffer description = new StringBuffer(icsneojava.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION);
int[] maxLength = {icsneojava.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION};
icsneojava.icsneo_describeDevice(selectedDevice, description, maxLength);
// Attempt to set baudrate and apply settings
if(icsneojava.icsneo_setBaudrate(selectedDevice, icsneojava.ICSNEO_NETID_HSCAN, 250000) && icsneojava.icsneo_settingsApply(selectedDevice)) {
System.out.println("Successfully set HS CAN baudrate for " + description + "to 250k!\n");
} else {
System.out.println("Failed to set HS CAN for " + description + " to 250k!\n");
printLastError();
System.out.println();
}
break;
}
// Set HS CAN to 500k
case 'J':
case 'j': {
// Select a device and get its description
if(numDevices == 0) {
System.out.println("No devices found! Please scan for new devices.\n");
break;
}
selectedDevice = selectDevice();
// Get the product description for the device
StringBuffer description = new StringBuffer(icsneojava.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION);
int[] maxLength = {icsneojava.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION};
icsneojava.icsneo_describeDevice(selectedDevice, description, maxLength);
// Attempt to set baudrate and apply settings
if(icsneojava.icsneo_setBaudrate(selectedDevice, icsneojava.ICSNEO_NETID_HSCAN, 500000) && icsneojava.icsneo_settingsApply(selectedDevice)) {
System.out.println("Successfully set HS CAN baudrate for " + description + "to 500k!\n");
} else {
System.out.println("Failed to set HS CAN for " + description + " to 500k!\n");
printLastError();
System.out.println();
}
break;
}
case 'X':
case 'x':
System.out.println("Exiting program");
return;
default:
System.out.println("Unexpected input, exiting!");
return;
}
}
}
}
+10
View File
@@ -0,0 +1,10 @@
public class Run {
static {
System.loadLibrary("icsneojava");
}
public static void main(String[] args) {
InteractiveExample example = new InteractiveExample();
example.run();
}
}
+25
View File
@@ -0,0 +1,25 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 4.0.0
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
public class SWIGTYPE_p_time_t {
private transient long swigCPtr;
protected SWIGTYPE_p_time_t(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
swigCPtr = cPtr;
}
protected SWIGTYPE_p_time_t() {
swigCPtr = 0;
}
protected static long getCPtr(SWIGTYPE_p_time_t obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
}
@@ -0,0 +1,25 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 4.0.0
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
public class SWIGTYPE_p_unsigned_char {
private transient long swigCPtr;
protected SWIGTYPE_p_unsigned_char(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
swigCPtr = cPtr;
}
protected SWIGTYPE_p_unsigned_char() {
swigCPtr = 0;
}
protected static long getCPtr(SWIGTYPE_p_unsigned_char obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
}
@@ -0,0 +1,25 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 4.0.0
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
public class SWIGTYPE_p_unsigned_int {
private transient long swigCPtr;
protected SWIGTYPE_p_unsigned_int(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
swigCPtr = cPtr;
}
protected SWIGTYPE_p_unsigned_int() {
swigCPtr = 0;
}
protected static long getCPtr(SWIGTYPE_p_unsigned_int obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
}
@@ -0,0 +1,25 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 4.0.0
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
public class SWIGTYPE_p_unsigned_short {
private transient long swigCPtr;
protected SWIGTYPE_p_unsigned_short(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
swigCPtr = cPtr;
}
protected SWIGTYPE_p_unsigned_short() {
swigCPtr = 0;
}
protected static long getCPtr(SWIGTYPE_p_unsigned_short obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
}
+25
View File
@@ -0,0 +1,25 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 4.0.0
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
public class SWIGTYPE_p_void {
private transient long swigCPtr;
protected SWIGTYPE_p_void(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
swigCPtr = cPtr;
}
protected SWIGTYPE_p_void() {
swigCPtr = 0;
}
protected static long getCPtr(SWIGTYPE_p_void obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
}
+262
View File
@@ -0,0 +1,262 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 4.0.0
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
public class icsneojava implements icsneojavaConstants {
public static void icsneo_findAllDevices(neodevice_t devices, int[] count) {
icsneojavaJNI.icsneo_findAllDevices(neodevice_t.getCPtr(devices), devices, count);
}
public static void icsneo_freeUnconnectedDevices() {
icsneojavaJNI.icsneo_freeUnconnectedDevices();
}
public static boolean icsneo_serialNumToString(long num, StringBuffer str, int[] count) {
return icsneojavaJNI.icsneo_serialNumToString(num, str, count);
}
public static long icsneo_serialStringToNum(StringBuffer str) {
return icsneojavaJNI.icsneo_serialStringToNum(str);
}
public static boolean icsneo_isValidNeoDevice(neodevice_t device) {
return icsneojavaJNI.icsneo_isValidNeoDevice(neodevice_t.getCPtr(device), device);
}
public static boolean icsneo_openDevice(neodevice_t device) {
return icsneojavaJNI.icsneo_openDevice(neodevice_t.getCPtr(device), device);
}
public static boolean icsneo_closeDevice(neodevice_t device) {
return icsneojavaJNI.icsneo_closeDevice(neodevice_t.getCPtr(device), device);
}
public static boolean icsneo_isOpen(neodevice_t device) {
return icsneojavaJNI.icsneo_isOpen(neodevice_t.getCPtr(device), device);
}
public static boolean icsneo_goOnline(neodevice_t device) {
return icsneojavaJNI.icsneo_goOnline(neodevice_t.getCPtr(device), device);
}
public static boolean icsneo_goOffline(neodevice_t device) {
return icsneojavaJNI.icsneo_goOffline(neodevice_t.getCPtr(device), device);
}
public static boolean icsneo_isOnline(neodevice_t device) {
return icsneojavaJNI.icsneo_isOnline(neodevice_t.getCPtr(device), device);
}
public static boolean icsneo_enableMessagePolling(neodevice_t device) {
return icsneojavaJNI.icsneo_enableMessagePolling(neodevice_t.getCPtr(device), device);
}
public static boolean icsneo_disableMessagePolling(neodevice_t device) {
return icsneojavaJNI.icsneo_disableMessagePolling(neodevice_t.getCPtr(device), device);
}
public static boolean icsneo_isMessagePollingEnabled(neodevice_t device) {
return icsneojavaJNI.icsneo_isMessagePollingEnabled(neodevice_t.getCPtr(device), device);
}
public static boolean icsneo_getMessages(neodevice_t device, neomessage_t messages, int[] items, java.math.BigInteger timeout) {
return icsneojavaJNI.icsneo_getMessages(neodevice_t.getCPtr(device), device, neomessage_t.getCPtr(messages), messages, items, timeout);
}
public static long icsneo_getPollingMessageLimit(neodevice_t device) {
return icsneojavaJNI.icsneo_getPollingMessageLimit(neodevice_t.getCPtr(device), device);
}
public static boolean icsneo_setPollingMessageLimit(neodevice_t device, long newLimit) {
return icsneojavaJNI.icsneo_setPollingMessageLimit(neodevice_t.getCPtr(device), device, newLimit);
}
public static boolean icsneo_getProductName(neodevice_t device, StringBuffer str, int[] maxLength) {
return icsneojavaJNI.icsneo_getProductName(neodevice_t.getCPtr(device), device, str, maxLength);
}
public static boolean icsneo_getProductNameForType(long type, StringBuffer str, int[] maxLength) {
return icsneojavaJNI.icsneo_getProductNameForType(type, str, maxLength);
}
public static boolean icsneo_settingsRefresh(neodevice_t device) {
return icsneojavaJNI.icsneo_settingsRefresh(neodevice_t.getCPtr(device), device);
}
public static boolean icsneo_settingsApply(neodevice_t device) {
return icsneojavaJNI.icsneo_settingsApply(neodevice_t.getCPtr(device), device);
}
public static boolean icsneo_settingsApplyTemporary(neodevice_t device) {
return icsneojavaJNI.icsneo_settingsApplyTemporary(neodevice_t.getCPtr(device), device);
}
public static boolean icsneo_settingsApplyDefaults(neodevice_t device) {
return icsneojavaJNI.icsneo_settingsApplyDefaults(neodevice_t.getCPtr(device), device);
}
public static boolean icsneo_settingsApplyDefaultsTemporary(neodevice_t device) {
return icsneojavaJNI.icsneo_settingsApplyDefaultsTemporary(neodevice_t.getCPtr(device), device);
}
public static int icsneo_settingsReadStructure(neodevice_t device, SWIGTYPE_p_void structure, long structureSize) {
return icsneojavaJNI.icsneo_settingsReadStructure(neodevice_t.getCPtr(device), device, SWIGTYPE_p_void.getCPtr(structure), structureSize);
}
public static boolean icsneo_settingsApplyStructure(neodevice_t device, SWIGTYPE_p_void structure, long structureSize) {
return icsneojavaJNI.icsneo_settingsApplyStructure(neodevice_t.getCPtr(device), device, SWIGTYPE_p_void.getCPtr(structure), structureSize);
}
public static boolean icsneo_settingsApplyStructureTemporary(neodevice_t device, SWIGTYPE_p_void structure, long structureSize) {
return icsneojavaJNI.icsneo_settingsApplyStructureTemporary(neodevice_t.getCPtr(device), device, SWIGTYPE_p_void.getCPtr(structure), structureSize);
}
public static long icsneo_getBaudrate(neodevice_t device, int netid) {
return icsneojavaJNI.icsneo_getBaudrate(neodevice_t.getCPtr(device), device, netid);
}
public static boolean icsneo_setBaudrate(neodevice_t device, int netid, long newBaudrate) {
return icsneojavaJNI.icsneo_setBaudrate(neodevice_t.getCPtr(device), device, netid, newBaudrate);
}
public static long icsneo_getFDBaudrate(neodevice_t device, int netid) {
return icsneojavaJNI.icsneo_getFDBaudrate(neodevice_t.getCPtr(device), device, netid);
}
public static boolean icsneo_setFDBaudrate(neodevice_t device, int netid, long newBaudrate) {
return icsneojavaJNI.icsneo_setFDBaudrate(neodevice_t.getCPtr(device), device, netid, newBaudrate);
}
public static boolean icsneo_transmit(neodevice_t device, neomessage_t message) {
return icsneojavaJNI.icsneo_transmit(neodevice_t.getCPtr(device), device, neomessage_t.getCPtr(message), message);
}
public static boolean icsneo_transmitMessages(neodevice_t device, neomessage_t messages, long count) {
return icsneojavaJNI.icsneo_transmitMessages(neodevice_t.getCPtr(device), device, neomessage_t.getCPtr(messages), messages, count);
}
public static void icsneo_setWriteBlocks(neodevice_t device, boolean blocks) {
icsneojavaJNI.icsneo_setWriteBlocks(neodevice_t.getCPtr(device), device, blocks);
}
public static boolean icsneo_describeDevice(neodevice_t device, StringBuffer str, int[] maxLength) {
return icsneojavaJNI.icsneo_describeDevice(neodevice_t.getCPtr(device), device, str, maxLength);
}
public static neoversion_t icsneo_getVersion() {
return new neoversion_t(icsneojavaJNI.icsneo_getVersion(), true);
}
public static boolean icsneo_getEvents(neoevent_t events, int[] size) {
return icsneojavaJNI.icsneo_getEvents(neoevent_t.getCPtr(events), events, size);
}
public static boolean icsneo_getDeviceEvents(neodevice_t device, neoevent_t events, int[] size) {
return icsneojavaJNI.icsneo_getDeviceEvents(neodevice_t.getCPtr(device), device, neoevent_t.getCPtr(events), events, size);
}
public static boolean icsneo_getLastError(neoevent_t error) {
return icsneojavaJNI.icsneo_getLastError(neoevent_t.getCPtr(error), error);
}
public static void icsneo_discardAllEvents() {
icsneojavaJNI.icsneo_discardAllEvents();
}
public static void icsneo_discardDeviceEvents(neodevice_t device) {
icsneojavaJNI.icsneo_discardDeviceEvents(neodevice_t.getCPtr(device), device);
}
public static void icsneo_setEventLimit(long newLimit) {
icsneojavaJNI.icsneo_setEventLimit(newLimit);
}
public static long icsneo_getEventLimit() {
return icsneojavaJNI.icsneo_getEventLimit();
}
public static boolean icsneo_getSupportedDevices(SWIGTYPE_p_unsigned_int devices, int[] count) {
return icsneojavaJNI.icsneo_getSupportedDevices(SWIGTYPE_p_unsigned_int.getCPtr(devices), count);
}
public static boolean icsneo_getTimestampResolution(neodevice_t device, SWIGTYPE_p_unsigned_short resolution) {
return icsneojavaJNI.icsneo_getTimestampResolution(neodevice_t.getCPtr(device), device, SWIGTYPE_p_unsigned_short.getCPtr(resolution));
}
public static neomessage_can_t neomessage_can_t_cast(neomessage_t msg) {
long cPtr = icsneojavaJNI.neomessage_can_t_cast(neomessage_t.getCPtr(msg), msg);
return (cPtr == 0) ? null : new neomessage_can_t(cPtr, false);
}
public static neomessage_eth_t neomessage_eth_t_cast(neomessage_t msg) {
long cPtr = icsneojavaJNI.neomessage_eth_t_cast(neomessage_t.getCPtr(msg), msg);
return (cPtr == 0) ? null : new neomessage_eth_t(cPtr, false);
}
public static neomessage_t from_can_neomessage_t_cast(neomessage_can_t msg) {
long cPtr = icsneojavaJNI.from_can_neomessage_t_cast(neomessage_can_t.getCPtr(msg), msg);
return (cPtr == 0) ? null : new neomessage_t(cPtr, false);
}
public static neomessage_t from_eth_neomessage_t_cast(neomessage_eth_t msg) {
long cPtr = icsneojavaJNI.from_eth_neomessage_t_cast(neomessage_eth_t.getCPtr(msg), msg);
return (cPtr == 0) ? null : new neomessage_t(cPtr, false);
}
public static neodevice_t new_neodevice_t_array(int nelements) {
long cPtr = icsneojavaJNI.new_neodevice_t_array(nelements);
return (cPtr == 0) ? null : new neodevice_t(cPtr, false);
}
public static void delete_neodevice_t_array(neodevice_t ary) {
icsneojavaJNI.delete_neodevice_t_array(neodevice_t.getCPtr(ary), ary);
}
public static neodevice_t neodevice_t_array_getitem(neodevice_t ary, int index) {
return new neodevice_t(icsneojavaJNI.neodevice_t_array_getitem(neodevice_t.getCPtr(ary), ary, index), true);
}
public static void neodevice_t_array_setitem(neodevice_t ary, int index, neodevice_t value) {
icsneojavaJNI.neodevice_t_array_setitem(neodevice_t.getCPtr(ary), ary, index, neodevice_t.getCPtr(value), value);
}
public static neoevent_t new_neoevent_t_array(int nelements) {
long cPtr = icsneojavaJNI.new_neoevent_t_array(nelements);
return (cPtr == 0) ? null : new neoevent_t(cPtr, false);
}
public static void delete_neoevent_t_array(neoevent_t ary) {
icsneojavaJNI.delete_neoevent_t_array(neoevent_t.getCPtr(ary), ary);
}
public static neoevent_t neoevent_t_array_getitem(neoevent_t ary, int index) {
return new neoevent_t(icsneojavaJNI.neoevent_t_array_getitem(neoevent_t.getCPtr(ary), ary, index), true);
}
public static void neoevent_t_array_setitem(neoevent_t ary, int index, neoevent_t value) {
icsneojavaJNI.neoevent_t_array_setitem(neoevent_t.getCPtr(ary), ary, index, neoevent_t.getCPtr(value), value);
}
public static neomessage_t new_neomessage_t_array(int nelements) {
long cPtr = icsneojavaJNI.new_neomessage_t_array(nelements);
return (cPtr == 0) ? null : new neomessage_t(cPtr, false);
}
public static void delete_neomessage_t_array(neomessage_t ary) {
icsneojavaJNI.delete_neomessage_t_array(neomessage_t.getCPtr(ary), ary);
}
public static neomessage_t neomessage_t_array_getitem(neomessage_t ary, int index) {
return new neomessage_t(icsneojavaJNI.neomessage_t_array_getitem(neomessage_t.getCPtr(ary), ary, index), true);
}
public static void neomessage_t_array_setitem(neomessage_t ary, int index, neomessage_t value) {
icsneojavaJNI.neomessage_t_array_setitem(neomessage_t.getCPtr(ary), ary, index, neomessage_t.getCPtr(value), value);
}
}
+121
View File
@@ -0,0 +1,121 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 4.0.0
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
public interface icsneojavaConstants {
public final static int ICSNEO_DEVICETYPE_LONGEST_NAME = icsneojavaJNI.ICSNEO_DEVICETYPE_LONGEST_NAME_get();
public final static int ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION = icsneojavaJNI.ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION_get();
public final static int ICSNEO_NETID_DEVICE = icsneojavaJNI.ICSNEO_NETID_DEVICE_get();
public final static int ICSNEO_NETID_HSCAN = icsneojavaJNI.ICSNEO_NETID_HSCAN_get();
public final static int ICSNEO_NETID_MSCAN = icsneojavaJNI.ICSNEO_NETID_MSCAN_get();
public final static int ICSNEO_NETID_SWCAN = icsneojavaJNI.ICSNEO_NETID_SWCAN_get();
public final static int ICSNEO_NETID_LSFTCAN = icsneojavaJNI.ICSNEO_NETID_LSFTCAN_get();
public final static int ICSNEO_NETID_FORDSCP = icsneojavaJNI.ICSNEO_NETID_FORDSCP_get();
public final static int ICSNEO_NETID_J1708 = icsneojavaJNI.ICSNEO_NETID_J1708_get();
public final static int ICSNEO_NETID_AUX = icsneojavaJNI.ICSNEO_NETID_AUX_get();
public final static int ICSNEO_NETID_J1850VPW = icsneojavaJNI.ICSNEO_NETID_J1850VPW_get();
public final static int ICSNEO_NETID_ISO = icsneojavaJNI.ICSNEO_NETID_ISO_get();
public final static int ICSNEO_NETID_ISOPIC = icsneojavaJNI.ICSNEO_NETID_ISOPIC_get();
public final static int ICSNEO_NETID_MAIN51 = icsneojavaJNI.ICSNEO_NETID_MAIN51_get();
public final static int ICSNEO_NETID_RED = icsneojavaJNI.ICSNEO_NETID_RED_get();
public final static int ICSNEO_NETID_SCI = icsneojavaJNI.ICSNEO_NETID_SCI_get();
public final static int ICSNEO_NETID_ISO2 = icsneojavaJNI.ICSNEO_NETID_ISO2_get();
public final static int ICSNEO_NETID_ISO14230 = icsneojavaJNI.ICSNEO_NETID_ISO14230_get();
public final static int ICSNEO_NETID_LIN = icsneojavaJNI.ICSNEO_NETID_LIN_get();
public final static int ICSNEO_NETID_OP_ETHERNET1 = icsneojavaJNI.ICSNEO_NETID_OP_ETHERNET1_get();
public final static int ICSNEO_NETID_OP_ETHERNET2 = icsneojavaJNI.ICSNEO_NETID_OP_ETHERNET2_get();
public final static int ICSNEO_NETID_OP_ETHERNET3 = icsneojavaJNI.ICSNEO_NETID_OP_ETHERNET3_get();
public final static int ICSNEO_NETID_RED_EXT_MEMORYREAD = icsneojavaJNI.ICSNEO_NETID_RED_EXT_MEMORYREAD_get();
public final static int ICSNEO_NETID_RED_INT_MEMORYREAD = icsneojavaJNI.ICSNEO_NETID_RED_INT_MEMORYREAD_get();
public final static int ICSNEO_NETID_RED_DFLASH_READ = icsneojavaJNI.ICSNEO_NETID_RED_DFLASH_READ_get();
public final static int ICSNEO_NETID_RED_SDCARD_READ = icsneojavaJNI.ICSNEO_NETID_RED_SDCARD_READ_get();
public final static int ICSNEO_NETID_CAN_ERRBITS = icsneojavaJNI.ICSNEO_NETID_CAN_ERRBITS_get();
public final static int ICSNEO_NETID_RED_DFLASH_WRITE_DONE = icsneojavaJNI.ICSNEO_NETID_RED_DFLASH_WRITE_DONE_get();
public final static int ICSNEO_NETID_RED_WAVE_CAN1_LOGICAL = icsneojavaJNI.ICSNEO_NETID_RED_WAVE_CAN1_LOGICAL_get();
public final static int ICSNEO_NETID_RED_WAVE_CAN2_LOGICAL = icsneojavaJNI.ICSNEO_NETID_RED_WAVE_CAN2_LOGICAL_get();
public final static int ICSNEO_NETID_RED_WAVE_LIN1_LOGICAL = icsneojavaJNI.ICSNEO_NETID_RED_WAVE_LIN1_LOGICAL_get();
public final static int ICSNEO_NETID_RED_WAVE_LIN2_LOGICAL = icsneojavaJNI.ICSNEO_NETID_RED_WAVE_LIN2_LOGICAL_get();
public final static int ICSNEO_NETID_RED_WAVE_LIN1_ANALOG = icsneojavaJNI.ICSNEO_NETID_RED_WAVE_LIN1_ANALOG_get();
public final static int ICSNEO_NETID_RED_WAVE_LIN2_ANALOG = icsneojavaJNI.ICSNEO_NETID_RED_WAVE_LIN2_ANALOG_get();
public final static int ICSNEO_NETID_RED_WAVE_MISC_ANALOG = icsneojavaJNI.ICSNEO_NETID_RED_WAVE_MISC_ANALOG_get();
public final static int ICSNEO_NETID_RED_WAVE_MISCDIO2_LOGICAL = icsneojavaJNI.ICSNEO_NETID_RED_WAVE_MISCDIO2_LOGICAL_get();
public final static int ICSNEO_NETID_RED_NETWORK_COM_ENABLE_EX = icsneojavaJNI.ICSNEO_NETID_RED_NETWORK_COM_ENABLE_EX_get();
public final static int ICSNEO_NETID_RED_NEOVI_NETWORK = icsneojavaJNI.ICSNEO_NETID_RED_NEOVI_NETWORK_get();
public final static int ICSNEO_NETID_RED_READ_BAUD_SETTINGS = icsneojavaJNI.ICSNEO_NETID_RED_READ_BAUD_SETTINGS_get();
public final static int ICSNEO_NETID_RED_OLDFORMAT = icsneojavaJNI.ICSNEO_NETID_RED_OLDFORMAT_get();
public final static int ICSNEO_NETID_RED_SCOPE_CAPTURE = icsneojavaJNI.ICSNEO_NETID_RED_SCOPE_CAPTURE_get();
public final static int ICSNEO_NETID_RED_HARDWARE_EXCEP = icsneojavaJNI.ICSNEO_NETID_RED_HARDWARE_EXCEP_get();
public final static int ICSNEO_NETID_RED_GET_RTC = icsneojavaJNI.ICSNEO_NETID_RED_GET_RTC_get();
public final static int ICSNEO_NETID_ISO3 = icsneojavaJNI.ICSNEO_NETID_ISO3_get();
public final static int ICSNEO_NETID_HSCAN2 = icsneojavaJNI.ICSNEO_NETID_HSCAN2_get();
public final static int ICSNEO_NETID_HSCAN3 = icsneojavaJNI.ICSNEO_NETID_HSCAN3_get();
public final static int ICSNEO_NETID_OP_ETHERNET4 = icsneojavaJNI.ICSNEO_NETID_OP_ETHERNET4_get();
public final static int ICSNEO_NETID_OP_ETHERNET5 = icsneojavaJNI.ICSNEO_NETID_OP_ETHERNET5_get();
public final static int ICSNEO_NETID_ISO4 = icsneojavaJNI.ICSNEO_NETID_ISO4_get();
public final static int ICSNEO_NETID_LIN2 = icsneojavaJNI.ICSNEO_NETID_LIN2_get();
public final static int ICSNEO_NETID_LIN3 = icsneojavaJNI.ICSNEO_NETID_LIN3_get();
public final static int ICSNEO_NETID_LIN4 = icsneojavaJNI.ICSNEO_NETID_LIN4_get();
public final static int ICSNEO_NETID_RED_APP_ERROR = icsneojavaJNI.ICSNEO_NETID_RED_APP_ERROR_get();
public final static int ICSNEO_NETID_CGI = icsneojavaJNI.ICSNEO_NETID_CGI_get();
public final static int ICSNEO_NETID_RESET_STATUS = icsneojavaJNI.ICSNEO_NETID_RESET_STATUS_get();
public final static int ICSNEO_NETID_FB_STATUS = icsneojavaJNI.ICSNEO_NETID_FB_STATUS_get();
public final static int ICSNEO_NETID_APP_SIGNAL_STATUS = icsneojavaJNI.ICSNEO_NETID_APP_SIGNAL_STATUS_get();
public final static int ICSNEO_NETID_READ_DATALINK_CM_TX_MSG = icsneojavaJNI.ICSNEO_NETID_READ_DATALINK_CM_TX_MSG_get();
public final static int ICSNEO_NETID_READ_DATALINK_CM_RX_MSG = icsneojavaJNI.ICSNEO_NETID_READ_DATALINK_CM_RX_MSG_get();
public final static int ICSNEO_NETID_LOGGING_OVERFLOW = icsneojavaJNI.ICSNEO_NETID_LOGGING_OVERFLOW_get();
public final static int ICSNEO_NETID_READ_SETTINGS = icsneojavaJNI.ICSNEO_NETID_READ_SETTINGS_get();
public final static int ICSNEO_NETID_HSCAN4 = icsneojavaJNI.ICSNEO_NETID_HSCAN4_get();
public final static int ICSNEO_NETID_HSCAN5 = icsneojavaJNI.ICSNEO_NETID_HSCAN5_get();
public final static int ICSNEO_NETID_RS232 = icsneojavaJNI.ICSNEO_NETID_RS232_get();
public final static int ICSNEO_NETID_UART = icsneojavaJNI.ICSNEO_NETID_UART_get();
public final static int ICSNEO_NETID_UART2 = icsneojavaJNI.ICSNEO_NETID_UART2_get();
public final static int ICSNEO_NETID_UART3 = icsneojavaJNI.ICSNEO_NETID_UART3_get();
public final static int ICSNEO_NETID_UART4 = icsneojavaJNI.ICSNEO_NETID_UART4_get();
public final static int ICSNEO_NETID_SWCAN2 = icsneojavaJNI.ICSNEO_NETID_SWCAN2_get();
public final static int ICSNEO_NETID_ETHERNET_DAQ = icsneojavaJNI.ICSNEO_NETID_ETHERNET_DAQ_get();
public final static int ICSNEO_NETID_DATA_TO_HOST = icsneojavaJNI.ICSNEO_NETID_DATA_TO_HOST_get();
public final static int ICSNEO_NETID_TEXTAPI_TO_HOST = icsneojavaJNI.ICSNEO_NETID_TEXTAPI_TO_HOST_get();
public final static int ICSNEO_NETID_OP_ETHERNET6 = icsneojavaJNI.ICSNEO_NETID_OP_ETHERNET6_get();
public final static int ICSNEO_NETID_RED_VBAT = icsneojavaJNI.ICSNEO_NETID_RED_VBAT_get();
public final static int ICSNEO_NETID_OP_ETHERNET7 = icsneojavaJNI.ICSNEO_NETID_OP_ETHERNET7_get();
public final static int ICSNEO_NETID_OP_ETHERNET8 = icsneojavaJNI.ICSNEO_NETID_OP_ETHERNET8_get();
public final static int ICSNEO_NETID_OP_ETHERNET9 = icsneojavaJNI.ICSNEO_NETID_OP_ETHERNET9_get();
public final static int ICSNEO_NETID_OP_ETHERNET10 = icsneojavaJNI.ICSNEO_NETID_OP_ETHERNET10_get();
public final static int ICSNEO_NETID_OP_ETHERNET11 = icsneojavaJNI.ICSNEO_NETID_OP_ETHERNET11_get();
public final static int ICSNEO_NETID_FLEXRAY1A = icsneojavaJNI.ICSNEO_NETID_FLEXRAY1A_get();
public final static int ICSNEO_NETID_FLEXRAY1B = icsneojavaJNI.ICSNEO_NETID_FLEXRAY1B_get();
public final static int ICSNEO_NETID_FLEXRAY2A = icsneojavaJNI.ICSNEO_NETID_FLEXRAY2A_get();
public final static int ICSNEO_NETID_FLEXRAY2B = icsneojavaJNI.ICSNEO_NETID_FLEXRAY2B_get();
public final static int ICSNEO_NETID_LIN5 = icsneojavaJNI.ICSNEO_NETID_LIN5_get();
public final static int ICSNEO_NETID_FLEXRAY = icsneojavaJNI.ICSNEO_NETID_FLEXRAY_get();
public final static int ICSNEO_NETID_FLEXRAY2 = icsneojavaJNI.ICSNEO_NETID_FLEXRAY2_get();
public final static int ICSNEO_NETID_OP_ETHERNET12 = icsneojavaJNI.ICSNEO_NETID_OP_ETHERNET12_get();
public final static int ICSNEO_NETID_MOST25 = icsneojavaJNI.ICSNEO_NETID_MOST25_get();
public final static int ICSNEO_NETID_MOST50 = icsneojavaJNI.ICSNEO_NETID_MOST50_get();
public final static int ICSNEO_NETID_MOST150 = icsneojavaJNI.ICSNEO_NETID_MOST150_get();
public final static int ICSNEO_NETID_ETHERNET = icsneojavaJNI.ICSNEO_NETID_ETHERNET_get();
public final static int ICSNEO_NETID_GMFSA = icsneojavaJNI.ICSNEO_NETID_GMFSA_get();
public final static int ICSNEO_NETID_TCP = icsneojavaJNI.ICSNEO_NETID_TCP_get();
public final static int ICSNEO_NETID_HSCAN6 = icsneojavaJNI.ICSNEO_NETID_HSCAN6_get();
public final static int ICSNEO_NETID_HSCAN7 = icsneojavaJNI.ICSNEO_NETID_HSCAN7_get();
public final static int ICSNEO_NETID_LIN6 = icsneojavaJNI.ICSNEO_NETID_LIN6_get();
public final static int ICSNEO_NETID_LSFTCAN2 = icsneojavaJNI.ICSNEO_NETID_LSFTCAN2_get();
public final static int ICSNEO_NETID_HW_COM_LATENCY_TEST = icsneojavaJNI.ICSNEO_NETID_HW_COM_LATENCY_TEST_get();
public final static int ICSNEO_NETID_DEVICE_STATUS = icsneojavaJNI.ICSNEO_NETID_DEVICE_STATUS_get();
public final static int ICSNEO_NETID_ANY = icsneojavaJNI.ICSNEO_NETID_ANY_get();
public final static int ICSNEO_NETID_INVALID = icsneojavaJNI.ICSNEO_NETID_INVALID_get();
public final static int ICSNEO_NETWORK_TYPE_INVALID = icsneojavaJNI.ICSNEO_NETWORK_TYPE_INVALID_get();
public final static int ICSNEO_NETWORK_TYPE_INTERNAL = icsneojavaJNI.ICSNEO_NETWORK_TYPE_INTERNAL_get();
public final static int ICSNEO_NETWORK_TYPE_CAN = icsneojavaJNI.ICSNEO_NETWORK_TYPE_CAN_get();
public final static int ICSNEO_NETWORK_TYPE_LIN = icsneojavaJNI.ICSNEO_NETWORK_TYPE_LIN_get();
public final static int ICSNEO_NETWORK_TYPE_FLEXRAY = icsneojavaJNI.ICSNEO_NETWORK_TYPE_FLEXRAY_get();
public final static int ICSNEO_NETWORK_TYPE_MOST = icsneojavaJNI.ICSNEO_NETWORK_TYPE_MOST_get();
public final static int ICSNEO_NETWORK_TYPE_ETHERNET = icsneojavaJNI.ICSNEO_NETWORK_TYPE_ETHERNET_get();
public final static int ICSNEO_NETWORK_TYPE_ANY = icsneojavaJNI.ICSNEO_NETWORK_TYPE_ANY_get();
public final static int ICSNEO_NETWORK_TYPE_OTHER = icsneojavaJNI.ICSNEO_NETWORK_TYPE_OTHER_get();
}
+400
View File
@@ -0,0 +1,400 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 4.0.0
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
public class icsneojavaJNI {
public final static native void icsneo_findAllDevices(long jarg1, neodevice_t jarg1_, int[] jarg2);
public final static native void icsneo_freeUnconnectedDevices();
public final static native boolean icsneo_serialNumToString(long jarg1, StringBuffer jarg2, int[] jarg3);
public final static native long icsneo_serialStringToNum(StringBuffer jarg1);
public final static native boolean icsneo_isValidNeoDevice(long jarg1, neodevice_t jarg1_);
public final static native boolean icsneo_openDevice(long jarg1, neodevice_t jarg1_);
public final static native boolean icsneo_closeDevice(long jarg1, neodevice_t jarg1_);
public final static native boolean icsneo_isOpen(long jarg1, neodevice_t jarg1_);
public final static native boolean icsneo_goOnline(long jarg1, neodevice_t jarg1_);
public final static native boolean icsneo_goOffline(long jarg1, neodevice_t jarg1_);
public final static native boolean icsneo_isOnline(long jarg1, neodevice_t jarg1_);
public final static native boolean icsneo_enableMessagePolling(long jarg1, neodevice_t jarg1_);
public final static native boolean icsneo_disableMessagePolling(long jarg1, neodevice_t jarg1_);
public final static native boolean icsneo_isMessagePollingEnabled(long jarg1, neodevice_t jarg1_);
public final static native boolean icsneo_getMessages(long jarg1, neodevice_t jarg1_, long jarg2, neomessage_t jarg2_, int[] jarg3, java.math.BigInteger jarg4);
public final static native long icsneo_getPollingMessageLimit(long jarg1, neodevice_t jarg1_);
public final static native boolean icsneo_setPollingMessageLimit(long jarg1, neodevice_t jarg1_, long jarg2);
public final static native boolean icsneo_getProductName(long jarg1, neodevice_t jarg1_, StringBuffer jarg2, int[] jarg3);
public final static native boolean icsneo_getProductNameForType(long jarg1, StringBuffer jarg2, int[] jarg3);
public final static native boolean icsneo_settingsRefresh(long jarg1, neodevice_t jarg1_);
public final static native boolean icsneo_settingsApply(long jarg1, neodevice_t jarg1_);
public final static native boolean icsneo_settingsApplyTemporary(long jarg1, neodevice_t jarg1_);
public final static native boolean icsneo_settingsApplyDefaults(long jarg1, neodevice_t jarg1_);
public final static native boolean icsneo_settingsApplyDefaultsTemporary(long jarg1, neodevice_t jarg1_);
public final static native int icsneo_settingsReadStructure(long jarg1, neodevice_t jarg1_, long jarg2, long jarg3);
public final static native boolean icsneo_settingsApplyStructure(long jarg1, neodevice_t jarg1_, long jarg2, long jarg3);
public final static native boolean icsneo_settingsApplyStructureTemporary(long jarg1, neodevice_t jarg1_, long jarg2, long jarg3);
public final static native long icsneo_getBaudrate(long jarg1, neodevice_t jarg1_, int jarg2);
public final static native boolean icsneo_setBaudrate(long jarg1, neodevice_t jarg1_, int jarg2, long jarg3);
public final static native long icsneo_getFDBaudrate(long jarg1, neodevice_t jarg1_, int jarg2);
public final static native boolean icsneo_setFDBaudrate(long jarg1, neodevice_t jarg1_, int jarg2, long jarg3);
public final static native boolean icsneo_transmit(long jarg1, neodevice_t jarg1_, long jarg2, neomessage_t jarg2_);
public final static native boolean icsneo_transmitMessages(long jarg1, neodevice_t jarg1_, long jarg2, neomessage_t jarg2_, long jarg3);
public final static native void icsneo_setWriteBlocks(long jarg1, neodevice_t jarg1_, boolean jarg2);
public final static native boolean icsneo_describeDevice(long jarg1, neodevice_t jarg1_, StringBuffer jarg2, int[] jarg3);
public final static native long icsneo_getVersion();
public final static native boolean icsneo_getEvents(long jarg1, neoevent_t jarg1_, int[] jarg2);
public final static native boolean icsneo_getDeviceEvents(long jarg1, neodevice_t jarg1_, long jarg2, neoevent_t jarg2_, int[] jarg3);
public final static native boolean icsneo_getLastError(long jarg1, neoevent_t jarg1_);
public final static native void icsneo_discardAllEvents();
public final static native void icsneo_discardDeviceEvents(long jarg1, neodevice_t jarg1_);
public final static native void icsneo_setEventLimit(long jarg1);
public final static native long icsneo_getEventLimit();
public final static native boolean icsneo_getSupportedDevices(long jarg1, int[] jarg2);
public final static native boolean icsneo_getTimestampResolution(long jarg1, neodevice_t jarg1_, long jarg2);
public final static native void neodevice_t_device_set(long jarg1, neodevice_t jarg1_, long jarg2);
public final static native long neodevice_t_device_get(long jarg1, neodevice_t jarg1_);
public final static native void neodevice_t_handle_set(long jarg1, neodevice_t jarg1_, int jarg2);
public final static native int neodevice_t_handle_get(long jarg1, neodevice_t jarg1_);
public final static native void neodevice_t_type_set(long jarg1, neodevice_t jarg1_, long jarg2);
public final static native long neodevice_t_type_get(long jarg1, neodevice_t jarg1_);
public final static native void neodevice_t_serial_set(long jarg1, neodevice_t jarg1_, String jarg2);
public final static native String neodevice_t_serial_get(long jarg1, neodevice_t jarg1_);
public final static native long new_neodevice_t();
public final static native void delete_neodevice_t(long jarg1);
public final static native void neomessage_statusbitfield_t_globalError_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_globalError_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_transmitMessage_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_transmitMessage_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_extendedFrame_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_extendedFrame_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_remoteFrame_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_remoteFrame_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_crcError_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_crcError_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_canErrorPassive_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_canErrorPassive_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_incompleteFrame_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_incompleteFrame_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_lostArbitration_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_lostArbitration_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_undefinedError_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_undefinedError_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_canBusOff_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_canBusOff_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_canErrorWarning_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_canErrorWarning_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_canBusShortedPlus_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_canBusShortedPlus_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_canBusShortedGround_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_canBusShortedGround_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_checksumError_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_checksumError_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_badMessageBitTimeError_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_badMessageBitTimeError_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_ifrData_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_ifrData_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_hardwareCommError_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_hardwareCommError_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_expectedLengthError_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_expectedLengthError_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_incomingNoMatch_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_incomingNoMatch_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_statusBreak_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_statusBreak_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_avsiRecOverflow_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_avsiRecOverflow_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_testTrigger_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_testTrigger_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_audioComment_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_audioComment_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_gpsData_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_gpsData_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_analogDigitalInput_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_analogDigitalInput_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_textComment_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_textComment_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_networkMessageType_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_networkMessageType_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_vsiTXUnderrun_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_vsiTXUnderrun_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_vsiIFRCRCBit_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_vsiIFRCRCBit_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_initMessage_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_initMessage_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_flexraySecondStartupFrame_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_flexraySecondStartupFrame_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_extended_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_extended_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_hasValue_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_hasValue_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_valueIsBoolean_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_valueIsBoolean_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_highVoltage_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_highVoltage_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_longMessage_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_longMessage_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_globalChange_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_globalChange_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_errorFrame_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_errorFrame_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_endOfLongMessage_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_endOfLongMessage_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_linErrorRXBreakNotZero_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_linErrorRXBreakNotZero_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_linErrorRXBreakTooShort_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_linErrorRXBreakTooShort_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_linErrorRXSyncNot55_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_linErrorRXSyncNot55_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_linErrorRXDataGreaterEight_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_linErrorRXDataGreaterEight_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_linErrorTXRXMismatch_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_linErrorTXRXMismatch_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_linErrorMessageIDParity_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_linErrorMessageIDParity_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_linSyncFrameError_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_linSyncFrameError_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_linIDFrameError_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_linIDFrameError_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_linSlaveByteError_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_linSlaveByteError_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_rxTimeoutError_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_rxTimeoutError_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_linNoSlaveData_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_linNoSlaveData_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_canfdESI_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_canfdESI_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_canfdIDE_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_canfdIDE_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_canfdRTR_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_canfdRTR_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_canfdFDF_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_canfdFDF_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_canfdBRS_set(long jarg1, neomessage_statusbitfield_t jarg1_, long jarg2);
public final static native long neomessage_statusbitfield_t_canfdBRS_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native void neomessage_statusbitfield_t_statusBitfield_set(long jarg1, neomessage_statusbitfield_t jarg1_, long[] jarg2);
public final static native long[] neomessage_statusbitfield_t_statusBitfield_get(long jarg1, neomessage_statusbitfield_t jarg1_);
public final static native long new_neomessage_statusbitfield_t();
public final static native void delete_neomessage_statusbitfield_t(long jarg1);
public final static native void neomessage_t_status_set(long jarg1, neomessage_t jarg1_, long jarg2, neomessage_statusbitfield_t jarg2_);
public final static native long neomessage_t_status_get(long jarg1, neomessage_t jarg1_);
public final static native void neomessage_t_timestamp_set(long jarg1, neomessage_t jarg1_, java.math.BigInteger jarg2);
public final static native java.math.BigInteger neomessage_t_timestamp_get(long jarg1, neomessage_t jarg1_);
public final static native void neomessage_t_timestampReserved_set(long jarg1, neomessage_t jarg1_, java.math.BigInteger jarg2);
public final static native java.math.BigInteger neomessage_t_timestampReserved_get(long jarg1, neomessage_t jarg1_);
public final static native void neomessage_t_data_set(long jarg1, neomessage_t jarg1_, byte[] jarg2);
public final static native byte[] neomessage_t_data_get(long jarg1, neomessage_t jarg1_);
public final static native void neomessage_t_length_set(long jarg1, neomessage_t jarg1_, long jarg2);
public final static native long neomessage_t_length_get(long jarg1, neomessage_t jarg1_);
public final static native void neomessage_t_header_set(long jarg1, neomessage_t jarg1_, short[] jarg2);
public final static native short[] neomessage_t_header_get(long jarg1, neomessage_t jarg1_);
public final static native void neomessage_t_netid_set(long jarg1, neomessage_t jarg1_, int jarg2);
public final static native int neomessage_t_netid_get(long jarg1, neomessage_t jarg1_);
public final static native void neomessage_t_type_set(long jarg1, neomessage_t jarg1_, short jarg2);
public final static native short neomessage_t_type_get(long jarg1, neomessage_t jarg1_);
public final static native void neomessage_t_reserved_set(long jarg1, neomessage_t jarg1_, short[] jarg2);
public final static native short[] neomessage_t_reserved_get(long jarg1, neomessage_t jarg1_);
public final static native long new_neomessage_t();
public final static native void delete_neomessage_t(long jarg1);
public final static native void neomessage_can_t_status_set(long jarg1, neomessage_can_t jarg1_, long jarg2, neomessage_statusbitfield_t jarg2_);
public final static native long neomessage_can_t_status_get(long jarg1, neomessage_can_t jarg1_);
public final static native void neomessage_can_t_timestamp_set(long jarg1, neomessage_can_t jarg1_, java.math.BigInteger jarg2);
public final static native java.math.BigInteger neomessage_can_t_timestamp_get(long jarg1, neomessage_can_t jarg1_);
public final static native void neomessage_can_t_timestampReserved_set(long jarg1, neomessage_can_t jarg1_, java.math.BigInteger jarg2);
public final static native java.math.BigInteger neomessage_can_t_timestampReserved_get(long jarg1, neomessage_can_t jarg1_);
public final static native void neomessage_can_t_data_set(long jarg1, neomessage_can_t jarg1_, byte[] jarg2);
public final static native byte[] neomessage_can_t_data_get(long jarg1, neomessage_can_t jarg1_);
public final static native void neomessage_can_t_length_set(long jarg1, neomessage_can_t jarg1_, long jarg2);
public final static native long neomessage_can_t_length_get(long jarg1, neomessage_can_t jarg1_);
public final static native void neomessage_can_t_arbid_set(long jarg1, neomessage_can_t jarg1_, long jarg2);
public final static native long neomessage_can_t_arbid_get(long jarg1, neomessage_can_t jarg1_);
public final static native void neomessage_can_t_netid_set(long jarg1, neomessage_can_t jarg1_, int jarg2);
public final static native int neomessage_can_t_netid_get(long jarg1, neomessage_can_t jarg1_);
public final static native void neomessage_can_t_type_set(long jarg1, neomessage_can_t jarg1_, short jarg2);
public final static native short neomessage_can_t_type_get(long jarg1, neomessage_can_t jarg1_);
public final static native void neomessage_can_t_dlcOnWire_set(long jarg1, neomessage_can_t jarg1_, short jarg2);
public final static native short neomessage_can_t_dlcOnWire_get(long jarg1, neomessage_can_t jarg1_);
public final static native void neomessage_can_t_reserved_set(long jarg1, neomessage_can_t jarg1_, short[] jarg2);
public final static native short[] neomessage_can_t_reserved_get(long jarg1, neomessage_can_t jarg1_);
public final static native long new_neomessage_can_t();
public final static native void delete_neomessage_can_t(long jarg1);
public final static native void neomessage_eth_t_status_set(long jarg1, neomessage_eth_t jarg1_, long jarg2, neomessage_statusbitfield_t jarg2_);
public final static native long neomessage_eth_t_status_get(long jarg1, neomessage_eth_t jarg1_);
public final static native void neomessage_eth_t_timestamp_set(long jarg1, neomessage_eth_t jarg1_, java.math.BigInteger jarg2);
public final static native java.math.BigInteger neomessage_eth_t_timestamp_get(long jarg1, neomessage_eth_t jarg1_);
public final static native void neomessage_eth_t_timestampReserved_set(long jarg1, neomessage_eth_t jarg1_, java.math.BigInteger jarg2);
public final static native java.math.BigInteger neomessage_eth_t_timestampReserved_get(long jarg1, neomessage_eth_t jarg1_);
public final static native void neomessage_eth_t_data_set(long jarg1, neomessage_eth_t jarg1_, byte[] jarg2);
public final static native byte[] neomessage_eth_t_data_get(long jarg1, neomessage_eth_t jarg1_);
public final static native void neomessage_eth_t_length_set(long jarg1, neomessage_eth_t jarg1_, long jarg2);
public final static native long neomessage_eth_t_length_get(long jarg1, neomessage_eth_t jarg1_);
public final static native void neomessage_eth_t_preemptionFlags_set(long jarg1, neomessage_eth_t jarg1_, short jarg2);
public final static native short neomessage_eth_t_preemptionFlags_get(long jarg1, neomessage_eth_t jarg1_);
public final static native void neomessage_eth_t_reservedHeader_set(long jarg1, neomessage_eth_t jarg1_, short[] jarg2);
public final static native short[] neomessage_eth_t_reservedHeader_get(long jarg1, neomessage_eth_t jarg1_);
public final static native void neomessage_eth_t_netid_set(long jarg1, neomessage_eth_t jarg1_, int jarg2);
public final static native int neomessage_eth_t_netid_get(long jarg1, neomessage_eth_t jarg1_);
public final static native void neomessage_eth_t_type_set(long jarg1, neomessage_eth_t jarg1_, short jarg2);
public final static native short neomessage_eth_t_type_get(long jarg1, neomessage_eth_t jarg1_);
public final static native void neomessage_eth_t_reserved_set(long jarg1, neomessage_eth_t jarg1_, short[] jarg2);
public final static native short[] neomessage_eth_t_reserved_get(long jarg1, neomessage_eth_t jarg1_);
public final static native long new_neomessage_eth_t();
public final static native void delete_neomessage_eth_t(long jarg1);
public final static native int ICSNEO_DEVICETYPE_LONGEST_NAME_get();
public final static native int ICSNEO_DEVICETYPE_LONGEST_DESCRIPTION_get();
public final static native void neoversion_t_major_set(long jarg1, neoversion_t jarg1_, int jarg2);
public final static native int neoversion_t_major_get(long jarg1, neoversion_t jarg1_);
public final static native void neoversion_t_minor_set(long jarg1, neoversion_t jarg1_, int jarg2);
public final static native int neoversion_t_minor_get(long jarg1, neoversion_t jarg1_);
public final static native void neoversion_t_patch_set(long jarg1, neoversion_t jarg1_, int jarg2);
public final static native int neoversion_t_patch_get(long jarg1, neoversion_t jarg1_);
public final static native void neoversion_t_metadata_set(long jarg1, neoversion_t jarg1_, String jarg2);
public final static native String neoversion_t_metadata_get(long jarg1, neoversion_t jarg1_);
public final static native void neoversion_t_buildBranch_set(long jarg1, neoversion_t jarg1_, String jarg2);
public final static native String neoversion_t_buildBranch_get(long jarg1, neoversion_t jarg1_);
public final static native void neoversion_t_buildTag_set(long jarg1, neoversion_t jarg1_, String jarg2);
public final static native String neoversion_t_buildTag_get(long jarg1, neoversion_t jarg1_);
public final static native void neoversion_t_reserved_set(long jarg1, neoversion_t jarg1_, String jarg2);
public final static native String neoversion_t_reserved_get(long jarg1, neoversion_t jarg1_);
public final static native long new_neoversion_t();
public final static native void delete_neoversion_t(long jarg1);
public final static native void neoevent_t_description_set(long jarg1, neoevent_t jarg1_, String jarg2);
public final static native String neoevent_t_description_get(long jarg1, neoevent_t jarg1_);
public final static native void neoevent_t_timestamp_set(long jarg1, neoevent_t jarg1_, long jarg2);
public final static native long neoevent_t_timestamp_get(long jarg1, neoevent_t jarg1_);
public final static native void neoevent_t_eventNumber_set(long jarg1, neoevent_t jarg1_, long jarg2);
public final static native long neoevent_t_eventNumber_get(long jarg1, neoevent_t jarg1_);
public final static native void neoevent_t_severity_set(long jarg1, neoevent_t jarg1_, short jarg2);
public final static native short neoevent_t_severity_get(long jarg1, neoevent_t jarg1_);
public final static native void neoevent_t_serial_set(long jarg1, neoevent_t jarg1_, String jarg2);
public final static native String neoevent_t_serial_get(long jarg1, neoevent_t jarg1_);
public final static native void neoevent_t_reserved_set(long jarg1, neoevent_t jarg1_, short[] jarg2);
public final static native short[] neoevent_t_reserved_get(long jarg1, neoevent_t jarg1_);
public final static native long new_neoevent_t();
public final static native void delete_neoevent_t(long jarg1);
public final static native int ICSNEO_NETID_DEVICE_get();
public final static native int ICSNEO_NETID_HSCAN_get();
public final static native int ICSNEO_NETID_MSCAN_get();
public final static native int ICSNEO_NETID_SWCAN_get();
public final static native int ICSNEO_NETID_LSFTCAN_get();
public final static native int ICSNEO_NETID_FORDSCP_get();
public final static native int ICSNEO_NETID_J1708_get();
public final static native int ICSNEO_NETID_AUX_get();
public final static native int ICSNEO_NETID_J1850VPW_get();
public final static native int ICSNEO_NETID_ISO_get();
public final static native int ICSNEO_NETID_ISOPIC_get();
public final static native int ICSNEO_NETID_MAIN51_get();
public final static native int ICSNEO_NETID_RED_get();
public final static native int ICSNEO_NETID_SCI_get();
public final static native int ICSNEO_NETID_ISO2_get();
public final static native int ICSNEO_NETID_ISO14230_get();
public final static native int ICSNEO_NETID_LIN_get();
public final static native int ICSNEO_NETID_OP_ETHERNET1_get();
public final static native int ICSNEO_NETID_OP_ETHERNET2_get();
public final static native int ICSNEO_NETID_OP_ETHERNET3_get();
public final static native int ICSNEO_NETID_RED_EXT_MEMORYREAD_get();
public final static native int ICSNEO_NETID_RED_INT_MEMORYREAD_get();
public final static native int ICSNEO_NETID_RED_DFLASH_READ_get();
public final static native int ICSNEO_NETID_RED_SDCARD_READ_get();
public final static native int ICSNEO_NETID_CAN_ERRBITS_get();
public final static native int ICSNEO_NETID_RED_DFLASH_WRITE_DONE_get();
public final static native int ICSNEO_NETID_RED_WAVE_CAN1_LOGICAL_get();
public final static native int ICSNEO_NETID_RED_WAVE_CAN2_LOGICAL_get();
public final static native int ICSNEO_NETID_RED_WAVE_LIN1_LOGICAL_get();
public final static native int ICSNEO_NETID_RED_WAVE_LIN2_LOGICAL_get();
public final static native int ICSNEO_NETID_RED_WAVE_LIN1_ANALOG_get();
public final static native int ICSNEO_NETID_RED_WAVE_LIN2_ANALOG_get();
public final static native int ICSNEO_NETID_RED_WAVE_MISC_ANALOG_get();
public final static native int ICSNEO_NETID_RED_WAVE_MISCDIO2_LOGICAL_get();
public final static native int ICSNEO_NETID_RED_NETWORK_COM_ENABLE_EX_get();
public final static native int ICSNEO_NETID_RED_NEOVI_NETWORK_get();
public final static native int ICSNEO_NETID_RED_READ_BAUD_SETTINGS_get();
public final static native int ICSNEO_NETID_RED_OLDFORMAT_get();
public final static native int ICSNEO_NETID_RED_SCOPE_CAPTURE_get();
public final static native int ICSNEO_NETID_RED_HARDWARE_EXCEP_get();
public final static native int ICSNEO_NETID_RED_GET_RTC_get();
public final static native int ICSNEO_NETID_ISO3_get();
public final static native int ICSNEO_NETID_HSCAN2_get();
public final static native int ICSNEO_NETID_HSCAN3_get();
public final static native int ICSNEO_NETID_OP_ETHERNET4_get();
public final static native int ICSNEO_NETID_OP_ETHERNET5_get();
public final static native int ICSNEO_NETID_ISO4_get();
public final static native int ICSNEO_NETID_LIN2_get();
public final static native int ICSNEO_NETID_LIN3_get();
public final static native int ICSNEO_NETID_LIN4_get();
public final static native int ICSNEO_NETID_RED_APP_ERROR_get();
public final static native int ICSNEO_NETID_CGI_get();
public final static native int ICSNEO_NETID_RESET_STATUS_get();
public final static native int ICSNEO_NETID_FB_STATUS_get();
public final static native int ICSNEO_NETID_APP_SIGNAL_STATUS_get();
public final static native int ICSNEO_NETID_READ_DATALINK_CM_TX_MSG_get();
public final static native int ICSNEO_NETID_READ_DATALINK_CM_RX_MSG_get();
public final static native int ICSNEO_NETID_LOGGING_OVERFLOW_get();
public final static native int ICSNEO_NETID_READ_SETTINGS_get();
public final static native int ICSNEO_NETID_HSCAN4_get();
public final static native int ICSNEO_NETID_HSCAN5_get();
public final static native int ICSNEO_NETID_RS232_get();
public final static native int ICSNEO_NETID_UART_get();
public final static native int ICSNEO_NETID_UART2_get();
public final static native int ICSNEO_NETID_UART3_get();
public final static native int ICSNEO_NETID_UART4_get();
public final static native int ICSNEO_NETID_SWCAN2_get();
public final static native int ICSNEO_NETID_ETHERNET_DAQ_get();
public final static native int ICSNEO_NETID_DATA_TO_HOST_get();
public final static native int ICSNEO_NETID_TEXTAPI_TO_HOST_get();
public final static native int ICSNEO_NETID_OP_ETHERNET6_get();
public final static native int ICSNEO_NETID_RED_VBAT_get();
public final static native int ICSNEO_NETID_OP_ETHERNET7_get();
public final static native int ICSNEO_NETID_OP_ETHERNET8_get();
public final static native int ICSNEO_NETID_OP_ETHERNET9_get();
public final static native int ICSNEO_NETID_OP_ETHERNET10_get();
public final static native int ICSNEO_NETID_OP_ETHERNET11_get();
public final static native int ICSNEO_NETID_FLEXRAY1A_get();
public final static native int ICSNEO_NETID_FLEXRAY1B_get();
public final static native int ICSNEO_NETID_FLEXRAY2A_get();
public final static native int ICSNEO_NETID_FLEXRAY2B_get();
public final static native int ICSNEO_NETID_LIN5_get();
public final static native int ICSNEO_NETID_FLEXRAY_get();
public final static native int ICSNEO_NETID_FLEXRAY2_get();
public final static native int ICSNEO_NETID_OP_ETHERNET12_get();
public final static native int ICSNEO_NETID_MOST25_get();
public final static native int ICSNEO_NETID_MOST50_get();
public final static native int ICSNEO_NETID_MOST150_get();
public final static native int ICSNEO_NETID_ETHERNET_get();
public final static native int ICSNEO_NETID_GMFSA_get();
public final static native int ICSNEO_NETID_TCP_get();
public final static native int ICSNEO_NETID_HSCAN6_get();
public final static native int ICSNEO_NETID_HSCAN7_get();
public final static native int ICSNEO_NETID_LIN6_get();
public final static native int ICSNEO_NETID_LSFTCAN2_get();
public final static native int ICSNEO_NETID_HW_COM_LATENCY_TEST_get();
public final static native int ICSNEO_NETID_DEVICE_STATUS_get();
public final static native int ICSNEO_NETID_ANY_get();
public final static native int ICSNEO_NETID_INVALID_get();
public final static native int ICSNEO_NETWORK_TYPE_INVALID_get();
public final static native int ICSNEO_NETWORK_TYPE_INTERNAL_get();
public final static native int ICSNEO_NETWORK_TYPE_CAN_get();
public final static native int ICSNEO_NETWORK_TYPE_LIN_get();
public final static native int ICSNEO_NETWORK_TYPE_FLEXRAY_get();
public final static native int ICSNEO_NETWORK_TYPE_MOST_get();
public final static native int ICSNEO_NETWORK_TYPE_ETHERNET_get();
public final static native int ICSNEO_NETWORK_TYPE_ANY_get();
public final static native int ICSNEO_NETWORK_TYPE_OTHER_get();
public final static native long neomessage_can_t_cast(long jarg1, neomessage_t jarg1_);
public final static native long neomessage_eth_t_cast(long jarg1, neomessage_t jarg1_);
public final static native long from_can_neomessage_t_cast(long jarg1, neomessage_can_t jarg1_);
public final static native long from_eth_neomessage_t_cast(long jarg1, neomessage_eth_t jarg1_);
public final static native long new_neodevice_t_array(int jarg1);
public final static native void delete_neodevice_t_array(long jarg1, neodevice_t jarg1_);
public final static native long neodevice_t_array_getitem(long jarg1, neodevice_t jarg1_, int jarg2);
public final static native void neodevice_t_array_setitem(long jarg1, neodevice_t jarg1_, int jarg2, long jarg3, neodevice_t jarg3_);
public final static native long new_neoevent_t_array(int jarg1);
public final static native void delete_neoevent_t_array(long jarg1, neoevent_t jarg1_);
public final static native long neoevent_t_array_getitem(long jarg1, neoevent_t jarg1_, int jarg2);
public final static native void neoevent_t_array_setitem(long jarg1, neoevent_t jarg1_, int jarg2, long jarg3, neoevent_t jarg3_);
public final static native long new_neomessage_t_array(int jarg1);
public final static native void delete_neomessage_t_array(long jarg1, neomessage_t jarg1_);
public final static native long neomessage_t_array_getitem(long jarg1, neomessage_t jarg1_, int jarg2);
public final static native void neomessage_t_array_setitem(long jarg1, neomessage_t jarg1_, int jarg2, long jarg3, neomessage_t jarg3_);
}
+75
View File
@@ -0,0 +1,75 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 4.0.0
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
public class neodevice_t {
private transient long swigCPtr;
protected transient boolean swigCMemOwn;
protected neodevice_t(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
protected static long getCPtr(neodevice_t obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@SuppressWarnings("deprecation")
protected void finalize() {
delete();
}
public synchronized void delete() {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
icsneojavaJNI.delete_neodevice_t(swigCPtr);
}
swigCPtr = 0;
}
}
public void setDevice(SWIGTYPE_p_void value) {
icsneojavaJNI.neodevice_t_device_set(swigCPtr, this, SWIGTYPE_p_void.getCPtr(value));
}
public SWIGTYPE_p_void getDevice() {
long cPtr = icsneojavaJNI.neodevice_t_device_get(swigCPtr, this);
return (cPtr == 0) ? null : new SWIGTYPE_p_void(cPtr, false);
}
public void setHandle(int value) {
icsneojavaJNI.neodevice_t_handle_set(swigCPtr, this, value);
}
public int getHandle() {
return icsneojavaJNI.neodevice_t_handle_get(swigCPtr, this);
}
public void setType(long value) {
icsneojavaJNI.neodevice_t_type_set(swigCPtr, this, value);
}
public long getType() {
return icsneojavaJNI.neodevice_t_type_get(swigCPtr, this);
}
public void setSerial(String value) {
icsneojavaJNI.neodevice_t_serial_set(swigCPtr, this, value);
}
public String getSerial() {
return icsneojavaJNI.neodevice_t_serial_get(swigCPtr, this);
}
public neodevice_t() {
this(icsneojavaJNI.new_neodevice_t(), true);
}
}
+90
View File
@@ -0,0 +1,90 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 4.0.0
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
public class neoevent_t {
private transient long swigCPtr;
protected transient boolean swigCMemOwn;
protected neoevent_t(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
protected static long getCPtr(neoevent_t obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@SuppressWarnings("deprecation")
protected void finalize() {
delete();
}
public synchronized void delete() {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
icsneojavaJNI.delete_neoevent_t(swigCPtr);
}
swigCPtr = 0;
}
}
public void setDescription(String value) {
icsneojavaJNI.neoevent_t_description_set(swigCPtr, this, value);
}
public String getDescription() {
return icsneojavaJNI.neoevent_t_description_get(swigCPtr, this);
}
public void setTimestamp(SWIGTYPE_p_time_t value) {
icsneojavaJNI.neoevent_t_timestamp_set(swigCPtr, this, SWIGTYPE_p_time_t.getCPtr(value));
}
public SWIGTYPE_p_time_t getTimestamp() {
return new SWIGTYPE_p_time_t(icsneojavaJNI.neoevent_t_timestamp_get(swigCPtr, this), true);
}
public void setEventNumber(long value) {
icsneojavaJNI.neoevent_t_eventNumber_set(swigCPtr, this, value);
}
public long getEventNumber() {
return icsneojavaJNI.neoevent_t_eventNumber_get(swigCPtr, this);
}
public void setSeverity(short value) {
icsneojavaJNI.neoevent_t_severity_set(swigCPtr, this, value);
}
public short getSeverity() {
return icsneojavaJNI.neoevent_t_severity_get(swigCPtr, this);
}
public void setSerial(String value) {
icsneojavaJNI.neoevent_t_serial_set(swigCPtr, this, value);
}
public String getSerial() {
return icsneojavaJNI.neoevent_t_serial_get(swigCPtr, this);
}
public void setReserved(short[] value) {
icsneojavaJNI.neoevent_t_reserved_set(swigCPtr, this, value);
}
public short[] getReserved() {
return icsneojavaJNI.neoevent_t_reserved_get(swigCPtr, this);
}
public neoevent_t() {
this(icsneojavaJNI.new_neoevent_t(), true);
}
}
+123
View File
@@ -0,0 +1,123 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 4.0.0
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
public class neomessage_can_t {
private transient long swigCPtr;
protected transient boolean swigCMemOwn;
protected neomessage_can_t(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
protected static long getCPtr(neomessage_can_t obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@SuppressWarnings("deprecation")
protected void finalize() {
delete();
}
public synchronized void delete() {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
icsneojavaJNI.delete_neomessage_can_t(swigCPtr);
}
swigCPtr = 0;
}
}
public void setStatus(neomessage_statusbitfield_t value) {
icsneojavaJNI.neomessage_can_t_status_set(swigCPtr, this, neomessage_statusbitfield_t.getCPtr(value), value);
}
public neomessage_statusbitfield_t getStatus() {
long cPtr = icsneojavaJNI.neomessage_can_t_status_get(swigCPtr, this);
return (cPtr == 0) ? null : new neomessage_statusbitfield_t(cPtr, false);
}
public void setTimestamp(java.math.BigInteger value) {
icsneojavaJNI.neomessage_can_t_timestamp_set(swigCPtr, this, value);
}
public java.math.BigInteger getTimestamp() {
return icsneojavaJNI.neomessage_can_t_timestamp_get(swigCPtr, this);
}
public void setTimestampReserved(java.math.BigInteger value) {
icsneojavaJNI.neomessage_can_t_timestampReserved_set(swigCPtr, this, value);
}
public java.math.BigInteger getTimestampReserved() {
return icsneojavaJNI.neomessage_can_t_timestampReserved_get(swigCPtr, this);
}
public void setData(byte[] value) {
icsneojavaJNI.neomessage_can_t_data_set(swigCPtr, this, value);
}
public byte[] getData() {
return icsneojavaJNI.neomessage_can_t_data_get(swigCPtr, this);
}
public void setLength(long value) {
icsneojavaJNI.neomessage_can_t_length_set(swigCPtr, this, value);
}
public long getLength() {
return icsneojavaJNI.neomessage_can_t_length_get(swigCPtr, this);
}
public void setArbid(long value) {
icsneojavaJNI.neomessage_can_t_arbid_set(swigCPtr, this, value);
}
public long getArbid() {
return icsneojavaJNI.neomessage_can_t_arbid_get(swigCPtr, this);
}
public void setNetid(int value) {
icsneojavaJNI.neomessage_can_t_netid_set(swigCPtr, this, value);
}
public int getNetid() {
return icsneojavaJNI.neomessage_can_t_netid_get(swigCPtr, this);
}
public void setType(short value) {
icsneojavaJNI.neomessage_can_t_type_set(swigCPtr, this, value);
}
public short getType() {
return icsneojavaJNI.neomessage_can_t_type_get(swigCPtr, this);
}
public void setDlcOnWire(short value) {
icsneojavaJNI.neomessage_can_t_dlcOnWire_set(swigCPtr, this, value);
}
public short getDlcOnWire() {
return icsneojavaJNI.neomessage_can_t_dlcOnWire_get(swigCPtr, this);
}
public void setReserved(short[] value) {
icsneojavaJNI.neomessage_can_t_reserved_set(swigCPtr, this, value);
}
public short[] getReserved() {
return icsneojavaJNI.neomessage_can_t_reserved_get(swigCPtr, this);
}
public neomessage_can_t() {
this(icsneojavaJNI.new_neomessage_can_t(), true);
}
}
+123
View File
@@ -0,0 +1,123 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 4.0.0
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
public class neomessage_eth_t {
private transient long swigCPtr;
protected transient boolean swigCMemOwn;
protected neomessage_eth_t(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
protected static long getCPtr(neomessage_eth_t obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@SuppressWarnings("deprecation")
protected void finalize() {
delete();
}
public synchronized void delete() {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
icsneojavaJNI.delete_neomessage_eth_t(swigCPtr);
}
swigCPtr = 0;
}
}
public void setStatus(neomessage_statusbitfield_t value) {
icsneojavaJNI.neomessage_eth_t_status_set(swigCPtr, this, neomessage_statusbitfield_t.getCPtr(value), value);
}
public neomessage_statusbitfield_t getStatus() {
long cPtr = icsneojavaJNI.neomessage_eth_t_status_get(swigCPtr, this);
return (cPtr == 0) ? null : new neomessage_statusbitfield_t(cPtr, false);
}
public void setTimestamp(java.math.BigInteger value) {
icsneojavaJNI.neomessage_eth_t_timestamp_set(swigCPtr, this, value);
}
public java.math.BigInteger getTimestamp() {
return icsneojavaJNI.neomessage_eth_t_timestamp_get(swigCPtr, this);
}
public void setTimestampReserved(java.math.BigInteger value) {
icsneojavaJNI.neomessage_eth_t_timestampReserved_set(swigCPtr, this, value);
}
public java.math.BigInteger getTimestampReserved() {
return icsneojavaJNI.neomessage_eth_t_timestampReserved_get(swigCPtr, this);
}
public void setData(byte[] value) {
icsneojavaJNI.neomessage_eth_t_data_set(swigCPtr, this, value);
}
public byte[] getData() {
return icsneojavaJNI.neomessage_eth_t_data_get(swigCPtr, this);
}
public void setLength(long value) {
icsneojavaJNI.neomessage_eth_t_length_set(swigCPtr, this, value);
}
public long getLength() {
return icsneojavaJNI.neomessage_eth_t_length_get(swigCPtr, this);
}
public void setPreemptionFlags(short value) {
icsneojavaJNI.neomessage_eth_t_preemptionFlags_set(swigCPtr, this, value);
}
public short getPreemptionFlags() {
return icsneojavaJNI.neomessage_eth_t_preemptionFlags_get(swigCPtr, this);
}
public void setReservedHeader(short[] value) {
icsneojavaJNI.neomessage_eth_t_reservedHeader_set(swigCPtr, this, value);
}
public short[] getReservedHeader() {
return icsneojavaJNI.neomessage_eth_t_reservedHeader_get(swigCPtr, this);
}
public void setNetid(int value) {
icsneojavaJNI.neomessage_eth_t_netid_set(swigCPtr, this, value);
}
public int getNetid() {
return icsneojavaJNI.neomessage_eth_t_netid_get(swigCPtr, this);
}
public void setType(short value) {
icsneojavaJNI.neomessage_eth_t_type_set(swigCPtr, this, value);
}
public short getType() {
return icsneojavaJNI.neomessage_eth_t_type_get(swigCPtr, this);
}
public void setReserved(short[] value) {
icsneojavaJNI.neomessage_eth_t_reserved_set(swigCPtr, this, value);
}
public short[] getReserved() {
return icsneojavaJNI.neomessage_eth_t_reserved_get(swigCPtr, this);
}
public neomessage_eth_t() {
this(icsneojavaJNI.new_neomessage_eth_t(), true);
}
}
@@ -0,0 +1,490 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 4.0.0
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
public class neomessage_statusbitfield_t {
private transient long swigCPtr;
protected transient boolean swigCMemOwn;
protected neomessage_statusbitfield_t(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
protected static long getCPtr(neomessage_statusbitfield_t obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@SuppressWarnings("deprecation")
protected void finalize() {
delete();
}
public synchronized void delete() {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
icsneojavaJNI.delete_neomessage_statusbitfield_t(swigCPtr);
}
swigCPtr = 0;
}
}
public void setGlobalError(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_globalError_set(swigCPtr, this, value);
}
public long getGlobalError() {
return icsneojavaJNI.neomessage_statusbitfield_t_globalError_get(swigCPtr, this);
}
public void setTransmitMessage(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_transmitMessage_set(swigCPtr, this, value);
}
public long getTransmitMessage() {
return icsneojavaJNI.neomessage_statusbitfield_t_transmitMessage_get(swigCPtr, this);
}
public void setExtendedFrame(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_extendedFrame_set(swigCPtr, this, value);
}
public long getExtendedFrame() {
return icsneojavaJNI.neomessage_statusbitfield_t_extendedFrame_get(swigCPtr, this);
}
public void setRemoteFrame(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_remoteFrame_set(swigCPtr, this, value);
}
public long getRemoteFrame() {
return icsneojavaJNI.neomessage_statusbitfield_t_remoteFrame_get(swigCPtr, this);
}
public void setCrcError(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_crcError_set(swigCPtr, this, value);
}
public long getCrcError() {
return icsneojavaJNI.neomessage_statusbitfield_t_crcError_get(swigCPtr, this);
}
public void setCanErrorPassive(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_canErrorPassive_set(swigCPtr, this, value);
}
public long getCanErrorPassive() {
return icsneojavaJNI.neomessage_statusbitfield_t_canErrorPassive_get(swigCPtr, this);
}
public void setIncompleteFrame(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_incompleteFrame_set(swigCPtr, this, value);
}
public long getIncompleteFrame() {
return icsneojavaJNI.neomessage_statusbitfield_t_incompleteFrame_get(swigCPtr, this);
}
public void setLostArbitration(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_lostArbitration_set(swigCPtr, this, value);
}
public long getLostArbitration() {
return icsneojavaJNI.neomessage_statusbitfield_t_lostArbitration_get(swigCPtr, this);
}
public void setUndefinedError(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_undefinedError_set(swigCPtr, this, value);
}
public long getUndefinedError() {
return icsneojavaJNI.neomessage_statusbitfield_t_undefinedError_get(swigCPtr, this);
}
public void setCanBusOff(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_canBusOff_set(swigCPtr, this, value);
}
public long getCanBusOff() {
return icsneojavaJNI.neomessage_statusbitfield_t_canBusOff_get(swigCPtr, this);
}
public void setCanErrorWarning(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_canErrorWarning_set(swigCPtr, this, value);
}
public long getCanErrorWarning() {
return icsneojavaJNI.neomessage_statusbitfield_t_canErrorWarning_get(swigCPtr, this);
}
public void setCanBusShortedPlus(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_canBusShortedPlus_set(swigCPtr, this, value);
}
public long getCanBusShortedPlus() {
return icsneojavaJNI.neomessage_statusbitfield_t_canBusShortedPlus_get(swigCPtr, this);
}
public void setCanBusShortedGround(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_canBusShortedGround_set(swigCPtr, this, value);
}
public long getCanBusShortedGround() {
return icsneojavaJNI.neomessage_statusbitfield_t_canBusShortedGround_get(swigCPtr, this);
}
public void setChecksumError(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_checksumError_set(swigCPtr, this, value);
}
public long getChecksumError() {
return icsneojavaJNI.neomessage_statusbitfield_t_checksumError_get(swigCPtr, this);
}
public void setBadMessageBitTimeError(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_badMessageBitTimeError_set(swigCPtr, this, value);
}
public long getBadMessageBitTimeError() {
return icsneojavaJNI.neomessage_statusbitfield_t_badMessageBitTimeError_get(swigCPtr, this);
}
public void setIfrData(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_ifrData_set(swigCPtr, this, value);
}
public long getIfrData() {
return icsneojavaJNI.neomessage_statusbitfield_t_ifrData_get(swigCPtr, this);
}
public void setHardwareCommError(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_hardwareCommError_set(swigCPtr, this, value);
}
public long getHardwareCommError() {
return icsneojavaJNI.neomessage_statusbitfield_t_hardwareCommError_get(swigCPtr, this);
}
public void setExpectedLengthError(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_expectedLengthError_set(swigCPtr, this, value);
}
public long getExpectedLengthError() {
return icsneojavaJNI.neomessage_statusbitfield_t_expectedLengthError_get(swigCPtr, this);
}
public void setIncomingNoMatch(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_incomingNoMatch_set(swigCPtr, this, value);
}
public long getIncomingNoMatch() {
return icsneojavaJNI.neomessage_statusbitfield_t_incomingNoMatch_get(swigCPtr, this);
}
public void setStatusBreak(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_statusBreak_set(swigCPtr, this, value);
}
public long getStatusBreak() {
return icsneojavaJNI.neomessage_statusbitfield_t_statusBreak_get(swigCPtr, this);
}
public void setAvsiRecOverflow(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_avsiRecOverflow_set(swigCPtr, this, value);
}
public long getAvsiRecOverflow() {
return icsneojavaJNI.neomessage_statusbitfield_t_avsiRecOverflow_get(swigCPtr, this);
}
public void setTestTrigger(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_testTrigger_set(swigCPtr, this, value);
}
public long getTestTrigger() {
return icsneojavaJNI.neomessage_statusbitfield_t_testTrigger_get(swigCPtr, this);
}
public void setAudioComment(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_audioComment_set(swigCPtr, this, value);
}
public long getAudioComment() {
return icsneojavaJNI.neomessage_statusbitfield_t_audioComment_get(swigCPtr, this);
}
public void setGpsData(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_gpsData_set(swigCPtr, this, value);
}
public long getGpsData() {
return icsneojavaJNI.neomessage_statusbitfield_t_gpsData_get(swigCPtr, this);
}
public void setAnalogDigitalInput(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_analogDigitalInput_set(swigCPtr, this, value);
}
public long getAnalogDigitalInput() {
return icsneojavaJNI.neomessage_statusbitfield_t_analogDigitalInput_get(swigCPtr, this);
}
public void setTextComment(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_textComment_set(swigCPtr, this, value);
}
public long getTextComment() {
return icsneojavaJNI.neomessage_statusbitfield_t_textComment_get(swigCPtr, this);
}
public void setNetworkMessageType(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_networkMessageType_set(swigCPtr, this, value);
}
public long getNetworkMessageType() {
return icsneojavaJNI.neomessage_statusbitfield_t_networkMessageType_get(swigCPtr, this);
}
public void setVsiTXUnderrun(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_vsiTXUnderrun_set(swigCPtr, this, value);
}
public long getVsiTXUnderrun() {
return icsneojavaJNI.neomessage_statusbitfield_t_vsiTXUnderrun_get(swigCPtr, this);
}
public void setVsiIFRCRCBit(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_vsiIFRCRCBit_set(swigCPtr, this, value);
}
public long getVsiIFRCRCBit() {
return icsneojavaJNI.neomessage_statusbitfield_t_vsiIFRCRCBit_get(swigCPtr, this);
}
public void setInitMessage(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_initMessage_set(swigCPtr, this, value);
}
public long getInitMessage() {
return icsneojavaJNI.neomessage_statusbitfield_t_initMessage_get(swigCPtr, this);
}
public void setFlexraySecondStartupFrame(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_flexraySecondStartupFrame_set(swigCPtr, this, value);
}
public long getFlexraySecondStartupFrame() {
return icsneojavaJNI.neomessage_statusbitfield_t_flexraySecondStartupFrame_get(swigCPtr, this);
}
public void setExtended(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_extended_set(swigCPtr, this, value);
}
public long getExtended() {
return icsneojavaJNI.neomessage_statusbitfield_t_extended_get(swigCPtr, this);
}
public void setHasValue(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_hasValue_set(swigCPtr, this, value);
}
public long getHasValue() {
return icsneojavaJNI.neomessage_statusbitfield_t_hasValue_get(swigCPtr, this);
}
public void setValueIsBoolean(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_valueIsBoolean_set(swigCPtr, this, value);
}
public long getValueIsBoolean() {
return icsneojavaJNI.neomessage_statusbitfield_t_valueIsBoolean_get(swigCPtr, this);
}
public void setHighVoltage(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_highVoltage_set(swigCPtr, this, value);
}
public long getHighVoltage() {
return icsneojavaJNI.neomessage_statusbitfield_t_highVoltage_get(swigCPtr, this);
}
public void setLongMessage(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_longMessage_set(swigCPtr, this, value);
}
public long getLongMessage() {
return icsneojavaJNI.neomessage_statusbitfield_t_longMessage_get(swigCPtr, this);
}
public void setGlobalChange(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_globalChange_set(swigCPtr, this, value);
}
public long getGlobalChange() {
return icsneojavaJNI.neomessage_statusbitfield_t_globalChange_get(swigCPtr, this);
}
public void setErrorFrame(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_errorFrame_set(swigCPtr, this, value);
}
public long getErrorFrame() {
return icsneojavaJNI.neomessage_statusbitfield_t_errorFrame_get(swigCPtr, this);
}
public void setEndOfLongMessage(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_endOfLongMessage_set(swigCPtr, this, value);
}
public long getEndOfLongMessage() {
return icsneojavaJNI.neomessage_statusbitfield_t_endOfLongMessage_get(swigCPtr, this);
}
public void setLinErrorRXBreakNotZero(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_linErrorRXBreakNotZero_set(swigCPtr, this, value);
}
public long getLinErrorRXBreakNotZero() {
return icsneojavaJNI.neomessage_statusbitfield_t_linErrorRXBreakNotZero_get(swigCPtr, this);
}
public void setLinErrorRXBreakTooShort(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_linErrorRXBreakTooShort_set(swigCPtr, this, value);
}
public long getLinErrorRXBreakTooShort() {
return icsneojavaJNI.neomessage_statusbitfield_t_linErrorRXBreakTooShort_get(swigCPtr, this);
}
public void setLinErrorRXSyncNot55(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_linErrorRXSyncNot55_set(swigCPtr, this, value);
}
public long getLinErrorRXSyncNot55() {
return icsneojavaJNI.neomessage_statusbitfield_t_linErrorRXSyncNot55_get(swigCPtr, this);
}
public void setLinErrorRXDataGreaterEight(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_linErrorRXDataGreaterEight_set(swigCPtr, this, value);
}
public long getLinErrorRXDataGreaterEight() {
return icsneojavaJNI.neomessage_statusbitfield_t_linErrorRXDataGreaterEight_get(swigCPtr, this);
}
public void setLinErrorTXRXMismatch(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_linErrorTXRXMismatch_set(swigCPtr, this, value);
}
public long getLinErrorTXRXMismatch() {
return icsneojavaJNI.neomessage_statusbitfield_t_linErrorTXRXMismatch_get(swigCPtr, this);
}
public void setLinErrorMessageIDParity(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_linErrorMessageIDParity_set(swigCPtr, this, value);
}
public long getLinErrorMessageIDParity() {
return icsneojavaJNI.neomessage_statusbitfield_t_linErrorMessageIDParity_get(swigCPtr, this);
}
public void setLinSyncFrameError(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_linSyncFrameError_set(swigCPtr, this, value);
}
public long getLinSyncFrameError() {
return icsneojavaJNI.neomessage_statusbitfield_t_linSyncFrameError_get(swigCPtr, this);
}
public void setLinIDFrameError(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_linIDFrameError_set(swigCPtr, this, value);
}
public long getLinIDFrameError() {
return icsneojavaJNI.neomessage_statusbitfield_t_linIDFrameError_get(swigCPtr, this);
}
public void setLinSlaveByteError(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_linSlaveByteError_set(swigCPtr, this, value);
}
public long getLinSlaveByteError() {
return icsneojavaJNI.neomessage_statusbitfield_t_linSlaveByteError_get(swigCPtr, this);
}
public void setRxTimeoutError(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_rxTimeoutError_set(swigCPtr, this, value);
}
public long getRxTimeoutError() {
return icsneojavaJNI.neomessage_statusbitfield_t_rxTimeoutError_get(swigCPtr, this);
}
public void setLinNoSlaveData(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_linNoSlaveData_set(swigCPtr, this, value);
}
public long getLinNoSlaveData() {
return icsneojavaJNI.neomessage_statusbitfield_t_linNoSlaveData_get(swigCPtr, this);
}
public void setCanfdESI(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_canfdESI_set(swigCPtr, this, value);
}
public long getCanfdESI() {
return icsneojavaJNI.neomessage_statusbitfield_t_canfdESI_get(swigCPtr, this);
}
public void setCanfdIDE(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_canfdIDE_set(swigCPtr, this, value);
}
public long getCanfdIDE() {
return icsneojavaJNI.neomessage_statusbitfield_t_canfdIDE_get(swigCPtr, this);
}
public void setCanfdRTR(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_canfdRTR_set(swigCPtr, this, value);
}
public long getCanfdRTR() {
return icsneojavaJNI.neomessage_statusbitfield_t_canfdRTR_get(swigCPtr, this);
}
public void setCanfdFDF(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_canfdFDF_set(swigCPtr, this, value);
}
public long getCanfdFDF() {
return icsneojavaJNI.neomessage_statusbitfield_t_canfdFDF_get(swigCPtr, this);
}
public void setCanfdBRS(long value) {
icsneojavaJNI.neomessage_statusbitfield_t_canfdBRS_set(swigCPtr, this, value);
}
public long getCanfdBRS() {
return icsneojavaJNI.neomessage_statusbitfield_t_canfdBRS_get(swigCPtr, this);
}
public void setStatusBitfield(long[] value) {
icsneojavaJNI.neomessage_statusbitfield_t_statusBitfield_set(swigCPtr, this, value);
}
public long[] getStatusBitfield() {
return icsneojavaJNI.neomessage_statusbitfield_t_statusBitfield_get(swigCPtr, this);
}
public neomessage_statusbitfield_t() {
this(icsneojavaJNI.new_neomessage_statusbitfield_t(), true);
}
}
+115
View File
@@ -0,0 +1,115 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 4.0.0
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
public class neomessage_t {
private transient long swigCPtr;
protected transient boolean swigCMemOwn;
protected neomessage_t(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
protected static long getCPtr(neomessage_t obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@SuppressWarnings("deprecation")
protected void finalize() {
delete();
}
public synchronized void delete() {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
icsneojavaJNI.delete_neomessage_t(swigCPtr);
}
swigCPtr = 0;
}
}
public void setStatus(neomessage_statusbitfield_t value) {
icsneojavaJNI.neomessage_t_status_set(swigCPtr, this, neomessage_statusbitfield_t.getCPtr(value), value);
}
public neomessage_statusbitfield_t getStatus() {
long cPtr = icsneojavaJNI.neomessage_t_status_get(swigCPtr, this);
return (cPtr == 0) ? null : new neomessage_statusbitfield_t(cPtr, false);
}
public void setTimestamp(java.math.BigInteger value) {
icsneojavaJNI.neomessage_t_timestamp_set(swigCPtr, this, value);
}
public java.math.BigInteger getTimestamp() {
return icsneojavaJNI.neomessage_t_timestamp_get(swigCPtr, this);
}
public void setTimestampReserved(java.math.BigInteger value) {
icsneojavaJNI.neomessage_t_timestampReserved_set(swigCPtr, this, value);
}
public java.math.BigInteger getTimestampReserved() {
return icsneojavaJNI.neomessage_t_timestampReserved_get(swigCPtr, this);
}
public void setData(byte[] value) {
icsneojavaJNI.neomessage_t_data_set(swigCPtr, this, value);
}
public byte[] getData() {
return icsneojavaJNI.neomessage_t_data_get(swigCPtr, this);
}
public void setLength(long value) {
icsneojavaJNI.neomessage_t_length_set(swigCPtr, this, value);
}
public long getLength() {
return icsneojavaJNI.neomessage_t_length_get(swigCPtr, this);
}
public void setHeader(short[] value) {
icsneojavaJNI.neomessage_t_header_set(swigCPtr, this, value);
}
public short[] getHeader() {
return icsneojavaJNI.neomessage_t_header_get(swigCPtr, this);
}
public void setNetid(int value) {
icsneojavaJNI.neomessage_t_netid_set(swigCPtr, this, value);
}
public int getNetid() {
return icsneojavaJNI.neomessage_t_netid_get(swigCPtr, this);
}
public void setType(short value) {
icsneojavaJNI.neomessage_t_type_set(swigCPtr, this, value);
}
public short getType() {
return icsneojavaJNI.neomessage_t_type_get(swigCPtr, this);
}
public void setReserved(short[] value) {
icsneojavaJNI.neomessage_t_reserved_set(swigCPtr, this, value);
}
public short[] getReserved() {
return icsneojavaJNI.neomessage_t_reserved_get(swigCPtr, this);
}
public neomessage_t() {
this(icsneojavaJNI.new_neomessage_t(), true);
}
}
+98
View File
@@ -0,0 +1,98 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 4.0.0
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
public class neoversion_t {
private transient long swigCPtr;
protected transient boolean swigCMemOwn;
protected neoversion_t(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
protected static long getCPtr(neoversion_t obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
@SuppressWarnings("deprecation")
protected void finalize() {
delete();
}
public synchronized void delete() {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
icsneojavaJNI.delete_neoversion_t(swigCPtr);
}
swigCPtr = 0;
}
}
public void setMajor(int value) {
icsneojavaJNI.neoversion_t_major_set(swigCPtr, this, value);
}
public int getMajor() {
return icsneojavaJNI.neoversion_t_major_get(swigCPtr, this);
}
public void setMinor(int value) {
icsneojavaJNI.neoversion_t_minor_set(swigCPtr, this, value);
}
public int getMinor() {
return icsneojavaJNI.neoversion_t_minor_get(swigCPtr, this);
}
public void setPatch(int value) {
icsneojavaJNI.neoversion_t_patch_set(swigCPtr, this, value);
}
public int getPatch() {
return icsneojavaJNI.neoversion_t_patch_get(swigCPtr, this);
}
public void setMetadata(String value) {
icsneojavaJNI.neoversion_t_metadata_set(swigCPtr, this, value);
}
public String getMetadata() {
return icsneojavaJNI.neoversion_t_metadata_get(swigCPtr, this);
}
public void setBuildBranch(String value) {
icsneojavaJNI.neoversion_t_buildBranch_set(swigCPtr, this, value);
}
public String getBuildBranch() {
return icsneojavaJNI.neoversion_t_buildBranch_get(swigCPtr, this);
}
public void setBuildTag(String value) {
icsneojavaJNI.neoversion_t_buildTag_set(swigCPtr, this, value);
}
public String getBuildTag() {
return icsneojavaJNI.neoversion_t_buildTag_get(swigCPtr, this);
}
public void setReserved(String value) {
icsneojavaJNI.neoversion_t_reserved_set(swigCPtr, this, value);
}
public String getReserved() {
return icsneojavaJNI.neoversion_t_reserved_get(swigCPtr, this);
}
public neoversion_t() {
this(icsneojavaJNI.new_neoversion_t(), true);
}
}
+1
View File
@@ -78,6 +78,7 @@ public:
DriverFailedToClose = 0x3003,
PacketChecksumError = 0x3004,
TransmitBufferFull = 0x3005,
DeviceInUse = 0x3006,
PCAPCouldNotStart = 0x3102,
PCAPCouldNotFindDevices = 0x3103,
PacketDecodingError = 0x3104,
+1
View File
@@ -5,6 +5,7 @@ namespace icsneo {
enum class Command : uint8_t {
EnableNetworkCommunication = 0x07,
EnableNetworkCommunicationEx = 0x08,
RequestSerialNumber = 0xA1,
SetSettings = 0xA4, // Previously known as RED_CMD_SET_BAUD_REQ, follow up with SaveSettings to write to EEPROM
//GetSettings = 0xA5, // Previously known as RED_CMD_READ_BAUD_REQ, now unused
+22 -12
View File
@@ -1,7 +1,7 @@
#ifndef __COMMUNICATION_H_
#define __COMMUNICATION_H_
#include "icsneo/communication/icommunication.h"
#include "icsneo/communication/driver.h"
#include "icsneo/communication/command.h"
#include "icsneo/communication/network.h"
#include "icsneo/communication/packet.h"
@@ -24,10 +24,12 @@ class Communication {
public:
Communication(
device_eventhandler_t report,
std::unique_ptr<ICommunication> com,
std::shared_ptr<Packetizer> p,
std::unique_ptr<Encoder> e,
std::unique_ptr<Decoder> md) : packetizer(p), encoder(std::move(e)), decoder(std::move(md)), report(report), impl(std::move(com)) {}
std::unique_ptr<Driver>&& driver,
std::function<std::unique_ptr<Packetizer>()> makeConfiguredPacketizer,
std::unique_ptr<Encoder>&& e,
std::unique_ptr<Decoder>&& md) : makeConfiguredPacketizer(makeConfiguredPacketizer), encoder(std::move(e)), decoder(std::move(md)), report(report), driver(std::move(driver)) {
packetizer = makeConfiguredPacketizer();
}
virtual ~Communication() { close(); }
bool open();
@@ -35,10 +37,10 @@ public:
bool isOpen();
virtual void spawnThreads();
virtual void joinThreads();
bool rawWrite(const std::vector<uint8_t>& bytes) { return impl->write(bytes); }
bool rawWrite(const std::vector<uint8_t>& bytes) { return driver->write(bytes); }
virtual bool sendPacket(std::vector<uint8_t>& bytes);
void setWriteBlocks(bool blocks) { impl->writeBlocks = blocks; }
void setWriteBlocks(bool blocks) { driver->writeBlocks = blocks; }
virtual bool sendCommand(Command cmd, bool boolean) { return sendCommand(cmd, std::vector<uint8_t>({ (uint8_t)boolean })); }
virtual bool sendCommand(Command cmd, std::vector<uint8_t> arguments = {});
@@ -47,18 +49,26 @@ public:
int addMessageCallback(const MessageCallback& cb);
bool removeMessageCallback(int id);
std::shared_ptr<Message> waitForMessageSync(MessageFilter f = MessageFilter(), std::chrono::milliseconds timeout = std::chrono::milliseconds(50)) {
return waitForMessageSync(std::make_shared<MessageFilter>(f), timeout);
std::shared_ptr<Message> waitForMessageSync(
MessageFilter f = MessageFilter(),
std::chrono::milliseconds timeout = std::chrono::milliseconds(50)) {
return waitForMessageSync([](){ return true; }, f, timeout);
}
std::shared_ptr<Message> waitForMessageSync(std::shared_ptr<MessageFilter> f, std::chrono::milliseconds timeout = std::chrono::milliseconds(50));
// onceWaitingDo is a way to avoid race conditions.
// Return false to bail early, in case your initial command failed.
std::shared_ptr<Message> waitForMessageSync(
std::function<bool(void)> onceWaitingDo,
MessageFilter f = MessageFilter(),
std::chrono::milliseconds timeout = std::chrono::milliseconds(50));
std::shared_ptr<Packetizer> packetizer; // Ownership is shared with the encoder
std::function<std::unique_ptr<Packetizer>()> makeConfiguredPacketizer;
std::unique_ptr<Packetizer> packetizer;
std::unique_ptr<Encoder> encoder;
std::unique_ptr<Decoder> decoder;
device_eventhandler_t report;
protected:
std::unique_ptr<ICommunication> impl;
std::unique_ptr<Driver> driver;
static int messageCallbackIDCounter;
std::mutex messageCallbacksLock;
std::map<int, MessageCallback> messageCallbacks;
@@ -1,5 +1,5 @@
#ifndef __ICOMMUNICATION_H_
#define __ICOMMUNICATION_H_
#ifndef __DRIVER_H_
#define __DRIVER_H_
#include <vector>
#include <chrono>
@@ -12,10 +12,10 @@
namespace icsneo {
class ICommunication {
class Driver {
public:
ICommunication(const device_eventhandler_t& handler) : report(handler) {}
virtual ~ICommunication() {}
Driver(const device_eventhandler_t& handler) : report(handler) {}
virtual ~Driver() {}
virtual bool open() = 0;
virtual bool isOpen() = 0;
virtual bool close() = 0;
+6 -5
View File
@@ -15,14 +15,15 @@ namespace icsneo {
class Encoder {
public:
Encoder(device_eventhandler_t report, std::shared_ptr<Packetizer> p) : packetizer(p), report(report) {}
bool encode(std::vector<uint8_t>& result, const std::shared_ptr<Message>& message);
bool encode(std::vector<uint8_t>& result, Command cmd, bool boolean) { return encode(result, cmd, std::vector<uint8_t>({ (uint8_t)boolean })); }
bool encode(std::vector<uint8_t>& result, Command cmd, std::vector<uint8_t> arguments = {});
Encoder(device_eventhandler_t report) : report(report) {}
bool encode(const Packetizer& packetizer, std::vector<uint8_t>& result, const std::shared_ptr<Message>& message);
bool encode(const Packetizer& packetizer, std::vector<uint8_t>& result, Command cmd, bool boolean) {
return encode(packetizer, result, cmd, std::vector<uint8_t>({ (uint8_t)boolean }));
}
bool encode(const Packetizer& packetizer, std::vector<uint8_t>& result, Command cmd, std::vector<uint8_t> arguments = {});
bool supportCANFD = false;
private:
std::shared_ptr<Packetizer> packetizer;
device_eventhandler_t report;
};
@@ -11,11 +11,11 @@ namespace icsneo {
class Main51MessageCallback : public MessageCallback {
public:
Main51MessageCallback(fn_messageCallback cb, std::shared_ptr<Main51MessageFilter> f) : MessageCallback(cb, f) {}
Main51MessageCallback(fn_messageCallback cb, Main51MessageFilter f = Main51MessageFilter()) : MessageCallback(cb, std::make_shared<Main51MessageFilter>(f)) {}
Main51MessageCallback(fn_messageCallback cb, Main51MessageFilter f = Main51MessageFilter()) : MessageCallback(cb, Main51MessageFilter(f)) {}
// Allow the filter to be placed first if the user wants (maybe in the case of a lambda)
Main51MessageCallback(std::shared_ptr<Main51MessageFilter> f, fn_messageCallback cb) : MessageCallback(cb, f) {}
Main51MessageCallback(Main51MessageFilter f, fn_messageCallback cb) : MessageCallback(cb, std::make_shared<Main51MessageFilter>(f)) {}
Main51MessageCallback(Main51MessageFilter f, fn_messageCallback cb) : MessageCallback(cb, Main51MessageFilter(f)) {}
};
};
@@ -11,7 +11,7 @@ class MessageFilter {
public:
MessageFilter() {}
MessageFilter(Network::Type type) : type(type) {}
MessageFilter(Network::NetID netid) : netid(netid) {}
MessageFilter(Network::NetID netid) : type(Network::GetTypeOfNetID(netid)), netid(netid) {}
virtual ~MessageFilter() {}
// When getting "all" types of messages, include the ones marked as "internal only"
bool includeInternalInAny = false;
@@ -5,15 +5,20 @@
#include "icsneo/communication/packet.h"
#include "icsneo/device/extensions/flexray/opcode.h"
#include "icsneo/device/extensions/flexray/pocstatus.h"
#include "icsneo/device/extensions/flexray/channel.h"
namespace icsneo {
// Internal message which gives us the state of the FlexRay Controllers
class FlexRayControlMessage : public Message {
public:
static std::vector<uint8_t> BuildBaseControlArgs(uint8_t controller, FlexRay::Opcode op, std::initializer_list<uint8_t> args);
static std::vector<uint8_t> BuildBaseControlArgs(uint8_t controller, FlexRay::Opcode op, const std::vector<uint8_t>& args);
static std::vector<uint8_t> BuildReadCCRegsArgs(uint8_t controller, uint16_t startAddress, uint8_t numRegisters = 1);
static std::vector<uint8_t> BuildWriteCCRegArgs(uint8_t controller, uint16_t address, uint32_t value);
static std::vector<uint8_t> BuildAddConfiguredTxMessageArgs(
uint8_t controller, uint16_t descriptionId, uint16_t slotId, uint8_t baseCycle, uint8_t cycleReps, FlexRay::Channel channel);
static std::vector<uint8_t> BuildWriteMessageBufferArgs(
uint8_t controller, uint16_t bufferId, const std::vector<uint8_t>& data, uint16_t desiredSize);
FlexRayControlMessage(const Packet& packet);
virtual ~FlexRayControlMessage() = default;
@@ -4,6 +4,7 @@
#include "icsneo/communication/message/message.h"
#include "icsneo/device/extensions/flexray/symbol.h"
#include "icsneo/device/extensions/flexray/crcstatus.h"
#include "icsneo/device/extensions/flexray/channel.h"
namespace icsneo {
@@ -17,14 +18,15 @@ public:
uint16_t headerCRC = 0;
FlexRay::CRCStatus crcStatus = FlexRay::CRCStatus::OK;
uint32_t frameCRC = 0;
bool channelB = false;
FlexRay::Channel channel = FlexRay::Channel::None;
bool nullFrame = false;
bool reserved0was1 = false;
bool payloadPreamble = false;
bool sync = false;
bool startup = false;
bool dynamic = false;
uint8_t cycle = 0;
uint8_t cycle = 0; // baseCycle when transmitting
uint8_t cycleRepetition = 0; // only for transmit
};
}
@@ -2,14 +2,15 @@
#define __MAIN51MESSAGE_H_
#include "icsneo/communication/message/message.h"
#include "icsneo/communication/communication.h"
#include "icsneo/communication/command.h"
namespace icsneo {
class Main51Message : public Message {
public:
virtual ~Main51Message() = default;
Command command;
Command command = Command(0);
bool forceShortFormat = false; // Necessary for EnableNetworkCom and EnableNetworkComEx
};
}
@@ -2,9 +2,10 @@
#define __MULTICHANNELCOMMUNICATION_H_
#include "icsneo/communication/communication.h"
#include "icsneo/communication/icommunication.h"
#include "icsneo/communication/driver.h"
#include "icsneo/communication/command.h"
#include "icsneo/communication/encoder.h"
#include "icsneo/third-party/readerwriterqueue/readerwriterqueue.h"
namespace icsneo {
@@ -12,10 +13,10 @@ class MultiChannelCommunication : public Communication {
public:
MultiChannelCommunication(
device_eventhandler_t err,
std::unique_ptr<ICommunication> com,
std::shared_ptr<Packetizer> p,
std::unique_ptr<Driver> com,
std::function<std::unique_ptr<Packetizer>()> makeConfiguredPacketizer,
std::unique_ptr<Encoder> e,
std::unique_ptr<Decoder> md) : Communication(err, std::move(com), p, std::move(e), std::move(md)) {}
std::unique_ptr<Decoder> md) : Communication(err, std::move(com), makeConfiguredPacketizer, std::move(e), std::move(md)) {}
void spawnThreads() override;
void joinThreads() override;
bool sendPacket(std::vector<uint8_t>& bytes) override;
@@ -24,6 +25,8 @@ protected:
bool preprocessPacket(std::deque<uint8_t>& usbReadFifo);
private:
static constexpr const size_t NUM_SUPPORTED_VNETS = 1;
enum class CommandType : uint8_t {
PlasmaReadRequest = 0x10, // Status read request to HSC
PlasmaStatusResponse = 0x11, // Status response by HSC
@@ -45,7 +48,6 @@ private:
Microblaze_to_HostPC = 0x81 // Microblaze processor data to host PC
};
static bool FixSlaveVNETPacketNetID(Packet& packet);
enum class CoreMiniNetwork : uint8_t {
HSCAN1 = (0),
MSCAN1 = (1),
@@ -156,8 +158,11 @@ private:
CommandType currentCommandType;
size_t currentReadIndex = 0;
std::thread mainChannelReadThread;
void readTask();
std::thread hidReadThread;
std::array<std::thread, NUM_SUPPORTED_VNETS> vnetThreads;
std::array<moodycamel::BlockingReaderWriterQueue< std::vector<uint8_t> >, NUM_SUPPORTED_VNETS> vnetQueues;
void hidReadTask();
void vnetReadTask(size_t vnetIndex);
};
}
+1
View File
@@ -433,6 +433,7 @@ public:
return os;
}
friend bool operator==(const Network& net1, const Network& net2) { return net1.getNetID() == net2.getNetID(); }
friend bool operator!=(const Network& net1, const Network& net2) { return !(net1 == net2); }
private:
NetID value; // Always use setValue so that value and type stay in sync
+1 -1
View File
@@ -15,7 +15,7 @@ public:
Packetizer(device_eventhandler_t report) : report(report) {}
std::vector<uint8_t>& packetWrap(std::vector<uint8_t>& data, bool shortFormat);
std::vector<uint8_t>& packetWrap(std::vector<uint8_t>& data, bool shortFormat) const;
bool input(const std::vector<uint8_t>& bytes);
std::vector<std::shared_ptr<Packet>> output();
+24 -17
View File
@@ -86,7 +86,7 @@ public:
virtual size_t getNetworkCountByType(Network::Type) const;
virtual Network getNetworkByNumber(Network::Type, size_t) const;
virtual std::shared_ptr<FlexRay::Controller> getFlexRayControllerByNetwork(const Network&) const { return nullptr; }
virtual std::vector<std::shared_ptr<FlexRay::Controller>> getFlexRayControllers() const { return {}; }
const device_eventhandler_t& getEventHandler() const { return report; }
@@ -106,18 +106,16 @@ protected:
data.device = this;
}
template<typename Transport, typename Settings = NullSettings>
template<typename Driver, typename Settings = NullSettings>
void initialize() {
report = makeEventHandler();
auto transport = makeTransport<Transport>();
setupTransport(*transport);
auto packetizer = makePacketizer();
setupPacketizer(*packetizer);
auto encoder = makeEncoder(packetizer);
auto driver = makeDriver<Driver>();
setupDriver(*driver);
auto encoder = makeEncoder();
setupEncoder(*encoder);
auto decoder = makeDecoder();
setupDecoder(*decoder);
com = makeCommunication(std::move(transport), packetizer, std::move(encoder), std::move(decoder));
com = makeCommunication(std::move(driver), std::bind(&Device::makeConfiguredPacketizer, this), std::move(encoder), std::move(decoder));
setupCommunication(*com);
settings = makeSettings<Settings>(com);
setupSettings(*settings);
@@ -132,24 +130,29 @@ protected:
};
}
template<typename Transport>
std::unique_ptr<ICommunication> makeTransport() { return std::unique_ptr<ICommunication>(new Transport(report, getWritableNeoDevice())); }
virtual void setupTransport(ICommunication&) {}
template<typename Driver>
std::unique_ptr<Driver> makeDriver() { return std::unique_ptr<Driver>(new Driver(report, getWritableNeoDevice())); }
virtual void setupDriver(Driver&) {}
virtual std::shared_ptr<Packetizer> makePacketizer() { return std::make_shared<Packetizer>(report); }
virtual std::unique_ptr<Packetizer> makePacketizer() { return std::unique_ptr<Packetizer>(new Packetizer(report)); }
virtual void setupPacketizer(Packetizer&) {}
std::unique_ptr<Packetizer> makeConfiguredPacketizer() {
auto packetizer = makePacketizer();
setupPacketizer(*packetizer);
return packetizer;
}
virtual std::unique_ptr<Encoder> makeEncoder(std::shared_ptr<Packetizer> p) { return std::unique_ptr<Encoder>(new Encoder(report, p)); }
virtual std::unique_ptr<Encoder> makeEncoder() { return std::unique_ptr<Encoder>(new Encoder(report)); }
virtual void setupEncoder(Encoder&) {}
virtual std::unique_ptr<Decoder> makeDecoder() { return std::unique_ptr<Decoder>(new Decoder(report)); }
virtual void setupDecoder(Decoder&) {}
virtual std::shared_ptr<Communication> makeCommunication(
std::unique_ptr<ICommunication> t,
std::shared_ptr<Packetizer> p,
std::unique_ptr<Driver> t,
std::function<std::unique_ptr<Packetizer>()> makeConfiguredPacketizer,
std::unique_ptr<Encoder> e,
std::unique_ptr<Decoder> d) { return std::make_shared<Communication>(report, std::move(t), p, std::move(e), std::move(d)); }
std::unique_ptr<Decoder> d) { return std::make_shared<Communication>(report, std::move(t), makeConfiguredPacketizer, std::move(e), std::move(d)); }
virtual void setupCommunication(Communication&) {}
template<typename Settings>
@@ -163,6 +166,10 @@ protected:
virtual void setupExtensions() {}
void addExtension(std::shared_ptr<DeviceExtension>&& extension);
// Hook for devices such as FIRE which need to inject traffic before RequestSerialNumber
// Return false to bail
virtual bool afterCommunicationOpen() { return true; }
template<typename Extension>
std::shared_ptr<Extension> getExtension() const {
@@ -186,7 +193,7 @@ private:
mutable std::mutex extensionsLock;
std::vector<std::shared_ptr<DeviceExtension>> extensions;
void forEachExtension(std::function<void(const std::shared_ptr<DeviceExtension>&)> fn);
void forEachExtension(std::function<bool(const std::shared_ptr<DeviceExtension>&)> fn);
std::vector<Network> supportedTXNetworks;
std::vector<Network> supportedRXNetworks;
+4
View File
@@ -36,6 +36,7 @@ public:
VCAN4_2EL = (0x0000000a),
RADIO_CANHUB = (0x0000000b),
VCAN3 = (0x00000010),
EtherBADGE = (0x00000016),
RED = (0x00000040),
ECU = (0x00000080),
IEVB = (0x00000100),
@@ -92,6 +93,8 @@ public:
return "RADIO_CANHUB";
case VCAN3:
return "ValueCAN 3";
case EtherBADGE:
return "EtherBADGE";
case RED:
return "neoVI RED";
case ECU:
@@ -179,6 +182,7 @@ private:
#define ICSNEO_DEVICETYPE_VCAN4_2EL ((devicetype_t)0x0000000a)
#define ICSNEO_DEVICETYPE_RADIO_CANHUB ((devicetype_t)0x0000000b)
#define ICSNEO_DEVICETYPE_VCAN3 ((devicetype_t)0x00000010)
#define ICSNEO_DEVICETYPE_ETHERBADGE ((devicetype_t)0x00000016)
#define ICSNEO_DEVICETYPE_RED ((devicetype_t)0x00000040)
#define ICSNEO_DEVICETYPE_ECU ((devicetype_t)0x00000080)
#define ICSNEO_DEVICETYPE_IEVB ((devicetype_t)0x00000100)
@@ -14,8 +14,17 @@ public:
DeviceExtension(Device& device) : device(device) {}
virtual ~DeviceExtension() = default;
virtual const char* getName() const = 0;
virtual void onDeviceOpen() {}
virtual void onGoOnline() {}
virtual void onGoOffline() {}
virtual void onDeviceClose() {}
virtual void handleMessage(const std::shared_ptr<Message>&) {}
// Return true to continue transmitting, success should be written to if false is returned
virtual bool transmitHook(const std::shared_ptr<Message>& message, bool& success) { (void)message; (void)success; return true; }
protected:
Device& device;
};
@@ -0,0 +1,22 @@
#ifndef __FLEXRAYCHANNEL_H_
#define __FLEXRAYCHANNEL_H_
#include <cstdint>
namespace icsneo {
namespace FlexRay {
// In some cases used as a bitfield
enum class Channel {
None = 0, // Usually an invalid/unset value
A = 1,
B = 2,
AB = 3
};
} // namespace FlexRay
} // namespace icsneo
#endif // __FLEXRAYCHANNEL_H_
@@ -0,0 +1,110 @@
#ifndef __FLEXRAYCLUSTER_H_
#define __FLEXRAYCLUSTER_H_
#ifdef __cplusplus
#include <cstdint>
#include "icsneo/communication/message/flexray/control/flexraycontrolmessage.h"
#include "icsneo/device/extensions/flexray/erayregister.h"
#include "icsneo/device/extensions/flexray/poccommand.h"
namespace icsneo {
namespace FlexRay {
namespace Cluster {
#endif // __cplusplus
typedef enum {
FLEXRAY_BAUDRATE_10M = 0,
FLEXRAY_BAUDRATE_5M = 1, // 5Mbit currently not supported in the monitor
FLEXRAY_BAUDRATE_2M5 = 2, // 2.5Mbit currently not supported in the monitor
FLEXRAY_BAUDRATE_2M5_ALT = 3 // Per the ERAY spec, 0b11 also means 2.5MBits
} neoflexray_speed_t;
typedef enum {
FLEXRAY_SPP_5 = 0, // FlexRay 2.1 requires this value to be 0
FLEXRAY_SPP_4 = 1,
FLEXRAY_SPP_6 = 2,
FLEXRAY_SPP_5_ALT = 3 // Per the ERAY spec, 0b11 also means sample point 5
} neoflexray_spp_t;
#ifdef __cplusplus
#define INIT(x) = x
#define neoflexray_cluster_config_t icsneo::FlexRay::Cluster::Configuration
struct Configuration {
#else // __cplusplus
#include <stdbool.h>
#include <stdint.h>
#define INIT(x)
typedef struct {
#endif // __cplusplus
neoflexray_speed_t Speed INIT(FLEXRAY_BAUDRATE_10M /* = 0 */); // gdSampleClockPeriod, pSamplesPerMicrotick, Baud Rate Prescaler
neoflexray_spp_t StrobePointPosition INIT(FLEXRAY_SPP_5 /* = 0 */);
uint8_t ActionPointOffset INIT(0);
uint32_t BitTimeNS INIT(0);
uint8_t CASRxLowMax INIT(0);
uint8_t ColdStartAttempts INIT(0);
uint32_t CycleCountMax INIT(0);
double CycleDurationSec INIT(0);
bool DetectNITError INIT(false);
uint8_t DynamicSlotIdlePhaseMinislots INIT(0); // In Minislot increments [0..2]
uint32_t IgnoreAfterTx INIT(0);
uint8_t ListenNoiseMacroticks INIT(0);
uint16_t MacroticksPerCycle INIT(0);
double MacrotickDurationSec INIT(0);
uint8_t MaxWithoutClockCorrectionFatal INIT(0);
uint8_t MaxWithoutClockCorrectionPassive INIT(0);
uint8_t MinislotActionPointOffsetMacroticks INIT(0);
uint32_t MinislotDurationMacroticks INIT(0); // gdMinislot
uint32_t NetworkIdleTimeMacroticks INIT(0);
uint8_t NetworkManagementVectorLengthBytes INIT(0);
uint32_t NumberOfMinislots INIT(0);
uint16_t NumberOfStaticSlots INIT(0);
uint32_t OffsetCorrectionStartMacroticks INIT(0);
uint8_t PayloadLengthOfStaticSlotInWords INIT(0);
uint32_t SafetyMarginMacroticks INIT(0);
double SampleClockPeriodSec INIT(0);
bool UseSampleClockPeriodSec INIT(false);
uint16_t StaticSlotMacroticks INIT(0); // gdStaticSlot
uint32_t SymbolWindowMacroticks INIT(0);
uint32_t SymbolWindowActionPointOffsetMacroticks INIT(0);
uint16_t SyncFrameIDCountMax INIT(0); // gSyncNodeMax
double TransceiverStandbyDelaySec INIT(false);
bool UseTransceiverStandbyDelaySec INIT(0);
uint8_t TransmissionStartSequenceDurationBits INIT(0); // gdTSSTransmitter
uint8_t WakeupRxIdleBits INIT(0);
uint8_t WakeupRxLowBits INIT(0);
uint16_t WakeupRxWindowBits INIT(0); // gdWakeupSymbolRxWindow
uint8_t WakeupTxActiveBits INIT(0); // gdWakeupSymbolTxLow (active = low here)
uint8_t WakeupTxIdleBits INIT(0);
#ifdef __cplusplus
};
#else
} neoflexray_cluster_config_t;
#endif
#ifdef __cplusplus
} // namespace Cluster
} // namespace FlexRay
} // namespace icsneo
#endif // __cplusplus
#endif // __FLEXRAYCLUSTER_H_
@@ -1,13 +1,21 @@
#ifndef __FLEXRAYCONTROLLER_H_
#define __FLEXRAYCONTROLLER_H_
#ifdef __cplusplus
#include <cstdint>
#include <memory>
#include <chrono>
#include <mutex>
#include "icsneo/communication/message/flexray/control/flexraycontrolmessage.h"
#include "icsneo/communication/message/flexray/flexraymessage.h"
#include "icsneo/device/extensions/flexray/messagebuffer.h"
#include "icsneo/device/extensions/flexray/erayregister.h"
#include "icsneo/device/extensions/flexray/poccommand.h"
#include "icsneo/device/extensions/flexray/pocstatus.h"
#include "icsneo/device/extensions/flexray/cluster.h"
#define INIT(x) = x
namespace icsneo {
@@ -17,21 +25,46 @@ namespace FlexRay {
class Controller {
public:
Controller(Device& device, uint8_t index) : device(device), index(index) {}
std::shared_ptr<FlexRayControlMessage> getStatus() const;
Controller(Device& device, uint8_t index, Network net) : device(device), index(index), network(net) {}
void _setStatus(std::shared_ptr<FlexRayControlMessage> msg);
// Begin Public Interface
std::shared_ptr<FlexRayControlMessage> getStatus() const;
const Network& getNetwork() const { return network; }
struct Configuration; // Forward declaration
std::pair<const Cluster::Configuration&, const Controller::Configuration&> getConfiguration() const;
void setConfiguration(Cluster::Configuration clConfig, Controller::Configuration coConfig);
bool getStartWhenGoingOnline() const { return startWhenGoingOnline; }
void setStartWhenGoingOnline(bool enable) { startWhenGoingOnline = enable; }
bool getAllowColdstart() const { return allowColdstart; }
void setAllowColdstart(bool enable) { allowColdstart = enable; }
bool getWakeupBeforeStart() const { return wakeupBeforeStart; }
void setWakeupBeforeStart(bool enable) { wakeupBeforeStart = enable; }
void getReady();
void start();
void addMessageBuffer(MessageBuffer buffer);
void clearMessageBuffers();
bool wakeup(std::chrono::milliseconds timeout = std::chrono::milliseconds(50));
bool configure(std::chrono::milliseconds timeout = std::chrono::milliseconds(2000));
bool getReady(std::chrono::milliseconds timeout = std::chrono::milliseconds(2000));
bool start(std::chrono::milliseconds timeout = std::chrono::milliseconds(2000));
bool transmit(const std::shared_ptr<FlexRayMessage>& frmsg);
bool halt(std::chrono::milliseconds timeout = std::chrono::milliseconds(50));
bool freeze(std::chrono::milliseconds timeout = std::chrono::milliseconds(50));
bool triggerMTS(std::chrono::milliseconds timeout = std::chrono::milliseconds(200));
// End Public Interface
private:
bool isPOCBusy() const { return readRegisterOr(ERAYRegister::SUCC1, 0x00000080) & 0x00000080; }
bool isClearAllRAMBusy() const { return readRegisterOr(ERAYRegister::MHDS, 0x00000080) & 0x00000080; }
bool isInputBufferHostBusy() const { return readRegisterOr(ERAYRegister::IBCR, 0x00008000) & 0x00008000; }
std::pair<bool, FlexRay::POCCommand> getCurrentPOCCommand(std::chrono::milliseconds timeout = std::chrono::milliseconds(50)) const;
bool setCurrentPOCCommand(
FlexRay::POCCommand cmd,
@@ -39,6 +72,14 @@ private:
std::chrono::milliseconds timeout = std::chrono::milliseconds(50));
bool wasCommandSuccessful(std::chrono::milliseconds timeout = std::chrono::milliseconds(50)) const;
std::pair<bool, FlexRay::POCStatus> getCurrentPOCStatus(std::chrono::milliseconds timeout = std::chrono::milliseconds(50)) const;
bool lockConfiguration(std::chrono::milliseconds timeout = std::chrono::milliseconds(150));
bool enterConfig(std::chrono::milliseconds timeout = std::chrono::milliseconds(50));
static uint16_t CalculateHCRC(const MessageBuffer& buf);
static uint16_t CalculateCycleFilter(uint8_t baseCycle, uint8_t cycleRepetition);
std::pair<bool, uint32_t> readRegister(
ERAYRegister reg,
std::chrono::milliseconds timeout = std::chrono::milliseconds(50)) const;
@@ -60,15 +101,107 @@ private:
Device& device;
uint8_t index;
Network network;
mutable std::mutex statusLock;
mutable std::mutex readRegisterLock;
std::shared_ptr<FlexRayControlMessage> status;
bool startWhenGoingOnline = false;
bool allowColdstart = false;
bool wakeupBeforeStart = false;
public:
#define neoflexray_controller_config_t icsneo::FlexRay::Controller::Configuration
struct Configuration {
#else // __cplusplus
#include <stdbool.h>
#include <stdint.h>
#define INIT(x)
typedef struct {
#endif // __cplusplus
uint16_t AcceptStartupRangeMicroticks INIT(0);
bool AllowHaltDueToClock INIT(false);
uint8_t AllowPassiveToActiveCyclePairs INIT(0);
uint8_t ClusterDriftDamping INIT(0);
bool ChannelA INIT(false);
bool ChannelB INIT(false);
uint8_t DecodingCorrectionMicroticks INIT(0);
uint8_t DelayCompensationAMicroticks INIT(0);
uint8_t DelayCompensationBMicroticks INIT(0);
uint8_t ExternOffsetCorrectionControl INIT(0);
uint8_t ExternRateCorrectionControl INIT(0);
uint8_t ExternOffsetCorrectionMicroticks INIT(0);
uint8_t ExternRateCorrectionMicroticks INIT(0);
bool ExternalSync INIT(false);
bool UseExternalSync INIT(false);
bool FallBackInternal INIT(false);
bool UseFallBackInternal INIT(false);
uint16_t KeySlotID INIT(0);
bool KeySlotOnlyEnabled INIT(false); // pSingleSlotEnabled (TSM)
bool KeySlotUsedForStartup INIT(false); // pKeySlotUsedForStartup (TXST)
bool KeySlotUsedForSync INIT(false); // pKeySlotUsedForSync (TXSY)
uint16_t LatestTxMinislot INIT(0);
uint32_t ListenTimeout INIT(0);
uint8_t MacroInitialOffsetA INIT(0); // Valid 2..72
uint8_t MacroInitialOffsetB INIT(0); // Valid 2..72
uint32_t MaximumDynamicPayloadLengthWords INIT(0);
uint8_t MicroInitialOffsetA INIT(0); // Valid 0..240
uint8_t MicroInitialOffsetB INIT(0); // Valid 0..240
uint32_t MicroPerCycle INIT(0);
double MicrotickDurationSec INIT(0);
bool UseMicrotickDurationSec INIT(false);
bool MTSOnA INIT(false);
bool MTSOnB INIT(false);
bool NMVectorEarlyUpdate INIT(false);
bool UseNMVectorEarlyUpdate INIT(false);
uint16_t OffsetCorrectionOutMicroticks INIT(0);
uint16_t RateCorrectionOutMicroticks INIT(0); // pdMaxDrift and pRateCorrectionOut
uint32_t SamplesPerMicrotick INIT(0);
bool UseSamplesPerMicrotick INIT(false);
uint16_t SecondKeySlotID INIT(0);
bool TwoKeySlotMode INIT(false);
uint8_t WakeupPattern INIT(0);
bool WakeupOnChannelB INIT(false);
#ifndef __cplusplus
} neoflexray_controller_config_t;
#else
};
private:
bool configDirty = false;
Cluster::Configuration clusterConfig;
Controller::Configuration controllerConfig;
std::vector<std::shared_ptr<MessageBuffer>> messageBuffers;
};
} // namespace FlexRay
} // namespace icsneo
#endif // __cplusplus
#endif // __FLEXRAYCONTROLLER_H_
@@ -5,6 +5,8 @@
namespace icsneo {
namespace FlexRay {
enum class ERAYRegister : uint32_t {
// Customer Registers : Not Part of ERAY, part of FUJITSU FlexRay ASSP MB88121C
VER = 0x0000,// Version Information Register reset = 0440_79FF Access = r
@@ -100,6 +102,8 @@ enum class ERAYRegister : uint32_t {
NDAT1 = 0x0330,// New Data Register 1 0000_0000 r
NDAT2 = 0x0334,// New Data Register 2 0000_0000 r
ENDN = 0x03F4,// Endian check, 8765_4321 r
WRHS1 = 0x0500,// Write Header Section Register 1
WRHS2 = 0x0504,// Write Header Section Register 2
WRHS3 = 0x0508,// Write Header Section Register 3
@@ -111,6 +115,8 @@ enum class ERAYRegister : uint32_t {
OBCR = 0x714,
};
} // namespace FlexRay
} // namespace icsneo
#endif // __ERAYREGISTER_H_
@@ -16,9 +16,14 @@ class Controller;
class Extension : public DeviceExtension {
public:
Extension(Device& device, uint8_t controllerCount);
Extension(Device& device, const std::vector<Network>& controllerNetworks);
const char* getName() const override { return "FlexRay"; }
void onGoOnline() override;
void onGoOffline() override;
void handleMessage(const std::shared_ptr<Message>& message) override;
bool transmitHook(const std::shared_ptr<Message>& message, bool& success) override;
std::shared_ptr<Controller> getController(uint8_t index) const {
if(index >= controllers.size())
@@ -0,0 +1,52 @@
#ifndef __FLEXRAYMESSAGEBUFFER_H_
#define __FLEXRAYMESSAGEBUFFER_H_
#ifdef __cplusplus
#include <cstdint>
namespace icsneo {
namespace FlexRay {
#define INIT(x) = x
#define neoflexray_message_buffer_t icsneo::FlexRay::MessageBuffer
struct MessageBuffer {
#else // __cplusplus
#include <stdbool.h>
#include <stdint.h>
#define INIT(x)
typedef struct {
#endif // __cplusplus
bool isDynamic INIT(false);
bool isSync INIT(false); // Must be set if isStartup is set!
bool isStartup INIT(false);
bool isNMFrame INIT(false);
bool isTransmit INIT(false);
uint16_t frameID INIT(0);
bool channelA INIT(false);
bool channelB INIT(false);
uint8_t frameLengthBytes INIT(0);
uint8_t baseCycle INIT(0);
uint8_t cycleRepetition INIT(0);
bool continuousMode INIT(false);
uint16_t _dataPointer INIT(0); // For internal use
uint16_t _id INIT(0); // For internal use
#ifndef __cplusplus
} neoflexray_message_buffer_t;
#else
};
} // namespace FlexRay
} // namespace icsneo
#endif // __cplusplus
#endif // __FLEXRAYMESSAGEBUFFER_H_
@@ -14,7 +14,7 @@ enum class Opcode : uint8_t {
WriteCCReg = 0x02,
WriteMessageBuffer = 0x03,
ReadCCStatus = 0x04,
AddConfiguredMessage = 0x05,
AddConfiguredTxMessage = 0x05,
InitForRun = 0x06,
Unknown = 0xff
};
@@ -14,6 +14,7 @@ enum class POCStatus : uint8_t {
NormalPassive = 0x03,
Halt = 0x04,
MonitorMode = 0x05,
Config = 0x0f,
WakeupStandby = 0x10,
WakeupListen = 0x11,
WakeupSend = 0x12,
@@ -0,0 +1,62 @@
#ifndef __ETHERBADGE_H_
#define __ETHERBADGE_H_
#include "icsneo/device/device.h"
#include "icsneo/device/devicetype.h"
#include "icsneo/communication/packetizer.h"
#include "icsneo/communication/decoder.h"
#include "icsneo/platform/stm32.h"
namespace icsneo {
class EtherBADGE : public Device {
public:
// Serial numbers start with EB
static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::EtherBADGE;
static constexpr const uint16_t PRODUCT_ID = 0x1107;
static constexpr const char* SERIAL_START = "EB";
static std::vector<std::shared_ptr<Device>> Find() {
std::vector<std::shared_ptr<Device>> found;
for(auto neodevice : STM32::FindByProduct(PRODUCT_ID))
found.emplace_back(new EtherBADGE(neodevice));
return found;
}
static const std::vector<Network>& GetSupportedNetworks() {
static std::vector<Network> supportedNetworks = {
Network::NetID::HSCAN,
Network::NetID::LIN,
Network::NetID::OP_Ethernet1
};
return supportedNetworks;
}
EtherBADGE(neodevice_t neodevice) : Device(neodevice) {
getWritableNeoDevice().type = DEVICE_TYPE;
productId = PRODUCT_ID;
initialize<STM32>();
}
protected:
virtual void setupEncoder(Encoder& encoder) override {
Device::setupEncoder(encoder);
encoder.supportCANFD = true;
}
virtual void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
for(auto& netid : GetSupportedNetworks())
rxNetworks.emplace_back(netid);
}
// The supported TX networks are the same as the supported RX networks for this device
virtual void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
};
}
#endif
@@ -45,18 +45,12 @@ public:
Bootloader = 'B'
};
bool open() override {
if(!com)
return false;
if(!com->open())
bool afterCommunicationOpen() override {
if(!Device::afterCommunicationOpen()) // Doesn't do anything right now but just in case it gets added to later
return false;
// Enter mode is only needed on very old FIRE devices (white board), will be ignored by newer devices
if(!enterMode(Mode::Application))
return false;
return Device::open();
return enterMode(Mode::Application);
}
bool enterMode(Mode mode) {

Some files were not shown because too many files have changed in this diff Show More