display

package
v0.0.0-...-e717604 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRemote

func IsRemote(device string) bool

IsRemote returns true if the device string looks like a remote host:port address.

func ReadImageFile

func ReadImageFile(filePath string, width, height int) ([]byte, error)

ReadImageFile reads an image from a file path or URL and returns PNG-encoded bytes.

Types

type LocalDisplay

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

LocalDisplay implements Service for direct hardware access via SPI/GPIO.

func NewLocalDisplay

func NewLocalDisplay(device string) (*LocalDisplay, error)

NewLocalDisplay creates a new local display service for the given device.

func (*LocalDisplay) Clear

func (l *LocalDisplay) Clear() error

Clear clears the EPD to white.

func (*LocalDisplay) Close

func (l *LocalDisplay) Close() error

Close releases resources. For local display, this is a no-op.

func (*LocalDisplay) DisplayImage

func (l *LocalDisplay) DisplayImage(pngData []byte) error

DisplayImage accepts raw PNG data and displays it on the EPD.

func (*LocalDisplay) DisplayImageFromFile

func (l *LocalDisplay) DisplayImageFromFile(filePath string) error

DisplayImageFromFile reads an image from a file path or URL and displays it.

func (*LocalDisplay) DisplayText

func (l *LocalDisplay) DisplayText(text string) error

DisplayText renders text and displays it on the EPD.

func (*LocalDisplay) EPD

func (l *LocalDisplay) EPD() *epd.EPD

EPD returns the underlying EPD device for direct access (e.g. HardwareInit).

func (*LocalDisplay) HardwareInit

func (l *LocalDisplay) HardwareInit()

HardwareInit initializes (wakes) the display hardware.

func (*LocalDisplay) Sleep

func (l *LocalDisplay) Sleep() error

Sleep puts the EPD into sleep mode.

type RemoteDisplay

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

RemoteDisplay implements Service by forwarding calls to a remote daemon via gRPC.

func NewRemoteDisplay

func NewRemoteDisplay(address string) (*RemoteDisplay, error)

NewRemoteDisplay creates a new remote display service connected to the given address.

func (*RemoteDisplay) Clear

func (r *RemoteDisplay) Clear() error

Clear sends a clear command to the remote daemon.

func (*RemoteDisplay) Close

func (r *RemoteDisplay) Close() error

Close closes the gRPC connection.

func (*RemoteDisplay) DisplayImage

func (r *RemoteDisplay) DisplayImage(pngData []byte) error

DisplayImage sends raw PNG data to the remote daemon for display.

func (*RemoteDisplay) DisplayText

func (r *RemoteDisplay) DisplayText(text string) error

DisplayText sends text to the remote daemon for rendering and display.

func (*RemoteDisplay) Sleep

func (r *RemoteDisplay) Sleep() error

Sleep sends a sleep command to the remote daemon.

type Service

type Service interface {
	// DisplayImage accepts raw PNG data and displays it on the EPD.
	DisplayImage(pngData []byte) error

	// DisplayText renders text and displays it on the EPD.
	DisplayText(text string) error

	// Clear clears the EPD to white.
	Clear() error

	// Sleep puts the EPD into sleep mode.
	Sleep() error

	// Close releases any resources held by the display service.
	Close() error
}

Service abstracts over local hardware and remote gRPC display operations.

Jump to

Keyboard shortcuts

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