Skip to content

Commit 7f92ded

Browse files
chore: create presentation utility for actuator's digital twin
1 parent ce74e0a commit 7f92ded

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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 infrastructure.digitaltwins.adtpresentation;
10+
11+
import entity.actuator.ActuatorType;
12+
13+
/**
14+
* Presentation-related stuff for Azure Digital Twins about actuators.
15+
*/
16+
public final class ActuatorAdtPresentation {
17+
/** Relationship from room to medical technology. */
18+
public static final String HAS_ACTUATOR_RELATIONSHIP = "rel_has_actuator";
19+
20+
private static final String HEATING_TYPE = "0";
21+
private static final String COOLING_TYPE = "1";
22+
private static final String VENTILATION_TYPE = "2";
23+
private static final String AMBIENT_LIGHT_TYPE = "3";
24+
private static final String SURGICAL_LIGHT_TYPE = "4";
25+
26+
private ActuatorAdtPresentation() { }
27+
28+
/**
29+
* Convert a {@link ActuatorType} to the type used internally by the Digital Twin model
30+
* on Azure Digital Twins.
31+
* @param actuatorType the type of actuator to convert.
32+
* @return the converted type respect to the Actuator Digital Twin model.
33+
*/
34+
public static String toActuatorDigitalTwinType(final ActuatorType actuatorType) {
35+
return switch (actuatorType) {
36+
case HEATING -> HEATING_TYPE;
37+
case COOLING -> COOLING_TYPE;
38+
case VENTILATION -> VENTILATION_TYPE;
39+
case AMBIENT_LIGHT -> AMBIENT_LIGHT_TYPE;
40+
case SURGICAL_LIGHT -> SURGICAL_LIGHT_TYPE;
41+
};
42+
}
43+
}

0 commit comments

Comments
 (0)