event

package
v0.0.0-...-7a59755 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataType

type DataType int

DataType is the type of data returned in an event callback.

const (
	DataTypeString DataType = iota
	DataTypeUint64
)

func DataTypeFromTag

func DataTypeFromTag(tag uint64) (DataType, uint64)

DataTypeFromTag returns the DataType and the actual tag value (i.e. without the data type) from a tag.

func (DataType) ParseData

func (d DataType) ParseData(data []byte) any

ParseData parses the data according to the DataType and returns it as an any type.

func (DataType) String

func (d DataType) String() string

String returns the string representation of the DataType.

type Event

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

Event represents a Unity Bridge event with associated type and sub-type.

func NewFromCode

func NewFromCode(eventCode uint64) *Event

NewFromCode creates a new Event from the given event code.

func NewFromType

func NewFromType(typ Type) *Event

NewFromType creates a new Event from the given type.

func NewFromTypeAndSubType

func NewFromTypeAndSubType(typ Type, subTyp uint32) *Event

NewFromTypeAndSubType creates a new Event from the given type and sub-type.

func (*Event) Code

func (e *Event) Code() uint64

Code returns the event code for the event.

func (*Event) Reset

func (e *Event) Reset(typ Type, subTyp uint32)

Reset resets the event type and sub-type.

func (*Event) ResetSubType

func (e *Event) ResetSubType(subTyp uint32)

ResetSubType resets the event sub-type.

func (*Event) String

func (e *Event) String() string

String returns a string representation of the event.

func (*Event) SubType

func (e *Event) SubType() uint32

SubType returns the event sub-type for the event.

func (*Event) Type

func (e *Event) Type() Type

Type returns the event type for the event.

type Type

type Type uint32

Type represents a Unity Bridge event type.

const (
	TypeSetValue          Type = iota // Sets the value of an attribute.
	TypeGetValue                      // Gets the value of an attribute.
	TypeGetAvailableValue             // Get cached value of an attribute.
	TypePerformAction                 // Perform an action.
	TypeStartListening                // Start listening for a specific event.
	TypeStopListening                 // Stop listening for a specific event.
	TypeActivation
	TypeLocalAlbum
	TypeFirmwareUpgrade

	TypeConnection         Type = 100 // Configure connection.
	TypeSecurity           Type = 101
	TypePrintLog           Type = 200
	TypeStartVideo         Type = 300 // Start video streaming.
	TypeStopVideo          Type = 301 // Stop video streaming.
	TypeRender             Type = 302
	TypeGetNativeTexture   Type = 303
	TypeVideoTransferSpeed Type = 304 // Video speed updates.
	TypeAudioDataRecv      Type = 305
	TypeVideoDataRecv      Type = 306
	TypeNativeFunctions    Type = 500
)

func AllTypes

func AllTypes() []Type

func (Type) String

func (t Type) String() string

type TypeCallback

type TypeCallback func(data []byte, dataType DataType)

TypeCallback is the type of the callback function that will be called when a type event is received. It will not be called for events that have sub-types.

Jump to

Keyboard shortcuts

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