Optional Features¶
This chapter describes optional features that are not included in the default firmware but can be used by building a project with their modules.
LPD¶
Line Printer Daemon (LPD) is a printing protocol used for submitting print jobs to a remote printer. After setting the Line protocol to LPD, a device can send a print job using TCP/IP to the gateway, which will then print over the Line using LPD.
For example, to print from a Windows PC to a printer attached to the gateway, add the printer on a Standard TCP/IP port using the gateway's IP address, the LPR (line printer remote) protocol, and a queue name that matches the queue name configured on the gateway. See the Send a print job from a Windows PC using LPD Use Case for an example.
Note
LPD is not included in the default firmware. To use LPD, use the SDK to create a project including the lpd
module. See Building Projects for more information. When LPD is included in a project, LPD will appear as a Line protocol choice.
LPD Status¶
You can view the current connection status of LPD, including the queue name, information on what was last printed, and information on the last and current client.
To view LPD status:
- In Web Manager, go to LPD and click Status.
- For CLI, see Status LPD level in the Command Line Interface (CLI) Reference chapter of the xPico 200 Series User Guide.
LPD Configuration¶
To configure LPD:
- In Web Manager, go to LPD and click Configuration.
- For CLI, see Config LPD level in the Command Line Interface (CLI) Reference chapter of the xPico 200 Series User Guide.
- For XML, see configgroup LPD in the XML Reference chapter of the xPico 200 Series User Guide.
Settings | Description |
---|---|
Banner | Enables or disables printing of the banner page with the print job. |
Binary | When enabled, the entire file is passed to the printer. When disabled, only valid ASCII characters and control characters (tab, linefeed, formfeed, backspace, and newline) are passed to the printer. |
SOJ Text | This is the Start Of Job string sent to the printer at the start of the print job. Non-printable characters must be represented in decimal or hexadecimal and must be enclosed in square braces and separated by commas. To specify an open square brace, use two in a row. For example AB[255,0xFF]C[[D] results in AB..C[D] . |
EOJ Text | This is the End Of Job string sent to the printer at the end of the print job. Non-printable characters must be represented in decimal or hexadecimal and must be enclosed in square braces and separated by commas. To specify an open square brace, use two in a row. For example AB[255,0xFF]C[[D] results in AB..C[D] . |
Formfeed | When enabled, a formfeed will be sent to the printer at the end of each print job. |
Convert Newline | When enabled, single newlines and single carriage returns will be converted into DOS-style carriage return and linefeed line endings. If carriage return and linefeed characters are already in the correct DOS line-ending order, they will remain unchanged. |
Use Case: Send a print job from a Windows PC using LPD¶
This example sends a print job from a Windows PC to the xPico 200 series gateway using LPD. The instructions have been validated in Windows 10.
Step 1 - Set up the gateway
- In Web Manager, go to LPD > Configuration.
- Type
testQueueName
in Queue Name and click Submit. - Click Line > Line 1 > Configuration.
- Set Protocol to LPD and click Submit.
Step 2 - Add a printer in Windows
- From a Windows 10 PC, open Printers & scanners in Settings.
- Click Add a printer or scanner.
- Click The printer that I want isn't listed when it appears after a few seconds.
- In the Add Printer dialog, select Add a printer using a TCP/IP address or hostname and click Next.
- Type the IP address of your xPico 200 series gateway in Hostname or IP address. Uncheck Query the printer and automatically select the driver to use. Click Next.
- Under Device Type, select Custom and click Settings.
- Set the Protocol to LPR and click OK.
- Click Next.
- To choose a driver, under Manufacturer select Generic and under Printers select Generic / Text Only. Click Next.
- Select Use the driver that is currently installed (recommended). Click Next.
- In Printer name, type
xPico 200
. - Choose whether to share the printer and click Next.
- A dialog box with the option to print a test page will appear. Leave this dialog box open while continuing to the next step.
Step 3 - Connect using a terminal and view print job
- Connect the xPico 200 series gateway to the PC using a serial cable.
- On the PC, open a terminal such as Tera Term and connect to the device using serial.
- In the Add Printer dialog, click Print a test page and view the test page in the terminal.
Microsoft Azure Integration¶
Microsoft Azure integration allows the gateway to be used with Microsoft's cloud computing service, Azure. For more information on Microsoft Azure, please see azure.microsoft.com.
To use the gateway with Microsoft Azure, a new device must be created in your IoT Hub in Azure, and Azure IoT state must be enabled on the gateway. Integration can be configured with a SAS Token, which can be generated in Visual Studio Code if Azure IoT Tools is installed, or X.509 credentials. To use Azure over a Line, the Line protocol on the gateway must be set to Azure IoT.
For an example of setting up a device with Azure, please see Application Note: Integrating xPico 200 Series with Microsoft Azure.
Note
Microsoft Azure integration is not included in the default firmware. To use Azure, use the SDK to create a project including the azure_iot
module. See Building Projects for more information. When Azure is included in a project, Azure IoT will appear as a Line protocol choice.
To configure Azure settings:
- In the Web Manager, go to Azure IoT and click Configuration.
- For CLI, see Config Azure Level in the Command Line Interface (CLI) Reference chapter of the xPico 200 Series User Guide.
- For XML, see configgroup Azure in the XML Reference chapter of the xPico 200 Series User Guide.
Status | Description |
---|---|
State | State of the Azure connection. Enabled or Disabled. |
Hub Name | The name of the Hub created in the Azure portal. |
Device ID | The Device ID of the device set in the Azure portal. |
Security | Can be Security Keys or X.509 Certificate. |
SAS Token | The SAS Token used when Security is set to Security Keys. |
Credential Name | The name of the credential found in TLS Credentials. This is applicable when Security is set to X.509 Certificate. |
MQTT Local Port | The MQTT local port to use. Blank the value to use a random port. |
Receive Buffer | The maximum size of a device message in bytes that can be received from Azure. Do not make the Receive Buffer larger than needed. Doing so may make the device become unstable and crash without sufficient memory. If this happens, consider removing unneeded modules. The tlog will indicate if the Receive Buffer needs to be increased. |
Reply Buffer | The maximum size of a device reply in bytes that can be sent to Azure. Do not make the Reply Buffer larger than needed. Doing so may make the device become unstable and crash without sufficient memory. If this happens, consider removing unneeded modules. The utility Device Explorer will indicate if the Reply Buffer needs to be increased. |
Modbus¶
Modbus is a serial communications protocol implemented on the gateway over a line with a TCP server. A line must be set to one of the Modbus protocols in order to use Modbus. The xPico 200 series gateway acts as a bridge with a network device operating as Modbus master and the devices connected via serial operating as Modbus slaves. There are four Modbus Input CP roles and four Modbus Output CP roles on the xPico 200 series gateway that can be read or written from the Modbus TCP Master. You will first need to configure the CPs appropriately for the Modbus CP role. For more information on CP roles, see Configurable Pin Roles in the xPico 200 Series User Guide. You will need to use a Modbus Master application on your network device to communicate with the gateway and attached Modbus devices.
When the Modbus module is included in firmware, the following configurable pin roles will be found in the Configurable Pin Manager:
Role Name | Description |
---|---|
Role Modbus Input 1 | Can be read by Modbus TCP. |
Role Modbus Input 2 | Can be read by Modbus TCP. |
Role Modbus Input 3 | Can be read by Modbus TCP. |
Role Modbus Input 4 | Can be read by Modbus TCP. |
Role Modbus Output 1 | Can be written by Modbus TCP. |
Role Modbus Output 2 | Can be written by Modbus TCP. |
Role Modbus Output 3 | Can be written by Modbus TCP. |
Role Modbus Output 4 | Can be written by Modbus TCP. |
Note
Modbus is not included in the default firmware. To use Modbus, use the SDK to create a project including the modbus
module. See Building Projects for more information. When Modbus is included in a project, Modbus ASCII and Modbus RTU will appear as Line protocol choices.
The following example uses the modpoll third-party application to read data from the gateway's CPs using Modbus. The gateway responds to address 255:
c:\modpoll-3.6\win>modpoll.exe -t3 -a 255 -r 1 -c 4 -1 -m tcp 172.20.197.120
modpoll 3.6 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright (c) 2002-2018 proconX Pty Ltd
Visit https://www.modbusdriver.com for Modbus libraries and tools.
Protocol configuration: MODBUS/TCP
Slave configuration...: address = 255, start reference = 1, count = 4
Communication.........: 172.20.197.120, port 502, t/o 1.00 s, poll rate 1000 ms
Data type.............: 16-bit register, input register table
-- Polling slave...
[1]: 1
[2]: 0
[3]: 0
[4]: 0
The following example uses the modpoll third-party application to read from an attached slave device at address 1 using Modbus:
c:\modpoll-3.6\win>modpoll.exe -t 0 -a 1 -r 1 -c 4 -1 -m tcp 172.20.197.120
modpoll 3.6 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright (c) 2002-2018 proconX Pty Ltd
Visit https://www.modbusdriver.com for Modbus libraries and tools.
Protocol configuration: MODBUS/TCP
Slave configuration...: address = 1, start reference = 1, count = 4
Communication.........: 172.20.197.120, port 502, t/o 1.00 s, poll rate 1000 ms
Data type.............: discrete output (coil)
-- Polling slave...
[1]: 1
[2]: 0
[3]: 1
[4]: 0
Modbus Status¶
You can view the current connection status of the Modbus server listening on the TCP port.
To view status:
- In Web Manager, go to Modbus, click a particular Modbus line, and click Status.
- For CLI, see Status Modbus level in the Command Line Interface (CLI) Reference chapter of the xPico 200 Series User Guide.
- For XML, see configgroup Modbus in the XML Reference chapter of the xPico 200 Series User Guide.
Modbus Configuration¶
The following table describes the Web Manager Modbus configuration settings. Settings can be configured for each available Line on the gateway. To use Modbus TCP to Modbus serial bridge, the TCP Server State needs to be enabled in Modbus Configuration and the appropriate Line must be set to the Modbus RTU or Modbus ASCII protocol.
To configure Modbus settings:
- In Web Manager, go to Modbus, click the appropriate line, and click Configuration.
- For CLI, see Config Modbus level in the Command Line Interface (CLI) Reference chapter of the xPico 200 Series User Guide.
Settings | Description |
---|---|
TCP Server State | Enables or disables the Modbus TCP server. |
Port | Sets the TCP server port on which Modbus will accept a connection. Enter 0 for "<None>". The default is 502. |
Response Timeout | This is the timeout waiting for a response from the slave device in milliseconds. The default is 3000 milliseconds. |
Modbus ASCII Protocol¶
A line protocol can be set to Modbus ASCII. The Modbus ASCII line provides a mode to bridge from a Modbus TCP Master on the network side to Modbus ASCII devices with checksum.
In order to select this operating mode, set the line protocol for the selected interface to "Modbus ASCII" and the threshold to 513 bytes. The TCP Server State must be enabled for a line instance in the Modbus settings before assigning that line instance a Modbus protocol.
To configure Modbus settings:
- In the Web Manager, go to Modbus, click a particular line, and click Configuration.
- For CLI, see Config Modbus Level in the Command Line Interface (CLI) Reference chapter of the xPico 200 Series User Guide.
- For XML, see configgroup Modbus in the XML Reference chapter of the xPico 200 Series User Guide.
To configure the Line operating mode:
- In the Web Manager, go to Line, click a particular line, and click Configuration. Next to Protocol, select "Modbus ASCII.” Next to Threshold, enter "513". Click Submit.
- For CLI, see Config Line Level in the Command Line Interface (CLI) Reference chapter of the xPico 200 Series User Guide.
- For XML, see configgroup Line in the XML Reference chapter of the xPico 200 Series User Guide.
Modbus RTU Protocol¶
A line protocol can be set to Modbus RTU. The Modbus RTU line provides a mode to bridge from a Modbus TCP Master on the network side to Modbus RTU devices with CRC.
In order to select this operating mode, set the line protocol for the selected interface to "Modbus RTU" and the threshold to 513 bytes. The TCP Server State must be enabled for a line instance in the Modbus settings before assigning that line instance a Modbus protocol.
To configure Modbus settings:
- In the Web Manager, go to Modbus, click a particular line, and click Configuration.
- For CLI, see Config Modbus Level in the Command Line Interface (CLI) Reference chapter of the xPico 200 Series User Guide.
- For XML, see configgroup Modbus in the XML Reference chapter of the xPico 200 Series User Guide.
To configure the Line operating mode:
- In the Web Manager, go to Line, click a particular line, and click Configuration. Next to Protocol, select "Modbus RTU.” Next to Threshold, enter "513". Click Submit.
- For CLI, see Config Line Level in the Command Line Interface (CLI) Reference chapter of the xPico 200 Series User Guide.
- For XML, see configgroup Line in the XML Reference chapter of the xPico 200 Series User Guide.
SNMP¶
The Simple Network Management Protocol v2 (SNMP) agent allows devices to query the gateway for information or change that information. The Lantronix SNMP agent supports responding to RFC MIBs and custom MIBs, and sending notifications (traps). With traps enabled, the gateway will send notifications to the specified destination when the gateway is powered on, its network link is established, or its network link is disabled.
The Lantronix SNMP agent may be extended to support distributed MIBs loaded into the host processor rather than requiring customized agent code to be loaded into the xPico 200 firmware.
The SNMP module is not present in the standard build. The application developer may either
- add the SNMP module to the build and write their own agent code to be built into the xPico device, or
- add the SNMP module to the build, and use the built-in extended agent feature to communicate with their agent in an external device.
For details on the SNMP extended agent feature, see Application Note: Configuring the SNMP Extended Agent for xPico 200 Series and XPort EDGE. The application note may be downloaded from the Lantronix Application Notes web page.
Note
SNMP is not included in the default firmware. To use SNMP, use the SDK to create a project including the snmp
module. See Building Projects for more information.
SNMP Status¶
You can view the current status of the SNMP Agent, the System Name, and the System Description.
To view SNMP status:
- In Web Manager, go to SNMP > Status.
- For CLI, see Status SNMP Level in the Command Line Interface (CLI) Reference chapter of the xPico 200 Series User Guide.
SNMP Configuration¶
To configure SNMP:
- In Web Manager, go to SNMP > Configuration.
- For CLI, see Config SNMP Level in the Command Line Interface (CLI) Reference chapter of the xPico 200 Series User Guide.
- For XML, see configgroup SNMP in the XML Reference chapter of the xPico 200 Series User Guide.
Settings | Description |
---|---|
State | Enable or disable the SNMP Agent. |
Listen Network | Select a network interface to listen for SNMP requests. This can be Any, ap0, eth0, or wlan0. |
Community Read | Specify the community used to read SNMP data. The default is public. May contain up to 64 characters. |
Community Write | Specify the community used to write SNMP data. The default is private. May contain up to 64 characters. |
System Contact | Specify the system contact. May contain up to 64 characters. |
System Name | Specify the system name. The default is the gateway model (such as xPico240). May contain up to 64 characters. |
System Description | Specify the system description. The default is the gateway model, firmware version, and serial number (such as xPico240 V3.3.0.0R8.1 (0080A3B787CF)). May contain up to 64 characters. |
System Location | Specify the system location. May contain up to 64 characters. |
(Traps) State | Enable or disable traps. When traps are enabled, the gateway will send notifications to the destinations specified below when the gateway is powered on, its network link is established, or its network link is disabled. |
Primary Destination | Specify the IP address of the primary destination to notify. |
Secondary Destination | Specify the IP address of the secondary destination to notify, used when the primary destination is unreachable. |
Extended Agent IP Address | May contain up to 31 characters. |
Extended Agent Port | This enables the SNMP extended agent to connect to the loopback interface with the specified port. Blank the value for "<None>" which will disable the extended agent. By default, the extended agent is disabled. |
BLE Beacon Scanner¶
BLE Beacon Scanner allows BLE beacons to be scanned and transmitted over a line. It implements a line protocol which scans for BLE advertisements in beacon format, such as iBeacons, and transmits them out a line.
Note
BLE Beacon Scanner is not included in the default firmware. To use BLE Beacon Scanner, use the SDK to create a project including the ble_beacon_scanner
module. See Building Projects for more information. When BLE Beacon Scanner is included in a project, BLE Beacon Scanner will appear as a Line protocol choice.
BLE Beacon Scanner Status¶
The status for BLE Beacon Scanner can be viewed per line. Status reporting includes the configured transmit mode as well as the current transmit enabled state, which will be true if the transmit mode is Always, but may be true or false if the transmit mode is Any Character or Start and Stop Characters, depending on whether those characters have been received.
Additional status includes the total number of beacons scanned and the number of transmitted, dropped, and ignored beacons. Beacons will be ignored if the transmit mode is Disabled, or if the transmit mode is Any Character or Start and Stop Characters and a start character has not been received. Beacons will be dropped if BLE Beacon Scanner cannot buffer incoming beacons before previously scanned beacons are transmitted. This may happen if flow control is used on the line and the line is in a flowed-off state.
BLE Beacon Scanner Configuration¶
To configure BLE Beacon Scanner:
- In Web Manager, go to BLE Beacon Scanner and click Configuration on whichever line you want to run the protocol. See the table below for field descriptions.
- For CLI, see Config BLE Beacon Scanner level in the Command Line Interface (CLI) Reference chapter of the xPico 200 Series User Guide.
- For XML, see configgroup BLE Beacon Scanner in the XML Reference chapter of the xPico 200 Series User Guide.
To configure the Line operating mode:
In Web Manager, go to Line (for CLI, go to Config Line Level), click the Line that you associated with the BLE Beacon Scanner configuration and select BLE Beacon Scanner for the protocol. Submit or write the change.
When this Line Protocol is selected for the UART, it can receive results from the scanner. If the UART of the gateway is to be used to scan for beacons as well as to send or receive data over the Wi-Fi or Ethernet networks, then:
- Configure Line 1 to Mux Protocol
- Configure Virtual Line 1 to BLE Beacon Scanner Protocol
- Use the Mux Virtual Line functions to access the data.
For example, enter the following Mux commands:
1v1\r
1sb~\r
s~\r
1p\r
1rb~500\r
BLE Beacon Scanner Configuration Fields
Setting | Description |
---|---|
Type | Specifies the type of beacon to scan for. |
Transmit Mode | By default, transmission of beacons is disabled. You can choose to transmit scanned beacons always or only after receiving an input character on the line. When the transmit mode is Any Character, input characters received on the line work as a switch: the first character received will enable transmission of beacons, the second will disable transmission, and so forth. Similarly, if the transmit mode is Start and Stop Characters, transmit will be enabled when the specified start character is received, and disable when the specified stop character is received. |
Start Character | Specifies the input character value used to enable beacon transmission. This setting is only available if the transmit mode is Start and Stop Characters. |
Stop Character | Specifies the input character value used to disable beacon transmission. This setting is only available if the transmit mode is Start and Stop Characters. |
Output Format | Allows a string to be constructed consisting of the main elements of a beacon (UUID, Major Number, Minor Number, and RSSI) as well as some formatting characters. |
GATT Server¶
GATT Server allows the creation of a custom GATT service. Running a GATT service allows the device to function in a BLE peripheral role. Note that this does not limit the device from also functioning in a BLE central role as well.
A GATT Server consists of a single primary service, defined by a UUID, and includes up to two characteristics for that service. Service characteristics are the basis for data transmission; they may be defined as readable, writeable, or both.
Note
GATT Server is not included in the default firmware. To use GATT Server, use the SDK to create a project including the ble_gatt_server
module. See Building Projects for more information.
To configure a GATT Server:
- In Web Manager, go to GATT Server and enter a name for the service. Service names are limited to six characters, although a description may be added to the service. Click Edit to configure the service.
- For CLI, see Config GATT Server level in the Command Line Interface (CLI) Reference chapter of the xPico 200 Series User Guide.
- For XML, see configgroup GATT Server Custom Service in the XML Reference chapter of the xPico 200 Series User Guide.
Setting | Description |
---|---|
Description | Not required; for readability only. |
UUID | Required. This is the primary service UUID for the GATT service. The UUID is a 128-bit value specified in a string of 32 hexadecimal bytes. UUIDs are typically formatted as follows: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. |
Characteristic UUID | A service contains characteristics, defined by a UUID. At least one characteristic is required; up to two characteristics may be added to a service. |
Characteristic Properties | Makes the characteristic readable, writeable, or both. Readability is needed if the characteristic will be written to, and writeability is needed is the characteristic will be read from. Options are "Readable" and "Writeable." |
Advertise | Allows the service UUID to be advertised. Options are No or Yes. The device can only advertise one BLE service. If the Lantronix Provisioning Server is enabled, then it is the one service that is advertised. If selected, this setting only applies if the Lantronix Provisioning Server is disabled. |
Interface | Allows the service to be accessible via a line driver. The line driver interface will create a new line instance based on the GATT server name. GATT server line names are created in the format GATTS_ You may need to refresh the Web Manager to see the new Line instance. |