Package jmri
Class PushbuttonPacket
- java.lang.Object
-
- jmri.PushbuttonPacket
-
public class PushbuttonPacket extends java.lang.Object
Generates an NMRA packet containing the correct payload to enable or disable pushbutton lockout. Currently supports the following Decoders NCE CVP AD4 NCE is the easiest to implement, CV556 = 0 disable lockout, CV556 = 1 enable lockout CVP is a bit tricker, CV514 controls the lockout for four turnouts. Each turnout can have one or two button controls. Therefore the user must specify if they are using one or two buttons for each turnout. From the CVP user manual: Function CV514 Lock all inputs 0 Unlock 1 1 Unlock 2 4 Unlock 3 16 Unlock 4 64 Unlock all 85 Enable 2 button 255 This routine assumes that for two button operations the following table is true: Lock all inputs 0 Unlock 1 3 Unlock 2 12 Unlock 3 48 Unlock 4 192 Unlock all 255 Each CVP can operate up to four turnouts, lucky for us, they are sequential. Also note that CVP decoder's use the old legacy format for ops mode programming.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CVP_1Bname
static java.lang.String
CVP_2Bname
static java.lang.String
NCEname
static java.lang.String
unknown
Valid stationary decoder names
-
Constructor Summary
Constructors Constructor Description PushbuttonPacket()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String[]
getValidDecoderNames()
static byte[]
pushbuttonPkt(java.lang.String prefix, int turnoutNum, boolean locked)
-
-
-
Field Detail
-
unknown
public static final java.lang.String unknown
Valid stationary decoder names- See Also:
- Constant Field Values
-
NCEname
public static final java.lang.String NCEname
- See Also:
- Constant Field Values
-
CVP_1Bname
public static final java.lang.String CVP_1Bname
- See Also:
- Constant Field Values
-
CVP_2Bname
public static final java.lang.String CVP_2Bname
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PushbuttonPacket
public PushbuttonPacket()
-
-
Method Detail
-
pushbuttonPkt
@Nonnull public static byte[] pushbuttonPkt(@Nonnull java.lang.String prefix, int turnoutNum, boolean locked)
- Parameters:
prefix
- system prefix.turnoutNum
- turnout number.locked
- true if locked, else false.- Returns:
- a DCC packet.
- Throws:
java.lang.IllegalArgumentException
- if input not OK
-
getValidDecoderNames
@Nonnull public static java.lang.String[] getValidDecoderNames()
-
-