Module lcdproc
A LCDproc client module.
Info:
- Copyright: denpamusic 2020
- License: MIT
- Author: denpamusic
Class LCDproc
LCDproc.server | LCDproc server info |
LCDproc.display | LCDproc display info |
LCDproc.handlers | event handlers table |
LCDproc.new ([host[, port[, opts]]]) | create client instance |
LCDproc.every (interval, fn) | Helper function to run the callback every interval |
LCDproc:request (line) | make request to LCDproc server |
LCDproc:hello () | initiate the LCDproc session |
LCDproc:set_name (name) | set client name |
LCDproc:add_screen (id) | add new screen |
LCDproc:del_screen (id) | remove screen |
LCDproc:add_key (id, mode) | add new key |
LCDproc:del_key (id) | remove key |
LCDproc:add_menu () | add main menu to the client |
LCDproc:backlight (state) | set display backlight state |
LCDproc:output (state) | set display gpio state |
LCDproc:info () | get display driver info |
LCDproc:noop () | do nothing |
LCDproc:sleep (seconds) | sleep for a given amount of seconds |
LCDproc:poll () | poll connection |
LCDproc:do_events (line) | handle server events |
LCDproc:on_listen (fn) | register screen listen event handler |
LCDproc:on_ignore (fn) | register screen ignore event handler |
LCDproc:on_keypress (fn) | register key press event handler |
LCDproc:on_menu (fn) | register menu event handler |
LCDproc:close () | close connection |
Class LCDproc
A LCDproc client class.
- LCDproc.server
-
LCDproc server info
Fields:
- version LCDproc version
- protocol protocol version
- LCDproc.display
-
LCDproc display info
Fields:
- width display width
- height display height
- cell_width display cell width
- cell_height display cell height
- LCDproc.handlers
-
event handlers table
Fields:
- listen
- LCDproc.new ([host[, port[, opts]]])
-
create client instance
Parameters:
- host string LCDproc server host (localhost) (optional)
- port int LCDproc server port (13666) (optional)
- opts table additional options ({ timeout = 3, debug = false }) (optional)
Returns:
-
LCDproc
the new LCDproc client
- LCDproc.every (interval, fn)
-
Helper function to run the callback every interval
Parameters:
- interval string inteval string (i. e. “5m”) Supports “h” for hours, “m” for minutes and “s” for seconds
- fn func callback function
- LCDproc:request (line)
-
make request to LCDproc server
Parameters:
- line string
Returns:
- LCDproc:hello ()
-
initiate the LCDproc session
See also:
- LCDproc:set_name (name)
-
set client name
Parameters:
- name string
Returns:
- LCDproc:add_screen (id)
-
add new screen
Parameters:
- id string screen id
Returns:
-
Screen
the new screen
- LCDproc:del_screen (id)
-
remove screen
Parameters:
- id string screen id
- LCDproc:add_key (id, mode)
-
add new key
Parameters:
- LCDproc:del_key (id)
-
remove key
Parameters:
- id string key id
- LCDproc:add_menu ()
-
add main menu to the client
Returns:
-
Menu
the main menu
- LCDproc:backlight (state)
-
set display backlight state
Parameters:
- state string backlight state (on | off | toggle | blink | flash)
Returns:
- LCDproc:output (state)
-
set display gpio state
Parameters:
- state string (on | off | number)
Returns:
- LCDproc:info ()
-
get display driver info
Returns:
- LCDproc:noop ()
-
do nothing
Returns:
- LCDproc:sleep (seconds)
-
sleep for a given amount of seconds
Parameters:
- seconds int number of seconds to sleep
Returns:
- LCDproc:poll ()
-
poll connection
Returns:
- LCDproc:do_events (line)
-
handle server events
Parameters:
- line string response line
Returns:
-
string
event type
- LCDproc:on_listen (fn)
-
register screen listen event handler
Parameters:
- fn func handler function
- LCDproc:on_ignore (fn)
-
register screen ignore event handler
Parameters:
- fn func handler function
- LCDproc:on_keypress (fn)
-
register key press event handler
Parameters:
- fn func handler function
- LCDproc:on_menu (fn)
-
register menu event handler
Parameters:
- fn func handler function
- LCDproc:close ()
- close connection