Documentation ¶
Index ¶
- Constants
- Variables
- func BatteryPower() int
- func CharWidth(c rune) int
- func ClearScreen()
- func Connect(name string) error
- func Connections() []string
- func DeviceKey() string
- func DeviceModel() string
- func DimArea(r image.Rectangle, cl color.Color)
- func DisableExitHourglass()
- func Disconnect() error
- func DrawLine(p1, p2 image.Point, cl color.Color)
- func DrawPixel(p image.Point, cl color.Color)
- func DrawRect(r image.Rectangle, cl color.Color)
- func DrawSelection(r image.Rectangle, cl color.Color)
- func DrawString(p image.Point, s string)
- func DrawStringR(p image.Point, s string)
- func Errorf(title, format string, args ...interface{})
- func Exit()
- func FillArea(r image.Rectangle, cl color.Color)
- func FullUpdate()
- func HardwareType() string
- func HideHourglass()
- func HwAddress() string
- func Infof(title, format string, args ...interface{})
- func InitCerts() error
- func InvertArea(r image.Rectangle)
- func InvertAreaBW(r image.Rectangle)
- func IsCharging() bool
- func IsPressed(key Key) bool
- func IsSDinserted() bool
- func IsUSBconnected() bool
- func KeepNetwork() (func(), error)
- func Message(icon Icon, title, text string, dt time.Duration)
- func OpenMainMenu()
- func OpenNetworkInfo()
- func Pad(r image.Rectangle, n int) image.Rectangle
- func PartialUpdate(r image.Rectangle)
- func PowerOff()
- func Questionf(title, format string, args ...interface{})
- func Repaint()
- func Run(app App) error
- func RunCLI(fnc RunFunc, c *RunConfig) error
- func Screen() image.Rectangle
- func ScreenSize() image.Point
- func SerialNumber() string
- func SetAutoPowerOff(on bool)
- func SetClip(r image.Rectangle)
- func SetErr(err error)
- func SetSleepMode(on bool)
- func SetTextStrength(n int)
- func ShowHourglass()
- func ShowHourglassAt(p image.Point)
- func Sleep(dt time.Duration, deep bool)
- func SleepMode() bool
- func SoftUpdate()
- func SoftwareVersion() string
- func StringWidth(s string) int
- func Temperature() int
- func Warningf(title, format string, args ...interface{})
- func WirelessNetworks() []string
- type App
- type Font
- type Icon
- type Key
- type KeyEvent
- type KeyState
- type Log
- type NetError
- type Orientation
- type PointerEvent
- type PointerState
- type RunConfig
- type RunFunc
- type TouchEvent
- type TouchState
Constants ¶
const ( KeyStateDown = KeyState(C.EVT_KEYDOWN) KeyStatePress = KeyState(C.EVT_KEYPRESS) KeyStateUp = KeyState(C.EVT_KEYUP) KeyStateRelease = KeyState(C.EVT_KEYRELEASE) KeyStateRepeat = KeyState(C.EVT_KEYREPEAT) )
const ( PointerUp = PointerState(C.EVT_POINTERUP) PointerDown = PointerState(C.EVT_POINTERDOWN) PointerMove = PointerState(C.EVT_POINTERMOVE) PointerLong = PointerState(C.EVT_POINTERLONG) PointerHold = PointerState(C.EVT_POINTERHOLD) )
const ( TouchUp = TouchState(C.EVT_TOUCHUP) TouchDown = TouchState(C.EVT_TOUCHDOWN) TouchMove = TouchState(C.EVT_TOUCHMOVE) )
const ( KeyBack = Key(C.KEY_BACK) KeyDelete = Key(C.KEY_DELETE) KeyOk = Key(C.KEY_OK) KeyUp = Key(C.KEY_UP) KeyDown = Key(C.KEY_DOWN) KeyLeft = Key(C.KEY_LEFT) KeyRight = Key(C.KEY_RIGHT) KeyMinus = Key(C.KEY_MINUS) KeyPlus = Key(C.KEY_PLUS) KeyMenu = Key(C.KEY_MENU) KeyMusic = Key(C.KEY_MUSIC) KeyPower = Key(C.KEY_POWER) KeyPrev = Key(C.KEY_PREV) KeyNext = Key(C.KEY_NEXT) KeyPrev2 = Key(C.KEY_PREV2) KeyNext2 = Key(C.KEY_NEXT2) )
const ( Orientation0 = Orientation(C.ROTATE0) Orientation90 = Orientation(C.ROTATE90) Orientation180 = Orientation(C.ROTATE180) Orientation270 = Orientation(C.ROTATE270) )
const ( DefaultFont = string(C.DEFAULTFONT) DefaultFontBold = string(C.DEFAULTFONTB) DefaultFontItalic = string(C.DEFAULTFONTI) DefaultFontBoldItalic = string(C.DEFAULTFONTBI) DefaultFontMono = string(C.DEFAULTFONTM) )
const ( Info = Icon(C.ICON_INFORMATION) Question = Icon(C.ICON_QUESTION) Warning = Icon(C.ICON_WARNING) Error = Icon(C.ICON_ERROR) )
Variables ¶
var ( Black = color.Black White = color.White DarkGray = color.Gray{0x55} LightGray = color.Gray{0xaa} )
var DefaultDelay = time.Second
var DefaultFontHeight = 14
var (
ErrNoConnections = errors.New("no connections available")
)
Functions ¶
func BatteryPower ¶
func BatteryPower() int
func Connections ¶
func Connections() []string
Connections returns all available network connections. Name can be used as an argument to Connect.
func DeviceModel ¶
func DeviceModel() string
func DisableExitHourglass ¶
func DisableExitHourglass()
func Disconnect ¶
func Disconnect() error
func DrawString ¶
func DrawStringR ¶
func FullUpdate ¶
func FullUpdate()
FullUpdate sends content of the whole screen buffer to display driver. Display depth is set to 2 bpp (usually) or 4 bpp if necessary. Function isn't synchronous i.e. it returns faster, than display is redrawn. Update is performed for active app (task) only, if display isn't locked and NO_DISPLAY flag in ivstate.uiflags isn't set.
Usage: Tradeoff between quality and speed. Recommended for text and common UI elements. Not recommended if quality of picture (image) is required, in such case use FullUpdateHQ().
func HardwareType ¶
func HardwareType() string
func HideHourglass ¶
func HideHourglass()
func InitCerts ¶
func InitCerts() error
InitCerts will read system certificates pool.
This pool is usually populated by the first call to tls.Dial or similar, but this operation might take up to 30 sec on some devices, leading to handshake timeout.
Calling this function before dialing will fix the problem.
func InvertArea ¶
func InvertAreaBW ¶
func IsCharging ¶
func IsCharging() bool
func IsSDinserted ¶
func IsSDinserted() bool
func IsUSBconnected ¶
func IsUSBconnected() bool
func KeepNetwork ¶
func KeepNetwork() (func(), error)
KeepNetwork will connect a default network interface on the device and will keep it enabled. Returned function can be called to disconnect an interface.
func OpenMainMenu ¶
func OpenMainMenu()
func OpenNetworkInfo ¶
func OpenNetworkInfo()
func PartialUpdate ¶
PartialUpdate sends content of the given rectangle in screen buffer to display driver. Function is smart and tries to perform the most suitable update possible: black and white update is performed if all pixels in given rectangle are black and white. Otherwise grayscale update is performed. If whole screen is specified, then grayscale update is performed.
func Repaint ¶
func Repaint()
Repaint puts Draw event into app's events queue. Eventually Draw method will be called on app object.
Usage: Call Repaint to make app (eventually) redraw itself on the screen.
func RunCLI ¶
RunCLI starts a command-line application that can write to device display. Context will be cancelled when application is closed. Provided callback can use any SDK functions.
func ScreenSize ¶
func SerialNumber ¶
func SerialNumber() string
func SetAutoPowerOff ¶
func SetAutoPowerOff(on bool)
func SetSleepMode ¶
func SetSleepMode(on bool)
func SetTextStrength ¶
func SetTextStrength(n int)
func ShowHourglass ¶
func ShowHourglass()
func ShowHourglassAt ¶
func SoftUpdate ¶
func SoftUpdate()
SoftUpdate is an alternative to FullUpdate. It's effect is (almost) PartialUpdate for the whole screen.
func SoftwareVersion ¶
func SoftwareVersion() string
func StringWidth ¶
func Temperature ¶
func Temperature() int
func WirelessNetworks ¶
func WirelessNetworks() []string
Types ¶
type App ¶
type App interface { // Init is called when application is started. Init() error // Close is called before exiting an application. Close() error // Draw is called each time an application view should be updated. // Can be queued by Repaint. Draw() // Key is called on each key-related event. Key(e KeyEvent) bool // Pointer is called on each pointer-related event. Pointer(e PointerEvent) bool // Touch is called on each touch-related event. Touch(e TouchEvent) bool // Orientation is called each time an orientation of device changes. Orientation(o Orientation) bool }
type Log ¶
type Log struct { Spacing int // line spacing // contains filtered or unexported fields }
func (*Log) WriteString ¶
type Orientation ¶
type Orientation int
type PointerEvent ¶
type PointerEvent struct { image.Point State PointerState }
type PointerState ¶
type PointerState int
type TouchEvent ¶
type TouchEvent struct { image.Point State TouchState }
type TouchState ¶
type TouchState int