Class NceMacroBackup

  • All Implemented Interfaces:
    java.lang.Runnable, java.util.EventListener, AbstractMRListener, NceListener

    public class NceMacroBackup
    extends java.lang.Thread
    implements NceListener
    Backups NCE Macros to a text file format defined by NCE.

    NCE "Backup macros" dumps the macros into a text file. Each line contains the contents of one macro. The first macro, 0 starts at address xC800 (PH5 0x6000). The last macro 255 is at address xDBEC.

    NCE file format:

    :C800 (macro 0: 20 hex chars representing 10 accessories) :C814 (macro 1: 20 hex chars representing 10 accessories) :C828 (macro 2: 20 hex chars representing 10 accessories) . . :DBEC (macro 255: 20 hex chars representing 10 accessories) :0000

    Macro data byte:

    bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 _ _ _ _ 1 0 A A A A A A 1 A A A C D D D addr bit 7 6 5 4 3 2 10 9 8 1 0 turnout T

    By convention, MSB address bits 10 - 8 are one's complement. NCE macros always set the C bit to 1. The LSB "D" (0) determines if the accessory is to be thrown (0) or closed (1). The next two bits "D D" are the LSBs of the accessory address. Note that NCE display addresses are 1 greater than NMRA DCC. Note that address bit 2 isn't supposed to be inverted, but it is the way NCE implemented their macros.

    Examples:

    81F8 = accessory 1 thrown 9FFC = accessory 123 thrown B5FD = accessory 211 close BF8F = accessory 2044 close

    FF10 = link macro 16

    This backup routine uses the same macro data format as NCE.

    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) javax.swing.JLabel macroNumber  
      (package private) javax.swing.JLabel textMacro  
      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void message​(NceMessage m)  
      void reply​(NceReply r)  
      void run()  
      • Methods inherited from class java.lang.Thread

        activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
      • Methods inherited from class java.lang.Object

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