Skip to content

Commit

Permalink
Make the telnet example an Lua module
Browse files Browse the repository at this point in the history
Contributes to #3118
  • Loading branch information
marcelstoer committed May 30, 2020
1 parent 8f85c9b commit d449883
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 140 deletions.
50 changes: 50 additions & 0 deletions docs/lua-modules/telnet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Telnet Module

| Since | Origin / Contributor | Maintainer | Source |
| :----- | :-------------------- | :---------- | :------ |
| 2018-05-24 | [Terry Ellison](https://github.com/TerryE) | [Terry Ellison](https://github.com/TerryE) | [telnet.lua](../../lua_modules/telnet/telnet.lua) |

The current version of this module exploits the stdin / stdout pipe functionality and
task integration that is now build into the NodeNMCU Lua core.

There are two nice advantages of this core implementation:

- Errors are now written to stdout in a separate task execution.
- The pipes pretty much eliminate UART and telnet overrun.

Both have the same interface if required into the variable `telnet`

## telnet:open()

Open a telnet server based on the provided parameters.

#### Syntax

`telnet:open(ssid, pwd, port)`

#### Parameters

`ssid` and `password`. Strings. SSID and Password for the Wifi network. If these are
`nil` then the wifi is assumed to be configured or auto-configured.

`port`. Integer TCP listening port for the Telnet service. The default is 2323

#### Returns

Nothing returned (this is evaluated as `nil` in a scalar context).

## telnet:close()

Close a telnet server and release all resources. Also set the variable `telnet` to nil to fully reference and GC the resources.

#### Syntax

`telnet:close()`

#### Parameters

None

#### Returns

Nothing returned (this is evaluated as `nil` in a scalar context).
56 changes: 0 additions & 56 deletions lua_examples/telnet/README.md

This file was deleted.

84 changes: 0 additions & 84 deletions lua_examples/telnet/telnet_fifosock.lua

This file was deleted.

3 changes: 3 additions & 0 deletions lua_modules/telnet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Telnet Module

Documentation for this Lua module is available in the [telnet.md](../../docs/lua-modules/telnet.md) file and in the [Official NodeMCU Documentation](https://nodemcu.readthedocs.io/) in `Lua Modules` section.
File renamed without changes.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ pages:
- 'lm92': 'lua-modules/lm92.md'
- 'mcp23008': 'lua-modules/mcp23008.md'
- 'redis': 'lua-modules/redis.md'
- 'telnet': 'lua-modules/telnet.md'
- 'yeelink': 'lua-modules/yeelink.md'
- C Modules:
- 'adc': 'modules/adc.md'
Expand Down

0 comments on commit d449883

Please sign in to comment.