Class NceShowCabPanel

  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, AbstractMRListener, NceListener, NcePanelInterface

    public class NceShowCabPanel
    extends NcePanel
    implements NceListener
    Frame to display NCE cabs

    Note, NCE bit layout MSB = bit 7, LSB = bit 0.

    From Jim Scorse at NCE:

    Each cab has a 256 byte "context page" in system RAM These pages start at 0x8000 in system RAM with Cab 0 at 0x8800, cab 1 at 0x8900, Cab 2 at 0x8a00, etc. (PH5 0x3C00)

    Below is a list of offsets (in decimal) into the cab context page for useful memory locations.

    For example if you want to know the current speed of cab address 2's currently selected loco look at memory location 0x8a00 + 32 dec (0x20). This will be address 0x8a20.


    To determine if a cab is active (plugged in at any point this session) you will need to look at the byte "FLAGS1" (offset 101)

    If bit 1 of FLAGS1 = 1 then the cab has been talked to at least once by the command station.

    Bits 0 and 7 indicate the type of cab being use this session at this cab address

    Bit 7,0 = 0,0 Procab or other cab with an LCD display (type A) Bit 7,0 = 0,1 Cab04 other cab without an LCD (type B) Bit 7,0 = 1,0 USB or similar device (type C) Bit 7,0 = 1,1 AIU or similar device (type D)


    CAB_BASE EQU 0 ; LCD_TOP_LINE EQU 0 ;16 chars (in ASCII) for top line of LCD LCD_BOT_LINE EQU 16 ;16 chars (in ASCII) for bottom line of LCD

    CURR_SPEED EQU 32 ;this cab's current speed ADDR_H EQU 33 ;loco address, high byte ADDR_L EQU 34 ;loco address, low byte FLAGS EQU 35 ;bit 0 - Do not use ;bit 1 - 1=128 speed mode, 0=28 speed mode ;bit 2 - 1=forward, 0=reverse ;bit 3 - Do not use ;bit 4 - Do not use ;bit 5 - Do not use ;bit 6 - Do not use ;bit 7 - 1=rear loco of consist is active address use reverse speeds

    FUNCTION_L EQU 36 ;bit 0 = function 1, 1=on, 0=off ;bit 1 = function 2, 1=on, 0=off ;bit 2 = function 3, 1=on, 0=off ;bit 3 = function 4, 1=on, 0=off ;bit 4 = headlight, 1=on, 0=off

    FUNCTION_H EQU 37 ;bit 0 = function 5, 1=on, 0=off ;bit 1 = function 6, 1=on, 0=off ;bit 2 = function 7, 1=on, 0=off ;bit 3 = function 8, 1=on, 0=off ;bit 4 = function 9, 1=on, 0=off ;bit 5 = function 10, 1=on, 0=off ;bit 6 = function 11, 1=on, 0=off ;bit 7 = function 12, 1=on, 0=off

    ALIAS EQU 38 ;If loco is in consist this is the consist address


    FUNC13_20 EQU 82 ;bit map of current functions (bit 0=F13) FUNC21_28 EQU 83 ;bit map of current functions (bit 0=F21)

    ACC_AD_H EQU 90 ;current accessory address high byte ACC_AD_L EQU 91 ;current accessory address low byte

    ;lower nibble bit 0 =1 if setup advanced consist in process

    FLAGS2 EQU 93 ;bit 0 = \ ;bit 1 = >Number of recalls for this cab ;bit 2 = / 1-6 valid ;bit 3 = 1=refresh LCD on ProCab ;bit 4 = Do not use ;bit 5 = Do not use ;bit 6 = Do not use ;bit 7 = Do not use

    FLAGS1 EQU 101 ;bit0 - 0 = type a or type C cab, 1 = type b or type d ;bit1 - 0 = cab type not determined, 1 = it has ;bit2 - 0 = Do not use ;bit3 - 0 = Do not use ;bit4 - 0 = Do not use ;bit5 - 0 = Do not use ;bit6 - 0 = Do not use ;bit7 - 0 = type a or type b cab, 1=type c or d Writing zero to FLAGS1 will remove the cab from the 'active' list

    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static class  NceShowCabPanel.DataRow  
      static class  NceShowCabPanel.Default
      Nested class to create one of these using old-style defaults.
      (package private) class  NceShowCabPanel.NceCabTableModel  
      • Nested classes/interfaces inherited from class javax.swing.JPanel

        javax.swing.JPanel.AccessibleJPanel
      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • Nested classes/interfaces inherited from class java.awt.Container

        java.awt.Container.AccessibleAWTContainer
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) java.lang.Thread autoRefreshThread  
      (package private) NceShowCabPanel.DataRow[] cabData  
      (package private) NceShowCabPanel.NceCabTableModel cabModel  
      (package private) javax.swing.JTable cabTable  
      (package private) javax.swing.JCheckBox checkBoxAutoRefresh  
      (package private) javax.swing.JCheckBox checkBoxShowAllCabs  
      (package private) java.lang.Thread nceCabUpdateThread  
      (package private) int recChar  
      (package private) int[] recChars  
      (package private) javax.swing.JButton refreshButton  
      (package private) javax.swing.JLabel textAddress  
      (package private) javax.swing.JLabel textAddrType  
      (package private) javax.swing.JLabel textCab  
      (package private) javax.swing.JLabel textConsist  
      (package private) javax.swing.JLabel textConsistPos  
      (package private) javax.swing.JLabel textDisplay1  
      (package private) javax.swing.JLabel textDisplay2  
      (package private) javax.swing.JLabel textFunctions  
      (package private) javax.swing.JLabel textLastUsed  
      (package private) javax.swing.JLabel textNumber  
      (package private) javax.swing.JLabel textReply  
      (package private) javax.swing.JLabel textSpeed  
      (package private) javax.swing.JLabel textStatus  
      • Fields inherited from class jmri.jmrix.nce.swing.NcePanel

        memo
      • Fields inherited from class javax.swing.JComponent

        listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • Fields inherited from class java.awt.Component

        accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
    • Constructor Summary

      Constructors 
      Constructor Description
      NceShowCabPanel()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addItem​(javax.swing.JPanel p, javax.swing.JComponent c, int x, int y)  
      protected void addItemLeft​(javax.swing.JPanel p, javax.swing.JComponent c, int x, int y)  
      protected void addItemTop​(javax.swing.JPanel p, javax.swing.JComponent c, int x, int y)  
      void buttonActionPerformed​(java.awt.event.ActionEvent ae)  
      void cabPurgeSerial()  
      void cabPurgeUsb()  
      void checkBoxActionPerformed​(java.awt.event.ActionEvent ae)  
      void dispose()  
      java.lang.String getHelpTarget()
      Provide a help target string which an enclosing frame can provide as a help reference.
      java.awt.Dimension getMinimumDimension()
      The minimum frame size for font size 16
      java.lang.String getTitle()
      Provide a recommended title for an enclosing frame.
      void initComponents​(NceSystemConnectionMemo m)
      2nd stage of initialization, invoked after the constuctor is complete.
      void initContext​(java.lang.Object context)
      3rd stage of initialization, invoked after Swing components exist.
      void message​(NceMessage m)  
      void purgeCab​(int cab)  
      void reply​(NceReply r)  
      (package private) void setColumnPurgeButton​(javax.swing.JTable table, int column)  
      • Methods inherited from class javax.swing.JPanel

        getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait