TagConnectionStateMachine

public class TagConnectionStateMachine extends Object implements StateMachine

A state machine for handling connecting to a tag. It receives events fromBleAdapterviaTagConnectionStateMachine. State changes can be observed viaTagConnectionStateMachine.

TagConnectionStateMachine has two child state machines. First events from onConnectStateEvent are forwarded to aTagPairingStateMachine. Once the tag is paired the child will be replaced with aProtocolInitializationStateMachine. TagConnectionStateMachine will emitConnectionState. When the connection has been established theConnectionStatewill be emitted with an instance of the connected tag.

Constructors

TagConnectionStateMachine

public TagConnectionStateMachine(BluetoothDevice device, List<Revision> badFirmwareVersions, Function<BluetoothDevice> connectMethod, VidPidMid targetUjtFirmwareVidPid)

Creates a new instance of TagConnectionStateMachine.

Parameters

Name Description
BluetoothDevice device

the device to connect to.

List<Revision> badFirmwareVersions
Function<BluetoothDevice> connectMethod

a reference to BleAdapter.connect()

VidPidMid targetUjtFirmwareVidPid

Methods

getState

public Signal<ConnectionState> getState()

ReturnValue

Name Description
Signal<ConnectionState>

onStateEvent

public void onStateEvent(ConnectState state)

Parameters

Name Description
ConnectState state

ReturnValue

Name Description
void

connect

public void connect(boolean isUserInitiated)

Starts the connection process.

Parameters

Name Description
boolean isUserInitiated

ReturnValue

Name Description
void

destroy

public void destroy()

ReturnValue

Name Description
void