mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-09-22 17:08:38 +02:00
Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6bc70b5f29 | ||
|
|
bb4176dec8 | ||
|
|
0b135e29a0 | ||
|
|
5bfd7e3300 | ||
|
|
f37b88d616 | ||
|
|
33dea748f7 | ||
|
|
245073f9d5 | ||
|
|
c4e858d346 | ||
|
|
b3d47f2ae5 | ||
|
|
b94ade1ef6 | ||
|
|
d9ea5e085e | ||
|
|
5125520e76 |
+2
-2
@@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(libicsneo VERSION 0.3.0)
|
||||
project(libicsneo VERSION 1.0.0)
|
||||
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
if(POLICY CMP0135)
|
||||
@@ -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
|
||||
@@ -429,7 +430,6 @@ if(LIBICSNEO_ENABLE_RAW_ETHERNET)
|
||||
add_definitions(-DWPCAP -DHAVE_REMOTE)
|
||||
else()
|
||||
target_include_directories(icsneocpp PUBLIC AFTER ${LIBICSNEO_NPCAP_INCLUDE_DIR})
|
||||
add_definitions(-DNPCAP)
|
||||
endif()
|
||||
else()
|
||||
find_package(PCAP REQUIRED)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -18,5 +18,59 @@ double liveDataValueToDouble(const LiveDataValue& val) {
|
||||
return val.value * liveDataFixedPointToDouble;
|
||||
}
|
||||
|
||||
int liveDataDoubleToValue(LiveDataValue& value, const double& dFloat) {
|
||||
union {
|
||||
struct
|
||||
{
|
||||
uint32_t ValueFractionPart;
|
||||
int32_t ValueInt32;
|
||||
} parts;
|
||||
int64_t ValueLarge;
|
||||
} CminiFixedPt;
|
||||
constexpr double CM_FIXED_POINT_TO_DOUBLEVALUE = (1.0 / (double)(1ULL << 32)); // 2^-32
|
||||
constexpr double CM_DOUBLEVALUE_TO_FIXED_POINT = ((double)(1ULL << 32)); // 2^32
|
||||
// Use const for limits (C++98 compatible)
|
||||
const double INT32_MAX_DOUBLE =
|
||||
static_cast<double>(std::numeric_limits<int32_t>::max()) + (1.0 - std::numeric_limits<double>::epsilon());
|
||||
const double INT32_MIN_DOUBLE = static_cast<double>(std::numeric_limits<int32_t>::min());
|
||||
const double MIN_FIXED_POINT_DOUBLE = (double)(1ull * CM_FIXED_POINT_TO_DOUBLEVALUE);
|
||||
|
||||
// This needs to be assigned separately, otherwise, for dFloat >= 2^31,
|
||||
// long double dBigFloat = dFloat * CM_DOUBLEVALUE_TO_FIXED_POINT overflows
|
||||
// long long (value is >= 2^63) and so the assignment ValueLarge = dBigFloat is undefined
|
||||
|
||||
int32_t intPart; //creating temp variable due to static analysis warning about writing and reading to different union members
|
||||
if (dFloat < 0.0)
|
||||
intPart = (int32_t)floor(dFloat);
|
||||
else
|
||||
intPart = (int32_t)dFloat;
|
||||
|
||||
//using temp varialbes to avoid static analysis warning about read/write to different union members
|
||||
double frac = dFloat - (double)(intPart);
|
||||
uint32_t fracPart = (uint32_t)floor((frac * CM_DOUBLEVALUE_TO_FIXED_POINT) + 0.5);
|
||||
|
||||
//write temp vars back into the union
|
||||
CminiFixedPt.parts.ValueInt32 = intPart;
|
||||
CminiFixedPt.parts.ValueFractionPart = fracPart;
|
||||
value.value = CminiFixedPt.ValueLarge;
|
||||
|
||||
if (dFloat == (double)0.0)
|
||||
return 0;
|
||||
|
||||
//check if double can be stored as 32.32
|
||||
// 0x1 0000 0000 0000 0000 * CM_FIXED_POINT_TO_DOUBLEVALUE = 0x1 0000 0000
|
||||
if (dFloat > INT32_MAX_DOUBLE)
|
||||
return 1;
|
||||
if (dFloat < INT32_MIN_DOUBLE)
|
||||
return -1;
|
||||
|
||||
// Use absolute value for minimum fixed point check
|
||||
double absFloat = (dFloat < 0.0) ? -dFloat : dFloat;
|
||||
if (absFloat < MIN_FIXED_POINT_DOUBLE)
|
||||
return -2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace LiveDataUtil
|
||||
} // namespace icsneo
|
||||
@@ -12,4 +12,14 @@ void LiveDataCommandMessage::appendSignalArg(LiveDataValueType valueType) {
|
||||
arg->valueType = valueType;
|
||||
}
|
||||
|
||||
void LiveDataSetValueMessage::appendSetValue(LiveDataValueType valueType, const LiveDataValue& value) {
|
||||
auto& arg = args.emplace_back(std::make_shared<LiveDataArgument>());
|
||||
arg->objectType = LiveDataObjectType::MISC;
|
||||
arg->objectIndex = 0u;
|
||||
arg->signalIndex = 0u;
|
||||
arg->valueType = valueType;
|
||||
|
||||
values.push_back(std::make_shared<LiveDataValue>(value));
|
||||
}
|
||||
|
||||
} // namespace icsneo
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
@@ -99,6 +99,33 @@ bool HardwareLiveDataPacket::EncodeFromMessage(LiveDataMessage& message, std::ve
|
||||
clearMsg->cmd = static_cast<uint32_t>(message.cmd);
|
||||
break;
|
||||
}
|
||||
case LiveDataCommand::SET_VALUE: {
|
||||
auto setValMsg = reinterpret_cast<LiveDataSetValueMessage*>(&message);
|
||||
const auto numArgs = setValMsg->args.size();
|
||||
if(numArgs) {
|
||||
payloadSize = static_cast<uint16_t>(sizeof(LiveDataSetValue) + (sizeof(LiveDataSetValueEntry) * (numArgs-1)));
|
||||
bytestream.resize((payloadSize + sizeof(ExtendedCommandHeader)),0);
|
||||
LiveDataSetValue* out = reinterpret_cast<LiveDataSetValue*>(bytestream.data() + sizeof(ExtendedCommandHeader));
|
||||
out->version = icsneo::LiveDataUtil::LiveDataVersion;
|
||||
out->cmd = static_cast<uint32_t>(setValMsg->cmd);
|
||||
if(!setValMsg->handle)
|
||||
setValMsg->handle = LiveDataUtil::getNewHandle();
|
||||
out->handle = setValMsg->handle;
|
||||
out->numArgs = static_cast<uint32_t>(setValMsg->args.size());
|
||||
for(size_t i = 0; i < numArgs; ++i) {
|
||||
out->values[i].arg.objectType = setValMsg->args[i]->objectType;
|
||||
out->values[i].arg.objectIndex = setValMsg->args[i]->objectIndex;
|
||||
out->values[i].arg.signalIndex = setValMsg->args[i]->signalIndex;
|
||||
out->values[i].arg.valueType = setValMsg->args[i]->valueType;
|
||||
out->values[i].value.value = setValMsg->values[i]->value;
|
||||
out->values[i].value.header.length = sizeof(int64_t);
|
||||
}
|
||||
} else {
|
||||
report(APIEvent::Type::LiveDataInvalidArgument, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
report(APIEvent::Type::LiveDataInvalidCommand, APIEvent::Severity::Error);
|
||||
return false;
|
||||
|
||||
@@ -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;
|
||||
@@ -2227,6 +2235,61 @@ bool Device::clearAllLiveData() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Device::setValueLiveData(std::shared_ptr<LiveDataSetValueMessage> message) {
|
||||
if(!supportsLiveData()) {
|
||||
report(APIEvent::Type::LiveDataNotSupported, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
if(!isOpen()) {
|
||||
report(APIEvent::Type::DeviceCurrentlyClosed, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
if((message->args.size() != message->values.size()) || message->args.empty()) {
|
||||
report(APIEvent::Type::LiveDataInvalidArgument, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<uint8_t> bytes;
|
||||
if(!com->encoder->encode(*com->packetizer, bytes, message)) {
|
||||
report(APIEvent::Type::LiveDataEncoderError, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::shared_ptr<Message> response = com->waitForMessageSync(
|
||||
[this, &bytes](){ return com->sendPacket(bytes); },
|
||||
std::make_shared<MessageFilter>(Message::Type::LiveData));
|
||||
|
||||
if(response) {
|
||||
auto statusMsg = std::dynamic_pointer_cast<LiveDataStatusMessage>(response);
|
||||
if(statusMsg && statusMsg->requestedCommand == message->cmd) {
|
||||
switch(statusMsg->status) {
|
||||
case LiveDataStatus::SUCCESS:
|
||||
return true;
|
||||
case LiveDataStatus::ERR_DUPLICATE:
|
||||
case LiveDataStatus::ERR_HANDLE:
|
||||
{
|
||||
report(APIEvent::Type::LiveDataInvalidHandle, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
case LiveDataStatus::ERR_FULL:
|
||||
{
|
||||
report(APIEvent::Type::LiveDataMaxSignalsReached, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
case LiveDataStatus::ERR_UNKNOWN_COMMAND:
|
||||
{
|
||||
report(APIEvent::Type::LiveDataCommandFailed, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
report(APIEvent::Type::LiveDataNoDeviceResponse, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Device::readVSA(const VSAExtractionSettings& extractionSettings) {
|
||||
if(isOnline()) {
|
||||
goOffline();
|
||||
|
||||
@@ -35,6 +35,8 @@ int main() {
|
||||
msg->appendSignalArg(icsneo::LiveDataValueType::GPS_LATITUDE);
|
||||
msg->appendSignalArg(icsneo::LiveDataValueType::GPS_LONGITUDE);
|
||||
msg->appendSignalArg(icsneo::LiveDataValueType::GPS_ACCURACY);
|
||||
msg->appendSignalArg(icsneo::LiveDataValueType::DAQ_ENABLE);
|
||||
msg->appendSignalArg(icsneo::LiveDataValueType::MANUAL_TRIGGER);
|
||||
msg->cmd = icsneo::LiveDataCommand::SUBSCRIBE;
|
||||
msg->handle = icsneo::LiveDataUtil::getNewHandle();
|
||||
msg->updatePeriod = std::chrono::milliseconds(100);
|
||||
@@ -77,6 +79,28 @@ int main() {
|
||||
}));
|
||||
// Run handler for three seconds to observe the signal data
|
||||
std::this_thread::sleep_for(std::chrono::seconds(3));
|
||||
double val = 0;
|
||||
for (unsigned int i = 0; i < 10; ++i)
|
||||
{
|
||||
// Set the values of signals we're watching so we can see them change live
|
||||
auto setValMsg = std::make_shared<icsneo::LiveDataSetValueMessage>();
|
||||
setValMsg->cmd = icsneo::LiveDataCommand::SET_VALUE;
|
||||
setValMsg->handle = msg->handle;
|
||||
// Convert the value format
|
||||
icsneo::LiveDataValue ldValueDAQEnable;
|
||||
icsneo::LiveDataValue ldValueManTrig;
|
||||
if ((icsneo::LiveDataUtil::liveDataDoubleToValue(ldValueDAQEnable, val * 10) < 0) ||
|
||||
(icsneo::LiveDataUtil::liveDataDoubleToValue(ldValueManTrig, val) < 0))
|
||||
{
|
||||
break;
|
||||
}
|
||||
setValMsg->appendSetValue(icsneo::LiveDataValueType::DAQ_ENABLE, ldValueDAQEnable);
|
||||
setValMsg->appendSetValue(icsneo::LiveDataValueType::MANUAL_TRIGGER, ldValueManTrig);
|
||||
device->setValueLiveData(setValMsg);
|
||||
++val;
|
||||
// Run handler for three seconds to observe the signal data
|
||||
std::this_thread::sleep_for(std::chrono::seconds(3));
|
||||
}
|
||||
// Unsubscribe from the GPS signals and run handler for one more second
|
||||
// Unsubscription only requires a valid in-use handle, in this case from our previous subscription
|
||||
ret = device->unsubscribeLiveData(msg->handle);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -19,6 +19,7 @@ enum class LiveDataCommand : uint32_t {
|
||||
UNSUBSCRIBE,
|
||||
RESPONSE,
|
||||
CLEAR_ALL,
|
||||
SET_VALUE,
|
||||
};
|
||||
|
||||
enum class LiveDataStatus : uint32_t {
|
||||
@@ -41,10 +42,13 @@ enum class LiveDataValueType : uint32_t {
|
||||
GPS_SPEED,
|
||||
GPS_VALID,
|
||||
GPS_ENABLE = 62,
|
||||
MANUAL_TRIGGER = 108,
|
||||
TIME_SINCE_MSG = 111,
|
||||
GPS_ACCURACY = 120,
|
||||
GPS_BEARING = 121,
|
||||
GPS_TIME = 122,
|
||||
GPS_TIME_VALID = 123,
|
||||
DAQ_ENABLE = 124,
|
||||
};
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& os, const LiveDataCommand cmd) {
|
||||
@@ -54,6 +58,7 @@ inline std::ostream& operator<<(std::ostream& os, const LiveDataCommand cmd) {
|
||||
case LiveDataCommand::UNSUBSCRIBE: return os << "Unsubscribe";
|
||||
case LiveDataCommand::RESPONSE: return os << "Response";
|
||||
case LiveDataCommand::CLEAR_ALL: return os << "Clear All";
|
||||
case LiveDataCommand::SET_VALUE: return os << "Set Value";
|
||||
}
|
||||
return os;
|
||||
}
|
||||
@@ -81,6 +86,8 @@ inline std::ostream& operator<<(std::ostream& os, const LiveDataValueType cmd) {
|
||||
case LiveDataValueType::GPS_BEARING: return os << "GPS Bearing";
|
||||
case LiveDataValueType::GPS_TIME: return os << "GPS Time";
|
||||
case LiveDataValueType::GPS_TIME_VALID: return os << "GPS Time Valid";
|
||||
case LiveDataValueType::DAQ_ENABLE: return os << "DAQ Enable";
|
||||
case LiveDataValueType::MANUAL_TRIGGER: return os << "Manual Trigger";
|
||||
}
|
||||
return os;
|
||||
}
|
||||
@@ -127,6 +134,17 @@ struct LiveDataSubscribe : public LiveDataHeader {
|
||||
LiveDataArgument args[1];
|
||||
};
|
||||
|
||||
struct LiveDataSetValueEntry
|
||||
{
|
||||
LiveDataArgument arg;
|
||||
LiveDataValue value;
|
||||
};
|
||||
|
||||
struct LiveDataSetValue : public LiveDataHeader {
|
||||
uint32_t numArgs;
|
||||
LiveDataSetValueEntry values[1];
|
||||
};
|
||||
|
||||
struct ExtResponseHeader {
|
||||
ExtendedCommand command;
|
||||
uint16_t length;
|
||||
@@ -138,6 +156,7 @@ namespace LiveDataUtil
|
||||
|
||||
LiveDataHandle getNewHandle();
|
||||
double liveDataValueToDouble(const LiveDataValue& val);
|
||||
int liveDataDoubleToValue(LiveDataValue& value, const double& dFloat);
|
||||
static constexpr uint32_t LiveDataVersion = 1;
|
||||
|
||||
} // namespace LiveDataUtil
|
||||
|
||||
@@ -38,6 +38,14 @@ public:
|
||||
LiveDataStatus status;
|
||||
};
|
||||
|
||||
class LiveDataSetValueMessage : public LiveDataMessage {
|
||||
public:
|
||||
LiveDataSetValueMessage() {}
|
||||
std::vector<std::shared_ptr<LiveDataArgument>> args;
|
||||
std::vector<std::shared_ptr<LiveDataValue>> values;
|
||||
void appendSetValue(LiveDataValueType valueType, const LiveDataValue& value);
|
||||
};
|
||||
|
||||
} // namespace icsneo
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
@@ -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,
|
||||
GPTPStatus = 0x8013,
|
||||
EthernetStatus = 0x8014,
|
||||
LogData = 0x8015,
|
||||
};
|
||||
|
||||
Message(Type t) : type(t) {}
|
||||
|
||||
@@ -17,11 +17,11 @@ public:
|
||||
bool isCoreminiRunning = false;
|
||||
uint32_t sectorOverflows = 0;
|
||||
uint32_t numRemainingSectorBuffers = 0;
|
||||
int32_t lastSector = 0;
|
||||
int32_t readBinSize = 0;
|
||||
int32_t minSector = 0;
|
||||
int32_t maxSector = 0;
|
||||
int32_t currentSector = 0;
|
||||
uint32_t lastSector = 0;
|
||||
uint32_t readBinSize = 0;
|
||||
uint32_t minSector = 0;
|
||||
uint32_t maxSector = 0;
|
||||
uint32_t currentSector = 0;
|
||||
uint64_t coreminiCreateTime = 0;
|
||||
uint16_t fileChecksum = 0;
|
||||
uint16_t coreminiVersion = 0;
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -47,11 +47,11 @@ struct ScriptStatus
|
||||
CoreMiniStatus status;
|
||||
uint32_t sectorOverflows;
|
||||
uint32_t numRemainingSectorBuffers;
|
||||
int32_t lastSector;
|
||||
int32_t readBinSize;
|
||||
int32_t minSector;
|
||||
int32_t maxSector;
|
||||
int32_t currentSector;
|
||||
uint32_t lastSector;
|
||||
uint32_t readBinSize;
|
||||
uint32_t minSector;
|
||||
uint32_t maxSector;
|
||||
uint32_t currentSector;
|
||||
uint32_t coreminiCreateTimeMsb;
|
||||
uint32_t coreminiCreateTimeLsb;
|
||||
uint16_t zero2;
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -179,6 +181,10 @@ public:
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
bool supportsCoreminiScript() const {
|
||||
return (getCoreminiStartAddressFlash()) || (getCoreminiStartAddressSD());
|
||||
}
|
||||
|
||||
std::optional<MemoryAddress> getCoreminiStartAddress(Disk::MemoryType memType) const {
|
||||
switch(memType) {
|
||||
case Disk::MemoryType::Flash:
|
||||
@@ -630,6 +636,7 @@ public:
|
||||
bool subscribeLiveData(std::shared_ptr<LiveDataCommandMessage> message);
|
||||
bool unsubscribeLiveData(const LiveDataHandle& handle);
|
||||
bool clearAllLiveData();
|
||||
bool setValueLiveData(std::shared_ptr<LiveDataSetValueMessage> message);
|
||||
|
||||
// VSA Read functions
|
||||
|
||||
|
||||
@@ -690,7 +690,7 @@ public:
|
||||
|
||||
IDeviceSettings(std::shared_ptr<Communication> com, size_t size) : com(com), report(com->report), structSize(size) {}
|
||||
virtual ~IDeviceSettings() {}
|
||||
bool ok() { return !disabled && settingsLoaded; }
|
||||
bool ok() const { return !disabled && settingsLoaded; }
|
||||
|
||||
virtual bool refresh(bool ignoreChecksum = false); // Get from device
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -52,6 +52,12 @@ namespace icsneo
|
||||
Network::NetID::LIN_08,
|
||||
Network::NetID::LIN_09,
|
||||
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_02,
|
||||
|
||||
@@ -127,12 +127,18 @@ namespace icsneo
|
||||
ETHERNET_SETTINGS2 ethT1s8;
|
||||
ETHERNET10T1S_SETTINGS t1s8;
|
||||
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;
|
||||
#pragma pack(pop)
|
||||
|
||||
#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>
|
||||
|
||||
@@ -215,6 +221,18 @@ namespace icsneo
|
||||
return &(cfg->lin9);
|
||||
case Network::NetID::LIN_10:
|
||||
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:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
bool ok() const;
|
||||
private:
|
||||
PCAPDLL();
|
||||
HINSTANCE dll;
|
||||
HINSTANCE dll = nullptr;
|
||||
void closeDLL();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -28,21 +28,15 @@ bool PCAPDLL::ok() const
|
||||
|
||||
PCAPDLL::PCAPDLL()
|
||||
{
|
||||
#ifdef NPCAP // Use -DLIBICSNEO_NPCAP_INCLUDE_DIR when configuring, point towards the npcap includes
|
||||
DLL_DIRECTORY_COOKIE cookie = 0;
|
||||
TCHAR dllPath[512] = { 0 };
|
||||
int len = GetSystemDirectory(dllPath, 480); // be safe
|
||||
if (len) {
|
||||
_tcscat_s(dllPath, 512, TEXT("\\Npcap"));
|
||||
cookie = AddDllDirectory(dllPath);
|
||||
}
|
||||
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
|
||||
TCHAR dir[512] = {0};
|
||||
if(GetSystemDirectory(dir, 480)) {
|
||||
_tcscat_s(dir, 512, TEXT("\\Npcap"));
|
||||
if(SetDllDirectory(dir)) {
|
||||
// will search for Npcap first, then fall back to WinPcap
|
||||
dll = LoadLibrary(TEXT("wpcap.dll"));
|
||||
#endif
|
||||
SetDllDirectory(nullptr); // reset
|
||||
}
|
||||
}
|
||||
|
||||
if(dll == NULL) {
|
||||
closeDLL();
|
||||
|
||||
@@ -46,7 +46,6 @@ local_scheme = "no-local-version"
|
||||
|
||||
[tool.scikit-build.cmake.define]
|
||||
LIBICSNEO_ENABLE_BINDINGS_PYTHON = true
|
||||
LIBICSNEO_ENABLE_TCP = true
|
||||
CMAKE_MSVC_RUNTIME_LIBRARY = "MultiThreaded"
|
||||
|
||||
[tool.cibuildwheel]
|
||||
|
||||
Reference in New Issue
Block a user