Class RestNetworkService

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void claim​(java.lang.String id)
      Claim an already existing network by its UUID
      java.lang.String createDevice​(java.lang.String networkId)
      Create a device under a network
      NetworkMeta createNetwork()
      Create virtual network.
      NetworkMeta fetch​(java.lang.String id)
      Fetch existing network
      CreatorResponse getCreator()
      Get a network creator object used for creating a simulated IoT network
      CreatorResponse getCreator​(boolean manufacturerAsOwner)
      Get a network creator object used for creating a simulated IoT network
      DeviceResponse getDevice​(java.util.UUID device)
      Fetch a device by its UUID
      java.lang.String getState​(java.util.UUID id)
      Get the current state of a value of a network.
      ValueResponse getValue​(java.util.UUID id)
      Fetch a value by its UUID
      void share​(java.lang.String networkId, java.lang.String friendUsername)
      Share existing network with another user
      void share​(NetworkMeta network, UserResponse friend)
      Share existing network with another user
      void updateState​(java.util.UUID id, java.lang.String data)
      Update a control state on a network
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RestNetworkService

        public RestNetworkService​(RestSession session)
    • Method Detail

      • claim

        public void claim​(java.lang.String id)
                   throws java.lang.Exception
        Claim an already existing network by its UUID
        Specified by:
        claim in interface NetworkService
        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:
        getCreator in interface NetworkService
        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:
        getCreator in interface NetworkService
        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:
        createNetwork in interface NetworkService
        Returns:
        Network
        Throws:
        java.lang.Exception
      • fetch

        public NetworkMeta fetch​(java.lang.String id)
                          throws java.lang.Exception
        Fetch existing network
        Specified by:
        fetch in interface NetworkService
        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:
        share in interface NetworkService
        Parameters:
        network - Network
        friend - Friend
        Throws:
        java.lang.Exception
      • share

        public void share​(java.lang.String networkId,
                          java.lang.String friendUsername)
                   throws java.lang.Exception
        Share existing network with another user
        Specified by:
        share in interface NetworkService
        Parameters:
        networkId - Network UUID
        friendUsername - Friend username
        Throws:
        java.lang.Exception
      • updateState

        public void updateState​(java.util.UUID id,
                                java.lang.String data)
                         throws java.lang.Exception
        Update a control state on a network
        Specified by:
        updateState in interface NetworkService
        Parameters:
        id - State UUID
        data - Desired value
        Throws:
        java.lang.Exception
      • getState

        public java.lang.String getState​(java.util.UUID id)
                                  throws java.lang.Exception
        Get the current state of a value of a network. Usually used for getting the current report state of a device value
        Specified by:
        getState in interface NetworkService
        Parameters:
        id - State UUID
        Returns:
        State value
        Throws:
        java.lang.Exception
      • createDevice

        public java.lang.String createDevice​(java.lang.String networkId)
                                      throws java.lang.Exception
        Create a device under a network
        Specified by:
        createDevice in interface NetworkService
        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:
        getDevice in interface NetworkService
        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:
        getValue in interface NetworkService
        Parameters:
        id - value UUID
        Returns:
        value data
        Throws:
        java.lang.Exception