recfz

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FlipperZero

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

FlipperZero represents the flipper zero device.

func NewFlipperZero

func NewFlipperZero(opts ...Opts) (*FlipperZero, error)

NewFlipperZero creates a new flipper zero device. If the port is not static, it will try to autodetect the flipper.

func (*FlipperZero) Close

func (f *FlipperZero) Close()

Close closes the connection to the flipper zero.

func (*FlipperZero) Connect

func (f *FlipperZero) Connect() error

Connect connects to the flipper zero device. It will indefinitely try to reconnect if the connection is lost.

func (*FlipperZero) Connected

func (f *FlipperZero) Connected() bool

Connected returns true if the flipper zero is connected.

func (*FlipperZero) GetFlipper

func (f *FlipperZero) GetFlipper() (*flipper.Flipper, error)

GetFlipper returns the flipper instance. If the flipper is not connected, it returns an error.

func (*FlipperZero) SendLongPress

func (f *FlipperZero) SendLongPress(event flipper.InputKey)

SendLongPress sends a long press event to the flipper zero device. If the flipper zero device is not connected, it will do nothing.

func (*FlipperZero) SendShortPress

func (f *FlipperZero) SendShortPress(event flipper.InputKey)

SendShortPress sends a short press event to the flipper zero device. If the flipper zero device is not connected, it will do nothing.

func (*FlipperZero) SetConn

func (f *FlipperZero) SetConn(c serial.Port)

SetConn sets a serial connection to the flipper zero.

func (*FlipperZero) SetFlipper

func (f *FlipperZero) SetFlipper(fz *flipper.Flipper)

SetFlipper can be used to set a flipper instance.

type Opts

type Opts func(f *FlipperZero)

Opts represents an optional configuration for the flipper zero.

func WithContext

func WithContext(ctx context.Context) Opts

WithContext sets the context for the flipper zero.

func WithLogger

func WithLogger(l *log.Logger) Opts

WithLogger sets the logger for the flipper zero.

func WithPort

func WithPort(port string) Opts

WithPort sets the port of the flipper zero.

func WithStreamScreenCallback

func WithStreamScreenCallback(cb func(frame flipper.ScreenFrame)) Opts

WithStreamScreenCallback sets the callback for the screen stream.

Jump to

Keyboard shortcuts

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