73 lines
3.4 KiB
Markdown
73 lines
3.4 KiB
Markdown
# TorqueVaultKMP
|
|
|
|
TorqueVaultKMP is a Kotlin Multiplatform (KMP) application designed for managing torque measurements, connecting to digital torque devices via Bluetooth Low Energy (BLE), and handling work orders.
|
|
|
|
The project targets **Android** and **iOS** using **Compose Multiplatform** for a shared UI and logic.
|
|
|
|
## 🚀 Key Features
|
|
|
|
- **BLE Device Management**: Scan, connect, and bond with digital torque wrenches using the [Kable](https://github.com/JuulLabs/kable) library.
|
|
- **Adaptive Scanning**: Automatically calibrates device discovery expiration by observing advertisement intervals, ensuring a responsive UI when devices stop broadcasting.
|
|
- **Work Order Workflow**:
|
|
- Fetch "Open" work orders from a remote API.
|
|
- Synchronize work order details (License Plate, Make, Torque requirements) with connected BLE devices.
|
|
- Receive and upload measurement results (Torque values, wheel/nut indices) back to the server.
|
|
- **Bonding & Persistence**: Automatically remembers and auto-connects to bonded devices using **SQLDelight** for local storage.
|
|
- **Diagnostic Logging**: A dedicated in-app logging system (`LogRepository`) that tracks system events, BLE communication, and HTTP requests. Supports exporting logs as CSV or Text for remote debugging.
|
|
- **Theme Support**: Built-in support for Dark and Light modes.
|
|
|
|
## 🛠 Tech Stack
|
|
|
|
- **Kotlin**: `2.3.21`
|
|
- **UI Framework**: [Compose Multiplatform](https://www.jetbrains.com/lp/compose-multiplatform/) `1.11.0`
|
|
- **Dependency Injection**: [Koin](https://insert-koin.io/) `4.2.1`
|
|
- **Networking**: [Ktor](https://ktor.io/) `3.4.3`
|
|
- **Database**: [SQLDelight](https://cashapp.github.io/sqldelight/) `2.3.2`
|
|
- **Bluetooth**: [Kable](https://github.com/JuulLabs/kable) `0.43.0`
|
|
- **Logging**: [Napier](https://github.com/aakira/Napier) `2.7.1`
|
|
- **Time/Date**: [Kotlinx Datetime](https://github.com/Kotlin/kotlinx-datetime) `0.8.0`
|
|
- **Serialization**: [Kotlinx Serialization](https://github.com/Kotlin/kotlinx.serialization) `2.3.21`
|
|
|
|
## 📁 Project Structure
|
|
|
|
- `composeApp/src/commonMain`: Shared logic, UI, and data management.
|
|
- `screens/`: UI modules for Scanner, Logs, Home, Settings, and Auth.
|
|
- `data/`: Network DTOs, SQLDelight DB schema, and Repositories.
|
|
- `kable/`: BLE abstraction and manager.
|
|
- `domain/`: Business logic models and shared interfaces.
|
|
- `composeApp/src/androidMain`: Android-specific implementations (e.g., Bluetooth permissions, Splash screen).
|
|
- `composeApp/src/iosMain`: iOS-specific implementations (e.g., Native sharing sheets, CoreBluetooth delegates).
|
|
- `iosApp`: Entry point for the iOS application.
|
|
|
|
## 🏗 Getting Started
|
|
|
|
### Prerequisites
|
|
|
|
- Android Studio (Ladybug or newer) / IntelliJ IDEA.
|
|
- Xcode 15+ (for iOS development).
|
|
- Kotlin Multiplatform plugin.
|
|
|
|
### Build and Run
|
|
|
|
#### Android
|
|
```bash
|
|
./gradlew :composeApp:assembleDebug
|
|
```
|
|
|
|
#### iOS
|
|
Open the `iosApp` directory in Xcode or use the run configuration in Android Studio.
|
|
|
|
## ⚙️ Communication Protocol
|
|
|
|
The app uses a custom UART protocol to communicate with torque devices. Commands include:
|
|
- `START_WO`: Initiate work order fetch.
|
|
- `ACCEPT_WO`: Confirm a specific work order selection.
|
|
- `FINISH_WO`: Send measurement data back to the app for server upload.
|
|
|
|
## 📜 Logging
|
|
|
|
Logs are stored in memory (up to 1000 entries) and categorized into **System** and **Device** logs. They can be shared via the **Logs** screen using platform-native sharing components.
|
|
|
|
---
|
|
Developed by **Digitool Solutions**.
|