Android Broadcaster

Broadcaster acts as a gateway to the application's capability to broadcast itself and handle Link connectivity.

Properties

State of the broadcaster

Declaration

public Broadcaster.State getState();

Discussion

The possible states of the local device are represented by the enum State.

public enum State { BLUETOOTH_UNAVAILABLE, IDLE, BROADCASTING }

The name of the broadcaster

Declaration

public String getName();

The certificates that are registered on the broadcaster

Declaration

public AccessCertificate[] getRegisteredCertificates();

Read More

The certificates that are stored in the device's database for other devices.

Declaration

public AccessCertificate[] getStoredCertificates();

Read More

An indiation of whether the alive pinging is active or not

Declaration

public boolean isAlivePinging();

Read More

Manage Listener

Set the listener instance to receive broadcaster events

Declaration

public void setListener(BroadcasterListener listener);

Discussion

The listener must implement the BroadcasterListener interface.

Read More

Broadcast

Start broadcasting the broadcaster via ble advertising

Declaration

public void startBroadcasting(StartCallback callback);

Parameters

callback

A Callback object that is invoked with the start broadcasting result.

Read More

Start broadcasting the broadcaster via ble advertising with custom configuration

Declaration

public void startBroadcasting(StartCallback callback, BroadcastConfiguration configuration);

Parameters

callback

A Callback object that is invoked with the start broadcasting result

configuration

The broadcast configuration

Read More

Broadcast Configuration

Declaration

class BroadcastConfiguration

Parameters

advertisemode

The advertise mode. See android.bluetooth.le.AdvertiseSettings for possible Advertise mode constants.

txpowerlevel

The tx power level. See android.bluetooth.le.AdvertiseSettings for possible TX power level constants.

broadcastTarget

The broadcasters target device serial number. This is used to only connect to a device with this specific serial number. Null means all connections are accepted.

overrideAdvertisedName

Whether the bluetooth device name is overriden by the SDK. This has to be true if parallel connections are expected. -

Discussion

Broadcast Configuration is used to configure some broadcasting options. Use the builder class to build the configuration and later pass it on to startBroadcasting().
For example, to not override the local devices name, the configuration would look like:

Example

BroadcastConfiguration configuration = new BroadcastConfiguration.Builder()
    .setOverridesAdvertisementName(false).build();
broadcaster.startBroadcasting(startCallback, configuration);

Start Callback

Declaration

public interface StartCallback {
    void onBroadcastingStarted();
    void onBroadcastingFailed(BroadcastError error);
}

Discussion

Startcallback is used to notify the user about the result of startBroadcasting().

Read More

Stops the advertisements and disconnects all the links

Declaration

public void stopBroadcasting();

Read More

Activate the alive ping mode

Declaration

public void startAlivePinging(long interval);

Parameters

interval

The interval after which alive ping is sent.

Read More

Deactivate the alive ping mode

Declaration

public void stopAlivePinging();

Read More

Manage Certificates

Register an accesscertificate for the broadcaster

Declaration

public Storage.Result registerCertificate(AccessCertificate certificate);

Parameters

certificate

The certificate that can be used by the Device to authorise Links

Returns

The storage result.

Read More

Stores a certificate to device s storage

Declaration

public Storage.Result storeCertificate(AccessCertificate certificate);

Parameters

certificate

The certificate that will be saved to the database

Returns

The storage result

Discussion

Stores the certificate to the database, mainly for other devices to read out and make an authenticated connection to this device.

Read More

Revokes a stored certificate from device s storage

Declaration

public Storage.Result revokeCertificate(byte[] serial);

Parameters

serial

The 9-byte serial number of the access providing device

Returns

The storage result.

Discussion

The stored certificate and its accompanying registered certificate are deleted from the storage.

Read More

The storage result enum

Declaration

public enum Storage.Result { SUCCESS(0), STORAGE_FULL(1), INTERNAL_ERROR(2) }

Discussion

These are the possible results for storage operations.