Package wappsto.api.rest.network
Class RestNetworkService
- java.lang.Object
-
- wappsto.api.rest.network.RestNetworkService
-
- All Implemented Interfaces:
NetworkService
public class RestNetworkService extends java.lang.Object implements NetworkService
-
-
Constructor Summary
Constructors Constructor Description RestNetworkService(RestSession session)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclaim(java.lang.String id)Claim an already existing network by its UUIDjava.lang.StringcreateDevice(java.lang.String networkId)Create a device under a networkNetworkMetacreateNetwork()Create virtual network.NetworkMetafetch(java.lang.String id)Fetch existing networkCreatorResponsegetCreator()Get a network creator object used for creating a simulated IoT networkCreatorResponsegetCreator(boolean manufacturerAsOwner)Get a network creator object used for creating a simulated IoT networkDeviceResponsegetDevice(java.util.UUID device)Fetch a device by its UUIDjava.lang.StringgetState(java.util.UUID id)Get the current state of a value of a network.ValueResponsegetValue(java.util.UUID id)Fetch a value by its UUIDvoidshare(java.lang.String networkId, java.lang.String friendUsername)Share existing network with another uservoidshare(NetworkMeta network, UserResponse friend)Share existing network with another uservoidupdateState(java.util.UUID id, java.lang.String data)Update a control state on a network
-
-
-
Constructor Detail
-
RestNetworkService
public RestNetworkService(RestSession session)
-
-
Method Detail
-
claim
public void claim(java.lang.String id) throws java.lang.ExceptionClaim an already existing network by its UUID- Specified by:
claimin interfaceNetworkService- Parameters:
id-- Throws:
java.lang.Exception
-
getCreator
public CreatorResponse getCreator() throws java.lang.Exception
Get a network creator object used for creating a simulated IoT network- Specified by:
getCreatorin interfaceNetworkService- Returns:
- creator object
- Throws:
java.lang.Exception
-
getCreator
public CreatorResponse getCreator(boolean manufacturerAsOwner) throws java.lang.Exception
Get a network creator object used for creating a simulated IoT network- Specified by:
getCreatorin interfaceNetworkService- Parameters:
manufacturerAsOwner- parameter sent with the POST request- Returns:
- creator object
- Throws:
java.lang.Exception
-
createNetwork
public NetworkMeta createNetwork() throws java.lang.Exception
Create virtual network. This does not return a network creator- Specified by:
createNetworkin interfaceNetworkService- Returns:
- Network
- Throws:
java.lang.Exception
-
fetch
public NetworkMeta fetch(java.lang.String id) throws java.lang.Exception
Fetch existing network- Specified by:
fetchin interfaceNetworkService- Parameters:
id-- Returns:
- Network
- Throws:
java.lang.Exception
-
share
public void share(NetworkMeta network, UserResponse friend) throws java.lang.Exception
Share existing network with another user- Specified by:
sharein interfaceNetworkService- Parameters:
network- Networkfriend- Friend- Throws:
java.lang.Exception
-
share
public void share(java.lang.String networkId, java.lang.String friendUsername) throws java.lang.ExceptionShare existing network with another user- Specified by:
sharein interfaceNetworkService- Parameters:
networkId- Network UUIDfriendUsername- Friend username- Throws:
java.lang.Exception
-
updateState
public void updateState(java.util.UUID id, java.lang.String data) throws java.lang.ExceptionUpdate a control state on a network- Specified by:
updateStatein interfaceNetworkService- Parameters:
id- State UUIDdata- Desired value- Throws:
java.lang.Exception
-
getState
public java.lang.String getState(java.util.UUID id) throws java.lang.ExceptionGet the current state of a value of a network. Usually used for getting the current report state of a device value- Specified by:
getStatein interfaceNetworkService- Parameters:
id- State UUID- Returns:
- State value
- Throws:
java.lang.Exception
-
createDevice
public java.lang.String createDevice(java.lang.String networkId) throws java.lang.ExceptionCreate a device under a network- Specified by:
createDevicein interfaceNetworkService- Parameters:
networkId- network to create the device under- Returns:
- device UUID
- Throws:
java.lang.Exception
-
getDevice
public DeviceResponse getDevice(java.util.UUID device) throws java.lang.Exception
Fetch a device by its UUID- Specified by:
getDevicein interfaceNetworkService- Parameters:
device-- Returns:
- device data
- Throws:
java.lang.Exception
-
getValue
public ValueResponse getValue(java.util.UUID id) throws java.lang.Exception
Fetch a value by its UUID- Specified by:
getValuein interfaceNetworkService- Parameters:
id- value UUID- Returns:
- value data
- Throws:
java.lang.Exception
-
-