bridgecommon

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: 14 Imported by: 0

Documentation

Overview

Package bridgecommon provides common util functions to bridge the backend to a native environment.

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(
	testnet bool,
	theCommunication NativeCommunication,
	backendEnvironment backend.Environment)

Serve serves the BitBox API for use in a native client.

func Shutdown

func Shutdown()

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

Types

type BackendEnvironment

type BackendEnvironment struct {
	NotifyUserFunc  func(string)
	DeviceInfosFunc func() []usb.DeviceInfo
	SystemOpenFunc  func(string) error
}

BackendEnvironment implements backend.Environment.

func (*BackendEnvironment) DeviceInfos

func (env *BackendEnvironment) DeviceInfos() []usb.DeviceInfo

DeviceInfos implements backend.Environment

func (*BackendEnvironment) NotifyUser

func (env *BackendEnvironment) NotifyUser(text string)

NotifyUser implements backend.Environment

func (*BackendEnvironment) SystemOpen

func (env *BackendEnvironment) SystemOpen(url string) error

SystemOpen implements backend.Environment

type NativeCommunication

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

NativeCommunication provides function to pass responses and push notifications to the native environment.

Jump to

Keyboard shortcuts

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