public abstract class AbstractHardwareWalletState extends Object implements HardwareWalletState
Abstract base class to provide the following to hardware wallet states:
Constructor and Description |
---|
AbstractHardwareWalletState() |
Modifier and Type | Method and Description |
---|---|
void |
await(HardwareWalletContext context)
Invoke the state's awaiting behaviour.
|
protected void |
handleUnexpectedMessageEvent(HardwareWalletContext context,
MessageEvent event)
Provide standard handling for an unexpected message so the downstream consumer can react appropriately
|
protected abstract void |
internalTransition(HardwareWalletClient client,
HardwareWalletContext context,
MessageEvent event)
Initiate a move to the next state through the given client.
|
void |
transition(HardwareWalletClient client,
HardwareWalletContext context,
MessageEvent event)
Initiate a move to the next state through the given client.
|
public void await(HardwareWalletContext context)
HardwareWalletState
Invoke the state's awaiting behaviour. This may cause an immediate state transition (such as from Attached to Connected) or it may start a background process to wait for an event.
await
in interface HardwareWalletState
context
- The current context providing parameters for decisionspublic void transition(HardwareWalletClient client, HardwareWalletContext context, MessageEvent event)
HardwareWalletState
Initiate a move to the next state through the given client.
Typically the client is used to move in to or out of a "waiting state" and the context is updated with new data
transition
in interface HardwareWalletState
client
- The hardware wallet client for sending messagescontext
- The current context providing parameters for decisionsevent
- The event driving the transitionprotected abstract void internalTransition(HardwareWalletClient client, HardwareWalletContext context, MessageEvent event)
Initiate a move to the next state through the given client.
Typically the client is used to move in to or out of a "waiting state" and the context is updated with new data
client
- The hardware wallet client for sending messagescontext
- The current context providing parameters for decisionsevent
- The event driving the transitionprotected void handleUnexpectedMessageEvent(HardwareWalletContext context, MessageEvent event)
Provide standard handling for an unexpected message so the downstream consumer can react appropriately
context
- The current context providing parameters for decisionsevent
- The event driving the transitionCopyright © 2013–2019 Bitcoin Solutions Ltd. All rights reserved.