wrapper

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: 3 Imported by: 1

README

wrapper

Go wrapper for Robomaster's Unity Bridge library

This is the low level interface with some niceties included (like supporting Go callbacks). It is not very useful unless you know how to use it as everything is based on specific events supported by it and used to communicate with the robot.

Supported platforms:

Platform Support Test Status
Windows (AMD64) Native Tested
MacOS (AMD64, ARM64) Native for AMD64 and through Rosetta for ARM64 Tested
Linux (AMD64) Through a Wine bridge that hosts the Windows DLL Tested
iOS (ARM64) Native Tested (*)
Android (ARM, ARM64) Native Tested

(*) Not throughly tested though.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UnityBridge

type UnityBridge interface {
	// Create sets up the UnityBridge using the given name (apparently only
	// "Robomaster" is supported), debuggable status (true to enable log
	// debugging) and path for log files.
	Create(name string, debuggable bool, logPath string)

	// Initialize tries to initialize the UnityBridge. Returns true if
	// successful.
	Initialize() bool

	// SetEventCallback sets the callback function for the given event type.
	// Any events with that type will be sent to the given callback.
	SetEventCallback(eventTypeCode uint64, c callback.Callback)

	// SendEvent sends an event with the given tag. The output field in this
	// case, if not nil or empty, will be filled with any data immediatelly
	// returned as a result of this call. The original Robomaster code seems to
	// always use a 2048 byte output for this but we may want to double check
	// what is actually used.
	SendEvent(eventCode uint64, output []byte, tag uint64)

	// SendEventWithString sends an event with the given string data and tag.
	SendEventWithString(eventCode uint64, data string, tag uint64)

	// SendEventWithNumber sends an event with the given number data and tag.
	SendEventWithNumber(eventCode uint64, data, tag uint64)

	// GetSecurityKeyByKeyChainIndex returns the security key associated with
	// the given index.
	GetSecurityKeyByKeyChainIndex(index int) string

	// Unitialize uninitializes the UnityBridge.
	Uninitialize()

	// Destroy destroys the UnityBridge.
	Destroy()
}

UnityBridge is the interface to the UnityBridge library. It will always wrap the specific implementation of the UnityBridge librart for the specific platform it is being compiled on (currently there are native implementations for windows_amd64, darwin_amd64, ios_arm64, android_arm64 and android_arm. There is also a linux_amd64 implementation through Wine).

func Get

func Get(l *logger.Logger) UnityBridge

Get returns a platform specific singleton instance of the UnityBridge interface.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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