mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Device: Implement version handling
This commit is contained in:
@@ -267,6 +267,8 @@ bool Device::open(OpenFlags flags, OpenStatusHandler handler) {
|
||||
}
|
||||
|
||||
APIEvent::Type Device::attemptToBeginCommunication() {
|
||||
versions.clear();
|
||||
|
||||
if(!afterCommunicationOpen()) {
|
||||
// Very unlikely, at the time of writing this only fails if rawWrite does.
|
||||
// If you're looking for this error, you're probably looking for if(!serial) below.
|
||||
@@ -287,6 +289,13 @@ APIEvent::Type Device::attemptToBeginCommunication() {
|
||||
std::string currentSerial = getNeoDevice().serial;
|
||||
if(currentSerial != serial->deviceSerial)
|
||||
return APIEvent::Type::IncorrectSerialNumber;
|
||||
|
||||
auto maybeVersions = com->getVersionsSync();
|
||||
if(!maybeVersions)
|
||||
return getCommunicationNotEstablishedError();
|
||||
else
|
||||
versions = std::move(*maybeVersions);
|
||||
|
||||
return APIEvent::Type::NoErrorFound;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user