Documentation
¶
Index ¶
- Constants
- Variables
- func IsCharacteristicZero(char bluetooth.DeviceCharacteristic) bool
- func IsDeviceZero(dev bluetooth.Device) bool
- type BitmapProcessor
- func (bp *BitmapProcessor) CreateFromColorArray(colors []color.RGBA) ([]byte, error)
- func (bp *BitmapProcessor) CreateSolidColorRGB(r, g, b byte) []byte
- func (bp *BitmapProcessor) ImageToRGB(img image.Image) []byte
- func (bp *BitmapProcessor) LoadImageFromFile(filepath string) (image.Image, error)
- func (bp *BitmapProcessor) ProcessImageFile(filepath string) ([]byte, error)
- func (bp *BitmapProcessor) ResizeImage(src image.Image, width, height int) image.Image
- type DeviceInfo
- type Display
- type PacketBuilder
- func (sc *PacketBuilder) BuildCameraData(rgbData []byte) [][]byte
- func (sc *PacketBuilder) Payload(dataType int, data []byte, totalData []byte, option int, totalLength int, ...) []byte
- func (sc *PacketBuilder) PayloadDefault(dataType int, data []byte, totalData []byte, option int, totalLength int, ...) []byte
- type Position
Constants ¶
const ( WRITE_CHAR_UUID = "0000fa02-0000-1000-8000-00805f9b34fb" NOTIFY_CHAR_UUID = "0000fa03-0000-1000-8000-00805f9b34fb" )
const ( // Data types TYPE_CAMERA = 0 TYPE_VIDEO = 1 TYPE_IMAGE = 2 TYPE_GIF = 3 TYPE_TEXT = 4 TYPE_DIY_IMAGE = 5 TYPE_DIY_IMAGE_UNREDO = 6 TYPE_TEM = 7 // Default values DEFAULT_LED_FRAME_SIZE = 1024 DEFAULT_BRIGHTNESS = 50 UBYTE_MAX_VALUE = 255 DIY_IMAGE_FUN_QUIT_NOSAVE_KEEP_PREV = 0 DIY_IMAGE_FUN_ENTER_CLEAR_CUR_SHOW = 1 DIY_IMAGE_FUN_QUIT_STILL_CUR_SHOW = 2 DIY_IMAGE_FUN_ENTER_NO_CLEAR_CUR_SHOW = 3 )
const CHUNK_SIZE = 12288
Variables ¶
var LEDConfigs = map[string]struct { Width int Height int AspectRatio float32 Description string }{ "16x16": {16, 16, 1.0, "Standard 16x16 matrix"}, "32x8": {32, 8, 4.0, "Wide 32x8 display"}, "64x16": {64, 16, 4.0, "Large 64x16 display"}, "96x16": {96, 16, 6.0, "Extra wide 96x16"}, "64x32": {64, 32, 2.0, "Large square-ish 64x32"}, "128x16": {128, 16, 8.0, "Ultra wide banner"}, "192x16": {192, 16, 12.0, "Super wide banner"}, "80x16": {80, 16, 5.0, "Medium wide display"}, "48x16": {48, 16, 3.0, "Small wide display"}, "64x20": {64, 20, 3.2, "Special ratio display"}, }
var ZeroCharacteristic = bluetooth.DeviceCharacteristic{}
var ZeroDevice = bluetooth.Device{}
Functions ¶
func IsCharacteristicZero ¶
func IsCharacteristicZero(char bluetooth.DeviceCharacteristic) bool
func IsDeviceZero ¶
Types ¶
type BitmapProcessor ¶
BitmapProcessor handles bitmap-to-RGB conversion for LED displays
func NewBitmapProcessor ¶
func NewBitmapProcessor(width, height int) *BitmapProcessor
NewBitmapProcessor creates a new bitmap processor with specified dimensions
func (*BitmapProcessor) CreateFromColorArray ¶
func (bp *BitmapProcessor) CreateFromColorArray(colors []color.RGBA) ([]byte, error)
CreateFromColorArray creates RGB data from a color array (useful for patterns)
func (*BitmapProcessor) CreateSolidColorRGB ¶
func (bp *BitmapProcessor) CreateSolidColorRGB(r, g, b byte) []byte
CreateSolidColorRGB creates RGB data for a solid color image
func (*BitmapProcessor) ImageToRGB ¶
func (bp *BitmapProcessor) ImageToRGB(img image.Image) []byte
ImageToRGB converts an image to RGB byte array (similar to BGRUtils.bitmap2RGB) Returns byte array in format: [R, G, B, R, G, B, ...]
func (*BitmapProcessor) LoadImageFromFile ¶
func (bp *BitmapProcessor) LoadImageFromFile(filepath string) (image.Image, error)
LoadImageFromFile loads an image from file path (supports PNG, JPEG)
func (*BitmapProcessor) ProcessImageFile ¶
func (bp *BitmapProcessor) ProcessImageFile(filepath string) ([]byte, error)
ProcessImageFile loads, resizes, and converts an image file to RGB byte array
func (*BitmapProcessor) ResizeImage ¶
ResizeImage resizes an image to the specified width and height using nearest neighbor
type DeviceInfo ¶
type DeviceInfo struct {
DeviceType byte // Byte 4 from device response
MCUVersion string // Major.Minor version
WiFiVersion string // Major.Minor version (or BLE version)
Width int // LED matrix width
Height int // LED matrix height
HasWifi bool // Whether device supports WiFi
PasswordFlag byte // Password requirement flag
}
DeviceInfo contains information retrieved from the LED device
type Display ¶
type Display interface {
Connect(ctx context.Context) error
Disconnect() error
GetScreenSize(ctx context.Context) (width, height int, err error)
GetDeviceInfo(ctx context.Context) (*DeviceInfo, error)
SetLED(on bool) error
SendImage(ctx context.Context, image image.Image) error
SwitchToDiyFunMode(mode int) error
}
func NewDisplay ¶
type PacketBuilder ¶
type PacketBuilder struct{}
PacketBuilder represents the core sending functionality
func NewPacketBuilder ¶
func NewPacketBuilder() *PacketBuilder
NewPacketBuilder creates a new SendCore instance
func (*PacketBuilder) BuildCameraData ¶
func (sc *PacketBuilder) BuildCameraData(rgbData []byte) [][]byte
BuildCameraData prepares camera/image data for BLE transmission
func (*PacketBuilder) Payload ¶
func (sc *PacketBuilder) Payload(dataType int, data []byte, totalData []byte, option int, totalLength int, bright int) []byte
Payload creates a payload packet for the given parameters This is the direct translation of the payload method in Java
func (*PacketBuilder) PayloadDefault ¶
func (sc *PacketBuilder) PayloadDefault(dataType int, data []byte, totalData []byte, option int, totalLength int, bright int, mask int) []byte
PayloadDefault provides default parameter handling for Payload function This is equivalent to the payload$default method in Java