Class Diagram
Company: Nikted
Document Name: Software Architecture Description (Client App)
Document Number: HAD-RPT-151-Rev1
Author: Khebrati
Date (Persian Calendar): 1404/06/30
Revision History
| Rev. no. | Description | Author(s) | Reviewers | Date (Persian) | Authors' Signature | Reviewers' Signature |
|---|---|---|---|---|---|---|
| 1. | Initial Draft | khebrati | Ghafar nosrati |
Diagram
classDiagram
direction TB
class BluetoothTabContent {
<<Composable>>
}
class HomeTabContent {
<<Composable>>
}
class MainScreenModel {
+scope: CoroutineScope
+snackBarState: SnackbarHostState
+leftBluetoothDevice: StateFlow~BluetoothDevice~
+rightBluetoothDevice: StateFlow~BluetoothDevice~
+isScanning: StateFlow~Boolean~
+nearbyDevices: MutableStateFlow~List~BluetoothDevice~~
+muteState: StateFlow~Mute~
+leftDeviceState: StateFlow~ConnectionDeviceState~
+rightDeviceState: StateFlow~ConnectionDeviceState~
+leftBatteryLevel: StateFlow~Async~Int~~
+rightBatteryLevel: StateFlow~Async~Int~~
+environment: StateFlow~Environment~
+leftDeviceVersion: StateFlow~Async~DeviceVersionState~~
+rightDeviceVersion: StateFlow~Async~DeviceVersionState~~
+feedbackUiState: StateFlow~FeedbackUiState~
+searchBluetoothDevices()
+connectToDevice(device: BluetoothDevice)
+disconnectFromDevice(side: Side)
+writeBothSidesEnvironments(env: Environment)
+writeBothSidesMute(mute: Mute)
+readVersion(side: Side)
}
class ConnectionDeviceState {
<<data>>
+bluetoothDevice: BluetoothDevice?
+receiverType: Receiver
+deviceSide: Side?
+serialNumber: String
+volumeRange: IntRange
+initialVolume: Int
+isSliderActive: Boolean
+sliderState: SliderState
+sliderValue: Int
}
class DeviceVersionState {
<<data>>
+hardwareVersion: String
+firmwareVersion: String
+dspVersion: String
}
class FeedbackUiState {
<<data>>
+showDialog: Boolean
+comment: String
}
class BluetoothManager {
<<interface>>
+leftBluetoothDevice: StateFlow~BluetoothDevice?~
+rightBluetoothDevice: StateFlow~BluetoothDevice?~
+isBluetoothOn: Flow~Boolean~
+isScanning(): Flow~Boolean~
+scan(timeout: Duration): Flow~BluetoothDevice~
+connectToDevice(device: BluetoothDevice): CoroutineScope
+disconnectFromDevice(side: Side)
+writeToDevice(device, service, characteristic, descriptor, data)
+readFromDevice(device, service, characteristic, descriptor): ByteArray
+observeFromDevice(device, service, characteristic): Flow~ByteArray~
}
class BleDataHandlerUseCase {
<<interface>>
+readVolumeRange(device): IntRange?
+readVolume(device): UByte?
+writeVolume(device, volume): Boolean
+readEnvironment(device): Environment?
+writeEnvironment(device, environment): Boolean
+writeMute(device, mute): Boolean
+readMute(device): Mute?
+writeSN(device, sn): Boolean
+readSideAndReceiver(device): Pair~Side, Receiver~?
+writeSideAndReceiver(device, side, receiver): Boolean
}
class SystemService {
<<interface>>
+getSystemServiceState(service: Service): ServiceState
+checkServiceFlow(service: Service): Flow~ServiceState~
+provideService(service: Service)
+disableService(service: Service)
+openSettingPage(service: Service)
}
class SystemServiceDelegate {
<<interface>>
+getServiceState(): ServiceState
+provideService()
+disableService()
+openSettingPage()
}
class BluetoothServiceDelegate
class LocationServiceDelegate
class ServiceState {
<<enum>>
NOT_DETERMINED
ON
OFF
}
class DeviceVersionReader {
<<interface>>
+readHardwareVersion(side: Side): String
+readFirmwareVersion(side: Side): String
+readDspVersion(side: Side): String
}
class EmailService {
<<interface>>
+sendEmail(toAddresses: List~String~, subject: String, body: String): Boolean
}
class PermissionsController {
<<interface>>
+providePermission(permission: Permission)
+isPermissionGranted(permission: Permission): Boolean
+getPermissionState(permission: Permission): PermissionState
+openAppSettings()
}
class BleDataTransmit {
<<interface>>
}
class BleDataCodec {
<<interface>>
}
class SmpCodec {
<<interface>>
+encode(data: ByteArray): ByteArray
+decode(data: ByteArray): ByteArray
}
class ProtoCodec {
<<interface>>
+encode(transactionReq: TransactionReq): ByteArray
+decode(data: ByteArray): TransactionRes?
}
class BluetoothManagerImpl {
-logger: Logger
-platformBleSetting: PlatformBleSetting
}
class BleDataHandlerUseCaseImpl {
-transmit: BleDataTransmit
-logger: Logger
}
class BleDataTransmitImpl {
-bluetooth: BluetoothManager
-codec: BleDataCodec
-logger: Logger
}
class BleDataCodecImpl {
-smpCodec: SmpCodec
-protoCodec: ProtoCodec
-logger: Logger
}
class SmpCodecImpl
class ProtoCodecImpl
class SystemServiceImpl
class DeviceVersionReaderImpl
class PermissionsControllerImpl
note for PermissionsControllerImpl "Third-party library (moko-permissions)"
BluetoothTabContent ..> MainScreenModel : uses
HomeTabContent ..> MainScreenModel : uses
MainScreenModel *-- "1" ConnectionDeviceState
MainScreenModel *-- "1" DeviceVersionState
MainScreenModel *-- "1" FeedbackUiState
MainScreenModel *-- "1" BluetoothManager: uses
MainScreenModel *-- "1" BleDataHandlerUseCase: uses
MainScreenModel *-- "1" SystemService: uses
MainScreenModel *-- "1" DeviceVersionReader: uses
MainScreenModel *-- "1" EmailService: uses
MainScreenModel *-- "1" PermissionsController: uses
BluetoothManager <|.. BluetoothManagerImpl
BleDataHandlerUseCase <|.. BleDataHandlerUseCaseImpl
SystemService <|.. SystemServiceImpl
DeviceVersionReader <|.. DeviceVersionReaderImpl
BleDataTransmit <|.. BleDataTransmitImpl
BleDataCodec <|.. BleDataCodecImpl
SmpCodec <|.. SmpCodecImpl
ProtoCodec <|.. ProtoCodecImpl
PermissionsController <|.. PermissionsControllerImpl
SystemServiceDelegate <|.. BluetoothServiceDelegate
SystemServiceDelegate <|.. LocationServiceDelegate
SystemServiceImpl o-- SystemServiceDelegate
SystemService ..> ServiceState
SystemServiceDelegate ..> ServiceState
BleDataHandlerUseCaseImpl "1" o-- BleDataTransmit
BleDataTransmitImpl "1" o-- BluetoothManager
BleDataTransmitImpl "1" o-- BleDataCodec
BleDataCodecImpl "1" o-- SmpCodec
BleDataCodecImpl "1" o-- ProtoCodec
DeviceVersionReaderImpl o-- BluetoothManager