001package jmri.jmrit.operations.automation.actions;
002
003/**
004 * Action codes for automation
005 *
006 * @author Daniel Boudreau Copyright (C) 2016
007 * 
008 *
009 */
010public class ActionCodes {
011
012    // lower byte used in the construction of action codes
013    public static final int ENABLE_TRAINS = 0x1;
014    public static final int ENABLE_ROUTES = 0x2;
015    public static final int OK_MESSAGE = 0x4;
016    public static final int FAIL_MESSAGE = 0x8;
017    
018    public static final int ENABLE_AUTOMATION = 0x10;
019    public static final int ENABLE_GOTO = 0x20;
020    public static final int ENABLE_OTHER = 0x40;
021
022    // codes use upper byte   
023    public static final int CODE_MASK = 0xFF00; // upper byte only
024    
025    public static final int NO_ACTION = 0x0000 + OK_MESSAGE;
026    
027    public static final int BUILD_TRAIN = 0x0100 + ENABLE_TRAINS + OK_MESSAGE + FAIL_MESSAGE;
028    public static final int BUILD_TRAIN_IF_SELECTED = 0x0200 + ENABLE_TRAINS + OK_MESSAGE + FAIL_MESSAGE;
029    public static final int PRINT_TRAIN_MANIFEST = 0x0300 + ENABLE_TRAINS + OK_MESSAGE + FAIL_MESSAGE;
030    public static final int PRINT_TRAIN_MANIFEST_IF_SELECTED = 0x0400 + ENABLE_TRAINS + OK_MESSAGE + FAIL_MESSAGE;
031    public static final int MOVE_TRAIN = 0x0500 + ENABLE_TRAINS + ENABLE_ROUTES + OK_MESSAGE + FAIL_MESSAGE;
032    public static final int TERMINATE_TRAIN = 0x0600 + ENABLE_TRAINS + OK_MESSAGE + FAIL_MESSAGE;
033    public static final int WAIT_FOR_TRAIN = 0x0700 + ENABLE_TRAINS + ENABLE_ROUTES + OK_MESSAGE + FAIL_MESSAGE;
034    public static final int RESET_TRAIN = 0x0800 + ENABLE_TRAINS + OK_MESSAGE + FAIL_MESSAGE;
035    public static final int RUN_TRAIN = 0x0900 + ENABLE_TRAINS + OK_MESSAGE + FAIL_MESSAGE;
036    public static final int SELECT_TRAIN = 0x0A00 + ENABLE_TRAINS + OK_MESSAGE + FAIL_MESSAGE;
037    public static final int DESELECT_TRAIN = 0x0B00 + ENABLE_TRAINS + OK_MESSAGE + FAIL_MESSAGE;
038    public static final int WAIT_FOR_TRAIN_TERMINATE = 0x0C00 + ENABLE_TRAINS + OK_MESSAGE + FAIL_MESSAGE;
039    public static final int IS_TRAIN_EN_ROUTE = 0x0D00 + ENABLE_TRAINS + ENABLE_ROUTES + OK_MESSAGE + FAIL_MESSAGE;
040    public static final int PRINT_TRAIN_BUILDREPORT = 0x0E00 + ENABLE_TRAINS + OK_MESSAGE + FAIL_MESSAGE;
041    
042    public static final int UPDATE_SWITCHLIST = 0x1000 + OK_MESSAGE;
043    public static final int PRINT_SWITCHLIST = 0x1100 + OK_MESSAGE;
044    public static final int WAIT_SWITCHLIST = 0x1200 + OK_MESSAGE;
045    public static final int RUN_SWITCHLIST_CHANGES = 0x1300 + OK_MESSAGE + FAIL_MESSAGE;
046    public static final int RUN_SWITCHLIST = 0x1400 + OK_MESSAGE + FAIL_MESSAGE;
047    public static final int PRINT_SWITCHLIST_CHANGES = 0x1500 + OK_MESSAGE;
048    public static final int GENERATE_SWITCHLIST_CHANGES = 0x1600 + OK_MESSAGE + FAIL_MESSAGE;
049    public static final int GENERATE_SWITCHLIST = 0x1700 + OK_MESSAGE + FAIL_MESSAGE;
050    public static final int RESET_SWITCHLIST = 0x1800 + OK_MESSAGE;
051    
052    public static final int ACTIVATE_TRAIN_SCHEDULE = 0x2000 + OK_MESSAGE + ENABLE_OTHER; 
053    public static final int APPLY_TRAIN_SCHEDULE = 0x2100 + OK_MESSAGE + FAIL_MESSAGE;
054    
055    public static final int STEP_AUTOMATION = 0x3000 + OK_MESSAGE + FAIL_MESSAGE + ENABLE_AUTOMATION;
056    public static final int RUN_AUTOMATION = 0x3100 + OK_MESSAGE + FAIL_MESSAGE + ENABLE_AUTOMATION;
057    public static final int STOP_AUTOMATION = 0x3200 + OK_MESSAGE + FAIL_MESSAGE + ENABLE_AUTOMATION;
058    public static final int RESUME_AUTOMATION = 0x3300 + OK_MESSAGE + FAIL_MESSAGE + ENABLE_AUTOMATION;
059    
060    public static final int COUNTER = 0x4000 + OK_MESSAGE;
061    public static final int MESSAGE_YES_NO = 0x4200 + ENABLE_TRAINS + ENABLE_ROUTES + OK_MESSAGE;
062    
063    public static final int GOTO = 0x5000 + OK_MESSAGE + FAIL_MESSAGE + ENABLE_GOTO;
064    public static final int GOTO_IF_TRUE = 0x5100 + OK_MESSAGE + FAIL_MESSAGE + ENABLE_GOTO;
065    public static final int GOTO_IF_FALSE = 0x5200 + OK_MESSAGE + FAIL_MESSAGE + ENABLE_GOTO;
066    
067    public static final int HALT_ACTION = 0xFF00 + OK_MESSAGE;
068
069}