BimmerGestalt / AAIdrive

Implementations of some Android Auto features as unofficial IDrive apps
MIT License
541 stars 90 forks source link

Car Information Screen #175

Closed 6i6i closed 3 years ago

6i6i commented 3 years ago

Hello,

I used a "car only iphone" connected via USB, to listen to spotify with the official BMW and spotify app. As in last months it started to become very unstable with my NBT EVO id-4 I tried your app on a spare old android phone with android 7.1.

I checked out the repo and compiled it in android studio to get the "bleeding edge". I tried to use it currently and it works without any major issues. What could be enhanced is a sentence in the readme, that the entrys in the cars multimeda menu do only switch the audio source( in my example pressing the spotify icon do not open any menu). So I found out that the complete control is listed under "Audio Player". Overall it is quite more stable than the official spotify app on the iphone. :-).

Now to my question. I started to investigate your findings on the github pages and found this article: https://hufman.github.io/BMWConnectedAnalysis/cds/.

I checked the possible CDS Data points and wonder if it could be also interessting for others too to have "Live information" of interesting car data that the car does not show anywhere. This would be f.ex.: engine.temperature: show the temperature of coolant and oil in numbers driving.gear: show the actual gear for cars with automatic transmissions driving in D sensors.fuel: show the fuel level in numbers sensors.temperatureInterior: show the interior temperature in numbers climate.airConditionerCompressor: show if the compressor is running or not climate.ACSystemTemperatures: could be interessting too :-)

My plan would be to add a additional information screen to display this values. Before I start with coding and debugging I wonder if you have anything in plan to add such an screen ? I think you would be about 100 times faster than me starting from scratch :-)

