Documentation ¶
Index ¶
- type Communication
- func (communication *Communication) Close()
- func (communication *Communication) Query(request []byte) ([]byte, error)
- func (communication *Communication) Read(p []byte) (n int, err error)
- func (communication *Communication) ReadFrame() ([]byte, error)
- func (communication *Communication) SendFrame(msg string) error
- func (communication *Communication) Write(p []byte) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Communication ¶
type Communication struct {
// contains filtered or unexported fields
}
Communication encodes JSON messages to/from a bitbox. The serialized messages are sent/received as USB packets, following the ISO 7816-4 standard.
func NewCommunication ¶
func NewCommunication( device io.ReadWriteCloser, usbCMD byte) *Communication
NewCommunication creates a new Communication.
func (*Communication) Close ¶
func (communication *Communication) Close()
Close closes the underlying device.
func (*Communication) Query ¶
func (communication *Communication) Query(request []byte) ([]byte, error)
Query sends a request and returns for the response. Blocking.
func (*Communication) Read ¶
func (communication *Communication) Read(p []byte) (n int, err error)
Read reads from the underlying device.
func (*Communication) ReadFrame ¶
func (communication *Communication) ReadFrame() ([]byte, error)
ReadFrame reads one usb message.
func (*Communication) SendFrame ¶
func (communication *Communication) SendFrame(msg string) error
SendFrame sends one usb message.
Click to show internal directories.
Click to hide internal directories.