Create service package

pull/63/head
michal.szwaj 2018-04-07 00:38:43 +02:00
parent 675e6cfcf6
commit 478caf0767
36 changed files with 129 additions and 167 deletions

View File

@ -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
{
@ -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();
@ -57,10 +57,10 @@ private:
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_;
};

View File

@ -1,37 +0,0 @@
/*
* This file is part of openauto project.
* Copyright (C) 2018 f1x.studio (Michal Szwaj)
*
* openauto is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
* openauto is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with openauto. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <f1x/aasdk/IO/Promise.hpp>
namespace f1x
{
namespace openauto
{
namespace autoapp
{
namespace projection
{
typedef aasdk::io::Promise<void> ServiceFinishPromise;
}
}
}
}

View File

@ -24,9 +24,9 @@
#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/IService.hpp>
#include <f1x/openauto/autoapp/Projection/IPinger.hpp>
#include <f1x/openauto/autoapp/Service/IAndroidAutoEntity.hpp>
#include <f1x/openauto/autoapp/Service/IService.hpp>
#include <f1x/openauto/autoapp/Service/IPinger.hpp>
namespace f1x
{
@ -34,7 +34,7 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
class AndroidAutoEntity: public IAndroidAutoEntity, public aasdk::channel::control::IControlServiceChannelEventHandler, public std::enable_shared_from_this<AndroidAutoEntity>

View File

@ -21,8 +21,8 @@
#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
{
@ -30,7 +30,7 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
class AndroidAutoEntityFactory: public IAndroidAutoEntityFactory

View File

@ -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
@ -28,7 +28,7 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
class AudioInputService: public aasdk::channel::av::IAVInputServiceChannelEventHandler, public IService, public std::enable_shared_from_this<AudioInputService>
@ -36,7 +36,7 @@ class AudioInputService: public aasdk::channel::av::IAVInputServiceChannelEventH
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;
@ -55,7 +55,7 @@ private:
boost::asio::io_service::strand strand_;
aasdk::channel::av::AVInputServiceChannel::Pointer channel_;
IAudioInput::Pointer audioInput_;
projection::IAudioInput::Pointer audioInput_;
int32_t session_;
};

View File

@ -21,7 +21,7 @@
#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
{
@ -29,7 +29,7 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
class AudioService: public aasdk::channel::av::IAudioServiceChannelEventHandler, public IService, public std::enable_shared_from_this<AudioService>
@ -37,7 +37,7 @@ class AudioService: public aasdk::channel::av::IAudioServiceChannelEventHandler,
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;
@ -55,7 +55,7 @@ protected:
boost::asio::io_service::strand strand_;
aasdk::channel::av::IAudioServiceChannel::Pointer channel_;
IAudioOutput::Pointer audioOutput_;
projection::IAudioOutput::Pointer audioOutput_;
int32_t session_;
};

View File

@ -20,7 +20,7 @@
#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
{
@ -28,13 +28,13 @@ 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;
@ -47,7 +47,7 @@ private:
boost::asio::io_service::strand strand_;
aasdk::channel::bluetooth::BluetoothServiceChannel::Pointer channel_;
IBluetoothDevice::Pointer bluetoothDevice_;
projection::IBluetoothDevice::Pointer bluetoothDevice_;
};
}

View File

@ -19,7 +19,7 @@
#pragma once
#include <memory>
#include <f1x/openauto/autoapp/Projection/IAndroidAutoEntityEventHandler.hpp>
#include <f1x/openauto/autoapp/Service/IAndroidAutoEntityEventHandler.hpp>
namespace f1x
{
@ -27,7 +27,7 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
class IAndroidAutoEntity

View File

@ -26,7 +26,7 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
class IAndroidAutoEntityEventHandler

View File

@ -20,7 +20,7 @@
#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
{
@ -28,7 +28,7 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
class IAndroidAutoEntityFactory

View File

@ -26,7 +26,7 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
class IPinger

View File

@ -28,7 +28,7 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
class IService

View File

@ -19,7 +19,7 @@
#pragma once
#include <f1x/aasdk/Messenger/IMessenger.hpp>
#include <f1x/openauto/autoapp/Projection/IService.hpp>
#include <f1x/openauto/autoapp/Service/IService.hpp>
namespace f1x
{
@ -27,7 +27,7 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
class IServiceFactory

View File

@ -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>
@ -30,17 +30,17 @@ 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;
@ -48,15 +48,15 @@ public:
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_;
};
}

View File

@ -19,7 +19,7 @@
#pragma once
#include <f1x/aasdk/Messenger/IMessenger.hpp>
#include <f1x/openauto/autoapp/Projection/AudioService.hpp>
#include <f1x/openauto/autoapp/Service/AudioService.hpp>
namespace f1x
{
@ -27,13 +27,13 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
class MediaAudioService: public AudioService
{
public:
MediaAudioService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, IAudioOutput::Pointer audioOutput);
MediaAudioService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IAudioOutput::Pointer audioOutput);
};
}

View File

@ -18,7 +18,7 @@
#pragma once
#include <f1x/openauto/autoapp/Projection/IPinger.hpp>
#include <f1x/openauto/autoapp/Service/IPinger.hpp>
namespace f1x
{
@ -26,7 +26,7 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
class Pinger: public IPinger, public std::enable_shared_from_this<Pinger>

View File

@ -19,7 +19,7 @@
#pragma once
#include <f1x/aasdk/Channel/Sensor/SensorServiceChannel.hpp>
#include <f1x/openauto/autoapp/Projection/IService.hpp>
#include <f1x/openauto/autoapp/Service/IService.hpp>
namespace f1x
{
@ -27,7 +27,7 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
class SensorService: public aasdk::channel::sensor::ISensorServiceChannelEventHandler, public IService, public std::enable_shared_from_this<SensorService>

View File

@ -18,7 +18,7 @@
#pragma once
#include <f1x/openauto/autoapp/Projection/IServiceFactory.hpp>
#include <f1x/openauto/autoapp/Service/IServiceFactory.hpp>
#include <f1x/openauto/autoapp/Configuration/IConfiguration.hpp>
namespace f1x
@ -27,7 +27,7 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
class ServiceFactory: public IServiceFactory

View File

@ -19,7 +19,7 @@
#pragma once
#include <f1x/aasdk/Messenger/IMessenger.hpp>
#include <f1x/openauto/autoapp/Projection/AudioService.hpp>
#include <f1x/openauto/autoapp/Service/AudioService.hpp>
namespace f1x
{
@ -27,13 +27,13 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
class SpeechAudioService: public AudioService
{
public:
SpeechAudioService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, IAudioOutput::Pointer audioOutput);
SpeechAudioService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IAudioOutput::Pointer audioOutput);
};
}

View File

@ -19,7 +19,7 @@
#pragma once
#include <f1x/aasdk/Messenger/IMessenger.hpp>
#include <f1x/openauto/autoapp/Projection/AudioService.hpp>
#include <f1x/openauto/autoapp/Service/AudioService.hpp>
namespace f1x
{
@ -27,13 +27,13 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
class SystemAudioService: public AudioService
{
public:
SystemAudioService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, IAudioOutput::Pointer audioOutput);
SystemAudioService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IAudioOutput::Pointer audioOutput);
};
}

View File

@ -21,9 +21,8 @@
#include <memory>
#include <f1x/aasdk/Channel/AV/VideoServiceChannel.hpp>
#include <f1x/aasdk/Channel/AV/IVideoServiceChannelEventHandler.hpp>
#include <f1x/openauto/autoapp/Projection/ServiceFinishPromise.hpp>
#include <f1x/openauto/autoapp/Projection/IVideoOutput.hpp>
#include <f1x/openauto/autoapp/Projection/IService.hpp>
#include <f1x/openauto/autoapp/Service/IService.hpp>
namespace f1x
{
@ -31,7 +30,7 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
class VideoService: public aasdk::channel::av::IVideoServiceChannelEventHandler, public IService, public std::enable_shared_from_this<VideoService>
@ -39,7 +38,7 @@ class VideoService: public aasdk::channel::av::IVideoServiceChannelEventHandler,
public:
typedef std::shared_ptr<VideoService> Pointer;
VideoService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, IVideoOutput::Pointer videoOutput);
VideoService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IVideoOutput::Pointer videoOutput);
void start() override;
void stop() override;
@ -58,7 +57,7 @@ private:
boost::asio::io_service::strand strand_;
aasdk::channel::av::VideoServiceChannel::Pointer channel_;
IVideoOutput::Pointer videoOutput_;
projection::IVideoOutput::Pointer videoOutput_;
int32_t session_;
};

View File

@ -29,7 +29,7 @@ namespace openauto
namespace autoapp
{
App::App(boost::asio::io_service& ioService, aasdk::usb::USBWrapper& usbWrapper, aasdk::tcp::ITCPWrapper& tcpWrapper, projection::IAndroidAutoEntityFactory& androidAutoEntityFactory,
App::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)
: ioService_(ioService)
, usbWrapper_(usbWrapper)

View File

@ -17,7 +17,7 @@
*/
#include <f1x/aasdk/Channel/Control/ControlServiceChannel.hpp>
#include <f1x/openauto/autoapp/Projection/AndroidAutoEntity.hpp>
#include <f1x/openauto/autoapp/Service/AndroidAutoEntity.hpp>
#include <f1x/openauto/Common/Log.hpp>
namespace f1x
@ -26,7 +26,7 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
AndroidAutoEntity::AndroidAutoEntity(boost::asio::io_service& ioService,

View File

@ -24,9 +24,9 @@
#include <f1x/aasdk/Messenger/MessageInStream.hpp>
#include <f1x/aasdk/Messenger/MessageOutStream.hpp>
#include <f1x/aasdk/Messenger/Messenger.hpp>
#include <f1x/openauto/autoapp/Projection/AndroidAutoEntityFactory.hpp>
#include <f1x/openauto/autoapp/Projection/AndroidAutoEntity.hpp>
#include <f1x/openauto/autoapp/Projection/Pinger.hpp>
#include <f1x/openauto/autoapp/Service/AndroidAutoEntityFactory.hpp>
#include <f1x/openauto/autoapp/Service/AndroidAutoEntity.hpp>
#include <f1x/openauto/autoapp/Service/Pinger.hpp>
namespace f1x
{
@ -34,7 +34,7 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
AndroidAutoEntityFactory::AndroidAutoEntityFactory(boost::asio::io_service& ioService,

View File

@ -18,7 +18,7 @@
#include <time.h>
#include <f1x/openauto/Common/Log.hpp>
#include <f1x/openauto/autoapp/Projection/AudioInputService.hpp>
#include <f1x/openauto/autoapp/Service/AudioInputService.hpp>
namespace f1x
{
@ -26,10 +26,10 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
AudioInputService::AudioInputService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, IAudioInput::Pointer audioInput)
AudioInputService::AudioInputService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IAudioInput::Pointer audioInput)
: strand_(ioService)
, channel_(std::make_shared<aasdk::channel::av::AVInputServiceChannel>(strand_, std::move(messenger)))
, audioInput_(std::move(audioInput))
@ -114,7 +114,7 @@ void AudioInputService::onAVInputOpenRequest(const aasdk::proto::messages::AVInp
if(request.open())
{
auto startPromise = IAudioInput::StartPromise::defer(strand_);
auto startPromise = projection::IAudioInput::StartPromise::defer(strand_);
startPromise->then(std::bind(&AudioInputService::onAudioInputOpenSucceed, this->shared_from_this()),
[this, self = this->shared_from_this()]() {
OPENAUTO_LOG(error) << "[AudioInputService] audio input open failed.";
@ -185,7 +185,7 @@ void AudioInputService::readAudioInput()
{
if(audioInput_->isActive())
{
auto readPromise = IAudioInput::ReadPromise::defer(strand_);
auto readPromise = projection::IAudioInput::ReadPromise::defer(strand_);
readPromise->then(std::bind(&AudioInputService::onAudioInputDataReady, this->shared_from_this(), std::placeholders::_1),
[this, self = this->shared_from_this()]() {
OPENAUTO_LOG(info) << "[AudioInputService] audio input read rejected.";

View File

@ -17,7 +17,7 @@
*/
#include <f1x/openauto/Common/Log.hpp>
#include <f1x/openauto/autoapp/Projection/AudioService.hpp>
#include <f1x/openauto/autoapp/Service/AudioService.hpp>
namespace f1x
{
@ -25,10 +25,10 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
AudioService::AudioService(boost::asio::io_service& ioService, aasdk::channel::av::IAudioServiceChannel::Pointer channel, IAudioOutput::Pointer audioOutput)
AudioService::AudioService(boost::asio::io_service& ioService, aasdk::channel::av::IAudioServiceChannel::Pointer channel, projection::IAudioOutput::Pointer audioOutput)
: strand_(ioService)
, channel_(std::move(channel))
, audioOutput_(std::move(audioOutput))

View File

@ -17,7 +17,7 @@
*/
#include <f1x/openauto/Common/Log.hpp>
#include <f1x/openauto/autoapp/Projection/BluetoothService.hpp>
#include <f1x/openauto/autoapp/Service/BluetoothService.hpp>
namespace f1x
{
@ -25,10 +25,10 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
BluetoothService::BluetoothService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, IBluetoothDevice::Pointer bluetoothDevice)
BluetoothService::BluetoothService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IBluetoothDevice::Pointer bluetoothDevice)
: strand_(ioService)
, channel_(std::make_shared<aasdk::channel::bluetooth::BluetoothServiceChannel>(strand_, std::move(messenger)))
, bluetoothDevice_(std::move(bluetoothDevice))

View File

@ -18,7 +18,7 @@
#include <aasdk_proto/InputEventIndicationMessage.pb.h>
#include <f1x/openauto/Common/Log.hpp>
#include <f1x/openauto/autoapp/Projection/InputService.hpp>
#include <f1x/openauto/autoapp/Service/InputService.hpp>
namespace f1x
{
@ -26,10 +26,10 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
InputService::InputService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, IInputDevice::Pointer inputDevice)
InputService::InputService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IInputDevice::Pointer inputDevice)
: strand_(ioService)
, channel_(std::make_shared<aasdk::channel::input::InputServiceChannel>(strand_, std::move(messenger)))
, inputDevice_(std::move(inputDevice))
@ -135,7 +135,7 @@ void InputService::onChannelError(const aasdk::error::Error& e)
OPENAUTO_LOG(error) << "[SensorService] channel error: " << e.what();
}
void InputService::onButtonEvent(const ButtonEvent& event)
void InputService::onButtonEvent(const projection::ButtonEvent& event)
{
auto timestamp = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now().time_since_epoch());
@ -146,14 +146,14 @@ void InputService::onButtonEvent(const ButtonEvent& event)
if(event.code == aasdk::proto::enums::ButtonCode::SCROLL_WHEEL)
{
auto relativeEvent = inputEventIndication.mutable_relative_input_event()->add_relative_input_events();
relativeEvent->set_delta(event.wheelDirection == WheelDirection::LEFT ? -1 : 1);
relativeEvent->set_delta(event.wheelDirection == projection::WheelDirection::LEFT ? -1 : 1);
relativeEvent->set_scan_code(event.code);
}
else
{
auto buttonEvent = inputEventIndication.mutable_button_event()->add_button_events();
buttonEvent->set_meta(0);
buttonEvent->set_is_pressed(event.type == ButtonEventType::PRESS);
buttonEvent->set_is_pressed(event.type == projection::ButtonEventType::PRESS);
buttonEvent->set_long_press(false);
buttonEvent->set_scan_code(event.code);
}
@ -164,7 +164,7 @@ void InputService::onButtonEvent(const ButtonEvent& event)
});
}
void InputService::onTouchEvent(const TouchEvent& event)
void InputService::onTouchEvent(const projection::TouchEvent& event)
{
auto timestamp = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now().time_since_epoch());

View File

@ -17,7 +17,7 @@
*/
#include <f1x/aasdk/Channel/AV/MediaAudioServiceChannel.hpp>
#include <f1x/openauto/autoapp/Projection/MediaAudioService.hpp>
#include <f1x/openauto/autoapp/Service/MediaAudioService.hpp>
namespace f1x
{
@ -25,10 +25,10 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
MediaAudioService::MediaAudioService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, IAudioOutput::Pointer audioOutput)
MediaAudioService::MediaAudioService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IAudioOutput::Pointer audioOutput)
: AudioService(ioService, std::make_shared<aasdk::channel::av::MediaAudioServiceChannel>(strand_, std::move(messenger)), std::move(audioOutput))
{

View File

@ -16,7 +16,7 @@
* along with openauto. If not, see <http://www.gnu.org/licenses/>.
*/
#include <f1x/openauto/autoapp/Projection/Pinger.hpp>
#include <f1x/openauto/autoapp/Service/Pinger.hpp>
namespace f1x
{
@ -24,7 +24,7 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
Pinger::Pinger(boost::asio::io_service& ioService, time_t duration)

View File

@ -18,7 +18,7 @@
#include <aasdk_proto/DrivingStatusEnum.pb.h>
#include <f1x/openauto/Common/Log.hpp>
#include <f1x/openauto/autoapp/Projection/SensorService.hpp>
#include <f1x/openauto/autoapp/Service/SensorService.hpp>
namespace f1x
{
@ -26,7 +26,7 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
SensorService::SensorService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger)

View File

@ -21,15 +21,15 @@
#include <f1x/aasdk/Channel/AV/MediaAudioServiceChannel.hpp>
#include <f1x/aasdk/Channel/AV/SystemAudioServiceChannel.hpp>
#include <f1x/aasdk/Channel/AV/SpeechAudioServiceChannel.hpp>
#include <f1x/openauto/autoapp/Projection/ServiceFactory.hpp>
#include <f1x/openauto/autoapp/Projection/VideoService.hpp>
#include <f1x/openauto/autoapp/Projection/MediaAudioService.hpp>
#include <f1x/openauto/autoapp/Projection/SpeechAudioService.hpp>
#include <f1x/openauto/autoapp/Projection/SystemAudioService.hpp>
#include <f1x/openauto/autoapp/Projection/AudioInputService.hpp>
#include <f1x/openauto/autoapp/Projection/SensorService.hpp>
#include <f1x/openauto/autoapp/Projection/BluetoothService.hpp>
#include <f1x/openauto/autoapp/Projection/InputService.hpp>
#include <f1x/openauto/autoapp/Service/ServiceFactory.hpp>
#include <f1x/openauto/autoapp/Service/VideoService.hpp>
#include <f1x/openauto/autoapp/Service/MediaAudioService.hpp>
#include <f1x/openauto/autoapp/Service/SpeechAudioService.hpp>
#include <f1x/openauto/autoapp/Service/SystemAudioService.hpp>
#include <f1x/openauto/autoapp/Service/AudioInputService.hpp>
#include <f1x/openauto/autoapp/Service/SensorService.hpp>
#include <f1x/openauto/autoapp/Service/BluetoothService.hpp>
#include <f1x/openauto/autoapp/Service/InputService.hpp>
#include <f1x/openauto/autoapp/Projection/QtVideoOutput.hpp>
#include <f1x/openauto/autoapp/Projection/OMXVideoOutput.hpp>
#include <f1x/openauto/autoapp/Projection/RtAudioOutput.hpp>
@ -46,7 +46,7 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
ServiceFactory::ServiceFactory(boost::asio::io_service& ioService, configuration::IConfiguration::Pointer configuration)
@ -60,7 +60,7 @@ ServiceList ServiceFactory::create(aasdk::messenger::IMessenger::Pointer messeng
{
ServiceList serviceList;
IAudioInput::Pointer audioInput(new QtAudioInput(1, 16, 16000), std::bind(&QObject::deleteLater, std::placeholders::_1));
projection::IAudioInput::Pointer audioInput(new projection::QtAudioInput(1, 16, 16000), std::bind(&QObject::deleteLater, std::placeholders::_1));
serviceList.emplace_back(std::make_shared<AudioInputService>(ioService_, messenger, std::move(audioInput)));
this->createAudioServices(serviceList, messenger);
serviceList.emplace_back(std::make_shared<SensorService>(ioService_, messenger));
@ -74,28 +74,28 @@ ServiceList ServiceFactory::create(aasdk::messenger::IMessenger::Pointer messeng
IService::Pointer ServiceFactory::createVideoService(aasdk::messenger::IMessenger::Pointer messenger)
{
#ifdef USE_OMX
IVideoOutput::Pointer videoOutput(std::make_shared<OMXVideoOutput>(configuration_));
auto videoOutput(std::make_shared<projection::OMXVideoOutput>(configuration_));
#else
IVideoOutput::Pointer videoOutput(new QtVideoOutput(configuration_), std::bind(&QObject::deleteLater, std::placeholders::_1));
projection::IVideoOutput::Pointer videoOutput(new projection::QtVideoOutput(configuration_), std::bind(&QObject::deleteLater, std::placeholders::_1));
#endif
return std::make_shared<VideoService>(ioService_, messenger, std::move(videoOutput));
}
IService::Pointer ServiceFactory::createBluetoothService(aasdk::messenger::IMessenger::Pointer messenger)
{
IBluetoothDevice::Pointer bluetoothDevice;
projection::IBluetoothDevice::Pointer bluetoothDevice;
switch(configuration_->getBluetoothAdapterType())
{
case configuration::BluetoothAdapterType::LOCAL:
bluetoothDevice = IBluetoothDevice::Pointer(new LocalBluetoothDevice(), std::bind(&QObject::deleteLater, std::placeholders::_1));
bluetoothDevice = projection::IBluetoothDevice::Pointer(new projection::LocalBluetoothDevice(), std::bind(&QObject::deleteLater, std::placeholders::_1));
break;
case configuration::BluetoothAdapterType::REMOTE:
bluetoothDevice = std::make_shared<RemoteBluetoothDevice>(configuration_->getBluetoothRemoteAdapterAddress());
bluetoothDevice = std::make_shared<projection::RemoteBluetoothDevice>(configuration_->getBluetoothRemoteAdapterAddress());
break;
default:
bluetoothDevice = std::make_shared<DummyBluetoothDevice>();
bluetoothDevice = std::make_shared<projection::DummyBluetoothDevice>();
break;
}
@ -122,7 +122,7 @@ IService::Pointer ServiceFactory::createInputService(aasdk::messenger::IMessenge
QScreen* screen = QGuiApplication::primaryScreen();
QRect screenGeometry = screen == nullptr ? QRect(0, 0, 1, 1) : screen->geometry();
IInputDevice::Pointer inputDevice(std::make_shared<InputDevice>(*QApplication::instance(), configuration_, std::move(screenGeometry), std::move(videoGeometry)));
projection::IInputDevice::Pointer inputDevice(std::make_shared<projection::InputDevice>(*QApplication::instance(), configuration_, std::move(screenGeometry), std::move(videoGeometry)));
return std::make_shared<InputService>(ioService_, messenger, std::move(inputDevice));
}
@ -132,8 +132,8 @@ void ServiceFactory::createAudioServices(ServiceList& serviceList, aasdk::messen
if(configuration_->musicAudioChannelEnabled())
{
auto mediaAudioOutput = configuration_->getAudioOutputBackendType() == configuration::AudioOutputBackendType::RTAUDIO ?
std::make_shared<RtAudioOutput>(2, 16, 48000) :
IAudioOutput::Pointer(new QtAudioOutput(2, 16, 48000), std::bind(&QObject::deleteLater, std::placeholders::_1));
std::make_shared<projection::RtAudioOutput>(2, 16, 48000) :
projection::IAudioOutput::Pointer(new projection::QtAudioOutput(2, 16, 48000), std::bind(&QObject::deleteLater, std::placeholders::_1));
serviceList.emplace_back(std::make_shared<MediaAudioService>(ioService_, messenger, std::move(mediaAudioOutput)));
}
@ -141,15 +141,15 @@ void ServiceFactory::createAudioServices(ServiceList& serviceList, aasdk::messen
if(configuration_->speechAudioChannelEnabled())
{
auto speechAudioOutput = configuration_->getAudioOutputBackendType() == configuration::AudioOutputBackendType::RTAUDIO ?
std::make_shared<RtAudioOutput>(1, 16, 16000) :
IAudioOutput::Pointer(new QtAudioOutput(1, 16, 16000), std::bind(&QObject::deleteLater, std::placeholders::_1));
std::make_shared<projection::RtAudioOutput>(1, 16, 16000) :
projection::IAudioOutput::Pointer(new projection::QtAudioOutput(1, 16, 16000), std::bind(&QObject::deleteLater, std::placeholders::_1));
serviceList.emplace_back(std::make_shared<SpeechAudioService>(ioService_, messenger, std::move(speechAudioOutput)));
}
auto systemAudioOutput = configuration_->getAudioOutputBackendType() == configuration::AudioOutputBackendType::RTAUDIO ?
std::make_shared<RtAudioOutput>(1, 16, 16000) :
IAudioOutput::Pointer(new QtAudioOutput(1, 16, 16000), std::bind(&QObject::deleteLater, std::placeholders::_1));
std::make_shared<projection::RtAudioOutput>(1, 16, 16000) :
projection::IAudioOutput::Pointer(new projection::QtAudioOutput(1, 16, 16000), std::bind(&QObject::deleteLater, std::placeholders::_1));
serviceList.emplace_back(std::make_shared<SystemAudioService>(ioService_, messenger, std::move(systemAudioOutput)));
}

View File

@ -17,7 +17,7 @@
*/
#include <f1x/aasdk/Channel/AV/SpeechAudioServiceChannel.hpp>
#include <f1x/openauto/autoapp/Projection/SpeechAudioService.hpp>
#include <f1x/openauto/autoapp/Service/SpeechAudioService.hpp>
namespace f1x
{
@ -25,10 +25,10 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
SpeechAudioService::SpeechAudioService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, IAudioOutput::Pointer audioOutput)
SpeechAudioService::SpeechAudioService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IAudioOutput::Pointer audioOutput)
: AudioService(ioService, std::make_shared<aasdk::channel::av::SpeechAudioServiceChannel>(strand_, std::move(messenger)), std::move(audioOutput))
{

View File

@ -17,7 +17,7 @@
*/
#include <f1x/aasdk/Channel/AV/SystemAudioServiceChannel.hpp>
#include <f1x/openauto/autoapp/Projection/SystemAudioService.hpp>
#include <f1x/openauto/autoapp/Service/SystemAudioService.hpp>
namespace f1x
{
@ -25,10 +25,10 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
SystemAudioService::SystemAudioService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, IAudioOutput::Pointer audioOutput)
SystemAudioService::SystemAudioService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IAudioOutput::Pointer audioOutput)
: AudioService(ioService, std::make_shared<aasdk::channel::av::SystemAudioServiceChannel>(strand_, std::move(messenger)), std::move(audioOutput))
{

View File

@ -17,7 +17,7 @@
*/
#include <f1x/openauto/Common/Log.hpp>
#include <f1x/openauto/autoapp/Projection/VideoService.hpp>
#include <f1x/openauto/autoapp/Service/VideoService.hpp>
namespace f1x
{
@ -25,10 +25,10 @@ namespace openauto
{
namespace autoapp
{
namespace projection
namespace service
{
VideoService::VideoService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, IVideoOutput::Pointer videoOutput)
VideoService::VideoService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IVideoOutput::Pointer videoOutput)
: strand_(ioService)
, channel_(std::make_shared<aasdk::channel::av::VideoServiceChannel>(strand_, std::move(messenger)))
, videoOutput_(std::move(videoOutput))

View File

@ -27,8 +27,8 @@
#include <f1x/openauto/autoapp/App.hpp>
#include <f1x/openauto/autoapp/Configuration/IConfiguration.hpp>
#include <f1x/openauto/autoapp/Configuration/RecentAddressesList.hpp>
#include <f1x/openauto/autoapp/Projection/AndroidAutoEntityFactory.hpp>
#include <f1x/openauto/autoapp/Projection/ServiceFactory.hpp>
#include <f1x/openauto/autoapp/Service/AndroidAutoEntityFactory.hpp>
#include <f1x/openauto/autoapp/Service/ServiceFactory.hpp>
#include <f1x/openauto/autoapp/Configuration/Configuration.hpp>
#include <f1x/openauto/autoapp/UI/MainWindow.hpp>
#include <f1x/openauto/autoapp/UI/SettingsWindow.hpp>
@ -113,8 +113,8 @@ int main(int argc, char* argv[])
aasdk::usb::USBWrapper usbWrapper(usbContext);
aasdk::usb::AccessoryModeQueryFactory queryFactory(usbWrapper, ioService);
aasdk::usb::AccessoryModeQueryChainFactory queryChainFactory(usbWrapper, ioService, queryFactory);
autoapp::projection::ServiceFactory serviceFactory(ioService, configuration);
autoapp::projection::AndroidAutoEntityFactory androidAutoEntityFactory(ioService, configuration, serviceFactory);
autoapp::service::ServiceFactory serviceFactory(ioService, configuration);
autoapp::service::AndroidAutoEntityFactory androidAutoEntityFactory(ioService, configuration, serviceFactory);
auto usbHub(std::make_shared<aasdk::usb::USBHub>(usbWrapper, ioService, queryChainFactory));
auto connectedAccessoriesEnumerator(std::make_shared<aasdk::usb::ConnectedAccessoriesEnumerator>(usbWrapper, ioService, queryChainFactory));