mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 09:28:40 +02:00
Resolve merge conflicts master into devicesettings
This commit is contained in:
@@ -7,7 +7,9 @@
|
|||||||
#include "device/include/device.h"
|
#include "device/include/device.h"
|
||||||
|
|
||||||
namespace icsneo {
|
namespace icsneo {
|
||||||
std::vector<std::shared_ptr<Device>> FindAllDevices();
|
|
||||||
};
|
std::vector<std::shared_ptr<Device>> FindAllDevices();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -58,6 +58,6 @@ private:
|
|||||||
void readTask();
|
void readTask();
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -38,6 +38,6 @@ protected:
|
|||||||
std::atomic<bool> closing{false};
|
std::atomic<bool> closing{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -98,6 +98,6 @@ private:
|
|||||||
void readTask();
|
void readTask();
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -400,6 +400,6 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -32,6 +32,6 @@ protected:
|
|||||||
std::shared_ptr<MessageFilter> filter;
|
std::shared_ptr<MessageFilter> filter;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -42,6 +42,6 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -10,6 +10,6 @@ public:
|
|||||||
uint32_t arbid;
|
uint32_t arbid;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -14,6 +14,6 @@ public:
|
|||||||
uint64_t timestamp;
|
uint64_t timestamp;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -32,8 +32,10 @@ typedef struct {
|
|||||||
#include "communication/message/include/message.h"
|
#include "communication/message/include/message.h"
|
||||||
|
|
||||||
namespace icsneo {
|
namespace icsneo {
|
||||||
neomessage_t CreateNeoMessage(const Message& message);
|
|
||||||
};
|
neomessage_t CreateNeoMessage(const Message& message);
|
||||||
|
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -86,7 +86,7 @@ bool Packetizer::input(const std::vector<uint8_t>& inputBytes) {
|
|||||||
break;
|
break;
|
||||||
case ReadState::GetData:
|
case ReadState::GetData:
|
||||||
// We do not include the checksum in packetLength so it doesn't get copied into the payload buffer
|
// We do not include the checksum in packetLength so it doesn't get copied into the payload buffer
|
||||||
if(bytes.size() < packetLength + (checksum ? 1 : 0)) { // Read until we have the rest of the packet
|
if(bytes.size() < (size_t)(packetLength + (checksum ? 1 : 0))) { // Read until we have the rest of the packet
|
||||||
haveEnoughData = false;
|
haveEnoughData = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,6 @@ private:
|
|||||||
void enforcePollingMessageLimit();
|
void enforcePollingMessageLimit();
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -12,6 +12,6 @@ public:
|
|||||||
static std::vector<std::shared_ptr<Device>> FindAll();
|
static std::vector<std::shared_ptr<Device>> FindAll();
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -6,8 +6,10 @@
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
// A forward declaration is needed as there is a circular dependency
|
// A forward declaration is needed as there is a circular dependency
|
||||||
namespace icsneo {
|
namespace icsneo {
|
||||||
class Device;
|
|
||||||
};
|
class Device;
|
||||||
|
|
||||||
|
}
|
||||||
typedef icsneo::Device* devicehandle_t;
|
typedef icsneo::Device* devicehandle_t;
|
||||||
#else
|
#else
|
||||||
typedef void* devicehandle_t;
|
typedef void* devicehandle_t;
|
||||||
|
|||||||
@@ -30,6 +30,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -30,6 +30,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -53,6 +53,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -14,6 +14,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -40,6 +40,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -29,6 +29,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -25,6 +25,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -25,6 +25,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -17,6 +17,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -44,6 +44,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -30,6 +30,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -33,6 +33,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -29,6 +29,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -30,6 +30,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -32,6 +32,6 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#ifndef __DYNAMICLIB_DARWIN_H_
|
#ifndef __DYNAMICLIB_DARWIN_H_
|
||||||
#define __DYNAMICLIB_DARWIN_H_
|
#define __DYNAMICLIB_DARWIN_H_
|
||||||
|
|
||||||
#define icsneo_dynamicLibraryLoad() dlopen("/home/paulywog/Code/icsneonext/build/libicsneoc.dylib", RTLD_LAZY)
|
#define icsneo_dynamicLibraryLoad() dlopen("/Users/paulywog/Code/icsneonext/build/libicsneoc.dylib", RTLD_LAZY)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -46,6 +46,6 @@ private:
|
|||||||
FTDIDevice ftdiDevice;
|
FTDIDevice ftdiDevice;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -26,6 +26,6 @@ private:
|
|||||||
void writeTask();
|
void writeTask();
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -273,8 +273,8 @@ void STM32::writeTask() {
|
|||||||
if(!writeQueue.wait_dequeue_timed(writeOp, std::chrono::milliseconds(100)))
|
if(!writeQueue.wait_dequeue_timed(writeOp, std::chrono::milliseconds(100)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const auto writeSize = writeOp.bytes.size();
|
const ssize_t writeSize = (ssize_t)writeOp.bytes.size();
|
||||||
int actualWritten = ::write(fd, writeOp.bytes.data(), writeSize);
|
ssize_t actualWritten = ::write(fd, writeOp.bytes.data(), writeSize);
|
||||||
if(actualWritten != writeSize)
|
if(actualWritten != writeSize)
|
||||||
std::cout << "Failure to write " << writeSize << " bytes, wrote " << actualWritten << std::endl;
|
std::cout << "Failure to write " << writeSize << " bytes, wrote " << actualWritten << std::endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,6 @@ public:
|
|||||||
static std::vector<neodevice_t> FindByProduct(int product) { return VCP::FindByProduct(product, L"serenum"); }
|
static std::vector<neodevice_t> FindByProduct(int product) { return VCP::FindByProduct(product, L"serenum"); }
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -65,6 +65,6 @@ private:
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -28,6 +28,6 @@ private:
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -11,6 +11,6 @@ public:
|
|||||||
static std::vector<neodevice_t> FindByProduct(int product) { return VCP::FindByProduct(product, L"usbser"); }
|
static std::vector<neodevice_t> FindByProduct(int product) { return VCP::FindByProduct(product, L"usbser"); }
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -43,6 +43,6 @@ private:
|
|||||||
void writeTask();
|
void writeTask();
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -4,12 +4,17 @@
|
|||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <pcap.h>
|
#include <pcap.h>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace icsneo {
|
namespace icsneo {
|
||||||
|
|
||||||
// Helper loader for the PCAP DLL
|
// Helper loader for the PCAP DLL
|
||||||
class PCAPDLL {
|
class PCAPDLL {
|
||||||
public:
|
public:
|
||||||
|
// The first time we use the DLL we keep it in here and it won't get freed until the user unloads us (for speed reasons)
|
||||||
|
static std::shared_ptr<PCAPDLL> lazyLoadHolder;
|
||||||
|
static bool lazyLoaded;
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
typedef int(__cdecl* PCAPFINDDEVICE)(char* source, struct pcap_rmtauth* auth, pcap_if_t** alldevs, char* errbuf);
|
typedef int(__cdecl* PCAPFINDDEVICE)(char* source, struct pcap_rmtauth* auth, pcap_if_t** alldevs, char* errbuf);
|
||||||
typedef pcap_t*(__cdecl* PCAPOPEN)(const char* source, int snaplen, int flags, int read_timeout, struct pcap_rmtauth* auth, char* errbuf);
|
typedef pcap_t*(__cdecl* PCAPOPEN)(const char* source, int snaplen, int flags, int read_timeout, struct pcap_rmtauth* auth, char* errbuf);
|
||||||
@@ -48,6 +53,6 @@ private:
|
|||||||
void closeDLL();
|
void closeDLL();
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -2,7 +2,15 @@
|
|||||||
|
|
||||||
using namespace icsneo;
|
using namespace icsneo;
|
||||||
|
|
||||||
|
std::shared_ptr<PCAPDLL> PCAPDLL::lazyLoadHolder;
|
||||||
|
bool PCAPDLL::lazyLoaded = false;
|
||||||
|
|
||||||
PCAPDLL::PCAPDLL() {
|
PCAPDLL::PCAPDLL() {
|
||||||
|
if(!lazyLoaded) {
|
||||||
|
lazyLoaded = true;
|
||||||
|
lazyLoadHolder = std::make_shared<PCAPDLL>();
|
||||||
|
}
|
||||||
|
|
||||||
dll = LoadLibrary("wpcap.dll");
|
dll = LoadLibrary("wpcap.dll");
|
||||||
|
|
||||||
if(dll == NULL) {
|
if(dll == NULL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user