# developerfromjokela/nissan-leaf-tcu architecture

> Architecture diagram of the GitHub repository developerfromjokela/nissan-leaf-tcu, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/developerfromjokela/nissan-leaf-tcu
- Repository: https://github.com/developerfromjokela/nissan-leaf-tcu

## Overview

This repository documents reverse engineering of Nissan Leaf telematics control units and includes an Android configurator. The main user workflow is selecting a Bluetooth OBD adapter, connecting to a TCU, choosing a hardware profile, and reading or writing configuration. Separate research branches document server protocols and CAN settings, preserve firmware images, and provide packet, GPS, and security-analysis tools. Android source excerpts support the app’s key calls; README statements support the broader research branches. Unsampled subsystems are represented without inferred internal wiring.

Main entry points: [`configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/MainActivity.kt`](https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/MainActivity.kt) (Configurator UI), [`configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/config/TCUConfigAdapter.kt`](https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/config/TCUConfigAdapter.kt) (Config editor), [`configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/profiles/AbstractTCUProfile.kt`](https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/profiles/AbstractTCUProfile.kt) (TCU profiles), [`configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/config/TCUConfigItem.kt`](https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/config/TCUConfigItem.kt) (Config item)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Android configurator"]
  node_main["Configurator UI<br/>[MainActivity.kt]"]
  node_device["Device selection"]
  node_bluetooth["Bluetooth service"]
  node_adapter["Config editor"]
  node_item["Config item<br/>[TCUConfigItem.kt]"]
  node_profile["TCU profiles"]
  node_continental["Continental profile<br/>[Continental2012.kt]"]
  node_ficosaprofile["Ficosa profile<br/>[FicosaGen2_5.kt]"]
  node_payloadmake["CAN payload maker<br/>[CanPayloadMaker.kt]"]
  node_payloadparse["CAN payload parser"]
  node_packetparse["CAN packet parser<br/>[CanPacketParser.kt]"]
  node_dtc["DTC utilities<br/>[DtcUtils.kt]"]
end

subgraph group_protocol["Protocol research"]
  node_canbook["CAN documentation<br/>[CAN.md]"]
  node_can2book["CAN notes<br/>[CAN2.md]"]
  node_commdocs["Server protocol docs"]
  node_gen2docs["Gen2 protocol docs"]
  node_captures["Protocol captures"]
end

subgraph group_firmware["Firmware archive"]
  node_fw["TCU firmware images"]
  node_fw642["AZE0 firmware<br/>[firmware-06.42]"]
  node_gen2fw["Gen2 firmware"]
end

subgraph group_analysis["Analysis tools"]
  node_gps["GPS decoders<br/>[gpsdecoder.py]"]
  node_gpsmeta["GPS metadata<br/>[gpsmetadecoder.py]"]
  node_evinfo["EV info parsers"]
  node_evinfoze["ZE0 parser<br/>[evinfoze0parser.py]"]
  node_batbody["Battery body tool<br/>[batbody.py]"]
  node_hmac["HMAC tool<br/>[genhmac.py]"]
  node_sds["SDS key tool<br/>[sdskey.py]"]
end

node_user(("TCU operator"))
node_obd{{"Bluetooth OBD adapter"}}

node_user -->|"configures TCU"| node_main
node_main -->|"opens selection"| node_device
node_main -->|"connects and commands"| node_bluetooth
node_bluetooth -.->|"communicates over Bluetooth"| node_obd
node_main -->|"displays configuration"| node_adapter
node_main -->|"selects profile"| node_profile
node_profile -->|"specialized by"| node_continental
node_profile -->|"specialized by"| node_ficosaprofile
node_continental -->|"defines fields"| node_item
node_ficosaprofile -->|"defines fields"| node_item
node_adapter -->|"renders fields"| node_item
node_main -->|"builds requests"| node_payloadmake
node_main -->|"parses responses"| node_payloadparse
node_adapter -->|"uses diagnostics"| node_dtc

