diff --git a/include/openauto/Service/InputService.hpp b/include/openauto/Service/InputService.hpp index 1240bed..893d2fb 100644 --- a/include/openauto/Service/InputService.hpp +++ b/include/openauto/Service/InputService.hpp @@ -38,7 +38,7 @@ class InputService: public: InputService(boost::asio::io_service& ioService, aasdk::messenger::IMessenger::Pointer messenger, projection::IInputDevice::Pointer inputDevice); - void sendButtonPress(aasdk::proto::enums::ButtonCode::Enum buttonCode); + void sendButtonPress(aasdk::proto::enums::ButtonCode::Enum buttonCode, projection::WheelDirection wheelDirection = projection::WheelDirection::NONE); void start() override; void stop() override; void fillFeatures(aasdk::proto::messages::ServiceDiscoveryResponse& response) override; diff --git a/include/openauto/Service/ServiceFactory.hpp b/include/openauto/Service/ServiceFactory.hpp index 5567099..8eef8e8 100644 --- a/include/openauto/Service/ServiceFactory.hpp +++ b/include/openauto/Service/ServiceFactory.hpp @@ -41,7 +41,7 @@ public: void setOpacity(unsigned int alpha); void resize(); void setNightMode(bool nightMode); - void sendButtonPress(aasdk::proto::enums::ButtonCode::Enum buttonCode); + void sendButtonPress(aasdk::proto::enums::ButtonCode::Enum buttonCode, projection::WheelDirection wheelDirection = projection::WheelDirection::NONE); void sendKeyEvent(QKeyEvent* event); static QRect mapActiveAreaToGlobal(QWidget* activeArea); #ifdef USE_OMX diff --git a/openauto/Service/InputService.cpp b/openauto/Service/InputService.cpp index 863ed35..db2982f 100644 --- a/openauto/Service/InputService.cpp +++ b/openauto/Service/InputService.cpp @@ -163,12 +163,19 @@ void InputService::onButtonEvent(const projection::ButtonEvent& event) }); } -void InputService::sendButtonPress(aasdk::proto::enums::ButtonCode::Enum buttonCode) +void InputService::sendButtonPress(aasdk::proto::enums::ButtonCode::Enum buttonCode, projection::WheelDirection wheelDirection) { - OPENAUTO_LOG(error) << "[InputService] injecting button press"; + OPENAUTO_LOG(info) << "[InputService] injecting button press"; + if(buttonCode == aasdk::proto::enums::ButtonCode::SCROLL_WHEEL) + { + onButtonEvent({projection::ButtonEventType::NONE, wheelDirection, buttonCode}); - onButtonEvent({projection::ButtonEventType::PRESS, projection::WheelDirection::NONE, buttonCode}); - onButtonEvent({projection::ButtonEventType::RELEASE, projection::WheelDirection::NONE, buttonCode}); + } + else + { + onButtonEvent({projection::ButtonEventType::PRESS, projection::WheelDirection::NONE, buttonCode}); + onButtonEvent({projection::ButtonEventType::RELEASE, projection::WheelDirection::NONE, buttonCode}); + } } void InputService::onTouchEvent(const projection::TouchEvent& event) diff --git a/openauto/Service/ServiceFactory.cpp b/openauto/Service/ServiceFactory.cpp index bc980a1..afad991 100644 --- a/openauto/Service/ServiceFactory.cpp +++ b/openauto/Service/ServiceFactory.cpp @@ -228,12 +228,12 @@ void ServiceFactory::setNightMode(bool nightMode) } } -void ServiceFactory::sendButtonPress(aasdk::proto::enums::ButtonCode::Enum buttonCode) +void ServiceFactory::sendButtonPress(aasdk::proto::enums::ButtonCode::Enum buttonCode, projection::WheelDirection wheelDirection) { if(std::shared_ptr inputService = inputService_.lock()) { - inputService->sendButtonPress(buttonCode); + inputService->sendButtonPress(buttonCode, wheelDirection); } }