mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Device: Add get_pcb_serial() & get_mac_address()
This commit is contained in:
committed by
Kyle Schwarz
parent
87e2a65b71
commit
6f2ad54adc
@@ -1,4 +1,5 @@
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include "icsneo/api/eventmanager.h"
|
||||
#include "icsneo/communication/message/filter/main51messagefilter.h"
|
||||
#include "icsneo/communication/message/extendedresponsemessage.h"
|
||||
@@ -2253,6 +2254,24 @@ bool Device::setRTC(const std::chrono::time_point<std::chrono::system_clock>& ti
|
||||
return m51msg->data.front();
|
||||
}
|
||||
|
||||
std::optional<std::vector<uint8_t>> Device::getPCBSerial() {
|
||||
auto serialMsg = com->getSerialNumberSync();
|
||||
if(!serialMsg || !serialMsg->hasPCBSerial) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return std::vector<uint8_t>(serialMsg->pcbSerial, serialMsg->pcbSerial + sizeof(serialMsg->pcbSerial));
|
||||
}
|
||||
|
||||
std::optional<std::vector<uint8_t>> Device::getMACAddress() {
|
||||
auto serialMsg = com->getSerialNumberSync();
|
||||
if(!serialMsg || !serialMsg->hasMacAddress) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return std::vector<uint8_t>(serialMsg->macAddress, serialMsg->macAddress + sizeof(serialMsg->macAddress));
|
||||
}
|
||||
|
||||
std::optional<std::set<SupportedFeature>> Device::getSupportedFeatures() {
|
||||
auto timeout = std::chrono::milliseconds(100);
|
||||
std::shared_ptr<Message> msg = com->waitForMessageSync(
|
||||
|
||||
Reference in New Issue
Block a user