mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-09-23 01:09:47 +02:00
Compare commits
6
Commits
4dcb944d35
...
1.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
245073f9d5 | ||
|
|
c4e858d346 | ||
|
|
b3d47f2ae5 | ||
|
|
b94ade1ef6 | ||
|
|
d9ea5e085e | ||
|
|
5125520e76 |
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
project(libicsneo VERSION 0.3.0)
|
project(libicsneo VERSION 1.0.0)
|
||||||
|
|
||||||
cmake_policy(SET CMP0074 NEW)
|
cmake_policy(SET CMP0074 NEW)
|
||||||
if(POLICY CMP0135)
|
if(POLICY CMP0135)
|
||||||
@@ -246,6 +246,7 @@ set(SRC_FILES
|
|||||||
communication/message/ethphymessage.cpp
|
communication/message/ethphymessage.cpp
|
||||||
communication/message/linmessage.cpp
|
communication/message/linmessage.cpp
|
||||||
communication/message/livedatamessage.cpp
|
communication/message/livedatamessage.cpp
|
||||||
|
communication/message/logdatamessage.cpp
|
||||||
communication/message/tc10statusmessage.cpp
|
communication/message/tc10statusmessage.cpp
|
||||||
communication/message/gptpstatusmessage.cpp
|
communication/message/gptpstatusmessage.cpp
|
||||||
communication/message/ethernetstatusmessage.cpp
|
communication/message/ethernetstatusmessage.cpp
|
||||||
@@ -429,7 +430,6 @@ if(LIBICSNEO_ENABLE_RAW_ETHERNET)
|
|||||||
add_definitions(-DWPCAP -DHAVE_REMOTE)
|
add_definitions(-DWPCAP -DHAVE_REMOTE)
|
||||||
else()
|
else()
|
||||||
target_include_directories(icsneocpp PUBLIC AFTER ${LIBICSNEO_NPCAP_INCLUDE_DIR})
|
target_include_directories(icsneocpp PUBLIC AFTER ${LIBICSNEO_NPCAP_INCLUDE_DIR})
|
||||||
add_definitions(-DNPCAP)
|
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
find_package(PCAP REQUIRED)
|
find_package(PCAP REQUIRED)
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "icsneo/communication/message/mdiomessage.h"
|
#include "icsneo/communication/message/mdiomessage.h"
|
||||||
#include "icsneo/communication/message/extendeddatamessage.h"
|
#include "icsneo/communication/message/extendeddatamessage.h"
|
||||||
#include "icsneo/communication/message/livedatamessage.h"
|
#include "icsneo/communication/message/livedatamessage.h"
|
||||||
|
#include "icsneo/communication/message/logdatamessage.h"
|
||||||
#include "icsneo/communication/message/diskdatamessage.h"
|
#include "icsneo/communication/message/diskdatamessage.h"
|
||||||
#include "icsneo/communication/message/hardwareinfo.h"
|
#include "icsneo/communication/message/hardwareinfo.h"
|
||||||
#include "icsneo/communication/message/tc10statusmessage.h"
|
#include "icsneo/communication/message/tc10statusmessage.h"
|
||||||
@@ -491,7 +492,16 @@ bool Decoder::decode(std::shared_ptr<Message>& result, const std::shared_ptr<Pac
|
|||||||
result = std::make_shared<DiskDataMessage>(std::move(packet->data));
|
result = std::make_shared<DiskDataMessage>(std::move(packet->data));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
case Network::NetID::Data_To_Host: {
|
||||||
|
result = LogDataMessage::DecodeToMessage(packet->data);
|
||||||
|
if(!result) {
|
||||||
|
report(APIEvent::Type::PacketDecodingError, APIEvent::Severity::EventWarning);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#include "icsneo/communication/message/logdatamessage.h"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace icsneo;
|
||||||
|
|
||||||
|
std::shared_ptr<LogDataMessage> LogDataMessage::DecodeToMessage(const std::vector<uint8_t>& bytestream) {
|
||||||
|
if(bytestream.size() % 2 != 0)
|
||||||
|
return nullptr;
|
||||||
|
const auto* begin = (char16_t*)bytestream.data();
|
||||||
|
const auto* end = begin + (bytestream.size() / sizeof(char16_t));
|
||||||
|
return std::make_shared<LogDataMessage>(std::wstring(begin,end));
|
||||||
|
}
|
||||||
@@ -405,6 +405,14 @@ bool Device::close() {
|
|||||||
return com->close();
|
return com->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Device::enableLogData() {
|
||||||
|
return com->sendCommand(Command::EnableLogData, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Device::disableLogData() {
|
||||||
|
return com->sendCommand(Command::EnableLogData, false);
|
||||||
|
}
|
||||||
|
|
||||||
bool Device::goOnline() {
|
bool Device::goOnline() {
|
||||||
if(!enableNetworkCommunication(true))
|
if(!enableNetworkCommunication(true))
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ enum class Command : uint8_t {
|
|||||||
FlexRayControl = 0xF3,
|
FlexRayControl = 0xF3,
|
||||||
CoreMiniPreload = 0xF4, // Previously known as RED_CMD_COREMINI_PRELOAD
|
CoreMiniPreload = 0xF4, // Previously known as RED_CMD_COREMINI_PRELOAD
|
||||||
PHYControlRegisters = 0xEF,
|
PHYControlRegisters = 0xEF,
|
||||||
|
EnableLogData = 0xF6,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class ExtendedCommand : uint16_t {
|
enum class ExtendedCommand : uint16_t {
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
#ifndef __LOGDATAMESSAGE_H_
|
||||||
|
#define __LOGDATAMESSAGE_H_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
#include "icsneo/communication/message/message.h"
|
||||||
|
#include <cstdint>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
namespace icsneo {
|
||||||
|
|
||||||
|
class LogDataMessage : public RawMessage {
|
||||||
|
public:
|
||||||
|
static std::shared_ptr<LogDataMessage> DecodeToMessage(const std::vector<uint8_t>& bytestream);
|
||||||
|
|
||||||
|
LogDataMessage(std::wstring logDataString) :
|
||||||
|
RawMessage(Message::Type::LogData, Network::NetID::Data_To_Host), logMessage(logDataString) {}
|
||||||
|
|
||||||
|
std::wstring logMessage;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -44,6 +44,7 @@ public:
|
|||||||
AppError = 0x8012,
|
AppError = 0x8012,
|
||||||
GPTPStatus = 0x8013,
|
GPTPStatus = 0x8013,
|
||||||
EthernetStatus = 0x8014,
|
EthernetStatus = 0x8014,
|
||||||
|
LogData = 0x8015,
|
||||||
};
|
};
|
||||||
|
|
||||||
Message(Type t) : type(t) {}
|
Message(Type t) : type(t) {}
|
||||||
|
|||||||
@@ -583,6 +583,7 @@ public:
|
|||||||
case NetID::RED_GET_RTC:
|
case NetID::RED_GET_RTC:
|
||||||
case NetID::DiskData:
|
case NetID::DiskData:
|
||||||
case NetID::RED_App_Error:
|
case NetID::RED_App_Error:
|
||||||
|
case NetID::Data_To_Host:
|
||||||
return Type::Internal;
|
return Type::Internal;
|
||||||
case NetID::Invalid:
|
case NetID::Invalid:
|
||||||
case NetID::Any:
|
case NetID::Any:
|
||||||
|
|||||||
@@ -151,6 +151,8 @@ public:
|
|||||||
virtual bool isDisconnected() const { return com->isDisconnected(); }
|
virtual bool isDisconnected() const { return com->isDisconnected(); }
|
||||||
virtual bool goOnline();
|
virtual bool goOnline();
|
||||||
virtual bool goOffline();
|
virtual bool goOffline();
|
||||||
|
virtual bool enableLogData();
|
||||||
|
virtual bool disableLogData();
|
||||||
|
|
||||||
enum class PreloadReturn : uint8_t
|
enum class PreloadReturn : uint8_t
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ public:
|
|||||||
};
|
};
|
||||||
return supportedNetworks;
|
return supportedNetworks;
|
||||||
}
|
}
|
||||||
|
size_t getEthernetActivationLineCount() const override { return 2; }
|
||||||
protected:
|
protected:
|
||||||
NeoVIFIRE3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
NeoVIFIRE3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||||
initialize<NeoVIFIRE3Settings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
initialize<NeoVIFIRE3Settings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);
|
||||||
|
|||||||
@@ -52,6 +52,12 @@ namespace icsneo
|
|||||||
Network::NetID::LIN_08,
|
Network::NetID::LIN_08,
|
||||||
Network::NetID::LIN_09,
|
Network::NetID::LIN_09,
|
||||||
Network::NetID::LIN_10,
|
Network::NetID::LIN_10,
|
||||||
|
Network::NetID::LIN_11,
|
||||||
|
Network::NetID::LIN_12,
|
||||||
|
Network::NetID::LIN_13,
|
||||||
|
Network::NetID::LIN_14,
|
||||||
|
Network::NetID::LIN_15,
|
||||||
|
Network::NetID::LIN_16,
|
||||||
|
|
||||||
Network::NetID::I2C_01,
|
Network::NetID::I2C_01,
|
||||||
Network::NetID::I2C_02,
|
Network::NetID::I2C_02,
|
||||||
|
|||||||
@@ -127,12 +127,18 @@ namespace icsneo
|
|||||||
ETHERNET_SETTINGS2 ethT1s8;
|
ETHERNET_SETTINGS2 ethT1s8;
|
||||||
ETHERNET10T1S_SETTINGS t1s8;
|
ETHERNET10T1S_SETTINGS t1s8;
|
||||||
ETHERNET10T1S_SETTINGS_EXT t1s8Ext;
|
ETHERNET10T1S_SETTINGS_EXT t1s8Ext;
|
||||||
|
LIN_SETTINGS lin11;
|
||||||
|
LIN_SETTINGS lin12;
|
||||||
|
LIN_SETTINGS lin13;
|
||||||
|
LIN_SETTINGS lin14;
|
||||||
|
LIN_SETTINGS lin15;
|
||||||
|
LIN_SETTINGS lin16;
|
||||||
} radgigastar2_settings_t;
|
} radgigastar2_settings_t;
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
static_assert(sizeof(radgigastar2_settings_t) == 2024, "RADGigastar2 settings size mismatch");
|
static_assert(sizeof(radgigastar2_settings_t) == 2084, "RADGigastar2 settings size mismatch");
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
@@ -215,6 +221,18 @@ namespace icsneo
|
|||||||
return &(cfg->lin9);
|
return &(cfg->lin9);
|
||||||
case Network::NetID::LIN_10:
|
case Network::NetID::LIN_10:
|
||||||
return &(cfg->lin10);
|
return &(cfg->lin10);
|
||||||
|
case Network::NetID::LIN_11:
|
||||||
|
return &(cfg->lin11);
|
||||||
|
case Network::NetID::LIN_12:
|
||||||
|
return &(cfg->lin12);
|
||||||
|
case Network::NetID::LIN_13:
|
||||||
|
return &(cfg->lin13);
|
||||||
|
case Network::NetID::LIN_14:
|
||||||
|
return &(cfg->lin14);
|
||||||
|
case Network::NetID::LIN_15:
|
||||||
|
return &(cfg->lin15);
|
||||||
|
case Network::NetID::LIN_16:
|
||||||
|
return &(cfg->lin16);
|
||||||
default:
|
default:
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "icsneo/communication/message/a2bmessage.h"
|
#include "icsneo/communication/message/a2bmessage.h"
|
||||||
#include "icsneo/communication/message/linmessage.h"
|
#include "icsneo/communication/message/linmessage.h"
|
||||||
#include "icsneo/communication/message/mdiomessage.h"
|
#include "icsneo/communication/message/mdiomessage.h"
|
||||||
|
#include "icsneo/communication/message/logdatamessage.h"
|
||||||
|
|
||||||
#include "icsneo/communication/message/callback/streamoutput/a2bwavoutput.h"
|
#include "icsneo/communication/message/callback/streamoutput/a2bwavoutput.h"
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
bool ok() const;
|
bool ok() const;
|
||||||
private:
|
private:
|
||||||
PCAPDLL();
|
PCAPDLL();
|
||||||
HINSTANCE dll;
|
HINSTANCE dll = nullptr;
|
||||||
void closeDLL();
|
void closeDLL();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,21 +28,15 @@ bool PCAPDLL::ok() const
|
|||||||
|
|
||||||
PCAPDLL::PCAPDLL()
|
PCAPDLL::PCAPDLL()
|
||||||
{
|
{
|
||||||
#ifdef NPCAP // Use -DLIBICSNEO_NPCAP_INCLUDE_DIR when configuring, point towards the npcap includes
|
TCHAR dir[512] = {0};
|
||||||
DLL_DIRECTORY_COOKIE cookie = 0;
|
if(GetSystemDirectory(dir, 480)) {
|
||||||
TCHAR dllPath[512] = { 0 };
|
_tcscat_s(dir, 512, TEXT("\\Npcap"));
|
||||||
int len = GetSystemDirectory(dllPath, 480); // be safe
|
if(SetDllDirectory(dir)) {
|
||||||
if (len) {
|
// will search for Npcap first, then fall back to WinPcap
|
||||||
_tcscat_s(dllPath, 512, TEXT("\\Npcap"));
|
dll = LoadLibrary(TEXT("wpcap.dll"));
|
||||||
cookie = AddDllDirectory(dllPath);
|
SetDllDirectory(nullptr); // reset
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dll = LoadLibraryEx(TEXT("wpcap.dll"), nullptr, LOAD_LIBRARY_SEARCH_USER_DIRS);
|
|
||||||
|
|
||||||
if (cookie)
|
|
||||||
RemoveDllDirectory(cookie);
|
|
||||||
#else // Otherwise we'll use WinPCAP, or npcap in compatibility mode
|
|
||||||
dll = LoadLibrary(TEXT("wpcap.dll"));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(dll == NULL) {
|
if(dll == NULL) {
|
||||||
closeDLL();
|
closeDLL();
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ local_scheme = "no-local-version"
|
|||||||
|
|
||||||
[tool.scikit-build.cmake.define]
|
[tool.scikit-build.cmake.define]
|
||||||
LIBICSNEO_ENABLE_BINDINGS_PYTHON = true
|
LIBICSNEO_ENABLE_BINDINGS_PYTHON = true
|
||||||
LIBICSNEO_ENABLE_TCP = true
|
|
||||||
CMAKE_MSVC_RUNTIME_LIBRARY = "MultiThreaded"
|
CMAKE_MSVC_RUNTIME_LIBRARY = "MultiThreaded"
|
||||||
|
|
||||||
[tool.cibuildwheel]
|
[tool.cibuildwheel]
|
||||||
|
|||||||
Reference in New Issue
Block a user