public interface HardwareWallet extends Connectable
Interface to provide the following to applications:
Typically a hardware wallet device is wrapped by a client that provides the higher protocol messages such as Initialise or Ping.
Modifier and Type | Method and Description |
---|---|
void |
applySpecification(HardwareWalletSpecification specification)
Apply any hardware wallet specific parameters
|
HardwareWalletSpecification |
getDefaultSpecification() |
HardwareWalletSpecification |
getSpecification() |
String |
name()
Assist downstream API consumers with identifying the source of events
|
com.google.common.base.Optional<MessageEvent> |
readMessage(int duration,
TimeUnit timeUnit)
Read a protobuf message from the hardware wallet and adapt it to a Core message event.
|
void |
writeMessage(com.google.protobuf.Message message)
Send a message to the hardware wallet using the generated protocol buffer classes
|
attach, connect, disconnect, hardDetach, softDetach
HardwareWalletSpecification getSpecification()
HardwareWalletSpecification getDefaultSpecification()
void applySpecification(HardwareWalletSpecification specification)
Apply any hardware wallet specific parameters
Implementers should override this, but call super.applySpecification(specification) as part of the application process
specification
- The HardwareWalletSpecification
com.google.common.base.Optional<MessageEvent> readMessage(int duration, TimeUnit timeUnit)
Read a protobuf message from the hardware wallet and adapt it to a Core message event.
Consumers of this interface should check the returned message event wrapper for failure modes as appropriate.
Forcing early adaption to a message event eases the implementation in many ways.
duration
- The durationtimeUnit
- The time unitvoid writeMessage(com.google.protobuf.Message message)
Send a message to the hardware wallet using the generated protocol buffer classes
Any response will be provided through the event bus subscribers
If this call fails the hardware wallet will be closed and a DISCONNECT message will be emitted
message
- A generated protocol buffer message (e.g. Message.Initialize)String name()
Assist downstream API consumers with identifying the source of events
Copyright © 2013–2019 Bitcoin Solutions Ltd. All rights reserved.