Replaced overloaded casting of CMSIS-DAP Command with rawCommand member function
This commit is contained in:
@@ -25,6 +25,6 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap
|
||||
this->lastCommandSentTimeStamp = now;
|
||||
}
|
||||
|
||||
this->getUsbHidInterface().write(static_cast<std::vector<unsigned char>>(cmsisDapCommand));
|
||||
this->getUsbHidInterface().write(cmsisDapCommand.rawCommand());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,9 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap
|
||||
: id(commandId)
|
||||
{}
|
||||
|
||||
Command::operator std::vector<unsigned char>() const {
|
||||
std::vector<unsigned char> Command::rawCommand() const {
|
||||
auto rawCommand = std::vector<unsigned char>(1, this->id);
|
||||
rawCommand.reserve(this->data.size() + 1);
|
||||
rawCommand.insert(rawCommand.end(), this->data.begin(), this->data.end());
|
||||
|
||||
return rawCommand;
|
||||
|
||||
@@ -72,11 +72,10 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts instance of a CMSIS Command to a vector of unsigned char (buffer), for sending
|
||||
* to the debug tool.
|
||||
* Generates the raw CMSIS-DAP command, for sending to the CMSIS-DAP-enabled device.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
explicit virtual operator std::vector<unsigned char>() const;
|
||||
std::vector<unsigned char> rawCommand() const;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user