From ae5646dd78482b8becf517a84b238b2a839eb614 Mon Sep 17 00:00:00 2001 From: Paul Hollinsky Date: Wed, 17 Oct 2018 15:12:48 -0400 Subject: [PATCH] Update devices to the new memory management model --- device/neoobd2pro/include/neoobd2pro.h | 7 ++++--- device/neoobd2sim/include/neoobd2sim.h | 7 ++++--- device/neovifire/include/neovifire.h | 7 ++++--- device/radsupermoon/include/radsupermoon.h | 9 ++++----- device/valuecan3/include/valuecan3.h | 7 ++++--- device/valuecan4/include/valuecan4.h | 7 ++++--- device/vividcan/include/vividcan.h | 7 ++++--- platform/posix/include/devices.h | 3 ++- platform/windows/include/devices.h | 14 +++++++------- 9 files changed, 37 insertions(+), 31 deletions(-) diff --git a/device/neoobd2pro/include/neoobd2pro.h b/device/neoobd2pro/include/neoobd2pro.h index 52eb4ee..3f7f5aa 100644 --- a/device/neoobd2pro/include/neoobd2pro.h +++ b/device/neoobd2pro/include/neoobd2pro.h @@ -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(getWritableNeoDevice()); + auto transport = std::unique_ptr(new STM32(getWritableNeoDevice())); auto packetizer = std::make_shared(); - auto decoder = std::make_shared(); - com = std::make_shared(transport, packetizer, decoder); + auto encoder = std::unique_ptr(new Encoder(packetizer)); + auto decoder = std::unique_ptr(new Decoder()); + com = std::make_shared(std::move(transport), packetizer, std::move(encoder), std::move(decoder)); getWritableNeoDevice().type = DEVICE_TYPE; productId = PRODUCT_ID; } diff --git a/device/neoobd2sim/include/neoobd2sim.h b/device/neoobd2sim/include/neoobd2sim.h index e152d8c..07b1126 100644 --- a/device/neoobd2sim/include/neoobd2sim.h +++ b/device/neoobd2sim/include/neoobd2sim.h @@ -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(getWritableNeoDevice()); + auto transport = std::unique_ptr(new STM32(getWritableNeoDevice())); auto packetizer = std::make_shared(); - auto decoder = std::make_shared(); - com = std::make_shared(transport, packetizer, decoder); + auto encoder = std::unique_ptr(new Encoder(packetizer)); + auto decoder = std::unique_ptr(new Decoder()); + com = std::make_shared(std::move(transport), packetizer, std::move(encoder), std::move(decoder)); getWritableNeoDevice().type = DEVICE_TYPE; productId = PRODUCT_ID; } diff --git a/device/neovifire/include/neovifire.h b/device/neovifire/include/neovifire.h index 19a5686..fef48da 100644 --- a/device/neovifire/include/neovifire.h +++ b/device/neovifire/include/neovifire.h @@ -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(getWritableNeoDevice()); + auto transport = std::unique_ptr(new FTDI(getWritableNeoDevice())); auto packetizer = std::make_shared(); - auto decoder = std::make_shared(); - com = std::make_shared(transport, packetizer, decoder); + auto encoder = std::unique_ptr(new Encoder(packetizer)); + auto decoder = std::unique_ptr(new Decoder()); + com = std::make_shared(std::move(transport), packetizer, std::move(encoder), std::move(decoder)); getWritableNeoDevice().type = DEVICE_TYPE; productId = PRODUCT_ID; } diff --git a/device/radsupermoon/include/radsupermoon.h b/device/radsupermoon/include/radsupermoon.h index 47fb97e..5555bbb 100644 --- a/device/radsupermoon/include/radsupermoon.h +++ b/device/radsupermoon/include/radsupermoon.h @@ -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(getWritableNeoDevice()); + auto transport = std::unique_ptr(new FTDI(getWritableNeoDevice())); auto packetizer = std::make_shared(); - packetizer->disableChecksum = true; - packetizer->align16bit = false; - auto decoder = std::make_shared(); - com = std::make_shared(transport, packetizer, decoder); + auto encoder = std::unique_ptr(new Encoder(packetizer)); + auto decoder = std::unique_ptr(new Decoder()); + com = std::make_shared(std::move(transport), packetizer, std::move(encoder), std::move(decoder)); getWritableNeoDevice().type = DEVICE_TYPE; productId = PRODUCT_ID; } diff --git a/device/valuecan3/include/valuecan3.h b/device/valuecan3/include/valuecan3.h index 3531d91..1dab4db 100644 --- a/device/valuecan3/include/valuecan3.h +++ b/device/valuecan3/include/valuecan3.h @@ -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(getWritableNeoDevice()); + auto transport = std::unique_ptr(new FTDI(getWritableNeoDevice())); auto packetizer = std::make_shared(); - auto decoder = std::make_shared(); - com = std::make_shared(transport, packetizer, decoder); + auto encoder = std::unique_ptr(new Encoder(packetizer)); + auto decoder = std::unique_ptr(new Decoder()); + com = std::make_shared(std::move(transport), packetizer, std::move(encoder), std::move(decoder)); getWritableNeoDevice().type = DEVICE_TYPE; productId = PRODUCT_ID; } diff --git a/device/valuecan4/include/valuecan4.h b/device/valuecan4/include/valuecan4.h index e36bde0..ec7fcba 100644 --- a/device/valuecan4/include/valuecan4.h +++ b/device/valuecan4/include/valuecan4.h @@ -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(getWritableNeoDevice()); + auto transport = std::unique_ptr(new STM32(getWritableNeoDevice())); auto packetizer = std::make_shared(); - auto decoder = std::make_shared(); - com = std::make_shared(transport, packetizer, decoder); + auto encoder = std::unique_ptr(new Encoder(packetizer)); + auto decoder = std::unique_ptr(new Decoder()); + com = std::make_shared(std::move(transport), packetizer, std::move(encoder), std::move(decoder)); getWritableNeoDevice().type = DEVICE_TYPE; productId = PRODUCT_ID; } diff --git a/device/vividcan/include/vividcan.h b/device/vividcan/include/vividcan.h index c0c887a..3f67fec 100644 --- a/device/vividcan/include/vividcan.h +++ b/device/vividcan/include/vividcan.h @@ -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(getWritableNeoDevice()); + auto transport = std::unique_ptr(new STM32(getWritableNeoDevice())); auto packetizer = std::make_shared(); - auto decoder = std::make_shared(); - com = std::make_shared(transport, packetizer, decoder); + auto encoder = std::unique_ptr(new Encoder(packetizer)); + auto decoder = std::unique_ptr(new Decoder()); + com = std::make_shared(std::move(transport), packetizer, std::move(encoder), std::move(decoder)); getWritableNeoDevice().type = DEVICE_TYPE; productId = PRODUCT_ID; } diff --git a/platform/posix/include/devices.h b/platform/posix/include/devices.h index 51e9486..223593c 100644 --- a/platform/posix/include/devices.h +++ b/platform/posix/include/devices.h @@ -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" diff --git a/platform/windows/include/devices.h b/platform/windows/include/devices.h index a2255f2..3feeb61 100644 --- a/platform/windows/include/devices.h +++ b/platform/windows/include/devices.h @@ -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 \ No newline at end of file