Files
BloomPatched/src/DebugToolDrivers/Protocols/CMSIS-DAP/Response.cpp

16 lines
469 B
C++
Raw Normal View History

2021-04-04 21:04:12 +01:00
#include "src/Exceptions/Exception.hpp"
#include "Response.hpp"
using namespace Bloom::DebugToolDrivers::Protocols::CmsisDap;
2021-04-06 02:10:14 +01:00
void Response::init(const std::vector<unsigned char>& rawResponse)
2021-04-04 21:04:12 +01:00
{
2021-04-06 02:10:14 +01:00
if (rawResponse.size() < 1) {
2021-04-04 21:04:12 +01:00
throw Exceptions::Exception("Failed to process CMSIS-DAP response - invalid response");
}
2021-04-06 02:10:14 +01:00
this->setResponseId(rawResponse[0]);
this->setData(std::vector<unsigned char>(rawResponse.begin() + 1, rawResponse.end()));
2021-04-04 21:04:12 +01:00
}