Device: Add manufacturing config message

This commit is contained in:
Jonathan Schwartz
2026-09-10 12:56:55 -04:00
committed by Kyle Schwarz
parent cf58f819cb
commit 236c6ad089
8 changed files with 178 additions and 0 deletions
+31
View File
@@ -8,6 +8,7 @@
#include "icsneo/disk/fat.h"
#include "icsneo/communication/message/filter/extendedresponsefilter.h"
#include "icsneo/communication/message/networkmutexmessage.h"
#include "icsneo/communication/message/mfgconfigmessage.h"
#include "icsneo/communication/message/transmitmessage.h"
#ifdef _MSC_VER
@@ -923,6 +924,36 @@ std::shared_ptr<HardwareInfo> Device::getHardwareInfo(std::chrono::milliseconds
return hardwareInfo;
}
std::shared_ptr<MfgConfigMessage> Device::getMfgConfig() {
if(!isOpen()) {
report(APIEvent::Type::DeviceCurrentlyClosed, APIEvent::Severity::Error);
return nullptr;
}
std::vector<uint8_t> payload = MfgConfigMessage::EncodeArgumentsForGet();
auto response = com->waitForMessageSync(
[this, payload]() {
return com->sendCommand(ExtendedCommand::ProtobufAPI, payload);
},
std::make_shared<MessageFilter>(Message::Type::MfgConfig),
std::chrono::milliseconds(250)
);
if(!response) {
report(APIEvent::Type::Timeout, APIEvent::Severity::Error);
return nullptr;
}
auto mfgConfig = std::dynamic_pointer_cast<MfgConfigMessage>(response);
if(!mfgConfig) {
report(APIEvent::Type::UnexpectedResponse, APIEvent::Severity::Error);
return nullptr;
}
return mfgConfig;
}
std::optional<uint64_t> Device::readLogicalDisk(uint64_t pos, uint8_t* into, uint64_t amount, std::chrono::milliseconds timeout, Disk::MemoryType memType) {
if(!into || timeout <= std::chrono::milliseconds(0)) {