wrapper

package
v0.0.0-...-3e1ade8 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FuncCreateUnityBridge byte = iota
	FuncDestroyUnityBridge
	FuncUnityBridgeInitialize
	FuncUnityBridgeUninitialize
	FuncUnitySetEventCallback
	FuncUnitySendEvent
	FuncUnitySendEventWithNumber
	FuncUnitySendEventWithString
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EventCallback

type EventCallback func(eventCode uint64, data []byte, tag uint64)

EventCallback is the type required for functions that want to handle bridge events.

type Linux

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

func (*Linux) CreateUnityBridge

func (l *Linux) CreateUnityBridge(name string, debuggable bool)

func (*Linux) DestroyUnityBridge

func (l *Linux) DestroyUnityBridge()

func (*Linux) UnityBridgeInitialize

func (l *Linux) UnityBridgeInitialize() bool

func (*Linux) UnityBridgeUninitialize

func (l *Linux) UnityBridgeUninitialize()

func (*Linux) UnitySendEvent

func (l *Linux) UnitySendEvent(eventCode uint64, info []byte, tag uint64)

func (*Linux) UnitySendEventWithNumber

func (l *Linux) UnitySendEventWithNumber(eventCode, info, tag uint64)

func (*Linux) UnitySendEventWithString

func (l *Linux) UnitySendEventWithString(eventCode uint64, info string,
	tag uint64)

func (*Linux) UnitySetEventCallback

func (l *Linux) UnitySetEventCallback(eventCode uint64,
	eventCallback EventCallback)

type Wrapper

type Wrapper interface {
	// CreateUnityBridge creates the app/Robomaster bridge. The name
	// parameter *MUST* be "Robomaster" otherwise the bridge will simply not
	// do anything it seems. The debuggable parameter enables or disables
	// debugging to the console/terminal. This has to be called before any
	// other methods.
	CreateUnityBridge(name string, debuggable bool)

	// DestroyUnityBridge removes the bridge. It should only be called after
	// the bridge was unitialized (or never initialized).
	DestroyUnityBridge()

	// Initializes the bridge, effectivelly starting it. Returns true on
	// success or false on failure.
	UnityBridgeInitialize() bool

	// UnityBridgeUninitialize uninitializes the bridge.
	UnityBridgeUninitialize()

	// UnitySetEventCallback sets a callback function for a specific event
	// code.
	UnitySetEventCallback(eventCode uint64, eventCallback EventCallback)

	// UnitySendEvent sends an event wieth the given eventCode, data and
	// tag to the bridge. The tag parameter is used to track responses to a
	// specific request (i.e. An event sent with tag set to X will result
	// in one or more callbacks with tag also set to X).
	UnitySendEvent(eventCode uint64, data []byte, tag uint64)

	// UnitySendEventWithString same as above, but data is a string.
	UnitySendEventWithString(eventCode uint64, data string, tag uint64)

	// UnitySendEventWithString same as above, but data is a uint64.
	UnitySendEventWithNumber(eventCode uint64, data uint64, tag uint64)
}

Wrapper is a Go wrapper for DJI's Robomaster unitybridge.dll functions. Descriptions of methods below are mostly what could be seem through observation and might be incomplete or even incorrect. Also, the interface does not cover all exported methods (more specifically, it does not cover GetRenderEventFunc, UnityPluginLoad and UnityPluginUnload), only the ones actually used to interface with the Robomaster S1.

func New

func New(string) (Wrapper, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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