Skip to content

Commit

Permalink
chore: add environment data concepts
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaGiulianelli committed Feb 23, 2023
1 parent 18ca20d commit 4eb67ce
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions src/main/kotlin/entity/environment/EnvironmentData.kt
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)
}

0 comments on commit 4eb67ce

Please sign in to comment.