diff --git a/communication/driver.cpp b/communication/driver.cpp index 3d0bbaf..999fa19 100644 --- a/communication/driver.cpp +++ b/communication/driver.cpp @@ -1,5 +1,11 @@ #include "icsneo/communication/driver.h" +//#define ICSNEO_DRIVER_DEBUG_PRINTS +#ifdef ICSNEO_DRIVER_DEBUG_PRINTS +#include +#include +#endif + using namespace icsneo; bool Driver::read(std::vector& bytes, size_t limit) { @@ -35,6 +41,18 @@ bool Driver::readWait(std::vector& bytes, std::chrono::milliseconds tim bytes.resize(actuallyRead); +#ifdef ICSNEO_DRIVER_DEBUG_PRINTS + if(actuallyRead > 0) { + std::cout << "Read data: (" << actuallyRead << ')' << std::hex << std::endl; + for(int i = 0; i < actuallyRead; i += 16) { + for(int j = 0; j < std::min(actuallyRead - i, 16); j++) + std::cout << std::setw(2) << std::setfill('0') << uint32_t(bytes[i+j]) << ' '; + std::cout << std::endl; + } + std::cout << std::dec << std::endl; + } +#endif + return actuallyRead > 0; }