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

CMR/I node type. More...

Public Member Functions

 CmriNode (name,...)
 Constructor – initialize a board. More...
 
 inputs ()
 Method to fetch input port values. More...
 
 outputs (portvector="")
 Method to set output ports. More...
 
 setport (portnum, byte)
 Set and send one byte to a port (rewrites all ports). More...
 
 setbitfield (portnum, mask, bits)
 Set and send a bitfield to a port (rewrites all ports). More...
 

Static Public Member Functions

static validate (object)
 Type validating code Raises an error if object is not either the empty string or a C4TSMINI_Block type. More...
 
static openport (port="/dev/ttyS0", baud=9600, maxtries=10000)
 Open the CMR/I port. More...
 
static closeport ()
 Close the CMR/I port. More...
 
static portopenp ()
 Return port status. More...
 

Public Attributes

 outputbuffer
 Output buffer. More...
 

Private Member Functions

 _ValidateType (option, value)
 Method to validate the card type. More...
 
 _ValidateAddress (option, value)
 Method to validate a card address. More...
 
 _ValidateListOfBytes (option, value)
 Method to validate a list of bytes. More...
 
 _ValidateSixElementListOfBytes (option, value)
 Method to validate a six element list of bytes. More...
 
 _ValidateByte (option, value)
 Method to validate a byte value. More...
 
 _ValidateWord (option, value)
 Method to validate a word (16-bit) value. More...
 

Static Private Attributes

static _TypeCodes
 Node type codes. More...
 

Detailed Description

CMR/I node type.


This Snit type defines CMR/I nodes (SUSIC, USIC, or SMINI boards) on a CMR/I network. All options are readonly.

Author
Robert Heller <heller@deepsoft.com>

Constructor & Destructor Documentation

◆ CmriNode()

CmriSupport::CmriNode::CmriNode ( name  ,
  ... 
)

Constructor – initialize a board.

Parameters
nameName of the node.
...Options:
  • -type The type of node, one of SUSIC, USIC, or SMINI. No default value.
  • -address The address of the node. Default is 0.
  • -cardmap The card type map. Only used with SUSIC and USIC. Default is {}.
  • -yellowmap The yellow bi-color LED map. Only used with the SMINI card type. Default is {0 0 0 0 0 0}.
  • -numberofyellow The number of yellow bi-color LED signals. Only for SMINI cards. Default is 0.
  • -inputports The number of 8-bit input ports. Default 0 (3 for SMINI cards).
  • -outputports The number of 8-bit output ports. Default 0 (6 for SMINI cards).
  • -delay The delay value to use. Only meaningful for older (USIC) cards. Default is 0.

Member Function Documentation

◆ _ValidateAddress()

CmriSupport::CmriNode::_ValidateAddress ( option  ,
value   
)
private

Method to validate a card address.

Parameters
optionThe option to validate.
valueThe value to validate.

◆ _ValidateByte()

CmriSupport::CmriNode::_ValidateByte ( option  ,
value   
)
private

Method to validate a byte value.

Parameters
optionThe option to validate.
valueThe value to validate.

◆ _ValidateListOfBytes()

CmriSupport::CmriNode::_ValidateListOfBytes ( option  ,
value   
)
private

Method to validate a list of bytes.

Parameters
optionThe option to validate.
valueThe value to validate.

◆ _ValidateSixElementListOfBytes()

CmriSupport::CmriNode::_ValidateSixElementListOfBytes ( option  ,
value   
)
private

Method to validate a six element list of bytes.

Parameters
optionThe option to validate.
valueThe value to validate.

◆ _ValidateType()

CmriSupport::CmriNode::_ValidateType ( option  ,
value   
)
private

Method to validate the card type.

Parameters
optionThe option to validate.
valueThe value to validate.

◆ _ValidateWord()

CmriSupport::CmriNode::_ValidateWord ( option  ,
value   
)
private

Method to validate a word (16-bit) value.

Parameters
optionThe option to validate.
valueThe value to validate.

◆ closeport()

static CmriSupport::CmriNode::closeport ( )
static

Close the CMR/I port.

This type method closes the CMR/I port.

◆ inputs()

CmriSupport::CmriNode::inputs ( )

Method to fetch input port values.

◆ openport()

static CmriSupport::CmriNode::openport ( port  = "/dev/ttyS0",
baud  = 9600,
maxtries  = 10000 
)
static

Open the CMR/I port.

This type method opens the CMR/I port.

Parameters
portThe serial port connected to the CMR/I network.
baudThe BAUD rate to be used.
maxtriesThe maximum number of retries.

◆ outputs()

CmriSupport::CmriNode::outputs ( portvector  = "")

Method to set output ports.

Parameters
portvectorVector of output ports.

◆ portopenp()

static CmriSupport::CmriNode::portopenp ( )
static

Return port status.

◆ setbitfield()

CmriSupport::CmriNode::setbitfield ( portnum  ,
mask  ,
bits   
)

Set and send a bitfield to a port (rewrites all ports).

Parameters
portnumNumber of the output port.
maskBit mask.
bitsBits (must already shifted into position!).

◆ setport()

CmriSupport::CmriNode::setport ( portnum  ,
byte   
)

Set and send one byte to a port (rewrites all ports).

Parameters
portnumNumber of the output port.
byteValue to write.

◆ validate()

static CmriSupport::CmriNode::validate ( object  )
static

Type validating code Raises an error if object is not either the empty string or a C4TSMINI_Block type.

Member Data Documentation

◆ _TypeCodes

CmriSupport::CmriNode::_TypeCodes
staticprivate

Node type codes.

◆ outputbuffer

CmriSupport::CmriNode::outputbuffer

Output buffer.