Moving ResponseId enum for the HOUSEKEEPING EDBG protocol out of the command frame class header.

This commit is contained in:
Nav
2022-03-01 20:25:16 +00:00
parent 8c3d49df79
commit 15f22b612f
11 changed files with 31 additions and 23 deletions

View File

@@ -71,6 +71,7 @@ namespace Bloom::DebugToolDrivers
void AtmelIce::startSession() { void AtmelIce::startSession() {
using namespace CommandFrames::HouseKeeping; using namespace CommandFrames::HouseKeeping;
using ResponseFrames::HouseKeeping::ResponseId;
auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame(
StartSession() StartSession()
@@ -86,6 +87,7 @@ namespace Bloom::DebugToolDrivers
void AtmelIce::endSession() { void AtmelIce::endSession() {
using namespace CommandFrames::HouseKeeping; using namespace CommandFrames::HouseKeeping;
using ResponseFrames::HouseKeeping::ResponseId;
auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame(
EndSession() EndSession()

View File

@@ -63,6 +63,7 @@ namespace Bloom::DebugToolDrivers
void CuriosityNano::startSession() { void CuriosityNano::startSession() {
using namespace CommandFrames::HouseKeeping; using namespace CommandFrames::HouseKeeping;
using ResponseFrames::HouseKeeping::ResponseId;
auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame(
StartSession() StartSession()
@@ -78,6 +79,7 @@ namespace Bloom::DebugToolDrivers
void CuriosityNano::endSession() { void CuriosityNano::endSession() {
using namespace CommandFrames::HouseKeeping; using namespace CommandFrames::HouseKeeping;
using ResponseFrames::HouseKeeping::ResponseId;
auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame(
EndSession() EndSession()

View File

@@ -64,6 +64,7 @@ namespace Bloom::DebugToolDrivers
void MplabPickit4::startSession() { void MplabPickit4::startSession() {
using namespace CommandFrames::HouseKeeping; using namespace CommandFrames::HouseKeeping;
using ResponseFrames::HouseKeeping::ResponseId;
auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame(
StartSession() StartSession()
@@ -79,6 +80,7 @@ namespace Bloom::DebugToolDrivers
void MplabPickit4::endSession() { void MplabPickit4::endSession() {
using namespace CommandFrames::HouseKeeping; using namespace CommandFrames::HouseKeeping;
using ResponseFrames::HouseKeeping::ResponseId;
auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame(
EndSession() EndSession()

View File

@@ -63,6 +63,7 @@ namespace Bloom::DebugToolDrivers
void MplabSnap::startSession() { void MplabSnap::startSession() {
using namespace CommandFrames::HouseKeeping; using namespace CommandFrames::HouseKeeping;
using ResponseFrames::HouseKeeping::ResponseId;
auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame(
StartSession() StartSession()
@@ -78,6 +79,7 @@ namespace Bloom::DebugToolDrivers
void MplabSnap::endSession() { void MplabSnap::endSession() {
using namespace CommandFrames::HouseKeeping; using namespace CommandFrames::HouseKeeping;
using ResponseFrames::HouseKeeping::ResponseId;
auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame(
EndSession() EndSession()

View File

@@ -69,6 +69,7 @@ namespace Bloom::DebugToolDrivers
void PowerDebugger::startSession() { void PowerDebugger::startSession() {
using namespace CommandFrames::HouseKeeping; using namespace CommandFrames::HouseKeeping;
using ResponseFrames::HouseKeeping::ResponseId;
auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame(
StartSession() StartSession()
@@ -86,6 +87,7 @@ namespace Bloom::DebugToolDrivers
void PowerDebugger::endSession() { void PowerDebugger::endSession() {
using namespace CommandFrames::HouseKeeping; using namespace CommandFrames::HouseKeeping;
using ResponseFrames::HouseKeeping::ResponseId;
auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame(
EndSession() EndSession()

View File

@@ -63,6 +63,7 @@ namespace Bloom::DebugToolDrivers
void XplainedMini::startSession() { void XplainedMini::startSession() {
using namespace CommandFrames::HouseKeeping; using namespace CommandFrames::HouseKeeping;
using ResponseFrames::HouseKeeping::ResponseId;
auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame(
StartSession() StartSession()
@@ -78,6 +79,7 @@ namespace Bloom::DebugToolDrivers
void XplainedMini::endSession() { void XplainedMini::endSession() {
using namespace CommandFrames::HouseKeeping; using namespace CommandFrames::HouseKeeping;
using ResponseFrames::HouseKeeping::ResponseId;
auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame(
EndSession() EndSession()

View File

@@ -63,6 +63,7 @@ namespace Bloom::DebugToolDrivers
void XplainedNano::startSession() { void XplainedNano::startSession() {
using namespace CommandFrames::HouseKeeping; using namespace CommandFrames::HouseKeeping;
using ResponseFrames::HouseKeeping::ResponseId;
auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame(
StartSession() StartSession()
@@ -78,6 +79,7 @@ namespace Bloom::DebugToolDrivers
void XplainedNano::endSession() { void XplainedNano::endSession() {
using namespace CommandFrames::HouseKeeping; using namespace CommandFrames::HouseKeeping;
using ResponseFrames::HouseKeeping::ResponseId;
auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame(
EndSession() EndSession()

View File

@@ -72,6 +72,7 @@ namespace Bloom::DebugToolDrivers
void XplainedPro::startSession() { void XplainedPro::startSession() {
using namespace CommandFrames::HouseKeeping; using namespace CommandFrames::HouseKeeping;
using ResponseFrames::HouseKeeping::ResponseId;
auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame(
StartSession() StartSession()
@@ -87,6 +88,7 @@ namespace Bloom::DebugToolDrivers
void XplainedPro::endSession() { void XplainedPro::endSession() {
using namespace CommandFrames::HouseKeeping; using namespace CommandFrames::HouseKeeping;
using ResponseFrames::HouseKeeping::ResponseId;
auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame( auto response = this->getEdbgInterface().sendAvrCommandFrameAndWaitForResponseFrame(
EndSession() EndSession()

View File

@@ -5,28 +5,11 @@
namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames::HouseKeeping namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames::HouseKeeping
{ {
enum class ResponseId : unsigned char
{
OK = 0x80,
LIST = 0x81,
DATA = 0x84,
FAILED = 0xA0,
FAILED_WITH_DATA = 0xA1
};
inline bool operator == (unsigned char rawId, ResponseId id) {
return static_cast<unsigned char>(id) == rawId;
}
inline bool operator == (ResponseId id, unsigned char rawId) {
return rawId == id;
}
template<class PayloadContainerType> template<class PayloadContainerType>
class HouseKeepingCommandFrame: public AvrCommandFrame<PayloadContainerType> class HouseKeepingCommandFrame: public AvrCommandFrame<PayloadContainerType>
{ {
public: public:
using ExpectedResponseFrameType = ResponseFrames::HouseKeepingResponseFrame; using ExpectedResponseFrameType = ResponseFrames::HouseKeeping::HouseKeepingResponseFrame;
HouseKeepingCommandFrame(): AvrCommandFrame<PayloadContainerType>(ProtocolHandlerId::HOUSE_KEEPING) {} HouseKeepingCommandFrame(): AvrCommandFrame<PayloadContainerType>(ProtocolHandlerId::HOUSE_KEEPING) {}
}; };

View File

@@ -2,17 +2,17 @@
#include "src/Exceptions/Exception.hpp" #include "src/Exceptions/Exception.hpp"
namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrames namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrames::HouseKeeping
{ {
using namespace Bloom::Exceptions; using namespace Bloom::Exceptions;
unsigned char HouseKeepingResponseFrame::getResponseId() { ResponseId HouseKeepingResponseFrame::getResponseId() {
const auto& payload = this->getPayload(); const auto& payload = this->getPayload();
if (payload.empty()) { if (payload.empty()) {
throw Exception("Response ID missing from HOUSEKEEPING response frame payload."); throw Exception("Response ID missing from HOUSEKEEPING response frame payload.");
} }
return payload[0]; return static_cast<ResponseId>(payload[0]);
} }
} }

View File

@@ -2,14 +2,23 @@
#include "src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/ResponseFrames/AvrResponseFrame.hpp" #include "src/DebugToolDrivers/Protocols/CMSIS-DAP/VendorSpecific/EDBG/AVR/ResponseFrames/AvrResponseFrame.hpp"
namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrames namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::ResponseFrames::HouseKeeping
{ {
enum class ResponseId : unsigned char
{
OK = 0x80,
LIST = 0x81,
DATA = 0x84,
FAILED = 0xA0,
FAILED_WITH_DATA = 0xA1
};
class HouseKeepingResponseFrame: public AvrResponseFrame class HouseKeepingResponseFrame: public AvrResponseFrame
{ {
public: public:
HouseKeepingResponseFrame() = default; HouseKeepingResponseFrame() = default;
explicit HouseKeepingResponseFrame(const std::vector<AvrResponse>& avrResponses): AvrResponseFrame(avrResponses) {} explicit HouseKeepingResponseFrame(const std::vector<AvrResponse>& avrResponses): AvrResponseFrame(avrResponses) {}
unsigned char getResponseId(); ResponseId getResponseId();
}; };
} }