# fabi019/hid-barcode-scanner architecture

> Architecture diagram of the GitHub repository fabi019/hid-barcode-scanner, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fabi019/hid-barcode-scanner
- Repository: https://github.com/fabi019/hid-barcode-scanner

## Overview

1. This is a single-module Android app (`app`) written in Kotlin, with the architecture centered around three runtime concerns: camera-based scanning, Bluetooth output, and user-configurable scan processing.

2. The entry points are `MainActivity` and `SettingsActivity`. The app uses a Compose-style UI layer under `ui/`, with reusable UI components, theme files, and screen-specific state holders in `ui/model/` (`CameraViewModel`, `DevicesViewModel`, `HistoryViewModel`).

3. The main user flow starts on the device-selection / connection path and then moves into the scanner. `Devices.kt`, `Scanner.kt`, `DevicesViewModel`, and the Bluetooth controller classes coordinate device discovery, connection choice, and handoff into scanning once a target device is ready.

4. The scanning pipeline is camera-driven: `CameraPreview` feeds frames into `ZXingAnalyzer`, which produces `BarcodeResult` data. There is also an OCR-related model under `org/totschnig/ocr/Text.kt`, suggesting the scanner can work with more than just barcode symbology in some paths, but the primary barcode decoding engine is ZXing C++.

5. Scan results are not sent directly. They pass through a processing layer in `utils/` and `ui/` that can apply regex filtering, template expansion, custom JavaScript logic (`JsEngineService`, `JsEditor`, `TemplateProcessor`), and app-specific options such as extra keys or volume-key behavior. This processing layer is the main “business logic” boundary between raw scan output and transport output.

6. Bluetooth output is abstracted in `bt/`. `BluetoothController` and `BluetoothService` coordinate the connection lifecycle, while `KeyboardSender`, `KeyTranslator`, and `Descriptor` turn processed text into low-level HID keyboard reports. The app’s core architectural distinction is that it can emit either HID keyboard events or RFCOMM/SPP serial data.

7. The HID path is the default and is designed to behave like a physical keyboard, using the Android Bluetooth HID capability. The RFCOMM path (`RfcommController`) is an alternate transport for serial-port-style delivery over Bluetooth, useful when keyboard emulation is undesirable or unsupported. The README makes clear that both modes share the same scanned-data source but diverge at the transport boundary.

8. User preferences and feature toggles are centralized in `Settings.kt` and `utils/PreferenceStore.kt`. These settings drive key architectural decisions such as keyboard layout selection, auto-connect behavior, auto-send, filtering, connection mode, and other scanner/transport options. `ui/Preference.kt` and related components render this configuration layer.

9. History is a separate subsystem rather than a side effect of scanning. `History.kt`, `HistoryViewModel`, and `ui/HistoryFilter.kt` manage stored scan sessions and export them through `utils/Serializer` into text, JSON, or CSV. This makes history an independent data domain that can be consumed without the live scanner or Bluetooth connection.

10. Keyboard layout mapping is data-driven. Layout definitions live in `app/src/main/assets/keymaps/*.layout`, and `KeyTranslator` uses them to convert characters into HID codes appropriate for the selected host keyboard layout. This is an important boundary because the app sends scan content as key events, not as literal characters.

11. The app also includes device and system integration helpers in `utils/`: `Permission` handling, `SystemBroadcastReceiver`, lifecycle helpers, image utilities, device metadata, and latency tracing. These classes support the main flows but are not separate business subsystems; they bridge Android platform concerns into the scanner/Bluetooth architecture.

12. The repository is covered by both unit and instrumented tests. Existing tests focus on the most architecture-sensitive logic: key translation, device info, serialization, and template processing. That lines up with the repo’s main risk areas: correct character-to-HID mapping, stable export formats, and deterministic scan transformation.

13. Operationally, the app is fully offline and self-contained. It ships localized resources, locale-specific string sets, XML shortcuts, backup/data-extraction configs, and app metadata for distribution channels, but it does not depend on external backend services at runtime.

