├── .gitignore ├── CMakeLists.txt ├── Dockerfile ├── LICENSE ├── README.md ├── RELEASE.txt ├── assets ├── Roboto-Regular.ttf ├── aausb-hot.png ├── aawifi-hot.png ├── album-hot.png ├── back-hot.png ├── black.png ├── brightness-hot.png ├── bug-hot.png ├── camera-hot.png ├── coverlogo.png ├── cursor-hot.png ├── day-hot.png ├── eye-hot.png ├── home-hot.png ├── ico_info.png ├── ico_warning.png ├── journey.jpg ├── list-hot.png ├── lock-hot.png ├── mp3-hot.png ├── next-hot.png ├── nextbig-hot.png ├── night-hot.png ├── pause-hot.png ├── play-hot.png ├── player-hot.png ├── power-hot.png ├── prev-hot.png ├── prevbig-hot.png ├── rearcam-hot.png ├── reboot-hot.png ├── record-hot.png ├── recordactive-hot.png ├── resources.qrc ├── save-hot.png ├── settings-hot.png ├── skin-hot.png ├── sleep-hot.png ├── stop-hot.png ├── volume-hot.png └── wifi-hot.png ├── buildenv ├── Dockerfile ├── cross-compile.md ├── docker-compose.yml ├── entrypoint.sh ├── patch-libboost-log-deb.sh ├── pi_binaries │ └── .gitignore └── release │ └── .gitignore ├── cmake_modules ├── Findaap_protobuf.cmake ├── Findaasdk.cmake ├── Findblkid.cmake ├── Findgps.cmake ├── Findlibusb-1.0.cmake ├── Findrtaudio.cmake └── Findtaglib.cmake ├── code_of_conduct.md ├── include └── f1x │ └── openauto │ ├── Common │ └── Log.hpp │ ├── autoapp │ ├── App.hpp │ ├── Configuration │ │ ├── AudioOutputBackendType.hpp │ │ ├── BluetoothAdapterType.hpp │ │ ├── Configuration.hpp │ │ ├── HandednessOfTrafficType.hpp │ │ ├── IConfiguration.hpp │ │ ├── IRecentAddressesList.hpp │ │ └── RecentAddressesList.hpp │ ├── Projection │ │ ├── DummyBluetoothDevice.hpp │ │ ├── IAudioInput.hpp │ │ ├── IAudioOutput.hpp │ │ ├── IBluetoothDevice.hpp │ │ ├── IInputDevice.hpp │ │ ├── IInputDeviceEventHandler.hpp │ │ ├── IVideoOutput.hpp │ │ ├── InputDevice.hpp │ │ ├── InputEvent.hpp │ │ ├── LocalBluetoothDevice.hpp │ │ ├── OMXVideoOutput.hpp │ │ ├── QtAudioInput.hpp │ │ ├── QtAudioOutput.hpp │ │ ├── QtVideoOutput.hpp │ │ ├── RtAudioOutput.hpp │ │ ├── SequentialBuffer.hpp │ │ └── VideoOutput.hpp │ ├── Service │ │ ├── AndroidAutoEntity.hpp │ │ ├── AndroidAutoEntityFactory.hpp │ │ ├── Bluetooth │ │ │ └── BluetoothService.hpp │ │ ├── GenericNotification │ │ │ └── GenericNotificationService.hpp │ │ ├── IAndroidAutoEntity.hpp │ │ ├── IAndroidAutoEntityEventHandler.hpp │ │ ├── IAndroidAutoEntityFactory.hpp │ │ ├── IPinger.hpp │ │ ├── IService.hpp │ │ ├── IServiceFactory.hpp │ │ ├── InputSource │ │ │ └── InputSourceService.hpp │ │ ├── MediaBrowser │ │ │ └── MediaBrowserService.hpp │ │ ├── MediaPlaybackStatus │ │ │ └── MediaPlaybackStatusService.hpp │ │ ├── MediaSink │ │ │ ├── AudioMediaSinkService.hpp │ │ │ ├── GuidanceAudioService.hpp │ │ │ ├── MediaAudioService.hpp │ │ │ ├── SystemAudioService.hpp │ │ │ ├── TelephonyAudioService.hpp │ │ │ ├── VideoMediaSinkService.hpp │ │ │ └── VideoService.hpp │ │ ├── MediaSource │ │ │ ├── MediaSourceService.hpp │ │ │ └── MicrophoneMediaSourceService.hpp │ │ ├── NavigationStatus │ │ │ └── NavigationStatusService.hpp │ │ ├── PhoneStatus │ │ │ └── PhoneStatusService.hpp │ │ ├── Pinger.hpp │ │ ├── Radio │ │ │ └── RadioService.hpp │ │ ├── Sensor │ │ │ └── SensorService.hpp │ │ ├── Service.hpp │ │ ├── ServiceFactory.hpp │ │ ├── VendorExtension │ │ │ └── VendorExtensionService.hpp │ │ └── WifiProjection │ │ │ └── WifiProjectionService.hpp │ └── UI │ │ ├── ConnectDialog.hpp │ │ ├── MainWindow.hpp │ │ ├── SettingsWindow.hpp │ │ ├── UpdateDialog.hpp │ │ └── WarningDialog.hpp │ └── btservice │ ├── AndroidBluetoothServer.hpp │ ├── AndroidBluetoothService.hpp │ ├── BluetoothHandler.hpp │ ├── IAndroidBluetoothServer.hpp │ ├── IAndroidBluetoothService.hpp │ └── IBluetoothHandler.hpp └── src ├── autoapp ├── App.cpp ├── Configuration │ ├── Configuration.cpp │ └── RecentAddressesList.cpp ├── Projection │ ├── DummyBluetoothDevice.cpp │ ├── InputDevice.cpp │ ├── LocalBluetoothDevice.cpp │ ├── OMXVideoOutput.cpp │ ├── QtAudioInput.cpp │ ├── QtAudioOutput.cpp │ ├── QtVideoOutput.cpp │ ├── RtAudioOutput.cpp │ ├── SequentialBuffer.cpp │ └── VideoOutput.cpp ├── Service │ ├── AndroidAutoEntity.cpp │ ├── AndroidAutoEntityFactory.cpp │ ├── Bluetooth │ │ └── BluetoothService.cpp │ ├── GenericNotification │ │ └── GenericNotificationService.cpp │ ├── InputSource │ │ └── InputSourceService.cpp │ ├── MediaBrowser │ │ └── MediaBrowserService.cpp │ ├── MediaPlaybackStatus │ │ └── MediaPlaybackStatusService.cpp │ ├── MediaSink │ │ ├── AudioMediaSinkService.cpp │ │ ├── GuidanceAudioService.cpp │ │ ├── MediaAudioService.cpp │ │ ├── SystemAudioService.cpp │ │ ├── TelephonyAudioService.cpp │ │ ├── VideoMediaSinkService.cpp │ │ └── VideoService.cpp │ ├── MediaSource │ │ ├── MediaSourceService.cpp │ │ └── MicrophoneMediaSourceService.cpp │ ├── NavigationStatus │ │ └── NavigationStatusService.cpp │ ├── PhoneStatus │ │ └── PhoneStatusService.cpp │ ├── Pinger.cpp │ ├── Radio │ │ └── RadioService.cpp │ ├── Sensor │ │ └── SensorService.cpp │ ├── ServiceFactory.cpp │ ├── VendorExtension │ │ └── VendorExtensionService.cpp │ ├── WifiProjection │ │ └── WifiProjectionService.cpp │ └── WifiService.cpp ├── UI │ ├── ConnectDialog.cpp │ ├── MainWindow.cpp │ ├── SettingsWindow.cpp │ ├── UpdateDialog.cpp │ ├── WarningDialog.cpp │ ├── assets │ │ └── journey.jpg │ ├── connectdialog.ui │ ├── dialog.cpp │ ├── dialog.h │ ├── dialog.ui │ ├── mainwindow.ui │ ├── settingswindow.ui │ ├── updatedialog.ui │ └── warningdialog.ui └── autoapp.cpp └── btservice ├── AndroidBluetoothServer.cpp ├── AndroidBluetoothService.cpp ├── BluetoothHandler.cpp └── btservice.cpp /.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/ -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM scratch 2 | ADD rootfs.tar.xz / 3 | CMD ["bash"] -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # OpenAuto 3 | 4 | [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](code_of_conduct.md) 5 | 6 | ### Support project 7 | [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R4HXE5ESDR4U4) 8 | 9 | For support of other platforms please contact me at f1xstudiopl@gmail.com 10 | 11 | ### Community 12 | [![Join the chat at https://gitter.im/publiclab/publiclab](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/openauto_androidauto/Lobby) 13 | 14 | ### Description 15 | OpenAuto is an AndroidAuto(tm) headunit emulator based on aasdk library and Qt libraries. Main goal is to run this application on the RaspberryPI 3 board computer smoothly. 16 | 17 | [See demo video](https://www.youtube.com/watch?v=k9tKRqIkQs8) 18 | 19 | ### Supported functionalities 20 | - 480p, 720p and 1080p with 30 or 60 FPS 21 | - RaspberryPI 3 hardware acceleration support to decode video stream (up to 1080p@60!) 22 | - Audio playback from all audio channels (Media, System and Speech) 23 | - Audio input for voice commands 24 | - Touchscreen and buttons input 25 | - Bluetooth 26 | - Automatic launch after device hotplug 27 | - Automatic detection of connected Android devices 28 | - Wireless (WiFi) mode via head unit server (must be enabled in hidden developer settings) 29 | - User-friendly settings 30 | 31 | ### Supported platforms 32 | 33 | - Linux 34 | - RaspberryPI 3 35 | - Windows 36 | 37 | ### License 38 | GNU GPLv3 39 | 40 | Copyrights (c) 2018 f1x.studio (Michal Szwaj) 41 | 42 | *AndroidAuto is registered trademark of Google Inc.* 43 | 44 | ### Used software 45 | - [aasdk](https://github.com/f1xpl/aasdk) 46 | - [Boost libraries](http://www.boost.org/) 47 | - [Qt libraries](https://www.qt.io/) 48 | - [CMake](https://cmake.org/) 49 | - [RtAudio](https://www.music.mcgill.ca/~gary/rtaudio/playback.html) 50 | - Broadcom ilclient from RaspberryPI 3 firmware 51 | - OpenMAX IL API 52 | 53 | ### Building 54 | #### Amd64 55 | Install the packages specified in the [prebuilts](https://github.com/opencardev/prebuilts) repository. Qt5 is required, versions packaged in modern Ubuntu and Debian 56 | seem to work fine. 57 | 58 | You will also likely need to install the udev rules from `prebuilts` 59 | 60 | You need to point some CMAKE variables at your `aasdk` files. 61 | ```text 62 | -DAASDK_INCLUDE_DIRS=/include 63 | -DAASDK_LIBRARIES=/lib/libaasdk.so 64 | DAASDK_PROTO_INCLUDE_DIRS= 65 | -DAASDK_PROTO_LIBRARIES=/lib/libaasdk_proto.so 66 | ``` 67 | 68 | #### Raspberry Pi 69 | Just run the scripts in the `prebuilts` repository for `aasdk` and `openauto`. It is possible to cross compile if your raspberry pi is too slow to compile the code itself. 70 | However, its easiest to just develop on a more capable `amd64` device. 71 | 72 | ### Remarks 73 | **This software is not certified by Google Inc. It is created for R&D purposes and may not work as expected by the original authors. Do not use while driving. You use this software at your own risk.** 74 | -------------------------------------------------------------------------------- /RELEASE.txt: -------------------------------------------------------------------------------- 1 | Release Notes 2 | 3 | 20241124 - 4.1.0 - Bluetooth Updates 4 | * Rename BluetootAdapterType to BluetoothAdapterType, and change from NONE, LOCAL, REMOTE to NONE, LOCAL, EXTERNAL to better match available settings 5 | * getLocalAddress() on Dummy, Local and Remote bluetooth changed to getAdapterAddress() 6 | * Removed RemoteBluetoothDevice replacing all references with LocalBluetoothDevice. RemoteBluetoothDevice is a wrapper essentially with all pairing work handled by btservice. 7 | * Pairing overlaps between btservice and LocalBluetoothDevice - removed duplicated elements from LocalBluetoothDevice to rely on btservice. 8 | * Swap Bluetooth dropdown in Settings from none, builtin or external, to showing a list of detected Bluetooth Adapters. Write hardware address to config file. 9 | 10 | 20241121 - 4.0.0 - AAP 1.6 Support 11 | * Added support for new services provided by AASDK and AAP Protocol version 1.6. 12 | * Add extensive logging 13 | * Add logo for forked version 14 | * 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. 15 | 16 | -------------------------------------------------------------------------------- /assets/Roboto-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/Roboto-Regular.ttf -------------------------------------------------------------------------------- /assets/aausb-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/aausb-hot.png -------------------------------------------------------------------------------- /assets/aawifi-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/aawifi-hot.png -------------------------------------------------------------------------------- /assets/album-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/album-hot.png -------------------------------------------------------------------------------- /assets/back-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/back-hot.png -------------------------------------------------------------------------------- /assets/black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/black.png -------------------------------------------------------------------------------- /assets/brightness-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/brightness-hot.png -------------------------------------------------------------------------------- /assets/bug-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/bug-hot.png -------------------------------------------------------------------------------- /assets/camera-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/camera-hot.png -------------------------------------------------------------------------------- /assets/coverlogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/coverlogo.png -------------------------------------------------------------------------------- /assets/cursor-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/cursor-hot.png -------------------------------------------------------------------------------- /assets/day-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/day-hot.png -------------------------------------------------------------------------------- /assets/eye-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/eye-hot.png -------------------------------------------------------------------------------- /assets/home-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/home-hot.png -------------------------------------------------------------------------------- /assets/ico_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/ico_info.png -------------------------------------------------------------------------------- /assets/ico_warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/ico_warning.png -------------------------------------------------------------------------------- /assets/journey.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/journey.jpg -------------------------------------------------------------------------------- /assets/list-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/list-hot.png -------------------------------------------------------------------------------- /assets/lock-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/lock-hot.png -------------------------------------------------------------------------------- /assets/mp3-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/mp3-hot.png -------------------------------------------------------------------------------- /assets/next-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/next-hot.png -------------------------------------------------------------------------------- /assets/nextbig-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/nextbig-hot.png -------------------------------------------------------------------------------- /assets/night-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/night-hot.png -------------------------------------------------------------------------------- /assets/pause-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/pause-hot.png -------------------------------------------------------------------------------- /assets/play-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/play-hot.png -------------------------------------------------------------------------------- /assets/player-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/player-hot.png -------------------------------------------------------------------------------- /assets/power-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/power-hot.png -------------------------------------------------------------------------------- /assets/prev-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/prev-hot.png -------------------------------------------------------------------------------- /assets/prevbig-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/prevbig-hot.png -------------------------------------------------------------------------------- /assets/rearcam-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/rearcam-hot.png -------------------------------------------------------------------------------- /assets/reboot-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/reboot-hot.png -------------------------------------------------------------------------------- /assets/record-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/record-hot.png -------------------------------------------------------------------------------- /assets/recordactive-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/recordactive-hot.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /assets/save-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/save-hot.png -------------------------------------------------------------------------------- /assets/settings-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/settings-hot.png -------------------------------------------------------------------------------- /assets/skin-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/skin-hot.png -------------------------------------------------------------------------------- /assets/sleep-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/sleep-hot.png -------------------------------------------------------------------------------- /assets/stop-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/stop-hot.png -------------------------------------------------------------------------------- /assets/volume-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/volume-hot.png -------------------------------------------------------------------------------- /assets/wifi-hot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/assets/wifi-hot.png -------------------------------------------------------------------------------- /buildenv/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:buster AS prebuilts 2 | 3 | COPY ./buildenv/pi_binaries/buster.tar.gz buster.tar.gz 4 | COPY ./buildenv/pi_binaries/aasdk_armhf.deb aasdk_armhf.deb 5 | RUN apt-get update &&\ 6 | apt-get -y install cmake build-essential git zip &&\ 7 | git clone https://github.com/SonOfGib/prebuilts.git &&\ 8 | mkdir qt5 &&\ 9 | cat prebuilts/qt5/Qt_5151_armv7l_OpenGLES2.tar.xz* > Qt5_OpenGLES2.tar.xz 10 | 11 | 12 | FROM debian:buster AS openauto 13 | 14 | COPY --from=prebuilts Qt5_OpenGLES2.tar.xz Qt5_OpenGLES2.tar.xz 15 | COPY --from=prebuilts buster.tar.gz buster.tar.gz 16 | COPY --from=prebuilts aasdk_armhf.deb aasdk_armhf.deb 17 | 18 | RUN dpkg --add-architecture armhf &&\ 19 | apt-get update &&\ 20 | apt-get -y install cmake build-essential git &&\ 21 | apt-get -y install gcc-arm-linux-gnueabihf cpp-arm-linux-gnueabihf g++-arm-linux-gnueabihf protobuf-compiler &&\ 22 | apt-get -y install gcc-8-base:armhf libc6:armhf libgcc1:armhf libicu63:armhf libidn2-0:armhf libstdc++6:armhf libunistring2:armhf pulseaudio:armhf librtaudio-dev:armhf libgps-dev:armhf libblkid-dev:armhf libtag1-dev:armhf libgles2-mesa-dev:armhf libdouble-conversion-dev:armhf &&\ 23 | tar -xf Qt5_OpenGLES2.tar.xz -C / &&\ 24 | tar -xf buster.tar.gz -C / 25 | 26 | # These are all the libboost requirements. It would be shorter if libboost-log-dev wasn't a disaster that's being dealt with manually. 27 | RUN apt-get install -y libprotobuf-dev libusb-1.0.0-dev libssl-dev libboost-dev libboost-system-dev libboost-atomic1.67.0 libboost-chrono1.67.0 libboost-date-time1.67.0 libboost-filesystem1.67.0 libboost-regex1.67.0 libboost-thread1.67.0 libboost-filesystem1.67-dev libboost-thread1.67-dev libboost-date-time1.67-dev &&\ 28 | apt-get install -y libprotobuf-dev:armhf libusb-1.0.0-dev:armhf libssl-dev:armhf libboost-dev:armhf libboost-system-dev:armhf libboost-atomic1.67.0:armhf libboost-chrono1.67.0:armhf libboost-date-time1.67.0:armhf libboost-filesystem1.67.0:armhf libboost-regex1.67.0:armhf libboost-system1.67.0:armhf libboost-thread1.67.0:armhf libboost-filesystem1.67-dev:armhf libboost-thread1.67-dev:armhf libboost-date-time1.67-dev:armhf 29 | 30 | COPY / /src 31 | 32 | WORKDIR /src 33 | 34 | # Import resources 35 | COPY ./buildenv/patch-libboost-log-deb.sh /src/resources/patch-libboost-log-deb.sh 36 | COPY ./buildenv/entrypoint.sh /entrypoint.sh 37 | 38 | # Patch libboost-log-dev and install 39 | RUN chmod +x ./resources/patch-libboost-log-deb.sh 40 | RUN ./resources/patch-libboost-log-deb.sh 41 | 42 | # Make Executable 43 | RUN chmod +x /entrypoint.sh 44 | 45 | WORKDIR / 46 | RUN dpkg-deb -xv aasdk_armhf.deb / 47 | 48 | WORKDIR /src 49 | ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] -------------------------------------------------------------------------------- /buildenv/cross-compile.md: -------------------------------------------------------------------------------- 1 | ### RPI Cross Compile 2 | The docker image in this folder is intended to be used to cross compile `openauto` without having to configure your 3 | host pc with multiarch or installing a toolchain. 4 | 5 | #### Setup 6 | The `openauto` build for RPI3 requires some files from the PI, as well as aasdk libraries compiled for amrhf. 7 | 8 | - RPI files should be compressed to `buildenv/pi_binaries/buster.tar.gz`. The files required in the archive should 9 | match the path/files in the `if(RPI3_BUILD)` section of `CMakeLists.txt` 10 | - Copy the `.deb` file from `aasdk` docker cross compile build and place it in `buildenv/pi_binaries/aasdk_armhf.dev` 11 | #### Build 12 | ```bash 13 | cd buildenv 14 | sudo docker compose up --build 15 | ``` 16 | Binary files will then be available in `buildenv/release`. -------------------------------------------------------------------------------- /buildenv/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | openauto-build: 3 | build: 4 | context: ../ 5 | dockerfile: buildenv/Dockerfile 6 | volumes: 7 | - ./release/:/release/ -------------------------------------------------------------------------------- /buildenv/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Clear out the /build directory 4 | mkdir build; 5 | cd build; 6 | cmake -DCMAKE_BUILD_TYPE=Release -DRPI3_BUILD=true -DCROSS_COMPILE_ARMHF=true -DAASDK_INCLUDE_DIRS=/usr/include/aasdk -DAASDK_LIBRARIES=/usr/lib/libaasdk.so -DAASDK_PROTO_INCLUDE_DIRS=/usr/include/aasdk_proto -DAASDK_PROTO_LIBRARIES=/usr/lib/libaasdk_proto.so ../ 7 | make -j4 8 | cd ../bin 9 | 10 | # Move it to release 11 | rm -f /release/autoapp 12 | rm -f /release/btservice 13 | mv autoapp /release 14 | mv btservice /release -------------------------------------------------------------------------------- /buildenv/patch-libboost-log-deb.sh: -------------------------------------------------------------------------------- 1 | # All this because of a packaging bug in libboost-log-dev 2 | # 'Multi-Arch: same' is not present in the control file of Debian packages, all the way up to Sid 3 | # Rather than recompiling the parent libbost suite, download the 6 packages, extract, edit, and repackage. 4 | 5 | # https://bugs.debian.org/cgi-bin/pkgreport.cgi?package=libboost-log-dev 6 | 7 | apt-get -y install --download-only libboost-log-dev:amd64 libboost-log1.67.0:amd64 libboost-log1.67-dev:amd64 8 | apt-get -y install --download-only libboost-log-dev:armhf libboost-log1.67.0:armhf libboost-log1.67-dev:armhf 9 | 10 | mkdir -p /tmp/armhf/libboost-log-dev/ 11 | dpkg-deb -x /var/cache/apt/archives/libboost-log-dev_1.67.0.1_armhf.deb /tmp/armhf/libboost-log-dev/ 12 | dpkg-deb -e /var/cache/apt/archives/libboost-log-dev_1.67.0.1_armhf.deb /tmp/armhf/libboost-log-dev/DEBIAN/ 13 | sed -i '/^Priority: optional/a Multi-Arch: same' /tmp/armhf/libboost-log-dev/DEBIAN/control 14 | dpkg-deb -b /tmp/armhf/libboost-log-dev/ /tmp/libboost-log-dev_1.67.0.1_armhf.deb 15 | 16 | mkdir -p /tmp/amd64/libboost-log-dev/ 17 | dpkg-deb -x /var/cache/apt/archives/libboost-log-dev_1.67.0.1_amd64.deb /tmp/amd64/libboost-log-dev/ 18 | dpkg-deb -e /var/cache/apt/archives/libboost-log-dev_1.67.0.1_amd64.deb /tmp/amd64/libboost-log-dev/DEBIAN/ 19 | sed -i '/^Priority: optional/a Multi-Arch: same' /tmp/amd64/libboost-log-dev/DEBIAN/control 20 | dpkg-deb -b /tmp/amd64/libboost-log-dev/ /tmp/libboost-log-dev_1.67.0.1_amd64.deb 21 | 22 | mkdir -p /tmp/armhf/libboost-log1.67-dev/ 23 | dpkg-deb -x /var/cache/apt/archives/libboost-log1.67-dev_1.67.0-13+deb10u1_armhf.deb /tmp/armhf/libboost-log1.67-dev/ 24 | dpkg-deb -e /var/cache/apt/archives/libboost-log1.67-dev_1.67.0-13+deb10u1_armhf.deb /tmp/armhf/libboost-log1.67-dev/DEBIAN/ 25 | sed -i '/^Priority: optional/a Multi-Arch: same' /tmp/armhf/libboost-log1.67-dev/DEBIAN/control 26 | dpkg-deb -b /tmp/armhf/libboost-log1.67-dev/ /tmp/libboost-log1.67-dev_1.67.0-13+deb10u1_armhf.deb 27 | 28 | mkdir -p /tmp/amd64/libboost-log1.67-dev/ 29 | dpkg-deb -x /var/cache/apt/archives/libboost-log1.67-dev_1.67.0-13+deb10u1_amd64.deb /tmp/amd64/libboost-log1.67-dev/ 30 | dpkg-deb -e /var/cache/apt/archives/libboost-log1.67-dev_1.67.0-13+deb10u1_amd64.deb /tmp/amd64/libboost-log1.67-dev/DEBIAN/ 31 | sed -i '/^Priority: optional/a Multi-Arch: same' /tmp/amd64/libboost-log1.67-dev/DEBIAN/control 32 | dpkg-deb -b /tmp/amd64/libboost-log1.67-dev/ /tmp/libboost-log1.67-dev_1.67.0-13+deb10u1_amd64.deb 33 | 34 | mkdir -p /tmp/armhf/libboost-log1.67.0/ 35 | dpkg-deb -x /var/cache/apt/archives/libboost-log1.67.0_1.67.0-13+deb10u1_armhf.deb /tmp/armhf/libboost-log1.67.0/ 36 | dpkg-deb -e /var/cache/apt/archives/libboost-log1.67.0_1.67.0-13+deb10u1_armhf.deb /tmp/armhf/libboost-log1.67.0/DEBIAN/ 37 | sed -i '/^Priority: optional/a Multi-Arch: same' /tmp/armhf/libboost-log1.67.0/DEBIAN/control 38 | dpkg-deb -b /tmp/armhf/libboost-log1.67.0/ /tmp/libboost-log1.67.0_1.67.0-13+deb10u1_armhf.deb 39 | 40 | mkdir -p /tmp/amd64/libboost-log1.67.0/ 41 | dpkg-deb -x /var/cache/apt/archives/libboost-log1.67.0_1.67.0-13+deb10u1_amd64.deb /tmp/amd64/libboost-log1.67.0/ 42 | dpkg-deb -e /var/cache/apt/archives/libboost-log1.67.0_1.67.0-13+deb10u1_amd64.deb /tmp/amd64/libboost-log1.67.0/DEBIAN/ 43 | sed -i '/^Priority: optional/a Multi-Arch: same' /tmp/amd64/libboost-log1.67.0/DEBIAN/control 44 | dpkg-deb -b /tmp/amd64/libboost-log1.67.0/ /tmp/libboost-log1.67.0_1.67.0-13+deb10u1_amd64.deb 45 | 46 | dpkg -i /tmp/libboost*.deb -------------------------------------------------------------------------------- /buildenv/pi_binaries/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /buildenv/release/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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/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/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::ip::tcp::acceptor acceptor_; 63 | boost::asio::io_service::strand strand_; 64 | service::IAndroidAutoEntityFactory& androidAutoEntityFactory_; 65 | aasdk::usb::IUSBHub::Pointer usbHub_; 66 | aasdk::usb::IConnectedAccessoriesEnumerator::Pointer connectedAccessoriesEnumerator_; 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/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 | -------------------------------------------------------------------------------- /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/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/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/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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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/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 | -------------------------------------------------------------------------------- /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/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 | 26 | namespace f1x 27 | { 28 | namespace openauto 29 | { 30 | namespace autoapp 31 | { 32 | namespace projection 33 | { 34 | 35 | class InputDevice: public QObject, public IInputDevice, boost::noncopyable 36 | { 37 | Q_OBJECT 38 | 39 | public: 40 | InputDevice(QObject& parent, configuration::IConfiguration::Pointer configuration, const QRect& touchscreenGeometry, const QRect& videoGeometry); 41 | 42 | void start(IInputDeviceEventHandler& eventHandler) override; 43 | void stop() override; 44 | ButtonCodes getSupportedButtonCodes() const override; 45 | bool eventFilter(QObject* obj, QEvent* event) override; 46 | bool hasTouchscreen() const override; 47 | QRect getTouchscreenGeometry() const override; 48 | 49 | private: 50 | void setVideoGeometry(); 51 | bool handleKeyEvent(QEvent* event, QKeyEvent* key); 52 | void dispatchKeyEvent(ButtonEvent event); 53 | bool handleTouchEvent(QEvent* event); 54 | 55 | QObject& parent_; 56 | configuration::IConfiguration::Pointer configuration_; 57 | QRect touchscreenGeometry_; 58 | QRect displayGeometry_; 59 | IInputDeviceEventHandler* eventHandler_; 60 | std::mutex mutex_; 61 | }; 62 | 63 | } 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /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 | 25 | namespace f1x 26 | { 27 | namespace openauto 28 | { 29 | namespace autoapp 30 | { 31 | namespace projection 32 | { 33 | 34 | enum class ButtonEventType 35 | { 36 | NONE, 37 | PRESS, 38 | RELEASE 39 | }; 40 | 41 | enum class WheelDirection 42 | { 43 | NONE, 44 | LEFT, 45 | RIGHT 46 | }; 47 | 48 | struct ButtonEvent 49 | { 50 | ButtonEventType type; 51 | WheelDirection wheelDirection; 52 | aap_protobuf::service::media::sink::message::KeyCode code; 53 | }; 54 | 55 | struct TouchEvent 56 | { 57 | aap_protobuf::service::inputsource::message::PointerAction type; 58 | uint32_t x; 59 | uint32_t y; 60 | uint32_t pointerId; 61 | }; 62 | 63 | } 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | 27 | namespace f1x 28 | { 29 | namespace openauto 30 | { 31 | namespace autoapp 32 | { 33 | namespace projection 34 | { 35 | 36 | class QtVideoOutput: public QObject, public VideoOutput, boost::noncopyable 37 | { 38 | Q_OBJECT 39 | 40 | public: 41 | QtVideoOutput(configuration::IConfiguration::Pointer configuration); 42 | bool open() override; 43 | bool init() override; 44 | void write(uint64_t timestamp, const aasdk::common::DataConstBuffer& buffer) override; 45 | void stop() override; 46 | 47 | signals: 48 | void startPlayback(); 49 | void stopPlayback(); 50 | 51 | protected slots: 52 | void createVideoOutput(); 53 | void onStartPlayback(); 54 | void onStopPlayback(); 55 | 56 | private: 57 | SequentialBuffer videoBuffer_; 58 | std::unique_ptr videoWidget_; 59 | std::unique_ptr mediaPlayer_; 60 | }; 61 | 62 | } 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /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 | #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 RtAudioOutput: public IAudioOutput 35 | { 36 | public: 37 | RtAudioOutput(uint32_t channelCount, uint32_t sampleSize, uint32_t sampleRate); 38 | bool open() override; 39 | void write(aasdk::messenger::Timestamp::ValueType timestamp, const aasdk::common::DataConstBuffer& buffer) override; 40 | void start() override; 41 | void stop() override; 42 | void suspend() override; 43 | uint32_t getSampleSize() const override; 44 | uint32_t getChannelCount() const override; 45 | uint32_t getSampleRate() const override; 46 | 47 | private: 48 | void doSuspend(); 49 | static int audioBufferReadHandler(void* outputBuffer, void* inputBuffer, unsigned int nBufferFrames, 50 | double streamTime, RtAudioStreamStatus status, void* userData); 51 | 52 | uint32_t channelCount_; 53 | uint32_t sampleSize_; 54 | uint32_t sampleRate_; 55 | SequentialBuffer audioBuffer_; 56 | std::unique_ptr dac_; 57 | std::mutex mutex_; 58 | }; 59 | 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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/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::deadline_timer timer_; 53 | boost::asio::io_service::strand strand_; 54 | aasdk::channel::genericnotification::GenericNotificationService::Pointer channel_; 55 | }; 56 | 57 | } 58 | } 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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/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/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 | -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /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::deadline_timer timer_; 53 | boost::asio::io_service::strand strand_; 54 | aasdk::channel::mediabrowser::MediaBrowserService::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::deadline_timer timer_; 53 | boost::asio::io_service::strand strand_; 54 | aasdk::channel::mediaplaybackstatus::MediaPlaybackStatusService::Pointer channel_; 55 | }; 56 | 57 | } 58 | } 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /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/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 | } -------------------------------------------------------------------------------- /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/Service/MediaSink/VideoMediaSinkService.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 mediasink { 32 | 33 | class VideoMediaSinkService : 34 | public aasdk::channel::mediasink::video::IVideoMediaSinkServiceEventHandler, 35 | public IService, 36 | public std::enable_shared_from_this { 37 | public: 38 | typedef std::shared_ptr Pointer; 39 | 40 | // General Constructor 41 | VideoMediaSinkService(boost::asio::io_service& ioService, 42 | aasdk::channel::mediasink::video::IVideoMediaSinkService::Pointer channel, 43 | projection::IVideoOutput::Pointer videoOutput); 44 | 45 | void start() override; 46 | void stop() override; 47 | void pause() override; 48 | void resume() override; 49 | void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; 50 | 51 | void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; 52 | 53 | void onMediaChannelSetupRequest( 54 | const aap_protobuf::service::media::shared::message::Setup &request) override; 55 | 56 | void onMediaChannelStartIndication( 57 | const aap_protobuf::service::media::shared::message::Start &indication) override; 58 | 59 | void onMediaChannelStopIndication( 60 | const aap_protobuf::service::media::shared::message::Stop &indication) override; 61 | 62 | void onMediaWithTimestampIndication(aasdk::messenger::Timestamp::ValueType timestamp, 63 | const aasdk::common::DataConstBuffer &buffer) override; 64 | 65 | void onMediaIndication(const aasdk::common::DataConstBuffer &buffer) override; 66 | 67 | void onChannelError(const aasdk::error::Error &e) override; 68 | 69 | void onVideoFocusRequest(const aap_protobuf::service::media::video::message::VideoFocusRequestNotification &request) override; 70 | void sendVideoFocusIndication(); 71 | protected: 72 | using std::enable_shared_from_this::shared_from_this; 73 | boost::asio::io_service::strand strand_; 74 | aasdk::channel::mediasink::video::IVideoMediaSinkService::Pointer channel_; 75 | projection::IVideoOutput::Pointer videoOutput_; 76 | int32_t session_; 77 | }; 78 | } 79 | } 80 | } 81 | } 82 | } -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /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::deadline_timer timer_; 56 | boost::asio::io_service::strand strand_; 57 | aasdk::channel::navigationstatus::NavigationStatusService::Pointer channel_; 58 | }; 59 | } 60 | } 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /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::deadline_timer timer_; 53 | boost::asio::io_service::strand strand_; 54 | aasdk::channel::phonestatus::PhoneStatusService::Pointer channel_; 55 | }; 56 | 57 | } 58 | } 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /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/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::deadline_timer timer_; 53 | boost::asio::io_service::strand strand_; 54 | aasdk::channel::radio::RadioService::Pointer channel_; 55 | }; 56 | 57 | } 58 | } 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /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 | 29 | 30 | namespace f1x::openauto::autoapp::service::sensor { 31 | class SensorService : 32 | public aasdk::channel::sensorsource::ISensorSourceServiceEventHandler, 33 | public IService, 34 | public std::enable_shared_from_this { 35 | public: 36 | SensorService(boost::asio::io_service &ioService, 37 | aasdk::messenger::IMessenger::Pointer messenger); 38 | 39 | bool isNight = false; 40 | bool previous = false; 41 | bool stopPolling = false; 42 | 43 | void start() override; 44 | 45 | void stop() override; 46 | 47 | void pause() override; 48 | 49 | void resume() override; 50 | 51 | void fillFeatures(aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) override; 52 | 53 | void onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) override; 54 | 55 | void onSensorStartRequest( 56 | const aap_protobuf::service::sensorsource::message::SensorRequest &request) override; 57 | 58 | void onChannelError(const aasdk::error::Error &e) override; 59 | 60 | private: 61 | using std::enable_shared_from_this::shared_from_this; 62 | 63 | void sendDrivingStatusUnrestricted(); 64 | 65 | void sendNightData(); 66 | 67 | void sendGPSLocationData(); 68 | 69 | bool is_file_exist(const char *filename); 70 | 71 | void sensorPolling(); 72 | 73 | bool firstRun = true; 74 | 75 | boost::asio::deadline_timer timer_; 76 | boost::asio::io_service::strand strand_; 77 | aasdk::channel::sensorsource::SensorSourceService::Pointer channel_; 78 | struct gps_data_t gpsData_; 79 | bool gpsEnabled_ = false; 80 | }; 81 | 82 | } 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /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/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/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::deadline_timer timer_; 54 | boost::asio::io_service::strand strand_; 55 | aasdk::channel::vendorextension::VendorExtensionService::Pointer channel_; 56 | }; 57 | 58 | } 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /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::deadline_timer timer_; 58 | boost::asio::io_service::strand strand_; 59 | aasdk::channel::wifiprojection::WifiProjectionService::Pointer channel_; 60 | }; 61 | 62 | } 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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/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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /src/autoapp/Projection/QtAudioOutput.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 25 | { 26 | namespace openauto 27 | { 28 | namespace autoapp 29 | { 30 | namespace projection 31 | { 32 | 33 | QtAudioOutput::QtAudioOutput(uint32_t channelCount, uint32_t sampleSize, uint32_t sampleRate) 34 | : audioBuffer_(nullptr) 35 | , playbackStarted_(false) 36 | { 37 | audioFormat_.setChannelCount(channelCount); 38 | audioFormat_.setSampleRate(sampleRate); 39 | audioFormat_.setSampleSize(sampleSize); 40 | audioFormat_.setCodec("audio/pcm"); 41 | audioFormat_.setByteOrder(QAudioFormat::LittleEndian); 42 | audioFormat_.setSampleType(QAudioFormat::SignedInt); 43 | 44 | QThread * th = QApplication::instance()->thread(); 45 | this->moveToThread(th); 46 | th->setPriority(QThread::TimeCriticalPriority); 47 | 48 | connect(this, &QtAudioOutput::startPlayback, this, &QtAudioOutput::onStartPlayback); 49 | connect(this, &QtAudioOutput::suspendPlayback, this, &QtAudioOutput::onSuspendPlayback); 50 | connect(this, &QtAudioOutput::stopPlayback, this, &QtAudioOutput::onStopPlayback); 51 | 52 | QMetaObject::invokeMethod(this, "createAudioOutput", Qt::BlockingQueuedConnection); 53 | } 54 | 55 | void QtAudioOutput::createAudioOutput() 56 | { 57 | OPENAUTO_LOG(info) << "[QtAudioOutput] createAudioOutput()"; 58 | audioOutput_ = std::make_unique(QAudioDeviceInfo::defaultOutputDevice(), audioFormat_); 59 | } 60 | 61 | bool QtAudioOutput::open() 62 | { 63 | return true; 64 | } 65 | 66 | void QtAudioOutput::write(aasdk::messenger::Timestamp::ValueType, const aasdk::common::DataConstBuffer& buffer) 67 | { 68 | if (audioBuffer_ != nullptr) 69 | { 70 | audioBuffer_->write(reinterpret_cast(buffer.cdata), buffer.size); 71 | } 72 | } 73 | 74 | void QtAudioOutput::start() 75 | { 76 | emit startPlayback(); 77 | } 78 | 79 | void QtAudioOutput::stop() 80 | { 81 | emit stopPlayback(); 82 | } 83 | 84 | void QtAudioOutput::suspend() 85 | { 86 | emit suspendPlayback(); 87 | } 88 | 89 | uint32_t QtAudioOutput::getSampleSize() const 90 | { 91 | return audioFormat_.sampleSize(); 92 | } 93 | 94 | uint32_t QtAudioOutput::getChannelCount() const 95 | { 96 | return audioFormat_.channelCount(); 97 | } 98 | 99 | uint32_t QtAudioOutput::getSampleRate() const 100 | { 101 | return audioFormat_.sampleRate(); 102 | } 103 | 104 | void QtAudioOutput::onStartPlayback() 105 | { 106 | if(!playbackStarted_) 107 | { 108 | audioBuffer_ = audioOutput_->start(); 109 | playbackStarted_ = true; 110 | } 111 | else 112 | { 113 | audioOutput_->resume(); 114 | } 115 | } 116 | 117 | void QtAudioOutput::onSuspendPlayback() 118 | { 119 | audioOutput_->suspend(); 120 | } 121 | 122 | void QtAudioOutput::onStopPlayback() 123 | { 124 | if(playbackStarted_) 125 | { 126 | audioOutput_->stop(); 127 | playbackStarted_ = false; 128 | } 129 | } 130 | 131 | } 132 | } 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /src/autoapp/Projection/QtVideoOutput.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 projection 30 | { 31 | 32 | QtVideoOutput::QtVideoOutput(configuration::IConfiguration::Pointer configuration) 33 | : VideoOutput(std::move(configuration)) 34 | { 35 | this->moveToThread(QApplication::instance()->thread()); 36 | connect(this, &QtVideoOutput::startPlayback, this, &QtVideoOutput::onStartPlayback, Qt::QueuedConnection); 37 | connect(this, &QtVideoOutput::stopPlayback, this, &QtVideoOutput::onStopPlayback, Qt::QueuedConnection); 38 | QMetaObject::invokeMethod(this, "createVideoOutput", Qt::BlockingQueuedConnection); 39 | } 40 | 41 | void QtVideoOutput::createVideoOutput() 42 | { 43 | OPENAUTO_LOG(info) << "[QtVideoOutput] createVideoOutput()"; 44 | videoWidget_ = std::make_unique(); 45 | mediaPlayer_ = std::make_unique(nullptr, QMediaPlayer::StreamPlayback); 46 | } 47 | 48 | 49 | bool QtVideoOutput::open() 50 | { 51 | return videoBuffer_.open(QIODevice::ReadWrite); 52 | } 53 | 54 | bool QtVideoOutput::init() 55 | { 56 | emit startPlayback(); 57 | return true; 58 | } 59 | 60 | void QtVideoOutput::stop() 61 | { 62 | emit stopPlayback(); 63 | } 64 | 65 | void QtVideoOutput::write(uint64_t, const aasdk::common::DataConstBuffer& buffer) 66 | { 67 | videoBuffer_.write(reinterpret_cast(buffer.cdata), buffer.size); 68 | } 69 | 70 | void QtVideoOutput::onStartPlayback() 71 | { 72 | videoWidget_->setAspectRatioMode(Qt::IgnoreAspectRatio); 73 | videoWidget_->setFocus(); 74 | //videoWidget_->setWindowFlags(Qt::WindowStaysOnTopHint); 75 | videoWidget_->setFullScreen(true); 76 | videoWidget_->show(); 77 | 78 | mediaPlayer_->setVideoOutput(videoWidget_.get()); 79 | mediaPlayer_->setMedia(QMediaContent(), &videoBuffer_); 80 | mediaPlayer_->play(); 81 | 82 | // TODO: This only outputs a line if there's an error - FIXME - Output a proper status instead 83 | OPENAUTO_LOG(debug) << "Player error state -> " << mediaPlayer_->errorString().toStdString(); 84 | } 85 | 86 | void QtVideoOutput::onStopPlayback() 87 | { 88 | videoWidget_->hide(); 89 | mediaPlayer_->stop(); 90 | } 91 | 92 | } 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /src/autoapp/Service/AndroidAutoEntityFactory.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 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | namespace f1x { 32 | namespace openauto { 33 | namespace autoapp { 34 | namespace service { 35 | 36 | AndroidAutoEntityFactory::AndroidAutoEntityFactory(boost::asio::io_service &ioService, 37 | configuration::IConfiguration::Pointer configuration, 38 | IServiceFactory &serviceFactory) 39 | : ioService_(ioService), configuration_(std::move(configuration)), serviceFactory_(serviceFactory) { 40 | 41 | } 42 | 43 | IAndroidAutoEntity::Pointer AndroidAutoEntityFactory::create(aasdk::usb::IAOAPDevice::Pointer aoapDevice) { 44 | auto transport(std::make_shared(ioService_, std::move(aoapDevice))); 45 | return create(std::move(transport)); 46 | } 47 | 48 | IAndroidAutoEntity::Pointer AndroidAutoEntityFactory::create(aasdk::tcp::ITCPEndpoint::Pointer tcpEndpoint) { 49 | auto transport(std::make_shared(ioService_, std::move(tcpEndpoint))); 50 | return create(std::move(transport)); 51 | } 52 | 53 | IAndroidAutoEntity::Pointer AndroidAutoEntityFactory::create(aasdk::transport::ITransport::Pointer transport) { 54 | auto sslWrapper(std::make_shared()); 55 | auto cryptor(std::make_shared(std::move(sslWrapper))); 56 | cryptor->init(); 57 | 58 | auto messenger(std::make_shared(ioService_, 59 | std::make_shared( 60 | ioService_, transport, cryptor), 61 | std::make_shared( 62 | ioService_, transport, cryptor))); 63 | 64 | auto serviceList = serviceFactory_.create(messenger); 65 | auto pinger(std::make_shared(ioService_, 5000)); 66 | return std::make_shared(ioService_, std::move(cryptor), std::move(transport), 67 | std::move(messenger), configuration_, std::move(serviceList), 68 | std::move(pinger)); 69 | } 70 | 71 | } 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/autoapp/Service/GenericNotification/GenericNotificationService.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::genericnotification { 25 | 26 | GenericNotificationService::GenericNotificationService(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( 31 | messenger))) { 32 | 33 | } 34 | 35 | void GenericNotificationService::start() { 36 | strand_.dispatch([this, self = this->shared_from_this()]() { 37 | OPENAUTO_LOG(info) << "[GenericNotificationService] start()"; 38 | }); 39 | } 40 | 41 | void GenericNotificationService::stop() { 42 | strand_.dispatch([this, self = this->shared_from_this()]() { 43 | OPENAUTO_LOG(info) << "[GenericNotificationService] stop()"; 44 | }); 45 | } 46 | 47 | void GenericNotificationService::pause() { 48 | strand_.dispatch([this, self = this->shared_from_this()]() { 49 | OPENAUTO_LOG(info) << "[GenericNotificationService] pause()"; 50 | }); 51 | } 52 | 53 | void GenericNotificationService::resume() { 54 | strand_.dispatch([this, self = this->shared_from_this()]() { 55 | OPENAUTO_LOG(info) << "[GenericNotificationService] resume()"; 56 | }); 57 | } 58 | 59 | void GenericNotificationService::fillFeatures( 60 | aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { 61 | OPENAUTO_LOG(info) << "[GenericNotificationService] fillFeatures()"; 62 | 63 | auto *service = response.add_channels(); 64 | service->set_id(static_cast(channel_->getId())); 65 | 66 | auto *genericNotification = service->mutable_wifi_projection_service(); 67 | } 68 | 69 | void GenericNotificationService::onChannelOpenRequest( 70 | const aap_protobuf::service::control::message::ChannelOpenRequest &request) { 71 | OPENAUTO_LOG(info) << "[GenericNotificationService] onChannelOpenRequest()"; 72 | OPENAUTO_LOG(debug) << "[GenericNotificationService] Channel Id: " << request.service_id() << ", Priority: " 73 | << request.priority(); 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(&GenericNotificationService::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 GenericNotificationService::onChannelError(const aasdk::error::Error &e) { 88 | OPENAUTO_LOG(error) << "[GenericNotificationService] onChannelError(): " << e.what(); 89 | } 90 | } 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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/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 | } -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /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/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/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 | } 67 | 68 | void RadioService::onChannelOpenRequest(const aap_protobuf::service::control::message::ChannelOpenRequest &request) { 69 | OPENAUTO_LOG(info) << "[RadioService] onChannelOpenRequest()"; 70 | OPENAUTO_LOG(debug) << "[RadioService] Channel Id: " << request.service_id() << ", Priority: " 71 | << request.priority(); 72 | 73 | 74 | aap_protobuf::service::control::message::ChannelOpenResponse response; 75 | const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; 76 | response.set_status(status); 77 | 78 | auto promise = aasdk::channel::SendPromise::defer(strand_); 79 | promise->then([]() {}, std::bind(&RadioService::onChannelError, this->shared_from_this(), 80 | std::placeholders::_1)); 81 | channel_->sendChannelOpenResponse(response, std::move(promise)); 82 | 83 | channel_->receive(this->shared_from_this()); 84 | } 85 | 86 | void RadioService::onChannelError(const aasdk::error::Error &e) { 87 | OPENAUTO_LOG(error) << "[RadioService] onChannelError(): " << e.what(); 88 | } 89 | 90 | 91 | } 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /src/autoapp/Service/VendorExtension/VendorExtensionService.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::vendorextension { 25 | 26 | VendorExtensionService::VendorExtensionService(boost::asio::io_service &ioService, 27 | aasdk::messenger::IMessenger::Pointer messenger) 28 | : strand_(ioService), 29 | timer_(ioService), 30 | channel_( 31 | std::make_shared(strand_, std::move(messenger))) { 32 | 33 | } 34 | 35 | void VendorExtensionService::start() { 36 | strand_.dispatch([this, self = this->shared_from_this()]() { 37 | OPENAUTO_LOG(info) << "[VendorExtensionService] start()"; 38 | }); 39 | } 40 | 41 | void VendorExtensionService::stop() { 42 | strand_.dispatch([this, self = this->shared_from_this()]() { 43 | OPENAUTO_LOG(info) << "[VendorExtensionService] stop()"; 44 | }); 45 | } 46 | 47 | void VendorExtensionService::pause() { 48 | strand_.dispatch([this, self = this->shared_from_this()]() { 49 | OPENAUTO_LOG(info) << "[VendorExtensionService] pause()"; 50 | }); 51 | } 52 | 53 | void VendorExtensionService::resume() { 54 | strand_.dispatch([this, self = this->shared_from_this()]() { 55 | OPENAUTO_LOG(info) << "[VendorExtensionService] resume()"; 56 | }); 57 | } 58 | 59 | void VendorExtensionService::fillFeatures( 60 | aap_protobuf::service::control::message::ServiceDiscoveryResponse &response) { 61 | OPENAUTO_LOG(info) << "[VendorExtensionService] fillFeatures()"; 62 | 63 | auto *service = response.add_channels(); 64 | service->set_id(static_cast(channel_->getId())); 65 | 66 | auto *vendorExtension = service->mutable_vendor_extension_service(); 67 | } 68 | 69 | void VendorExtensionService::onChannelError(const aasdk::error::Error &e) { 70 | OPENAUTO_LOG(error) << "[VendorExtensionService] onChannelError(): " << e.what(); 71 | } 72 | 73 | void VendorExtensionService::onChannelOpenRequest( 74 | const aap_protobuf::service::control::message::ChannelOpenRequest &request) { 75 | OPENAUTO_LOG(info) << "[VendorExtensionService] onChannelOpenRequest()"; 76 | OPENAUTO_LOG(info) << "[VendorExtensionService] Channel Id: " << request.service_id() << ", Priority: " 77 | << request.priority(); 78 | 79 | aap_protobuf::service::control::message::ChannelOpenResponse response; 80 | const aap_protobuf::shared::MessageStatus status = aap_protobuf::shared::MessageStatus::STATUS_SUCCESS; 81 | response.set_status(status); 82 | 83 | auto promise = aasdk::channel::SendPromise::defer(strand_); 84 | promise->then([]() {}, std::bind(&VendorExtensionService::onChannelError, this->shared_from_this(), 85 | std::placeholders::_1)); 86 | channel_->sendChannelOpenResponse(response, std::move(promise)); 87 | channel_->receive(this->shared_from_this()); 88 | } 89 | } 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /src/autoapp/Service/WifiService.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/src/autoapp/Service/WifiService.cpp -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /src/autoapp/UI/assets/journey.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opencardev/openauto/82bffdb514dd287e8e80b168f00449cc4e215d54/src/autoapp/UI/assets/journey.jpg -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | --------------------------------------------------------------------------------