mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 09:28:40 +02:00
Repo: Normalize source files to LF
This commit is contained in:
@@ -1,61 +1,61 @@
|
||||
#ifndef __DRIVER_H_
|
||||
#define __DRIVER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <vector>
|
||||
#include <chrono>
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
#include "icsneo/api/eventmanager.h"
|
||||
#include "icsneo/third-party/concurrentqueue/blockingconcurrentqueue.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class Driver {
|
||||
public:
|
||||
Driver(const device_eventhandler_t& handler) : report(handler) {}
|
||||
virtual ~Driver() {}
|
||||
virtual bool open() = 0;
|
||||
virtual bool isOpen() = 0;
|
||||
virtual void modeChangeIncoming() {}
|
||||
virtual void awaitModeChangeComplete() {}
|
||||
virtual bool isDisconnected() { return disconnected; };
|
||||
virtual bool close() = 0;
|
||||
virtual bool read(std::vector<uint8_t>& bytes, size_t limit = 0);
|
||||
virtual bool readWait(std::vector<uint8_t>& bytes, std::chrono::milliseconds timeout = std::chrono::milliseconds(100), size_t limit = 0);
|
||||
virtual bool write(const std::vector<uint8_t>& bytes);
|
||||
virtual bool isEthernet() const { return false; }
|
||||
|
||||
device_eventhandler_t report;
|
||||
|
||||
size_t writeQueueSize = 50;
|
||||
bool writeBlocks = true; // Otherwise it just fails when the queue is full
|
||||
|
||||
protected:
|
||||
class WriteOperation {
|
||||
public:
|
||||
WriteOperation() {}
|
||||
WriteOperation(const std::vector<uint8_t>& b) : bytes(b) {}
|
||||
std::vector<uint8_t> bytes;
|
||||
};
|
||||
enum IOTaskState {
|
||||
LAUNCH,
|
||||
WAIT
|
||||
};
|
||||
virtual void readTask() = 0;
|
||||
virtual void writeTask() = 0;
|
||||
moodycamel::BlockingConcurrentQueue<uint8_t> readQueue;
|
||||
moodycamel::BlockingConcurrentQueue<WriteOperation> writeQueue;
|
||||
std::thread readThread, writeThread;
|
||||
std::atomic<bool> closing{false};
|
||||
std::atomic<bool> disconnected{false};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef __DRIVER_H_
|
||||
#define __DRIVER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <vector>
|
||||
#include <chrono>
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
#include "icsneo/api/eventmanager.h"
|
||||
#include "icsneo/third-party/concurrentqueue/blockingconcurrentqueue.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class Driver {
|
||||
public:
|
||||
Driver(const device_eventhandler_t& handler) : report(handler) {}
|
||||
virtual ~Driver() {}
|
||||
virtual bool open() = 0;
|
||||
virtual bool isOpen() = 0;
|
||||
virtual void modeChangeIncoming() {}
|
||||
virtual void awaitModeChangeComplete() {}
|
||||
virtual bool isDisconnected() { return disconnected; };
|
||||
virtual bool close() = 0;
|
||||
virtual bool read(std::vector<uint8_t>& bytes, size_t limit = 0);
|
||||
virtual bool readWait(std::vector<uint8_t>& bytes, std::chrono::milliseconds timeout = std::chrono::milliseconds(100), size_t limit = 0);
|
||||
virtual bool write(const std::vector<uint8_t>& bytes);
|
||||
virtual bool isEthernet() const { return false; }
|
||||
|
||||
device_eventhandler_t report;
|
||||
|
||||
size_t writeQueueSize = 50;
|
||||
bool writeBlocks = true; // Otherwise it just fails when the queue is full
|
||||
|
||||
protected:
|
||||
class WriteOperation {
|
||||
public:
|
||||
WriteOperation() {}
|
||||
WriteOperation(const std::vector<uint8_t>& b) : bytes(b) {}
|
||||
std::vector<uint8_t> bytes;
|
||||
};
|
||||
enum IOTaskState {
|
||||
LAUNCH,
|
||||
WAIT
|
||||
};
|
||||
virtual void readTask() = 0;
|
||||
virtual void writeTask() = 0;
|
||||
moodycamel::BlockingConcurrentQueue<uint8_t> readQueue;
|
||||
moodycamel::BlockingConcurrentQueue<WriteOperation> writeQueue;
|
||||
std::thread readThread, writeThread;
|
||||
std::atomic<bool> closing{false};
|
||||
std::atomic<bool> disconnected{false};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -1,50 +1,50 @@
|
||||
#ifndef __MESSAGECALLBACK_H_
|
||||
#define __MESSAGECALLBACK_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/communication/message/message.h"
|
||||
#include "icsneo/communication/message/filter/messagefilter.h"
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class MessageCallback {
|
||||
public:
|
||||
typedef std::function< void( std::shared_ptr<Message> ) > fn_messageCallback;
|
||||
|
||||
MessageCallback(fn_messageCallback cb, std::shared_ptr<MessageFilter> f)
|
||||
: callback(cb), filter(f ? f : std::make_shared<MessageFilter>()) {
|
||||
if(!cb)
|
||||
throw std::bad_function_call();
|
||||
}
|
||||
|
||||
MessageCallback(fn_messageCallback cb, MessageFilter f = MessageFilter())
|
||||
: MessageCallback(cb, std::make_shared<MessageFilter>(f)) {}
|
||||
|
||||
// Allow the filter to be placed first if the user wants (maybe in the case of a lambda)
|
||||
MessageCallback(std::shared_ptr<MessageFilter> f, fn_messageCallback cb)
|
||||
: MessageCallback(cb, f) {}
|
||||
MessageCallback(MessageFilter f, fn_messageCallback cb)
|
||||
: MessageCallback(cb, std::make_shared<MessageFilter>(f)) {}
|
||||
|
||||
virtual bool callIfMatch(const std::shared_ptr<Message>& message) const {
|
||||
bool ret = filter->match(message);
|
||||
if(ret)
|
||||
callback(message);
|
||||
return ret;
|
||||
}
|
||||
const MessageFilter& getFilter() const { return *filter; }
|
||||
const fn_messageCallback& getCallback() const { return callback; }
|
||||
|
||||
protected:
|
||||
const fn_messageCallback callback;
|
||||
const std::shared_ptr<MessageFilter> filter;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef __MESSAGECALLBACK_H_
|
||||
#define __MESSAGECALLBACK_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/communication/message/message.h"
|
||||
#include "icsneo/communication/message/filter/messagefilter.h"
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class MessageCallback {
|
||||
public:
|
||||
typedef std::function< void( std::shared_ptr<Message> ) > fn_messageCallback;
|
||||
|
||||
MessageCallback(fn_messageCallback cb, std::shared_ptr<MessageFilter> f)
|
||||
: callback(cb), filter(f ? f : std::make_shared<MessageFilter>()) {
|
||||
if(!cb)
|
||||
throw std::bad_function_call();
|
||||
}
|
||||
|
||||
MessageCallback(fn_messageCallback cb, MessageFilter f = MessageFilter())
|
||||
: MessageCallback(cb, std::make_shared<MessageFilter>(f)) {}
|
||||
|
||||
// Allow the filter to be placed first if the user wants (maybe in the case of a lambda)
|
||||
MessageCallback(std::shared_ptr<MessageFilter> f, fn_messageCallback cb)
|
||||
: MessageCallback(cb, f) {}
|
||||
MessageCallback(MessageFilter f, fn_messageCallback cb)
|
||||
: MessageCallback(cb, std::make_shared<MessageFilter>(f)) {}
|
||||
|
||||
virtual bool callIfMatch(const std::shared_ptr<Message>& message) const {
|
||||
bool ret = filter->match(message);
|
||||
if(ret)
|
||||
callback(message);
|
||||
return ret;
|
||||
}
|
||||
const MessageFilter& getFilter() const { return *filter; }
|
||||
const fn_messageCallback& getCallback() const { return callback; }
|
||||
|
||||
protected:
|
||||
const fn_messageCallback callback;
|
||||
const std::shared_ptr<MessageFilter> filter;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -1,25 +1,25 @@
|
||||
#ifndef __CANMESSAGE_H_
|
||||
#define __CANMESSAGE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/communication/message/message.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class CANMessage : public Frame {
|
||||
public:
|
||||
uint32_t arbid;
|
||||
uint8_t dlcOnWire;
|
||||
bool isRemote = false; // Not allowed if CAN FD
|
||||
bool isExtended = false;
|
||||
bool isCANFD = false;
|
||||
bool baudrateSwitch = false; // CAN FD only
|
||||
bool errorStateIndicator = false; // CAN FD only
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef __CANMESSAGE_H_
|
||||
#define __CANMESSAGE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/communication/message/message.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class CANMessage : public Frame {
|
||||
public:
|
||||
uint32_t arbid;
|
||||
uint8_t dlcOnWire;
|
||||
bool isRemote = false; // Not allowed if CAN FD
|
||||
bool isExtended = false;
|
||||
bool isCANFD = false;
|
||||
bool baudrateSwitch = false; // CAN FD only
|
||||
bool errorStateIndicator = false; // CAN FD only
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -1,68 +1,68 @@
|
||||
#ifndef __MESSAGEFILTER_H_
|
||||
#define __MESSAGEFILTER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/communication/network.h"
|
||||
#include "icsneo/communication/message/message.h"
|
||||
#include <memory>
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class MessageFilter {
|
||||
public:
|
||||
MessageFilter() {}
|
||||
MessageFilter(Message::Type type) : includeInternalInAny(neomessagetype_t(type) & 0x8000), messageType(type) {}
|
||||
MessageFilter(Network::NetID netid) : MessageFilter(Network::GetTypeOfNetID(netid), netid) {}
|
||||
MessageFilter(Network::Type type, Network::NetID net = Network::NetID::Any) : networkType(type), netid(net) {
|
||||
// If a Network::Type::Internal is used, we want to also get internal Message::Types
|
||||
// The NetID we want may be in there
|
||||
includeInternalInAny = (networkType == Network::Type::Internal);
|
||||
}
|
||||
virtual ~MessageFilter() = default;
|
||||
// When getting "all" types of messages, include the ones marked as "internal only"
|
||||
bool includeInternalInAny = false;
|
||||
|
||||
virtual bool match(const std::shared_ptr<Message>& message) const {
|
||||
if(!matchMessageType(message->type))
|
||||
return false;
|
||||
|
||||
if(message->type == Message::Type::Frame || message->type == Message::Type::Main51 ||
|
||||
message->type == Message::Type::RawMessage || message->type == Message::Type::ReadSettings) {
|
||||
RawMessage& frame = *static_cast<RawMessage*>(message.get());
|
||||
if(!matchNetworkType(frame.network.getType()))
|
||||
return false;
|
||||
if(!matchNetID(frame.network.getNetID()))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
Message::Type messageType = Message::Type::Invalid; // Used here for "any"
|
||||
bool matchMessageType(Message::Type mtype) const {
|
||||
if(messageType == Message::Type::Invalid && ((neomessagetype_t(mtype) & 0x8000) == 0 || includeInternalInAny))
|
||||
return true;
|
||||
return messageType == mtype;
|
||||
}
|
||||
|
||||
Network::Type networkType = Network::Type::Any;
|
||||
bool matchNetworkType(Network::Type mtype) const {
|
||||
if(networkType == Network::Type::Any && (mtype != Network::Type::Internal || includeInternalInAny))
|
||||
return true;
|
||||
return networkType == mtype;
|
||||
}
|
||||
|
||||
Network::NetID netid = Network::NetID::Any;
|
||||
bool matchNetID(Network::NetID mnetid) const {
|
||||
if(netid == Network::NetID::Any)
|
||||
return true;
|
||||
return netid == mnetid;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef __MESSAGEFILTER_H_
|
||||
#define __MESSAGEFILTER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/communication/network.h"
|
||||
#include "icsneo/communication/message/message.h"
|
||||
#include <memory>
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class MessageFilter {
|
||||
public:
|
||||
MessageFilter() {}
|
||||
MessageFilter(Message::Type type) : includeInternalInAny(neomessagetype_t(type) & 0x8000), messageType(type) {}
|
||||
MessageFilter(Network::NetID netid) : MessageFilter(Network::GetTypeOfNetID(netid), netid) {}
|
||||
MessageFilter(Network::Type type, Network::NetID net = Network::NetID::Any) : networkType(type), netid(net) {
|
||||
// If a Network::Type::Internal is used, we want to also get internal Message::Types
|
||||
// The NetID we want may be in there
|
||||
includeInternalInAny = (networkType == Network::Type::Internal);
|
||||
}
|
||||
virtual ~MessageFilter() = default;
|
||||
// When getting "all" types of messages, include the ones marked as "internal only"
|
||||
bool includeInternalInAny = false;
|
||||
|
||||
virtual bool match(const std::shared_ptr<Message>& message) const {
|
||||
if(!matchMessageType(message->type))
|
||||
return false;
|
||||
|
||||
if(message->type == Message::Type::Frame || message->type == Message::Type::Main51 ||
|
||||
message->type == Message::Type::RawMessage || message->type == Message::Type::ReadSettings) {
|
||||
RawMessage& frame = *static_cast<RawMessage*>(message.get());
|
||||
if(!matchNetworkType(frame.network.getType()))
|
||||
return false;
|
||||
if(!matchNetID(frame.network.getNetID()))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
Message::Type messageType = Message::Type::Invalid; // Used here for "any"
|
||||
bool matchMessageType(Message::Type mtype) const {
|
||||
if(messageType == Message::Type::Invalid && ((neomessagetype_t(mtype) & 0x8000) == 0 || includeInternalInAny))
|
||||
return true;
|
||||
return messageType == mtype;
|
||||
}
|
||||
|
||||
Network::Type networkType = Network::Type::Any;
|
||||
bool matchNetworkType(Network::Type mtype) const {
|
||||
if(networkType == Network::Type::Any && (mtype != Network::Type::Internal || includeInternalInAny))
|
||||
return true;
|
||||
return networkType == mtype;
|
||||
}
|
||||
|
||||
Network::NetID netid = Network::NetID::Any;
|
||||
bool matchNetID(Network::NetID mnetid) const {
|
||||
if(netid == Network::NetID::Any)
|
||||
return true;
|
||||
return netid == mnetid;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -1,30 +1,30 @@
|
||||
#ifndef __ISO9141MESSAGE_H_
|
||||
#define __ISO9141MESSAGE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/communication/message/message.h"
|
||||
#include <array>
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class ISO9141Message : public Frame {
|
||||
public:
|
||||
std::array<uint8_t, 3> header;
|
||||
bool isInit = false;
|
||||
bool isBreak = false;
|
||||
bool framingError = false;
|
||||
bool overflowError = false;
|
||||
bool parityError = false;
|
||||
bool rxTimeoutError = false;
|
||||
// Checksum not yet implemted, it's just at the end of the data if enabled for now
|
||||
// bool checksumError = false;
|
||||
// bool hasChecksum = false;
|
||||
// uint8_t checksum = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef __ISO9141MESSAGE_H_
|
||||
#define __ISO9141MESSAGE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/communication/message/message.h"
|
||||
#include <array>
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class ISO9141Message : public Frame {
|
||||
public:
|
||||
std::array<uint8_t, 3> header;
|
||||
bool isInit = false;
|
||||
bool isBreak = false;
|
||||
bool framingError = false;
|
||||
bool overflowError = false;
|
||||
bool parityError = false;
|
||||
bool rxTimeoutError = false;
|
||||
// Checksum not yet implemted, it's just at the end of the data if enabled for now
|
||||
// bool checksumError = false;
|
||||
// bool hasChecksum = false;
|
||||
// uint8_t checksum = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -1,77 +1,77 @@
|
||||
#ifndef __MESSAGE_H_
|
||||
#define __MESSAGE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
typedef uint16_t neomessagetype_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/communication/network.h"
|
||||
#include <vector>
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class Message {
|
||||
public:
|
||||
enum class Type : neomessagetype_t {
|
||||
Frame = 0,
|
||||
|
||||
CANErrorCount = 0x100,
|
||||
|
||||
// Past 0x8000 are all for internal use only
|
||||
Invalid = 0x8000,
|
||||
RawMessage = 0x8001,
|
||||
ReadSettings = 0x8002,
|
||||
ResetStatus = 0x8003,
|
||||
DeviceVersion = 0x8004,
|
||||
Main51 = 0x8005,
|
||||
FlexRayControl = 0x8006,
|
||||
EthernetPhyRegister = 0x8007,
|
||||
LogicalDiskInfo = 0x8008,
|
||||
};
|
||||
|
||||
Message(Type t) : type(t) {}
|
||||
virtual ~Message() = default;
|
||||
const Type type;
|
||||
uint64_t timestamp = 0;
|
||||
};
|
||||
|
||||
class RawMessage : public Message {
|
||||
public:
|
||||
RawMessage(Message::Type type = Message::Type::RawMessage) : Message(type) {}
|
||||
RawMessage(Message::Type type, Network net) : Message(type), network(net) {}
|
||||
RawMessage(Network net) : Message(Message::Type::RawMessage), network(net) {}
|
||||
RawMessage(Network net, std::vector<uint8_t> d) : Message(Message::Type::RawMessage), network(net), data(d) {}
|
||||
|
||||
Network network;
|
||||
std::vector<uint8_t> data;
|
||||
};
|
||||
|
||||
class Frame : public RawMessage {
|
||||
public:
|
||||
Frame() : RawMessage(Message::Type::Frame) {}
|
||||
|
||||
uint16_t description = 0;
|
||||
bool transmitted = false;
|
||||
bool error = false;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifdef __ICSNEOC_H_
|
||||
|
||||
#define ICSNEO_MESSAGE_TYPE_FRAME (0x0)
|
||||
#define ICSNEO_MESSAGE_TYPE_CAN_ERROR_COUNT (0x100)
|
||||
#define ICSNEO_MESSAGE_TYPE_INVALID (0x8000)
|
||||
#define ICSNEO_MESSAGE_TYPE_RAW_MESSAGE (0x8001)
|
||||
#define ICSNEO_MESSAGE_TYPE_READ_SETTINGS (0x8002)
|
||||
#define ICSNEO_MESSAGE_TYPE_RESET_STATUS (0x8003)
|
||||
#define ICSNEO_MESSAGE_TYPE_DEVICE_VERSION (0x8004)
|
||||
#define ICSNEO_MESSAGE_TYPE_MAIN51 (0x8005)
|
||||
#define ICSNEO_MESSAGE_TYPE_FLEXRAY_CONTROL (0x8006)
|
||||
|
||||
#endif // __ICSNEOC_H_
|
||||
|
||||
#ifndef __MESSAGE_H_
|
||||
#define __MESSAGE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
typedef uint16_t neomessagetype_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/communication/network.h"
|
||||
#include <vector>
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class Message {
|
||||
public:
|
||||
enum class Type : neomessagetype_t {
|
||||
Frame = 0,
|
||||
|
||||
CANErrorCount = 0x100,
|
||||
|
||||
// Past 0x8000 are all for internal use only
|
||||
Invalid = 0x8000,
|
||||
RawMessage = 0x8001,
|
||||
ReadSettings = 0x8002,
|
||||
ResetStatus = 0x8003,
|
||||
DeviceVersion = 0x8004,
|
||||
Main51 = 0x8005,
|
||||
FlexRayControl = 0x8006,
|
||||
EthernetPhyRegister = 0x8007,
|
||||
LogicalDiskInfo = 0x8008,
|
||||
};
|
||||
|
||||
Message(Type t) : type(t) {}
|
||||
virtual ~Message() = default;
|
||||
const Type type;
|
||||
uint64_t timestamp = 0;
|
||||
};
|
||||
|
||||
class RawMessage : public Message {
|
||||
public:
|
||||
RawMessage(Message::Type type = Message::Type::RawMessage) : Message(type) {}
|
||||
RawMessage(Message::Type type, Network net) : Message(type), network(net) {}
|
||||
RawMessage(Network net) : Message(Message::Type::RawMessage), network(net) {}
|
||||
RawMessage(Network net, std::vector<uint8_t> d) : Message(Message::Type::RawMessage), network(net), data(d) {}
|
||||
|
||||
Network network;
|
||||
std::vector<uint8_t> data;
|
||||
};
|
||||
|
||||
class Frame : public RawMessage {
|
||||
public:
|
||||
Frame() : RawMessage(Message::Type::Frame) {}
|
||||
|
||||
uint16_t description = 0;
|
||||
bool transmitted = false;
|
||||
bool error = false;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifdef __ICSNEOC_H_
|
||||
|
||||
#define ICSNEO_MESSAGE_TYPE_FRAME (0x0)
|
||||
#define ICSNEO_MESSAGE_TYPE_CAN_ERROR_COUNT (0x100)
|
||||
#define ICSNEO_MESSAGE_TYPE_INVALID (0x8000)
|
||||
#define ICSNEO_MESSAGE_TYPE_RAW_MESSAGE (0x8001)
|
||||
#define ICSNEO_MESSAGE_TYPE_READ_SETTINGS (0x8002)
|
||||
#define ICSNEO_MESSAGE_TYPE_RESET_STATUS (0x8003)
|
||||
#define ICSNEO_MESSAGE_TYPE_DEVICE_VERSION (0x8004)
|
||||
#define ICSNEO_MESSAGE_TYPE_MAIN51 (0x8005)
|
||||
#define ICSNEO_MESSAGE_TYPE_FLEXRAY_CONTROL (0x8006)
|
||||
|
||||
#endif // __ICSNEOC_H_
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,23 +1,23 @@
|
||||
#ifndef __DEVICEFINDER_H_
|
||||
#define __DEVICEFINDER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class DeviceFinder {
|
||||
public:
|
||||
static std::vector<std::shared_ptr<Device>> FindAll();
|
||||
static const std::vector<DeviceType>& GetSupportedDevices();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef __DEVICEFINDER_H_
|
||||
#define __DEVICEFINDER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class DeviceFinder {
|
||||
public:
|
||||
static std::vector<std::shared_ptr<Device>> FindAll();
|
||||
static const std::vector<DeviceType>& GetSupportedDevices();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -1,90 +1,90 @@
|
||||
#ifndef __RADMOON2_H_
|
||||
#define __RADMOON2_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
#include "icsneo/device/tree/radmoon2/radmoon2settings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class RADMoon2 : public Device {
|
||||
public:
|
||||
// Serial numbers start with RM
|
||||
// USB PID is 0x1202, standard driver is FTDI3
|
||||
ICSNEO_FINDABLE_DEVICE(RADMoon2, DeviceType::RADMoon2, "RM");
|
||||
|
||||
enum class SKU {
|
||||
Standard,
|
||||
APM1000E, // Keysight Branding
|
||||
APM1000E_CLK, // Clock Option and Keysight Branding
|
||||
};
|
||||
|
||||
SKU getSKU() const {
|
||||
switch(getSerial().back()) {
|
||||
case 'A':
|
||||
case 'B':
|
||||
return SKU::APM1000E;
|
||||
case 'C':
|
||||
case 'D':
|
||||
return SKU::APM1000E_CLK;
|
||||
default:
|
||||
return SKU::Standard;
|
||||
}
|
||||
}
|
||||
|
||||
std::string getProductName() const override {
|
||||
switch(getSKU()) {
|
||||
case SKU::Standard: break;
|
||||
case SKU::APM1000E:
|
||||
return "Keysight APM1000E";
|
||||
case SKU::APM1000E_CLK:
|
||||
return "Keysight APM1000E-CLK";
|
||||
}
|
||||
return Device::getProductName();
|
||||
}
|
||||
|
||||
// RADMoon 2 does not go online, you can only set settings and
|
||||
// view PHY information (when supported)
|
||||
bool goOnline() override {
|
||||
report(APIEvent::Type::OnlineNotSupported, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool goOffline() override {
|
||||
report(APIEvent::Type::OnlineNotSupported, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool getEthPhyRegControlSupported() const override { return true; }
|
||||
|
||||
protected:
|
||||
RADMoon2(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<RADMoon2Settings>(makeDriver);
|
||||
}
|
||||
|
||||
void setupPacketizer(Packetizer& packetizer) override {
|
||||
Device::setupPacketizer(packetizer);
|
||||
packetizer.disableChecksum = true;
|
||||
packetizer.align16bit = false;
|
||||
}
|
||||
|
||||
virtual void setupEncoder(Encoder& encoder) override {
|
||||
Device::setupEncoder(encoder);
|
||||
encoder.supportEthPhy = true;
|
||||
}
|
||||
|
||||
void setupDecoder(Decoder& decoder) override {
|
||||
Device::setupDecoder(decoder);
|
||||
decoder.timestampResolution = 10; // Timestamps are in 10ns increments instead of the usual 25ns
|
||||
}
|
||||
|
||||
bool requiresVehiclePower() const override { return false; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef __RADMOON2_H_
|
||||
#define __RADMOON2_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
#include "icsneo/device/tree/radmoon2/radmoon2settings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class RADMoon2 : public Device {
|
||||
public:
|
||||
// Serial numbers start with RM
|
||||
// USB PID is 0x1202, standard driver is FTDI3
|
||||
ICSNEO_FINDABLE_DEVICE(RADMoon2, DeviceType::RADMoon2, "RM");
|
||||
|
||||
enum class SKU {
|
||||
Standard,
|
||||
APM1000E, // Keysight Branding
|
||||
APM1000E_CLK, // Clock Option and Keysight Branding
|
||||
};
|
||||
|
||||
SKU getSKU() const {
|
||||
switch(getSerial().back()) {
|
||||
case 'A':
|
||||
case 'B':
|
||||
return SKU::APM1000E;
|
||||
case 'C':
|
||||
case 'D':
|
||||
return SKU::APM1000E_CLK;
|
||||
default:
|
||||
return SKU::Standard;
|
||||
}
|
||||
}
|
||||
|
||||
std::string getProductName() const override {
|
||||
switch(getSKU()) {
|
||||
case SKU::Standard: break;
|
||||
case SKU::APM1000E:
|
||||
return "Keysight APM1000E";
|
||||
case SKU::APM1000E_CLK:
|
||||
return "Keysight APM1000E-CLK";
|
||||
}
|
||||
return Device::getProductName();
|
||||
}
|
||||
|
||||
// RADMoon 2 does not go online, you can only set settings and
|
||||
// view PHY information (when supported)
|
||||
bool goOnline() override {
|
||||
report(APIEvent::Type::OnlineNotSupported, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool goOffline() override {
|
||||
report(APIEvent::Type::OnlineNotSupported, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool getEthPhyRegControlSupported() const override { return true; }
|
||||
|
||||
protected:
|
||||
RADMoon2(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<RADMoon2Settings>(makeDriver);
|
||||
}
|
||||
|
||||
void setupPacketizer(Packetizer& packetizer) override {
|
||||
Device::setupPacketizer(packetizer);
|
||||
packetizer.disableChecksum = true;
|
||||
packetizer.align16bit = false;
|
||||
}
|
||||
|
||||
virtual void setupEncoder(Encoder& encoder) override {
|
||||
Device::setupEncoder(encoder);
|
||||
encoder.supportEthPhy = true;
|
||||
}
|
||||
|
||||
void setupDecoder(Decoder& decoder) override {
|
||||
Device::setupDecoder(decoder);
|
||||
decoder.timestampResolution = 10; // Timestamps are in 10ns increments instead of the usual 25ns
|
||||
}
|
||||
|
||||
bool requiresVehiclePower() const override { return false; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -1,54 +1,54 @@
|
||||
#ifndef __RADMOONDUO_H_
|
||||
#define __RADMOONDUO_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
#include "icsneo/device/tree/radmoonduo/radmoonduosettings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class RADMoonDuo : public Device {
|
||||
public:
|
||||
// Serial numbers start with MD
|
||||
// USB PID is 1106, standard driver is CDCACM
|
||||
ICSNEO_FINDABLE_DEVICE(RADMoonDuo, DeviceType::RADMoonDuo, "MD");
|
||||
|
||||
static const std::vector<Network>& GetSupportedNetworks() {
|
||||
// If Converter1 Target is set to USB/CM, OP_Ethernet2 will be exposed to the PC
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::OP_Ethernet2
|
||||
};
|
||||
return supportedNetworks;
|
||||
}
|
||||
|
||||
bool getEthPhyRegControlSupported() const override { return true; }
|
||||
|
||||
protected:
|
||||
RADMoonDuo(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<RADMoonDuoSettings>(makeDriver);
|
||||
}
|
||||
|
||||
virtual void setupEncoder(Encoder& encoder) override {
|
||||
Device::setupEncoder(encoder);
|
||||
encoder.supportEthPhy = true;
|
||||
}
|
||||
|
||||
void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : GetSupportedNetworks())
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
|
||||
bool requiresVehiclePower() const override { return false; }
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef __RADMOONDUO_H_
|
||||
#define __RADMOONDUO_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
#include "icsneo/device/tree/radmoonduo/radmoonduosettings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class RADMoonDuo : public Device {
|
||||
public:
|
||||
// Serial numbers start with MD
|
||||
// USB PID is 1106, standard driver is CDCACM
|
||||
ICSNEO_FINDABLE_DEVICE(RADMoonDuo, DeviceType::RADMoonDuo, "MD");
|
||||
|
||||
static const std::vector<Network>& GetSupportedNetworks() {
|
||||
// If Converter1 Target is set to USB/CM, OP_Ethernet2 will be exposed to the PC
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::OP_Ethernet2
|
||||
};
|
||||
return supportedNetworks;
|
||||
}
|
||||
|
||||
bool getEthPhyRegControlSupported() const override { return true; }
|
||||
|
||||
protected:
|
||||
RADMoonDuo(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<RADMoonDuoSettings>(makeDriver);
|
||||
}
|
||||
|
||||
virtual void setupEncoder(Encoder& encoder) override {
|
||||
Device::setupEncoder(encoder);
|
||||
encoder.supportEthPhy = true;
|
||||
}
|
||||
|
||||
void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : GetSupportedNetworks())
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
|
||||
bool requiresVehiclePower() const override { return false; }
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -1,88 +1,88 @@
|
||||
#ifndef __RADSUPERMOON_H_
|
||||
#define __RADSUPERMOON_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
#include "icsneo/device/tree/radsupermoon/radsupermoonsettings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class RADSupermoon : public Device {
|
||||
public:
|
||||
// Serial numbers start with SM
|
||||
// USB PID is 0x1201, standard driver is FTDI3
|
||||
ICSNEO_FINDABLE_DEVICE(RADSupermoon, DeviceType::RADSupermoon, "SM");
|
||||
|
||||
enum class SKU {
|
||||
Standard,
|
||||
APM1000ET, // Keysight Branding
|
||||
};
|
||||
|
||||
static const std::vector<Network>& GetSupportedNetworks() {
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::Ethernet,
|
||||
Network::NetID::OP_Ethernet1,
|
||||
Network::NetID::OP_Ethernet2
|
||||
};
|
||||
return supportedNetworks;
|
||||
}
|
||||
|
||||
SKU getSKU() const {
|
||||
switch(getSerial().back()) {
|
||||
case 'A':
|
||||
return SKU::APM1000ET;
|
||||
default:
|
||||
return SKU::Standard;
|
||||
}
|
||||
}
|
||||
|
||||
std::string getProductName() const override {
|
||||
switch(getSKU()) {
|
||||
case SKU::Standard: break;
|
||||
case SKU::APM1000ET:
|
||||
return "Keysight APM1000ET";
|
||||
}
|
||||
return Device::getProductName();
|
||||
}
|
||||
|
||||
bool getEthPhyRegControlSupported() const override { return true; }
|
||||
|
||||
protected:
|
||||
RADSupermoon(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<RADSupermoonSettings>(makeDriver);
|
||||
}
|
||||
|
||||
void setupPacketizer(Packetizer& packetizer) override {
|
||||
Device::setupPacketizer(packetizer);
|
||||
packetizer.disableChecksum = true;
|
||||
packetizer.align16bit = false;
|
||||
}
|
||||
|
||||
virtual void setupEncoder(Encoder& encoder) override {
|
||||
Device::setupEncoder(encoder);
|
||||
encoder.supportEthPhy = true;
|
||||
}
|
||||
|
||||
void setupDecoder(Decoder& decoder) override {
|
||||
Device::setupDecoder(decoder);
|
||||
decoder.timestampResolution = 10; // Timestamps are in 10ns increments instead of the usual 25ns
|
||||
}
|
||||
|
||||
void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : GetSupportedNetworks())
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
|
||||
bool requiresVehiclePower() const override { return false; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef __RADSUPERMOON_H_
|
||||
#define __RADSUPERMOON_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
#include "icsneo/device/tree/radsupermoon/radsupermoonsettings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class RADSupermoon : public Device {
|
||||
public:
|
||||
// Serial numbers start with SM
|
||||
// USB PID is 0x1201, standard driver is FTDI3
|
||||
ICSNEO_FINDABLE_DEVICE(RADSupermoon, DeviceType::RADSupermoon, "SM");
|
||||
|
||||
enum class SKU {
|
||||
Standard,
|
||||
APM1000ET, // Keysight Branding
|
||||
};
|
||||
|
||||
static const std::vector<Network>& GetSupportedNetworks() {
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::Ethernet,
|
||||
Network::NetID::OP_Ethernet1,
|
||||
Network::NetID::OP_Ethernet2
|
||||
};
|
||||
return supportedNetworks;
|
||||
}
|
||||
|
||||
SKU getSKU() const {
|
||||
switch(getSerial().back()) {
|
||||
case 'A':
|
||||
return SKU::APM1000ET;
|
||||
default:
|
||||
return SKU::Standard;
|
||||
}
|
||||
}
|
||||
|
||||
std::string getProductName() const override {
|
||||
switch(getSKU()) {
|
||||
case SKU::Standard: break;
|
||||
case SKU::APM1000ET:
|
||||
return "Keysight APM1000ET";
|
||||
}
|
||||
return Device::getProductName();
|
||||
}
|
||||
|
||||
bool getEthPhyRegControlSupported() const override { return true; }
|
||||
|
||||
protected:
|
||||
RADSupermoon(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<RADSupermoonSettings>(makeDriver);
|
||||
}
|
||||
|
||||
void setupPacketizer(Packetizer& packetizer) override {
|
||||
Device::setupPacketizer(packetizer);
|
||||
packetizer.disableChecksum = true;
|
||||
packetizer.align16bit = false;
|
||||
}
|
||||
|
||||
virtual void setupEncoder(Encoder& encoder) override {
|
||||
Device::setupEncoder(encoder);
|
||||
encoder.supportEthPhy = true;
|
||||
}
|
||||
|
||||
void setupDecoder(Decoder& decoder) override {
|
||||
Device::setupDecoder(decoder);
|
||||
decoder.timestampResolution = 10; // Timestamps are in 10ns increments instead of the usual 25ns
|
||||
}
|
||||
|
||||
void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : GetSupportedNetworks())
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
|
||||
bool requiresVehiclePower() const override { return false; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -1,46 +1,46 @@
|
||||
#ifndef __VALUECAN3_H_
|
||||
#define __VALUECAN3_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
#include "icsneo/platform/ftdi.h"
|
||||
#include "icsneo/device/tree/valuecan3/valuecan3settings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class ValueCAN3 : public Device {
|
||||
public:
|
||||
// USB PID is 0x0601, standard driver is FTDI
|
||||
ICSNEO_FINDABLE_DEVICE_BY_PID(ValueCAN3, DeviceType::VCAN3, 0x0701);
|
||||
|
||||
static const std::vector<Network>& GetSupportedNetworks() {
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::HSCAN,
|
||||
Network::NetID::MSCAN
|
||||
};
|
||||
return supportedNetworks;
|
||||
}
|
||||
|
||||
private:
|
||||
ValueCAN3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<ValueCAN3Settings>(makeDriver);
|
||||
}
|
||||
|
||||
void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : GetSupportedNetworks())
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
|
||||
bool requiresVehiclePower() const override { return false; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef __VALUECAN3_H_
|
||||
#define __VALUECAN3_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
#include "icsneo/platform/ftdi.h"
|
||||
#include "icsneo/device/tree/valuecan3/valuecan3settings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class ValueCAN3 : public Device {
|
||||
public:
|
||||
// USB PID is 0x0601, standard driver is FTDI
|
||||
ICSNEO_FINDABLE_DEVICE_BY_PID(ValueCAN3, DeviceType::VCAN3, 0x0701);
|
||||
|
||||
static const std::vector<Network>& GetSupportedNetworks() {
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::HSCAN,
|
||||
Network::NetID::MSCAN
|
||||
};
|
||||
return supportedNetworks;
|
||||
}
|
||||
|
||||
private:
|
||||
ValueCAN3(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<ValueCAN3Settings>(makeDriver);
|
||||
}
|
||||
|
||||
void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : GetSupportedNetworks())
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
|
||||
bool requiresVehiclePower() const override { return false; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -1,47 +1,47 @@
|
||||
#ifndef __VALUECAN4_1_H_
|
||||
#define __VALUECAN4_1_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/tree/valuecan4/valuecan4.h"
|
||||
#include "icsneo/device/tree/valuecan4/settings/valuecan4-1settings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class ValueCAN4_1 : public ValueCAN4 {
|
||||
public:
|
||||
// Serial numbers start with V1 for 4-1
|
||||
// USB PID is 0x1101 (shared by all ValueCAN 4s), standard driver is CDCACM
|
||||
ICSNEO_FINDABLE_DEVICE(ValueCAN4_1, DeviceType::VCAN4_1, "V1");
|
||||
|
||||
static const std::vector<Network>& GetSupportedNetworks() {
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::HSCAN
|
||||
};
|
||||
return supportedNetworks;
|
||||
}
|
||||
|
||||
protected:
|
||||
ValueCAN4_1(neodevice_t neodevice, const driver_factory_t& makeDriver) : ValueCAN4(neodevice) {
|
||||
initialize<ValueCAN4_1Settings>(makeDriver);
|
||||
}
|
||||
|
||||
void setupEncoder(Encoder& encoder) override {
|
||||
ValueCAN4::setupEncoder(encoder);
|
||||
encoder.supportCANFD = false; // VCAN 4-1 does not support CAN FD
|
||||
}
|
||||
|
||||
void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : GetSupportedNetworks())
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef __VALUECAN4_1_H_
|
||||
#define __VALUECAN4_1_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/tree/valuecan4/valuecan4.h"
|
||||
#include "icsneo/device/tree/valuecan4/settings/valuecan4-1settings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class ValueCAN4_1 : public ValueCAN4 {
|
||||
public:
|
||||
// Serial numbers start with V1 for 4-1
|
||||
// USB PID is 0x1101 (shared by all ValueCAN 4s), standard driver is CDCACM
|
||||
ICSNEO_FINDABLE_DEVICE(ValueCAN4_1, DeviceType::VCAN4_1, "V1");
|
||||
|
||||
static const std::vector<Network>& GetSupportedNetworks() {
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::HSCAN
|
||||
};
|
||||
return supportedNetworks;
|
||||
}
|
||||
|
||||
protected:
|
||||
ValueCAN4_1(neodevice_t neodevice, const driver_factory_t& makeDriver) : ValueCAN4(neodevice) {
|
||||
initialize<ValueCAN4_1Settings>(makeDriver);
|
||||
}
|
||||
|
||||
void setupEncoder(Encoder& encoder) override {
|
||||
ValueCAN4::setupEncoder(encoder);
|
||||
encoder.supportCANFD = false; // VCAN 4-1 does not support CAN FD
|
||||
}
|
||||
|
||||
void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : GetSupportedNetworks())
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -1,67 +1,67 @@
|
||||
#ifndef __VALUECAN4_2_H_
|
||||
#define __VALUECAN4_2_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/tree/valuecan4/valuecan4.h"
|
||||
#include "icsneo/device/tree/valuecan4/settings/valuecan4-2settings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class ValueCAN4_2 : public ValueCAN4 {
|
||||
public:
|
||||
// Serial numbers start with V2 for 4-2
|
||||
// USB PID is 0x1101 (shared by all ValueCAN 4s), standard driver is CDCACM
|
||||
ICSNEO_FINDABLE_DEVICE(ValueCAN4_2, DeviceType::VCAN4_2, "V2");
|
||||
|
||||
enum class SKU {
|
||||
Standard,
|
||||
AP0200A, // USB A and Keysight Branding
|
||||
};
|
||||
|
||||
static const std::vector<Network>& GetSupportedNetworks() {
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::HSCAN,
|
||||
Network::NetID::HSCAN2
|
||||
};
|
||||
return supportedNetworks;
|
||||
}
|
||||
|
||||
SKU getSKU() const {
|
||||
switch(getSerial().back()) {
|
||||
case 'A':
|
||||
case 'B':
|
||||
return SKU::AP0200A;
|
||||
default:
|
||||
return SKU::Standard;
|
||||
}
|
||||
}
|
||||
|
||||
std::string getProductName() const override {
|
||||
switch(getSKU()) {
|
||||
case SKU::Standard: break;
|
||||
case SKU::AP0200A:
|
||||
return "Keysight AP0200A";
|
||||
}
|
||||
return Device::getProductName();
|
||||
}
|
||||
|
||||
protected:
|
||||
ValueCAN4_2(neodevice_t neodevice, const driver_factory_t& makeDriver) : ValueCAN4(neodevice) {
|
||||
initialize<ValueCAN4_2Settings>(makeDriver);
|
||||
}
|
||||
|
||||
void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : GetSupportedNetworks())
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef __VALUECAN4_2_H_
|
||||
#define __VALUECAN4_2_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/tree/valuecan4/valuecan4.h"
|
||||
#include "icsneo/device/tree/valuecan4/settings/valuecan4-2settings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class ValueCAN4_2 : public ValueCAN4 {
|
||||
public:
|
||||
// Serial numbers start with V2 for 4-2
|
||||
// USB PID is 0x1101 (shared by all ValueCAN 4s), standard driver is CDCACM
|
||||
ICSNEO_FINDABLE_DEVICE(ValueCAN4_2, DeviceType::VCAN4_2, "V2");
|
||||
|
||||
enum class SKU {
|
||||
Standard,
|
||||
AP0200A, // USB A and Keysight Branding
|
||||
};
|
||||
|
||||
static const std::vector<Network>& GetSupportedNetworks() {
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::HSCAN,
|
||||
Network::NetID::HSCAN2
|
||||
};
|
||||
return supportedNetworks;
|
||||
}
|
||||
|
||||
SKU getSKU() const {
|
||||
switch(getSerial().back()) {
|
||||
case 'A':
|
||||
case 'B':
|
||||
return SKU::AP0200A;
|
||||
default:
|
||||
return SKU::Standard;
|
||||
}
|
||||
}
|
||||
|
||||
std::string getProductName() const override {
|
||||
switch(getSKU()) {
|
||||
case SKU::Standard: break;
|
||||
case SKU::AP0200A:
|
||||
return "Keysight AP0200A";
|
||||
}
|
||||
return Device::getProductName();
|
||||
}
|
||||
|
||||
protected:
|
||||
ValueCAN4_2(neodevice_t neodevice, const driver_factory_t& makeDriver) : ValueCAN4(neodevice) {
|
||||
initialize<ValueCAN4_2Settings>(makeDriver);
|
||||
}
|
||||
|
||||
void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : GetSupportedNetworks())
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -1,98 +1,98 @@
|
||||
#ifndef __VALUECAN4_2EL_H_
|
||||
#define __VALUECAN4_2EL_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/tree/valuecan4/valuecan4.h"
|
||||
#include "icsneo/device/tree/valuecan4/settings/valuecan4-2elsettings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class ValueCAN4_2EL : public ValueCAN4 {
|
||||
public:
|
||||
// Serial numbers start with VE for 4-2EL
|
||||
// USB PID is 0x1101 (shared by all ValueCAN 4s), standard driver is CDCACM
|
||||
// Ethernet MAC allocation is 0x0B, standard driver is Raw
|
||||
ICSNEO_FINDABLE_DEVICE(ValueCAN4_2EL, DeviceType::VCAN4_2EL, "VE");
|
||||
|
||||
enum class SKU {
|
||||
Standard,
|
||||
AP04E0A_D26, // HDB26, USB A, and Keysight Branding
|
||||
AP04E0A_MUL, // Multi-connectors, USB A, and Keysight Branding
|
||||
AP04E0A_OBD, // OBD, USB A, and Keysight Branding
|
||||
};
|
||||
|
||||
SKU getSKU() const {
|
||||
switch(getSerial().back()) {
|
||||
case 'A':
|
||||
return SKU::AP04E0A_D26;
|
||||
case 'B':
|
||||
return SKU::AP04E0A_MUL;
|
||||
case 'C':
|
||||
return SKU::AP04E0A_OBD;
|
||||
default:
|
||||
return SKU::Standard;
|
||||
}
|
||||
}
|
||||
|
||||
std::string getProductName() const override {
|
||||
switch(getSKU()) {
|
||||
case SKU::Standard: break;
|
||||
case SKU::AP04E0A_D26:
|
||||
return "Keysight AP04E0A-D26";
|
||||
case SKU::AP04E0A_MUL:
|
||||
return "Keysight AP04E0A-MUL";
|
||||
case SKU::AP04E0A_OBD:
|
||||
return "Keysight AP04E0A-OBD";
|
||||
}
|
||||
return Device::getProductName();
|
||||
}
|
||||
|
||||
static const std::vector<Network>& GetSupportedNetworks() {
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::HSCAN,
|
||||
Network::NetID::HSCAN2,
|
||||
|
||||
Network::NetID::Ethernet,
|
||||
|
||||
Network::NetID::LIN
|
||||
};
|
||||
return supportedNetworks;
|
||||
}
|
||||
|
||||
protected:
|
||||
ValueCAN4_2EL(neodevice_t neodevice, const driver_factory_t& makeDriver) : ValueCAN4(neodevice) {
|
||||
initialize<ValueCAN4_2ELSettings>(makeDriver);
|
||||
}
|
||||
|
||||
void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : GetSupportedNetworks())
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
|
||||
size_t getEthernetActivationLineCount() const override { return 1; }
|
||||
|
||||
void handleDeviceStatus(const std::shared_ptr<RawMessage>& message) override {
|
||||
if(message->data.size() < sizeof(valuecan4_2el_status_t))
|
||||
return;
|
||||
std::lock_guard<std::mutex> lk(ioMutex);
|
||||
const valuecan4_2el_status_t* status = reinterpret_cast<const valuecan4_2el_status_t*>(message->data.data());
|
||||
ethActivationStatus = status->ethernetActivationLineEnabled;
|
||||
}
|
||||
|
||||
bool currentDriverSupportsDFU() const override { return com->driver->isEthernet(); }
|
||||
|
||||
void setupPacketizer(Packetizer& packetizer) override {
|
||||
ValueCAN4::setupPacketizer(packetizer);
|
||||
packetizer.align16bit = !com->driver->isEthernet();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef __VALUECAN4_2EL_H_
|
||||
#define __VALUECAN4_2EL_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/tree/valuecan4/valuecan4.h"
|
||||
#include "icsneo/device/tree/valuecan4/settings/valuecan4-2elsettings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class ValueCAN4_2EL : public ValueCAN4 {
|
||||
public:
|
||||
// Serial numbers start with VE for 4-2EL
|
||||
// USB PID is 0x1101 (shared by all ValueCAN 4s), standard driver is CDCACM
|
||||
// Ethernet MAC allocation is 0x0B, standard driver is Raw
|
||||
ICSNEO_FINDABLE_DEVICE(ValueCAN4_2EL, DeviceType::VCAN4_2EL, "VE");
|
||||
|
||||
enum class SKU {
|
||||
Standard,
|
||||
AP04E0A_D26, // HDB26, USB A, and Keysight Branding
|
||||
AP04E0A_MUL, // Multi-connectors, USB A, and Keysight Branding
|
||||
AP04E0A_OBD, // OBD, USB A, and Keysight Branding
|
||||
};
|
||||
|
||||
SKU getSKU() const {
|
||||
switch(getSerial().back()) {
|
||||
case 'A':
|
||||
return SKU::AP04E0A_D26;
|
||||
case 'B':
|
||||
return SKU::AP04E0A_MUL;
|
||||
case 'C':
|
||||
return SKU::AP04E0A_OBD;
|
||||
default:
|
||||
return SKU::Standard;
|
||||
}
|
||||
}
|
||||
|
||||
std::string getProductName() const override {
|
||||
switch(getSKU()) {
|
||||
case SKU::Standard: break;
|
||||
case SKU::AP04E0A_D26:
|
||||
return "Keysight AP04E0A-D26";
|
||||
case SKU::AP04E0A_MUL:
|
||||
return "Keysight AP04E0A-MUL";
|
||||
case SKU::AP04E0A_OBD:
|
||||
return "Keysight AP04E0A-OBD";
|
||||
}
|
||||
return Device::getProductName();
|
||||
}
|
||||
|
||||
static const std::vector<Network>& GetSupportedNetworks() {
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::HSCAN,
|
||||
Network::NetID::HSCAN2,
|
||||
|
||||
Network::NetID::Ethernet,
|
||||
|
||||
Network::NetID::LIN
|
||||
};
|
||||
return supportedNetworks;
|
||||
}
|
||||
|
||||
protected:
|
||||
ValueCAN4_2EL(neodevice_t neodevice, const driver_factory_t& makeDriver) : ValueCAN4(neodevice) {
|
||||
initialize<ValueCAN4_2ELSettings>(makeDriver);
|
||||
}
|
||||
|
||||
void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : GetSupportedNetworks())
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
|
||||
size_t getEthernetActivationLineCount() const override { return 1; }
|
||||
|
||||
void handleDeviceStatus(const std::shared_ptr<RawMessage>& message) override {
|
||||
if(message->data.size() < sizeof(valuecan4_2el_status_t))
|
||||
return;
|
||||
std::lock_guard<std::mutex> lk(ioMutex);
|
||||
const valuecan4_2el_status_t* status = reinterpret_cast<const valuecan4_2el_status_t*>(message->data.data());
|
||||
ethActivationStatus = status->ethernetActivationLineEnabled;
|
||||
}
|
||||
|
||||
bool currentDriverSupportsDFU() const override { return com->driver->isEthernet(); }
|
||||
|
||||
void setupPacketizer(Packetizer& packetizer) override {
|
||||
ValueCAN4::setupPacketizer(packetizer);
|
||||
packetizer.align16bit = !com->driver->isEthernet();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -1,78 +1,78 @@
|
||||
#ifndef __VALUECAN4_4_H_
|
||||
#define __VALUECAN4_4_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/tree/valuecan4/valuecan4.h"
|
||||
#include "icsneo/device/tree/valuecan4/settings/valuecan4-4settings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class ValueCAN4_4 : public ValueCAN4 {
|
||||
public:
|
||||
// Serial numbers start with V4 for 4-4
|
||||
// USB PID is 0x1101 (shared by all ValueCAN 4s), standard driver is CDCACM
|
||||
ICSNEO_FINDABLE_DEVICE(ValueCAN4_4, DeviceType::VCAN4_4, "V4");
|
||||
|
||||
enum class SKU {
|
||||
Standard,
|
||||
AP0400A_D26, // HDB26, USB A, and Keysight Branding
|
||||
AP0400A_DB9, // 4xDB9, USB A, and Keysight Branding
|
||||
AP0400A_OBD, // OBD, USB A, and Keysight Branding
|
||||
};
|
||||
|
||||
static const std::vector<Network>& GetSupportedNetworks() {
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::HSCAN,
|
||||
Network::NetID::HSCAN2,
|
||||
Network::NetID::HSCAN3,
|
||||
Network::NetID::HSCAN4
|
||||
};
|
||||
return supportedNetworks;
|
||||
}
|
||||
|
||||
SKU getSKU() const {
|
||||
switch(getSerial().back()) {
|
||||
case 'A':
|
||||
return SKU::AP0400A_D26;
|
||||
case 'B':
|
||||
return SKU::AP0400A_DB9;
|
||||
case 'C':
|
||||
return SKU::AP0400A_OBD;
|
||||
default:
|
||||
return SKU::Standard;
|
||||
}
|
||||
}
|
||||
|
||||
std::string getProductName() const override {
|
||||
switch(getSKU()) {
|
||||
case SKU::Standard: break;
|
||||
case SKU::AP0400A_D26:
|
||||
return "Keysight AP0400A-D26";
|
||||
case SKU::AP0400A_DB9:
|
||||
return "Keysight AP0400A-DB9";
|
||||
case SKU::AP0400A_OBD:
|
||||
return "Keysight AP0400A-OBD";
|
||||
}
|
||||
return Device::getProductName();
|
||||
}
|
||||
|
||||
protected:
|
||||
ValueCAN4_4(neodevice_t neodevice, const driver_factory_t& makeDriver) : ValueCAN4(neodevice) {
|
||||
initialize<ValueCAN4_4Settings>(makeDriver);
|
||||
}
|
||||
|
||||
void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : GetSupportedNetworks())
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef __VALUECAN4_4_H_
|
||||
#define __VALUECAN4_4_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/tree/valuecan4/valuecan4.h"
|
||||
#include "icsneo/device/tree/valuecan4/settings/valuecan4-4settings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class ValueCAN4_4 : public ValueCAN4 {
|
||||
public:
|
||||
// Serial numbers start with V4 for 4-4
|
||||
// USB PID is 0x1101 (shared by all ValueCAN 4s), standard driver is CDCACM
|
||||
ICSNEO_FINDABLE_DEVICE(ValueCAN4_4, DeviceType::VCAN4_4, "V4");
|
||||
|
||||
enum class SKU {
|
||||
Standard,
|
||||
AP0400A_D26, // HDB26, USB A, and Keysight Branding
|
||||
AP0400A_DB9, // 4xDB9, USB A, and Keysight Branding
|
||||
AP0400A_OBD, // OBD, USB A, and Keysight Branding
|
||||
};
|
||||
|
||||
static const std::vector<Network>& GetSupportedNetworks() {
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::HSCAN,
|
||||
Network::NetID::HSCAN2,
|
||||
Network::NetID::HSCAN3,
|
||||
Network::NetID::HSCAN4
|
||||
};
|
||||
return supportedNetworks;
|
||||
}
|
||||
|
||||
SKU getSKU() const {
|
||||
switch(getSerial().back()) {
|
||||
case 'A':
|
||||
return SKU::AP0400A_D26;
|
||||
case 'B':
|
||||
return SKU::AP0400A_DB9;
|
||||
case 'C':
|
||||
return SKU::AP0400A_OBD;
|
||||
default:
|
||||
return SKU::Standard;
|
||||
}
|
||||
}
|
||||
|
||||
std::string getProductName() const override {
|
||||
switch(getSKU()) {
|
||||
case SKU::Standard: break;
|
||||
case SKU::AP0400A_D26:
|
||||
return "Keysight AP0400A-D26";
|
||||
case SKU::AP0400A_DB9:
|
||||
return "Keysight AP0400A-DB9";
|
||||
case SKU::AP0400A_OBD:
|
||||
return "Keysight AP0400A-OBD";
|
||||
}
|
||||
return Device::getProductName();
|
||||
}
|
||||
|
||||
protected:
|
||||
ValueCAN4_4(neodevice_t neodevice, const driver_factory_t& makeDriver) : ValueCAN4(neodevice) {
|
||||
initialize<ValueCAN4_4Settings>(makeDriver);
|
||||
}
|
||||
|
||||
void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : GetSupportedNetworks())
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -1,30 +1,30 @@
|
||||
#ifndef __VALUECAN4_H_
|
||||
#define __VALUECAN4_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class ValueCAN4 : public Device {
|
||||
public:
|
||||
// All ValueCAN 4 devices share a USB PID of 0x1101
|
||||
|
||||
protected:
|
||||
using Device::Device;
|
||||
|
||||
virtual void setupEncoder(Encoder& encoder) override {
|
||||
Device::setupEncoder(encoder);
|
||||
encoder.supportCANFD = true;
|
||||
}
|
||||
|
||||
bool requiresVehiclePower() const override { return false; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef __VALUECAN4_H_
|
||||
#define __VALUECAN4_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class ValueCAN4 : public Device {
|
||||
public:
|
||||
// All ValueCAN 4 devices share a USB PID of 0x1101
|
||||
|
||||
protected:
|
||||
using Device::Device;
|
||||
|
||||
virtual void setupEncoder(Encoder& encoder) override {
|
||||
Device::setupEncoder(encoder);
|
||||
encoder.supportCANFD = true;
|
||||
}
|
||||
|
||||
bool requiresVehiclePower() const override { return false; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -1,55 +1,55 @@
|
||||
#ifndef __VALUECAN4INDUSTRIAL_H_
|
||||
#define __VALUECAN4INDUSTRIAL_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/tree/valuecan4/valuecan4.h"
|
||||
#include "icsneo/device/tree/valuecan4/settings/valuecan4industrialsettings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class ValueCAN4Industrial : public ValueCAN4 {
|
||||
public:
|
||||
// Serial numbers start with IV for Industrial
|
||||
// USB PID is 0x1101 (shared by all ValueCAN 4s), standard driver is CDCACM
|
||||
// Ethernet MAC allocation is 0x12, standard driver is Raw
|
||||
ICSNEO_FINDABLE_DEVICE(ValueCAN4Industrial, DeviceType::VCAN4_IND, "IV");
|
||||
|
||||
static const std::vector<Network>& GetSupportedNetworks() {
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::HSCAN,
|
||||
Network::NetID::HSCAN2,
|
||||
|
||||
Network::NetID::Ethernet,
|
||||
|
||||
Network::NetID::LIN
|
||||
};
|
||||
return supportedNetworks;
|
||||
}
|
||||
|
||||
protected:
|
||||
ValueCAN4Industrial(neodevice_t neodevice, const driver_factory_t& makeDriver) : ValueCAN4(neodevice) {
|
||||
initialize<ValueCAN4IndustrialSettings>(makeDriver);
|
||||
}
|
||||
|
||||
void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : GetSupportedNetworks())
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
|
||||
bool currentDriverSupportsDFU() const override { return com->driver->isEthernet(); }
|
||||
|
||||
void setupPacketizer(Packetizer& packetizer) override {
|
||||
ValueCAN4::setupPacketizer(packetizer);
|
||||
packetizer.align16bit = !com->driver->isEthernet();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef __VALUECAN4INDUSTRIAL_H_
|
||||
#define __VALUECAN4INDUSTRIAL_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/tree/valuecan4/valuecan4.h"
|
||||
#include "icsneo/device/tree/valuecan4/settings/valuecan4industrialsettings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class ValueCAN4Industrial : public ValueCAN4 {
|
||||
public:
|
||||
// Serial numbers start with IV for Industrial
|
||||
// USB PID is 0x1101 (shared by all ValueCAN 4s), standard driver is CDCACM
|
||||
// Ethernet MAC allocation is 0x12, standard driver is Raw
|
||||
ICSNEO_FINDABLE_DEVICE(ValueCAN4Industrial, DeviceType::VCAN4_IND, "IV");
|
||||
|
||||
static const std::vector<Network>& GetSupportedNetworks() {
|
||||
static std::vector<Network> supportedNetworks = {
|
||||
Network::NetID::HSCAN,
|
||||
Network::NetID::HSCAN2,
|
||||
|
||||
Network::NetID::Ethernet,
|
||||
|
||||
Network::NetID::LIN
|
||||
};
|
||||
return supportedNetworks;
|
||||
}
|
||||
|
||||
protected:
|
||||
ValueCAN4Industrial(neodevice_t neodevice, const driver_factory_t& makeDriver) : ValueCAN4(neodevice) {
|
||||
initialize<ValueCAN4IndustrialSettings>(makeDriver);
|
||||
}
|
||||
|
||||
void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
|
||||
for(auto& netid : GetSupportedNetworks())
|
||||
rxNetworks.emplace_back(netid);
|
||||
}
|
||||
|
||||
// The supported TX networks are the same as the supported RX networks for this device
|
||||
void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
|
||||
|
||||
bool currentDriverSupportsDFU() const override { return com->driver->isEthernet(); }
|
||||
|
||||
void setupPacketizer(Packetizer& packetizer) override {
|
||||
ValueCAN4::setupPacketizer(packetizer);
|
||||
packetizer.align16bit = !com->driver->isEthernet();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -1,42 +1,42 @@
|
||||
#ifndef __VIVIDCAN_H_
|
||||
#define __VIVIDCAN_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
#include "icsneo/platform/cdcacm.h"
|
||||
#include "icsneo/device/tree/vividcan/vividcansettings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class VividCAN : public Device {
|
||||
public:
|
||||
// Serial numbers start with VV
|
||||
// USB PID is 0x1102, standard driver is CDCACM
|
||||
ICSNEO_FINDABLE_DEVICE(VividCAN, DeviceType::VividCAN, "VV");
|
||||
|
||||
// VividCAN does not go online, you can only set settings
|
||||
bool goOnline() override {
|
||||
report(APIEvent::Type::OnlineNotSupported, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool goOffline() override {
|
||||
report(APIEvent::Type::OnlineNotSupported, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
VividCAN(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<VividCANSettings>(makeDriver);
|
||||
}
|
||||
|
||||
bool requiresVehiclePower() const override { return false; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef __VIVIDCAN_H_
|
||||
#define __VIVIDCAN_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/device/devicetype.h"
|
||||
#include "icsneo/platform/cdcacm.h"
|
||||
#include "icsneo/device/tree/vividcan/vividcansettings.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class VividCAN : public Device {
|
||||
public:
|
||||
// Serial numbers start with VV
|
||||
// USB PID is 0x1102, standard driver is CDCACM
|
||||
ICSNEO_FINDABLE_DEVICE(VividCAN, DeviceType::VividCAN, "VV");
|
||||
|
||||
// VividCAN does not go online, you can only set settings
|
||||
bool goOnline() override {
|
||||
report(APIEvent::Type::OnlineNotSupported, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool goOffline() override {
|
||||
report(APIEvent::Type::OnlineNotSupported, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
VividCAN(neodevice_t neodevice, const driver_factory_t& makeDriver) : Device(neodevice) {
|
||||
initialize<VividCANSettings>(makeDriver);
|
||||
}
|
||||
|
||||
bool requiresVehiclePower() const override { return false; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
+38
-38
@@ -1,39 +1,39 @@
|
||||
#ifndef __ICSNEOCPP_H_
|
||||
#define __ICSNEOCPP_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/api/version.h"
|
||||
#include "icsneo/api/eventmanager.h"
|
||||
|
||||
#include "icsneo/communication/message/canmessage.h"
|
||||
#include "icsneo/communication/message/ethernetmessage.h"
|
||||
#include "icsneo/communication/message/flexray/flexraymessage.h"
|
||||
#include "icsneo/communication/message/iso9141message.h"
|
||||
#include "icsneo/communication/message/canerrorcountmessage.h"
|
||||
#include "icsneo/communication/message/ethphymessage.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
std::vector<std::shared_ptr<Device>> FindAllDevices();
|
||||
std::vector<DeviceType> GetSupportedDevices();
|
||||
|
||||
size_t EventCount(EventFilter filter = EventFilter());
|
||||
std::vector<APIEvent> GetEvents(EventFilter filter, size_t max = 0);
|
||||
std::vector<APIEvent> GetEvents(size_t max = 0, EventFilter filter = EventFilter());
|
||||
void GetEvents(std::vector<APIEvent>& events, EventFilter filter, size_t max = 0);
|
||||
void GetEvents(std::vector<APIEvent>& events, size_t max = 0, EventFilter filter = EventFilter());
|
||||
APIEvent GetLastError();
|
||||
void DiscardEvents(EventFilter filter = EventFilter());
|
||||
void SetEventLimit(size_t newLimit);
|
||||
size_t GetEventLimit();
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef __ICSNEOCPP_H_
|
||||
#define __ICSNEOCPP_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/api/version.h"
|
||||
#include "icsneo/api/eventmanager.h"
|
||||
|
||||
#include "icsneo/communication/message/canmessage.h"
|
||||
#include "icsneo/communication/message/ethernetmessage.h"
|
||||
#include "icsneo/communication/message/flexray/flexraymessage.h"
|
||||
#include "icsneo/communication/message/iso9141message.h"
|
||||
#include "icsneo/communication/message/canerrorcountmessage.h"
|
||||
#include "icsneo/communication/message/ethphymessage.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
std::vector<std::shared_ptr<Device>> FindAllDevices();
|
||||
std::vector<DeviceType> GetSupportedDevices();
|
||||
|
||||
size_t EventCount(EventFilter filter = EventFilter());
|
||||
std::vector<APIEvent> GetEvents(EventFilter filter, size_t max = 0);
|
||||
std::vector<APIEvent> GetEvents(size_t max = 0, EventFilter filter = EventFilter());
|
||||
void GetEvents(std::vector<APIEvent>& events, EventFilter filter, size_t max = 0);
|
||||
void GetEvents(std::vector<APIEvent>& events, size_t max = 0, EventFilter filter = EventFilter());
|
||||
APIEvent GetLastError();
|
||||
void DiscardEvents(EventFilter filter = EventFilter());
|
||||
void SetEventLimit(size_t newLimit);
|
||||
size_t GetEventLimit();
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -1,14 +1,14 @@
|
||||
#ifndef __CDCACM_H_
|
||||
#define __CDCACM_H_
|
||||
|
||||
#define INTREPID_USB_VENDOR_ID (0x093c)
|
||||
|
||||
#if defined _WIN32
|
||||
#include "icsneo/platform/windows/cdcacm.h"
|
||||
#elif defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
|
||||
#include "icsneo/platform/posix/cdcacm.h"
|
||||
#else
|
||||
#warning "This platform is not supported by the CDC ACM driver"
|
||||
#endif
|
||||
|
||||
#ifndef __CDCACM_H_
|
||||
#define __CDCACM_H_
|
||||
|
||||
#define INTREPID_USB_VENDOR_ID (0x093c)
|
||||
|
||||
#if defined _WIN32
|
||||
#include "icsneo/platform/windows/cdcacm.h"
|
||||
#elif defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
|
||||
#include "icsneo/platform/posix/cdcacm.h"
|
||||
#else
|
||||
#warning "This platform is not supported by the CDC ACM driver"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,12 +1,12 @@
|
||||
#ifndef __DYNAMICLIB_H_
|
||||
#define __DYNAMICLIB_H_
|
||||
|
||||
#if defined _WIN32
|
||||
#include "icsneo/platform/windows/dynamiclib.h"
|
||||
#elif defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
|
||||
#include "icsneo/platform/posix/dynamiclib.h"
|
||||
#else
|
||||
#warning "This platform is not supported by the dynamic library driver"
|
||||
#endif
|
||||
|
||||
#ifndef __DYNAMICLIB_H_
|
||||
#define __DYNAMICLIB_H_
|
||||
|
||||
#if defined _WIN32
|
||||
#include "icsneo/platform/windows/dynamiclib.h"
|
||||
#elif defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
|
||||
#include "icsneo/platform/posix/dynamiclib.h"
|
||||
#else
|
||||
#warning "This platform is not supported by the dynamic library driver"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,14 +1,14 @@
|
||||
#ifndef __FTDI_H_
|
||||
#define __FTDI_H_
|
||||
|
||||
#define INTREPID_USB_VENDOR_ID (0x093c)
|
||||
|
||||
#if defined _WIN32
|
||||
#include "icsneo/platform/windows/ftdi.h"
|
||||
#elif defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
|
||||
#include "icsneo/platform/posix/ftdi.h"
|
||||
#else
|
||||
#warning "This platform is not supported by the FTDI driver"
|
||||
#endif
|
||||
|
||||
#ifndef __FTDI_H_
|
||||
#define __FTDI_H_
|
||||
|
||||
#define INTREPID_USB_VENDOR_ID (0x093c)
|
||||
|
||||
#if defined _WIN32
|
||||
#include "icsneo/platform/windows/ftdi.h"
|
||||
#elif defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
|
||||
#include "icsneo/platform/posix/ftdi.h"
|
||||
#else
|
||||
#warning "This platform is not supported by the FTDI driver"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,24 +1,24 @@
|
||||
#ifndef __DYNAMICLIB_POSIX_H_
|
||||
#define __DYNAMICLIB_POSIX_H_
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "icsneo/platform/posix/darwin/dynamiclib.h"
|
||||
#else
|
||||
#include "icsneo/platform/posix/linux/dynamiclib.h"
|
||||
#endif
|
||||
|
||||
#define DLLExport __attribute__((visibility("default")))
|
||||
#define LegacyDLLExport DLLExport
|
||||
|
||||
// #ifndef ICSNEO_NO_AUTO_DESTRUCT
|
||||
// #define ICSNEO_DESTRUCTOR __attribute__((destructor));
|
||||
// #else
|
||||
#define ICSNEO_DESTRUCTOR
|
||||
// #endif
|
||||
|
||||
#define icsneo_dynamicLibraryGetFunction(handle, func) dlsym(handle, func)
|
||||
#define icsneo_dynamicLibraryClose(handle) (dlclose(handle) == 0)
|
||||
|
||||
#ifndef __DYNAMICLIB_POSIX_H_
|
||||
#define __DYNAMICLIB_POSIX_H_
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "icsneo/platform/posix/darwin/dynamiclib.h"
|
||||
#else
|
||||
#include "icsneo/platform/posix/linux/dynamiclib.h"
|
||||
#endif
|
||||
|
||||
#define DLLExport __attribute__((visibility("default")))
|
||||
#define LegacyDLLExport DLLExport
|
||||
|
||||
// #ifndef ICSNEO_NO_AUTO_DESTRUCT
|
||||
// #define ICSNEO_DESTRUCTOR __attribute__((destructor));
|
||||
// #else
|
||||
#define ICSNEO_DESTRUCTOR
|
||||
// #endif
|
||||
|
||||
#define icsneo_dynamicLibraryGetFunction(handle, func) dlsym(handle, func)
|
||||
#define icsneo_dynamicLibraryClose(handle) (dlclose(handle) == 0)
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,6 @@
|
||||
#ifndef __TCHAR_POSIX_H_
|
||||
#define __TCHAR_POSIX_H_
|
||||
|
||||
typedef char TCHAR;
|
||||
|
||||
#ifndef __TCHAR_POSIX_H_
|
||||
#define __TCHAR_POSIX_H_
|
||||
|
||||
typedef char TCHAR;
|
||||
|
||||
#endif
|
||||
@@ -1,10 +1,10 @@
|
||||
#ifndef __REGISTRY_H_
|
||||
#define __REGISTRY_H_
|
||||
|
||||
#if defined _WIN32
|
||||
#include "icsneo/platform/windows/registry.h"
|
||||
#else
|
||||
#warning "This platform is not supported by the registry driver"
|
||||
#endif
|
||||
|
||||
#ifndef __REGISTRY_H_
|
||||
#define __REGISTRY_H_
|
||||
|
||||
#if defined _WIN32
|
||||
#include "icsneo/platform/windows/registry.h"
|
||||
#else
|
||||
#warning "This platform is not supported by the registry driver"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,20 +1,20 @@
|
||||
#ifndef __CDCACM_WINDOWS_H_
|
||||
#define __CDCACM_WINDOWS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/platform/windows/vcp.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class CDCACM : public VCP {
|
||||
public:
|
||||
CDCACM(const device_eventhandler_t& err, neodevice_t& forDevice) : VCP(err, forDevice) {}
|
||||
static void Find(std::vector<FoundDevice>& found) { return VCP::Find(found, { L"usbser" }); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef __CDCACM_WINDOWS_H_
|
||||
#define __CDCACM_WINDOWS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/platform/windows/vcp.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class CDCACM : public VCP {
|
||||
public:
|
||||
CDCACM(const device_eventhandler_t& err, neodevice_t& forDevice) : VCP(err, forDevice) {}
|
||||
static void Find(std::vector<FoundDevice>& found) { return VCP::Find(found, { L"usbser" }); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -1,20 +1,20 @@
|
||||
#ifndef __DYNAMICLIB_WINDOWS_H_
|
||||
#define __DYNAMICLIB_WINDOWS_H_
|
||||
|
||||
#include "icsneo/platform/windows.h"
|
||||
|
||||
#ifdef ICSNEOC_MAKEDLL
|
||||
#define DLLExport __declspec(dllexport)
|
||||
#else
|
||||
#define DLLExport __declspec(dllimport)
|
||||
#endif
|
||||
#define LegacyDLLExport DLLExport _stdcall
|
||||
|
||||
// MSVC does not have the ability to specify a destructor
|
||||
#define ICSNEO_DESTRUCTOR
|
||||
|
||||
#define icsneo_dynamicLibraryLoad() LoadLibrary(TEXT("icsneoc.dll"))
|
||||
#define icsneo_dynamicLibraryGetFunction(handle, func) GetProcAddress((HMODULE) handle, func)
|
||||
#define icsneo_dynamicLibraryClose(handle) FreeLibrary((HMODULE) handle)
|
||||
|
||||
#ifndef __DYNAMICLIB_WINDOWS_H_
|
||||
#define __DYNAMICLIB_WINDOWS_H_
|
||||
|
||||
#include "icsneo/platform/windows.h"
|
||||
|
||||
#ifdef ICSNEOC_MAKEDLL
|
||||
#define DLLExport __declspec(dllexport)
|
||||
#else
|
||||
#define DLLExport __declspec(dllimport)
|
||||
#endif
|
||||
#define LegacyDLLExport DLLExport _stdcall
|
||||
|
||||
// MSVC does not have the ability to specify a destructor
|
||||
#define ICSNEO_DESTRUCTOR
|
||||
|
||||
#define icsneo_dynamicLibraryLoad() LoadLibrary(TEXT("icsneoc.dll"))
|
||||
#define icsneo_dynamicLibraryGetFunction(handle, func) GetProcAddress((HMODULE) handle, func)
|
||||
#define icsneo_dynamicLibraryClose(handle) FreeLibrary((HMODULE) handle)
|
||||
|
||||
#endif
|
||||
@@ -1,20 +1,20 @@
|
||||
#ifndef __FTDI_WINDOWS_H_
|
||||
#define __FTDI_WINDOWS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/platform/windows/vcp.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class FTDI : public VCP {
|
||||
public:
|
||||
FTDI(const device_eventhandler_t& err, neodevice_t& forDevice) : VCP(err, forDevice) {}
|
||||
static void Find(std::vector<FoundDevice>& found) { return VCP::Find(found, { L"serenum" /*, L"ftdibus" */ }); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef __FTDI_WINDOWS_H_
|
||||
#define __FTDI_WINDOWS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "icsneo/platform/windows/vcp.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class FTDI : public VCP {
|
||||
public:
|
||||
FTDI(const device_eventhandler_t& err, neodevice_t& forDevice) : VCP(err, forDevice) {}
|
||||
static void Find(std::vector<FoundDevice>& found) { return VCP::Find(found, { L"serenum" /*, L"ftdibus" */ }); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -1,28 +1,28 @@
|
||||
#ifndef __REGISTRY_WINDOWS_H_
|
||||
#define __REGISTRY_WINDOWS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class Registry {
|
||||
public:
|
||||
static bool EnumerateSubkeys(std::wstring path, std::vector<std::wstring>& subkeys);
|
||||
|
||||
// Get string value
|
||||
static bool Get(std::wstring path, std::wstring key, std::wstring& value);
|
||||
static bool Get(std::string path, std::string key, std::string& value);
|
||||
|
||||
// Get DWORD value
|
||||
static bool Get(std::wstring path, std::wstring key, uint32_t& value);
|
||||
static bool Get(std::string path, std::string key, uint32_t& value);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef __REGISTRY_WINDOWS_H_
|
||||
#define __REGISTRY_WINDOWS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
class Registry {
|
||||
public:
|
||||
static bool EnumerateSubkeys(std::wstring path, std::vector<std::wstring>& subkeys);
|
||||
|
||||
// Get string value
|
||||
static bool Get(std::wstring path, std::wstring key, std::wstring& value);
|
||||
static bool Get(std::string path, std::string key, std::string& value);
|
||||
|
||||
// Get DWORD value
|
||||
static bool Get(std::wstring path, std::wstring key, uint32_t& value);
|
||||
static bool Get(std::string path, std::string key, uint32_t& value);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
@@ -1,48 +1,48 @@
|
||||
#ifndef __VCP_WINDOWS_H_
|
||||
#define __VCP_WINDOWS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include "icsneo/device/neodevice.h"
|
||||
#include "icsneo/communication/driver.h"
|
||||
#include "icsneo/api/eventmanager.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
// Virtual COM Port Communication
|
||||
class VCP : public Driver {
|
||||
public:
|
||||
static void Find(std::vector<FoundDevice>& found, std::vector<std::wstring> driverName);
|
||||
static bool IsHandleValid(neodevice_handle_t handle);
|
||||
typedef void(*fn_boolCallback)(bool success);
|
||||
|
||||
VCP(const device_eventhandler_t& err, neodevice_t& forDevice);
|
||||
~VCP() { close(); }
|
||||
bool open() { return open(false); }
|
||||
void openAsync(fn_boolCallback callback);
|
||||
bool close();
|
||||
bool isOpen();
|
||||
|
||||
private:
|
||||
bool open(bool fromAsync);
|
||||
bool opening = false;
|
||||
neodevice_t& device;
|
||||
|
||||
struct Detail;
|
||||
std::shared_ptr<Detail> detail;
|
||||
|
||||
std::vector<std::shared_ptr<std::thread>> threads;
|
||||
void readTask();
|
||||
void writeTask();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifndef __VCP_WINDOWS_H_
|
||||
#define __VCP_WINDOWS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include "icsneo/device/neodevice.h"
|
||||
#include "icsneo/communication/driver.h"
|
||||
#include "icsneo/api/eventmanager.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
// Virtual COM Port Communication
|
||||
class VCP : public Driver {
|
||||
public:
|
||||
static void Find(std::vector<FoundDevice>& found, std::vector<std::wstring> driverName);
|
||||
static bool IsHandleValid(neodevice_handle_t handle);
|
||||
typedef void(*fn_boolCallback)(bool success);
|
||||
|
||||
VCP(const device_eventhandler_t& err, neodevice_t& forDevice);
|
||||
~VCP() { close(); }
|
||||
bool open() { return open(false); }
|
||||
void openAsync(fn_boolCallback callback);
|
||||
bool close();
|
||||
bool isOpen();
|
||||
|
||||
private:
|
||||
bool open(bool fromAsync);
|
||||
bool opening = false;
|
||||
neodevice_t& device;
|
||||
|
||||
struct Detail;
|
||||
std::shared_ptr<Detail> detail;
|
||||
|
||||
std::vector<std::shared_ptr<std::thread>> threads;
|
||||
void readTask();
|
||||
void writeTask();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user