Add method to create entity based on TCP transport

pull/53/head
michal.szwaj 2018-03-12 20:01:46 +01:00
parent fba7aaf208
commit 53ebc1b75c
3 changed files with 18 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#pragma once
#include <boost/asio.hpp>
#include <f1x/aasdk/Transport/ITransport.hpp>
#include <f1x/openauto/autoapp/Configuration/IConfiguration.hpp>
#include <f1x/openauto/autoapp/Projection/IAndroidAutoEntityFactory.hpp>
#include <f1x/openauto/autoapp/Projection/IServiceFactory.hpp>
@ -41,8 +42,11 @@ public:
IServiceFactory& serviceFactory);
IAndroidAutoEntity::Pointer create(aasdk::usb::DeviceHandle deviceHandle) override;
IAndroidAutoEntity::Pointer create(aasdk::tcp::ITCPEndpoint::Pointer tcpEndpoint) override;
private:
IAndroidAutoEntity::Pointer create(aasdk::transport::ITransport::Pointer transport);
aasdk::usb::IUSBWrapper& usbWrapper_;
boost::asio::io_service& ioService_;
configuration::IConfiguration::Pointer configuration_;

View File

@ -18,6 +18,7 @@
#pragma once
#include <f1x/aasdk/TCP/ITCPEndpoint.hpp>
#include <f1x/aasdk/USB/USBWrapper.hpp>
#include <f1x/openauto/autoapp/Projection/IAndroidAutoEntity.hpp>
@ -36,6 +37,7 @@ public:
virtual ~IAndroidAutoEntityFactory() = default;
virtual IAndroidAutoEntity::Pointer create(aasdk::usb::DeviceHandle deviceHandle) = 0;
virtual IAndroidAutoEntity::Pointer create(aasdk::tcp::ITCPEndpoint::Pointer tcpEndpoint) = 0;
};
}

View File

@ -19,6 +19,7 @@
#include <f1x/aasdk/USB/AOAPDevice.hpp>
#include <f1x/aasdk/Transport/SSLWrapper.hpp>
#include <f1x/aasdk/Transport/USBTransport.hpp>
#include <f1x/aasdk/Transport/TCPTransport.hpp>
#include <f1x/aasdk/Messenger/Cryptor.hpp>
#include <f1x/openauto/autoapp/Projection/AndroidAutoEntityFactory.hpp>
#include <f1x/openauto/autoapp/Projection/AndroidAutoEntity.hpp>
@ -49,6 +50,17 @@ IAndroidAutoEntity::Pointer AndroidAutoEntityFactory::create(aasdk::usb::DeviceH
auto aoapDevice(aasdk::usb::AOAPDevice::create(usbWrapper_, ioService_, deviceHandle));
auto transport(std::make_shared<aasdk::transport::USBTransport>(ioService_, aoapDevice));
return create(std::move(transport));
}
IAndroidAutoEntity::Pointer AndroidAutoEntityFactory::create(aasdk::tcp::ITCPEndpoint::Pointer tcpEndpoint)
{
auto transport(std::make_shared<aasdk::transport::TCPTransport>(ioService_, std::move(tcpEndpoint)));
return create(std::move(transport));
}
IAndroidAutoEntity::Pointer AndroidAutoEntityFactory::create(aasdk::transport::ITransport::Pointer transport)
{
auto sslWrapper(std::make_shared<aasdk::transport::SSLWrapper>());
auto cryptor(std::make_shared<aasdk::messenger::Cryptor>(std::move(sslWrapper)));