Skip to content

Commit 4eb67ce

Browse files
chore: add environment data concepts
1 parent 18ca20d commit 4eb67ce

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Copyright (c) 2023. Smart Operating Block
3+
*
4+
* Use of this source code is governed by an MIT-style
5+
* license that can be found in the LICENSE file or at
6+
* https://opensource.org/licenses/MIT.
7+
*/
8+
9+
package entity.environment
10+
11+
/**
12+
* Module that contains all the data useful to describe an environment.
13+
*/
14+
object EnvironmentData {
15+
16+
/**
17+
* Temperature concept.
18+
* It is described by the current temperature [value] expressed in a [unit].
19+
*/
20+
data class Temperature(val value: Double, val unit: TemperatureUnit = TemperatureUnit.CELSIUS)
21+
22+
/**
23+
* This enum describe the possible [Temperature] unit of measurement.
24+
*/
25+
enum class TemperatureUnit {
26+
/**
27+
* Celsius unit.
28+
*/
29+
CELSIUS
30+
}
31+
32+
/**
33+
* Humidity concept.
34+
* It is described by the current [percentage] of humidity. So it describes the Relative Humidity.
35+
*/
36+
data class Humidity(val percentage: Double)
37+
38+
/**
39+
* Luminosity concept.
40+
* It is described by the current luminosity [value] expressed in a [unit].
41+
*/
42+
data class Luminosity(val value: Double, val unit: LightUnit = LightUnit.LUX) {
43+
init {
44+
// Constructor validation
45+
require(this.value >= 0)
46+
}
47+
}
48+
49+
/**
50+
* This enum describe the possibile [Luminosity] unit of measurement.
51+
*/
52+
enum class LightUnit {
53+
/**
54+
* Lux unit.
55+
*/
56+
LUX
57+
}
58+
59+
/**
60+
* Describe the presence inside a Room of the Operating Block.
61+
* @param[presenceDetected] true if someone is in the room, false otherwise.
62+
*/
63+
data class Presence(val presenceDetected: Boolean)
64+
}

0 commit comments

Comments
 (0)