Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/development'
Browse files Browse the repository at this point in the history
  • Loading branch information
f1xpl committed Apr 7, 2018
2 parents 26826ae + f908f91 commit bfaf8e1
Show file tree
Hide file tree
Showing 35 changed files with 403 additions and 192 deletions.
13 changes: 6 additions & 7 deletions include/f1x/openauto/autoapp/App.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#include <f1x/aasdk/USB/USBWrapper.hpp>
#include <f1x/aasdk/TCP/ITCPWrapper.hpp>
#include <f1x/aasdk/TCP/ITCPEndpoint.hpp>
#include <f1x/openauto/autoapp/Projection/IAndroidAutoEntityEventHandler.hpp>
#include <f1x/openauto/autoapp/Projection/IAndroidAutoEntityFactory.hpp>
#include <f1x/openauto/autoapp/Service/IAndroidAutoEntityEventHandler.hpp>
#include <f1x/openauto/autoapp/Service/IAndroidAutoEntityFactory.hpp>

namespace f1x
{
Expand All @@ -33,12 +33,12 @@ namespace openauto
namespace autoapp
{

class App: public projection::IAndroidAutoEntityEventHandler, public std::enable_shared_from_this<App>
class App: public service::IAndroidAutoEntityEventHandler, public std::enable_shared_from_this<App>
{
public:
typedef std::shared_ptr<App> Pointer;

App(boost::asio::io_service& ioService, aasdk::usb::USBWrapper& usbWrapper, aasdk::tcp::ITCPWrapper& tcpWrapper, projection::IAndroidAutoEntityFactory& androidAutoEntityFactory,
App(boost::asio::io_service& ioService, aasdk::usb::USBWrapper& usbWrapper, aasdk::tcp::ITCPWrapper& tcpWrapper, service::IAndroidAutoEntityFactory& androidAutoEntityFactory,
aasdk::usb::IUSBHub::Pointer usbHub, aasdk::usb::IConnectedAccessoriesEnumerator::Pointer connectedAccessoriesEnumerator);

void waitForUSBDevice();
Expand All @@ -48,7 +48,6 @@ class App: public projection::IAndroidAutoEntityEventHandler, public std::enable

private:
using std::enable_shared_from_this<App>::shared_from_this;

void enumerateDevices();
void waitForDevice();
void aoapDeviceHandler(aasdk::usb::DeviceHandle deviceHandle);
Expand All @@ -58,10 +57,10 @@ class App: public projection::IAndroidAutoEntityEventHandler, public std::enable
aasdk::usb::USBWrapper& usbWrapper_;
aasdk::tcp::ITCPWrapper& tcpWrapper_;
boost::asio::io_service::strand strand_;
projection::IAndroidAutoEntityFactory& androidAutoEntityFactory_;
service::IAndroidAutoEntityFactory& androidAutoEntityFactory_;
aasdk::usb::IUSBHub::Pointer usbHub_;
aasdk::usb::IConnectedAccessoriesEnumerator::Pointer connectedAccessoriesEnumerator_;
projection::IAndroidAutoEntity::Pointer androidAutoEntity_;
service::IAndroidAutoEntity::Pointer androidAutoEntity_;
bool isStopped_;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,21 @@

#include <boost/asio.hpp>
#include <f1x/aasdk/Transport/ITransport.hpp>
#include <f1x/aasdk/Channel/Control/ControlServiceChannel.hpp>
#include <f1x/aasdk/Channel/Control/IControlServiceChannel.hpp>
#include <f1x/aasdk/Channel/Control/IControlServiceChannelEventHandler.hpp>
#include <f1x/aasdk/Channel/AV/VideoServiceChannel.hpp>
#include <f1x/openauto/autoapp/Configuration/IConfiguration.hpp>
#include <f1x/openauto/autoapp/Projection/IAndroidAutoEntity.hpp>
#include <f1x/openauto/autoapp/Projection/IServiceFactory.hpp>
#include <f1x/openauto/autoapp/Service/IAndroidAutoEntity.hpp>
#include <f1x/openauto/autoapp/Service/IService.hpp>
#include <f1x/openauto/autoapp/Service/IPinger.hpp>

namespace f1x
{
namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{

class AndroidAutoEntity: public IAndroidAutoEntity, public aasdk::channel::control::IControlServiceChannelEventHandler, public std::enable_shared_from_this<AndroidAutoEntity>
Expand All @@ -42,8 +43,10 @@ class AndroidAutoEntity: public IAndroidAutoEntity, public aasdk::channel::contr
AndroidAutoEntity(boost::asio::io_service& ioService,
aasdk::messenger::ICryptor::Pointer cryptor,
aasdk::transport::ITransport::Pointer transport,
aasdk::messenger::IMessenger::Pointer messenger,
configuration::IConfiguration::Pointer configuration,
IServiceFactory& serviceFactory);
ServiceList serviceList,
IPinger::Pointer pinger);
~AndroidAutoEntity() override;

void start(IAndroidAutoEntityEventHandler& eventHandler) override;
Expand All @@ -55,20 +58,23 @@ class AndroidAutoEntity: public IAndroidAutoEntity, public aasdk::channel::contr
void onShutdownRequest(const aasdk::proto::messages::ShutdownRequest& request) override;
void onShutdownResponse(const aasdk::proto::messages::ShutdownResponse& response) override;
void onNavigationFocusRequest(const aasdk::proto::messages::NavigationFocusRequest& request) override;
void onPingResponse(const aasdk::proto::messages::PingResponse& response) override;
void onChannelError(const aasdk::error::Error& e) override;

private:
using std::enable_shared_from_this<AndroidAutoEntity>::shared_from_this;
void triggerQuit();
void schedulePing();
void sendPing();

boost::asio::io_service::strand strand_;
aasdk::messenger::ICryptor::Pointer cryptor_;
aasdk::transport::ITransport::Pointer transport_;
configuration::IConfiguration::Pointer configuration_;
IServiceFactory& serviceFactory_;
aasdk::messenger::IMessenger::Pointer messenger_;
aasdk::channel::control::ControlServiceChannel::Pointer controlServiceChannel_;
aasdk::channel::control::IControlServiceChannel::Pointer controlServiceChannel_;
configuration::IConfiguration::Pointer configuration_;
ServiceList serviceList_;
IPinger::Pointer pinger_;
IAndroidAutoEntityEventHandler* eventHandler_;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
#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>
#include <f1x/openauto/autoapp/Service/IAndroidAutoEntityFactory.hpp>
#include <f1x/openauto/autoapp/Service/IServiceFactory.hpp>

namespace f1x
{
namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{

class AndroidAutoEntityFactory: public IAndroidAutoEntityFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#pragma once

#include <f1x/aasdk/Channel/AV/AVInputServiceChannel.hpp>
#include <f1x/openauto/autoapp/Projection/IService.hpp>
#include <f1x/openauto/autoapp/Service/IService.hpp>
#include <f1x/openauto/autoapp/Projection/IAudioInput.hpp>

namespace f1x
Expand All @@ -28,15 +28,15 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{

class AudioInputService: public aasdk::channel::av::IAVInputServiceChannelEventHandler, public IService, public std::enable_shared_from_this<AudioInputService>
{
public:
typedef std::shared_ptr<AudioInputService> Pointer;

AudioInputService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, IAudioInput::Pointer audioInput);
AudioInputService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IAudioInput::Pointer audioInput);

void start() override;
void stop() override;
Expand All @@ -55,7 +55,7 @@ class AudioInputService: public aasdk::channel::av::IAVInputServiceChannelEventH

boost::asio::io_service::strand strand_;
aasdk::channel::av::AVInputServiceChannel::Pointer channel_;
IAudioInput::Pointer audioInput_;
projection::IAudioInput::Pointer audioInput_;
int32_t session_;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@
#include <f1x/aasdk/Channel/AV/IAudioServiceChannel.hpp>
#include <f1x/aasdk/Channel/AV/IAudioServiceChannelEventHandler.hpp>
#include <f1x/openauto/autoapp/Projection/IAudioOutput.hpp>
#include <f1x/openauto/autoapp/Projection/IService.hpp>
#include <f1x/openauto/autoapp/Service/IService.hpp>

namespace f1x
{
namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{

class AudioService: public aasdk::channel::av::IAudioServiceChannelEventHandler, public IService, public std::enable_shared_from_this<AudioService>
{
public:
typedef std::shared_ptr<AudioService> Pointer;

AudioService(boost::asio::io_service& ioService, aasdk::channel::av::IAudioServiceChannel::Pointer channel, IAudioOutput::Pointer audioOutput);
AudioService(boost::asio::io_service& ioService, aasdk::channel::av::IAudioServiceChannel::Pointer channel, projection::IAudioOutput::Pointer audioOutput);

void start() override;
void stop() override;
Expand All @@ -55,7 +55,7 @@ class AudioService: public aasdk::channel::av::IAudioServiceChannelEventHandler,

boost::asio::io_service::strand strand_;
aasdk::channel::av::IAudioServiceChannel::Pointer channel_;
IAudioOutput::Pointer audioOutput_;
projection::IAudioOutput::Pointer audioOutput_;
int32_t session_;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@

#include <f1x/aasdk/Channel/Bluetooth/BluetoothServiceChannel.hpp>
#include <f1x/openauto/autoapp/Projection/IBluetoothDevice.hpp>
#include <f1x/openauto/autoapp/Projection/IService.hpp>
#include <f1x/openauto/autoapp/Service/IService.hpp>

namespace f1x
{
namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{

class BluetoothService: public aasdk::channel::bluetooth::IBluetoothServiceChannelEventHandler, public IService, public std::enable_shared_from_this<BluetoothService>
{
public:
BluetoothService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, IBluetoothDevice::Pointer bluetoothDevice);
BluetoothService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IBluetoothDevice::Pointer bluetoothDevice);
void start() override;
void stop() override;
void fillFeatures(aasdk::proto::messages::ServiceDiscoveryResponse& response) override;
Expand All @@ -47,7 +47,7 @@ class BluetoothService: public aasdk::channel::bluetooth::IBluetoothServiceChann

boost::asio::io_service::strand strand_;
aasdk::channel::bluetooth::BluetoothServiceChannel::Pointer channel_;
IBluetoothDevice::Pointer bluetoothDevice_;
projection::IBluetoothDevice::Pointer bluetoothDevice_;
};

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
#pragma once

#include <memory>
#include <f1x/openauto/autoapp/Projection/IAndroidAutoEntityEventHandler.hpp>
#include <f1x/openauto/autoapp/Service/IAndroidAutoEntityEventHandler.hpp>

namespace f1x
{
namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{

class IAndroidAutoEntity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{

class IAndroidAutoEntityEventHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@

#include <f1x/aasdk/TCP/ITCPEndpoint.hpp>
#include <f1x/aasdk/USB/IAOAPDevice.hpp>
#include <f1x/openauto/autoapp/Projection/IAndroidAutoEntity.hpp>
#include <f1x/openauto/autoapp/Service/IAndroidAutoEntity.hpp>

namespace f1x
{
namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{

class IAndroidAutoEntityFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,20 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{

typedef aasdk::io::Promise<void> ServiceFinishPromise;
class IPinger
{
public:
typedef std::shared_ptr<IPinger> Pointer;
typedef aasdk::io::Promise<void> Promise;

virtual ~IPinger() = default;
virtual void ping(Promise::Pointer promise) = 0;
virtual void pong() = 0;
virtual void cancel() = 0;
};

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{

class IService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
#pragma once

#include <f1x/aasdk/Messenger/IMessenger.hpp>
#include <f1x/openauto/autoapp/Projection/IService.hpp>
#include <f1x/openauto/autoapp/Service/IService.hpp>

namespace f1x
{
namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{

class IServiceFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include <aasdk_proto/ButtonCodeEnum.pb.h>
#include <f1x/aasdk/Channel/Input/InputServiceChannel.hpp>
#include <f1x/openauto/autoapp/Projection/IService.hpp>
#include <f1x/openauto/autoapp/Service/IService.hpp>
#include <f1x/openauto/autoapp/Projection/IInputDevice.hpp>
#include <f1x/openauto/autoapp/Projection/IInputDeviceEventHandler.hpp>

Expand All @@ -30,33 +30,33 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{

class InputService:
public aasdk::channel::input::IInputServiceChannelEventHandler,
public IService,
public IInputDeviceEventHandler,
public projection::IInputDeviceEventHandler,
public std::enable_shared_from_this<InputService>
{
public:
InputService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, IInputDevice::Pointer inputDevice);
InputService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IInputDevice::Pointer inputDevice);

void start() override;
void stop() override;
void fillFeatures(aasdk::proto::messages::ServiceDiscoveryResponse& response) override;
void onChannelOpenRequest(const aasdk::proto::messages::ChannelOpenRequest& request) override;
void onBindingRequest(const aasdk::proto::messages::BindingRequest& request) override;
void onChannelError(const aasdk::error::Error& e) override;
void onButtonEvent(const ButtonEvent& event) override;
void onTouchEvent(const TouchEvent& event) override;
void onButtonEvent(const projection::ButtonEvent& event) override;
void onTouchEvent(const projection::TouchEvent& event) override;

private:
using std::enable_shared_from_this<InputService>::shared_from_this;

boost::asio::io_service::strand strand_;
aasdk::channel::input::InputServiceChannel::Pointer channel_;
IInputDevice::Pointer inputDevice_;
projection::IInputDevice::Pointer inputDevice_;
};

}
Expand Down
Loading

0 comments on commit bfaf8e1

Please sign in to comment.