Model Railroad System  2.2.1
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | Static Private Attributes | List of all members
lcc::OpenLCBOverTcp Class Reference

Connect to a OpenLCB over Tcp/Ip. More...

Public Member Functions

 OpenLCBOverTcp (name,...)
 Constructor: Connect to a Tcp/Ip OpenLCB network. More...
 
 setMessageHandler (handler)
 Set the message handler. More...
 
 sendMessage (...)
 Send a message on the OpenLCB bus. More...
 

Static Public Member Functions

static buildPortnidandhostDialog ()
 Function to construct the Dialog to ask the user for a port, host, and Node ID. More...
 
static _CancelOpenTransport ()
 Function bound to the Cancel button. More...
 
static _OpenTransport ()
 Function bound to the Open button. More...
 
static requiredOpts ()
 Return the default option list. More...
 
static drawOptionsDialog (...)
 Pop up the Options Dialog box. More...
 

Static Public Attributes

static portnidandhostDialog
 Dialog to ask the user for a port, host, and Node ID. More...
 
static portLSpin
 LabelSpinBox containing possible network ports. More...
 
static hostLEntry
 LabelEntry containing the hostname. More...
 
static nidLEntry
 LabelEntry containing the Node ID. More...
 

Private Attributes

 mtidetail
 MTIDetail component. More...
 
 messagehandler
 Message handler. More...
 
 datagrambuffers
 Datagram buffers. More...
 
 messagebuffers
 General message buffers (for multi frame messages) More...
 
 sock
 The socket I/O channel. More...
 
 _timeout
 Timeout flag. More...
 

Static Private Attributes

static NIDPATTERN
 The regexp for breaking up the Node ID into bytes. More...
 

Detailed Description

Connect to a OpenLCB over Tcp/Ip.

Options:

Constructor & Destructor Documentation

◆ OpenLCBOverTcp()

lcc::OpenLCBOverTcp::OpenLCBOverTcp ( name  ,
  ... 
)

Constructor: Connect to a Tcp/Ip OpenLCB network.

Create a connection to a Tcp/Ip network.

Parameters
nameThe name of the instance.
...The options:
  • -host The name of the host (or IP address) to connect to. The default is localhost.
  • -port The Tcp/Ip port number to connect with. The default is 12000.
  • -nid The Node ID that the computer will assume in the format of hh:hh:hh:hh:hh:hh which is a 48 bit number expressed as 6 pairs of hexadecimal digits separacted by colons (:).
  • -promisciousmode Promiscious mode flag. If true all messages are handled, whether they are addressed to this node or not.

Member Function Documentation

◆ _CancelOpenTransport()

static lcc::OpenLCBOverTcp::_CancelOpenTransport ( )
static

Function bound to the Cancel button.

Closes the dialog box and returns the empty string.

Returns
The empty string.

◆ _OpenTransport()

static lcc::OpenLCBOverTcp::_OpenTransport ( )
static

Function bound to the Open button.

Closes the dialog box and returns the options needed to open the transport.

Returns
An option argument list with the -nid and -port options.

◆ buildPortnidandhostDialog()

static lcc::OpenLCBOverTcp::buildPortnidandhostDialog ( )
static

Function to construct the Dialog to ask the user for a port, host, and Node ID.

Returns
The Dialog box object.

◆ drawOptionsDialog()

static lcc::OpenLCBOverTcp::drawOptionsDialog (   ...)
static

Pop up the Options Dialog box.

Pops up the Options Dialog box and collects the options needed to open the OpenLCBOverTcp object.

Parameters
...Options:
  • -parent Set the parent for this dialog box.
  • -port The default Tcp/Ip port number option.
  • -host The default Tcp/Ip hostname option.
  • -nid The default Node ID to use for the Node ID option.
Returns
Either the null string or an options list.

◆ requiredOpts()

static lcc::OpenLCBOverTcp::requiredOpts ( )
static

Return the default option list.

Returns the default options for the options dialog.

Returns
The option value list.

◆ sendMessage()

lcc::OpenLCBOverTcp::sendMessage (   ...)

Send a message on the OpenLCB bus.

Parameters
...Message options. See OpenLCBMessage for possible options.

◆ setMessageHandler()

lcc::OpenLCBOverTcp::setMessageHandler ( handler  )

Set the message handler.

Generally called from the upper level class to gain access to incoming messages asyncronously.

Parameters
handlerThe new handler procedure.
Returns
The old handler or the empty string if there was no old handler.

Member Data Documentation

◆ _timeout

lcc::OpenLCBOverTcp::_timeout
private

Timeout flag.

◆ datagrambuffers

lcc::OpenLCBOverTcp::datagrambuffers
private

Datagram buffers.

◆ hostLEntry

lcc::OpenLCBOverTcp::hostLEntry
static

LabelEntry containing the hostname.

◆ messagebuffers

lcc::OpenLCBOverTcp::messagebuffers
private

General message buffers (for multi frame messages)

◆ messagehandler

lcc::OpenLCBOverTcp::messagehandler
private

Message handler.

◆ mtidetail

lcc::OpenLCBOverTcp::mtidetail
private

MTIDetail component.

This component is used to extract and pack fields from and to a MTI header at a MTI detail level.

◆ nidLEntry

lcc::OpenLCBOverTcp::nidLEntry
static

LabelEntry containing the Node ID.

◆ NIDPATTERN

lcc::OpenLCBOverTcp::NIDPATTERN
staticprivate

The regexp for breaking up the Node ID into bytes.

◆ portLSpin

lcc::OpenLCBOverTcp::portLSpin
static

LabelSpinBox containing possible network ports.

◆ portnidandhostDialog

lcc::OpenLCBOverTcp::portnidandhostDialog
static

Dialog to ask the user for a port, host, and Node ID.

◆ sock

lcc::OpenLCBOverTcp::sock
private

The socket I/O channel.