Tidying EDBG driver code:
- Binned a lot of pointless code - Simplified many EDBG data structure implementations - Const-correctness - Many other bits of tidying
This commit is contained in:
@@ -62,17 +62,17 @@ namespace Bloom::DebugToolDrivers
|
||||
using namespace CommandFrames::Discovery;
|
||||
using ResponseFrames::Discovery::ResponseId;
|
||||
|
||||
auto response = this->edbgInterface->sendAvrCommandFrameAndWaitForResponseFrame(
|
||||
const auto responseFrame = this->edbgInterface->sendAvrCommandFrameAndWaitForResponseFrame(
|
||||
Query(QueryContext::SERIAL_NUMBER)
|
||||
);
|
||||
|
||||
if (response.getResponseId() != ResponseId::OK) {
|
||||
if (responseFrame.id != ResponseId::OK) {
|
||||
throw DeviceInitializationFailure(
|
||||
"Failed to fetch serial number from device - invalid Discovery Protocol response ID."
|
||||
);
|
||||
}
|
||||
|
||||
auto data = response.getPayloadData();
|
||||
auto data = responseFrame.getPayloadData();
|
||||
return std::string(data.begin(), data.end());
|
||||
}
|
||||
|
||||
@@ -80,11 +80,11 @@ namespace Bloom::DebugToolDrivers
|
||||
using namespace CommandFrames::HouseKeeping;
|
||||
using ResponseFrames::HouseKeeping::ResponseId;
|
||||
|
||||
auto response = this->edbgInterface->sendAvrCommandFrameAndWaitForResponseFrame(
|
||||
const auto responseFrame = this->edbgInterface->sendAvrCommandFrameAndWaitForResponseFrame(
|
||||
StartSession()
|
||||
);
|
||||
|
||||
if (response.getResponseId() == ResponseId::FAILED) {
|
||||
if (responseFrame.id == ResponseId::FAILED) {
|
||||
// Failed response returned!
|
||||
throw DeviceInitializationFailure("Failed to start session with Xplained Pro!");
|
||||
}
|
||||
@@ -96,11 +96,11 @@ namespace Bloom::DebugToolDrivers
|
||||
using namespace CommandFrames::HouseKeeping;
|
||||
using ResponseFrames::HouseKeeping::ResponseId;
|
||||
|
||||
auto response = this->edbgInterface->sendAvrCommandFrameAndWaitForResponseFrame(
|
||||
const auto responseFrame = this->edbgInterface->sendAvrCommandFrameAndWaitForResponseFrame(
|
||||
EndSession()
|
||||
);
|
||||
|
||||
if (response.getResponseId() == ResponseId::FAILED) {
|
||||
if (responseFrame.id == ResponseId::FAILED) {
|
||||
// Failed response returned!
|
||||
throw DeviceFailure("Failed to end session with Xplained Pro!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user