mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Remove all debugging printouts to stdout
This commit is contained in:
@@ -50,6 +50,14 @@ public:
|
||||
SettingsChecksumError = 0x2006,
|
||||
SettingsNotAvailable = 0x2007,
|
||||
|
||||
// Transport Errors
|
||||
FailedToRead = 0x3000,
|
||||
FailedToWrite = 0x3001,
|
||||
DriverFailedToOpen = 0x3002,
|
||||
PacketChecksumError = 0x3003,
|
||||
PCAPCouldNotStart = 0x3102,
|
||||
PCAPCouldNotFindDevices = 0x3103,
|
||||
|
||||
TooManyErrors = 0xFFFFFFFE,
|
||||
Unknown = 0xFFFFFFFF
|
||||
};
|
||||
|
||||
@@ -21,14 +21,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
const auto main51Message = std::dynamic_pointer_cast<Main51Message>(message);
|
||||
if(!main51Message)
|
||||
std::cout << "could not upcast " << message->network << std::endl;
|
||||
if(main51Message == nullptr || !matchCommand(main51Message->command)) {
|
||||
if(main51Message)
|
||||
std::cout << "Could not match command " << (int)(command) << " to " << (int)(main51Message->command) << std::endl;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return main51Message && matchCommand(main51Message->command);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -102,7 +102,7 @@ protected:
|
||||
}
|
||||
|
||||
template<typename Transport>
|
||||
std::unique_ptr<ICommunication> makeTransport() { return std::unique_ptr<ICommunication>(new Transport(getWritableNeoDevice())); }
|
||||
std::unique_ptr<ICommunication> makeTransport() { return std::unique_ptr<ICommunication>(new Transport(err, getWritableNeoDevice())); }
|
||||
virtual void setupTransport(ICommunication* transport) {}
|
||||
|
||||
virtual std::shared_ptr<Packetizer> makePacketizer() { return std::make_shared<Packetizer>(err); }
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "icsneo/device/neodevice.h"
|
||||
#include "icsneo/communication/icommunication.h"
|
||||
#include "icsneo/third-party/concurrentqueue/blockingconcurrentqueue.h"
|
||||
#include "icsneo/api/errormanager.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
@@ -18,7 +19,7 @@ public:
|
||||
static std::vector<neodevice_t> FindByProduct(int product);
|
||||
static bool IsHandleValid(neodevice_handle_t handle);
|
||||
|
||||
FTDI(neodevice_t& forDevice);
|
||||
FTDI(device_errorhandler_t err, neodevice_t& forDevice);
|
||||
~FTDI() { close(); }
|
||||
bool open();
|
||||
bool close();
|
||||
@@ -43,6 +44,7 @@ private:
|
||||
bool openable; // Set to false in the constructor if the object has not been found in searchResultDevices
|
||||
|
||||
neodevice_t& device;
|
||||
device_errorhandler_t err;
|
||||
FTDIDevice ftdiDevice;
|
||||
};
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "icsneo/communication/icommunication.h"
|
||||
#include "icsneo/device/neodevice.h"
|
||||
#include "icsneo/api/errormanager.h"
|
||||
#include <chrono>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -10,7 +11,7 @@ namespace icsneo {
|
||||
|
||||
class STM32 : public ICommunication {
|
||||
public:
|
||||
STM32(neodevice_t& forDevice) : device(forDevice) {}
|
||||
STM32(device_errorhandler_t err, neodevice_t& forDevice) : device(forDevice), err(err) {}
|
||||
static std::vector<neodevice_t> FindByProduct(int product);
|
||||
|
||||
bool open();
|
||||
@@ -19,6 +20,7 @@ public:
|
||||
|
||||
private:
|
||||
neodevice_t& device;
|
||||
device_errorhandler_t err;
|
||||
int fd = -1;
|
||||
static constexpr neodevice_handle_t HANDLE_OFFSET = 10;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace icsneo {
|
||||
|
||||
class FTDI : public VCP {
|
||||
public:
|
||||
FTDI(neodevice_t& forDevice) : VCP(forDevice) {}
|
||||
FTDI(device_errorhandler_t err, neodevice_t& forDevice) : VCP(err, forDevice) {}
|
||||
static std::vector<neodevice_t> FindByProduct(int product) { return VCP::FindByProduct(product, L"serenum"); }
|
||||
};
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "icsneo/platform/windows/internal/pcapdll.h"
|
||||
#include "icsneo/device/neodevice.h"
|
||||
#include "icsneo/communication/icommunication.h"
|
||||
#include "icsneo/api/errormanager.h"
|
||||
#include <string>
|
||||
|
||||
namespace icsneo {
|
||||
@@ -20,7 +21,7 @@ public:
|
||||
static std::string GetEthDevSerialFromMacAddress(uint8_t product, uint16_t macSerial);
|
||||
static bool IsHandleValid(neodevice_handle_t handle);
|
||||
|
||||
PCAP(neodevice_t& forDevice);
|
||||
PCAP(device_errorhandler_t err, neodevice_t& forDevice);
|
||||
bool open();
|
||||
bool isOpen();
|
||||
bool close();
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace icsneo {
|
||||
|
||||
class STM32 : public VCP {
|
||||
public:
|
||||
STM32(neodevice_t& forDevice) : VCP(forDevice) {}
|
||||
STM32(device_errorhandler_t err, neodevice_t& forDevice) : VCP(err, forDevice) {}
|
||||
static std::vector<neodevice_t> FindByProduct(int product) { return VCP::FindByProduct(product, L"usbser"); }
|
||||
};
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <Windows.h>
|
||||
#include "icsneo/device/neodevice.h"
|
||||
#include "icsneo/communication/icommunication.h"
|
||||
#include "icsneo/api/errormanager.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
@@ -19,7 +20,7 @@ public:
|
||||
static bool IsHandleValid(neodevice_handle_t handle);
|
||||
typedef void(*fn_boolCallback)(bool success);
|
||||
|
||||
VCP(neodevice_t& forDevice) : device(forDevice) {
|
||||
VCP(device_errorhandler_t err, neodevice_t& forDevice) : device(forDevice), err(err) {
|
||||
overlappedRead.hEvent = INVALID_HANDLE_VALUE;
|
||||
overlappedWrite.hEvent = INVALID_HANDLE_VALUE;
|
||||
overlappedWait.hEvent = INVALID_HANDLE_VALUE;
|
||||
@@ -34,6 +35,7 @@ private:
|
||||
bool open(bool fromAsync);
|
||||
bool opening = false;
|
||||
neodevice_t& device;
|
||||
device_errorhandler_t err;
|
||||
HANDLE handle = INVALID_HANDLE_VALUE;
|
||||
OVERLAPPED overlappedRead = {};
|
||||
OVERLAPPED overlappedWrite = {};
|
||||
|
||||
Reference in New Issue
Block a user