Thank you very much (you'll get a coffee) BR Martin

hufman commented 3 years ago

I'm so happy you're enjoying it! The music app icons are slightly flaky in ID4, they sometimes are able to bring up the Audioplayer interface but not always and I don't know the pattern. I had added some code a few months ago to try to help, but I no longer have an ID4 system to test on! There is an oblique note in the Limitations section in the README, but I didn't word it very confidently because it sometimes works (at least it did for me). The icons work much more reliably in my current ID5 vehicle!

Good find on the CDS data! I'm so glad that you share my excitement in extending the car's capabilities! I've been pondering a sort of addon system in the back of my mind for a few months now, to make it easier for other developers to build other integrations for the car. I want to keep this AndroidAutoIdrive app dedicated to its namesake functionality, just the music and notifications and some navigation functionality, and implement extra functionality as separate apps. This Car Information functionality is definitely on the list as an example addon! This next 1.3 release is already too big and delayed, so I have committed to this addon idea for the 1.3.1 release.

hufman commented 3 years ago

As for the actual implementation of this car information screen, the actual fetching of data is the easiest part. The above addon project is to simplify the boilerplate of connecting to the car, to make it easier for other developers to jump on and start building new ideas.

A very old project implements a very basic data observer, if you want to play with it. This example project relies on fetching the car cert from an official app instead of bundling it, so either iHeartRadio or Pandora or the old Spotify app must be installed, and it links to an older IDriveConnectKit version that still requires Connected Classic to be installed.

You could also try out extending the CarInformationDiscovery object to fetch this extra data, but there isn't any UI wired to it currently.

What sort of UI are you thinking of? A Phone UI is what I originally had in mind, allowing for more detailed inspection of data values, and it is easier in some ways. The problem with adding a Car UI is the restriction on the RHMI menu resources: Adding a new RHMI app to the car requires logging in as an official car app, including appearing as that official car app in the menu (e.g. the Maps module logs in as Samsung SmartThings). With effort it can be worked around, but this is why I had imagined this functionality with a Phone UI first. I'm disappointed that the ID4 system didn't like my attempt to fix the music app icons, that was my hope for feasibly adding custom menu icons.

Anyways, that is the extent of my existing plans about a car information screen! I of course encourage you to play around and see what you think, and I hope to have a framework in a few months to make it even easier for users to build add-on apps like this one. Feel free to reach out and chat about other ideas!

6i6i commented 3 years ago

Hello,

thank you very much for the nice explanations and the hint to CarInformationDiscovery. I'll have a look into.

I would prefer a IDrive UI as in my current setup the phone is left in the arm rest all the time and I don't touch it as long as everything works so far (what it incredibly does very well). So we would have to find a official car app that provides a menu with the possibility to display some text based entrys in the first step.

BR

hufman commented 3 years ago

The official Android car apps use a very flexible set of widgets, there is even a table-like List widget capable of displaying pictures, so getting the information to the screen is easy once the RHMI app is created.

The tricky part with an RHMI app is that locked menu icon. I'll have to search through the official apps to find one with a menu icon/text that seems reasonable. I should document the known official apps and what their menu icons look like, to help others who want to build RHMI apps too.

Those music app icons (and also the Notifications icon in the Office menu) are built with a different API, called AM, which only support onClick handlers. In this onClick handler I request that the car switch to an existing RHMI window, such as the main Audioplayer screen. In ID5+ it works great, but I'm disappointed by your report that ID4 does not. My hope was to create RHMI apps without the menu icon/text loaded, and then create customized AM icons that just switch to the related RHMI app. I'll probably still do that (the AM API even supports adding entries to the Vehicle Information menu), and hope to at least use a unique RHMI icon for ID4 users to use.

You've gotten me all excited, but it has to wait until I finish building the addon interface 😄

6i6i commented 3 years ago

OK that sounds nice.

Is there anywhere a list of official RHMI apps?

I was just testing some small modifications in the car and with my main phone (S9 with Android 10). I had to use bluetooth audio instead the USB audio that is supported with my "android i drive phone" that I am usually using. There it was possible to select spotify, vlc,.. in the Media Menu of the Idrive. So probably there is a difference in your handling of this entries regarding USB or bluetooth audio?

Here are the additional infos if they help: a4axl: false alignment-right: true hmi.display-height: 480 hmi.display-width: 1280 hmi.type: BMW ID4++ hmi.version: NBTevo_3D1511_Release 3D1511-501-1533C Build 45 - Rev:170594 2015-12-15 11:47:04 inbox: true map: true navi: true pia: true speech2text: false speedlock: true tts: true vehicle.country: ECE vehicle.productiondate: 03.16 vehicle.type: F31 voice: false

jezikk82 commented 3 years ago

Maybe as an initial step it'd be good to just create a CDS tab in phone app and as a next step move the important one to car. I saw @hufman created branch CDSData with some initial commits.

6i6i commented 3 years ago

Yes, I think that would be good first step. Let's see what magic @hufman will perform in this branch :-). I look forward to get a go for first testing :-)

hufman commented 3 years ago

I implemented a quick version of this in a branch, hidden behind the Show Advanced Settings flag in the Connection tab, here's what it looks like in my electric car. The CarInformation object now has a cdsData.liveData object to easily wire up any desired CDS data point to PhoneUI widgets, for future UI design improvements. Try it out and see if there's any other useful data points to add before I merge it! photo5494694285208037310

6i6i commented 3 years ago

Great. OK I'll give it a try afterwards and report back! :-)

6i6i commented 3 years ago

Hi.

The information data is displayed :-).. Screenshot_20210120-193451_AndroidAutoIdrive

So far I think there is all interesting data displayed!

Br

hufman commented 3 years ago

Merged! Thank you so much for the idea!

jezikk82 commented 3 years ago

