finder

package
v0.0.0-...-e766dbd Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BroadcastMessage

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

BroadcastMessage represents a broadcast message sent by a Robomaster robot.

func ParseBroadcastMessageData

func ParseBroadcastMessageData(data []byte) (*BroadcastMessage, error)

ParseBroadcastMessageData parses the given data as a BroadcastMessage. It returns the associated BroadcastMessage instance pointer and a nil error on success and a nil BroadcastMessage and a non-nil error on failure.

func (*BroadcastMessage) AppId

func (b *BroadcastMessage) AppId() uint64

func (*BroadcastMessage) IsPairing

func (b *BroadcastMessage) IsPairing() bool

func (*BroadcastMessage) SourceIp

func (b *BroadcastMessage) SourceIp() net.IP

func (*BroadcastMessage) SourceMac

func (b *BroadcastMessage) SourceMac() net.HardwareAddr

func (*BroadcastMessage) String

func (b *BroadcastMessage) String() string

type Finder

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

Finder provides an interface for finding a robot broadcasting its ip in the network.

func New

func New(l *support.Logger) *Finder

New returns a Finder instance with no associated ip.

func (*Finder) GetOrFindIP

func (f *Finder) GetOrFindIP(timeout time.Duration) (net.IP, error)

GetOrFindIP returns the ip of a robot if it is already know or tries to detect a robot broadcasting its ip in the network. The search will go on until a robot is detected or a timeout happens. Returns the robot ip and a nil error on success and a non-nil error on failure.

func (*Finder) SendACK

func (f *Finder) SendACK()

func (*Finder) SetIP

func (f *Finder) SetIP(ip net.IP)

SetIP forces the associated ip to be the given one. Useful for when connecting to a robot with a known ip.

Jump to

Keyboard shortcuts

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