Package wappsto.iot.network
Class VirtualIoTNetwork
- java.lang.Object
-
- wappsto.iot.network.VirtualIoTNetwork
-
public class VirtualIoTNetwork extends java.lang.ObjectSimulated IoT device. Keeps track of the internal state of the device
-
-
Field Summary
Fields Modifier and Type Field Description IoTClientclientNetworkSchemaschema
-
Constructor Summary
Constructors Constructor Description VirtualIoTNetwork(NetworkSchema schema, IoTClient client)Instantiate the network
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.UUIDgetControlStateId(int index)Return the UUID of a control state from a listjava.util.UUIDgetReportStateId(int index)Return the UUID of a report state from a listbooleanisRunning()Check the status of the networkvoidstop()Stop the networkvoidupdateControlState(StateData request)Updates a report state via an incoming control state request from the server.voidupdateReportState(StateData request)Update a report state directly
-
-
-
Field Detail
-
schema
public final NetworkSchema schema
-
client
public final IoTClient client
-
-
Constructor Detail
-
VirtualIoTNetwork
public VirtualIoTNetwork(NetworkSchema schema, IoTClient client) throws java.lang.Exception
Instantiate the network- Parameters:
schema- internal data structure of the network containing devices values and statesclient- Client between the network and the conneciton- Throws:
java.lang.Exception
-
-
Method Detail
-
updateControlState
public void updateControlState(StateData request)
Updates a report state via an incoming control state request from the server. This network is designed to be an echo network, so it simply sets the report state to the value of the control state- Parameters:
request- update request with a state UUID and the desired value
-
updateReportState
public void updateReportState(StateData request) throws java.lang.Exception
Update a report state directly- Parameters:
request-- Throws:
java.lang.Exception
-
getControlStateId
public java.util.UUID getControlStateId(int index)
Return the UUID of a control state from a list- Parameters:
index-- Returns:
- control state UUID
-
getReportStateId
public java.util.UUID getReportStateId(int index)
Return the UUID of a report state from a list- Parameters:
index-- Returns:
- report state UUID
-
stop
public void stop()
Stop the network
-
isRunning
public boolean isRunning()
Check the status of the network- Returns:
- true: network is running false: network is stopped
-
-