public class

ReferenceLink

extends Object
implements Link
java.lang.Object
   ↳ org.ocast.referencedriver.ReferenceLink

Class Overview

Defines a logical link between the driver and a remote device

Summary

Constants
int PING_INTERVAL
Public Constructors
ReferenceLink(LinkProfile profile, Link.LinkListener listener)
Public Methods
void connect(Runnable onSuccess, Consumer<Throwable> onFailure)
Establish a communication link with the device
void disconnect(Runnable onSuccess)
Release the communication link
String getUrl()
Returns the URL used to establish the link
boolean sendPayload(String domain, JSONObject message, Consumer<Reply> onSuccess, Consumer<Throwable> onFailure)
Send a payload on the link for the given Module
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.ocast.core.Link

Constants

public static final int PING_INTERVAL

Constant Value: 7 (0x00000007)

Public Constructors

public ReferenceLink (LinkProfile profile, Link.LinkListener listener)

Public Methods

public 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 void disconnect (Runnable onSuccess)

Release the communication link

public String getUrl ()

Returns the URL used to establish the link

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

Send a payload on the link for the given Module

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