Skip to content

Latest commit

 

History

History
129 lines (99 loc) · 6.14 KB

README.md

File metadata and controls

129 lines (99 loc) · 6.14 KB

Flutter HeadUnit

This project is part of DES_03_Head-Unit and DES_04_PDC to provide infotainment feature. Flutter was used to implement front end application. It uses CommonAPI and SOME/IP binding as IPC

Table of Contents

Features

  • Gear Selection
    Head-Unit application is capable of setting gears through touch screen.

  • Music Player
    Head-Unit application can play your favourite mp3 musics.
    How? Just plug in your USB!

  • Video Player
    Head-Unit application can not only play music but also your favourite vidoes just like the music player.

  • Dark Mode
    Is the screen too bright for your eyes?
    Don't worry! Head-Unit application support dark mode.

  • USB media

Dendencies

All these applications should be installed in your linux build host to build this project

Gear Selection

HomePage Head-Unit application displays current gear on the left side of the screen. This section is always visible and accessable to the user. And also this section not only displays current gear but also is able to change gears by sending request to the controller application.

sequenceDiagram
    HeadUnit->>CarControl: Gear Change Request
    Note right of CarControl: If throttle is not 0,<br/>request will be rejected
    CarControl-->>HeadUnit: Response
Loading

Music Player

MusicPlayer

Music player uses media_kit to play media. When the music application widget is opened, the widget will try to read application's bundle directory and /media, /run/media for USB medium. Therefore to read and play media from USB, it is necessary to mount them on those directories. If the system does not mount usb or not on those directories, pleas configure yout udev rules accordingly.

Music player supports

  • metadata
  • progress bar
  • scrollerable playback
  • player control
  • volume control

Metadata is fetched by using metadata_god package.

Progress bar was implemented by using Player.stream and rxdart.

MusicList On left bottom there is a floating action button, which will open drawer to show your current playlist.

Video Player

VideoPlayer VideoController

Video player also uses media_kit to play video. Similar to the music player when the widget is opened, the widget will try to read /media, /run/media for videos in USB.

Video player uses MaterialVideoControls controller type since infotainment system only uses touch screen as input device rather then mouse like desktop environment.

Dark Mode

SettingsLightMode SettingsDarkMode

User can choose theme between light mode or dark mode. ChangeNotifier was used to implement this feature, since cupertino widgets don't share same attributes in material app, it was necessary to override some attributes manually.

FFI

Foreign function interface(FFI) is necessary to use CommonAPI since flutter does not support it directly like dbus. CommonAPI-someip is used to communicate with other applications like CarControl and Dashboard applications. To build proxy and stub for CommonAPI, custom plugin is generated in the flutter build process. Source codes and CMakeLists.txt for this plugin is located in lib/ffi directory.

sequenceDiagram
    title: Communication Scheme
    HeadUnit->>libHeadUnit.so: Open Dynamic Library<br/>Function Lookup
    Note left of libHeadUnit.so: Proxy and Stub<br/>instance is created
    libHeadUnit.so->>Other CommonAPI Apps: Subscribe
    Other CommonAPI Apps-->>libHeadUnit.so: Notify Events
    HeadUnit->>libHeadUnit.so: Method Call
    libHeadUnit.so->>Other CommonAPI Apps: Method Call
    Other CommonAPI Apps-->>libHeadUnit.so: Response
    libHeadUnit.so-->>HeadUnit: Response
    Other CommonAPI Apps-->>libHeadUnit.so: Notify Events
Loading

FIDL

package commonapi

interface HeadUnit {
    version { major 0 minor 1 }

    attribute Boolean lightMode readonly
    attribute MetaData metadata readonly

    struct MetaData {
        UInt8[] albumcover
        String artist
        String title
    }
}

libHeadUnit-someip.so provides proxy for other applications. In HeadUnit.fidl file, attributes are defined as shown on top. Flutter_Dashboard subscribes to these attributes to update it's widgets.

On Dashboard dashboard_dark Widgets are updated on other applications also!

References