File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
src/env/artifact/environment/roomartifact Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 10
10
11
11
import cartago .OPERATION ;
12
12
import entity .actuator .ActuatorType ;
13
+ import entity .actuator .SwitchableActuator ;
13
14
import entity .room .RoomID ;
15
+ import infrastructure .wot .WotInvoker ;
14
16
15
17
import java .util .logging .Logger ;
16
18
19
21
* to the heating part.
20
22
*/
21
23
public class Heater extends AbstractActuatorInRoomArtifact implements SwitchableArtifact {
24
+ private SwitchableActuator actuator ;
25
+ private WotInvoker wotInvoker ;
22
26
/**
23
27
* Initialize the heater artifact.
24
28
* @param roomId the room id where the heater is placed.
25
29
*/
26
30
void init (final String roomId ) {
27
31
super .init (ActuatorType .HEATING , new RoomID (roomId ));
32
+ this .actuator = new SwitchableActuator (this .getActuatorID ());
33
+ this .wotInvoker = new WotInvoker ();
28
34
}
29
35
30
36
@ Override
31
37
@ OPERATION
32
38
public final void turnOn () {
33
39
Logger .getLogger (Heater .class .toString ()).info ("[" + this .getRoomId ().getId () + "] "
34
40
+ this .getActuatorID ().getId () + " ON" );
41
+ actuator .turnOn (this .wotInvoker );
35
42
}
36
43
37
44
@ Override
38
45
@ OPERATION
39
46
public final void turnOff () {
40
47
Logger .getLogger (Heater .class .toString ()).info ("[" + this .getRoomId ().getId () + "] "
41
48
+ this .getActuatorID ().getId () + " OFF" );
49
+ actuator .turnOff (this .wotInvoker );
42
50
}
43
51
}
You can’t perform that action at this time.
0 commit comments