jmri.jmrix.nce.cab
Class NceShowCabPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by jmri.util.swing.JmriPanel
                      extended by jmri.jmrix.nce.swing.NcePanel
                          extended by jmri.jmrix.nce.cab.NceShowCabPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, 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. 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

Author:
Dan Boudreau Copyright (C) 2009, 2010, Ken Cameron Copyright (C) 2010
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class jmri.jmrix.nce.swing.NcePanel
memo
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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
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
NceShowCabPanel()
           
 
Method Summary
protected  void addItem(JPanel p, JComponent c, int x, int y)
           
protected  void addItemLeft(JPanel p, JComponent c, int x, int y)
           
 void buttonActionPerformed(ActionEvent ae)
           
 String getHelpTarget()
          Provide a help target string which an enclosing frame can provide as a help reference.
 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(Object context)
          3rd stage of initialization, invoked after Swing components exist.
 void message(NceMessage m)
           
 void reply(NceReply r)
           
 
Methods inherited from class jmri.util.swing.JmriPanel
dispose, getMenus, getWindowInterface, initComponents, isMultipleInstances, setWindowInterface
 
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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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, transferFocusBackward, 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NceShowCabPanel

public NceShowCabPanel()
Method Detail

initContext

public void initContext(Object context)
                 throws Exception
Description copied from class: JmriPanel
3rd stage of initialization, invoked after Swing components exist.

Overrides:
initContext in class NcePanel
Throws:
Exception

getHelpTarget

public String getHelpTarget()
Description copied from class: JmriPanel
Provide a help target string which an enclosing frame can provide as a help reference.

Overrides:
getHelpTarget in class JmriPanel

getTitle

public String getTitle()
Description copied from class: JmriPanel
Provide a recommended title for an enclosing frame.

Overrides:
getTitle in class JmriPanel

initComponents

public void initComponents(NceSystemConnectionMemo m)
                    throws Exception
Description copied from interface: NcePanelInterface
2nd stage of initialization, invoked after the constuctor is complete.

This needs to be connected to the initContext() method in implementing classes.

Specified by:
initComponents in interface NcePanelInterface
Overrides:
initComponents in class NcePanel
Throws:
Exception

buttonActionPerformed

public void buttonActionPerformed(ActionEvent ae)

message

public void message(NceMessage m)
Specified by:
message in interface NceListener

reply

public void reply(NceReply r)
Specified by:
reply in interface NceListener

addItem

protected void addItem(JPanel p,
                       JComponent c,
                       int x,
                       int y)

addItemLeft

protected void addItemLeft(JPanel p,
                           JComponent c,
                           int x,
                           int y)


Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads