Documentation
¶
Index ¶
- Constants
- Variables
- func AddTranslation(label, trans string)
- func BatteryPower() int
- func CharWidth(c rune) int
- func ClearScreen()
- func CloseKeyboard()
- func CloseProgressbar()
- func Connect(name string) error
- func ConnectDefault() error
- func Connections() []string
- func DeviceKey() string
- func DeviceModel() string
- func Dialog(icon Icon, title, text, button1, button2 string)
- func DimArea(r image.Rectangle, cl color.Color)
- func DisableExitHourglass()
- func Disconnect() error
- func DitherArea(r image.Rectangle, levels int, method int)
- 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 DrawTopPanel()
- func Errorf(title, format string, args ...interface{})
- func Exit()
- func FillArea(r image.Rectangle, cl color.Color)
- func FullUpdate()
- func GetConfig() (map[string]string, error)
- func GetCurrentLang() string
- func GetLangText(s string) string
- 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 LoadKeyboard()
- func LoadLanguage(lang string)
- func Message(icon Icon, title, text string, dt time.Duration)
- func OpenBook(path string)
- func OpenCustomKeyboard(keyboardFileName, placeholder string, buflen int)
- func OpenKeyboard(placeholder string, buflen int)
- func OpenMainMenu()
- func OpenNetworkInfo()
- func OpenProgressbar(icon Icon, title, text string, percent int)
- func OpenRotateBox()
- func OpenTimeEdit(title string, p image.Point, initime time.Time)
- func Pad(r image.Rectangle, n int) image.Rectangle
- func PageSnapshot()
- func PartialUpdate(r image.Rectangle)
- func PartialUpdateBW(r image.Rectangle)
- func PowerOff()
- func QueryNetwork()
- 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 SetDefaultOrientation(orientation Orientation)
- func SetDialogHandler(handler DialogHandler)
- func SetErr(err error)
- func SetGlobalOrientation(orientation Orientation)
- func SetKeyboardHandler(kh KeyboardHandler)
- func SetMessageDelay(time time.Duration)
- func SetOrientation(orientation Orientation)
- func SetRotateBoxHandler(handler RotateBoxHandler)
- func SetSleepMode(on bool)
- func SetTextStrength(n int)
- func SetTimeEditHandler(handler TimeEditHandler)
- 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 UpdateProgressbar(text string, percent int)
- func Warningf(title, format string, args ...interface{})
- func WirelessNetworks() []string
- type App
- type DialogHandler
- type Font
- type Icon
- type Key
- type KeyEvent
- type KeyState
- type KeyboardHandler
- type Log
- type NetError
- type Orientation
- type PointerEvent
- type PointerState
- type RotateBoxHandler
- type RunConfig
- type RunFunc
- type TimeEditHandler
- type TouchEvent
- type TouchState
Constants ¶
const ( FlashDir = "/mnt/ext1" SdCardDir = "/mnt/ext2" UsbDir = "/mnt/ext3" SystemData = "/ebrmain" UserData = "/mnt/ext1/system" UserData2 = "/mnt/ext2/system" TempDir = "/tmp" SystemFontDir = "/ebrmain/fonts" UserFontDir = "/mnt/ext1/system/fonts" TempFontPath = "/tmp/fonts" PhotoTempDir = "/tmp/photo" UserProfiles = "/mnt/ext1/system/profiles" UserProfiles2 = "/mnt/ext2/system/profiles" CurrentProfile = "/mnt/ext1/system/profiles/.current" LastProfile = "/mnt/ext1/system/profiles/.last" SalvageProfiles = "/mnt/ext1/system/profiles/.salvage" ConfigPath = "/mnt/ext1/system/config" StatePath = "/mnt/ext1/system/state" SystemThemesPath = "/ebrmain/themes" UserThemesPath = "/mnt/ext1/system/themes" GlobalConfigFile = "/mnt/ext1/system/config/global.cfg" NetworkConfigFile = "/mnt/ext1/system/config/network.cfg" TsCalData = "/mnt/ext1/system/config/tsc.dat" TsCalData2 = "/tmp/tsc.dat" SystemLangPath = "/ebrmain/language" UserLangPath = "/mnt/ext1/system/language" SystemKbdPath = "/ebrmain/language/keyboard" UserKbdPath = "/mnt/ext1/system/language/keyboard" SystemDictPath = "/ebrmain/dictionaries" UserDictPath1 = "/mnt/ext1/system/dictionaries" UserDictPath2 = "/mnt/ext2/system/dictionaries" SystemLogoPath = "/ebrmain/logo" UserLogoPath = "/mnt/ext1/system/logo" NotesPath = "/mnt/ext1/notes" GamePath = "/mnt/ext1/applications" UserAppDir = "/mnt/ext1/system/bin" CachePath = "/mnt/ext1/system/cache" BackupDir = "/mnt/ext2/backup" UserBookshelf = "/mnt/ext1/system/bin/bookshelf.app" SystemBookshelf = "/ebrmain/bin/bookshelf.app" UserMpd = "/mnt/ext1/system/bin/mpd.app" SystemMpd = "/ebrmain/bin/mpd.app" StateCleaner = "/ebrmain/bin/cleanstate.sh" BackupScript = "/ebrmain/bin/backup.sh" RestoreScript = "/ebrmain/bin/restore.sh" NetAgent = "/ebrmain/bin/netagent" BooklandApp = "/ebrmain/bin/bookland.app" UserMplayer = "/mnt/ext1/system/bin/mplayer.so" UserBookinfo = "/mnt/ext1/system/bin/bookinfo.so" PocketbookSig = "/mnt/ext1/system/.pocketbook" LastOpenBooks = "/mnt/ext1/system/state/lastopen.txt" Favorites = "/mnt/ext1/system/favorite" CurrentBook = "/tmp/.current" BookshelfState = "/tmp/.bsstate" BookshelfStateNv = "/mnt/ext1/system/state/.bsstate" HistoryFile = "/tmp/history.txt" DicKeyboard = "/tmp/dictionary.kbd" PlaylistFile = "/tmp/playlist.pls" NetAgentLog = "/tmp/netagent.log" AdobePath = "/mnt/ext1/.adobe-digital-editions" AdobePath2 = "/mnt/ext2/.adobe-digital-editions" HandlersPath = "/mnt/ext1/system/config/handlers.cfg" UrlHistory = "/mnt/ext1/system/cache/urlhistory.txt" WebCache = "/tmp/webcache" WebCacheIndex = "/tmp/webcache/index" WidgetsConfig = "/mnt/ext1/system/config/widgets" WidgetsOpen = "/mnt/ext1/system/config/widgets/open.cfg" )
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 AddTranslation ¶ added in v0.3.4
func AddTranslation(label, trans string)
Add translation text that will later be used in getLangText
func BatteryPower ¶
func BatteryPower() int
func CloseProgressbar ¶ added in v0.3.6
func CloseProgressbar()
func ConnectDefault ¶ added in v0.3.12
func ConnectDefault() error
Obtained through reverse engineering, automatically connecting to the network and maintaining an active connection requires passing null instead of the network name. If not connected display network select or warning message, return error if connection failed
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 DitherArea ¶ added in v0.3.4
func DrawString ¶
func DrawStringR ¶
func DrawTopPanel ¶ added in v0.3.3
func DrawTopPanel()
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 GetCurrentLang ¶ added in v0.3.4
func GetCurrentLang() string
func GetLangText ¶ added in v0.3.4
Get text with translation, translation variables can be found only in original pocketbook apps
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 LoadLanguage ¶ added in v0.3.4
func LoadLanguage(lang string)
Probably changes the language the app should run in, translations depend on it
func OpenBook ¶ added in v0.3.4
func OpenBook(path string)
open the book in the default reader. If the .app file, then run the application
func OpenCustomKeyboard ¶ added in v0.3.4
Open keyboard from .kbd file
func OpenKeyboard ¶ added in v0.3.2
Open default keyboard
func OpenMainMenu ¶
func OpenMainMenu()
func OpenNetworkInfo ¶
func OpenNetworkInfo()
func OpenProgressbar ¶ added in v0.3.6
Use dialog handler for callback
func OpenRotateBox ¶ added in v0.3.6
func OpenRotateBox()
func OpenTimeEdit ¶ added in v0.3.10
func PageSnapshot ¶ added in v0.3.4
func PageSnapshot()
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 PartialUpdateBW ¶ added in v0.3.4
func QueryNetwork ¶ added in v0.3.12
func QueryNetwork()
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 SetDefaultOrientation ¶ added in v0.3.4
func SetDefaultOrientation(orientation Orientation)
Original pb apps prefer to use setDefaultOrientation on init action (It's an undocumented function, found by reverse engineering)
func SetDialogHandler ¶ added in v0.3.13
func SetDialogHandler(handler DialogHandler)
func SetGlobalOrientation ¶ added in v0.3.4
func SetGlobalOrientation(orientation Orientation)
func SetKeyboardHandler ¶ added in v0.3.2
func SetKeyboardHandler(kh KeyboardHandler)
func SetMessageDelay ¶
func SetOrientation ¶ added in v0.3.4
func SetOrientation(orientation Orientation)
func SetRotateBoxHandler ¶ added in v0.3.6
func SetRotateBoxHandler(handler RotateBoxHandler)
func SetSleepMode ¶
func SetSleepMode(on bool)
func SetTextStrength ¶
func SetTextStrength(n int)
func SetTimeEditHandler ¶ added in v0.3.10
func SetTimeEditHandler(handler TimeEditHandler)
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 UpdateProgressbar ¶ added in v0.3.6
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 DialogHandler ¶ added in v0.3.6
type DialogHandler func(button int)
return 1 for left button, 2 for right button. 1 for progressbar cancel button
type KeyboardHandler ¶ added in v0.3.2
type KeyboardHandler func(string)
type Log ¶
type Log struct {
Spacing int // line spacing
// contains filtered or unexported fields
}
func (*Log) WriteString ¶
type Orientation ¶
type Orientation int
func GetGlobalOrientation ¶ added in v0.3.4
func GetGlobalOrientation() Orientation
func GetOrientation ¶ added in v0.3.4
func GetOrientation() Orientation
type PointerEvent ¶
type PointerEvent struct {
image.Point
State PointerState
}
type PointerState ¶
type PointerState int
type RotateBoxHandler ¶ added in v0.3.6
type RotateBoxHandler func(Orientation)
type TimeEditHandler ¶ added in v0.3.10
type TouchEvent ¶
type TouchEvent struct {
image.Point
State TouchState
}
type TouchState ¶
type TouchState int