Main entry points: [`app/src/main/java/dev/fabik/bluetoothhid/Scanner.kt`](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/Scanner.kt) (Scanner), [`app/src/main/java/dev/fabik/bluetoothhid/bt/BluetoothController.kt`](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/bt/BluetoothController.kt) (BluetoothController), [`app/src/main/java/dev/fabik/bluetoothhid/ui/Navigation.kt`](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/ui/Navigation.kt) (Navigation), [`app/src/main/java/dev/fabik/bluetoothhid/utils/PreferenceStore.kt`](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/utils/PreferenceStore.kt) (PreferenceStore)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App shell"]
  node_main_activity["MainActivity<br/>entry<br/>[MainActivity.kt]"]
  node_settings_activity["SettingsActivity<br/>entry"]
  node_navigation["Navigation<br/>ui routing<br/>[Navigation.kt]"]
  node_devices_screen["Devices<br/>device screen<br/>[Devices.kt]"]
  node_devices_vm["DevicesViewModel<br/>state"]
end

subgraph group_scan["Scan flow"]
  node_scanner_screen["Scanner<br/>scan screen<br/>[Scanner.kt]"]
  node_camera_preview["CameraPreview<br/>camera ui<br/>[CameraPreview.kt]"]
  node_camera_overlay["CameraOverlay<br/>camera ui<br/>[CameraOverlay.kt]"]
  node_zxing_analyzer["ZXingAnalyzer<br/>decoder<br/>[ZXingAnalyzer.kt]"]
  node_barcode_result["BarcodeResult<br/>scan model<br/>[BarcodeResult.kt]"]
  node_ocr_text["OCR Text<br/>ocr model<br/>[Text.kt]"]
  node_camera_vm["CameraViewModel<br/>state<br/>[CameraViewModel.kt]"]
end

subgraph group_transport["Bluetooth transport"]
  node_bt_controller["BluetoothController<br/>bluetooth coord"]
  node_bt_service["BluetoothService<br/>bluetooth service"]
  node_keyboard_sender["KeyboardSender<br/>hid sender<br/>[KeyboardSender.kt]"]
  node_key_translator["KeyTranslator<br/>layout mapper<br/>[KeyTranslator.kt]"]
  node_descriptor["Descriptor<br/>[Descriptor.kt]"]
  node_rfcomm_controller["RfcommController<br/>serial transport"]
end

subgraph group_config["Config and logic"]
  node_preference_store[("PreferenceStore<br/>settings store<br/>[PreferenceStore.kt]")]
  node_settings_core["Settings<br/>options model<br/>[Settings.kt]"]
  node_template_processor["TemplateProcessor<br/>transform"]
  node_js_engine["JsEngineService<br/>script engine<br/>[JsEngineService.kt]"]
  node_js_editor["JsEditor<br/>ui editor<br/>[JsEditor.kt]"]
end

subgraph group_history["History"]
  node_history_vm["HistoryViewModel<br/>state"]
  node_history_core[("History<br/>data domain<br/>[History.kt]")]
  node_serializer["Serializer<br/>export<br/>[Serializer.kt]"]
  node_history_filter["HistoryFilter<br/>ui filter<br/>[HistoryFilter.kt]"]
end

subgraph group_support["Platform support"]
  node_device_info["DeviceInfo<br/>platform helper<br/>[DeviceInfo.kt]"]
  node_permissions["Permissions<br/>ui helper<br/>[Permissions.kt]"]
  node_system_receiver["SystemBroadcastReceiver<br/>android bridge"]
end

