communication

package
v4.14.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

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.

func (*Communication) Write

func (communication *Communication) Write(p []byte) (n int, err error)

Write writes to the underlying device.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL