Skip to content

Commit 66fde9d

Browse files
feat: implement heater actions
1 parent 9e8954a commit 66fde9d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/env/artifact/environment/roomartifact/Heater.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
import cartago.OPERATION;
1212
import entity.actuator.ActuatorType;
13+
import entity.actuator.SwitchableActuator;
1314
import entity.room.RoomID;
15+
import infrastructure.wot.WotInvoker;
1416

1517
import java.util.logging.Logger;
1618

@@ -19,25 +21,31 @@
1921
* to the heating part.
2022
*/
2123
public class Heater extends AbstractActuatorInRoomArtifact implements SwitchableArtifact {
24+
private SwitchableActuator actuator;
25+
private WotInvoker wotInvoker;
2226
/**
2327
* Initialize the heater artifact.
2428
* @param roomId the room id where the heater is placed.
2529
*/
2630
void init(final String roomId) {
2731
super.init(ActuatorType.HEATING, new RoomID(roomId));
32+
this.actuator = new SwitchableActuator(this.getActuatorID());
33+
this.wotInvoker = new WotInvoker();
2834
}
2935

3036
@Override
3137
@OPERATION
3238
public final void turnOn() {
3339
Logger.getLogger(Heater.class.toString()).info("[" + this.getRoomId().getId() + "] "
3440
+ this.getActuatorID().getId() + " ON");
41+
actuator.turnOn(this.wotInvoker);
3542
}
3643

3744
@Override
3845
@OPERATION
3946
public final void turnOff() {
4047
Logger.getLogger(Heater.class.toString()).info("[" + this.getRoomId().getId() + "] "
4148
+ this.getActuatorID().getId() + " OFF");
49+
actuator.turnOff(this.wotInvoker);
4250
}
4351
}

0 commit comments

Comments
 (0)