2021-04-04 21:04:12 +01:00
|
|
|
#include "Response.hpp"
|
|
|
|
|
|
2021-10-02 17:39:27 +01:00
|
|
|
#include "src/Exceptions/Exception.hpp"
|
|
|
|
|
|
2023-08-13 15:47:51 +01:00
|
|
|
namespace DebugToolDrivers::Protocols::CmsisDap
|
2022-02-05 15:32:08 +00:00
|
|
|
{
|
2022-02-28 16:27:24 +00:00
|
|
|
Response::Response(const std::vector<unsigned char>& rawResponse) {
|
2022-02-05 15:32:08 +00:00
|
|
|
if (rawResponse.empty()) {
|
|
|
|
|
throw Exceptions::Exception("Failed to process CMSIS-DAP response - invalid response");
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-01 20:42:37 +01:00
|
|
|
this->id = rawResponse[0];
|
|
|
|
|
this->data = std::vector<unsigned char>(rawResponse.begin() + 1, rawResponse.end());
|
2021-04-04 21:04:12 +01:00
|
|
|
}
|
|
|
|
|
}
|