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

Connect to a OpenLCB interface. More...

Public Member Functions

 OpenLCBNode (name,...)
 Constructor: construct a OpenLCBNode object. More...
 
 SendInitComplete ()
 Send an initialization complete message. More...
 
 SendVerifyNodeID (nid="")
 Send a verify node id message. More...
 
 ProtocolSupportRequest (nid)
 Send a Protocol Support Request to the specified node. More...
 
 ProduceEvent (eventid)
 Send an event message. More...
 
 IdentifyConsumer (eventid)
 Send an identify consumer message. More...
 
 ConsumerIdentified (eventid, validity)
 Send a consumer identified message. More...
 
 ConsumerRangeIdentified (eventidrange)
 Send a consumer range identified message. More...
 
 IdentifyProducer (eventid)
 Send an identify producer message. More...
 
 ProducerIdentified (eventid, validity)
 Send a producer identified message. More...
 
 ProducerRangeIdentified (eventidrange)
 Send a producer range identified message. More...
 
 IdentifyEvents (nid="")
 Send an identify events message. More...
 
 LearnEvent (eventid)
 Send a learn event message. More...
 
 SendDatagram (nid, data)
 Send a datagram message to the specificed Node ID. More...
 
 DatagramReceivedOK (nid, flags=0)
 Send a datagram received ok message. More...
 
 DatagramRejected (nid, errorcode)
 Send a datagram rejected message. More...
 
 SendSimpleNodeInfoRequest (nid)
 Send a simple node info request message. More...
 
 SendSupportedProtocolsRequest (nid)
 Send a Supported protocols request message. More...
 
 SendMySupportedProtocols (nid)
 Send my supported protocols message. More...
 
 ReturnMySupportedProtocols ()
 Return my protocol support bitvector (three bytes). More...
 
 SendMySimpleNodeInfo (nid)
 Send my simple node info message. More...
 
 ReturnMySimpleNodeInfo ()
 Return my Simple Node Info payload. More...
 
 SendMyNodeVerifcation ()
 Send my node verification message. More...
 

Private Member Functions

 _messageHandler (message)
 Generic message handler. More...
 

Static Private Member Functions

static nidlist (nid)
 Break a Node ID string into a list of bytes. More...
 
static _buildSelectTransportConstructorDialog ()
 Build a dialog box to select the transport constructor. More...
 
static _CancelSelectTransport ()
 Bound to the Cancel button. More...
 
static _SelectTransport ()
 Bound to the Select button. More...
 
static selectTransportConstructor (...)
 @oublicsection Pop up a select transport constructor dialog box. More...
 
static transportConstructors ()
 Return the list of known available transport constructors. More...
 

Private Attributes

 transport
 The logical transport layer component. More...
 
 protocolsupport
 Protocol support: Simple Protocol subset and SimpleNodeInfo by default. More...
 
 simplenodeinfo
 Simple node info payload. More...
 

Static Private Attributes

static _transportConstructors
 Array of transport constructors. More...
 
static selectTransportConstructorDialog
 Dialog box to select the transport constructor. More...
 
static constructorCombo
 LabelComboBox to select a transport constructor. More...
 

Detailed Description

Connect to a OpenLCB interface.

This class implements the high level interface to the OpenLCB network.

Options:

Constructor & Destructor Documentation

◆ OpenLCBNode()

lcc::OpenLCBNode::OpenLCBNode ( name  ,
  ... 
)

Constructor: construct a OpenLCBNode object.

Open a connection to the OpenLCB network.

Parameters
nameThe name of the OpenLCBNode object.
...Options:
  • -transport The transport layer constuctor. This option is required.
  • -eventhandler This is a script prefix that is run for event processing messages. This is a command with the procedure signature of
    proc eventhandler {command eventid {{validity {}}}} {...}
    The command is one of consumerrangeidentified, consumeridentified, producerrangeidentified, produceridentified, learnevents, report, identifyconsumer, identifyproducer, or identifyevents.
  • -datagramehandler This is a script prefix that is run for datagram messages. This is a command with the procedure signature of
    proc datagramehandler {command sourcenid data} {...}
    The command argument is one of datagramreceivedok, datagramrejected, or datagramcontent
  • -generalmessagehandler This is a script prefix that is run for general messages. This is a command with the procedure signature of
    proc generalmessagehandler {message} {...}
    The message is an lcc::OpenLCBMessage object. The procedure should reference the -mti option of the message object to determine what sort message it is.
Additional options are passed to the transport layer constructor.

Member Function Documentation

◆ _buildSelectTransportConstructorDialog()

static lcc::OpenLCBNode::_buildSelectTransportConstructorDialog ( )
staticprivate

Build a dialog box to select the transport constructor.

Returns
A transport constructor selection dialog box.

◆ _CancelSelectTransport()

static lcc::OpenLCBNode::_CancelSelectTransport ( )
staticprivate

Bound to the Cancel button.


Closes the transport constructor dialog box and return the null string.

Returns
The null string.

◆ _messageHandler()

lcc::OpenLCBNode::_messageHandler ( message  )
private

Generic message handler.

Parameters
messageThe received OpenLCB message.

◆ _SelectTransport()

static lcc::OpenLCBNode::_SelectTransport ( )
staticprivate

Bound to the Select button.

Closes the transport constructor dialog box and returns the selected transport constructor.

Returns
The transport constructor name.

◆ ConsumerIdentified()

lcc::OpenLCBNode::ConsumerIdentified ( eventid  ,
validity   
)

Send a consumer identified message.

Parameters
eventidThe event id to send.
validityThe validity of the eventid: one of the words valid, invalid, or unknown.

◆ ConsumerRangeIdentified()

lcc::OpenLCBNode::ConsumerRangeIdentified ( eventidrange  )

Send a consumer range identified message.

Parameters
eventidrangeThe event id range identified.

◆ DatagramReceivedOK()

lcc::OpenLCBNode::DatagramReceivedOK ( nid  ,
flags  = 0 
)

Send a datagram received ok message.

Parameters
nidThe Node ID to send the message to.
flagsThe (optional) flags to send.

◆ DatagramRejected()

lcc::OpenLCBNode::DatagramRejected ( nid  ,
errorcode   
)

Send a datagram rejected message.

Parameters
nidThe Node ID to send the message to.
errorcodeThe error code to send.

◆ IdentifyConsumer()

lcc::OpenLCBNode::IdentifyConsumer ( eventid  )

Send an identify consumer message.

Parameters
eventidThe event id to send.

◆ IdentifyEvents()

lcc::OpenLCBNode::IdentifyEvents ( nid  = "")

Send an identify events message.

Parameters
nidThe (optional) Node ID to send the message to. If ommited, a global verify node id message is sent.

◆ IdentifyProducer()

lcc::OpenLCBNode::IdentifyProducer ( eventid  )

Send an identify producer message.

Parameters
eventidThe event id to send.

◆ LearnEvent()

lcc::OpenLCBNode::LearnEvent ( eventid  )

Send a learn event message.

Parameters
eventidThe event id to learn.

◆ nidlist()

static lcc::OpenLCBNode::nidlist ( nid  )
staticprivate

Break a Node ID string into a list of bytes.

Parameters
nidThe Node ID to split up.

◆ ProduceEvent()

lcc::OpenLCBNode::ProduceEvent ( eventid  )

Send an event message.

Parameters
eventidThe event id to send.

◆ ProducerIdentified()

lcc::OpenLCBNode::ProducerIdentified ( eventid  ,
validity   
)

Send a producer identified message.

Parameters
eventidThe event id to send.
validityThe validity of the eventid: one of the words valid, invalid, or unknown.

◆ ProducerRangeIdentified()

lcc::OpenLCBNode::ProducerRangeIdentified ( eventidrange  )

Send a producer range identified message.

Parameters
eventidrangeThe event id range identified.

◆ ProtocolSupportRequest()

lcc::OpenLCBNode::ProtocolSupportRequest ( nid  )

Send a Protocol Support Request to the specified node.

Parameters
nidThe Node ID to send the message to.

◆ ReturnMySimpleNodeInfo()

lcc::OpenLCBNode::ReturnMySimpleNodeInfo ( )

Return my Simple Node Info payload.

Returns
A Simple Node Info payload.

◆ ReturnMySupportedProtocols()

lcc::OpenLCBNode::ReturnMySupportedProtocols ( )

Return my protocol support bitvector (three bytes).

Returns
A protocol support bitvector (three bytes).

◆ selectTransportConstructor()

static lcc::OpenLCBNode::selectTransportConstructor (   ...)
staticprivate

@oublicsection Pop up a select transport constructor dialog box.

Parameters
...Options:
  • -parent The parent window for this dialog box.
Returns
Either the null string or the transport constructor.

◆ SendDatagram()

lcc::OpenLCBNode::SendDatagram ( nid  ,
data   
)

Send a datagram message to the specificed Node ID.

Parameters
nidThe Node ID to send the message to.
dataThe data to send (1 to 64 bytes).

◆ SendInitComplete()

lcc::OpenLCBNode::SendInitComplete ( )

Send an initialization complete message.

◆ SendMyNodeVerifcation()

lcc::OpenLCBNode::SendMyNodeVerifcation ( )

Send my node verification message.

◆ SendMySimpleNodeInfo()

lcc::OpenLCBNode::SendMySimpleNodeInfo ( nid  )

Send my simple node info message.

Parameters
nidThe Node ID to send the message to.

◆ SendMySupportedProtocols()

lcc::OpenLCBNode::SendMySupportedProtocols ( nid  )

Send my supported protocols message.

Parameters
nidThe Node ID to send the message to.

◆ SendSimpleNodeInfoRequest()

lcc::OpenLCBNode::SendSimpleNodeInfoRequest ( nid  )

Send a simple node info request message.

Parameters
nidThe Node ID to send the message to.

◆ SendSupportedProtocolsRequest()

lcc::OpenLCBNode::SendSupportedProtocolsRequest ( nid  )

Send a Supported protocols request message.

Parameters
nidThe Node ID to send the message to.

◆ SendVerifyNodeID()

lcc::OpenLCBNode::SendVerifyNodeID ( nid  = "")

Send a verify node id message.

Parameters
nidThe (optional) Node ID to send the message to. If ommited, a global verify node id message is sent.

◆ transportConstructors()

static lcc::OpenLCBNode::transportConstructors ( )
staticprivate

Return the list of known available transport constructors.

Returns
The list of known available transport constructors as a description name list.

Member Data Documentation

◆ _transportConstructors

lcc::OpenLCBNode::_transportConstructors
staticprivate

Array of transport constructors.

◆ constructorCombo

lcc::OpenLCBNode::constructorCombo
staticprivate

LabelComboBox to select a transport constructor.

◆ protocolsupport

lcc::OpenLCBNode::protocolsupport
private

Protocol support: Simple Protocol subset and SimpleNodeInfo by default.

◆ selectTransportConstructorDialog

lcc::OpenLCBNode::selectTransportConstructorDialog
staticprivate

Dialog box to select the transport constructor.

◆ simplenodeinfo

lcc::OpenLCBNode::simplenodeinfo
private

Simple node info payload.

◆ transport

lcc::OpenLCBNode::transport
private

The logical transport layer component.