Update Readme.md, add docstring
This commit is contained in:
@@ -1,35 +1,72 @@
|
||||
This is a Kotlin Multiplatform project targeting Android, iOS.
|
||||
# TorqueVaultKMP
|
||||
|
||||
* [/composeApp](./composeApp/src) is for code that will be shared across your Compose Multiplatform applications.
|
||||
It contains several subfolders:
|
||||
- [commonMain](./composeApp/src/commonMain/kotlin) is for code that’s common for all targets.
|
||||
- Other folders are for Kotlin code that will be compiled for only the platform indicated in the folder name.
|
||||
For example, if you want to use Apple’s CoreCrypto for the iOS part of your Kotlin app,
|
||||
the [iosMain](./composeApp/src/iosMain/kotlin) folder would be the right place for such calls.
|
||||
Similarly, if you want to edit the Desktop (JVM) specific part, the [jvmMain](./composeApp/src/jvmMain/kotlin)
|
||||
folder is the appropriate location.
|
||||
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.
|
||||
|
||||
* [/iosApp](./iosApp/iosApp) contains iOS applications. Even if you’re sharing your UI with Compose Multiplatform,
|
||||
you need this entry point for your iOS app. This is also where you should add SwiftUI code for your project.
|
||||
The project targets **Android** and **iOS** using **Compose Multiplatform** for a shared UI and logic.
|
||||
|
||||
### Build and Run Android Application
|
||||
## 🚀 Key Features
|
||||
|
||||
To build and run the development version of the Android app, use the run configuration from the run widget
|
||||
in your IDE’s toolbar or build it directly from the terminal:
|
||||
- on macOS/Linux
|
||||
```shell
|
||||
./gradlew :composeApp:assembleDebug
|
||||
```
|
||||
- on Windows
|
||||
```shell
|
||||
.\gradlew.bat :composeApp:assembleDebug
|
||||
```
|
||||
- **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.
|
||||
|
||||
### Build and Run iOS Application
|
||||
## 🛠 Tech Stack
|
||||
|
||||
To build and run the development version of the iOS app, use the run configuration from the run widget
|
||||
in your IDE’s toolbar or open the [/iosApp](./iosApp) directory in Xcode and run it from there.
|
||||
- **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.
|
||||
|
||||
---
|
||||
|
||||
Learn more about [Kotlin Multiplatform](https://www.jetbrains.com/help/kotlin-multiplatform-dev/get-started.html)…
|
||||
Developed by **Digitool Solutions**.
|
||||
|
||||
Reference in New Issue
Block a user