goserver

package
v4.10.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

README

BitBox Android Library

make build builds android.aar, which can be imported as a module into an Android project (Android Studio).

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BackendCall

func BackendCall(queryID int, jsonQuery string)

BackendCall bridges GET/POST calls (serverless, directly calling the backend handlers).

func Serve

func Serve(dataDir string, environment GoEnvironmentInterface, theGoAPI GoAPIInterface)

Serve serves the BitBox Wallet API for use in a mobile client. It is called when the application is started or wakes up from sleep.

func Shutdown

func Shutdown()

Shutdown is cleaning up after Serve. It is called when the application is closed or goes to sleep.

Types

type GoAPIInterface

type GoAPIInterface interface {
	Respond(queryID int, response string)
	PushNotify(msg string)
}

GoAPIInterface is used to pas api (GET/POST) responses and websocket push notifications to Android.

type GoDeviceInfoInterface

type GoDeviceInfoInterface interface {
	VendorID() int
	ProductID() int
	UsagePage() int
	Interface() int
	Serial() string
	Product() string
	Identifier() string
	Open() (GoReadWriteCloserInterface, error)
}

GoDeviceInfoInterface adapts usb.DeviceInfo's Open method to return the adapted ReadWriteCloser.

type GoEnvironmentInterface

type GoEnvironmentInterface interface {
	NotifyUser(string)
	DeviceInfo() GoDeviceInfoInterface
}

GoEnvironmentInterface adapts backend.Environment to return only one DeviceInfo instead of a slice of them, as a slice of interfaces does not seem to be supported by gomobile yet.

type GoReadWriteCloserInterface

type GoReadWriteCloserInterface interface {
	Read(n int) ([]byte, error)
	io.Writer
	io.Closer
}

GoReadWriteCloserInterface adapts io.ReadWriteCloser's Read method to return the byte read byte slice instead of the .Read([]byte) pattern. This is as gomobile bind seems to make a copy of passed slices instead of writing directly to it, so the byte slice never makes it back to Go-land.

Jump to

Keyboard shortcuts

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