generated from SmartOperatingBlock/kotlin-template-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add environment data concepts
- Loading branch information
1 parent
18ca20d
commit 4eb67ce
Showing
1 changed file
with
64 additions
and
0 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,64 @@ | ||
/* | ||
* Copyright (c) 2023. Smart Operating Block | ||
* | ||
* Use of this source code is governed by an MIT-style | ||
* license that can be found in the LICENSE file or at | ||
* https://opensource.org/licenses/MIT. | ||
*/ | ||
|
||
package entity.environment | ||
|
||
/** | ||
* Module that contains all the data useful to describe an environment. | ||
*/ | ||
object EnvironmentData { | ||
|
||
/** | ||
* Temperature concept. | ||
* It is described by the current temperature [value] expressed in a [unit]. | ||
*/ | ||
data class Temperature(val value: Double, val unit: TemperatureUnit = TemperatureUnit.CELSIUS) | ||
|
||
/** | ||
* This enum describe the possible [Temperature] unit of measurement. | ||
*/ | ||
enum class TemperatureUnit { | ||
/** | ||
* Celsius unit. | ||
*/ | ||
CELSIUS | ||
} | ||
|
||
/** | ||
* Humidity concept. | ||
* It is described by the current [percentage] of humidity. So it describes the Relative Humidity. | ||
*/ | ||
data class Humidity(val percentage: Double) | ||
|
||
/** | ||
* Luminosity concept. | ||
* It is described by the current luminosity [value] expressed in a [unit]. | ||
*/ | ||
data class Luminosity(val value: Double, val unit: LightUnit = LightUnit.LUX) { | ||
init { | ||
// Constructor validation | ||
require(this.value >= 0) | ||
} | ||
} | ||
|
||
/** | ||
* This enum describe the possibile [Luminosity] unit of measurement. | ||
*/ | ||
enum class LightUnit { | ||
/** | ||
* Lux unit. | ||
*/ | ||
LUX | ||
} | ||
|
||
/** | ||
* Describe the presence inside a Room of the Operating Block. | ||
* @param[presenceDetected] true if someone is in the room, false otherwise. | ||
*/ | ||
data class Presence(val presenceDetected: Boolean) | ||
} |