Compare commits

...

5 Commits

Author SHA1 Message Date
vits71 3c242448cd
Merge 739ff4d637 into b3d47f2ae5 2025-06-04 16:35:06 -04:00
Keith Nash b3d47f2ae5 Communication: Add LogDataMessage 2025-05-16 19:36:27 +00:00
Kyle Schwarz b94ade1ef6 FIRE3: Add Ethernet Activation Lines 2025-05-15 11:11:26 -04:00
vits71 739ff4d637
Merge branch 'intrepidcs:master' into Npcap-fix 2025-01-11 23:15:28 +01:00
Vít Šembera e233233b94 Fixed Npcap related errors in PCAPDLL::PCAPDLL() 2024-07-18 13:26:39 +02:00
12 changed files with 70 additions and 3 deletions

View File

@ -13,7 +13,7 @@ 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)
option(LIBICSNEO_BUILD_ICSNEOLEGACY_STATIC "Build static icsnVC40 compatibility library" ON)
set(LIBICSNEO_NPCAP_INCLUDE_DIR "" CACHE STRING "Npcap include directory; set to build with Npcap")
set(LIBICSNEO_NPCAP_INCLUDE_DIR "C:/Users/Vit/source/repos/npcap-sdk-1.13/Include" CACHE STRING "Npcap include directory; set to build with Npcap")
# Device Drivers
# You almost certainly don't want firmio for your build,
@ -246,6 +246,7 @@ set(SRC_FILES
communication/message/ethphymessage.cpp
communication/message/linmessage.cpp
communication/message/livedatamessage.cpp
communication/message/logdatamessage.cpp
communication/message/tc10statusmessage.cpp
communication/message/gptpstatusmessage.cpp
communication/message/ethernetstatusmessage.cpp

View File

@ -16,6 +16,7 @@
#include "icsneo/communication/message/mdiomessage.h"
#include "icsneo/communication/message/extendeddatamessage.h"
#include "icsneo/communication/message/livedatamessage.h"
#include "icsneo/communication/message/logdatamessage.h"
#include "icsneo/communication/message/diskdatamessage.h"
#include "icsneo/communication/message/hardwareinfo.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));
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:
break;
}
break;

View File

@ -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));
}

View File

@ -405,6 +405,14 @@ bool Device::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() {
if(!enableNetworkCommunication(true))
return false;

View File

@ -38,6 +38,7 @@ enum class Command : uint8_t {
FlexRayControl = 0xF3,
CoreMiniPreload = 0xF4, // Previously known as RED_CMD_COREMINI_PRELOAD
PHYControlRegisters = 0xEF,
EnableLogData = 0xF6,
};
enum class ExtendedCommand : uint16_t {

View File

@ -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

View File

@ -44,6 +44,7 @@ public:
AppError = 0x8012,
GPTPStatus = 0x8013,
EthernetStatus = 0x8014,
LogData = 0x8015,
};
Message(Type t) : type(t) {}

View File

@ -583,6 +583,7 @@ public:
case NetID::RED_GET_RTC:
case NetID::DiskData:
case NetID::RED_App_Error:
case NetID::Data_To_Host:
return Type::Internal;
case NetID::Invalid:
case NetID::Any:

View File

@ -151,6 +151,8 @@ public:
virtual bool isDisconnected() const { return com->isDisconnected(); }
virtual bool goOnline();
virtual bool goOffline();
virtual bool enableLogData();
virtual bool disableLogData();
enum class PreloadReturn : uint8_t
{

View File

@ -49,6 +49,7 @@ public:
};
return supportedNetworks;
}
size_t getEthernetActivationLineCount() const override { return 2; }
protected:
NeoVIFIRE3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
initialize<NeoVIFIRE3Settings, Disk::ExtExtractorDiskReadDriver, Disk::NeoMemoryDiskDriver>(makeDriver);

View File

@ -20,6 +20,7 @@
#include "icsneo/communication/message/a2bmessage.h"
#include "icsneo/communication/message/linmessage.h"
#include "icsneo/communication/message/mdiomessage.h"
#include "icsneo/communication/message/logdatamessage.h"
#include "icsneo/communication/message/callback/streamoutput/a2bwavoutput.h"

View File

@ -34,9 +34,12 @@ PCAPDLL::PCAPDLL()
int len = GetSystemDirectory(dllPath, 480); // be safe
if (len) {
_tcscat_s(dllPath, 512, TEXT("\\Npcap"));
cookie = AddDllDirectory(dllPath);
WCHAR dllPath_w[512] = { 0 };
if (mbstowcs(dllPath_w, dllPath, 512)) {
cookie = AddDllDirectory(dllPath_w);
}
}
dll = LoadLibraryEx(TEXT("wpcap.dll"), nullptr, LOAD_LIBRARY_SEARCH_USER_DIRS);
dll = LoadLibraryEx(TEXT("wpcap.dll"), nullptr, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
if (cookie)
RemoveDllDirectory(cookie);