Moved toHex functions to String helper class
This commit is contained in:
@@ -6,8 +6,11 @@
|
||||
#include "src/DebugServer/Gdb/ResponsePackets/ResponsePacket.hpp"
|
||||
|
||||
#include "src/Application.hpp"
|
||||
|
||||
#include "src/Helpers/Paths.hpp"
|
||||
#include "src/Helpers/String.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
@@ -26,7 +29,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
void BloomVersion::handle(DebugSession& debugSession, TargetControllerConsole&) {
|
||||
Logger::debug("Handling BloomVersion packet");
|
||||
|
||||
debugSession.connection.writePacket(ResponsePacket(Packet::toHex(
|
||||
debugSession.connection.writePacket(ResponsePacket(String::toHex(
|
||||
std::string(
|
||||
"Bloom v" + Application::VERSION.toString() + "\n"
|
||||
+ Paths::homeDomainName() + "\n"
|
||||
|
||||
@@ -7,7 +7,10 @@
|
||||
#include "src/DebugServer/Gdb/ResponsePackets/ResponsePacket.hpp"
|
||||
|
||||
#include "src/Application.hpp"
|
||||
|
||||
#include "src/Helpers/String.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
@@ -25,7 +28,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
void BloomVersionMachine::handle(DebugSession& debugSession, TargetControllerConsole&) {
|
||||
Logger::debug("Handling BloomVersionMachine packet");
|
||||
|
||||
debugSession.connection.writePacket(ResponsePacket(Packet::toHex(
|
||||
debugSession.connection.writePacket(ResponsePacket(String::toHex(
|
||||
QJsonDocument(QJsonObject({
|
||||
{"version", QString::fromStdString(Application::VERSION.toString())},
|
||||
{"components", QJsonObject({
|
||||
|
||||
@@ -6,9 +6,11 @@
|
||||
#include "src/DebugServer/Gdb/ResponsePackets/ResponsePacket.hpp"
|
||||
#include "src/DebugServer/Gdb/ResponsePackets/ErrorResponsePacket.hpp"
|
||||
|
||||
#include "src/Helpers/String.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
#include "src/DebugServer/Gdb/Exceptions/InvalidCommandOption.hpp"
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
{
|
||||
@@ -85,7 +87,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
);
|
||||
}
|
||||
|
||||
const auto hexValues = Packet::toHex(data);
|
||||
const auto hexValues = String::toHex(data);
|
||||
Logger::debug("Filling EEPROM with values: " + hexValues);
|
||||
|
||||
targetControllerConsole.writeMemory(
|
||||
@@ -94,13 +96,13 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
std::move(data)
|
||||
);
|
||||
|
||||
debugSession.connection.writePacket(ResponsePacket(Packet::toHex(
|
||||
debugSession.connection.writePacket(ResponsePacket(String::toHex(
|
||||
"Filled " + std::to_string(eepromSize) + " bytes of EEPROM, with values: " + hexValues + "\n"
|
||||
)));
|
||||
|
||||
} catch (const InvalidCommandOption& exception) {
|
||||
Logger::error(exception.getMessage());
|
||||
debugSession.connection.writePacket(ResponsePacket(Packet::toHex(exception.getMessage() + "\n")));
|
||||
debugSession.connection.writePacket(ResponsePacket(String::toHex(exception.getMessage() + "\n")));
|
||||
|
||||
} catch (const Exception& exception) {
|
||||
Logger::error("Failed to fill EEPROM - " + exception.getMessage());
|
||||
|
||||
@@ -7,12 +7,14 @@
|
||||
#include "src/DebugServer/Gdb/ResponsePackets/ErrorResponsePacket.hpp"
|
||||
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
|
||||
#include "src/Application.hpp"
|
||||
|
||||
#include "src/Helpers/Paths.hpp"
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
#include "src/Helpers/String.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
{
|
||||
using TargetController::TargetControllerConsole;
|
||||
@@ -40,7 +42,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
);
|
||||
|
||||
if (this->sendOutput) {
|
||||
debugSession.connection.writePacket(ResponsePacket(Packet::toHex(svdXml.toString().toStdString())));
|
||||
debugSession.connection.writePacket(ResponsePacket(String::toHex(svdXml.toString().toStdString())));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -56,7 +58,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
outputFile.write(svdXml.toByteArray());
|
||||
outputFile.close();
|
||||
|
||||
debugSession.connection.writePacket(ResponsePacket(Packet::toHex(
|
||||
debugSession.connection.writePacket(ResponsePacket(String::toHex(
|
||||
"SVD output saved to " + svdOutputFilePath + "\n"
|
||||
)));
|
||||
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
#include "src/DebugServer/Gdb/ResponsePackets/ResponsePacket.hpp"
|
||||
|
||||
#include "src/Helpers/Paths.hpp"
|
||||
#include "src/Helpers/String.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
@@ -45,7 +47,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
}
|
||||
|
||||
debugSession.connection.writePacket(
|
||||
ResponsePacket(Packet::toHex("\n" + QTextStream(&helpFile).readAll().toUtf8().toStdString() + "\n"))
|
||||
ResponsePacket(String::toHex("\n" + QTextStream(&helpFile).readAll().toUtf8().toStdString() + "\n"))
|
||||
);
|
||||
|
||||
} catch (const Exception& exception) {
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
|
||||
#include "src/Targets/TargetRegister.hpp"
|
||||
|
||||
#include "src/Helpers/String.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
@@ -87,7 +89,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
}
|
||||
|
||||
debugSession.connection.writePacket(
|
||||
ResponsePacket(Packet::toHex(registers))
|
||||
ResponsePacket(String::toHex(registers))
|
||||
);
|
||||
|
||||
} catch (const Exception& exception) {
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
#include "src/DebugServer/Gdb/ResponsePackets/ErrorResponsePacket.hpp"
|
||||
#include "src/DebugServer/Gdb/ResponsePackets/ResponsePacket.hpp"
|
||||
|
||||
#include "src/Helpers/String.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
@@ -27,7 +29,7 @@ namespace Bloom::DebugServer::Gdb::CommandPackets
|
||||
targetControllerConsole.resetTarget();
|
||||
Logger::info("Target reset complete");
|
||||
|
||||
debugSession.connection.writePacket(ResponsePacket(Packet::toHex(
|
||||
debugSession.connection.writePacket(ResponsePacket(String::toHex(
|
||||
"Target reset complete - use the 'continue' command to begin execution.\n"
|
||||
)));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user