class documentation

CV access - POM

This is the CV Access Command - long form RCN-214 Section 2. Only one CV access conversation may take place concurrently. RailCom only - not service track or simplex Programming on Main.

To read a single CV we can execute either of the check operations. In RailCom POM these both return the entire CV rather than the simple boolean service mode response. In practice we will use byte check for cv read.

Objects in this class are single use. I.e once the CV access is complete they may dropped for garbage collection.

TODO Do we need to look at accessory CVs too?

Method __init__ Construct a Program on Main Command
Method all_sent Update State after Send
Method get_cv Get the CV number
Method get_state Get the command state
Constant BIT_CHK CV BIT Check
Constant BIT_MANIP As specified in RCN-217 for write cv bit
Constant BIT_WRT CV Bit Write
Constant BYTE_CHK As specified in RCN-217 for read cv byte
Constant BYTE_WRT As specified in RCN-217 for write cv byte
Constant NOT_SENT Undocumented
Constant SENT_POM Undocumented
Constant SENT_W1 Undocumented
Constant TYPE P - Programme on Main
Constant _CMD Undocumented
Instance Variable _address Undocumented
Instance Variable _byte_list Undocumented
Instance Variable _cv Undocumented
Instance Variable _operation Undocumented
Instance Variable _state Undocumented
Instance Variable _type Undocumented

Inherited from CommandPacket:

Method is_locked Is Locked
Method set_buffer Set buffer contents
Constant BASE_LONG_ADDR DCC long mobile address range base
Constant MAX_LONG_ADDR DCC long address upper limit (inclusive)
Constant MIN_LONG_ADDR DCC long address lower limit (inclusive)
Instance Variable SENT Return value for command serialised
Property address Get Address
Property packet_buffer Get the Packet Buffer
Property type Get the command type
Instance Variable _packet_buff Undocumented
def __init__(self, address, cv, *, operation='r', value=0):

Construct a Program on Main Command

This constructs a POM command. It calls __init__ in the base class. It sets the decoder address, the CV number, the operation (read or write), and the new value. At the moment only single byte CV operations are supported.

Note

Parameters not validated here.

Parameters
addressDCC address of target decoder
cvCV number to read or write
operationread(r) or write(w)
valuenew value for CV
def all_sent(self):

Update State after Send

Process state according to operation (r or w)

Should only need to send read once but TOM appears to need it twice!

returns True if all POM sends done

def get_cv(self):

Get the CV number

This returns the number of the CV being accessed. The primary purpose is allow the Channel 2 response processor to determine which CV a returned CV value relates to.

Returns
The CV numver being accessed.
def get_state(self):

Get the command state

This returns the state of the most recent send or NOT_SENT.

todo

Confirm that this is required.

Returns
The send state of the command
BIT_CHK =

CV BIT Check

Value
const(224)
BIT_MANIP =

As specified in RCN-217 for write cv bit

Value
const(232)
BIT_WRT =

CV Bit Write

Value
const(240)
BYTE_CHK =

As specified in RCN-217 for read cv byte

Value
const(228)
BYTE_WRT =

As specified in RCN-217 for write cv byte

Value
const(236)
NOT_SENT =

Undocumented

Value
const(0)
SENT_POM =

Undocumented

Value
const(2)
SENT_W1 =

Undocumented

Value
const(1)
TYPE: str =

P - Programme on Main

Value
'P'
_CMD =

Undocumented

Value
{'r': BYTE_CHK, 'w': BYTE_WRT}
_address =

Undocumented

_byte_list =

Undocumented

_cv =

Undocumented

_operation =

Undocumented

_state =

Undocumented

_type =

Undocumented