-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: e1turin <48864186+e1turin@users.noreply.github.com> Co-authored-by: Victor Smirnov <53015676+vityaman@users.noreply.github.com>
- Loading branch information
1 parent
b3a36bd
commit 720d141
Showing
83 changed files
with
2,997 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
name: Gradle Build Check | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- ".github/workflows/*" | ||
- "**/*.kts" | ||
- "**/*.properties" | ||
- "gradle/*" | ||
- "gradlew" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the Code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v3 | ||
|
||
- name: Build Common | ||
run: (./gradlew :common:build) | ||
|
||
- name: Build Connection Service | ||
run: (./gradlew :connection-service:build) | ||
|
||
- name: Build Database Service | ||
run: (./gradlew :db-service:build) | ||
|
||
- name: Build Logging Service | ||
run: (./gradlew :log-service:build) | ||
|
||
- name: Build Emulator Service | ||
run: (./gradlew :model-service:build) | ||
|
||
- name: Build Mobile App | ||
run: (./gradlew :mobile-app:build) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
plugins { | ||
alias(libs.plugins.jetbrainsKotlinJvm) | ||
alias(libs.plugins.kotlinSerialization) | ||
} | ||
|
||
kotlin { | ||
jvmToolchain(17) | ||
} | ||
|
||
dependencies { | ||
implementation(libs.kotlinx.serialization.json) | ||
} |
95 changes: 95 additions & 0 deletions
95
common/src/main/kotlin/org/vivlaniv/nexohub/ConnectionTask.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
package org.vivlaniv.nexohub | ||
|
||
import kotlinx.serialization.Serializable | ||
import java.util.* | ||
|
||
// connection-service tasks | ||
|
||
@Serializable | ||
data class SearchDevicesTask( | ||
override val id: String = UUID.randomUUID().toString() | ||
) : Task | ||
|
||
@Serializable | ||
data class SearchDevicesTaskResult( | ||
override val tid: String, | ||
val devices: List<DeviceInfo> | ||
) : TaskResult | ||
|
||
|
||
@Serializable | ||
data class SaveDeviceTask( | ||
override val id: String = UUID.randomUUID().toString(), | ||
val device: String, | ||
val room: String? = null, | ||
val alias: String? = null | ||
) : Task | ||
|
||
@Serializable | ||
data class SaveDeviceTaskResult( | ||
override val tid: String, | ||
override val code: Int = 0, | ||
override val errorMessage: String? = null | ||
) : TaskResult | ||
|
||
|
||
@Serializable | ||
data class FetchSavedDevicesTask( | ||
override val id: String = UUID.randomUUID().toString() | ||
) : Task | ||
|
||
@Serializable | ||
data class FetchSavedDevicesTaskResult( | ||
override val tid: String, | ||
override val code: Int = 0, | ||
override val errorMessage: String? = null, | ||
val devices: List<SavedDevice>? = null | ||
) : TaskResult | ||
|
||
|
||
@Serializable | ||
data class FetchDevicesPropertiesTask( | ||
override val id: String = UUID.randomUUID().toString(), | ||
val include: List<String>? = null, | ||
) : Task | ||
|
||
@Serializable | ||
data class FetchDevicesPropertiesTaskResult( | ||
override val tid: String, | ||
override val code: Int = 0, | ||
override val errorMessage: String? = null, | ||
val properties: Map<String, List<PropertyInfo>>? = null | ||
) : TaskResult | ||
|
||
|
||
@Serializable | ||
data class PutDevicePropertyTask( | ||
override val id: String = UUID.randomUUID().toString(), | ||
val device: String, | ||
val property: String, | ||
val value: Int | ||
) : Task | ||
|
||
@Serializable | ||
data class PutDevicePropertyTaskResult( | ||
override val tid: String, | ||
override val code: Int = 0, | ||
override val errorMessage: String? = null, | ||
val device: String, | ||
) : TaskResult | ||
|
||
|
||
@Serializable | ||
data class SendDeviceSignalTask( | ||
override val id: String = UUID.randomUUID().toString(), | ||
val device: String, | ||
val signal: String, | ||
val arguments: List<Int> = listOf() | ||
) : Task | ||
|
||
@Serializable | ||
data class SendDeviceSignalTaskResult( | ||
override val tid: String, | ||
override val code: Int = 0, | ||
override val errorMessage: String? = null | ||
) : TaskResult |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.vivlaniv.nexohub | ||
|
||
import kotlinx.serialization.Serializable | ||
import java.util.* | ||
|
||
// db-service tasks | ||
|
||
@Serializable | ||
data class GetSavedDevicesTask( | ||
override val id: String = UUID.randomUUID().toString(), | ||
val user: String | ||
) : Task | ||
|
||
@Serializable | ||
data class GetSavedDevicesTaskResult( | ||
override val tid: String, | ||
val devices: List<SavedDeviceInfo> | ||
) : TaskResult | ||
|
||
|
||
@Serializable | ||
data class SaveUserDeviceTask( | ||
override val id: String = UUID.randomUUID().toString(), | ||
val type: String, | ||
val user: String, | ||
val device: String, | ||
val room: String?, | ||
val alias: String? | ||
) : Task | ||
|
||
@Serializable | ||
data class SaveUserDeviceTaskResult( | ||
override val tid: String | ||
) : TaskResult | ||
|
||
|
||
@Serializable | ||
data class SaveSensorsTask( | ||
override val id: String = UUID.randomUUID().toString(), | ||
val sensors: Map<String, List<PropertyInfo>> | ||
) : Task |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package org.vivlaniv.nexohub | ||
|
||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
enum class Type { | ||
BOOLEAN, // 0 or 1 | ||
PERCENT, // value from 0 to 100 | ||
BYTE, // value from 0 to 255 | ||
TEMPERATURE // temperature value | ||
} | ||
|
||
@Serializable | ||
data class Schema( | ||
val type: Type, | ||
val min: Int? = null, | ||
val max: Int? = null | ||
) | ||
|
||
@Serializable | ||
data class PropertyInfo( | ||
val name: String, | ||
val schema: Schema, | ||
val readOnly: Boolean, | ||
val value: Int | ||
) | ||
|
||
@Serializable | ||
data class SignalInfo( | ||
val name: String, | ||
val args: List<Schema> | ||
) | ||
|
||
@Serializable | ||
data class DeviceInfo( | ||
val id: String, | ||
val type: String, | ||
val properties: List<PropertyInfo>, | ||
val signals: List<SignalInfo> | ||
) | ||
|
||
@Serializable | ||
data class SavedDeviceInfo( | ||
val id: String, | ||
val type: String, | ||
val user: String, | ||
val room: String?, | ||
val alias: String? | ||
) | ||
|
||
@Serializable | ||
data class SavedDevice( | ||
val id: String, | ||
val type: String, | ||
val room: String?, | ||
val alias: String?, | ||
var properties: List<PropertyInfo>, | ||
val signals: List<SignalInfo> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package org.vivlaniv.nexohub | ||
|
||
import kotlinx.serialization.Serializable | ||
import java.util.* | ||
|
||
// model-service tasks | ||
|
||
@Serializable | ||
data class GetDevicesTask( | ||
override val id: String = UUID.randomUUID().toString(), | ||
val user: String, | ||
val include: List<String>? = null, | ||
val exclude: List<String>? = null | ||
) : Task | ||
|
||
@Serializable | ||
data class GetDevicesTaskResult( | ||
override val tid: String, | ||
override val code: Int = 0, | ||
override val errorMessage: String? = null, | ||
val devices: List<DeviceInfo>? = null | ||
) : TaskResult | ||
|
||
|
||
@Serializable | ||
data class GetDeviceTask( | ||
override val id: String = UUID.randomUUID().toString(), | ||
val user: String, | ||
val device: String | ||
) : Task | ||
|
||
@Serializable | ||
data class GetDeviceTaskResult( | ||
override val tid: String, | ||
override val code: Int = 0, | ||
override val errorMessage: String? = null, | ||
val device: DeviceInfo? = null | ||
) : TaskResult | ||
|
||
|
||
@Serializable | ||
data class GetDevicesPropertiesTask( | ||
override val id: String = UUID.randomUUID().toString(), | ||
val user: String, | ||
val include: List<String>? = null | ||
) : Task | ||
|
||
@Serializable | ||
data class GetDevicesPropertiesTaskResult( | ||
override val tid: String, | ||
override val code: Int = 0, | ||
override val errorMessage: String? = null, | ||
val properties: Map<String, List<PropertyInfo>>? = null | ||
) : TaskResult | ||
|
||
|
||
@Serializable | ||
data class SetDevicePropertyTask( | ||
override val id: String = UUID.randomUUID().toString(), | ||
val user: String, | ||
val device: String, | ||
val name: String, | ||
val value: Int | ||
) : Task | ||
|
||
@Serializable | ||
data class SetDevicePropertyTaskResult( | ||
override val tid: String, | ||
override val code: Int = 0, | ||
override val errorMessage: String? = null | ||
) : TaskResult | ||
|
||
|
||
@Serializable | ||
data class SignalDeviceTask( | ||
override val id: String = UUID.randomUUID().toString(), | ||
val user: String, | ||
val device: String, | ||
val name: String, | ||
val args: List<Int> | ||
) : Task | ||
|
||
@Serializable | ||
data class SignalDeviceTaskResult( | ||
override val tid: String, | ||
override val code: Int = 0, | ||
override val errorMessage: String? = null | ||
) : TaskResult |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.vivlaniv.nexohub | ||
|
||
// task interfaces | ||
|
||
sealed interface Task { | ||
val id: String | ||
} | ||
|
||
sealed interface TaskResult { | ||
// task id | ||
val tid: String | ||
|
||
// status code (0 - OK, >0 - error depends on handler) | ||
val code: Int | ||
get() = 0 | ||
|
||
// error message if task resulted into error | ||
val errorMessage: String? | ||
get() = null | ||
} |
Oops, something went wrong.