public interface

Link

org.ocast.core.Link
Known Indirect Subclasses

Class Overview

Interface Link is implemented by driver libraries to provide a network link with the device

Summary

Nested Classes
interface Link.LinkListener Listener interface to be notified of event happening on the Link  
Public Methods
abstract void connect(Runnable onSuccess, Consumer<Throwable> onFailure)
Establish a communication link with the device
abstract void disconnect(Runnable onSuccess)
Release the communication link
abstract String getUrl()
Returns the URL used to establish the link
abstract boolean sendPayload(String domain, JSONObject payload, Consumer<Reply> onSuccess, Consumer<Throwable> onFailure)
Send a payload on the link for the given Module

Public Methods

public abstract void connect (Runnable onSuccess, Consumer<Throwable> onFailure)

Establish a communication link with the device

Parameters
onSuccess called when the link has been properly connected
onFailure called when an error

public abstract void disconnect (Runnable onSuccess)

Release the communication link

public abstract String getUrl ()

Returns the URL used to establish the link

public abstract boolean sendPayload (String domain, JSONObject payload, Consumer<Reply> onSuccess, Consumer<Throwable> onFailure)

Send a payload on the link for the given Module

Parameters
domain the targeted Module
payload the payload to be sent
onSuccess called on success, providing the Reply
onFailure called if an error occured