36 lines
1.1 KiB
C++
36 lines
1.1 KiB
C++
|
|
#include "FlashDone.hpp"
|
||
|
|
|
||
|
|
#include "src/DebugServer/Gdb/ResponsePackets/ErrorResponsePacket.hpp"
|
||
|
|
#include "src/DebugServer/Gdb/ResponsePackets/OkResponsePacket.hpp"
|
||
|
|
|
||
|
|
#include "src/Logger/Logger.hpp"
|
||
|
|
#include "src/Exceptions/Exception.hpp"
|
||
|
|
|
||
|
|
namespace Bloom::DebugServer::Gdb::AvrGdb::CommandPackets
|
||
|
|
{
|
||
|
|
using TargetController::TargetControllerConsole;
|
||
|
|
|
||
|
|
using ResponsePackets::ErrorResponsePacket;
|
||
|
|
using ResponsePackets::OkResponsePacket;
|
||
|
|
|
||
|
|
using namespace Bloom::Exceptions;
|
||
|
|
|
||
|
|
FlashDone::FlashDone(const RawPacketType& rawPacket)
|
||
|
|
: MemoryAccessCommandPacket(rawPacket)
|
||
|
|
{}
|
||
|
|
|
||
|
|
void FlashDone::handle(DebugSession& debugSession, TargetControllerConsole& targetControllerConsole) {
|
||
|
|
Logger::debug("Handling FlashDone packet");
|
||
|
|
|
||
|
|
try {
|
||
|
|
targetControllerConsole.disableProgrammingMode();
|
||
|
|
|
||
|
|
debugSession.connection.writePacket(OkResponsePacket());
|
||
|
|
|
||
|
|
} catch (const Exception& exception) {
|
||
|
|
Logger::error("Failed to disabling programming mode - " + exception.getMessage());
|
||
|
|
debugSession.connection.writePacket(ErrorResponsePacket());
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|