Skip to content

Commit fa9c4b4

Browse files
feat: implement ambient light actions
1 parent 06dba7a commit fa9c4b4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 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.DimmableActuator;
1314
import entity.room.RoomID;
15+
import infrastructure.wot.WotInvoker;
1416

1517
import java.util.logging.Logger;
1618

@@ -19,18 +21,23 @@
1921
* Operating Block.
2022
*/
2123
public class AmbientLight extends AbstractActuatorInRoomArtifact implements DimmableArtifact {
24+
private DimmableActuator actuator;
25+
private WotInvoker wotInvoker;
2226
/**
2327
* Initialize the ambient light artifact.
2428
* @param roomId the room id where the ambient light is placed.
2529
*/
2630
void init(final String roomId) {
2731
super.init(ActuatorType.AMBIENT_LIGHT, new RoomID(roomId));
32+
this.actuator = new DimmableActuator(this.getActuatorID());
33+
this.wotInvoker = new WotInvoker();
2834
}
2935

3036
@Override
3137
@OPERATION
3238
public final void setIntensity(final int luxToSet) {
3339
Logger.getLogger(AmbientLight.class.toString())
3440
.info("[" + this.getRoomId().getId() + "] " + this.getActuatorID().getId() + " Set " + luxToSet + " LUX");
41+
this.actuator.setIntensity(luxToSet, this.wotInvoker);
3542
}
3643
}

0 commit comments

Comments
 (0)