Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ body:
attributes:
label: Project version
description: The release you installed, or the commit you built.
placeholder: 0.12.1-rc.4
placeholder: 0.13.0-rc.1
validations:
required: true
- type: input
Expand Down
33 changes: 32 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,36 @@ QEMU avec les bibliothèques de la voiture).

## [Non publié]

## [0.13.0-rc.1] - 2026-11-15 · PC

Version candidate : la touche MAP vers la navigation d'Android Auto, les MINI reconnues (marque et écran rond), le
volume et la sourdine comme l'iDrive, en plus des corrections des 0.12.1-rc.1 à rc.4. Testée sur PC et sous QEMU,
**pas encore essayée en voiture** ; une BMW reçoit la même description de voiture qu'avant.

### Ajouté

- La touche MAP ouvre la navigation d'Android Auto quand il est à l'écran, comme NAV, au lieu de rendre l'écran à la
carte BMW ; c'est ce que fait l'iDrive avec CarPlay. Seules MENU et OPTION quittent Android Auto
([#1](https://github.com/Jiraiya43/EntryNav2-Android-Auto/issues/1)).
- MINI : la marque codée dans l'iDrive est lue au démarrage ; une MINI s'annonce « MINI » au téléphone et non plus
« BMW ». Son écran est encadré par un rond qui en cache les bords : le téléphone garde ses boutons hors de 40 colonnes
de chaque côté sur un écran de 1280 de large, 25 sur 800 ([#56](https://github.com/Jiraiya43/EntryNav2-Android-Auto/issues/56),
[#64](https://github.com/Jiraiya43/EntryNav2-Android-Auto/issues/64), [#78](https://github.com/Jiraiya43/EntryNav2-Android-Auto/issues/78)).
- Sourdine sur la pastille du volume : l'appui sur le bouton du volume la bascule dans l'iDrive, un cran de volume la
lève ; la pastille montre le haut-parleur barré.
- Image cassée après une image vidéo perdue : la session redemande une image complète au téléphone, pas dans les
5 premières secondes de la vidéo et au plus une fois par 10 s.

### Corrigé

- Pastille du volume ouverte seule à la connexion, barre vide : la voiture envoie aussi le niveau d'une autre source
(minimum au-dessus de 0), et le même niveau plusieurs fois. Seul le volume de la molette ouvre la pastille, sur un
changement ou juste après une touche de volume, comme la barre de l'iDrive ([#56](https://github.com/Jiraiya43/EntryNav2-Android-Auto/issues/56)).
- Flux chiffré cassé : après 16 trames d'affilée qui ne se déchiffrent pas, la session se termine au lieu de garder
une image figée jusqu'à la limite de silence.
- Journal `[WifiLink]` : plus de faux « signal 0 dBm » (niveau non mesuré par la puce) ni de débit vers le téléphone,
que le pilote ne connaît pas (il donnait 1 Mbit/s partout).

## [0.12.1-rc.4] - 2026-11-14 · PC

Version candidate, pour faire essayer le double appui sur MEDIA après une autre touche sur l'ancien contrôleur (F20
Expand Down Expand Up @@ -291,7 +321,8 @@ Première version publique. Essayée sur une BMW G20 de 2019, logiciel iDrive `2
encore suivie sur une voiture.
- Voir les [limites connues](ROADMAP.md#limites-connues).

[Non publié]: https://github.com/Jiraiya43/EntryNav2-Android-Auto/compare/v0.12.1-rc.4...HEAD
[Non publié]: https://github.com/Jiraiya43/EntryNav2-Android-Auto/compare/v0.13.0-rc.1...HEAD
[0.13.0-rc.1]: https://github.com/Jiraiya43/EntryNav2-Android-Auto/releases/tag/v0.13.0-rc.1
[0.12.1-rc.4]: https://github.com/Jiraiya43/EntryNav2-Android-Auto/releases/tag/v0.12.1-rc.4
[0.12.1-rc.3]: https://github.com/Jiraiya43/EntryNav2-Android-Auto/releases/tag/v0.12.1-rc.3
[0.12.1-rc.2]: https://github.com/Jiraiya43/EntryNav2-Android-Auto/releases/tag/v0.12.1-rc.2
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ aa-supervisor: $(SUPERVISOR_OBJ)
# iDrive PluginApp (installed in /opt/hmi/data/ro/Plugins/EntryAad, loaded by HmiMain3D at boot). Its objects are
# position independent and hidden: HmiMain3D only looks up pluginAppInfo, the one symbol the library exports.
HMI_SRC = hmiapp/entry_aa_app.cpp hmiapp/bmw_framework.cpp hmiapp/app_log.cpp hmiapp/app_guards.cpp \
hmiapp/service_link.cpp hmiapp/car_signals.cpp hmiapp/hold_machine.cpp hmiapp/controller_coding.cpp
hmiapp/service_link.cpp hmiapp/car_signals.cpp hmiapp/hold_machine.cpp hmiapp/idrive_coding.cpp
HMI_OBJ = $(HMI_SRC:.cpp=.o)
HMI_LIBDIRS = -L$(SYSROOT)/opt/hmi/lib -Wl,-rpath-link,$(SYSROOT)/opt/hmi/lib
hmiapp: hmiapp/libEntryAad.so
Expand Down Expand Up @@ -159,6 +159,8 @@ test-host: test-parsers test-spp-host test-kombi-host test-gps-host test-capture
./tests/test-evo-control
$(HOST_CXX) $(HOST_FLAGS) tests/test_peek_timing.cpp platform/peek_timing.cpp -o tests/test-peek-timing
./tests/test-peek-timing
$(HOST_CXX) $(HOST_FLAGS) tests/test_volume_state.cpp -o tests/test-volume-state
./tests/test-volume-state
$(HOST_CXX) $(HOST_FLAGS) -Icore/include tests/test_sdr_g20.cpp core/sdr_builder.cpp platform/evo_sdr_sensors.cpp -o tests/test-sdr-g20
./tests/test-sdr-g20
$(HOST_CXX) $(HOST_FLAGS) -Icore/include tests/test_evo_sdr.cpp core/sdr_builder.cpp platform/evo_sdr_sensors.cpp -o tests/test-evo-sdr
Expand Down
1 change: 0 additions & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ Un point n'est coché qu'avec une preuve en voiture : un test sur PC ne suffit p

| Limite | Cause | Piste |
|---|---|---|
| La touche MAP ouvre la carte BMW, pas la navigation d'Android Auto | choix actuel : MAP rend l'écran à l'iDrive | à décider |
| Le son passe par le Bluetooth de la voiture : qualité limitée, débuts de messages vocaux coupés | pas de son par le Wi-Fi | son par le Wi-Fi |
| Aide au stationnement ouverte sans marche arrière : Android Auto reste en retrait jusqu'à « Ouvrir » | l'écran affiché par l'iDrive n'est pas connu | lire l'état du PDC |
| Pendant un appel, la molette agit aussi sur l'écran d'appel de l'iDrive | idem | lire l'écran affiché par l'iDrive |
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.12.1-rc.4
0.13.0-rc.1
5 changes: 3 additions & 2 deletions core/aa_channels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ void AASession::onTlsHandshake(const Message& message) {
// The description of this car: Google's Desktop Head Unit template, adapted by core/sdr_builder.cpp.
void AASession::onDiscovery() {
printf("[AASession] >>> Received ServiceDiscoveryRequest from phone! Sending ServiceDiscoveryResponse...\n");
const Message response = message::discoveryResponse(
buildCarServiceDiscovery(kDhuSdpProtobuf, kDhuSdpProtobufLen, vehicleFile_, softwareVersion_, display_));
const Message response = message::discoveryResponse(buildCarServiceDiscovery(
kDhuSdpProtobuf, kDhuSdpProtobufLen, vehicleFile_, softwareVersion_, display_, carMake_));
if (sendSealed(channel::kControl, response)) {
printf("[AASession] >>> Sent ServiceDiscoveryResponse (%u bytes)\n", static_cast<unsigned>(response.size()));
}
Expand Down Expand Up @@ -253,6 +253,7 @@ void AASession::onSetup(uint8_t channel) {
if (channel == channel::kVideo) {
sendVideoFocus(true, false);
videoReady_ = true;
keyframe_.videoStarted(locationClockMs());
}
}

Expand Down
35 changes: 35 additions & 0 deletions core/aa_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ const unsigned kFramesLoggedEvery = 300;
const unsigned kKeysLogged = 200; // evo_knob logs every key anyway
const unsigned kMovesLogged = 40;
const unsigned kMicrophoneLogEvery = 250;
// Encrypted frames in a row that do not decrypt: the TLS stream is broken (a record lost or cut on the way), and no
// later frame will decrypt either. The session ends rather than wait for the silence limit with a frozen picture.
const unsigned kUnreadableLimit = 16;
const int kTouchMove = 2;

uint64_t monotonicUs() {
Expand All @@ -61,9 +64,12 @@ AASession::AASession()
thread_(0),
vehicleFile_(nullptr),
softwareVersion_(nullptr),
carMake_(nullptr),
longestSilenceMs_(0),
lastReceivedMs_(0),
videoReady_(false),
projected_(false),
unreadableInARow_(0),
mediaMessages_(0),
microphoneChunks_(0) {
pthread_mutex_init(&lifecycleLock_, nullptr);
Expand Down Expand Up @@ -125,6 +131,10 @@ void AASession::postVideoFocus(bool projected) {
inbox_.postFocus(projected);
}

void AASession::postKeyframeRequest() {
inbox_.postKeyframeRequest();
}

void AASession::postNightMode(bool night) {
inbox_.postNight(night);
}
Expand Down Expand Up @@ -211,6 +221,9 @@ bool AASession::start(int client_fd) {
assembler_.clear();
inbox_.reset();
videoReady_ = false;
projected_ = false;
keyframe_.reset();
unreadableInARow_ = 0;
microphoneChunks_ = 0;
mediaMessages_ = 0;
memset(mediaSessions_, 0, sizeof(mediaSessions_));
Expand Down Expand Up @@ -441,7 +454,14 @@ AASession::Received AASession::receive(uint8_t& channel, Message& message) {
} else if (!tls_.open(&payload[0], payload.size(), plain)) {
printf("[AASession] Failed to decrypt encrypted frame (%u bytes).\n", header.length);
assembler_.drop(channel);
if (++unreadableInARow_ >= kUnreadableLimit) {
printf("[AASession] %u encrypted frames in a row did not decrypt: the stream is broken, session ends.\n",
unreadableInARow_);
return kLost;
}
return kNothing;
} else {
unreadableInARow_ = 0;
}
switch (assembler_.add(header, plain, message)) {
case MessageAssembler::kComplete:
Expand Down Expand Up @@ -497,6 +517,9 @@ void AASession::sendCarInput() {
printf("[AASession] video focus -> phone: %s (unrequested) %s\n",
projected ? "FOCUSED/projected" : "UNFOCUSED/native", sent ? "sent" : "SEND FAILED");
}
if (batch.keyframe) {
askKeyframe();
}
for (size_t i = 0; i < batch.keys.size(); ++i) {
const CarKey& key = batch.keys[i];
const Message event = key.rotary ? message::rotaryEvent(monotonicUs(), key.keycode, key.delta)
Expand Down Expand Up @@ -566,10 +589,22 @@ bool AASession::sendSensorEvent(uint32_t type) {
bool AASession::sendVideoFocus(bool projected, bool unrequested) {
const bool sent = sendSealed(channel::kVideo, message::videoFocusIndication(projected, unrequested));
if (sent) {
projected_ = projected;
printf("[AASession] >>> Sent VideoFocusIndication (%s%s) on Channel %u!\n", projected ? "FOCUSED" : "UNFOCUSED",
unrequested ? ", unrequested" : "", channel::kVideo);
}
return sent;
}

// A lost frame leaves the picture broken until the phone's next keyframe: the focus is taken away and given back at
// once, which restarts the phone's encoder with one (keyframe_request.hpp). Only while the picture is projected.
void AASession::askKeyframe() {
if (!videoReady_ || !projected_ || !keyframe_.allow(locationClockMs())) {
return;
}
const bool sent = sendVideoFocus(false, true) && sendVideoFocus(true, true);
printf("[AASession] video frame lost: keyframe asked of the phone (focus off and on) %s\n",
sent ? "sent" : "SEND FAILED");
}

} // namespace aa
12 changes: 11 additions & 1 deletion core/aa_session.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "car_inbox.hpp"
#include "car_location.hpp"
#include "display_plan.hpp"
#include "keyframe_request.hpp"

namespace aa {

Expand Down Expand Up @@ -65,13 +66,17 @@ class AASession {
void setSoftwareVersion(const char* version) { softwareVersion_ = version; }
// The panel and the canvas asked of the phone for it (display_plan.hpp). The reference car's by default.
void setDisplay(const DisplayPlan& display) { display_ = display; }
// The maker announced to the phone, as iDrive is coded ("MINI"); kept by the caller. Null: "BMW".
void setCarMake(const char* make) { carMake_ = make; }

// Car input for the phone, from any thread: queued, then sent by the session thread.
void postTouchEvent(const TouchEventOut& ev);
void postKeyEvent(uint32_t keycode, bool down); // Android key codes, as declared on the input channel
void postRelativeEvent(uint32_t keycode, int delta); // rotary steps (keycode 65536, ROTARY_CONTROLLER)
// The car takes (false) or gives back (true) the screen: an unrequested video focus indication.
void postVideoFocus(bool projected);
// The decoder lost a video frame. Any thread; the session asks the phone for a keyframe when it may.
void postKeyframeRequest();
// The car's day or night, kept across sessions: a NIGHT_MODE event once the phone started that sensor.
void postNightMode(bool night);
// The car's latest fix (monotonic capture time); an invalid one when the car's feed expired.
Expand Down Expand Up @@ -114,6 +119,7 @@ class AASession {
bool sendLocation();
bool sendSensorEvent(uint32_t type);
bool sendVideoFocus(bool projected, bool unrequested);
void askKeyframe();

// One handler per route (aa_channels.cpp); dispatch() is false when the session must end.
bool dispatch(uint8_t channel, const Message& message);
Expand Down Expand Up @@ -150,6 +156,7 @@ class AASession {
Callback<NavStatusCallback> navigation_;
const char* vehicleFile_;
const char* softwareVersion_;
const char* carMake_;
DisplayPlan display_;

CarInbox inbox_;
Expand All @@ -158,7 +165,10 @@ class AASession {
uint64_t lastReceivedMs_; // when the phone last sent anything, 0 before its first byte
TlsClient tls_;
MessageAssembler assembler_;
bool videoReady_; // the phone set the video channel up: a focus can go
bool videoReady_; // the phone set the video channel up: a focus can go
bool projected_; // the last video focus sent was FOCUSED
KeyframeRequest keyframe_;
unsigned unreadableInARow_; // encrypted frames that did not decrypt since the last one that did
uint32_t mediaSessions_[32]; // per channel, the session id of its start indication, echoed in our acks
uint32_t mediaMessages_; // media messages received, every channel
uint32_t audioMessages_[2]; // guidance (8), media (9)
Expand Down
16 changes: 16 additions & 0 deletions core/car_inbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ CarInbox::CarInbox()
keyDrops_(0),
rotaryDrops_(0),
focus_(kFocusNone),
keyframe_(false),
night_(-1),
nightStarted_(false),
nightChanged_(false),
Expand Down Expand Up @@ -134,6 +135,18 @@ void CarInbox::postFocus(bool projected) {
wake();
}

void CarInbox::postKeyframeRequest() {
bool first;
{
MutexLock lock(mutex_);
first = !keyframe_;
keyframe_ = true;
}
if (first) { // a stalled decoder loses frame after frame: one wake is enough
wake();
}
}

void CarInbox::postNight(bool night) {
bool due;
{
Expand Down Expand Up @@ -188,6 +201,8 @@ void CarInbox::take(CarBatch& batch) {
batch.keys.swap(keys_);
batch.focus = focus_;
focus_ = kFocusNone;
batch.keyframe = keyframe_;
keyframe_ = false;
batch.nightChanged = nightChanged_ && nightStarted_;
nightChanged_ = false;
batch.microphone.swap(microphone_);
Expand Down Expand Up @@ -248,6 +263,7 @@ void CarInbox::reset() {
keys_.clear();
keyDrops_ = rotaryDrops_ = 0;
focus_ = kFocusNone;
keyframe_ = false;
nightStarted_ = nightChanged_ = false;
location_.reset();
microphoneOpen_ = false;
Expand Down
3 changes: 3 additions & 0 deletions core/car_inbox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ struct CarBatch {
std::vector<TouchEventOut> touches;
std::vector<CarKey> keys;
FocusRequest focus;
bool keyframe; // the decoder lost a video frame since the last turn
bool nightChanged; // the phone started night mode and the car changed since the last event
std::vector<std::vector<uint8_t>> microphone;
};
Expand All @@ -50,6 +51,7 @@ class CarInbox {
void postKey(uint32_t keycode, bool down);
void postRotary(uint32_t keycode, int delta);
void postFocus(bool projected);
void postKeyframeRequest(); // a video frame was lost: the session decides whether to ask the phone
void postNight(bool night); // kept across sessions
void postLocation(const CarLocation& location);
void postMicrophone(const uint8_t* pcm, size_t size);
Expand Down Expand Up @@ -83,6 +85,7 @@ class CarInbox {
std::vector<CarKey> keys_;
unsigned keyDrops_, rotaryDrops_;
FocusRequest focus_;
bool keyframe_;
int night_;
bool nightStarted_, nightChanged_;
LocationFeed location_;
Expand Down
9 changes: 7 additions & 2 deletions core/display_plan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// asked for; the phone is told to keep its UI in the top-left part the panel shows (insets, core/sdr_builder.cpp),
// and the video surface shows that part only (platform/evo_video.cpp). The reference car is one case of the rule: a
// 1280x480 panel in the 1280x720 canvas, its top 480 rows shown.
// A panel partly hidden by its surround (the MINI's round one, platform/car_brand.hpp) keeps the whole picture; the
// phone is only told to keep its UI away from the hidden sides.
#ifndef ENTRY_AAD_CORE_DISPLAY_PLAN_HPP
#define ENTRY_AAD_CORE_DISPLAY_PLAN_HPP

Expand All @@ -17,10 +19,12 @@ struct DisplayPlan {
uint32_t width, height; // the panel, and the part of the canvas that is shown
uint32_t canvasWidth, canvasHeight; // what the phone streams
uint32_t resolution; // the canvas as the protocol numbers it: 1, 2 or 3
uint32_t hiddenSide; // panel columns hidden on each side by the surround
// The reference car.
DisplayPlan() : width(1280), height(480), canvasWidth(1280), canvasHeight(720), resolution(2) {}
DisplayPlan() : width(1280), height(480), canvasWidth(1280), canvasHeight(720), resolution(2), hiddenSide(0) {}
uint32_t bottomInset() const { return canvasHeight - height; }
uint32_t rightInset() const { return canvasWidth - width; }
uint32_t leftInset() const { return hiddenSide; }
uint32_t rightInset() const { return canvasWidth - width + hiddenSide; }
bool reference() const { return width == 1280 && height == 480; }
};

Expand All @@ -37,6 +41,7 @@ inline bool planDisplay(uint32_t panelWidth, uint32_t panelHeight, DisplayPlan&
out.canvasWidth = kCanvas[i][0];
out.canvasHeight = kCanvas[i][1];
out.resolution = i + 1;
out.hiddenSide = 0;
return true;
}
}
Expand Down
Loading