Android Link

The Link is a representation of the connection between two bluetooth devices.
The Link's interface provides the user the ability to send commands and access Link attributes.

Attributes

The state of the Link

Declaration

public Link.State getState();

Returns

The current state of the link

Discussion

The possible states of the link are represented by the enum Link.State

The name of the Link

Declaration

public Link.State getName();

Returns

The name of the link

Discussion

This is the name of the Link's underlying bluetooth device

The serial number of the Link

Declaration

public DeviceSerial getSerial();

Returns

The serial number of the link

Send Command

Send a command to the Link

Declaration

public void sendCommand(Bytes bytes, CommandCallback callback);

Parameters

bytes

The command bytes that will be sent to the link

callback

A CommandCallback object that is invoked with the command result

Discussion

Before sending the command, the link has to be authenticated. Commands can only be sent to synchronously

Send a command to the Link

Declaration

public void sendCommand(Bytes bytes, Bytes bytes, ContentType contentType, int version, CommandCallback callback);

Parameters

bytes

The command bytes that will be sent to the link

contentType

The command content typeSee ContentType for possible options

version

The command version

callback

A CommandCallback object that is invoked with the command result

Discussion

Overloaded sendCommand method that also accepts content type and version

Read More

Sub Types

State

Declaration

enum State { DISCONNECTED, CONNECTED, AUTHENTICATED }

Discussion

The possible states of the link

Command callback

Declaration

public interface CommandCallback { 
    void onCommandSent(); 
    void onCommandFailed(LinkError error); 
}

Discussion

CommandCallback is used to notify the user about the command result