node_main_activity -->|"hosts"| node_navigation
node_settings_activity -->|"edits"| node_settings_core
node_navigation -->|"routes to"| node_devices_screen
node_navigation -->|"routes to"| node_scanner_screen
node_navigation -->|"routes to"| node_history_filter
node_devices_screen -->|"uses"| node_devices_vm
node_devices_vm -->|"chooses"| node_bt_controller
node_bt_controller -->|"starts"| node_bt_service
node_bt_controller -->|"switches"| node_rfcomm_controller
node_scanner_screen -->|"uses"| node_camera_vm
node_scanner_screen -->|"renders"| node_camera_preview
node_scanner_screen -->|"renders"| node_camera_overlay
node_camera_preview -->|"feeds"| node_zxing_analyzer
node_zxing_analyzer -->|"produces"| node_barcode_result
node_zxing_analyzer -.->|"may produce"| node_ocr_text
node_barcode_result -->|"passes through"| node_template_processor
node_template_processor -->|"can invoke"| node_js_engine
node_js_engine -->|"configured by"| node_js_editor
node_settings_core -->|"persisted in"| node_preference_store
node_preference_store -->|"drives"| node_template_processor
node_preference_store -->|"drives"| node_bt_controller
node_preference_store -->|"drives"| node_key_translator
node_key_translator -->|"uses"| node_descriptor
node_bt_service -->|"sends via"| node_keyboard_sender
node_keyboard_sender -->|"maps through"| node_key_translator
node_rfcomm_controller -->|"receives"| node_template_processor
node_history_core -->|"exports via"| node_serializer
node_history_vm -->|"reads"| node_history_core
node_history_filter -->|"filters"| node_history_vm
node_permissions -->|"gates"| node_scanner_screen
node_system_receiver -.->|"observes"| node_bt_controller
node_device_info -.->|"annotates"| node_serializer

