Message: Validate PHY register batches

This commit is contained in:
David Rebbe
2026-09-24 20:13:48 -04:00
committed by Kyle Schwarz
parent f0b1341cdf
commit f310938684
6 changed files with 141 additions and 11 deletions
+6 -1
View File
@@ -2053,7 +2053,12 @@ std::optional<EthPhyMessage> Device::sendEthPhyMsg(const EthPhyMessage& message,
}
std::vector<uint8_t> bytes;
HardwareEthernetPhyRegisterPacket::EncodeFromMessage(message, bytes, report);
if(timeout.count() <= 0) {
report(APIEvent::Type::ParameterOutOfRange, APIEvent::Severity::Error);
return std::nullopt;
}
if(!HardwareEthernetPhyRegisterPacket::EncodeFromMessage(message, bytes, report))
return std::nullopt;
std::shared_ptr<Message> response = com->waitForMessageSync(
[this, bytes](){ return com->sendCommand(Command::PHYControlRegisters, bytes); },
std::make_shared<MessageFilter>(Message::Type::EthernetPhyRegister), timeout);