├── Dockerfile.rootfs ├── assets ├── black.png ├── back-hot.png ├── bug-hot.png ├── day-hot.png ├── eye-hot.png ├── home-hot.png ├── ico_info.png ├── journey.jpg ├── list-hot.png ├── lock-hot.png ├── mp3-hot.png ├── next-hot.png ├── play-hot.png ├── prev-hot.png ├── save-hot.png ├── skin-hot.png ├── stop-hot.png ├── wifi-hot.png ├── aausb-hot.png ├── aawifi-hot.png ├── album-hot.png ├── camera-hot.png ├── coverlogo.png ├── cursor-hot.png ├── night-hot.png ├── pause-hot.png ├── player-hot.png ├── power-hot.png ├── reboot-hot.png ├── record-hot.png ├── sleep-hot.png ├── volume-hot.png ├── ico_warning.png ├── nextbig-hot.png ├── prevbig-hot.png ├── rearcam-hot.png ├── settings-hot.png ├── Roboto-Regular.ttf ├── brightness-hot.png ├── recordactive-hot.png └── resources.qrc ├── src ├── autoapp │ ├── UI │ │ ├── assets │ │ │ └── journey.jpg │ │ ├── dialog.cpp │ │ ├── dialog.h │ │ ├── WarningDialog.cpp │ │ └── dialog.ui │ ├── Projection │ │ ├── DummyBluetoothDevice.cpp │ │ ├── VideoOutput.cpp │ │ ├── LocalBluetoothDevice.cpp │ │ └── SequentialBuffer.cpp │ ├── Service │ │ ├── MediaSink │ │ │ ├── GuidanceAudioService.cpp │ │ │ ├── MediaAudioService.cpp │ │ │ ├── SystemAudioService.cpp │ │ │ ├── VideoService.cpp │ │ │ └── TelephonyAudioService.cpp │ │ ├── MediaSource │ │ │ └── MicrophoneMediaSourceService.cpp │ │ ├── Pinger.cpp │ │ └── Radio │ │ │ └── RadioService.cpp │ └── Configuration │ │ └── RecentAddressesList.cpp └── btservice │ ├── btservice.cpp │ └── AndroidBluetoothService.cpp ├── .gitignore ├── tests ├── unit │ └── main.cpp ├── mocks │ ├── MockAndroidAutoEntity.hpp │ ├── MockAndroidAutoEntityFactory.hpp │ ├── MockAudioOutput.hpp │ └── MockConfiguration.hpp ├── integration │ └── main.cpp └── CMakeLists.txt ├── cmake_modules ├── CPackProjectConfig.cmake ├── Findaasdk.cmake ├── Findgps.cmake ├── Findaap_protobuf.cmake ├── Findblkid.cmake ├── Findtaglib.cmake └── Findrtaudio.cmake ├── include └── f1x │ └── openauto │ ├── autoapp │ ├── UI │ │ ├── WarningDialog.hpp │ │ ├── UpdateDialog.hpp │ │ └── ConnectDialog.hpp │ ├── Configuration │ │ ├── BluetoothAdapterType.hpp │ │ ├── AudioOutputBackendType.hpp │ │ ├── HandednessOfTrafficType.hpp │ │ ├── IRecentAddressesList.hpp │ │ └── RecentAddressesList.hpp │ ├── Service │ │ ├── IAndroidAutoEntityEventHandler.hpp │ │ ├── IServiceFactory.hpp │ │ ├── IPinger.hpp │ │ ├── IAndroidAutoEntity.hpp │ │ ├── IAndroidAutoEntityFactory.hpp │ │ ├── MediaSink │ │ │ ├── MediaAudioService.hpp │ │ │ ├── GuidanceAudioService.hpp │ │ │ ├── VideoService.hpp │ │ │ ├── SystemAudioService.hpp │ │ │ ├── TelephonyAudioService.hpp │ │ │ └── AudioMediaSinkService.hpp │ │ ├── Service.hpp │ │ ├── IService.hpp │ │ ├── MediaSource │ │ │ ├── MicrophoneMediaSourceService.hpp │ │ │ └── MediaSourceService.hpp │ │ ├── Pinger.hpp │ │ ├── AndroidAutoEntityFactory.hpp │ │ ├── VendorExtension │ │ │ └── VendorExtensionService.hpp │ │ ├── Radio │ │ │ └── RadioService.hpp │ │ ├── PhoneStatus │ │ │ └── PhoneStatusService.hpp │ │ ├── MediaBrowser │ │ │ └── MediaBrowserService.hpp │ │ ├── GenericNotification │ │ │ └── GenericNotificationService.hpp │ │ ├── MediaPlaybackStatus │ │ │ └── MediaPlaybackStatusService.hpp │ │ ├── WifiProjection │ │ │ └── WifiProjectionService.hpp │ │ ├── NavigationStatus │ │ │ └── NavigationStatusService.hpp │ │ ├── Bluetooth │ │ │ └── BluetoothService.hpp │ │ ├── Sensor │ │ │ └── SensorService.hpp │ │ ├── ServiceFactory.hpp │ │ └── InputSource │ │ │ └── InputSourceService.hpp │ ├── Projection │ │ ├── IInputDeviceEventHandler.hpp │ │ ├── DummyBluetoothDevice.hpp │ │ ├── IBluetoothDevice.hpp │ │ ├── VideoOutput.hpp │ │ ├── IInputDevice.hpp │ │ ├── IAudioOutput.hpp │ │ ├── IAudioInput.hpp │ │ ├── SequentialBuffer.hpp │ │ ├── InputEvent.hpp │ │ ├── LocalBluetoothDevice.hpp │ │ ├── OMXVideoOutput.hpp │ │ ├── IVideoOutput.hpp │ │ ├── QtAudioOutput.hpp │ │ ├── QtAudioInput.hpp │ │ ├── RtAudioOutput.hpp │ │ ├── QtVideoOutput.hpp │ │ └── InputDevice.hpp │ └── App.hpp │ ├── btservice │ ├── IBluetoothHandler.hpp │ ├── IAndroidBluetoothServer.hpp │ ├── IAndroidBluetoothService.hpp │ ├── AndroidBluetoothService.hpp │ ├── BluetoothHandler.hpp │ └── AndroidBluetoothServer.hpp │ └── Common │ └── Log.hpp ├── .dockerignore ├── packaging ├── debian │ ├── preinst │ ├── prerm │ ├── postrm │ └── postinst ├── systemd │ ├── openauto-btservice.service │ └── openauto.service └── opt │ └── crankshaft │ ├── usb_action.sh │ └── crankshaft_system_env.sh ├── RELEASE.txt ├── scripts └── distro_release.sh ├── .github └── workflows │ └── trigger-apt-publish.yml └── docs └── fix_summaries ├── touch_fix_summary.md └── shutdown_fix_summary.md /Dockerfile.rootfs: -------------------------------------------------------------------------------- 1 | FROM scratch 2 | ADD rootfs.tar.xz / 3 | CMD ["bash"] -------------------------------------------------------------------------------- /assets/black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/black.png -------------------------------------------------------------------------------- /assets/back-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/back-hot.png -------------------------------------------------------------------------------- /assets/bug-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/bug-hot.png -------------------------------------------------------------------------------- /assets/day-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/day-hot.png -------------------------------------------------------------------------------- /assets/eye-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/eye-hot.png -------------------------------------------------------------------------------- /assets/home-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/home-hot.png -------------------------------------------------------------------------------- /assets/ico_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/ico_info.png -------------------------------------------------------------------------------- /assets/journey.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/journey.jpg -------------------------------------------------------------------------------- /assets/list-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/list-hot.png -------------------------------------------------------------------------------- /assets/lock-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/lock-hot.png -------------------------------------------------------------------------------- /assets/mp3-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/mp3-hot.png -------------------------------------------------------------------------------- /assets/next-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/next-hot.png -------------------------------------------------------------------------------- /assets/play-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/play-hot.png -------------------------------------------------------------------------------- /assets/prev-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/prev-hot.png -------------------------------------------------------------------------------- /assets/save-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/save-hot.png -------------------------------------------------------------------------------- /assets/skin-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/skin-hot.png -------------------------------------------------------------------------------- /assets/stop-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/stop-hot.png -------------------------------------------------------------------------------- /assets/wifi-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/wifi-hot.png -------------------------------------------------------------------------------- /assets/aausb-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/aausb-hot.png -------------------------------------------------------------------------------- /assets/aawifi-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/aawifi-hot.png -------------------------------------------------------------------------------- /assets/album-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/album-hot.png -------------------------------------------------------------------------------- /assets/camera-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/camera-hot.png -------------------------------------------------------------------------------- /assets/coverlogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/coverlogo.png -------------------------------------------------------------------------------- /assets/cursor-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/cursor-hot.png -------------------------------------------------------------------------------- /assets/night-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/night-hot.png -------------------------------------------------------------------------------- /assets/pause-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/pause-hot.png -------------------------------------------------------------------------------- /assets/player-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/player-hot.png -------------------------------------------------------------------------------- /assets/power-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/power-hot.png -------------------------------------------------------------------------------- /assets/reboot-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/reboot-hot.png -------------------------------------------------------------------------------- /assets/record-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/record-hot.png -------------------------------------------------------------------------------- /assets/sleep-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/sleep-hot.png -------------------------------------------------------------------------------- /assets/volume-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/volume-hot.png -------------------------------------------------------------------------------- /assets/ico_warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/ico_warning.png -------------------------------------------------------------------------------- /assets/nextbig-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/nextbig-hot.png -------------------------------------------------------------------------------- /assets/prevbig-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/prevbig-hot.png -------------------------------------------------------------------------------- /assets/rearcam-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/rearcam-hot.png -------------------------------------------------------------------------------- /assets/settings-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/settings-hot.png -------------------------------------------------------------------------------- /assets/Roboto-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/Roboto-Regular.ttf -------------------------------------------------------------------------------- /assets/brightness-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/brightness-hot.png -------------------------------------------------------------------------------- /assets/recordactive-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/assets/recordactive-hot.png -------------------------------------------------------------------------------- /src/autoapp/UI/assets/journey.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/HEAD/src/autoapp/UI/assets/journey.jpg -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Add any directories, files, or patterns you don't want to be tracked by version control 2 | lib/ 3 | bin/ 4 | build/ 5 | .vscode/ 6 | openauto.ini 7 | CMakeLists.txt.user 8 | /cmake-build-*/ 9 | .idea/ -------------------------------------------------------------------------------- /src/autoapp/UI/dialog.cpp: -------------------------------------------------------------------------------- 1 | #include "dialog.h" 2 | #include "ui_dialog.h" 3 | 4 | Dialog::Dialog(QWidget *parent) 5 | : QDialog(parent) 6 | , ui(new Ui::Dialog) 7 | { 8 | ui->setupUi(this); 9 | } 10 | 11 | Dialog::~Dialog() 12 | { 13 | delete ui; 14 | } 15 | -------------------------------------------------------------------------------- /src/autoapp/UI/dialog.h: -------------------------------------------------------------------------------- 1 | #ifndef DIALOG_H 2 | #define DIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class Dialog; 8 | } 9 | 10 | class Dialog : public QDialog 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit Dialog(QWidget *parent = nullptr); 16 | ~Dialog(); 17 | 18 | private: 19 | Ui::Dialog *ui; 20 | }; 21 | 22 | #endif // DIALOG_H 23 | -------------------------------------------------------------------------------- /tests/unit/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | std::unique_ptr app; 6 | 7 | int main(int argc, char *argv[]) { 8 | // Initialize QApplication for tests that require Qt functionality 9 | app = std::make_unique(argc, argv); 10 | 11 | ::testing::InitGoogleTest(&argc, argv); 12 | return RUN_ALL_TESTS(); 13 | } -------------------------------------------------------------------------------- /cmake_modules/CPackProjectConfig.cmake: -------------------------------------------------------------------------------- 1 | # CPack project configuration to harmonize packaging 2 | # If CPACK_DEBIAN_PACKAGE_RELEASE was not explicitly set, pick it up from environment 3 | 4 | if(NOT DEFINED CPACK_DEBIAN_PACKAGE_RELEASE) 5 | if(DEFINED ENV{DISTRO_DEB_RELEASE} AND NOT "$ENV{DISTRO_DEB_RELEASE}" STREQUAL "") 6 | set(CPACK_DEBIAN_PACKAGE_RELEASE "$ENV{DISTRO_DEB_RELEASE}") 7 | endif() 8 | endif() 9 | 10 | # You can extend this file to set other CPACK defaults shared across CI builds 11 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/UI/WarningDialog.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace Ui { 4 | class WarningDialog; 5 | } 6 | 7 | namespace f1x 8 | { 9 | namespace openauto 10 | { 11 | namespace autoapp 12 | { 13 | namespace ui 14 | { 15 | 16 | class WarningDialog : public QDialog 17 | { 18 | Q_OBJECT 19 | 20 | public: 21 | explicit WarningDialog(QWidget *parent = nullptr); 22 | ~WarningDialog() override; 23 | 24 | private: 25 | Ui::WarningDialog* ui_; 26 | 27 | private slots: 28 | void Autoclose(); 29 | }; 30 | 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /include/f1x/openauto/btservice/IBluetoothHandler.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simon Dean on 26/11/2024. 3 | // 4 | 5 | #ifndef OPENAUTO_IBLUETOOTHHANDLER_HPP 6 | #define OPENAUTO_IBLUETOOTHHANDLER_HPP 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | namespace f1x::openauto::btservice { 13 | 14 | class IBluetoothHandler 15 | { 16 | public: 17 | virtual ~IBluetoothHandler() = default; 18 | 19 | virtual void shutdownService() = 0; 20 | }; 21 | 22 | } 23 | 24 | 25 | 26 | #endif //OPENAUTO_IBLUETOOTHHANDLER_HPP 27 | -------------------------------------------------------------------------------- /tests/mocks/MockAndroidAutoEntity.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace f1x::openauto::autoapp::service { 7 | 8 | class MockAndroidAutoEntity : public IAndroidAutoEntity { 9 | public: 10 | MOCK_METHOD(void, start, (IAndroidAutoEntityEventHandler& eventHandler), (override)); 11 | MOCK_METHOD(void, stop, (), (override)); 12 | MOCK_METHOD(void, pause, (), (override)); 13 | MOCK_METHOD(void, resume, (), (override)); 14 | }; 15 | 16 | } // namespace f1x::openauto::autoapp::service -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | # Git files 2 | .git 3 | .gitignore 4 | .gitattributes 5 | 6 | # Build directories 7 | build/ 8 | build-*/ 9 | bin/ 10 | lib/ 11 | packages/ 12 | buildenv/pi_binaries/ 13 | buildenv/release/ 14 | 15 | # IDE files 16 | .vscode/ 17 | .idea/ 18 | *.swp 19 | *.swo 20 | *~ 21 | 22 | # Documentation 23 | *.md 24 | docs/ 25 | RELEASE.txt 26 | 27 | # CI/CD (these are copied separately if needed) 28 | .github/ 29 | 30 | # Docker files 31 | Dockerfile.rootfs 32 | .dockerignore 33 | 34 | # Test files 35 | tests/ 36 | test_*/ 37 | 38 | # Temporary files 39 | *.tmp 40 | *.log 41 | *.bak 42 | -------------------------------------------------------------------------------- /tests/mocks/MockAndroidAutoEntityFactory.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace f1x::openauto::autoapp::service { 7 | 8 | class MockAndroidAutoEntityFactory : public IAndroidAutoEntityFactory { 9 | public: 10 | MOCK_METHOD(IAndroidAutoEntity::Pointer, create, (aasdk::usb::IAOAPDevice::Pointer aoapDevice), (override)); 11 | MOCK_METHOD(IAndroidAutoEntity::Pointer, create, (aasdk::tcp::ITCPEndpoint::Pointer tcpEndpoint), (override)); 12 | }; 13 | 14 | } // namespace f1x::openauto::autoapp::service -------------------------------------------------------------------------------- /src/autoapp/UI/WarningDialog.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | namespace f1x 6 | { 7 | namespace openauto 8 | { 9 | namespace autoapp 10 | { 11 | namespace ui 12 | { 13 | 14 | WarningDialog::WarningDialog(QWidget *parent) 15 | : QDialog(parent) 16 | , ui_(new Ui::WarningDialog) 17 | { 18 | ui_->setupUi(this); 19 | 20 | connect(ui_->pushButtonClose, &QPushButton::clicked, this, &WarningDialog::close); 21 | QTimer::singleShot(5000, this, SLOT(Autoclose())); 22 | } 23 | 24 | WarningDialog::~WarningDialog() 25 | { 26 | delete ui_; 27 | } 28 | 29 | void WarningDialog::Autoclose() 30 | { 31 | WarningDialog::close(); 32 | } 33 | 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/mocks/MockAudioOutput.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace f1x::openauto::autoapp::projection { 7 | 8 | class MockAudioOutput : public IAudioOutput { 9 | public: 10 | MOCK_METHOD(bool, open, (), (override)); 11 | MOCK_METHOD(void, write, (aasdk::messenger::Timestamp::ValueType timestamp, const aasdk::common::DataConstBuffer& buffer), (override)); 12 | MOCK_METHOD(void, start, (), (override)); 13 | MOCK_METHOD(void, stop, (), (override)); 14 | MOCK_METHOD(void, suspend, (), (override)); 15 | MOCK_METHOD(uint32_t, getSampleSize, (), (const, override)); 16 | MOCK_METHOD(uint32_t, getChannelCount, (), (const, override)); 17 | MOCK_METHOD(uint32_t, getSampleRate, (), (const, override)); 18 | }; 19 | 20 | } // namespace f1x::openauto::autoapp::projection -------------------------------------------------------------------------------- /packaging/debian/preinst: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # * Project: OpenAuto 3 | # * This file is part of openauto project. 4 | # * Copyright (C) 2025 OpenCarDev Team 5 | # * 6 | # * openauto is free software: you can redistribute it and/or modify 7 | # * it under the terms of the GNU General Public License as published by 8 | # * the Free Software Foundation; either version 3 of the License, or 9 | # * (at your option) any later version. 10 | # * 11 | # * openauto is distributed in the hope that it will be useful, 12 | # * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # * GNU General Public License for more details. 15 | # * 16 | # * You should have received a copy of the GNU General Public License 17 | # * along with openauto. If not, see . 18 | 19 | set -e 20 | 21 | # Placeholder for pre-installation tasks 22 | # Currently no actions needed before installation 23 | 24 | exit 0 25 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Configuration/BluetoothAdapterType.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | 22 | namespace f1x::openauto::autoapp::configuration { 23 | 24 | enum class BluetoothAdapterType { 25 | NONE, 26 | LOCAL, 27 | EXTERNAL 28 | }; 29 | } 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /include/f1x/openauto/Common/Log.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | 23 | #define OPENAUTO_LOG_CONTEXT "" //"(" << typeid(*this).name() << "::" << __func__ << ")" 24 | #define OPENAUTO_LOG(severity) BOOST_LOG_TRIVIAL(severity) << "[OpenAuto] " << OPENAUTO_LOG_CONTEXT 25 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Configuration/AudioOutputBackendType.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | namespace f1x 22 | { 23 | namespace openauto 24 | { 25 | namespace autoapp 26 | { 27 | namespace configuration 28 | { 29 | 30 | enum class AudioOutputBackendType 31 | { 32 | RTAUDIO, 33 | QT 34 | }; 35 | 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packaging/systemd/openauto-btservice.service: -------------------------------------------------------------------------------- 1 | # * Project: OpenAuto 2 | # * This file is part of openauto project. 3 | # * Copyright (C) 2025 OpenCarDev Team 4 | # * 5 | # * openauto is free software: you can redistribute it and/or modify 6 | # * it under the terms of the GNU General Public License as published by 7 | # * the Free Software Foundation; either version 3 of the License, or 8 | # * (at your option) any later version. 9 | # * 10 | # * openauto is distributed in the hope that it will be useful, 11 | # * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # * GNU General Public License for more details. 14 | # * 15 | # * You should have received a copy of the GNU General Public License 16 | # * along with openauto. If not, see . 17 | 18 | [Unit] 19 | Description=OpenAuto Bluetooth Service 20 | After=bluetooth.target 21 | 22 | [Service] 23 | Type=simple 24 | ExecStart=/usr/bin/btservice 25 | Restart=on-failure 26 | RestartSec=5s 27 | User=root 28 | 29 | [Install] 30 | WantedBy=multi-user.target 31 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Configuration/HandednessOfTrafficType.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | namespace f1x 22 | { 23 | namespace openauto 24 | { 25 | namespace autoapp 26 | { 27 | namespace configuration 28 | { 29 | 30 | enum class HandednessOfTrafficType 31 | { 32 | LEFT_HAND_DRIVE, 33 | RIGHT_HAND_DRIVE 34 | }; 35 | 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/IAndroidAutoEntityEventHandler.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | 23 | namespace f1x 24 | { 25 | namespace openauto 26 | { 27 | namespace autoapp 28 | { 29 | namespace service 30 | { 31 | 32 | class IAndroidAutoEntityEventHandler 33 | { 34 | public: 35 | virtual ~IAndroidAutoEntityEventHandler() = default; 36 | virtual void onAndroidAutoQuit() = 0; 37 | }; 38 | 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/UI/UpdateDialog.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | namespace Ui { 12 | class UpdateDialog; 13 | } 14 | 15 | namespace f1x 16 | { 17 | namespace openauto 18 | { 19 | namespace autoapp 20 | { 21 | namespace ui 22 | { 23 | 24 | class UpdateDialog : public QDialog 25 | { 26 | Q_OBJECT 27 | 28 | public: 29 | explicit UpdateDialog(QWidget *parent = nullptr); 30 | ~UpdateDialog() override; 31 | 32 | void updateCheck(); 33 | void downloadCheck(); 34 | void updateProgress(); 35 | 36 | private slots: 37 | void on_pushButtonUpdateCsmt_clicked(); 38 | void on_pushButtonUpdateUdev_clicked(); 39 | void on_pushButtonUpdateOpenauto_clicked(); 40 | void on_pushButtonUpdateSystem_clicked(); 41 | void on_pushButtonUpdateCheck_clicked(); 42 | void on_pushButtonUpdateCancel_clicked(); 43 | 44 | protected: 45 | void keyPressEvent(QKeyEvent *event); 46 | 47 | private: 48 | Ui::UpdateDialog *ui_; 49 | QFileSystemWatcher* watcher_tmp; 50 | QFileSystemWatcher* watcher_download; 51 | }; 52 | 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /include/f1x/openauto/btservice/IAndroidBluetoothServer.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | namespace f1x::openauto::btservice { 25 | 26 | class IAndroidBluetoothServer { 27 | public: 28 | typedef std::shared_ptr Pointer; 29 | 30 | virtual ~IAndroidBluetoothServer() = default; 31 | 32 | virtual uint16_t start(const QBluetoothAddress &address) = 0; 33 | }; 34 | 35 | } 36 | 37 | 38 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/IServiceFactory.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | namespace f1x 25 | { 26 | namespace openauto 27 | { 28 | namespace autoapp 29 | { 30 | namespace service 31 | { 32 | 33 | class IServiceFactory 34 | { 35 | public: 36 | virtual ~IServiceFactory() = default; 37 | 38 | virtual ServiceList create(aasdk::messenger::IMessenger::Pointer messenger) = 0; 39 | }; 40 | 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /RELEASE.txt: -------------------------------------------------------------------------------- 1 | Release Notes 2 | 3 | 20250710 - 4.1.0 - Build Date Update 4 | * Updated build date to 20250710 5 | * Fixed compiler warnings and build issues 6 | 7 | 20241124 - 4.1.0 - Bluetooth Updates 8 | * Rename BluetootAdapterType to BluetoothAdapterType, and change from NONE, LOCAL, REMOTE to NONE, LOCAL, EXTERNAL to better match available settings 9 | * getLocalAddress() on Dummy, Local and Remote bluetooth changed to getAdapterAddress() 10 | * Removed RemoteBluetoothDevice replacing all references with LocalBluetoothDevice. RemoteBluetoothDevice is a wrapper essentially with all pairing work handled by btservice. 11 | * Pairing overlaps between btservice and LocalBluetoothDevice - removed duplicated elements from LocalBluetoothDevice to rely on btservice. 12 | * Swap Bluetooth dropdown in Settings from none, builtin or external, to showing a list of detected Bluetooth Adapters. Write hardware address to config file. 13 | 14 | 20241121 - 4.0.0 - AAP 1.6 Support 15 | * Added support for new services provided by AASDK and AAP Protocol version 1.6. 16 | * Add extensive logging 17 | * Add logo for forked version 18 | * Resolve display issue where if Raspberry Pi thinks both HDMI and LCD are enabled, the display width is appearing as two side by side monitors (double width) rather than just using the physical width of the screen. 19 | 20 | -------------------------------------------------------------------------------- /include/f1x/openauto/btservice/IAndroidBluetoothService.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | #include 21 | #include 22 | 23 | namespace f1x::openauto::btservice 24 | { 25 | 26 | class IAndroidBluetoothService 27 | { 28 | public: 29 | typedef std::shared_ptr Pointer; 30 | 31 | virtual ~IAndroidBluetoothService() = default; 32 | 33 | virtual bool registerService(int16_t portNumber, const QBluetoothAddress& bluetoothAddress) = 0; 34 | virtual bool unregisterService() = 0; 35 | }; 36 | 37 | } 38 | 39 | 40 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Projection/IInputDeviceEventHandler.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | 23 | namespace f1x 24 | { 25 | namespace openauto 26 | { 27 | namespace autoapp 28 | { 29 | namespace projection 30 | { 31 | 32 | class IInputDeviceEventHandler 33 | { 34 | public: 35 | virtual ~IInputDeviceEventHandler() = default; 36 | 37 | virtual void onButtonEvent(const ButtonEvent& event) = 0; 38 | virtual void onTouchEvent(const TouchEvent& event) = 0; 39 | }; 40 | 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /scripts/distro_release.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | 4 | # Compute distro-specific Debian revision suffix for CPack DEB packages. 5 | # Prints the suffix to stdout, e.g.: 6 | # - Debian 12 (bookworm): 1+deb12u1 7 | # - Debian 13 (trixie): 1+deb13u1 8 | # - Ubuntu 22.04: 0ubuntu1~22.04 9 | # - Ubuntu 24.04: 0ubuntu1~24.04 10 | # - Raspberry Pi OS: 1+rpi12u1 (example) 11 | # - Fallback: 1~- 12 | 13 | if [[ -r /etc/os-release ]]; then 14 | # shellcheck disable=SC1091 15 | . /etc/os-release 16 | else 17 | echo "1~unknown" && exit 0 18 | fi 19 | 20 | id_lc=$(echo "${ID:-unknown}" | tr '[:upper:]' '[:lower:]') 21 | suite=${VERSION_CODENAME:-unknown} 22 | verid=${VERSION_ID:-0} 23 | 24 | case "$id_lc" in 25 | debian) 26 | case "$suite" in 27 | bookworm) deb_num=12 ;; 28 | trixie) deb_num=13 ;; 29 | *) deb_num="${verid%%.*}" ;; 30 | esac 31 | if [[ -n "${deb_num}" ]]; then 32 | echo "1+deb${deb_num}u1" 33 | else 34 | echo "1~debian${suite}1" 35 | fi 36 | ;; 37 | ubuntu) 38 | series="${verid}" 39 | echo "0ubuntu1~${series}" 40 | ;; 41 | raspbian|raspios) 42 | series="${verid%%.*}" 43 | echo "1+rpi${series}u1" 44 | ;; 45 | *) 46 | echo "1~${id_lc}${verid}-${suite}" 47 | ;; 48 | esac 49 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Configuration/IRecentAddressesList.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | namespace f1x 25 | { 26 | namespace openauto 27 | { 28 | namespace autoapp 29 | { 30 | namespace configuration 31 | { 32 | 33 | class IRecentAddressesList 34 | { 35 | public: 36 | typedef std::deque RecentAddresses; 37 | 38 | virtual void read() = 0; 39 | virtual void insertAddress(const std::string& address) = 0; 40 | virtual RecentAddresses getList() const = 0; 41 | }; 42 | 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/IPinger.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | 23 | namespace f1x 24 | { 25 | namespace openauto 26 | { 27 | namespace autoapp 28 | { 29 | namespace service 30 | { 31 | 32 | class IPinger 33 | { 34 | public: 35 | typedef std::shared_ptr Pointer; 36 | typedef aasdk::io::Promise Promise; 37 | 38 | virtual ~IPinger() = default; 39 | virtual void ping(Promise::Pointer promise) = 0; 40 | virtual void pong() = 0; 41 | virtual void cancel() = 0; 42 | }; 43 | 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Projection/DummyBluetoothDevice.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | 23 | namespace f1x 24 | { 25 | namespace openauto 26 | { 27 | namespace autoapp 28 | { 29 | namespace projection 30 | { 31 | 32 | class DummyBluetoothDevice: public IBluetoothDevice 33 | { 34 | public: 35 | void stop() override; 36 | bool isPaired(const std::string& address) const override; 37 | std::string getAdapterAddress() const override; 38 | bool isAvailable() const override; 39 | }; 40 | 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/autoapp/Projection/DummyBluetoothDevice.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #include 20 | 21 | 22 | 23 | 24 | namespace f1x::openauto::autoapp::projection 25 | { 26 | 27 | void DummyBluetoothDevice::stop() 28 | { 29 | 30 | } 31 | 32 | bool DummyBluetoothDevice::isPaired(const std::string&) const 33 | { 34 | return false; 35 | } 36 | 37 | std::string DummyBluetoothDevice::getAdapterAddress() const 38 | { 39 | return ""; 40 | } 41 | 42 | bool DummyBluetoothDevice::isAvailable() const 43 | { 44 | return false; 45 | } 46 | 47 | } 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /include/f1x/openauto/btservice/AndroidBluetoothService.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | namespace f1x::openauto::btservice 25 | { 26 | 27 | class AndroidBluetoothService: public IAndroidBluetoothService 28 | { 29 | public: 30 | AndroidBluetoothService(); 31 | 32 | bool registerService(int16_t portNumber, const QBluetoothAddress& bluetoothAddress) override; 33 | bool unregisterService() override; 34 | 35 | private: 36 | QBluetoothServiceInfo serviceInfo_; 37 | }; 38 | 39 | } 40 | 41 | 42 | -------------------------------------------------------------------------------- /packaging/debian/prerm: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # * Project: OpenAuto 3 | # * This file is part of openauto project. 4 | # * Copyright (C) 2025 OpenCarDev Team 5 | # * 6 | # * openauto is free software: you can redistribute it and/or modify 7 | # * it under the terms of the GNU General Public License as published by 8 | # * the Free Software Foundation; either version 3 of the License, or 9 | # * (at your option) any later version. 10 | # * 11 | # * openauto is distributed in the hope that it will be useful, 12 | # * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # * GNU General Public License for more details. 15 | # * 16 | # * You should have received a copy of the GNU General Public License 17 | # * along with openauto. If not, see . 18 | 19 | set -e 20 | 21 | case "$1" in 22 | remove|upgrade|deconfigure) 23 | # Stop services before removal/upgrade 24 | if [ -x /bin/systemctl ]; then 25 | /bin/systemctl stop openauto.service || true 26 | /bin/systemctl stop openauto-btservice.service || true 27 | fi 28 | ;; 29 | 30 | failed-upgrade) 31 | ;; 32 | 33 | *) 34 | echo "prerm called with unknown argument \`$1'" >&2 35 | exit 1 36 | ;; 37 | esac 38 | 39 | #DEBHELPER# 40 | 41 | exit 0 42 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Projection/IBluetoothDevice.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #include 20 | 21 | #pragma once 22 | 23 | namespace f1x 24 | { 25 | namespace openauto 26 | { 27 | namespace autoapp 28 | { 29 | namespace projection 30 | { 31 | 32 | class IBluetoothDevice 33 | { 34 | public: 35 | typedef aasdk::io::Promise PairingPromise; 36 | typedef std::shared_ptr Pointer; 37 | 38 | virtual void stop() = 0; 39 | virtual bool isPaired(const std::string& address) const = 0; 40 | virtual std::string getAdapterAddress() const = 0; 41 | virtual bool isAvailable() const = 0; 42 | }; 43 | 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/IAndroidAutoEntity.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | namespace f1x 25 | { 26 | namespace openauto 27 | { 28 | namespace autoapp 29 | { 30 | namespace service 31 | { 32 | 33 | class IAndroidAutoEntity 34 | { 35 | public: 36 | typedef std::shared_ptr Pointer; 37 | 38 | virtual ~IAndroidAutoEntity() = default; 39 | 40 | virtual void start(IAndroidAutoEntityEventHandler& eventHandler) = 0; 41 | virtual void stop() = 0; 42 | virtual void pause() = 0; 43 | virtual void resume() = 0; 44 | }; 45 | 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /packaging/debian/postrm: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # * Project: OpenAuto 3 | # * This file is part of openauto project. 4 | # * Copyright (C) 2025 OpenCarDev Team 5 | # * 6 | # * openauto is free software: you can redistribute it and/or modify 7 | # * it under the terms of the GNU General Public License as published by 8 | # * the Free Software Foundation; either version 3 of the License, or 9 | # * (at your option) any later version. 10 | # * 11 | # * openauto is distributed in the hope that it will be useful, 12 | # * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # * GNU General Public License for more details. 15 | # * 16 | # * You should have received a copy of the GNU General Public License 17 | # * along with openauto. If not, see . 18 | 19 | set -e 20 | 21 | case "$1" in 22 | purge) 23 | # Disable and remove service files on purge 24 | if [ -x /bin/systemctl ]; then 25 | /bin/systemctl disable openauto.service || true 26 | /bin/systemctl disable openauto-btservice.service || true 27 | /bin/systemctl daemon-reload || true 28 | fi 29 | ;; 30 | 31 | remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) 32 | ;; 33 | 34 | *) 35 | echo "postrm called with unknown argument \`$1'" >&2 36 | exit 1 37 | ;; 38 | esac 39 | 40 | #DEBHELPER# 41 | 42 | exit 0 43 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/IAndroidAutoEntityFactory.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | namespace f1x 26 | { 27 | namespace openauto 28 | { 29 | namespace autoapp 30 | { 31 | namespace service 32 | { 33 | 34 | class IAndroidAutoEntityFactory 35 | { 36 | public: 37 | virtual ~IAndroidAutoEntityFactory() = default; 38 | 39 | virtual IAndroidAutoEntity::Pointer create(aasdk::usb::IAOAPDevice::Pointer aoapDevice) = 0; 40 | virtual IAndroidAutoEntity::Pointer create(aasdk::tcp::ITCPEndpoint::Pointer tcpEndpoint) = 0; 41 | }; 42 | 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /.github/workflows/trigger-apt-publish.yml: -------------------------------------------------------------------------------- 1 | name: Trigger APT Repository Update 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | build_run_id: 7 | description: 'Build run ID to publish to APT repo' 8 | required: true 9 | type: string 10 | distribution: 11 | description: 'Distribution to publish to' 12 | required: false 13 | default: 'trixie' 14 | type: choice 15 | options: 16 | - trixie 17 | - bookworm 18 | - both 19 | 20 | jobs: 21 | trigger-apt-update: 22 | runs-on: ubuntu-latest 23 | steps: 24 | - name: Dispatch to packages repo 25 | run: | 26 | echo "Triggering APT repository update for build run ${{ inputs.build_run_id }}" 27 | curl -X POST \ 28 | -H "Accept: application/vnd.github.v3+json" \ 29 | -H "Authorization: token ${{ secrets.PACKAGES_REPO_TOKEN }}" \ 30 | https://api.github.com/repos/opencardev/packages/dispatches \ 31 | -d '{ 32 | "event_type": "publish-apt-packages", 33 | "client_payload": { 34 | "source_repo": "${{ github.repository }}", 35 | "build_run_id": "${{ inputs.build_run_id }}", 36 | "apt_import": true, 37 | "distribution": "${{ inputs.distribution }}" 38 | } 39 | }' 40 | 41 | echo "✅ APT repository update triggered successfully!" 42 | echo "Check: https://github.com/opencardev/packages/actions" -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/MediaSink/MediaAudioService.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | 25 | namespace f1x { 26 | namespace openauto { 27 | namespace autoapp { 28 | namespace service { 29 | namespace mediasink { 30 | class MediaAudioService : public AudioMediaSinkService { 31 | public: 32 | MediaAudioService(boost::asio::io_service &ioService, 33 | aasdk::messenger::IMessenger::Pointer messenger, 34 | projection::IAudioOutput::Pointer audioOutput); 35 | }; 36 | 37 | } 38 | } 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/Service.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | namespace f1x::openauto::autoapp::service { 26 | 27 | class Service 28 | : public IService { 29 | public: 30 | Service(boost::asio::io_service &ioService); 31 | 32 | void start() override; 33 | 34 | void stop() override; 35 | 36 | void pause() override; 37 | 38 | void resume() override; 39 | 40 | void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; 41 | 42 | private: 43 | 44 | boost::asio::io_service::strand strand_; 45 | 46 | }; 47 | } 48 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/MediaSink/GuidanceAudioService.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | namespace f1x { 25 | namespace openauto { 26 | namespace autoapp { 27 | namespace service { 28 | namespace mediasink { 29 | class GuidanceAudioService : public AudioMediaSinkService { 30 | public: 31 | GuidanceAudioService(boost::asio::io_service &ioService, 32 | aasdk::messenger::IMessenger::Pointer messenger, 33 | projection::IAudioOutput::Pointer audioOutput); 34 | 35 | }; 36 | 37 | } 38 | } 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /assets/resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | ico_warning.png 4 | ico_info.png 5 | aausb-hot.png 6 | aawifi-hot.png 7 | cursor-hot.png 8 | power-hot.png 9 | settings-hot.png 10 | sleep-hot.png 11 | wifi-hot.png 12 | brightness-hot.png 13 | camera-hot.png 14 | day-hot.png 15 | night-hot.png 16 | record-hot.png 17 | stop-hot.png 18 | save-hot.png 19 | reboot-hot.png 20 | back-hot.png 21 | rearcam-hot.png 22 | recordactive-hot.png 23 | lock-hot.png 24 | volume-hot.png 25 | bug-hot.png 26 | eye-hot.png 27 | skin-hot.png 28 | mp3-hot.png 29 | play-hot.png 30 | prev-hot.png 31 | next-hot.png 32 | pause-hot.png 33 | prevbig-hot.png 34 | nextbig-hot.png 35 | list-hot.png 36 | home-hot.png 37 | player-hot.png 38 | coverlogo.png 39 | black.png 40 | album-hot.png 41 | Roboto-Regular.ttf 42 | 43 | 44 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/MediaSink/VideoService.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | 25 | namespace f1x { 26 | namespace openauto { 27 | namespace autoapp { 28 | namespace service { 29 | namespace mediasink { 30 | class VideoService : public VideoMediaSinkService { 31 | public: 32 | VideoService(boost::asio::io_service &ioService, 33 | aasdk::messenger::IMessenger::Pointer messenger, 34 | projection::IVideoOutput::Pointer videoOutput); 35 | 36 | protected: 37 | projection::IVideoOutput::Pointer videoOutput; 38 | }; 39 | 40 | } 41 | } 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/IService.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | 28 | namespace f1x::openauto::autoapp::service { 29 | 30 | class IService { 31 | public: 32 | typedef std::shared_ptr Pointer; 33 | 34 | virtual ~IService() = default; 35 | 36 | virtual void start() = 0; 37 | 38 | virtual void stop() = 0; 39 | 40 | virtual void pause() = 0; 41 | 42 | virtual void resume() = 0; 43 | 44 | virtual void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) = 0; 45 | }; 46 | 47 | typedef std::vector ServiceList; 48 | 49 | } 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/MediaSink/SystemAudioService.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | namespace f1x { 25 | namespace openauto { 26 | namespace autoapp { 27 | namespace service { 28 | namespace mediasink { 29 | class SystemAudioService : public AudioMediaSinkService { 30 | public: 31 | SystemAudioService(boost::asio::io_service &ioService, 32 | aasdk::messenger::IMessenger::Pointer messenger, 33 | projection::IAudioOutput::Pointer audioOutput); 34 | 35 | protected: 36 | projection::IAudioOutput::Pointer audioOutput_; 37 | }; 38 | 39 | } 40 | } 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /tests/mocks/MockConfiguration.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace f1x::openauto::autoapp::configuration { 7 | 8 | class MockConfiguration : public IConfiguration { 9 | public: 10 | MOCK_METHOD(void, load, (), (override)); 11 | MOCK_METHOD(void, reset, (), (override)); 12 | MOCK_METHOD(void, save, (), (override)); 13 | MOCK_METHOD(bool, hasTouchScreen, (), (const, override)); 14 | MOCK_METHOD(void, setHandednessOfTrafficType, (HandednessOfTrafficType value), (override)); 15 | MOCK_METHOD(HandednessOfTrafficType, getHandednessOfTrafficType, (), (const, override)); 16 | MOCK_METHOD(void, showClock, (bool value), (override)); 17 | MOCK_METHOD(bool, showClock, (), (const, override)); 18 | MOCK_METHOD(void, showBigClock, (bool value), (override)); 19 | MOCK_METHOD(bool, showBigClock, (), (const, override)); 20 | MOCK_METHOD(void, oldGUI, (bool value), (override)); 21 | MOCK_METHOD(bool, oldGUI, (), (const, override)); 22 | MOCK_METHOD(void, setAlphaTrans, (size_t value), (override)); 23 | MOCK_METHOD(size_t, getAlphaTrans, (), (const, override)); 24 | MOCK_METHOD(void, hideMenuToggle, (bool value), (override)); 25 | MOCK_METHOD(bool, hideMenuToggle, (), (const, override)); 26 | MOCK_METHOD(void, hideAlpha, (bool value), (override)); 27 | MOCK_METHOD(bool, hideAlpha, (), (const, override)); 28 | MOCK_METHOD(QString, getCSValue, (const QString& key), (const, override)); 29 | MOCK_METHOD(QString, readFileContent, (const QString& fileName), (const, override)); 30 | }; 31 | 32 | } // namespace f1x::openauto::autoapp::configuration -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/MediaSink/TelephonyAudioService.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | 25 | namespace f1x { 26 | namespace openauto { 27 | namespace autoapp { 28 | namespace service { 29 | namespace mediasink { 30 | class TelephonyAudioService : public AudioMediaSinkService { 31 | public: 32 | TelephonyAudioService(boost::asio::io_service &ioService, 33 | aasdk::messenger::IMessenger::Pointer messenger, 34 | projection::IAudioOutput::Pointer audioOutput); 35 | 36 | protected: 37 | projection::IAudioOutput::Pointer audioOutput_; 38 | }; 39 | 40 | } 41 | } 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Projection/VideoOutput.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | namespace f1x 25 | { 26 | namespace openauto 27 | { 28 | namespace autoapp 29 | { 30 | namespace projection 31 | { 32 | 33 | class VideoOutput: public IVideoOutput 34 | { 35 | public: 36 | VideoOutput(configuration::IConfiguration::Pointer configuration); 37 | 38 | aap_protobuf::service::media::sink::message::VideoFrameRateType getVideoFPS() const override; 39 | aap_protobuf::service::media::sink::message::VideoCodecResolutionType getVideoResolution() const override; 40 | size_t getScreenDPI() const override; 41 | QRect getVideoMargins() const override; 42 | 43 | protected: 44 | configuration::IConfiguration::Pointer configuration_; 45 | }; 46 | 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/integration/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | std::unique_ptr app; 8 | boost::asio::io_service ioService; 9 | std::unique_ptr ioServiceThread; 10 | 11 | // Custom test environment for setting up and tearing down global test resources 12 | class IntegrationTestEnvironment : public ::testing::Environment { 13 | public: 14 | void SetUp() override { 15 | // Start io_service in a separate thread for async operations 16 | ioServiceThread = std::make_unique(); 17 | QObject::connect(ioServiceThread.get(), &QThread::started, []() { 18 | boost::asio::io_service::work work(ioService); 19 | ioService.run(); 20 | }); 21 | ioServiceThread->start(); 22 | } 23 | 24 | void TearDown() override { 25 | // Cleanup resources 26 | ioService.stop(); 27 | if (ioServiceThread && ioServiceThread->isRunning()) { 28 | ioServiceThread->quit(); 29 | ioServiceThread->wait(3000); // Wait 3 seconds max 30 | if (ioServiceThread->isRunning()) { 31 | ioServiceThread->terminate(); 32 | } 33 | } 34 | } 35 | }; 36 | 37 | int main(int argc, char *argv[]) { 38 | // Initialize QApplication for tests that require Qt functionality 39 | app = std::make_unique(argc, argv); 40 | 41 | ::testing::InitGoogleTest(&argc, argv); 42 | 43 | // Add the global test environment 44 | ::testing::AddGlobalTestEnvironment(new IntegrationTestEnvironment); 45 | 46 | return RUN_ALL_TESTS(); 47 | } -------------------------------------------------------------------------------- /include/f1x/openauto/btservice/BluetoothHandler.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Simon Dean on 26/11/2024. 3 | // 4 | 5 | #ifndef OPENAUTO_BLUETOOTHHANDLER_HPP 6 | #define OPENAUTO_BLUETOOTHHANDLER_HPP 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | namespace f1x::openauto::btservice { 15 | 16 | class BluetoothHandler : public QObject, public IBluetoothHandler { 17 | Q_OBJECT 18 | public: 19 | BluetoothHandler(btservice::IAndroidBluetoothService::Pointer androidBluetoothService, 20 | autoapp::configuration::IConfiguration::Pointer configuration); 21 | 22 | void shutdownService() override; 23 | 24 | private slots: 25 | void onPairingDisplayPinCode(const QBluetoothAddress &address, QString pin); 26 | 27 | void onPairingDisplayConfirmation(const QBluetoothAddress &address, QString pin); 28 | 29 | void onPairingFinished(const QBluetoothAddress &address, QBluetoothLocalDevice::Pairing pairing); 30 | 31 | void onError(QBluetoothLocalDevice::Error error); 32 | 33 | void onHostModeStateChanged(QBluetoothLocalDevice::HostMode state); 34 | 35 | 36 | private: 37 | std::unique_ptr localDevice_; 38 | autoapp::configuration::IConfiguration::Pointer configuration_; 39 | btservice::IAndroidBluetoothService::Pointer androidBluetoothService_; 40 | btservice::IAndroidBluetoothServer::Pointer androidBluetoothServer_; 41 | }; 42 | } 43 | 44 | 45 | #endif //OPENAUTO_BLUETOOTHHANDLER_HPP 46 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Configuration/RecentAddressesList.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | namespace f1x 25 | { 26 | namespace openauto 27 | { 28 | namespace autoapp 29 | { 30 | namespace configuration 31 | { 32 | 33 | class RecentAddressesList: public IRecentAddressesList 34 | { 35 | public: 36 | RecentAddressesList(size_t maxListSize); 37 | 38 | void read() override; 39 | void insertAddress(const std::string& address) override; 40 | RecentAddresses getList() const override; 41 | 42 | private: 43 | void load(); 44 | void save(); 45 | 46 | size_t maxListSize_; 47 | RecentAddresses list_; 48 | 49 | static const std::string cConfigFileName; 50 | static const std::string cRecentEntiresCount; 51 | static const std::string cRecentEntryPrefix; 52 | }; 53 | 54 | } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Projection/IInputDevice.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | namespace f1x 26 | { 27 | namespace openauto 28 | { 29 | namespace autoapp 30 | { 31 | namespace projection 32 | { 33 | 34 | class IInputDeviceEventHandler; 35 | 36 | class IInputDevice 37 | { 38 | public: 39 | typedef std::shared_ptr Pointer; 40 | typedef std::vector ButtonCodes; 41 | 42 | virtual ~IInputDevice() = default; 43 | virtual void start(IInputDeviceEventHandler& eventHandler) = 0; 44 | virtual void stop() = 0; 45 | virtual ButtonCodes getSupportedButtonCodes() const = 0; 46 | virtual bool hasTouchscreen() const = 0; 47 | virtual QRect getTouchscreenGeometry() const = 0; 48 | }; 49 | 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/MediaSource/MicrophoneMediaSourceService.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | 25 | namespace f1x { 26 | namespace openauto { 27 | namespace autoapp { 28 | namespace service { 29 | namespace mediasource { 30 | class MicrophoneMediaSourceService : public MediaSourceService { 31 | public: 32 | MicrophoneMediaSourceService(boost::asio::io_service &ioService, 33 | aasdk::messenger::IMessenger::Pointer messenger, 34 | projection::IAudioInput::Pointer audioInput); 35 | 36 | protected: 37 | projection::IAudioInput::Pointer audioInput_; 38 | }; 39 | 40 | } 41 | } 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /src/autoapp/Service/MediaSink/GuidanceAudioService.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #include 20 | 21 | 22 | namespace f1x::openauto::autoapp::service::mediasink { 23 | using f1x::openauto::autoapp::service::mediasink::GuidanceAudioService; 24 | using f1x::openauto::autoapp::service::mediasink::AudioMediaSinkService; 25 | using aasdk::channel::mediasink::audio::channel::GuidanceAudioChannel; 26 | 27 | GuidanceAudioService::GuidanceAudioService(boost::asio::io_service &ioService, 28 | aasdk::messenger::IMessenger::Pointer messenger, 29 | projection::IAudioOutput::Pointer audioOutput) 30 | : AudioMediaSinkService( 31 | ioService, 32 | std::make_shared(strand_, std::move(messenger)), 33 | std::move(audioOutput)) { 34 | 35 | } 36 | } 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /packaging/systemd/openauto.service: -------------------------------------------------------------------------------- 1 | # * Project: OpenAuto 2 | # * This file is part of openauto project. 3 | # * Copyright (C) 2025 OpenCarDev Team 4 | # * 5 | # * openauto is free software: you can redistribute it and/or modify 6 | # * it under the terms of the GNU General Public License as published by 7 | # * the Free Software Foundation; either version 3 of the License, or 8 | # * (at your option) any later version. 9 | # * 10 | # * openauto is distributed in the hope that it will be useful, 11 | # * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # * GNU General Public License for more details. 14 | # * 15 | # * You should have received a copy of the GNU General Public License 16 | # * along with openauto. If not, see . 17 | 18 | [Unit] 19 | Description=OpenAuto Android Auto Head Unit 20 | After=network.target sound.target bluetooth.target 21 | 22 | [Service] 23 | Type=simple 24 | ExecStart=/usr/bin/autoapp 25 | Restart=on-failure 26 | RestartSec=5s 27 | User=root 28 | Environment="QT_QPA_PLATFORM=eglfs" 29 | Environment="QT_QPA_EGLFS_ALWAYS_SET_MODE=1" 30 | Environment="DISPLAY=:0" 31 | Environment="XDG_RUNTIME_DIR=/run/user/1000" 32 | Environment="GST_DEBUG=3,video_sink:5" 33 | Environment="QT_QPA_EGLFS_SWAPINTERVAL=0" 34 | Environment="QT_QPA_EGLFS_FORCEVSYNC=0" 35 | Environment="QT_QPA_EGLFS_INTEGRATION=eglfs_kms" 36 | Environment="QT_QPA_EGLFS_KMS_ATOMIC=1" 37 | Environment="QT_QPA_EGLFS_LAYER_INDEX=0" 38 | Environment="QT_QPA_EGLFS_NO_VSYNC=1" 39 | 40 | # Ensure audio is accessible 41 | SupplementaryGroups=audio video plugdev 42 | 43 | [Install] 44 | WantedBy=multi-user.target 45 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Projection/IAudioOutput.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | namespace f1x 26 | { 27 | namespace openauto 28 | { 29 | namespace autoapp 30 | { 31 | namespace projection 32 | { 33 | 34 | class IAudioOutput 35 | { 36 | public: 37 | typedef std::shared_ptr Pointer; 38 | 39 | IAudioOutput() = default; 40 | virtual ~IAudioOutput() = default; 41 | 42 | virtual bool open() = 0; 43 | virtual void write(aasdk::messenger::Timestamp::ValueType timestamp, const aasdk::common::DataConstBuffer& buffer) = 0; 44 | virtual void start() = 0; 45 | virtual void stop() = 0; 46 | virtual void suspend() = 0; 47 | virtual uint32_t getSampleSize() const = 0; 48 | virtual uint32_t getChannelCount() const = 0; 49 | virtual uint32_t getSampleRate() const = 0; 50 | }; 51 | 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/autoapp/Service/MediaSink/MediaAudioService.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #include 20 | 21 | 22 | namespace f1x::openauto::autoapp::service::mediasink { 23 | MediaAudioService::MediaAudioService(boost::asio::io_service &ioService, 24 | aasdk::messenger::IMessenger::Pointer messenger, 25 | projection::IAudioOutput::Pointer audioOutput) 26 | : AudioMediaSinkService(ioService, 27 | std::make_shared(strand_, 28 | std::move( 29 | messenger)), 30 | std::move(audioOutput)) { 31 | 32 | } 33 | } 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/autoapp/UI/dialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Dialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Dialog 15 | 16 | 17 | 18 | 19 | 30 20 | 240 21 | 341 22 | 32 23 | 24 | 25 | 26 | Qt::Horizontal 27 | 28 | 29 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 30 | 31 | 32 | 33 | 34 | 35 | 36 | buttonBox 37 | accepted() 38 | Dialog 39 | accept() 40 | 41 | 42 | 248 43 | 254 44 | 45 | 46 | 157 47 | 274 48 | 49 | 50 | 51 | 52 | buttonBox 53 | rejected() 54 | Dialog 55 | reject() 56 | 57 | 58 | 316 59 | 260 60 | 61 | 62 | 286 63 | 274 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/Pinger.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | 23 | namespace f1x 24 | { 25 | namespace openauto 26 | { 27 | namespace autoapp 28 | { 29 | namespace service 30 | { 31 | 32 | class Pinger: public IPinger, public std::enable_shared_from_this 33 | { 34 | public: 35 | Pinger(boost::asio::io_service& ioService, time_t duration); 36 | 37 | void ping(Promise::Pointer promise) override; 38 | void pong() override; 39 | void cancel() override; 40 | 41 | private: 42 | using std::enable_shared_from_this::shared_from_this; 43 | 44 | void onTimerExceeded(const boost::system::error_code& error); 45 | 46 | boost::asio::io_service::strand strand_; 47 | boost::asio::deadline_timer timer_; 48 | time_t duration_; 49 | bool cancelled_; 50 | Promise::Pointer promise_; 51 | int64_t pingsCount_; 52 | int64_t pongsCount_; 53 | }; 54 | 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Projection/IAudioInput.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | namespace f1x 26 | { 27 | namespace openauto 28 | { 29 | namespace autoapp 30 | { 31 | namespace projection 32 | { 33 | 34 | class IAudioInput 35 | { 36 | public: 37 | typedef aasdk::io::Promise StartPromise; 38 | typedef aasdk::io::Promise ReadPromise; 39 | typedef std::shared_ptr Pointer; 40 | 41 | virtual ~IAudioInput() = default; 42 | 43 | virtual bool open() = 0; 44 | virtual bool isActive() const = 0; 45 | virtual void read(ReadPromise::Pointer promise) = 0; 46 | virtual void start(StartPromise::Pointer promise) = 0; 47 | virtual void stop() = 0; 48 | virtual uint32_t getSampleSize() const = 0; 49 | virtual uint32_t getChannelCount() const = 0; 50 | virtual uint32_t getSampleRate() const = 0; 51 | }; 52 | 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/autoapp/Service/MediaSink/SystemAudioService.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #include 20 | #include 21 | 22 | 23 | namespace f1x::openauto::autoapp::service::mediasink { 24 | SystemAudioService::SystemAudioService(boost::asio::io_service &ioService, 25 | aasdk::messenger::IMessenger::Pointer messenger, 26 | projection::IAudioOutput::Pointer audioOutput) 27 | : AudioMediaSinkService(ioService, 28 | std::make_shared(strand_, 29 | std::move( 30 | messenger)), 31 | std::move(audioOutput)) { 32 | 33 | } 34 | 35 | } 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/btservice/btservice.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | namespace btservice = f1x::openauto::btservice; 27 | 28 | int main(int argc, char *argv[]) { 29 | QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth*=true")); 30 | QCoreApplication qApplication(argc, argv); 31 | 32 | auto configuration = std::make_shared(); 33 | 34 | try { 35 | auto androidBluetoothService = std::make_shared(); 36 | btservice::BluetoothHandler bluetoothHandler(androidBluetoothService, configuration); 37 | QCoreApplication::exec(); 38 | } catch (std::runtime_error& e) { 39 | std::cerr << "Exception caught: " << e.what() << std::endl; 40 | } 41 | 42 | OPENAUTO_LOG(info) << "stop"; 43 | 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /cmake_modules/Findaasdk.cmake: -------------------------------------------------------------------------------- 1 | if (AASDK_LIB_DIRS AND AASDK_INCLUDE_DIRS) 2 | # in cache already 3 | message(STATUS "aasdk cached") 4 | set(AASDK_FOUND TRUE) 5 | else (AASDK_LIB_DIRS AND AASDK_INCLUDE_DIRS) 6 | find_path(AASDK_INCLUDE_DIR 7 | NAMES 8 | Version.hpp 9 | PATHS 10 | /usr/include 11 | /usr/local/include 12 | /opt/local/include 13 | /sw/include 14 | PATH_SUFFIXES 15 | aasdk 16 | ) 17 | 18 | find_library(AASDK_LIB_DIR 19 | NAMES 20 | aasdk libaasdk 21 | PATHS 22 | /usr/lib 23 | /usr/local/lib 24 | /opt/local/lib 25 | /sw/lib 26 | ) 27 | 28 | set(AASDK_INCLUDE_DIRS 29 | ${AASDK_INCLUDE_DIR} 30 | ) 31 | set(AASDK_LIB_DIRS 32 | ${AASDK_LIB_DIR} 33 | ) 34 | 35 | if (AASDK_INCLUDE_DIRS AND AASDK_LIB_DIRS) 36 | set(AASDK_FOUND TRUE) 37 | endif (AASDK_INCLUDE_DIRS AND AASDK_LIB_DIRS) 38 | 39 | if (AASDK_FOUND) 40 | message(STATUS "Found aasdk:") 41 | message(STATUS " - Includes: ${AASDK_INCLUDE_DIRS}") 42 | message(STATUS " - Libraries: ${AASDK_LIB_DIRS}") 43 | add_library(aasdk INTERFACE) 44 | target_include_directories(aasdk SYSTEM INTERFACE ${AASDK_INCLUDE_DIR}) 45 | target_link_libraries(aasdk INTERFACE ${AASDK_LIB_DIR}) 46 | else (AASDK_FOUND) 47 | message(STATUS " - Includes: ${AASDK_INCLUDE_DIRS}") 48 | message(STATUS " - Libraries: ${AASDK_LIB_DIRS}") 49 | message(FATAL_ERROR "Could not find aasdk") 50 | endif (AASDK_FOUND) 51 | 52 | # show the AASDK_INCLUDE_DIRS and AASDK_LIB_DIRS variables only in the advanced view 53 | mark_as_advanced(AASDK_INCLUDE_DIRS AASDK_LIB_DIRS) 54 | 55 | endif (AASDK_LIB_DIRS AND AASDK_INCLUDE_DIRS) 56 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Projection/SequentialBuffer.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | namespace f1x 27 | { 28 | namespace openauto 29 | { 30 | namespace autoapp 31 | { 32 | namespace projection 33 | { 34 | 35 | class SequentialBuffer: public QIODevice 36 | { 37 | public: 38 | SequentialBuffer(); 39 | bool isSequential() const override; 40 | qint64 size() const override; 41 | qint64 pos() const override; 42 | bool seek(qint64 pos) override; 43 | bool atEnd() const override; 44 | bool reset() override; 45 | bool canReadLine() const override; 46 | qint64 bytesAvailable() const override; 47 | bool open(OpenMode mode) override; 48 | 49 | protected: 50 | qint64 readData(char *data, qint64 maxlen) override; 51 | qint64 writeData(const char *data, qint64 len) override; 52 | 53 | private: 54 | boost::circular_buffer data_; 55 | mutable std::mutex mutex_; 56 | }; 57 | 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/autoapp/Service/MediaSource/MicrophoneMediaSourceService.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #include 20 | #include 21 | 22 | namespace f1x::openauto::autoapp::service::mediasource { 23 | MicrophoneMediaSourceService::MicrophoneMediaSourceService(boost::asio::io_service &ioService, 24 | aasdk::messenger::IMessenger::Pointer messenger, 25 | projection::IAudioInput::Pointer audioOutput) 26 | : MediaSourceService(ioService, 27 | std::make_shared(strand_, 28 | std::move( 29 | messenger)), 30 | std::move(audioOutput)) { 31 | 32 | } 33 | } 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/autoapp/Projection/VideoOutput.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #include 20 | #include 21 | 22 | namespace f1x { 23 | namespace openauto { 24 | namespace autoapp { 25 | namespace projection { 26 | 27 | VideoOutput::VideoOutput(configuration::IConfiguration::Pointer configuration) 28 | : configuration_(std::move(configuration)) { 29 | 30 | } 31 | 32 | aap_protobuf::service::media::sink::message::VideoFrameRateType VideoOutput::getVideoFPS() const { 33 | return configuration_->getVideoFPS(); 34 | } 35 | 36 | aap_protobuf::service::media::sink::message::VideoCodecResolutionType VideoOutput::getVideoResolution() const { 37 | return configuration_->getVideoResolution(); 38 | } 39 | 40 | size_t VideoOutput::getScreenDPI() const { 41 | return configuration_->getScreenDPI(); 42 | } 43 | 44 | QRect VideoOutput::getVideoMargins() const { 45 | return configuration_->getVideoMargins(); 46 | } 47 | 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /packaging/debian/postinst: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # * Project: OpenAuto 3 | # * This file is part of openauto project. 4 | # * Copyright (C) 2025 OpenCarDev Team 5 | # * 6 | # * openauto is free software: you can redistribute it and/or modify 7 | # * it under the terms of the GNU General Public License as published by 8 | # * the Free Software Foundation; either version 3 of the License, or 9 | # * (at your option) any later version. 10 | # * 11 | # * openauto is distributed in the hope that it will be useful, 12 | # * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # * GNU General Public License for more details. 15 | # * 16 | # * You should have received a copy of the GNU General Public License 17 | # * along with openauto. If not, see . 18 | 19 | set -e 20 | 21 | case "$1" in 22 | configure) 23 | # Reload udev rules 24 | if [ -x /bin/udevadm ]; then 25 | /bin/udevadm control --reload-rules || true 26 | /bin/udevadm trigger || true 27 | fi 28 | 29 | # Reload systemd daemon 30 | if [ -x /bin/systemctl ]; then 31 | /bin/systemctl daemon-reload || true 32 | fi 33 | 34 | # Enable but don't start services (user can start manually or on next boot) 35 | if [ -x /bin/systemctl ]; then 36 | /bin/systemctl enable openauto.service || true 37 | /bin/systemctl enable openauto-btservice.service || true 38 | fi 39 | 40 | echo "OpenAuto services enabled. Use 'systemctl start openauto' to start now." 41 | ;; 42 | 43 | abort-upgrade|abort-remove|abort-deconfigure) 44 | ;; 45 | 46 | *) 47 | echo "postinst called with unknown argument \`$1'" >&2 48 | exit 1 49 | ;; 50 | esac 51 | 52 | #DEBHELPER# 53 | 54 | exit 0 55 | -------------------------------------------------------------------------------- /src/autoapp/Service/MediaSink/VideoService.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #include 20 | #include 21 | 22 | namespace f1x { 23 | namespace openauto { 24 | namespace autoapp { 25 | namespace service { 26 | namespace mediasink { 27 | VideoService::VideoService(boost::asio::io_service &ioService, 28 | aasdk::messenger::IMessenger::Pointer messenger, 29 | projection::IVideoOutput::Pointer videoOutput) 30 | : VideoMediaSinkService(ioService, std::make_shared(strand_, 31 | std::move( 32 | messenger)), 33 | std::move(videoOutput)) { 34 | 35 | } 36 | } 37 | } 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Projection/InputEvent.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | namespace f1x 27 | { 28 | namespace openauto 29 | { 30 | namespace autoapp 31 | { 32 | namespace projection 33 | { 34 | 35 | enum class ButtonEventType 36 | { 37 | NONE, 38 | PRESS, 39 | RELEASE 40 | }; 41 | 42 | enum class WheelDirection 43 | { 44 | NONE, 45 | LEFT, 46 | RIGHT 47 | }; 48 | 49 | struct ButtonEvent 50 | { 51 | ButtonEventType type; 52 | WheelDirection wheelDirection; 53 | aap_protobuf::service::media::sink::message::KeyCode code; 54 | }; 55 | 56 | struct TouchPoint 57 | { 58 | uint32_t x; 59 | uint32_t y; 60 | uint32_t pointerId; 61 | }; 62 | 63 | struct TouchEvent 64 | { 65 | aap_protobuf::service::inputsource::message::PointerAction type; 66 | std::vector pointers; 67 | uint32_t actionIndex; // Index of the pointer that changed state 68 | }; 69 | 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/autoapp/Service/MediaSink/TelephonyAudioService.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #include 20 | #include 21 | 22 | namespace f1x { 23 | namespace openauto { 24 | namespace autoapp { 25 | namespace service { 26 | namespace mediasink { 27 | TelephonyAudioService::TelephonyAudioService(boost::asio::io_service &ioService, 28 | aasdk::messenger::IMessenger::Pointer messenger, 29 | projection::IAudioOutput::Pointer audioOutput) 30 | : AudioMediaSinkService(ioService, std::make_shared(strand_, 31 | std::move( 32 | messenger)), 33 | std::move(audioOutput)) { 34 | 35 | } 36 | } 37 | } 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Projection/LocalBluetoothDevice.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #pragma once 25 | 26 | namespace f1x::openauto::autoapp::projection 27 | { 28 | 29 | class LocalBluetoothDevice: public QObject, public IBluetoothDevice 30 | { 31 | Q_OBJECT 32 | 33 | public: 34 | LocalBluetoothDevice(const QString &adapterAddress = QString(), QObject *parent = nullptr); 35 | 36 | void stop() override; 37 | bool isPaired(const std::string& address) const override; 38 | std::string getAdapterAddress() const override; 39 | bool isAvailable() const override; 40 | 41 | private slots: 42 | void createBluetoothLocalDevice(const QString &adapterAddress); 43 | 44 | private: 45 | mutable std::mutex mutex_; 46 | std::unique_ptr localDevice_; 47 | PairingPromise::Pointer pairingPromise_; 48 | QBluetoothAddress pairingAddress_; 49 | QBluetoothServiceInfo serviceInfo_; 50 | std::unique_ptr rfcommServer_; 51 | 52 | }; 53 | 54 | } 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Projection/OMXVideoOutput.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #ifdef USE_OMX 20 | #pragma once 21 | 22 | extern "C" 23 | { 24 | #include 25 | } 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | namespace f1x 34 | { 35 | namespace openauto 36 | { 37 | namespace autoapp 38 | { 39 | namespace projection 40 | { 41 | 42 | class OMXVideoOutput: public VideoOutput 43 | { 44 | public: 45 | OMXVideoOutput(configuration::IConfiguration::Pointer configuration); 46 | 47 | bool open() override; 48 | bool init() override; 49 | void write(uint64_t timestamp, const aasdk::common::DataConstBuffer& buffer) override; 50 | void stop() override; 51 | 52 | private: 53 | bool createComponents(); 54 | bool initClock(); 55 | bool setupTunnels(); 56 | bool enablePortBuffers(); 57 | bool setupDisplayRegion(); 58 | 59 | std::mutex mutex_; 60 | bool isActive_; 61 | bool portSettingsChanged_; 62 | ILCLIENT_T* client_; 63 | COMPONENT_T* components_[5]; 64 | TUNNEL_T tunnels_[4]; 65 | }; 66 | 67 | } 68 | } 69 | } 70 | } 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Projection/IVideoOutput.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | namespace f1x 29 | { 30 | namespace openauto 31 | { 32 | namespace autoapp 33 | { 34 | namespace projection 35 | { 36 | 37 | class IVideoOutput 38 | { 39 | public: 40 | typedef std::shared_ptr Pointer; 41 | 42 | IVideoOutput() = default; 43 | virtual ~IVideoOutput() = default; 44 | 45 | virtual bool open() = 0; 46 | virtual bool init() = 0; 47 | virtual void write(aasdk::messenger::Timestamp::ValueType timestamp, const aasdk::common::DataConstBuffer& buffer) = 0; 48 | virtual void stop() = 0; 49 | 50 | virtual aap_protobuf::service::media::sink::message::VideoFrameRateType getVideoFPS() const = 0; 51 | virtual aap_protobuf::service::media::sink::message::VideoCodecResolutionType getVideoResolution() const = 0; 52 | virtual size_t getScreenDPI() const = 0; 53 | virtual QRect getVideoMargins() const = 0; 54 | 55 | }; 56 | 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/AndroidAutoEntityFactory.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | namespace f1x 28 | { 29 | namespace openauto 30 | { 31 | namespace autoapp 32 | { 33 | namespace service 34 | { 35 | 36 | class AndroidAutoEntityFactory: public IAndroidAutoEntityFactory 37 | { 38 | public: 39 | AndroidAutoEntityFactory(boost::asio::io_service& ioService, 40 | configuration::IConfiguration::Pointer configuration, 41 | IServiceFactory& serviceFactory); 42 | 43 | IAndroidAutoEntity::Pointer create(aasdk::usb::IAOAPDevice::Pointer aoapDevice) override; 44 | IAndroidAutoEntity::Pointer create(aasdk::tcp::ITCPEndpoint::Pointer tcpEndpoint) override; 45 | 46 | private: 47 | IAndroidAutoEntity::Pointer create(aasdk::transport::ITransport::Pointer transport); 48 | 49 | boost::asio::io_service& ioService_; 50 | configuration::IConfiguration::Pointer configuration_; 51 | IServiceFactory& serviceFactory_; 52 | }; 53 | 54 | } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/UI/ConnectDialog.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | namespace Ui { 11 | class ConnectDialog; 12 | } 13 | 14 | namespace f1x 15 | { 16 | namespace openauto 17 | { 18 | namespace autoapp 19 | { 20 | namespace ui 21 | { 22 | 23 | class ConnectDialog : public QDialog 24 | { 25 | Q_OBJECT 26 | 27 | public: 28 | explicit ConnectDialog(boost::asio::io_service& ioService, aasdk::tcp::ITCPWrapper& tcpWrapper, openauto::autoapp::configuration::IRecentAddressesList& recentAddressesList, QWidget *parent = nullptr); 29 | ~ConnectDialog() override; 30 | void autoconnect(); 31 | void loadClientList(); 32 | 33 | signals: 34 | void connectToDevice(const QString& ipAddress); 35 | void connectionSucceed(aasdk::tcp::ITCPEndpoint::SocketPointer socket, const std::string& ipAddress); 36 | void connectionFailed(const QString& message); 37 | 38 | private slots: 39 | void onConnectButtonClicked(); 40 | void onConnectionFailed(const QString& message); 41 | void onConnectionSucceed(aasdk::tcp::ITCPEndpoint::SocketPointer socket, const std::string& ipAddress); 42 | void onRecentAddressClicked(const QModelIndex& index); 43 | void onUpdateButtonClicked(); 44 | 45 | protected: 46 | void keyPressEvent(QKeyEvent *event); 47 | 48 | private: 49 | void insertIpAddress(const std::string& ipAddress); 50 | void loadRecentList(); 51 | void setControlsEnabledStatus(bool status); 52 | void connectHandler(const boost::system::error_code& ec, const std::string& ipAddress, aasdk::tcp::ITCPEndpoint::SocketPointer socket); 53 | 54 | boost::asio::io_service& ioService_; 55 | aasdk::tcp::ITCPWrapper& tcpWrapper_; 56 | openauto::autoapp::configuration::IRecentAddressesList& recentAddressesList_; 57 | Ui::ConnectDialog *ui_; 58 | QStringListModel recentAddressesModel_; 59 | }; 60 | 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /cmake_modules/Findgps.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of openauto project. 3 | # Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | # 5 | # openauto is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3 of the License, or 8 | # (at your option) any later version. 9 | 10 | # openauto is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with openauto. If not, see . 17 | # 18 | 19 | if (GPS_LIBRARIES AND GPS_INCLUDE_DIRS) 20 | # in cache already 21 | set(GPS_FOUND TRUE) 22 | else (GPS_LIBRARIES AND GPS_INCLUDE_DIRS) 23 | find_path(GPS_INCLUDE_DIR 24 | NAMES 25 | gps.h 26 | PATHS 27 | /usr/include 28 | /usr/local/include 29 | /opt/local/include 30 | /sw/include 31 | PATH_SUFFIXES 32 | gps 33 | ) 34 | 35 | find_library(GPS_LIBRARY 36 | NAMES 37 | gps 38 | PATHS 39 | /usr/lib 40 | /usr/local/lib 41 | /opt/local/lib 42 | /sw/lib 43 | ) 44 | 45 | set(GPS_INCLUDE_DIRS 46 | ${GPS_INCLUDE_DIR} 47 | ) 48 | set(GPS_LIBRARIES 49 | ${GPS_LIBRARY} 50 | ) 51 | 52 | if (GPS_INCLUDE_DIRS AND GPS_LIBRARIES) 53 | set(GPS_FOUND TRUE) 54 | endif (GPS_INCLUDE_DIRS AND GPS_LIBRARIES) 55 | 56 | if (GPS_FOUND) 57 | if (NOT gps_FIND_QUIETLY) 58 | message(STATUS "Found gps:") 59 | message(STATUS " - Includes: ${GPS_INCLUDE_DIRS}") 60 | message(STATUS " - Libraries: ${GPS_LIBRARIES}") 61 | endif (NOT gps_FIND_QUIETLY) 62 | else (GPS_FOUND) 63 | if (gps_FIND_REQUIRED) 64 | message(FATAL_ERROR "Could not find gps") 65 | endif (gps_FIND_REQUIRED) 66 | endif (GPS_FOUND) 67 | 68 | mark_as_advanced(GPS_INCLUDE_DIRS GPS_LIBRARIES) 69 | 70 | endif (GPS_LIBRARIES AND GPS_INCLUDE_DIRS) 71 | -------------------------------------------------------------------------------- /cmake_modules/Findaap_protobuf.cmake: -------------------------------------------------------------------------------- 1 | if (AAP_PROTOBUF_LIB_DIRS AND AAP_PROTOBUF_INCLUDE_DIRS) 2 | # in cache already 3 | message(STATUS "aap_protobuf is cached") 4 | set(AAP_PROTOBUF_FOUND TRUE) 5 | else (AAP_PROTOBUF_LIB_DIRS AND AAP_PROTOBUF_INCLUDE_DIRS) 6 | find_path(AAP_PROTOBUF_INCLUDE_DIR 7 | NAMES 8 | channel/control/GalConstants.pb.h 9 | PATHS 10 | /usr/include 11 | /usr/local/include 12 | /opt/local/include 13 | /sw/include 14 | PATH_SUFFIXES 15 | aap_protobuf 16 | ) 17 | 18 | find_library(AAP_PROTOBUF_LIB_DIR 19 | NAMES 20 | aap_protobuf libaap_protobuf 21 | PATHS 22 | /usr/lib 23 | /usr/local/lib 24 | /opt/local/lib 25 | /sw/lib 26 | ) 27 | 28 | set(AAP_PROTOBUF_INCLUDE_DIRS 29 | ${AAP_PROTOBUF_INCLUDE_DIR} 30 | ) 31 | set(AAP_PROTOBUF_LIB_DIRS 32 | ${AAP_PROTOBUF_LIB_DIR} 33 | ) 34 | 35 | if (AAP_PROTOBUF_INCLUDE_DIRS AND AAP_PROTOBUF_LIB_DIRS) 36 | set(AAP_PROTOBUF_FOUND TRUE) 37 | endif (AAP_PROTOBUF_INCLUDE_DIRS AND AAP_PROTOBUF_LIB_DIRS) 38 | 39 | if (AAP_PROTOBUF_FOUND) 40 | message(STATUS "SUCCESS. Found: aap_protobuf:") 41 | message(STATUS " - Includes: ${AAP_PROTOBUF_INCLUDE_DIRS}") 42 | message(STATUS " - Libraries: ${AAP_PROTOBUF_LIB_DIRS}") 43 | add_library(aap_protobuf INTERFACE) 44 | target_include_directories(aap_protobuf SYSTEM INTERFACE ${AAP_PROTOBUF_INCLUDE_DIR}) 45 | target_link_libraries(aap_protobuf INTERFACE ${AAP_PROTOBUF_LIB_DIR}) 46 | else (AAP_PROTOBUF_FOUND) 47 | message(STATUS " - Includes: ${AAP_PROTOBUF_INCLUDE_DIRS}") 48 | message(STATUS " - Libraries: ${AAP_PROTOBUF_LIB_DIRS}") 49 | message(FATAL_ERROR "Could not locate aap_protobuf") 50 | endif (AAP_PROTOBUF_FOUND) 51 | 52 | # show the AAP_PROTOBUF_INCLUDE_DIRS and AAP_PROTOBUF_LIB_DIRS variables only in the advanced view 53 | mark_as_advanced(AAP_PROTOBUF_INCLUDE_DIRS AAP_PROTOBUF_LIB_DIRS) 54 | 55 | endif (AAP_PROTOBUF_LIB_DIRS AND AAP_PROTOBUF_INCLUDE_DIRS) 56 | -------------------------------------------------------------------------------- /cmake_modules/Findblkid.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of openauto project. 3 | # Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | # 5 | # openauto is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3 of the License, or 8 | # (at your option) any later version. 9 | 10 | # openauto is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with openauto. If not, see . 17 | # 18 | 19 | if (BLKID_LIBRARIES AND BLKID_INCLUDE_DIRS) 20 | # in cache already 21 | set(BLKID_FOUND TRUE) 22 | else (BLKID_LIBRARIES AND BLKID_INCLUDE_DIRS) 23 | find_path(BLKID_INCLUDE_DIR 24 | NAMES 25 | blkid.h 26 | PATHS 27 | /usr/include 28 | /usr/local/include 29 | /opt/local/include 30 | /sw/include 31 | PATH_SUFFIXES 32 | blkid 33 | ) 34 | 35 | find_library(BLKID_LIBRARY 36 | NAMES 37 | blkid 38 | PATHS 39 | /usr/lib 40 | /usr/local/lib 41 | /opt/local/lib 42 | /sw/lib 43 | ) 44 | 45 | set(BLKID_INCLUDE_DIRS 46 | ${BLKID_INCLUDE_DIR} 47 | ) 48 | set(BLKID_LIBRARIES 49 | ${BLKID_LIBRARY} 50 | ) 51 | 52 | if (BLKID_INCLUDE_DIRS AND BLKID_LIBRARIES) 53 | set(BLKID_FOUND TRUE) 54 | endif (BLKID_INCLUDE_DIRS AND BLKID_LIBRARIES) 55 | 56 | if (BLKID_FOUND) 57 | if (NOT blkid_FIND_QUIETLY) 58 | message(STATUS "Found blkid:") 59 | message(STATUS " - Includes: ${BLKID_INCLUDE_DIRS}") 60 | message(STATUS " - Libraries: ${BLKID_LIBRARIES}") 61 | endif (NOT blkid_FIND_QUIETLY) 62 | else (BLKID_FOUND) 63 | if (blkid_FIND_REQUIRED) 64 | message(FATAL_ERROR "Could not find blkid") 65 | endif (blkid_FIND_REQUIRED) 66 | endif (BLKID_FOUND) 67 | 68 | mark_as_advanced(BLKID_INCLUDE_DIRS BLKID_LIBRARIES) 69 | 70 | endif (BLKID_LIBRARIES AND BLKID_INCLUDE_DIRS) 71 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Projection/QtAudioOutput.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | namespace f1x 27 | { 28 | namespace openauto 29 | { 30 | namespace autoapp 31 | { 32 | namespace projection 33 | { 34 | 35 | class QtAudioOutput: public QObject, public IAudioOutput 36 | { 37 | Q_OBJECT 38 | 39 | public: 40 | QtAudioOutput(uint32_t channelCount, uint32_t sampleSize, uint32_t sampleRate); 41 | bool open() override; 42 | void write(aasdk::messenger::Timestamp::ValueType, const aasdk::common::DataConstBuffer& buffer) override; 43 | void start() override; 44 | void stop() override; 45 | void suspend() override; 46 | uint32_t getSampleSize() const override; 47 | uint32_t getChannelCount() const override; 48 | uint32_t getSampleRate() const override; 49 | 50 | signals: 51 | void startPlayback(); 52 | void suspendPlayback(); 53 | void stopPlayback(); 54 | 55 | protected slots: 56 | void createAudioOutput(); 57 | void onStartPlayback(); 58 | void onSuspendPlayback(); 59 | void onStopPlayback(); 60 | 61 | private: 62 | QAudioFormat audioFormat_; 63 | QIODevice * audioBuffer_; 64 | std::unique_ptr audioOutput_; 65 | bool playbackStarted_; 66 | }; 67 | 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /cmake_modules/Findtaglib.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of openauto project. 3 | # Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | # 5 | # openauto is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3 of the License, or 8 | # (at your option) any later version. 9 | 10 | # openauto is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with openauto. If not, see . 17 | # 18 | 19 | if (TAGLIB_LIBRARIES AND TAGLIB_INCLUDE_DIRS) 20 | # in cache already 21 | set(TAGLIB_FOUND TRUE) 22 | else (TAGLIB_LIBRARIES AND TAGLIB_INCLUDE_DIRS) 23 | find_path(TAGLIB_INCLUDE_DIR 24 | NAMES 25 | taglib.h 26 | PATHS 27 | /usr/include 28 | /usr/local/include 29 | /opt/local/include 30 | /sw/include 31 | PATH_SUFFIXES 32 | taglib 33 | ) 34 | 35 | find_library(TAGLIB_LIBRARY 36 | NAMES 37 | tag taglib libtag 38 | PATHS 39 | /usr/lib 40 | /usr/local/lib 41 | /opt/local/lib 42 | /sw/lib 43 | ) 44 | 45 | set(TAGLIB_INCLUDE_DIRS 46 | ${TAGLIB_INCLUDE_DIR} 47 | ) 48 | set(TAGLIB_LIBRARIES 49 | ${TAGLIB_LIBRARY} -ltag 50 | ) 51 | 52 | if (TAGLIB_INCLUDE_DIRS AND TAGLIB_LIBRARIES) 53 | set(TAGLIB_FOUND TRUE) 54 | endif (TAGLIB_INCLUDE_DIRS AND TAGLIB_LIBRARIES) 55 | 56 | if (TAGLIB_FOUND) 57 | if (NOT taglib_FIND_QUIETLY) 58 | message(STATUS "Found taglib:") 59 | message(STATUS " - Includes: ${TAGLIB_INCLUDE_DIRS}") 60 | message(STATUS " - Libraries: ${TAGLIB_LIBRARIES}") 61 | endif (NOT taglib_FIND_QUIETLY) 62 | else (TAGLIB_FOUND) 63 | if (taglib_FIND_REQUIRED) 64 | message(FATAL_ERROR "Could not find taglib") 65 | endif (taglib_FIND_REQUIRED) 66 | endif (TAGLIB_FOUND) 67 | 68 | mark_as_advanced(TAGLIB_INCLUDE_DIRS TAGLIB_LIBRARIES) 69 | 70 | endif (TAGLIB_LIBRARIES AND TAGLIB_INCLUDE_DIRS) 71 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Projection/QtAudioInput.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | namespace f1x 27 | { 28 | namespace openauto 29 | { 30 | namespace autoapp 31 | { 32 | namespace projection 33 | { 34 | 35 | class QtAudioInput: public QObject, public IAudioInput 36 | { 37 | Q_OBJECT 38 | public: 39 | QtAudioInput(uint32_t channelCount, uint32_t sampleSize, uint32_t sampleRate); 40 | 41 | bool open() override; 42 | bool isActive() const override; 43 | void read(ReadPromise::Pointer promise) override; 44 | void start(StartPromise::Pointer promise) override; 45 | void stop() override; 46 | uint32_t getSampleSize() const override; 47 | uint32_t getChannelCount() const override; 48 | uint32_t getSampleRate() const override; 49 | 50 | signals: 51 | void startRecording(StartPromise::Pointer promise); 52 | void stopRecording(); 53 | 54 | private slots: 55 | void createAudioInput(); 56 | void onStartRecording(StartPromise::Pointer promise); 57 | void onStopRecording(); 58 | void onReadyRead(); 59 | 60 | private: 61 | QAudioFormat audioFormat_; 62 | QIODevice* ioDevice_; 63 | std::unique_ptr audioInput_; 64 | ReadPromise::Pointer readPromise_; 65 | mutable std::mutex mutex_; 66 | 67 | static constexpr size_t cSampleSize = 2056; 68 | }; 69 | 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /cmake_modules/Findrtaudio.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of openauto project. 3 | # Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | # 5 | # openauto is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3 of the License, or 8 | # (at your option) any later version. 9 | 10 | # openauto is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with openauto. If not, see . 17 | # 18 | 19 | if (RTAUDIO_LIBRARIES AND RTAUDIO_INCLUDE_DIRS) 20 | # in cache already 21 | set(RTAUDIO_FOUND TRUE) 22 | else (RTAUDIO_LIBRARIES AND RTAUDIO_INCLUDE_DIRS) 23 | find_path(RTAUDIO_INCLUDE_DIR 24 | NAMES 25 | RtAudio.h 26 | PATHS 27 | /usr/include 28 | /usr/local/include 29 | /opt/local/include 30 | /sw/include 31 | PATH_SUFFIXES 32 | rtaudio 33 | ) 34 | 35 | find_library(RTAUDIO_LIBRARY 36 | NAMES 37 | rtaudio 38 | PATHS 39 | /usr/lib 40 | /usr/local/lib 41 | /opt/local/lib 42 | /sw/lib 43 | ) 44 | 45 | set(RTAUDIO_INCLUDE_DIRS 46 | ${RTAUDIO_INCLUDE_DIR} 47 | ) 48 | set(RTAUDIO_LIBRARIES 49 | ${RTAUDIO_LIBRARY} 50 | ) 51 | 52 | if (RTAUDIO_INCLUDE_DIRS AND RTAUDIO_LIBRARIES) 53 | set(RTAUDIO_FOUND TRUE) 54 | endif (RTAUDIO_INCLUDE_DIRS AND RTAUDIO_LIBRARIES) 55 | 56 | if (RTAUDIO_FOUND) 57 | if (NOT rtaudio_FIND_QUIETLY) 58 | message(STATUS "Found rtaudio:") 59 | message(STATUS " - Includes: ${RTAUDIO_INCLUDE_DIRS}") 60 | message(STATUS " - Libraries: ${RTAUDIO_LIBRARIES}") 61 | endif (NOT rtaudio_FIND_QUIETLY) 62 | else (RTAUDIO_FOUND) 63 | if (rtaudio_FIND_REQUIRED) 64 | message(FATAL_ERROR "Could not find rtaudio") 65 | endif (rtaudio_FIND_REQUIRED) 66 | endif (RTAUDIO_FOUND) 67 | 68 | mark_as_advanced(RTAUDIO_INCLUDE_DIRS RTAUDIO_LIBRARIES) 69 | 70 | endif (RTAUDIO_LIBRARIES AND RTAUDIO_INCLUDE_DIRS) 71 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/VendorExtension/VendorExtensionService.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | 27 | namespace f1x::openauto::autoapp::service::vendorextension { 28 | 29 | class VendorExtensionService : 30 | public aasdk::channel::vendorextension::IVendorExtensionServiceEventHandler, 31 | public IService, 32 | public std::enable_shared_from_this { 33 | public: 34 | VendorExtensionService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger); 35 | 36 | void start() override; 37 | 38 | void stop() override; 39 | 40 | void pause() override; 41 | 42 | void resume() override; 43 | 44 | void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; 45 | 46 | void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; 47 | 48 | void onChannelError(const aasdk::error::Error &e) override; 49 | 50 | 51 | private: 52 | using std::enable_shared_from_this::shared_from_this; 53 | boost::asio::io_service::strand strand_; 54 | boost::asio::deadline_timer timer_; 55 | aasdk::channel::vendorextension::VendorExtensionService::Pointer channel_; 56 | }; 57 | 58 | } 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Projection/RtAudioOutput.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #if __has_include() 22 | # include 23 | #elif __has_include() 24 | # include 25 | #endif 26 | 27 | #include 28 | #include 29 | 30 | namespace f1x 31 | { 32 | namespace openauto 33 | { 34 | namespace autoapp 35 | { 36 | namespace projection 37 | { 38 | 39 | class RtAudioOutput: public IAudioOutput 40 | { 41 | public: 42 | RtAudioOutput(uint32_t channelCount, uint32_t sampleSize, uint32_t sampleRate); 43 | bool open() override; 44 | void write(aasdk::messenger::Timestamp::ValueType timestamp, const aasdk::common::DataConstBuffer& buffer) override; 45 | void start() override; 46 | void stop() override; 47 | void suspend() override; 48 | uint32_t getSampleSize() const override; 49 | uint32_t getChannelCount() const override; 50 | uint32_t getSampleRate() const override; 51 | 52 | private: 53 | void doSuspend(); 54 | static int audioBufferReadHandler(void* outputBuffer, void* inputBuffer, unsigned int nBufferFrames, 55 | double streamTime, RtAudioStreamStatus status, void* userData); 56 | 57 | uint32_t channelCount_; 58 | uint32_t sampleSize_; 59 | uint32_t sampleRate_; 60 | SequentialBuffer audioBuffer_; 61 | std::unique_ptr dac_; 62 | std::mutex mutex_; 63 | }; 64 | 65 | } 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/Radio/RadioService.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | namespace f1x { 27 | namespace openauto { 28 | namespace autoapp { 29 | namespace service { 30 | namespace radio { 31 | 32 | class RadioService : 33 | public aasdk::channel::radio::IRadioServiceEventHandler, 34 | public IService, 35 | public std::enable_shared_from_this { 36 | public: 37 | RadioService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger); 38 | 39 | void start() override; 40 | void stop() override; 41 | void pause() override; 42 | void resume() override; 43 | void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; 44 | 45 | void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; 46 | 47 | void onChannelError(const aasdk::error::Error &e) override; 48 | 49 | 50 | private: 51 | using std::enable_shared_from_this::shared_from_this; 52 | boost::asio::io_service::strand strand_; 53 | boost::asio::deadline_timer timer_; 54 | aasdk::channel::radio::RadioService::Pointer channel_; 55 | }; 56 | 57 | } 58 | } 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /docs/fix_summaries/touch_fix_summary.md: -------------------------------------------------------------------------------- 1 | []: # ```plaintext 2 | []: # * Project: OpenAuto 3 | []: # * This file is part of openauto project. 4 | []: # * Copyright (C) 2025 OpenCarDev Team 5 | []: # * 6 | []: # * openauto is free software: you can redistribute it and/or modify 7 | []: # * it under the terms of the GNU General Public License as published by 8 | []: # * the Free Software Foundation; either version 3 of the License, or 9 | []: # * (at your option) any later version. 10 | []: # * 11 | []: # * openauto is distributed in the hope that it will be useful, 12 | []: # * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | []: # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | []: # * GNU General Public License for more details. 15 | []: # * 16 | []: # * You should have received a copy of the GNU General Public License 17 | []: # * along with openauto. If not, see . 18 | []: # ``` 19 | # Touch Coordinate Misalignment Fix 20 | 21 | Date: 2025-11-13 22 | Commit: 410aa0e 23 | Branch: `develop` 24 | 25 | ## Problem 26 | AA video filled ~75% width on RPi 7" (800x480); touch targets horizontally offset. 27 | 28 | ## Root Cause 29 | `QVideoWidget::setFullScreen(true)` enforced aspect ratio despite `IgnoreAspectRatio`, shrinking usable width. Touch scaling assumed full physical width → mismatch. 30 | 31 | ## Solution 32 | Replaced fullscreen with explicit widget geometry: 33 | ```cpp 34 | QScreen* screen = QGuiApplication::primaryScreen(); 35 | if(screen) { 36 | videoWidget_->setGeometry(screen->geometry()); 37 | } else { 38 | videoWidget_->setFullScreen(true); // fallback 39 | } 40 | ``` 41 | Maintains `IgnoreAspectRatio` so AA content stretches to fill 800x480. 42 | 43 | ## Impact 44 | | Before | After | 45 | |--------|-------| 46 | | Video ~600x480 | Video 800x480 | 47 | | Touch at physical 75% hits wrong logical target | 1:1 alignment | 48 | | Visible offset | No offset | 49 | 50 | ## Testing 51 | 1. Tap buttons across width → direct hits. 52 | 2. Check logs for geometry line. 53 | 3. Validate multi-resolution (480p/720p/1080p) negotiation: alignment intact. 54 | 55 | ## Why Correct 56 | Widget now truly matches physical screen, eliminating need for compensation logic; simpler and robust across resolutions. 57 | 58 | ## Future Ideas 59 | - Optional aspect ratio preservation toggle. 60 | - Portrait/rotation support. 61 | - Configurable margins/padding. 62 | 63 | --- 64 | End of touch fix summary. -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Projection/QtVideoOutput.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | namespace f1x 29 | { 30 | namespace openauto 31 | { 32 | namespace autoapp 33 | { 34 | namespace projection 35 | { 36 | 37 | class QtVideoOutput: public QObject, public VideoOutput, boost::noncopyable 38 | { 39 | Q_OBJECT 40 | 41 | public: 42 | QtVideoOutput(configuration::IConfiguration::Pointer configuration); 43 | ~QtVideoOutput() override; 44 | bool open() override; 45 | bool init() override; 46 | void write(uint64_t timestamp, const aasdk::common::DataConstBuffer& buffer) override; 47 | void stop() override; 48 | 49 | signals: 50 | void startPlayback(); 51 | void stopPlayback(); 52 | 53 | protected slots: 54 | void createVideoOutput(); 55 | void onStartPlayback(); 56 | void onStopPlayback(); 57 | void onMediaStatusChanged(QMediaPlayer::MediaStatus status); 58 | void onStateChanged(QMediaPlayer::State state); 59 | void onError(QMediaPlayer::Error error); 60 | 61 | private: 62 | void cleanupPlayer(); 63 | SequentialBuffer videoBuffer_; 64 | std::unique_ptr videoWidget_; 65 | std::unique_ptr mediaPlayer_; 66 | bool playerReady_; 67 | bool initialBufferingDone_; 68 | size_t bytesWritten_; 69 | std::mutex writeMutex_; 70 | static constexpr size_t INITIAL_BUFFER_SIZE = 65536; // 64KB initial buffer before checking state 71 | }; 72 | 73 | } 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/PhoneStatus/PhoneStatusService.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | namespace f1x { 27 | namespace openauto { 28 | namespace autoapp { 29 | namespace service { 30 | namespace phonestatus { 31 | 32 | class PhoneStatusService : 33 | public aasdk::channel::phonestatus::IPhoneStatusServiceEventHandler, 34 | public IService, 35 | public std::enable_shared_from_this { 36 | public: 37 | PhoneStatusService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger); 38 | 39 | void start() override; 40 | void stop() override; 41 | void pause() override; 42 | void resume() override; 43 | void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; 44 | 45 | void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; 46 | 47 | void onChannelError(const aasdk::error::Error &e) override; 48 | 49 | 50 | private: 51 | using std::enable_shared_from_this::shared_from_this; 52 | boost::asio::io_service::strand strand_; 53 | boost::asio::deadline_timer timer_; 54 | aasdk::channel::phonestatus::PhoneStatusService::Pointer channel_; 55 | }; 56 | 57 | } 58 | } 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/MediaBrowser/MediaBrowserService.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | namespace f1x { 27 | namespace openauto { 28 | namespace autoapp { 29 | namespace service { 30 | namespace mediabrowser { 31 | 32 | class MediaBrowserService : 33 | public aasdk::channel::mediabrowser::IMediaBrowserServiceEventHandler, 34 | public IService, 35 | public std::enable_shared_from_this { 36 | public: 37 | MediaBrowserService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger); 38 | 39 | void start() override; 40 | void stop() override; 41 | void pause() override; 42 | void resume() override; 43 | void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; 44 | 45 | void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; 46 | 47 | void onChannelError(const aasdk::error::Error &e) override; 48 | 49 | 50 | private: 51 | using std::enable_shared_from_this::shared_from_this; 52 | boost::asio::io_service::strand strand_; 53 | boost::asio::deadline_timer timer_; 54 | aasdk::channel::mediabrowser::MediaBrowserService::Pointer channel_; 55 | }; 56 | 57 | } 58 | } 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Projection/InputDevice.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | namespace f1x 29 | { 30 | namespace openauto 31 | { 32 | namespace autoapp 33 | { 34 | namespace projection 35 | { 36 | 37 | class InputDevice: public QObject, public IInputDevice, boost::noncopyable 38 | { 39 | Q_OBJECT 40 | 41 | public: 42 | InputDevice(QObject& parent, configuration::IConfiguration::Pointer configuration, const QRect& touchscreenGeometry, const QRect& videoGeometry); 43 | 44 | void start(IInputDeviceEventHandler& eventHandler) override; 45 | void stop() override; 46 | ButtonCodes getSupportedButtonCodes() const override; 47 | bool eventFilter(QObject* obj, QEvent* event) override; 48 | bool hasTouchscreen() const override; 49 | QRect getTouchscreenGeometry() const override; 50 | 51 | private: 52 | void setVideoGeometry(); 53 | bool handleKeyEvent(QEvent* event, QKeyEvent* key); 54 | void dispatchKeyEvent(ButtonEvent event); 55 | bool handleTouchEvent(QEvent* event); 56 | bool handleMultiTouchEvent(QTouchEvent* touchEvent); 57 | void translateTouchPoint(const QTouchEvent::TouchPoint& qtPoint, TouchPoint& ourPoint); 58 | 59 | QObject& parent_; 60 | configuration::IConfiguration::Pointer configuration_; 61 | QRect touchscreenGeometry_; 62 | QRect displayGeometry_; 63 | IInputDeviceEventHandler* eventHandler_; 64 | std::mutex mutex_; 65 | std::map touchPointIdMap_; // Maps Qt touch IDs to our sequential IDs 66 | uint32_t nextTouchPointId_; 67 | }; 68 | 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/GenericNotification/GenericNotificationService.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | namespace f1x { 27 | namespace openauto { 28 | namespace autoapp { 29 | namespace service { 30 | namespace genericnotification { 31 | 32 | class GenericNotificationService : 33 | public aasdk::channel::genericnotification::IGenericNotificationServiceEventHandler, 34 | public IService, 35 | public std::enable_shared_from_this { 36 | public: 37 | GenericNotificationService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger); 38 | 39 | void start() override; 40 | void stop() override; 41 | void pause() override; 42 | void resume() override; 43 | void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; 44 | 45 | void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; 46 | 47 | void onChannelError(const aasdk::error::Error &e) override; 48 | 49 | 50 | private: 51 | using std::enable_shared_from_this::shared_from_this; 52 | boost::asio::io_service::strand strand_; 53 | boost::asio::deadline_timer timer_; 54 | aasdk::channel::genericnotification::GenericNotificationService::Pointer channel_; 55 | }; 56 | 57 | } 58 | } 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/MediaPlaybackStatus/MediaPlaybackStatusService.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | namespace f1x { 27 | namespace openauto { 28 | namespace autoapp { 29 | namespace service { 30 | namespace mediaplaybackstatus { 31 | 32 | class MediaPlaybackStatusService : 33 | public aasdk::channel::mediaplaybackstatus::IMediaPlaybackStatusServiceEventHandler, 34 | public IService, 35 | public std::enable_shared_from_this { 36 | public: 37 | MediaPlaybackStatusService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger); 38 | 39 | void start() override; 40 | void stop() override; 41 | void pause() override; 42 | void resume() override; 43 | void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; 44 | 45 | void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; 46 | 47 | void onChannelError(const aasdk::error::Error &e) override; 48 | 49 | 50 | private: 51 | using std::enable_shared_from_this::shared_from_this; 52 | boost::asio::io_service::strand strand_; 53 | boost::asio::deadline_timer timer_; 54 | aasdk::channel::mediaplaybackstatus::MediaPlaybackStatusService::Pointer channel_; 55 | }; 56 | 57 | } 58 | } 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/WifiProjection/WifiProjectionService.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | namespace f1x::openauto::autoapp::service::wifiprojection { 28 | 29 | class WifiProjectionService : 30 | public aasdk::channel::wifiprojection::IWifiProjectionServiceEventHandler, 31 | public IService, 32 | public std::enable_shared_from_this { 33 | public: 34 | WifiProjectionService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger, configuration::IConfiguration::Pointer configuration); 35 | 36 | void start() override; 37 | 38 | void stop() override; 39 | 40 | void pause() override; 41 | 42 | void resume() override; 43 | 44 | void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; 45 | 46 | void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; 47 | 48 | void onChannelError(const aasdk::error::Error &e) override; 49 | 50 | void 51 | onWifiCredentialsRequest( 52 | const aap_protobuf::service::wifiprojection::message::WifiCredentialsRequest &request) override; 53 | 54 | private: 55 | using std::enable_shared_from_this::shared_from_this; 56 | configuration::IConfiguration::Pointer configuration_; 57 | boost::asio::io_service::strand strand_; 58 | boost::asio::deadline_timer timer_; 59 | aasdk::channel::wifiprojection::WifiProjectionService::Pointer channel_; 60 | }; 61 | 62 | } 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5.1) 2 | 3 | # Google Test requires at least C++11 4 | set(CMAKE_CXX_STANDARD 17) 5 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 6 | 7 | # Locate GTest 8 | find_package(GTest REQUIRED) 9 | include_directories(${GTEST_INCLUDE_DIRS}) 10 | 11 | # Find required packages 12 | find_package(aasdk REQUIRED) 13 | find_package(Boost REQUIRED COMPONENTS system log program_options thread) 14 | find_package(Qt5 REQUIRED COMPONENTS Multimedia MultimediaWidgets Bluetooth Network) 15 | find_package(Protobuf REQUIRED) 16 | find_package(libusb-1.0 REQUIRED) 17 | find_package(rtaudio REQUIRED) 18 | find_package(aap_protobuf REQUIRED) 19 | 20 | # Include main project directories 21 | include_directories( 22 | ${CMAKE_SOURCE_DIR}/include 23 | ${aasdk_INCLUDE_DIRS} 24 | ${Boost_INCLUDE_DIRS} 25 | ${Qt5Multimedia_INCLUDE_DIRS} 26 | ${Qt5MultimediaWidgets_INCLUDE_DIRS} 27 | ${Qt5Bluetooth_INCLUDE_DIRS} 28 | ${Qt5Network_INCLUDE_DIRS} 29 | ${PROTOBUF_INCLUDE_DIRS} 30 | ${aap_protobuf_INCLUDE_DIRS} 31 | ${LIBUSB_1_INCLUDE_DIRS} 32 | ${RTAUDIO_INCLUDE_DIRS} 33 | ) 34 | 35 | # Add test executable 36 | add_executable(unit_tests 37 | unit/main.cpp 38 | unit/ConnectionTests.cpp 39 | unit/ProjectionTests.cpp 40 | unit/ServiceTests.cpp 41 | unit/ConfigurationTests.cpp 42 | ) 43 | 44 | add_executable(integration_tests 45 | integration/main.cpp 46 | integration/AndroidAutoIntegrationTests.cpp 47 | integration/BluetoothIntegrationTests.cpp 48 | integration/UIIntegrationTests.cpp 49 | ) 50 | 51 | # Link test executable against Google Test and main project libraries 52 | target_link_libraries(unit_tests 53 | ${GTEST_LIBRARIES} 54 | ${GTEST_MAIN_LIBRARIES} 55 | pthread 56 | openauto 57 | ${aasdk_LIBRARIES} 58 | ${Boost_LIBRARIES} 59 | ${Qt5Multimedia_LIBRARIES} 60 | ${Qt5MultimediaWidgets_LIBRARIES} 61 | ${Qt5Bluetooth_LIBRARIES} 62 | ${Qt5Network_LIBRARIES} 63 | ${PROTOBUF_LIBRARIES} 64 | ${LIBUSB_1_LIBRARIES} 65 | ${RTAUDIO_LIBRARIES} 66 | ${aap_protobuf_LIBRARIES} 67 | ) 68 | 69 | target_link_libraries(integration_tests 70 | ${GTEST_LIBRARIES} 71 | ${GTEST_MAIN_LIBRARIES} 72 | pthread 73 | openauto 74 | ${aasdk_LIBRARIES} 75 | ${Boost_LIBRARIES} 76 | ${Qt5Multimedia_LIBRARIES} 77 | ${Qt5MultimediaWidgets_LIBRARIES} 78 | ${Qt5Bluetooth_LIBRARIES} 79 | ${Qt5Network_LIBRARIES} 80 | ${PROTOBUF_LIBRARIES} 81 | ${LIBUSB_1_LIBRARIES} 82 | ${RTAUDIO_LIBRARIES} 83 | ${aap_protobuf_LIBRARIES} 84 | ) 85 | 86 | # Add tests to CTest 87 | add_test(NAME UnitTests COMMAND unit_tests) 88 | add_test(NAME IntegrationTests COMMAND integration_tests) -------------------------------------------------------------------------------- /src/autoapp/Projection/LocalBluetoothDevice.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | namespace f1x::openauto::autoapp::projection { 25 | 26 | LocalBluetoothDevice::LocalBluetoothDevice(const QString &adapterAddress, QObject *parent) : QObject(parent) { 27 | qRegisterMetaType("PairingPromise::Pointer"); 28 | 29 | this->moveToThread(QApplication::instance()->thread()); 30 | 31 | QMetaObject::invokeMethod(this, "createBluetoothLocalDevice", Qt::BlockingQueuedConnection, 32 | Q_ARG(QString, adapterAddress)); 33 | 34 | } 35 | 36 | void LocalBluetoothDevice::createBluetoothLocalDevice(const QString &adapterAddress) { 37 | OPENAUTO_LOG(info) << "[LocalBluetoothDevice] create."; 38 | 39 | 40 | QBluetoothAddress address(adapterAddress); 41 | localDevice_ = std::make_unique(address); 42 | 43 | // Pairing signals are being handled by btservice 44 | 45 | } 46 | 47 | void LocalBluetoothDevice::stop() { 48 | std::lock_guard lock(mutex_); 49 | 50 | } 51 | 52 | bool LocalBluetoothDevice::isPaired(const std::string &address) const { 53 | std::lock_guard lock(mutex_); 54 | 55 | return localDevice_->pairingStatus(QBluetoothAddress(QString::fromStdString(address))) != 56 | QBluetoothLocalDevice::Unpaired; 57 | } 58 | 59 | std::string LocalBluetoothDevice::getAdapterAddress() const { 60 | std::lock_guard lock(mutex_); 61 | return localDevice_->isValid() ? localDevice_->address().toString().toStdString() : ""; 62 | } 63 | 64 | bool LocalBluetoothDevice::isAvailable() const { 65 | std::lock_guard lock(mutex_); 66 | return localDevice_->isValid(); 67 | } 68 | } 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /include/f1x/openauto/btservice/AndroidBluetoothServer.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | 37 | namespace f1x::openauto::btservice { 38 | 39 | class AndroidBluetoothServer : public QObject, public IAndroidBluetoothServer { 40 | Q_OBJECT 41 | 42 | public: 43 | AndroidBluetoothServer(autoapp::configuration::IConfiguration::Pointer configuration); 44 | 45 | uint16_t start(const QBluetoothAddress &address) override; 46 | 47 | private slots: 48 | 49 | void onClientConnected(); 50 | void onError(QBluetoothServer::Error error); 51 | 52 | private: 53 | std::unique_ptr rfcommServer_; 54 | QBluetoothSocket *socket = nullptr; 55 | autoapp::configuration::IConfiguration::Pointer configuration_; 56 | 57 | void readSocket(); 58 | 59 | QByteArray buffer; 60 | 61 | void handleWifiInfoRequest(QByteArray &buffer, uint16_t length); 62 | 63 | void handleWifiVersionResponse(QByteArray &buffer, uint16_t length); 64 | 65 | void handleWifiConnectionStatus(QByteArray &buffer, uint16_t length); 66 | 67 | void handleWifiStartResponse(QByteArray &buffer, uint16_t length); 68 | 69 | void sendMessage(const google::protobuf::Message &message, uint16_t type); 70 | 71 | 72 | const ::std::string getIP4_(const QString intf); 73 | 74 | void DecodeProtoMessage(const std::string &proto_data); 75 | }; 76 | 77 | } 78 | 79 | 80 | -------------------------------------------------------------------------------- /src/autoapp/Service/Pinger.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #include 20 | #include 21 | 22 | namespace f1x::openauto::autoapp::service { 23 | 24 | Pinger::Pinger(boost::asio::io_service &ioService, time_t duration) 25 | : strand_(ioService), timer_(ioService), duration_(duration), cancelled_(false), pingsCount_(0), pongsCount_(0) { 26 | 27 | } 28 | 29 | void Pinger::ping(Promise::Pointer promise) { 30 | strand_.dispatch([this, self = this->shared_from_this(), promise = std::move(promise)]() mutable { 31 | cancelled_ = false; 32 | 33 | if (promise_ != nullptr) { 34 | promise_->reject(aasdk::error::Error(aasdk::error::ErrorCode::OPERATION_IN_PROGRESS)); 35 | } else { 36 | ++pingsCount_; 37 | OPENAUTO_LOG(debug) << "[Pinger] Ping counter: " << pingsCount_; 38 | 39 | promise_ = std::move(promise); 40 | timer_.expires_from_now(boost::posix_time::milliseconds(duration_)); 41 | timer_.async_wait( 42 | strand_.wrap(std::bind(&Pinger::onTimerExceeded, this->shared_from_this(), std::placeholders::_1))); 43 | } 44 | }); 45 | } 46 | 47 | void Pinger::pong() { 48 | strand_.dispatch([this, self = this->shared_from_this()]() { 49 | ++pongsCount_; 50 | OPENAUTO_LOG(debug) << "[Pinger] Pong counter: " << pongsCount_; 51 | }); 52 | } 53 | 54 | void Pinger::onTimerExceeded(const boost::system::error_code &error) { 55 | if (promise_ == nullptr) { 56 | return; 57 | } else if (error == boost::asio::error::operation_aborted || cancelled_) { 58 | promise_->reject(aasdk::error::Error(aasdk::error::ErrorCode::OPERATION_ABORTED)); 59 | } else if (pingsCount_ - pongsCount_ > 4) { 60 | promise_->reject(aasdk::error::Error()); 61 | } else { 62 | promise_->resolve(); 63 | } 64 | 65 | promise_.reset(); 66 | } 67 | 68 | void Pinger::cancel() { 69 | strand_.dispatch([this, self = this->shared_from_this()]() { 70 | cancelled_ = true; 71 | timer_.cancel(); 72 | }); 73 | } 74 | 75 | } 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /src/autoapp/Projection/SequentialBuffer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #include 20 | 21 | namespace f1x 22 | { 23 | namespace openauto 24 | { 25 | namespace autoapp 26 | { 27 | namespace projection 28 | { 29 | 30 | SequentialBuffer::SequentialBuffer() 31 | : data_(aasdk::common::cStaticDataSize) 32 | { 33 | } 34 | 35 | bool SequentialBuffer::isSequential() const 36 | { 37 | return true; 38 | } 39 | 40 | bool SequentialBuffer::open(OpenMode mode) 41 | { 42 | std::lock_guard lock(mutex_); 43 | 44 | return QIODevice::open(mode); 45 | } 46 | 47 | qint64 SequentialBuffer::readData(char *data, qint64 maxlen) 48 | { 49 | std::lock_guard lock(mutex_); 50 | 51 | if(data_.empty()) 52 | { 53 | return 0; 54 | } 55 | 56 | const auto len = std::min(maxlen, data_.size()); 57 | std::copy(data_.begin(), data_.begin() + len, data); 58 | data_.erase_begin(len); 59 | 60 | return len; 61 | } 62 | 63 | qint64 SequentialBuffer::writeData(const char *data, qint64 len) 64 | { 65 | std::lock_guard lock(mutex_); 66 | 67 | data_.insert(data_.end(), data, data + len); 68 | emit readyRead(); 69 | return len; 70 | } 71 | 72 | qint64 SequentialBuffer::size() const 73 | { 74 | return this->bytesAvailable(); 75 | } 76 | 77 | qint64 SequentialBuffer::pos() const 78 | { 79 | return 0; 80 | } 81 | 82 | 83 | bool SequentialBuffer::seek(qint64) 84 | { 85 | return false; 86 | } 87 | 88 | bool SequentialBuffer::atEnd() const 89 | { 90 | return false; 91 | } 92 | 93 | bool SequentialBuffer::reset() 94 | { 95 | data_.clear(); 96 | return true; 97 | } 98 | 99 | qint64 SequentialBuffer::bytesAvailable() const 100 | { 101 | std::lock_guard lock(mutex_); 102 | 103 | return QIODevice::bytesAvailable() + std::max(1, data_.size()); 104 | } 105 | 106 | bool SequentialBuffer::canReadLine() const 107 | { 108 | return true; 109 | } 110 | 111 | } 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/NavigationStatus/NavigationStatusService.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | namespace f1x { 27 | namespace openauto { 28 | namespace autoapp { 29 | namespace service { 30 | namespace navigationstatus { 31 | 32 | class NavigationStatusService : 33 | public aasdk::channel::navigationstatus::INavigationStatusServiceEventHandler, 34 | public IService, 35 | public std::enable_shared_from_this { 36 | public: 37 | NavigationStatusService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger); 38 | 39 | void start() override; 40 | void stop() override; 41 | void pause() override; 42 | void resume() override; 43 | void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; 44 | 45 | void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; 46 | 47 | void onChannelError(const aasdk::error::Error &e) override; 48 | 49 | void onStatusUpdate(const aap_protobuf::service::navigationstatus::message::NavigationStatus &navStatus) override; 50 | void onTurnEvent(const aap_protobuf::service::navigationstatus::message::NavigationNextTurnEvent &turnEvent) override; 51 | void onDistanceEvent(const aap_protobuf::service::navigationstatus::message::NavigationNextTurnDistanceEvent &distanceEvent) override; 52 | 53 | private: 54 | using std::enable_shared_from_this::shared_from_this; 55 | boost::asio::io_service::strand strand_; 56 | boost::asio::deadline_timer timer_; 57 | aasdk::channel::navigationstatus::NavigationStatusService::Pointer channel_; 58 | }; 59 | } 60 | } 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/Bluetooth/BluetoothService.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | namespace f1x { 26 | namespace openauto { 27 | namespace autoapp { 28 | namespace service { 29 | namespace bluetooth { 30 | 31 | class BluetoothService 32 | : public aasdk::channel::bluetooth::IBluetoothServiceEventHandler, 33 | public IService, 34 | public std::enable_shared_from_this { 35 | public: 36 | BluetoothService(boost::asio::io_service &ioService, 37 | aasdk::messenger::IMessenger::Pointer messenger, 38 | projection::IBluetoothDevice::Pointer bluetoothDevice); 39 | 40 | void start() override; 41 | void stop() override; 42 | void pause() override; 43 | void resume() override; 44 | void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; 45 | 46 | void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; 47 | 48 | void onBluetoothPairingRequest( 49 | const aap_protobuf::service::bluetooth::message::BluetoothPairingRequest &request) override; 50 | 51 | void onBluetoothAuthenticationResult(const aap_protobuf::service::bluetooth::message::BluetoothAuthenticationResult &request) override; 52 | 53 | void onChannelError(const aasdk::error::Error &e) override; 54 | 55 | 56 | private: 57 | using std::enable_shared_from_this::shared_from_this; 58 | 59 | void sendBluetoothAuthenticationData(); 60 | 61 | boost::asio::io_service::strand strand_; 62 | aasdk::channel::bluetooth::BluetoothService::Pointer channel_; 63 | projection::IBluetoothDevice::Pointer bluetoothDevice_; 64 | }; 65 | 66 | } 67 | } 68 | } 69 | } 70 | } -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/Sensor/SensorService.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | namespace f1x::openauto::autoapp::service::sensor { 32 | class SensorService : 33 | public aasdk::channel::sensorsource::ISensorSourceServiceEventHandler, 34 | public IService, 35 | public std::enable_shared_from_this { 36 | public: 37 | SensorService(boost::asio::io_service &ioService, 38 | aasdk::messenger::IMessenger::Pointer messenger); 39 | 40 | bool isNight = false; 41 | bool previous = false; 42 | std::atomic stopPolling{false}; 43 | 44 | void start() override; 45 | 46 | void stop() override; 47 | 48 | void pause() override; 49 | 50 | void resume() override; 51 | 52 | void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; 53 | 54 | void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; 55 | 56 | void onSensorStartRequest( 57 | const aap_protobuf::service::sensorsource::message::SensorRequest &request) override; 58 | 59 | void onChannelError(const aasdk::error::Error &e) override; 60 | 61 | private: 62 | using std::enable_shared_from_this::shared_from_this; 63 | 64 | void sendDrivingStatusUnrestricted(); 65 | 66 | void sendNightData(); 67 | 68 | void sendGPSLocationData(); 69 | 70 | bool is_file_exist(const char *filename); 71 | 72 | void sensorPolling(); 73 | 74 | bool firstRun = true; 75 | 76 | boost::asio::io_service::strand strand_; 77 | boost::asio::deadline_timer timer_; 78 | aasdk::channel::sensorsource::SensorSourceService::Pointer channel_; 79 | struct gps_data_t gpsData_; 80 | bool gpsEnabled_ = false; 81 | }; 82 | 83 | } 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/ServiceFactory.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | 24 | namespace f1x { 25 | namespace openauto { 26 | namespace autoapp { 27 | namespace service { 28 | 29 | class ServiceFactory : public IServiceFactory { 30 | public: 31 | ServiceFactory(boost::asio::io_service &ioService, configuration::IConfiguration::Pointer configuration); 32 | ServiceList create(aasdk::messenger::IMessenger::Pointer messenger) override; 33 | 34 | private: 35 | IService::Pointer createBluetoothService(aasdk::messenger::IMessenger::Pointer messenger); 36 | IService::Pointer createGenericNotificationService(aasdk::messenger::IMessenger::Pointer messenger); 37 | IService::Pointer createInputService(aasdk::messenger::IMessenger::Pointer messenger); 38 | IService::Pointer createMediaBrowserService(aasdk::messenger::IMessenger::Pointer messenger); 39 | IService::Pointer createMediaPlaybackStatusService(aasdk::messenger::IMessenger::Pointer messenger); 40 | 41 | void createMediaSinkServices(ServiceList &serviceList, aasdk::messenger::IMessenger::Pointer messenger); 42 | void createMediaSourceServices(ServiceList &serviceList, aasdk::messenger::IMessenger::Pointer messenger); 43 | 44 | IService::Pointer createNavigationStatusService(aasdk::messenger::IMessenger::Pointer messenger); 45 | IService::Pointer createPhoneStatusService(aasdk::messenger::IMessenger::Pointer messenger); 46 | IService::Pointer createRadioService(aasdk::messenger::IMessenger::Pointer messenger); 47 | IService::Pointer createSensorService(aasdk::messenger::IMessenger::Pointer messenger); 48 | IService::Pointer createVendorExtensionService(aasdk::messenger::IMessenger::Pointer messenger); 49 | IService::Pointer createWifiProjectionService(aasdk::messenger::IMessenger::Pointer messenger); 50 | 51 | boost::asio::io_service &ioService_; 52 | configuration::IConfiguration::Pointer configuration_; 53 | }; 54 | 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/App.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | namespace f1x 30 | { 31 | namespace openauto 32 | { 33 | namespace autoapp 34 | { 35 | 36 | class App: public service::IAndroidAutoEntityEventHandler, public std::enable_shared_from_this 37 | { 38 | public: 39 | typedef std::shared_ptr Pointer; 40 | 41 | App(boost::asio::io_service& ioService, aasdk::usb::USBWrapper& usbWrapper, aasdk::tcp::ITCPWrapper& tcpWrapper, service::IAndroidAutoEntityFactory& androidAutoEntityFactory, 42 | aasdk::usb::IUSBHub::Pointer usbHub, aasdk::usb::IConnectedAccessoriesEnumerator::Pointer connectedAccessoriesEnumerator); 43 | 44 | void waitForUSBDevice(); 45 | void start(aasdk::tcp::ITCPEndpoint::SocketPointer socket); 46 | void stop(); 47 | void pause(); 48 | void resume(); 49 | void onAndroidAutoQuit() override; 50 | bool disableAutostartEntity = false; 51 | 52 | private: 53 | using std::enable_shared_from_this::shared_from_this; 54 | void enumerateDevices(); 55 | void waitForDevice(); 56 | void aoapDeviceHandler(aasdk::usb::DeviceHandle deviceHandle); 57 | void onUSBHubError(const aasdk::error::Error& error); 58 | 59 | boost::asio::io_service& ioService_; 60 | aasdk::usb::USBWrapper& usbWrapper_; 61 | aasdk::tcp::ITCPWrapper& tcpWrapper_; 62 | boost::asio::io_service::strand strand_; 63 | service::IAndroidAutoEntityFactory& androidAutoEntityFactory_; 64 | aasdk::usb::IUSBHub::Pointer usbHub_; 65 | aasdk::usb::IConnectedAccessoriesEnumerator::Pointer connectedAccessoriesEnumerator_; 66 | boost::asio::ip::tcp::acceptor acceptor_; 67 | service::IAndroidAutoEntity::Pointer androidAutoEntity_; 68 | bool isStopped_; 69 | 70 | void startServerSocket(); 71 | 72 | void handleNewClient(std::shared_ptr socket, const boost::system::error_code &err); 73 | }; 74 | 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/InputSource/InputSourceService.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | namespace f1x { 28 | namespace openauto { 29 | namespace autoapp { 30 | namespace service { 31 | namespace inputsource { 32 | 33 | class InputSourceService : 34 | public aasdk::channel::inputsource::IInputSourceServiceEventHandler, 35 | public IService, 36 | public projection::IInputDeviceEventHandler, 37 | public std::enable_shared_from_this { 38 | public: 39 | InputSourceService(boost::asio::io_service &ioService, aasdk::messenger::IMessenger::Pointer messenger, 40 | projection::IInputDevice::Pointer inputDevice); 41 | 42 | void start() override; 43 | void stop() override; 44 | void pause() override; 45 | void resume() override; 46 | void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; 47 | 48 | 49 | void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; 50 | 51 | void onKeyBindingRequest(const aap_protobuf::service::media::sink::message::KeyBindingRequest &request) override; 52 | 53 | void onChannelError(const aasdk::error::Error &e) override; 54 | 55 | void onButtonEvent(const projection::ButtonEvent &event) override; 56 | 57 | void onTouchEvent(const projection::TouchEvent &event) override; 58 | 59 | private: 60 | using std::enable_shared_from_this::shared_from_this; 61 | 62 | boost::asio::io_service::strand strand_; 63 | aasdk::channel::inputsource::InputSourceService::Pointer channel_; 64 | projection::IInputDevice::Pointer inputDevice_; 65 | }; 66 | 67 | } 68 | } 69 | } 70 | } 71 | } -------------------------------------------------------------------------------- /packaging/opt/crankshaft/usb_action.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # * Project: OpenAuto 3 | # * This file is part of openauto project. 4 | # * Copyright (C) 2025 OpenCarDev Team 5 | # * 6 | # * openauto is free software: you can redistribute it and/or modify 7 | # * it under the terms of the GNU General Public License as published by 8 | # * the Free Software Foundation; either version 3 of the License, or 9 | # * (at your option) any later version. 10 | # * 11 | # * openauto is distributed in the hope that it will be useful, 12 | # * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # * GNU General Public License for more details. 15 | # * 16 | # * You should have received a copy of the GNU General Public License 17 | # * along with openauto. If not, see . 18 | 19 | # USB action script for Crankshaft 20 | # Handles addition and removal of Android devices 21 | 22 | # Load Crankshaft environment variables 23 | source /opt/crankshaft/bin/crankshaft_env.sh 24 | source /opt/crankshaft/bin/log_functions.sh 25 | 26 | addremove=$1 27 | model=$2 28 | usbpath=$3 29 | 30 | if [ $addremove == "add" ] && [ "$usbpath" != "" ]; then 31 | sleep 1 32 | echo $usbpath > /tmp/android_device 33 | echo $model >> /tmp/android_device 34 | echo "" > /dev/tty3 35 | echo "[${CYAN}${BOLD} INFO ${RESET}] *******************************************************" > /dev/tty3 36 | echo "[${CYAN}${BOLD} INFO ${RESET}] Device detected!" > /dev/tty3 37 | echo "[${CYAN}${BOLD} INFO ${RESET}] Model: $model" > /dev/tty3 38 | echo "[${CYAN}${BOLD} INFO ${RESET}] Path: $usbpath" > /dev/tty3 39 | echo "[${CYAN}${BOLD} INFO ${RESET}] *******************************************************" > /dev/tty3 40 | log_echo "Device detected - $usbpath - $model" 41 | /usr/local/bin/crankshaft timers stop 42 | fi 43 | 44 | if [ "$addremove" == "remove" ] && [ "$usbpath" != "" ]; then 45 | if [ -f /tmp/android_device ]; then 46 | CHECK=$(cat /tmp/android_device | grep $usbpath) 47 | if [ ! -z $CHECK ]; then 48 | sudo rm /tmp/android_device 49 | echo "" > /dev/tty3 50 | echo "[${RED}${BOLD} WARN ${RESET}] *******************************************************" > /dev/tty3 51 | echo "[${RED}${BOLD} WARN ${RESET}] Device removed!" > /dev/tty3 52 | echo "[${RED}${BOLD} WARN ${RESET}] Model: $model" > /dev/tty3 53 | echo "[${RED}${BOLD} WARN ${RESET}] Path: $usbpath" > /dev/tty3 54 | echo "[${RED}${BOLD} WARN ${RESET}] *******************************************************" > /dev/tty3 55 | log_echo "Device removed - $usbpath - $model" 56 | sleep 1 # relax time for failsafe while android phone is switching mode 57 | # while starting google auto 58 | if [ ! -f /tmp/dev_mode_enabled ] && [ ! -f /tmp/android_device ] && [ ! -f /tmp/aa_device ]; then 59 | log_echo "Start timers" 60 | /usr/local/bin/crankshaft timers start 61 | fi 62 | fi 63 | fi 64 | fi 65 | -------------------------------------------------------------------------------- /docs/fix_summaries/shutdown_fix_summary.md: -------------------------------------------------------------------------------- 1 | []: # ```plaintext 2 | []: # * Project: OpenAuto 3 | []: # * This file is part of openauto project. 4 | []: # * Copyright (C) 2025 OpenCarDev Team 5 | []: # * 6 | []: # * openauto is free software: you can redistribute it and/or modify 7 | []: # * it under the terms of the GNU General Public License as published by 8 | []: # * the Free Software Foundation; either version 3 of the License, or 9 | []: # * (at your option) any later version. 10 | []: # * 11 | []: # * openauto is distributed in the hope that it will be useful, 12 | []: # * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | []: # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | []: # * GNU General Public License for more details. 15 | []: # * 16 | []: # * You should have received a copy of the GNU General Public License 17 | []: # * along with openauto. If not, see . 18 | []: # ``` 19 | # Shutdown Freeze Fix 20 | 21 | Date: 2025-11-13 22 | Repos: `aasdk` & `openauto` 23 | Key Commits: aasdk `3365b08`; openauto `18a5bf3` `0dce201` `ac66df6` `8efec4b` `bf7f010` 24 | 25 | ## Symptoms 26 | - UI clock stops after AA exit 27 | - Infinite sensor polling 28 | - Flood of channel errors (code 30) 29 | - Cannot reconnect without restart 30 | - Occasional 90s systemd timeout 31 | 32 | ## Root Causes 33 | 1. Messenger promises left pending (cascade errors). 34 | 2. SensorService timer race rescheduling after stop. 35 | 3. Re-entrant quit due to channel errors mid-teardown. 36 | 4. Video output blocking (player stop + queued cleanup). 37 | 5. Late writes after playback stop. 38 | 39 | ## Solutions 40 | | Area | Fix | 41 | |------|-----| 42 | | Messenger | Reject pending send/receive with OPERATION_ABORTED | 43 | | AndroidAutoEntity | `stopping_` guard; ignore expected abort errors | 44 | | SensorService | Immediate timer cancellation; check flag before reschedule | 45 | | QtVideoOutput | Early `playerReady_` clear; mutex-protected writes; blocking connection; destructor cleanup | 46 | | Services | Uniform OPERATION_ABORTED handling → suppress noise | 47 | 48 | ## Result 49 | - Clean reconnect path 50 | - No runaway polling 51 | - Shutdown completes ~1s 52 | - Log noise reduced (debug-level abort lines only) 53 | 54 | ## Build & Deploy 55 | ```bash 56 | # aasdk first 57 | cd ~/aasdk && ./build.sh release clean && sudo dpkg -i build-release/*.deb 58 | # then openauto 59 | cd ~/openauto && ./build-packages.sh --release-only && sudo dpkg -i packages/*release*.deb 60 | sudo systemctl restart openauto 61 | ``` 62 | 63 | ## Expected Log Snippet 64 | ``` 65 | [AndroidAutoEntity] stop() 66 | [SensorService] stop() 67 | [VideoMediaSinkService] onChannelError(): OPERATION_ABORTED (expected during stop) 68 | [QtVideoOutput] onStopPlayback() complete 69 | ``` 70 | 71 | ## Rollback 72 | Revert both repos to previous stable commits if issues arise; they must stay in sync for consistent shutdown semantics. 73 | 74 | ## Future Improvements 75 | - Centralised cancellation abstraction for services 76 | - Timeout wrapper for media pipeline operations 77 | - Metrics on shutdown duration for regression detection 78 | 79 | --- 80 | End of shutdown fix summary. 81 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/MediaSource/MediaSourceService.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | namespace f1x 28 | { 29 | namespace openauto 30 | { 31 | namespace autoapp 32 | { 33 | namespace service 34 | { 35 | namespace mediasource { 36 | 37 | 38 | class MediaSourceService 39 | : public aasdk::channel::mediasource::IMediaSourceServiceEventHandler, 40 | public IService, 41 | public std::enable_shared_from_this { 42 | public: 43 | typedef std::shared_ptr Pointer; 44 | 45 | // General Constructor 46 | MediaSourceService(boost::asio::io_service& ioService, 47 | aasdk::channel::mediasource::IMediaSourceService::Pointer channel, projection::IAudioInput::Pointer audioInput); 48 | 49 | void start() override; 50 | 51 | void stop() override; 52 | 53 | void pause() override; 54 | 55 | void resume() override; 56 | 57 | void fillFeatures( 58 | aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; 59 | 60 | void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; 61 | 62 | void onMediaChannelSetupRequest( 63 | const aap_protobuf::service::media::shared::message::Setup &request) override; 64 | 65 | void onMediaSourceOpenRequest( 66 | const aap_protobuf::service::media::source::message::MicrophoneRequest &request) override; 67 | 68 | void onMediaChannelAckIndication( 69 | const aap_protobuf::service::media::source::message::Ack &indication) override; 70 | 71 | void onChannelError(const aasdk::error::Error &e) override; 72 | 73 | protected: 74 | using std::enable_shared_from_this::shared_from_this; 75 | 76 | void onMediaSourceOpenSuccess(); 77 | 78 | void onMediaSourceDataReady(aasdk::common::Data data); 79 | 80 | void readMediaSource(); 81 | 82 | boost::asio::io_service::strand strand_; 83 | aasdk::channel::mediasource::IMediaSourceService::Pointer channel_; 84 | projection::IAudioInput::Pointer audioInput_; 85 | int32_t session_; 86 | }; 87 | } 88 | } 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /src/btservice/AndroidBluetoothService.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #include 20 | #include 21 | 22 | namespace f1x::openauto::btservice { 23 | 24 | AndroidBluetoothService::AndroidBluetoothService() { 25 | OPENAUTO_LOG(info) << "[AndroidBluetoothService::AndroidBluetoothService] Initialising"; 26 | const QBluetoothUuid serviceUuid(QLatin1String("4de17a00-52cb-11e6-bdf4-0800200c9a66")); 27 | 28 | QBluetoothServiceInfo::Sequence classId; 29 | classId << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::SerialPort)); 30 | serviceInfo_.setAttribute(QBluetoothServiceInfo::BluetoothProfileDescriptorList, classId); 31 | classId.prepend(QVariant::fromValue(serviceUuid)); 32 | serviceInfo_.setAttribute(QBluetoothServiceInfo::ServiceClassIds, classId); 33 | serviceInfo_.setAttribute(QBluetoothServiceInfo::ServiceName, "OpenAuto Bluetooth Service"); 34 | serviceInfo_.setAttribute(QBluetoothServiceInfo::ServiceDescription, "AndroidAuto WiFi projection automatic setup"); 35 | serviceInfo_.setAttribute(QBluetoothServiceInfo::ServiceProvider, "f1xstudio.com"); 36 | serviceInfo_.setServiceUuid(serviceUuid); 37 | 38 | QBluetoothServiceInfo::Sequence publicBrowse; 39 | publicBrowse << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::PublicBrowseGroup)); 40 | serviceInfo_.setAttribute(QBluetoothServiceInfo::BrowseGroupList, publicBrowse); 41 | } 42 | 43 | bool AndroidBluetoothService::registerService(int16_t portNumber, const QBluetoothAddress &bluetoothAddress) { 44 | OPENAUTO_LOG(info) << "[AndroidBluetoothService::registerService] Registering Service"; 45 | 46 | QBluetoothServiceInfo::Sequence protocolDescriptorList; 47 | QBluetoothServiceInfo::Sequence protocol; 48 | protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::L2cap)); 49 | protocolDescriptorList.append(QVariant::fromValue(protocol)); 50 | protocol.clear(); 51 | protocol << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::Rfcomm)) 52 | << QVariant::fromValue(quint16(portNumber)); 53 | protocolDescriptorList.append(QVariant::fromValue(protocol)); 54 | serviceInfo_.setAttribute(QBluetoothServiceInfo::ProtocolDescriptorList, protocolDescriptorList); 55 | 56 | return serviceInfo_.registerService(bluetoothAddress); 57 | } 58 | 59 | bool AndroidBluetoothService::unregisterService() { 60 | OPENAUTO_LOG(info) << "[AndroidBluetoothService::unregisterService] Unregistering"; 61 | return serviceInfo_.unregisterService(); 62 | } 63 | 64 | } 65 | 66 | 67 | -------------------------------------------------------------------------------- /packaging/opt/crankshaft/crankshaft_system_env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # * Project: OpenAuto 3 | # * This file is part of openauto project. 4 | # * Copyright (C) 2025 OpenCarDev Team 5 | # * 6 | # * openauto is free software: you can redistribute it and/or modify 7 | # * it under the terms of the GNU General Public License as published by 8 | # * the Free Software Foundation; either version 3 of the License, or 9 | # * (at your option) any later version. 10 | # * 11 | # * openauto is distributed in the hope that it will be useful, 12 | # * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # * GNU General Public License for more details. 15 | # * 16 | # * You should have received a copy of the GNU General Public License 17 | # * along with openauto. If not, see . 18 | 19 | 20 | if [ -f /boot/crankshaft/crankshaft_env.sh ]; then 21 | source /boot/crankshaft/crankshaft_env.sh 22 | fi 23 | 24 | # colors 25 | RED=`tput setaf 1 -T xterm` 26 | GREEN=`tput setaf 2 -T xterm` 27 | YELLOW=`tput setaf 3 -T xterm` 28 | CYAN=`tput setaf 6 -T xterm` 29 | BLUE=`tput setaf 4 -T xterm` 30 | MAGENTA=`tput setaf 5 -T xterm` 31 | RESET=`tput sgr0 -T xterm && tput setaf 7 -T xterm` 32 | BOLD=`tput bold -T xterm` 33 | 34 | # set gpio default pin levels if global activated 35 | if [ ! -z $ENABLE_GPIO ]; then 36 | if [ $ENABLE_GPIO -eq 1 ]; then 37 | if [ $DEV_PIN -ne 0 ]; then 38 | sudo /usr/bin/gpio -g mode $DEV_PIN up 39 | fi 40 | if [ $INVERT_PIN -ne 0 ]; then 41 | sudo /usr/bin/gpio -g mode $INVERT_PIN up 42 | fi 43 | if [ $X11_PIN -ne 0 ]; then 44 | sudo /usr/bin/gpio -g mode $X11_PIN up 45 | fi 46 | else 47 | # make sure flag is correctly set if 48 | # ENABLE_GPIO is not set to 1 or missing 49 | # to prevent from errors 50 | ENABLE_GPIO=0 51 | fi 52 | fi 53 | 54 | # set predefined state for standalone gpio's 55 | if [ $REARCAM_PIN -ne 0 ]; then 56 | sudo /usr/bin/gpio -g mode $REARCAM_PIN up 57 | fi 58 | 59 | if [ $IGNITION_PIN -ne 0 ]; then 60 | sudo /usr/bin/gpio -g mode $IGNITION_PIN up 61 | fi 62 | 63 | if [ $DAYNIGHT_PIN -ne 0 ]; then 64 | sudo /usr/bin/gpio -g mode $DAYNIGHT_PIN up 65 | fi 66 | 67 | # callable functions 68 | show_clear_screen() { 69 | plymouth --hide-splash > /dev/null 2>&1 # hide the boot splash 70 | #sleep 1 71 | plymouth --hide-splash > /dev/null 2>&1 # hide the boot splash 72 | chvt 3 73 | printf "\033[2J" > /dev/tty3 # clear screen 74 | printf "\033[0;0H\n" > /dev/tty3 # Move to 0,0 75 | log_echo "Show Clear Screen" 76 | } 77 | 78 | show_screen() { 79 | plymouth --hide-splash > /dev/null 2>&1 # hide the boot splash 80 | #sleep 1 81 | plymouth --hide-splash > /dev/null 2>&1 # hide the boot splash 82 | chvt 3 83 | log_echo "Show Screen" 84 | } 85 | 86 | show_cursor() { 87 | setterm -cursor on > /dev/tty3 88 | setterm -blink on > /dev/tty3 89 | log_echo "Show Cursor" 90 | } 91 | 92 | hide_cursor() { 93 | setterm -cursor off > /dev/tty3 94 | setterm -blink off > /dev/tty3 95 | log_echo "Hide Cursor" 96 | } 97 | 98 | log_echo() { 99 | logger "SERV-LOGGER: --------------------------------------------------------------------" 100 | logger "SERV-LOGGER: Caller: $0" 101 | logger "SERV-LOGGER: $1" 102 | logger "SERV-LOGGER: --------------------------------------------------------------------" 103 | } 104 | -------------------------------------------------------------------------------- /include/f1x/openauto/autoapp/Service/MediaSink/AudioMediaSinkService.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #pragma once 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | namespace f1x { 27 | namespace openauto { 28 | namespace autoapp { 29 | namespace service { 30 | namespace mediasink { 31 | class AudioMediaSinkService : 32 | public aasdk::channel::mediasink::audio::IAudioMediaSinkServiceEventHandler, 33 | public IService, 34 | public std::enable_shared_from_this { 35 | public: 36 | typedef std::shared_ptr Pointer; 37 | 38 | // General Constructor 39 | AudioMediaSinkService(boost::asio::io_service& ioService, 40 | aasdk::channel::mediasink::audio::IAudioMediaSinkService::Pointer channel, 41 | projection::IAudioOutput::Pointer audioOutput); 42 | 43 | void start() override; 44 | void stop() override; 45 | void pause() override; 46 | void resume() override; 47 | void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; 48 | 49 | void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; 50 | 51 | void onMediaChannelSetupRequest( 52 | const aap_protobuf::service::media::shared::message::Setup &request) override; 53 | 54 | void onMediaChannelStartIndication( 55 | const aap_protobuf::service::media::shared::message::Start &indication) override; 56 | 57 | void onMediaChannelStopIndication( 58 | const aap_protobuf::service::media::shared::message::Stop &indication) override; 59 | 60 | void onMediaWithTimestampIndication(aasdk::messenger::Timestamp::ValueType timestamp, 61 | const aasdk::common::DataConstBuffer &buffer) override; 62 | 63 | void onMediaIndication(const aasdk::common::DataConstBuffer &buffer) override; 64 | 65 | void onChannelError(const aasdk::error::Error &e) override; 66 | 67 | protected: 68 | using std::enable_shared_from_this::shared_from_this; 69 | boost::asio::io_service::strand strand_; 70 | aasdk::channel::mediasink::audio::IAudioMediaSinkService::Pointer channel_; 71 | projection::IAudioOutput::Pointer audioOutput_; 72 | int32_t session_; 73 | }; 74 | } 75 | } 76 | } 77 | } 78 | } -------------------------------------------------------------------------------- /src/autoapp/Service/Radio/RadioService.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | namespace f1x::openauto::autoapp::service::radio { 25 | 26 | RadioService::RadioService(boost::asio::io_service &ioService, 27 | aasdk::messenger::IMessenger::Pointer messenger) 28 | : strand_(ioService), 29 | timer_(ioService), 30 | channel_(std::make_shared(strand_, std::move(messenger))) { 31 | 32 | } 33 | 34 | void RadioService::start() { 35 | strand_.dispatch([this, self = this->shared_from_this()]() { 36 | OPENAUTO_LOG(debug) << "[RadioService] start()"; 37 | }); 38 | } 39 | 40 | void RadioService::stop() { 41 | strand_.dispatch([this, self = this->shared_from_this()]() { 42 | OPENAUTO_LOG(debug) << "[RadioService] stop()"; 43 | }); 44 | } 45 | 46 | void RadioService::pause() { 47 | strand_.dispatch([this, self = this->shared_from_this()]() { 48 | OPENAUTO_LOG(debug) << "[RadioService] pause()"; 49 | }); 50 | } 51 | 52 | void RadioService::resume() { 53 | strand_.dispatch([this, self = this->shared_from_this()]() { 54 | OPENAUTO_LOG(debug) << "[RadioService] resume()"; 55 | }); 56 | } 57 | 58 | void RadioService::fillFeatures( 59 | aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { 60 | OPENAUTO_LOG(info) << "[RadioService] fillFeatures()"; 61 | 62 | auto *service = response.add_channels(); 63 | service->set_id(static_cast(channel_->getId())); 64 | 65 | auto *radio = service->mutable_radio_service(); 66 | (void)radio; // Suppress unused variable warning 67 | } 68 | 69 | void RadioService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { 70 | OPENAUTO_LOG(info) << "[RadioService] onChannelOpenRequest()"; 71 | OPENAUTO_LOG(debug) << "[RadioService] Channel Id: " << request.service_id() << ", Priority: " 72 | << request.priority(); 73 | 74 | 75 | aap_protobuf::service::control::message::ChannelOpenResponse response; 76 | const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; 77 | response.set_status(status); 78 | 79 | auto promise = aasdk::channel::SendPromise::defer(strand_); 80 | promise->then([]() {}, std::bind(&RadioService::onChannelError, this->shared_from_this(), 81 | std::placeholders::_1)); 82 | channel_->sendChannelOpenResponse(response, std::move(promise)); 83 | 84 | channel_->receive(this->shared_from_this()); 85 | } 86 | 87 | void RadioService::onChannelError(const aasdk::error::Error &e) { 88 | OPENAUTO_LOG(error) << "[RadioService] onChannelError(): " << e.what(); 89 | } 90 | 91 | 92 | } 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /src/autoapp/Configuration/RecentAddressesList.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of openauto project. 3 | * Copyright (C) 2018 f1x.studio (Michal Szwaj) 4 | * 5 | * openauto is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 3 of the License, or 8 | * (at your option) any later version. 9 | 10 | * openauto is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with openauto. If not, see . 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | namespace f1x 24 | { 25 | namespace openauto 26 | { 27 | namespace autoapp 28 | { 29 | namespace configuration 30 | { 31 | 32 | const std::string RecentAddressesList::cConfigFileName = "openauto_wifi_recent.ini"; 33 | const std::string RecentAddressesList::cRecentEntiresCount = "Recent.EntiresCount"; 34 | const std::string RecentAddressesList::cRecentEntryPrefix = "Recent.Entry_"; 35 | 36 | RecentAddressesList::RecentAddressesList(size_t maxListSize) 37 | : maxListSize_(maxListSize) 38 | { 39 | 40 | } 41 | 42 | void RecentAddressesList::read() 43 | { 44 | this->load(); 45 | } 46 | 47 | void RecentAddressesList::insertAddress(const std::string& address) 48 | { 49 | if(std::find(list_.begin(), list_.end(), address) != list_.end()) 50 | { 51 | return; 52 | } 53 | 54 | if(list_.size() >= maxListSize_) 55 | { 56 | list_.pop_back(); 57 | } 58 | 59 | list_.push_front(address); 60 | this->save(); 61 | } 62 | 63 | RecentAddressesList::RecentAddresses RecentAddressesList::getList() const 64 | { 65 | return list_; 66 | } 67 | 68 | void RecentAddressesList::load() 69 | { 70 | boost::property_tree::ptree iniConfig; 71 | 72 | try 73 | { 74 | boost::property_tree::ini_parser::read_ini(cConfigFileName, iniConfig); 75 | 76 | const auto listSize = std::min(maxListSize_, iniConfig.get(cRecentEntiresCount, 0)); 77 | 78 | for(size_t i = 0; i < listSize; ++i) 79 | { 80 | const auto key = cRecentEntryPrefix + std::to_string(i); 81 | const auto address = iniConfig.get(key, RecentAddresses::value_type()); 82 | 83 | if(!address.empty()) 84 | { 85 | list_.push_back(address); 86 | } 87 | } 88 | } 89 | catch(const boost::property_tree::ini_parser_error& e) 90 | { 91 | OPENAUTO_LOG(warning) << "[RecentAddressesList] failed to read configuration file: " << cConfigFileName 92 | << ", error: " << e.what() 93 | << ". Empty list will be used."; 94 | } 95 | } 96 | 97 | void RecentAddressesList::save() 98 | { 99 | boost::property_tree::ptree iniConfig; 100 | 101 | const auto entiresCount = std::min(maxListSize_, list_.size()); 102 | iniConfig.put(cRecentEntiresCount, entiresCount); 103 | 104 | for(size_t i = 0; i < entiresCount; ++i) 105 | { 106 | const auto key = cRecentEntryPrefix + std::to_string(i); 107 | iniConfig.put(key, list_.at(i)); 108 | } 109 | 110 | boost::property_tree::ini_parser::write_ini(cConfigFileName, iniConfig); 111 | } 112 | 113 | } 114 | } 115 | } 116 | } 117 | --------------------------------------------------------------------------------