click node_main_activity "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/MainActivity.kt"
click node_settings_activity "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/SettingsActivity.kt"
click node_navigation "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/ui/Navigation.kt"
click node_devices_screen "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/Devices.kt"
click node_scanner_screen "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/Scanner.kt"
click node_camera_preview "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/ui/CameraPreview.kt"
click node_camera_overlay "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/ui/CameraOverlay.kt"
click node_zxing_analyzer "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/utils/ZXingAnalyzer.kt"
click node_barcode_result "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/ui/model/BarcodeResult.kt"
click node_ocr_text "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/org/totschnig/ocr/Text.kt"
click node_devices_vm "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/ui/model/DevicesViewModel.kt"
click node_camera_vm "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/ui/model/CameraViewModel.kt"
click node_history_vm "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/ui/model/HistoryViewModel.kt"
click node_preference_store "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/utils/PreferenceStore.kt"
click node_settings_core "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/Settings.kt"
click node_template_processor "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/utils/TemplateProcessor.kt"
click node_js_engine "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/utils/JsEngineService.kt"
click node_js_editor "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/ui/JsEditor.kt"
click node_history_core "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/History.kt"
click node_serializer "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/utils/Serializer.kt"
click node_history_filter "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/ui/HistoryFilter.kt"
click node_bt_controller "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/bt/BluetoothController.kt"
click node_bt_service "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/bt/BluetoothService.kt"
click node_keyboard_sender "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/bt/KeyboardSender.kt"
click node_key_translator "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/bt/KeyTranslator.kt"
click node_descriptor "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/bt/Descriptor.kt"
click node_rfcomm_controller "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/bt/RfcommController.kt"
click node_device_info "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/utils/DeviceInfo.kt"
click node_permissions "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/ui/Permissions.kt"
click node_system_receiver "https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/utils/SystemBroadcastReceiver.kt"

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_activity,node_settings_activity,node_navigation,node_devices_screen,node_devices_vm toneBlue
class node_scanner_screen,node_camera_preview,node_camera_overlay,node_zxing_analyzer,node_barcode_result,node_ocr_text,node_camera_vm toneAmber
class node_bt_controller,node_bt_service,node_keyboard_sender,node_key_translator,node_descriptor,node_rfcomm_controller toneMint
class node_preference_store,node_settings_core,node_template_processor,node_js_engine,node_js_editor toneRose
class node_history_vm,node_history_core,node_serializer,node_history_filter toneIndigo
class node_device_info,node_permissions,node_system_receiver toneTeal
```

## Components

### App shell

Android entry points and screen routing

- [MainActivity](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/MainActivity.kt): entry · App entry and primary navigation host · `app/src/main/java/dev/fabik/bluetoothhid/MainActivity.kt`
- [SettingsActivity](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/SettingsActivity.kt): entry · Settings entry screen · `app/src/main/java/dev/fabik/bluetoothhid/SettingsActivity.kt`
- [Navigation](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/ui/Navigation.kt): ui routing · Compose screen routing between app flows · `app/src/main/java/dev/fabik/bluetoothhid/ui/Navigation.kt`
- [Devices](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/Devices.kt): device screen · Device selection and connection handoff · `app/src/main/java/dev/fabik/bluetoothhid/Devices.kt`
- [DevicesViewModel](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/ui/model/DevicesViewModel.kt): state · State and coordination for device flow · `app/src/main/java/dev/fabik/bluetoothhid/ui/model/DevicesViewModel.kt`

### Scan flow

Camera capture and result generation

- [Scanner](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/Scanner.kt): scan screen · Live scanning screen and scan actions · `app/src/main/java/dev/fabik/bluetoothhid/Scanner.kt`
- [CameraPreview](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/ui/CameraPreview.kt): camera ui · Camera feed presentation · `app/src/main/java/dev/fabik/bluetoothhid/ui/CameraPreview.kt`
- [CameraOverlay](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/ui/CameraOverlay.kt): camera ui · Overlay and framing controls for scanning · `app/src/main/java/dev/fabik/bluetoothhid/ui/CameraOverlay.kt`
- [ZXingAnalyzer](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/utils/ZXingAnalyzer.kt): decoder · Frame analyzer producing barcode results · `app/src/main/java/dev/fabik/bluetoothhid/utils/ZXingAnalyzer.kt`
- [BarcodeResult](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/ui/model/BarcodeResult.kt): scan model · Decoded scan payload model · `app/src/main/java/dev/fabik/bluetoothhid/ui/model/BarcodeResult.kt`
- [OCR Text](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/org/totschnig/ocr/Text.kt): ocr model · Text model for OCR-oriented paths · `app/src/main/java/org/totschnig/ocr/Text.kt`
- [CameraViewModel](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/ui/model/CameraViewModel.kt): state · Scanner camera state holder · `app/src/main/java/dev/fabik/bluetoothhid/ui/model/CameraViewModel.kt`

### Bluetooth transport

HID and RFCOMM output paths

- [BluetoothController](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/bt/BluetoothController.kt): bluetooth coord · Bluetooth connection lifecycle and mode selection · `app/src/main/java/dev/fabik/bluetoothhid/bt/BluetoothController.kt`
- [BluetoothService](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/bt/BluetoothService.kt): bluetooth service · Service backing Bluetooth operations · `app/src/main/java/dev/fabik/bluetoothhid/bt/BluetoothService.kt`
- [KeyboardSender](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/bt/KeyboardSender.kt): hid sender · Builds and sends HID keyboard reports · `app/src/main/java/dev/fabik/bluetoothhid/bt/KeyboardSender.kt`
- [KeyTranslator](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/bt/KeyTranslator.kt): layout mapper · Maps characters to HID codes by keyboard layout · `app/src/main/java/dev/fabik/bluetoothhid/bt/KeyTranslator.kt`
- [Descriptor](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/bt/Descriptor.kt): hid descriptor · HID report descriptor definition · `app/src/main/java/dev/fabik/bluetoothhid/bt/Descriptor.kt`
- [RfcommController](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/bt/RfcommController.kt): serial transport · RFCOMM/SPP alternate Bluetooth transport · `app/src/main/java/dev/fabik/bluetoothhid/bt/RfcommController.kt`

### Config and logic

Preferences and scan processing

- [PreferenceStore](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/utils/PreferenceStore.kt): settings store · Persistent configuration and feature flags · `app/src/main/java/dev/fabik/bluetoothhid/utils/PreferenceStore.kt`
- [Settings](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/Settings.kt): options model · Central option definitions driving app behavior · `app/src/main/java/dev/fabik/bluetoothhid/Settings.kt`
- [TemplateProcessor](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/utils/TemplateProcessor.kt): transform · Template expansion and scan shaping · `app/src/main/java/dev/fabik/bluetoothhid/utils/TemplateProcessor.kt`
- [JsEngineService](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/utils/JsEngineService.kt): script engine · Custom JavaScript scan processing · `app/src/main/java/dev/fabik/bluetoothhid/utils/JsEngineService.kt`
- [JsEditor](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/ui/JsEditor.kt): ui editor · UI for editing custom JavaScript logic · `app/src/main/java/dev/fabik/bluetoothhid/ui/JsEditor.kt`

### History

Stored scans and export

- [HistoryViewModel](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/ui/model/HistoryViewModel.kt): state · History screen state holder · `app/src/main/java/dev/fabik/bluetoothhid/ui/model/HistoryViewModel.kt`
- [History](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/History.kt): data domain · Stored scan sessions and records · `app/src/main/java/dev/fabik/bluetoothhid/History.kt`
- [Serializer](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/utils/Serializer.kt): export · History export to text, JSON, and CSV · `app/src/main/java/dev/fabik/bluetoothhid/utils/Serializer.kt`
- [HistoryFilter](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/ui/HistoryFilter.kt): ui filter · History filtering and browsing controls · `app/src/main/java/dev/fabik/bluetoothhid/ui/HistoryFilter.kt`

### Platform support

Android bridge helpers and system integration

- [DeviceInfo](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/utils/DeviceInfo.kt): platform helper · Device metadata and identification helpers · `app/src/main/java/dev/fabik/bluetoothhid/utils/DeviceInfo.kt`
- [Permissions](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/ui/Permissions.kt): ui helper · Permission flows and gates · `app/src/main/java/dev/fabik/bluetoothhid/ui/Permissions.kt`
- [SystemBroadcastReceiver](https://github.com/fabi019/hid-barcode-scanner/blob/main/app/src/main/java/dev/fabik/bluetoothhid/utils/SystemBroadcastReceiver.kt): android bridge · Receives system broadcasts for app integration · `app/src/main/java/dev/fabik/bluetoothhid/utils/SystemBroadcastReceiver.kt`

## Connections

- MainActivity → Navigation: hosts · Main entry hosts navigation
- SettingsActivity → Settings: edits · Settings entry exposes app options
- Navigation → Devices: routes to · Initial flow starts with device selection
- Navigation → Scanner: routes to · Handoff into scanning after connection
- Navigation → HistoryFilter: routes to · History browsing path
- Devices → DevicesViewModel: uses · Device UI driven by view model state
- DevicesViewModel → BluetoothController: chooses · Coordinates discovery and connection choice
- BluetoothController → BluetoothService: starts · Connection lifecycle backed by service
- BluetoothController → RfcommController: switches · Selects alternate RFCOMM transport
- Scanner → CameraViewModel: uses · Scanner UI driven by camera state
- Scanner → CameraPreview: renders · Live camera feed
- Scanner → CameraOverlay: renders · Scan framing and controls
- CameraPreview → ZXingAnalyzer: feeds · Camera frames enter decoder
- ZXingAnalyzer → BarcodeResult: produces · Decoded barcode output
- ZXingAnalyzer → OCR Text: may produce · OCR-oriented text path
- BarcodeResult → TemplateProcessor: passes through · Raw result enters processing layer
- TemplateProcessor → JsEngineService: can invoke · Custom JavaScript transforms scan text
- JsEngineService → JsEditor: configured by · UI for editing scripts
- Settings → PreferenceStore: persisted in · Central options stored as preferences
- PreferenceStore → TemplateProcessor: drives · Filtering and template behavior
- PreferenceStore → BluetoothController: drives · Connection and auto-connect behavior
- PreferenceStore → KeyTranslator: drives · Keyboard layout selection
- KeyTranslator → Descriptor: uses · Produces HID-compatible reports
- BluetoothService → KeyboardSender: sends via · Keyboard-emulation output path
- KeyboardSender → KeyTranslator: maps through · Characters converted to keycodes
- RfcommController → TemplateProcessor: receives · Shares processed scan payloads
- History → Serializer: exports via · History exported in multiple formats
- HistoryViewModel → History: reads · History state backed by stored sessions
- HistoryFilter → HistoryViewModel: filters · UI narrows stored scans
- Permissions → Scanner: gates · Camera and device permissions for scanning
- SystemBroadcastReceiver → BluetoothController: observes · System integration for Bluetooth lifecycle
- DeviceInfo → Serializer: annotates · Metadata used in exports and diagnostics