Hi guys, I tested it as well with a bit bigger data set: val CDS_KEYS = mapOf( CDS.ENGINE.TEMPERATURE to "temperature", CDS.ENGINE.TORQUE to "torque", CDS.ENGINE.RPMSPEED to "RPMSpeed", CDS.DRIVING.GEAR to "gear", CDS.DRIVING.ACCELERATION to "acceleration", CDS.DRIVING.ACCELERATORPEDAL to "acceleratorPedal", CDS.DRIVING.AVERAGECONSUMPTION to "averageConsumption", CDS.DRIVING.ODOMETER to "odometer", CDS.DRIVING.SPEEDACTUAL to "speedActual", CDS.DRIVING.SPEEDDISPLAYED to "speedDisplayed", CDS.DRIVING.DRIVINGSTYLE to "drivingStyle", CDS.SENSORS.BATTERY to "battery", CDS.SENSORS.BATTERYTEMP to "batteryTemp", CDS.SENSORS.FUEL to "fuel", CDS.SENSORS.TEMPERATUREINTERIOR to "temperatureInterior", CDS.SENSORS.TEMPERATUREEXTERIOR to "temperatureExterior", CDS.SENSORS.PDCRANGEFRONT to "PDCRangeFront", CDS.SENSORS.PDCRANGEREAR to "PDCRangeRear", CDS.CLIMATE.AIRCONDITIONERCOMPRESSOR to "ACCompressor", CDS.CLIMATE.ACSYSTEMTEMPERATURES to "ACSystemTemperatures", CDS.CONTROLS.LIGHTS to "Lights", CDS.CONTROLS.STARTSTOPSTATUS to "StartStop_Status", CDS.NAVIGATION.CURRENTPOSITIONDETAILEDINFO to "currentPositionDetailedInfo", CDS.NAVIGATION.GPSEXTENDEDINFO to "GPSExtendedInfo", ) and it works well. However, to be in any way usable I think we need:

  1. At first step: move it to other tab and present in a more readable way (some UI for it)
  2. Move the most interesting&important information to the car's screen.

I'm gona test all the CDS values @hufman reported to see what we can actually add and if you guide me I can try to prepare some basic UI on a separate tab.

hufman commented 3 years ago

I'm pleased to hear that it works well for you! I added that small block of text to validate that the refactor effort around CDS handling worked soundly, and to quickly achieve the goal of viewing that data available over the API which is otherwise not visible anywhere in the car.

To expand it into a more usable interface, of course, more work is needed. A new menu entry needs to be added for the tab, with a link in the navigation structure to specify the menu entry's destination fragment. This new fragment class would look similar to the other pages' fragments (and less like the CarAdvancedInfoFragment which does too much work directly): The Fragment class instantiates a ViewModel class and uses Android DataBinding to link it into the layout. Within this ViewModel you can easily consume and transform the LiveData objects from the CarInformation.cdsData object, similar to the language settings.

The harder part is to think of ways to visualize the various data points, which I didn't have any immediate good ideas for :) However, once the ViewModel has the desired data pulled into LiveData objects, the UI is relatively standard Android development, and all the car API connection is just background details, allowing anyone to build as they please!

I think this feature should ultimately live in a separate optional app, but I haven't yet built out support for addon apps to provide such optional functionality. Until then, feel free to prototype and experiment in this app! I expect this cdsData interface will be migrated relatively unchanged to the future plugin spec, and so this Car Information functionality can be easily used as an initial example plugin app.

hufman commented 3 years ago

With the deprecation of BMW Connected, ID4 cars without remote data access are unsupported by the new MyBMW app, and so it would make sense to bring in some of the previously available data (odometer, fuel level, and so on) into such a Car Information tab.

hufman commented 3 years ago

One feature I'm investigating is to allow other apps easy access to the car's data, so a Torque-like or M Laptimer app could be built easily without needing to connect directly to the car if they only need the data: https://github.com/hufman/AndroidAutoIdrive/tree/cds_content_provider Still pretty early, but the data is available as individual Android Content Provider items, personal ones like location, navigation, and phone information are locked behind a special permission, and data updates seem to work well. I'll keep working on it, but maybe that'll inspire someone to try something?

6i6i commented 3 years ago

Hi Walter,

that sound great. But what I was actually looking into, was displaying this data on the Idrive screen, as I don't want to use the phone display during driving. Is there a way to display this data in a separate menu?

Thank you, Martin

berseker commented 2 years ago

I write here even if the topic had been closed. I was wondering if the great cds_gauges addon could be implemented as per the following mockup. basically the idea would be "replicating" the standard BMW "sport" screen showing on the car screen, the infos now shown on the phone by the "cds_gauges" addon, maybe allowing the user to choose which info to show. I think it would be an awesome improvement for this addon ;D

image

hufman commented 2 years ago

Interesting idea! It's difficult to reimplement the Sports Displays because I haven't found any BMW app for Android that provides the resources would be needed, and reimplementing using an image technique would have a painfully poor refresh rate (and also be yet another blank app icon in the list).