Initial commit
This commit is contained in:
@@ -0,0 +1 @@
|
||||
/build
|
||||
@@ -0,0 +1,35 @@
|
||||
plugins {
|
||||
alias(libs.plugins.kotlinMultiplatform)
|
||||
alias(libs.plugins.androidMultiplatformLibrary)
|
||||
alias(libs.plugins.kotlinxSerialization)
|
||||
}
|
||||
|
||||
kotlin {
|
||||
androidLibrary {
|
||||
namespace = "ru.tanexc.hemoanalysis.domain"
|
||||
compileSdk {
|
||||
version = release(36)
|
||||
}
|
||||
minSdk = 26
|
||||
}
|
||||
|
||||
listOf(
|
||||
iosArm64(),
|
||||
iosSimulatorArm64()
|
||||
).forEach { iosTarget ->
|
||||
iosTarget.binaries.framework {
|
||||
baseName = "domainkit"
|
||||
isStatic = true
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
implementation(libs.kotlinx.serialization.json)
|
||||
|
||||
implementation(libs.kotlinx.coroutines.core)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package ru.tanexc.hemoanalysis.domain
|
||||
|
||||
sealed interface State<out T> {
|
||||
data object Loading: State<Nothing>
|
||||
|
||||
data class Success<T>(val data: T): State<T>
|
||||
|
||||
data object Error: State<Nothing>
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package ru.tanexc.hemoanalysis.domain.model
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class ModelInfo(
|
||||
val version: String,
|
||||
val lastUpdateTime: String,
|
||||
val createdAt: String,
|
||||
val filename: String,
|
||||
val isLatest: Boolean,
|
||||
val size: Size
|
||||
)
|
||||
@@ -0,0 +1,18 @@
|
||||
package ru.tanexc.hemoanalysis.domain.model
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlin.jvm.JvmInline
|
||||
|
||||
@Serializable
|
||||
@JvmInline
|
||||
value class Size(
|
||||
val value: Int
|
||||
) {
|
||||
companion object {
|
||||
val ZERO get() = Size(0)
|
||||
}
|
||||
}
|
||||
|
||||
val Size.Kb: Float get() = value / 1024f
|
||||
val Size.Mb: Float get() = Kb / 1024f
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package ru.tanexc.hemoanalysis.domain.repository
|
||||
|
||||
interface AnalysisParamsRepository {
|
||||
var confThreshold: Float
|
||||
var iouThreshold: Float
|
||||
var preprocessVariant: Int
|
||||
var roiVariant: Int
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package ru.tanexc.hemoanalysis.domain.repository
|
||||
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import ru.tanexc.hemoanalysis.domain.State
|
||||
import ru.tanexc.hemoanalysis.domain.model.ModelInfo
|
||||
|
||||
interface ModelRepository {
|
||||
fun getLatestModelInfo(): ModelInfo?
|
||||
|
||||
fun getCurrentModelInfo(): ModelInfo?
|
||||
|
||||
fun updateModelInfo(): Flow<State<ModelInfo?>>
|
||||
|
||||
fun loadLatestModel(): Flow<State<ModelInfo?>>
|
||||
|
||||
fun getKeyApi(): String
|
||||
|
||||
fun updateApiKey(apiKey: String)
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package ru.tanexc.hemoanalysis.domain.usecase
|
||||
|
||||
interface BytesReader {
|
||||
suspend fun readNext(size: Int): ByteArray
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package ru.tanexc.hemoanalysis.domain.usecase
|
||||
|
||||
interface GetLatestModelFileUseCase {
|
||||
operator fun invoke(): ByteArray?
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package ru.tanexc.hemoanalysis.domain.usecase
|
||||
|
||||
interface GetModelPathUseCase {
|
||||
operator fun invoke(): String?
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package ru.tanexc.hemoanalysis.domain.usecase
|
||||
|
||||
import ru.tanexc.hemoanalysis.domain.model.Size
|
||||
|
||||
interface SaveModelFileUseCase {
|
||||
suspend operator fun invoke(filename: String, bytesReader: BytesReader): Size
|
||||
}
|
||||
Reference in New Issue
Block a user