File tree Expand file tree Collapse file tree 1 file changed +64
-0
lines changed
src/main/kotlin/entity/environment Expand file tree Collapse file tree 1 file changed +64
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments