Update devices to the new memory management model

pull/4/head
Paul Hollinsky 2018-10-17 15:12:48 -04:00
parent ba82c51914
commit ae5646dd78
9 changed files with 37 additions and 31 deletions

View File

@ -13,10 +13,11 @@ public:
static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::OBD2_PRO;
static constexpr const uint16_t PRODUCT_ID = 0x1103;
NeoOBD2PRO(neodevice_t neodevice) : Device(neodevice) {
auto transport = std::make_shared<STM32>(getWritableNeoDevice());
auto transport = std::unique_ptr<ICommunication>(new STM32(getWritableNeoDevice()));
auto packetizer = std::make_shared<Packetizer>();
auto decoder = std::make_shared<Decoder>();
com = std::make_shared<Communication>(transport, packetizer, decoder);
auto encoder = std::unique_ptr<Encoder>(new Encoder(packetizer));
auto decoder = std::unique_ptr<Decoder>(new Decoder());
com = std::make_shared<Communication>(std::move(transport), packetizer, std::move(encoder), std::move(decoder));
getWritableNeoDevice().type = DEVICE_TYPE;
productId = PRODUCT_ID;
}

View File

@ -13,10 +13,11 @@ public:
static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::OBD2_SIM;
static constexpr const uint16_t PRODUCT_ID = 0x1100;
NeoOBD2SIM(neodevice_t neodevice) : Device(neodevice) {
auto transport = std::make_shared<STM32>(getWritableNeoDevice());
auto transport = std::unique_ptr<ICommunication>(new STM32(getWritableNeoDevice()));
auto packetizer = std::make_shared<Packetizer>();
auto decoder = std::make_shared<Decoder>();
com = std::make_shared<Communication>(transport, packetizer, decoder);
auto encoder = std::unique_ptr<Encoder>(new Encoder(packetizer));
auto decoder = std::unique_ptr<Decoder>(new Decoder());
com = std::make_shared<Communication>(std::move(transport), packetizer, std::move(encoder), std::move(decoder));
getWritableNeoDevice().type = DEVICE_TYPE;
productId = PRODUCT_ID;
}

View File

@ -12,10 +12,11 @@ public:
static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::FIRE;
static constexpr const uint16_t PRODUCT_ID = 0x0701;
NeoVIFIRE(neodevice_t neodevice) : Device(neodevice) {
auto transport = std::make_shared<FTDI>(getWritableNeoDevice());
auto transport = std::unique_ptr<ICommunication>(new FTDI(getWritableNeoDevice()));
auto packetizer = std::make_shared<Packetizer>();
auto decoder = std::make_shared<Decoder>();
com = std::make_shared<Communication>(transport, packetizer, decoder);
auto encoder = std::unique_ptr<Encoder>(new Encoder(packetizer));
auto decoder = std::unique_ptr<Decoder>(new Decoder());
com = std::make_shared<Communication>(std::move(transport), packetizer, std::move(encoder), std::move(decoder));
getWritableNeoDevice().type = DEVICE_TYPE;
productId = PRODUCT_ID;
}

View File

@ -13,12 +13,11 @@ public:
static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::RADSupermoon;
static constexpr const uint16_t PRODUCT_ID = 0x1201;
RADSupermoon(neodevice_t neodevice) : Device(neodevice) {
auto transport = std::make_shared<FTDI>(getWritableNeoDevice());
auto transport = std::unique_ptr<ICommunication>(new FTDI(getWritableNeoDevice()));
auto packetizer = std::make_shared<Packetizer>();
packetizer->disableChecksum = true;
packetizer->align16bit = false;
auto decoder = std::make_shared<Decoder>();
com = std::make_shared<Communication>(transport, packetizer, decoder);
auto encoder = std::unique_ptr<Encoder>(new Encoder(packetizer));
auto decoder = std::unique_ptr<Decoder>(new Decoder());
com = std::make_shared<Communication>(std::move(transport), packetizer, std::move(encoder), std::move(decoder));
getWritableNeoDevice().type = DEVICE_TYPE;
productId = PRODUCT_ID;
}

View File

