Tidying
This commit is contained in:
@@ -108,7 +108,7 @@ namespace Bloom::DebugServers::Gdb
|
|||||||
auto output = std::vector<unsigned char>();
|
auto output = std::vector<unsigned char>();
|
||||||
constexpr size_t bufferSize = 1024;
|
constexpr size_t bufferSize = 1024;
|
||||||
std::array<unsigned char, bufferSize> buffer = {};
|
std::array<unsigned char, bufferSize> buffer = {};
|
||||||
ssize_t bytesRead;
|
ssize_t bytesRead = 0;
|
||||||
|
|
||||||
if (interruptible) {
|
if (interruptible) {
|
||||||
if (this->readInterruptEnabled != interruptible) {
|
if (this->readInterruptEnabled != interruptible) {
|
||||||
@@ -145,8 +145,10 @@ namespace Bloom::DebugServers::Gdb
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t bytesToRead = (bytes > bufferSize || bytes == 0) ? bufferSize : bytes;
|
size_t bytesToRead = (bytes > bufferSize || bytes == 0) ? bufferSize : bytes;
|
||||||
while (bytesToRead > 0
|
while (
|
||||||
&& (bytesRead = ::read(this->socketFileDescriptor, buffer.data(), bytesToRead)) > 0) {
|
bytesToRead > 0
|
||||||
|
&& (bytesRead = ::read(this->socketFileDescriptor, buffer.data(), bytesToRead)) > 0
|
||||||
|
) {
|
||||||
output.insert(output.end(), buffer.begin(), buffer.begin() + bytesRead);
|
output.insert(output.end(), buffer.begin(), buffer.begin() + bytesRead);
|
||||||
|
|
||||||
if (bytesRead < bytesToRead) {
|
if (bytesRead < bytesToRead) {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ namespace Bloom::DebugServers::Gdb
|
|||||||
class Connection
|
class Connection
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
Connection() = delete;
|
||||||
|
|
||||||
explicit Connection(EventNotifier& interruptEventNotifier)
|
explicit Connection(EventNotifier& interruptEventNotifier)
|
||||||
: interruptEventNotifier(interruptEventNotifier)
|
: interruptEventNotifier(interruptEventNotifier)
|
||||||
@@ -103,7 +104,11 @@ namespace Bloom::DebugServers::Gdb
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
std::vector<unsigned char> read(std::size_t bytes = 0, bool interruptible = true, std::optional<int> msTimeout = std::nullopt);
|
std::vector<unsigned char> read(
|
||||||
|
std::size_t bytes = 0,
|
||||||
|
bool interruptible = true,
|
||||||
|
std::optional<int> msTimeout = std::nullopt
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does the same as Connection::read(), but only reads a single byte.
|
* Does the same as Connection::read(), but only reads a single byte.
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#include "Connection.hpp"
|
|
||||||
#include "TargetDescriptor.hpp"
|
#include "TargetDescriptor.hpp"
|
||||||
|
#include "Connection.hpp"
|
||||||
|
|
||||||
namespace Bloom::DebugServers::Gdb
|
namespace Bloom::DebugServers::Gdb
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,12 +11,12 @@ namespace Bloom::DebugToolDrivers::Protocols::CmsisDap::Edbg::Avr::CommandFrames
|
|||||||
public:
|
public:
|
||||||
explicit GetParameter(const EdbgParameter& parameter) {
|
explicit GetParameter(const EdbgParameter& parameter) {
|
||||||
/*
|
/*
|
||||||
* The EDBG Get Parameter command consists of 6 bytes:
|
* The EDBG Get Parameter command consists of 5 bytes:
|
||||||
*
|
*
|
||||||
* 1. Command ID (0x02)
|
* 1. Command ID (0x02)
|
||||||
* 2. Version (0x00)
|
* 2. Version (0x00)
|
||||||
* 3. Parameter context
|
* 3. Parameter context
|
||||||
* 4. Parameter
|
* 4. Parameter ID
|
||||||
* 5. Parameter size
|
* 5. Parameter size
|
||||||
*/
|
*/
|
||||||
this->payload = {
|
this->payload = {
|
||||||
|
|||||||
Reference in New Issue
Block a user