support

package
v0.0.0-...-9ffe791 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

View Source
const AnyAppID = 0

AnyAppID is a special app ID that can be used to indicate that any app ID should be accepted when connecting to a Robot.

Variables

This section is empty.

Functions

func GenerateAppID

func GenerateAppID() (uint64, error)

GenerateAppID generates a random app ID suitable to be used for Robomaster applications.

func SimpleEncryptDecrypt

func SimpleEncryptDecrypt(data []byte)

SimpleEncryptDecrypt encrypts or decrypts a byte slice using a simple algorithm. In other words:

SimpleEncryptDecrypt(SimpleEncryptDecrypt(data)) == data

This is used, for example, for the broadcast message sent by the robot when trying to pair with an app.

Types

type ResultListener

type ResultListener struct {
	// contains filtered or unexported fields
}

ResultListener is a helper class to listen for event results from the Unity Bridge. It allows callers to wait for new results, to get the last result obtained and to register a callback to be called when a new result is available. It is thread safe.

func NewResultListener

func NewResultListener(ub unitybridge.UnityBridge, l *logger.Logger,
	k *key.Key, cb result.Callback) *ResultListener

NewResultListener creates a new ResultListener instance.

func (*ResultListener) Result

func (ls *ResultListener) Result() *result.Result

Result returns the current result.

func (*ResultListener) Start

func (ls *ResultListener) Start() error

Start starts the listener. If cb is non nil, it will be called when a new result is available.

func (*ResultListener) Stop

func (ls *ResultListener) Stop() error

Stop stops the listener.

func (*ResultListener) WaitForAnyResult

func (ls *ResultListener) WaitForAnyResult(timeout time.Duration) *result.Result

WaitForAnyResult returns any existing result immediatelly or blocks until a result is available, a timeout happens or the listener is stopped. If result is nil, no result was available (for example, if the listener is closed). If result is non nil, Callers should inspect the result error code and description to check if the result is valid.

func (*ResultListener) WaitForNewResult

func (ls *ResultListener) WaitForNewResult(timeout time.Duration) *result.Result

WaitForNewResult blocks until a new result is available, a timeout happens or the listener is stopped. If result is nil, no result was available (for example, if the listener is closed). If result is non nil, Callers should inspect the result error code and description to check if the result is valid.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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