@ -12,10 +12,11 @@ public:
static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::VCAN3;
static constexpr const uint16_t PRODUCT_ID = 0x0601;
ValueCAN3(neodevice_t neodevice) : Device(neodevice) {
auto transport = std::make_shared<FTDI>(getWritableNeoDevice());
auto transport = std::unique_ptr<ICommunication>(new FTDI(getWritableNeoDevice()));
auto packetizer = std::make_shared<Packetizer>();
auto decoder = std::make_shared<Decoder>();
com = std::make_shared<Communication>(transport, packetizer, decoder);
auto encoder = std::unique_ptr<Encoder>(new Encoder(packetizer));
auto decoder = std::unique_ptr<Decoder>(new Decoder());
com = std::make_shared<Communication>(std::move(transport), packetizer, std::move(encoder), std::move(decoder));
getWritableNeoDevice().type = DEVICE_TYPE;
productId = PRODUCT_ID;
}

View File

@ -13,10 +13,11 @@ public:
static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::VCAN4_2; // TODO Split headers and determine the correct type
static constexpr const uint16_t PRODUCT_ID = 0x1101;
ValueCAN4(neodevice_t neodevice) : Device(neodevice) {
auto transport = std::make_shared<STM32>(getWritableNeoDevice());
auto transport = std::unique_ptr<ICommunication>(new STM32(getWritableNeoDevice()));
auto packetizer = std::make_shared<Packetizer>();
auto decoder = std::make_shared<Decoder>();
com = std::make_shared<Communication>(transport, packetizer, decoder);
auto encoder = std::unique_ptr<Encoder>(new Encoder(packetizer));
auto decoder = std::unique_ptr<Decoder>(new Decoder());
com = std::make_shared<Communication>(std::move(transport), packetizer, std::move(encoder), std::move(decoder));
getWritableNeoDevice().type = DEVICE_TYPE;
productId = PRODUCT_ID;
}

View File

@ -13,10 +13,11 @@ public:
static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::VividCAN;
static constexpr const uint16_t PRODUCT_ID = 0x1102;
VividCAN(neodevice_t neodevice) : Device(neodevice) {
auto transport = std::make_shared<STM32>(getWritableNeoDevice());
auto transport = std::unique_ptr<ICommunication>(new STM32(getWritableNeoDevice()));
auto packetizer = std::make_shared<Packetizer>();
auto decoder = std::make_shared<Decoder>();
com = std::make_shared<Communication>(transport, packetizer, decoder);
auto encoder = std::unique_ptr<Encoder>(new Encoder(packetizer));
auto decoder = std::unique_ptr<Decoder>(new Decoder());
com = std::make_shared<Communication>(std::move(transport), packetizer, std::move(encoder), std::move(decoder));
getWritableNeoDevice().type = DEVICE_TYPE;
productId = PRODUCT_ID;
}

View File

@ -9,7 +9,8 @@
#include "device/plasion/include/neoviion.h"
#include "device/plasion/include/neoviplasma.h"
//#include "device/radgalaxy/include/radgalaxy.h" Ethernet not yet supported
#include "device/radstar2/include/radstar2.h"
//#include "device/radstar2/include/radstar2eth.h" Ethernet not yet supported
#include "device/radstar2/include/radstar2usb.h"
#include "device/radsupermoon/include/radsupermoon.h"
#include "device/valuecan3/include/valuecan3.h"
#include "device/valuecan4/include/valuecan4.h"

View File

@ -1,9 +1,9 @@
#ifndef __DEVICES_WINDOWS_H_
#define __DEVICES_WINDOWS_H_
// #include "device/neoobd2pro/include/neoobd2pro.h"
// #include "device/neoobd2sim/include/neoobd2sim.h"
// #include "device/neovifire/include/neovifire.h"
#include "device/neoobd2pro/include/neoobd2pro.h"
#include "device/neoobd2sim/include/neoobd2sim.h"
#include "device/neovifire/include/neovifire.h"
#include "device/neovifire2/include/neovifire2eth.h"
#include "device/neovifire2/include/neovifire2usb.h"
#include "device/plasion/include/neoviion.h"
@ -11,9 +11,9 @@
#include "device/radgalaxy/include/radgalaxy.h"
#include "device/radstar2/include/radstar2eth.h"
#include "device/radstar2/include/radstar2usb.h"
// #include "device/radsupermoon/include/radsupermoon.h"
// #include "device/valuecan3/include/valuecan3.h"
// #include "device/valuecan4/include/valuecan4.h"
// #include "device/vividcan/include/vividcan.h"
#include "device/radsupermoon/include/radsupermoon.h"
#include "device/valuecan3/include/valuecan3.h"
#include "device/valuecan4/include/valuecan4.h"
#include "device/vividcan/include/vividcan.h"
#endif