mirror of
https://github.com/elua/elua.git
synced 2025-01-08 20:56:17 +08:00
17487f9ebe
- This should actually be a merge but we made a mistake on the initial repo creation and a merge was not possible. - Below there is a resumed log of the commit messages for the few steps, just for the record. - The merged commit messages for this work are: - Removing Portuguese doc content - Ignore folder names fixed on .gitignore - Removed doc files which content migrated to the CMS - docdata.lua updated accordingly - Doc build checked ok - Overall doc structure and contents still being refined - Removing folder cache from git versioning - Removing folder dist from git versioning. The folders above are generated by the buildall.lua script and are not part of the sources - Adding .gitignore file with objects info to inform git what to ignore - Removed file - Merge branch 'master' of git@repos.giga.puc-rio.br:elua-doc.git - Moving all files and folders to a working doc folder - Css updated - Index page added and CSS adjusts - Merge branch 'master' of git@repos.giga.puc-rio.br:elua-doc.git - Signed-off-by: Guilherme Sanchez <guilhermesanchezpacheco@gmail.com> - Merge branch 'master' of git@repos.giga.puc-rio.br:elua-doc.git - files deleted - Changed function that creates functions submenus. - Menu inserted with árvore, CSS adjusts, google search - Changed past design to new design - CSS updated - initial import - The commit ids were also preserved but they are related to this "other" work done on Led Lab. We'll keep the repo just in case. 4dce3f77c47b0c3001a2075a946e80ee52759b49 - Removing Portuguese doc content 78d8847525cacf045fe7e672cff6bd1e058a6a4b Ignore folder names fixed on .gitignore 48dee6b7962168ab1098bf709ead6f3cfe6b7964 - Removed doc files which content migrated to the CMS - docdata.lua updated accordingly - Doc build checked ok - Overall doc structure and contents still being refined 2aa2fe0c554db03dbc7029c34d0f4500fe625b37 - Removing folder cache from git versioning - Removing folder dist from git versioning The folders above are generated by the buildall.lua script and are not part of the sources - Adding .gitignore file with objects info to inform git what to ignore af6cc2890edf1855af319dc999a03feee5f9bee0 Removed file 6a180e72eb4f4860620cafc0685000e9f2174cfe Merge branch 'master' of git@repos.giga.puc-rio.br:elua-doc.git eb430112e78ae537459ab315e228ebca84bdf2d4 Moving all files and folders to a working doc folder d28a7c99489915630bd2625f3756fecf0d08ce37 Css updated 32836ffe382f04ab07c3e6f018c7b449a20d7a8d Index page added and CSS adjusts 1461d9957d9d25a1467cb57ab8717aa213a37e8d Merge branch 'master' of git@repos.giga.puc-rio.br:elua-doc.git ae1934c04f35a29e25bb4495ae8a31cd9c000b5b Signed-off-by: Guilherme Sanchez <guilhermesanchezpacheco@gmail.com> b5f31d70f1fac8d3fba325c9867a03f976775698 Merge branch 'master' of git@repos.giga.puc-rio.br:elua-doc.git ec9ad8446b7ea38b252c6a416e70774349835e45 files deleted bd7a80151b2030720ba8d8a303467d8c25a4b4b2 Changed function that creates functions submenus. 6a7494acaec694fadbb13520bcbccc51a6b95dfe Inserido menu com árvore, ajustes no CSS, busca do google e979f1c259d425c9a3be83f9cda20eddffe073bb Changed past design to new design. 381459e95286886b052103a0253e60b29e064d7a CSS updated 4f81d2f1195efe733fe5f97517be325d75937bc3 initial import
117 lines
5.1 KiB
Lua
117 lines
5.1 KiB
Lua
-- eLua reference manual - RPC module
|
|
|
|
data_en =
|
|
{
|
|
|
|
-- Title
|
|
title = "eLua reference manual - LuaRPC module",
|
|
|
|
-- Menu name
|
|
menu_name = "rpc",
|
|
|
|
-- Overview
|
|
overview = [[LuaRPC allows one to remotely control a lua state running on another machine or microcontroller.</p>
|
|
<p>It works by providing a $handle$ to the client session which allows control over remote state. Functions can
|
|
be called in the remote environment and variables can be manipulated by treating the $handle$ (representing
|
|
the remote global table) as if it were a local table.</p>
|
|
<p>In order to open a connection, it is necessary to specify the interface through wich the connection is made.
|
|
Currently the connections are limited to serial ports on the desktop side, and uart devices on the eLua side.
|
|
For a number of the connections below, a parameter labeled $transport_identifiers$ is used to specify the port
|
|
to be used in a platform specific manner.:
|
|
<ul>
|
|
<li>eLua: $transport_identifiers$ = $uart_id$, $timer_id$
|
|
<ul>
|
|
<li>$uart_id$ - the ID of the serial port (as in the @refman_gen_uart.html@uart module@). This uart must already be configured using $uart.setup$ before being used in this module.</li>
|
|
<li>$timer_id$ - the ID of the timer for send/receive timeouts (as with send/receive functions in the @refman_gen_uart.html@uart module@)</li>
|
|
</ul>
|
|
</li>
|
|
<li>Linux/Mac OS X luarpc: $transport_identifiers$ = $uart_path$
|
|
<ul>
|
|
<li>$uart_path$ - the path to the serial port to use (e.g.: "/dev/ttyS0")</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</p>
|
|
|
|
<p>See @using.html#rpc@Using eLua@ for a basic tutorial on getting started with the RPC module.</p>
|
|
|
|
<p><span class="warning">NOTE</span>: This module is considered experimental. It currently works over a
|
|
serial port with eLua targets and on desktop systems implementing POSIX serial communications (Linux, Mac OS X, etc).
|
|
]],
|
|
|
|
-- Functions
|
|
funcs =
|
|
{
|
|
{ sig = "handle = #rpc.connect#( transport_identifiers )",
|
|
desc = "Initiate connection from client to server.",
|
|
args =
|
|
{
|
|
"$transport_identifiers$ - platform-specific serial port identification (see @#overview@overview@)"
|
|
},
|
|
ret = [[$handle$ - handle used to interact with the remote Lua state. Usage styles are as follows:</p>
|
|
<table style="text-align: left; margin-left: 2em;">
|
|
<tbody>
|
|
<tr>
|
|
<th style="text-align: left; width: 20em;">Usage Style</th>
|
|
<th style="text-align: left;">Meaning</th>
|
|
</tr>
|
|
<tr>
|
|
<td>$handle$.$remote_var$ = $local_var$</td>
|
|
<td>send contents of $local_var$ to remote host and assign to $remote_var$ (registered on global table). This also works where the destination variable is nested within tables.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>$local_var$ = $handle$.$remote_var$:get()</td>
|
|
<td>get contents of $remote_var$ from remote global table and assign to $local_var$.</td>
|
|
</tr>
|
|
<tr>
|
|
<td>$val1$, $val2$, $valn$ = $handle$.$remote_func$()</td>
|
|
<td>call $remote_func$ on the server side, and return values to local state</td>
|
|
</tr>
|
|
<tr>
|
|
<td>$helper$ = $handle$.$remote_var$</td>
|
|
<td>create a $helper$ which points to $remote_var$, and can be used as shorthand later (e.g.: $helper$:get() would get the contents of the remote variable. If $remote_var$ were a table with functions on it: $helper$.$funcname$() would call $funcname$, on table $remote_var$ on the server, and return any results.)</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p>]]
|
|
},
|
|
|
|
{ sig = "#rpc.close#( handle )",
|
|
desc = "Close an active RPC session.",
|
|
args = "$handle$ - handle associated with the connection.",
|
|
},
|
|
|
|
{ sig = "#rpc.server#( transport_identifiers )",
|
|
desc = "Start a blocking/captive RPC server, which will wait for incoming connections.",
|
|
args = "$transport_identifiers$ - platform-specific serial port identification (see @#overview@overview@)",
|
|
},
|
|
|
|
{ sig = "#rpc.on_error#( err_handler )",
|
|
desc = "Define client-side error handler to deal with server-side error responses.",
|
|
args = "$err_handler$ - function to handle error messages. string error messages may be passed to this function.",
|
|
},
|
|
|
|
{ sig = "server_handle = #rpc.listen#( transport_identifiers )",
|
|
desc = "Open a listener on transport and await incoming connections.",
|
|
args = "$transport_identifiers$ - platform-specific serial port identification (see @#overview@overview@)",
|
|
ret = "server handle to use with @#rpc.peek@rpc.peek@ and @#rpc.dispatch@rpc.dispatch@"
|
|
},
|
|
|
|
{ sig = "data_available = #rpc.peek#( server_handle )",
|
|
desc = "Check if data are available to read on transport.",
|
|
args = "$server_handle$ - handle to refer to server session, created by @#rpc.listen@rpc.listen@",
|
|
ret = "$data_available$ - 1 if data are available, 0 if data are unavailable"
|
|
},
|
|
|
|
{ sig = "#rpc.dispatch#( server_handle )",
|
|
desc = "Read transport and handle incoming command.",
|
|
args = "$server_handle$ - handle to refer to server session, created by @#rpc.listen@rpc.listen@",
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
data_pt = data_en
|
|
|