click node_main "https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/MainActivity.kt"
click node_device "https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/bluetooth/DeviceSelectActivity.java"
click node_bluetooth "https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/bluetooth/BluetoothService.java"
click node_adapter "https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/config/TCUConfigAdapter.kt"
click node_item "https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/config/TCUConfigItem.kt"
click node_profile "https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/profiles/AbstractTCUProfile.kt"
click node_continental "https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/profiles/Continental2012.kt"
click node_ficosaprofile "https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/profiles/FicosaGen2_5.kt"
click node_payloadmake "https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/diag/CanPayloadMaker.kt"
click node_payloadparse "https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/diag/CanPayloadParser.kt"
click node_packetparse "https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/diag/CanPacketParser.kt"
click node_dtc "https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/utils/DtcUtils.kt"
click node_canbook "https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/CAN.md"
click node_can2book "https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/CAN2.md"
click node_commdocs "https://github.com/developerfromjokela/nissan-leaf-tcu/tree/master/communication"
click node_gen2docs "https://github.com/developerfromjokela/nissan-leaf-tcu/tree/master/gen2"
click node_captures "https://github.com/developerfromjokela/nissan-leaf-tcu/tree/master/gen2/batcaptures"
click node_fw "https://github.com/developerfromjokela/nissan-leaf-tcu/tree/master/firmware"
click node_fw642 "https://github.com/developerfromjokela/nissan-leaf-tcu/tree/master/firmware-06.42"
click node_gen2fw "https://github.com/developerfromjokela/nissan-leaf-tcu/tree/master/gen2"
click node_gps "https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/scripts/gpsdecoder.py"
click node_gpsmeta "https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/scripts/gpsmetadecoder.py"
click node_evinfo "https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/scripts/evinfoaze0parser.py"
click node_evinfoze "https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/scripts/evinfoze0parser.py"
click node_batbody "https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/gen2/batbody.py"
click node_hmac "https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/gen2/genhmac.py"
click node_sds "https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/gen2/sdskey.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_device,node_bluetooth,node_adapter,node_item,node_profile,node_continental,node_ficosaprofile,node_payloadmake,node_payloadparse,node_packetparse,node_dtc toneBlue
class node_canbook,node_can2book,node_commdocs,node_gen2docs,node_captures toneAmber
class node_fw,node_fw642,node_gen2fw toneMint
class node_gps,node_gpsmeta,node_evinfo,node_evinfoze,node_batbody,node_hmac,node_sds toneRose
class node_user,node_obd toneIndigo
```

## Components

### Android configurator

- [Configurator UI](https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/MainActivity.kt): `configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/MainActivity.kt`
- [Device selection](https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/bluetooth/DeviceSelectActivity.java): `configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/bluetooth/DeviceSelectActivity.java`
- [Bluetooth service](https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/bluetooth/BluetoothService.java): `configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/bluetooth/BluetoothService.java`
- [Config editor](https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/config/TCUConfigAdapter.kt): `configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/config/TCUConfigAdapter.kt`
- [Config item](https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/config/TCUConfigItem.kt): `configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/config/TCUConfigItem.kt`
- [TCU profiles](https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/profiles/AbstractTCUProfile.kt): `configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/profiles/AbstractTCUProfile.kt`
- [Continental profile](https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/profiles/Continental2012.kt): `configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/profiles/Continental2012.kt`
- [Ficosa profile](https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/profiles/FicosaGen2_5.kt): `configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/profiles/FicosaGen2_5.kt`
- [CAN payload maker](https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/diag/CanPayloadMaker.kt): `configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/diag/CanPayloadMaker.kt`
- [CAN payload parser](https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/diag/CanPayloadParser.kt): `configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/diag/CanPayloadParser.kt`
- [CAN packet parser](https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/diag/CanPacketParser.kt): `configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/diag/CanPacketParser.kt`
- [DTC utilities](https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/utils/DtcUtils.kt): `configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/utils/DtcUtils.kt`

### Protocol research

- [CAN documentation](https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/CAN.md): `CAN.md`
- [CAN notes](https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/CAN2.md): `CAN2.md`
- [Server protocol docs](https://github.com/developerfromjokela/nissan-leaf-tcu/tree/master/communication): `communication`
- [Gen2 protocol docs](https://github.com/developerfromjokela/nissan-leaf-tcu/tree/master/gen2): `gen2`
- [Protocol captures](https://github.com/developerfromjokela/nissan-leaf-tcu/tree/master/gen2/batcaptures): `gen2/batcaptures`

### Firmware archive

- [TCU firmware images](https://github.com/developerfromjokela/nissan-leaf-tcu/tree/master/firmware): `firmware`
- [AZE0 firmware](https://github.com/developerfromjokela/nissan-leaf-tcu/tree/master/firmware-06.42): `firmware-06.42`
- [Gen2 firmware](https://github.com/developerfromjokela/nissan-leaf-tcu/tree/master/gen2): `gen2`

### Analysis tools

- [GPS decoders](https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/scripts/gpsdecoder.py): `scripts/gpsdecoder.py`
- [GPS metadata](https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/scripts/gpsmetadecoder.py): `scripts/gpsmetadecoder.py`
- [EV info parsers](https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/scripts/evinfoaze0parser.py): `scripts/evinfoaze0parser.py`
- [ZE0 parser](https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/scripts/evinfoze0parser.py): `scripts/evinfoze0parser.py`
- [Battery body tool](https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/gen2/batbody.py): `gen2/batbody.py`
- [HMAC tool](https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/gen2/genhmac.py): `gen2/genhmac.py`
- [SDS key tool](https://github.com/developerfromjokela/nissan-leaf-tcu/blob/master/gen2/sdskey.py): `gen2/sdskey.py`

### Other components

- **TCU operator**
- **Bluetooth OBD adapter**

## Connections

- TCU operator → Configurator UI: configures TCU (evidence: `README.md`)
- Configurator UI → Device selection: opens selection (evidence: `configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/MainActivity.kt`)
- Configurator UI → Bluetooth service: connects and commands (evidence: `configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/MainActivity.kt`)
- Bluetooth service → Bluetooth OBD adapter: communicates over Bluetooth
- Configurator UI → Config editor: displays configuration (evidence: `configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/MainActivity.kt`)
- Configurator UI → TCU profiles: selects profile (evidence: `configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/MainActivity.kt`)
- TCU profiles → Continental profile: specialized by (evidence: `configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/profiles/Continental2012.kt`)
- TCU profiles → Ficosa profile: specialized by (evidence: `configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/profiles/FicosaGen2_5.kt`)
- Continental profile → Config item: defines fields (evidence: `configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/profiles/Continental2012.kt`)
- Ficosa profile → Config item: defines fields (evidence: `configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/profiles/FicosaGen2_5.kt`)
- Config editor → Config item: renders fields (evidence: `configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/config/TCUConfigAdapter.kt`)
- Configurator UI → CAN payload maker: builds requests (evidence: `configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/MainActivity.kt`)
- Configurator UI → CAN payload parser: parses responses (evidence: `configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/MainActivity.kt`)
- Config editor → DTC utilities: uses diagnostics (evidence: `configapp-android/app/src/main/java/com/developerfromjokela/nissanleaftelematics/config/TCUConfigAdapter.kt`)
