gtt43a

package
v0.0.0-...-aa3ce0d Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

* This file contain the functions to manage event messages /*

* Package to send commands and recieve response to and from gtt43a device. *

Index

Constants

View Source
const (
	OPENED uint32 = iota
	CLOSED
	LISTEN
)
View Source
const (
	OFF int = iota
	GREEN
	RED
	YELLOW
)

Variables

View Source
var ErrorDevClosed = errors.New("dev is closed")
View Source
var ErrorDevEmptyRead = errors.New("read bytes in dev is empty")
View Source
var ErrorDevEmptyWrite = errors.New("write bytes in dev is empty")
View Source
var ErrorDevNull = errors.New("dev is null")
View Source
var ErrorDevTimeout = errors.New("dev timeout")

Functions

func ApduGetPropertyText

func ApduGetPropertyText(id int, prpType GTT25PropertyType) []byte

func ApduGetPropertyValueS16

func ApduGetPropertyValueS16(id int, prpType GTT25PropertyType) []byte

func ApduGetPropertyValueU16

func ApduGetPropertyValueU16(id int, prpType GTT25PropertyType) []byte

func ApduGetPropertyValueU8

func ApduGetPropertyValueU8(id int, prpType GTT25PropertyType) []byte

func ApduSetPropertyText

func ApduSetPropertyText(id int, prpType GTT25PropertyType, text string) []byte

func ApduSetPropertyValueS16

func ApduSetPropertyValueS16(id int, prpType GTT25PropertyType, value int) []byte

func ApduSetPropertyValueU16

func ApduSetPropertyValueU16(id int, prpType GTT25PropertyType, value int) []byte

func ApduSetPropertyValueU8

func ApduSetPropertyValueU8(id int, prpType GTT25PropertyType, value int) []byte

Types

type Display

type Display interface {
	Open() error
	Close() error
	ClrScreen() error
	Text(string) error
	FontSize(int) error
	Send([]byte) error

	Recv() ([]byte, error)
	SendRecv([]byte) ([]byte, error)
	Echo([]byte) ([]byte, error)
	Version() ([]byte, error)
	SendRecvCmd(int, []byte) ([]byte, error)
	SendCmd(int, []byte) error
	Reset() error
	TextInsertPoint(int, int) error
	GetTextPoint() ([]byte, error)
	TextPoint(int, int) func(data string) error
	TextWindow(int, int, int, int) error
	TextColour(int, int, int) error
	PrintUTF8String(string) error
	PrintUnicode([]byte) error
	UpdateLabel(id, format int, value []byte) error
	UpdateLabelAscii(int, string) error
	UpdateLabelUTF8(int, string) error
	UpdateLabelUnicode(int, []byte) error
	SetLabelBackgroundColour(id, r, g, b int) error
	CreateLabelLegacy(id, x, y, width, height, h, v, font, r, g, b int) error
	UpdateBargraphValue(int, int) ([]byte, error)
	UpdateTraceValue(int, int) error
	RunScript(string) error
	LoadBitmapLegcay(id int, filename string) error
	DisplayBitmapLegcay(id int, x, y int) error
	ClearBitmapLegacy(id int) error
	SetBitmapTransparencyLegacy(id int, r, g, b int) error
	SetBacklightLegcay(brightness int) error

	BitmapLoad(int, string) error
	BitmapCapture(id int, left, top, width, height int) error
	BuzzerActive(frec, time int) error
	CreateObject(id int, objectType GTT25ObjectType) error
	DestroyObject(id int) error
	BaseObjectBeginUpdate(id int) error
	BaseObjectEndUpdate(id int) error
	ObjectListGet(id, itemIndex int) error
	SetPropertyValueU16(id int, prpType GTT25PropertyType) func(value int) error
	SetPropertyValueS16(id int, prpType GTT25PropertyType) func(value int) error
	SetPropertyValueU8(id int, prpType GTT25PropertyType) func(value int) error
	SetPropertyText(id int, prpType GTT25PropertyType) func(text string) error
	GetPropertyValueU16(id int, prpType GTT25PropertyType) func() ([]byte, error)
	GetPropertyValueS16(id int, prpType GTT25PropertyType) func() ([]byte, error)
	GetPropertyValueU8(id int, prpType GTT25PropertyType) func() (byte, error)
	GetPropertyText(id int, prpType GTT25PropertyType) func() ([]byte, error)

	ChangeTouchReporting(style int) error
	GetTouchReporting() ([]byte, error)

	GetToggleState(id int) ([]byte, error)
	GetSliderValue(id int) ([]byte, error)

	WriteScratch(addr int, data []byte) error
	ReadScratch(addr, size int) ([]byte, error)
	Listen() error
	ListenWithContext(ctx context.Context) error
	Events() (chan *Event, error)
	StopListen()
	AnimationStartStop(id, action int) error
	AnimationSetFrame(id, state int) error
	AnimationStopAll() error
	// contains filtered or unexported methods
}

func NewDisplay

func NewDisplay(opt *PortOptions) Display

Create a new Display device

type Event

type Event struct {
	Type  EventType
	ObjId uint16
	Value []byte
}

type EventType

type EventType int
const (
	GTT25BaseObjectOnPropertyChange EventType = iota
	GTT25VisualObjectOnKey
	ButtonClick
	RegionTouch
)

type GTT25CommandType

type GTT25CommandType []byte
var Begin_Update GTT25CommandType = []byte{0x1F, 0x00}
var Bitmap_Capture GTT25CommandType = []byte{0x0D, 0x01}
var Bitmap_Load GTT25CommandType = []byte{0x0D, 0x00}
var Create_Object GTT25CommandType = []byte{0x01, 0x00}
var Destroy_Object GTT25CommandType = []byte{0x01, 0x01}
var End_Update GTT25CommandType = []byte{0x1F, 0x01}
var ObjectList_Get GTT25CommandType = []byte{0x1A, 0x03}
var SetBacklight GTT25CommandType = []byte{153}
var Set_Focus GTT25CommandType = []byte{0x02, 0x02}

func (GTT25CommandType) Value

func (typeP GTT25CommandType) Value() []byte

type GTT25ObjectType

type GTT25ObjectType []byte
var ObjectType_Bitmap GTT25ObjectType = []byte{0x00, 0x0d}
var ObjectType_VisualBitmap GTT25ObjectType = []byte{0x00, 0x1f}

func (GTT25ObjectType) Value

func (typeP GTT25ObjectType) Value() []byte

type GTT25PropertyType

type GTT25PropertyType []byte
var ButtonDisableBitmap GTT25PropertyType = []byte{0x15, 0x0e}
var ButtonState GTT25PropertyType = []byte{0x15, 0x0C}
var ButtonText GTT25PropertyType = []byte{0x15, 0x03}
var CanFocus GTT25PropertyType = []byte{0x02, 0x05}
var Enabled GTT25PropertyType = []byte{0x02, 0x07}
var GaugeValue GTT25PropertyType = []byte{0x03, 0x02}
var HasFocus GTT25PropertyType = []byte{0x02, 0x06}
var Height GTT25PropertyType = []byte{0x02, 0x04}
var Invalidated GTT25PropertyType = []byte{0x02, 0x00}
var LabelBackgroundB GTT25PropertyType = []byte{0x09, 0x02}
var LabelBackgroundG GTT25PropertyType = []byte{0x09, 0x01}
var LabelBackgroundR GTT25PropertyType = []byte{0x09, 0x00}
var LabelFontSize GTT25PropertyType = []byte{0x09, 0x0A}
var LabelText GTT25PropertyType = []byte{0x09, 0x06}
var Left GTT25PropertyType = []byte{0x02, 0x01}
var SliderLabelText GTT25PropertyType = []byte{0x0A, 0x09}
var SliderValue GTT25PropertyType = []byte{0x0A, 0x08}
var Top GTT25PropertyType = []byte{0x02, 0x02}
var VisualBitmap_Source GTT25PropertyType = []byte{0x1F, 0x00}
var VisualBitmap_SourceIndex GTT25PropertyType = []byte{0x1F, 0x01}
var Width GTT25PropertyType = []byte{0x02, 0x03}

func (GTT25PropertyType) Value

func (typeP GTT25PropertyType) Value() []byte

type PortOptions

type PortOptions struct {
	Port        string
	Baud        int
	ReadTimeout time.Duration
}

Jump to

Keyboard shortcuts

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