Support for EtherBADGE

pull/25/head
Paul Hollinsky 2020-02-20 14:43:10 -05:00
parent 98bd7e9c55
commit a2fecb7621
5 changed files with 76 additions and 0 deletions

View File

@ -6,6 +6,10 @@ using namespace icsneo;
static bool supportedDevicesCached = false;
static std::vector<DeviceType> supportedDevices = {
#ifdef __ETHERBADGE_H_
EtherBADGE::DEVICE_TYPE,
#endif
#ifdef __NEOOBD2PRO_H_
NeoOBD2PRO::DEVICE_TYPE,
#endif
@ -83,6 +87,10 @@ static std::vector<DeviceType> supportedDevices = {
std::vector<std::shared_ptr<Device>> DeviceFinder::FindAll() {
std::vector<std::shared_ptr<Device>> foundDevices;
std::vector<std::vector<std::shared_ptr<Device>>> findResults;
#ifdef __ETHERBADGE_H_
findResults.push_back(EtherBADGE::Find());
#endif
#ifdef __NEOOBD2PRO_H_
findResults.push_back(NeoOBD2PRO::Find());

View File

@ -36,6 +36,7 @@ public:
VCAN4_2EL = (0x0000000a),
RADIO_CANHUB = (0x0000000b),
VCAN3 = (0x00000010),
EtherBADGE = (0x00000016),
RED = (0x00000040),
ECU = (0x00000080),
IEVB = (0x00000100),
@ -92,6 +93,8 @@ public:
return "RADIO_CANHUB";
case VCAN3:
return "ValueCAN 3";
case EtherBADGE:
return "EtherBADGE";
case RED:
return "neoVI RED";
case ECU:
@ -179,6 +182,7 @@ private:
#define ICSNEO_DEVICETYPE_VCAN4_2EL ((devicetype_t)0x0000000a)
#define ICSNEO_DEVICETYPE_RADIO_CANHUB ((devicetype_t)0x0000000b)
#define ICSNEO_DEVICETYPE_VCAN3 ((devicetype_t)0x00000010)
#define ICSNEO_DEVICETYPE_ETHERBADGE ((devicetype_t)0x00000016)
#define ICSNEO_DEVICETYPE_RED ((devicetype_t)0x00000040)
#define ICSNEO_DEVICETYPE_ECU ((devicetype_t)0x00000080)
#define ICSNEO_DEVICETYPE_IEVB ((devicetype_t)0x00000100)

View File

@ -0,0 +1,62 @@
#ifndef __ETHERBADGE_H_
#define __ETHERBADGE_H_
#include "icsneo/device/device.h"
#include "icsneo/device/devicetype.h"
#include "icsneo/communication/packetizer.h"
#include "icsneo/communication/decoder.h"
#include "icsneo/platform/stm32.h"
namespace icsneo {
class EtherBADGE : public Device {
public:
// Serial numbers start with EB
static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::EtherBADGE;
static constexpr const uint16_t PRODUCT_ID = 0x1107;
static constexpr const char* SERIAL_START = "EB";
static std::vector<std::shared_ptr<Device>> Find() {
std::vector<std::shared_ptr<Device>> found;
for(auto neodevice : STM32::FindByProduct(PRODUCT_ID))
found.emplace_back(new EtherBADGE(neodevice));
return found;
}
static const std::vector<Network>& GetSupportedNetworks() {
static std::vector<Network> supportedNetworks = {
Network::NetID::HSCAN,
Network::NetID::LIN,
Network::NetID::OP_Ethernet1
};
return supportedNetworks;
}
EtherBADGE(neodevice_t neodevice) : Device(neodevice) {
getWritableNeoDevice().type = DEVICE_TYPE;
productId = PRODUCT_ID;
initialize<STM32>();
}
protected:
virtual void setupEncoder(Encoder& encoder) override {
Device::setupEncoder(encoder);
encoder.supportCANFD = true;
}
virtual 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
virtual void setupSupportedTXNetworks(std::vector<Network>& txNetworks) override { setupSupportedRXNetworks(txNetworks); }
};
}
#endif

View File

@ -1,6 +1,7 @@
#ifndef __DEVICES_POSIX_H_
#define __DEVICES_POSIX_H_
#include "icsneo/device/tree/etherbadge/etherbadge.h"
#include "icsneo/device/tree/neoobd2pro/neoobd2pro.h"
#include "icsneo/device/tree/neoobd2sim/neoobd2sim.h"
#include "icsneo/device/tree/neovifire/neovifire.h"

View File

@ -1,6 +1,7 @@
#ifndef __DEVICES_WINDOWS_H_
#define __DEVICES_WINDOWS_H_
#include "icsneo/device/tree/etherbadge/etherbadge.h"
#include "icsneo/device/tree/neoobd2pro/neoobd2pro.h"
#include "icsneo/device/tree/neoobd2sim/neoobd2sim.h"
#include "icsneo/device/tree/neovifire/neovifire.h"