Class AbstractAlmImplementation

java.lang.Object
jmri.jmrix.loconet.AbstractAlmImplementation
All Implemented Interfaces:
EventListener, LocoNetListener

@Deprecated
public abstract class AbstractAlmImplementation
extends Object
implements LocoNetListener
Deprecated.
as of JMRI 2.13.5 - keep for a bit until DCS240 situation is resolved (note added June 2016)
Provide an ALM that lives on the LocoNet.

ALMs work in terms of numbered (indexed) Args, each 14 bits long. These are typically in the SW1, SW2 format, but don't have to be.

This ALM can operate in one of two modes:

  • "image" - This ALM shadows one that really exists somewhere else. This implementation keeps values that are being written, but doesn't reply to read or write commands on the LocoNet.
  • "not image" - This is the only existing implementation of this particular ALM, so it replies to read and write commands.
LocoNet ALM messages showing a argument value N will show in the throttle editor as N+1. Here, we refer to these as "arguments" and "throttle values". Similarly, device addresses are "addresses" in the ALM, based on zero, and "entries" in the throttle, based on 1.

Some of the message formats used in this class are Copyright Digitrax, Inc. and used with permission as part of the JMRI project. That permission does not extend to uses in other software products. If you wish to use this code, algorithm or these message formats outside of JMRI, please contact Digitrax Inc for separate permission.

  • Field Summary

    Fields 
    Modifier and Type Field Description
    (package private) LocoNetSystemConnectionMemo adapterMemo
    Deprecated.
     
    (package private) boolean handleNextLACK
    Deprecated.
     
    (package private) int INTERROGATE
    Deprecated.
     
    (package private) int lastWriteBlock
    Deprecated.
     
    protected boolean mImage
    Deprecated.
    Does this ALM reply on the LocoNet, or just form an image of an implementation elsewhere?
    protected int mNumber
    Deprecated.
    What ALM number does this object respond to?
    (package private) int READ
    Deprecated.
     
    (package private) boolean waitWriteMessage
    Deprecated.
     
    (package private) int WRITE
    Deprecated.
     
  • Constructor Summary

    Constructors 
    Constructor Description
    AbstractAlmImplementation​(int pNumber, boolean pImage)
    Deprecated.
     
  • Method Summary

    Modifier and Type Method Description
    (package private) abstract void initData()
    Deprecated.
    Abstract method to initialize the local storage
    (package private) void lackMsg​(LocoNetMessage msg)
    Deprecated.
    Handle LACK message.
    void message​(LocoNetMessage msg)
    Deprecated.
    Interpret LocoNet traffic.
    void noteChanged​(int block)
    Deprecated.
    Notify possible subclass that a block has changed.
    void noteReadCmd​(int block)
    Deprecated.
    Notify possible subclass that a read cmd is being handled
    void noteReadReply​(int block)
    Deprecated.
    Notify possible subclass that a read reply is being handled
    void noteWriteComplete​(int block)
    Deprecated.
    Notify possible subclass that a write operation is complete
    (package private) void readMsg​(LocoNetMessage msg)
    Deprecated.
    Handle ALM_RD_ACCESS message.
    (package private) abstract int retrieve​(int block, int item)
    Deprecated.
    Abstract method invoked to retrieve a value.
    (package private) void sendRead​(int block)
    Deprecated.
    Create and send the LocoNet message to read a particular block.
    (package private) void sendWrite​(int block)
    Deprecated.
    Create and send the LocoNet message to read a particular block.
    (package private) abstract void store​(int block, int item, int value)
    Deprecated.
    Abstract method invoked to save a new value.
    (package private) void writeMsg​(LocoNetMessage msg)
    Deprecated.
    Handle ALM_WR_ACCESS message.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • message

      public void message​(LocoNetMessage msg)
      Deprecated.
      Interpret LocoNet traffic.
      Specified by:
      message in interface LocoNetListener
      Parameters:
      msg - Input message
    • lackMsg

      void lackMsg​(LocoNetMessage msg)
      Deprecated.
      Handle LACK message.

      If we're waiting for this, it indicates successful end of a write ALM sequence.

      Parameters:
      msg - Message, which might or might not be LACK
    • writeMsg

      void writeMsg​(LocoNetMessage msg)
      Deprecated.
      Handle ALM_WR_ACCESS message.

      If we're an image, just record information from a WRITE.

      If we're not an image, reply to all commands

      Parameters:
      msg - Message to decode and fill out
    • noteChanged

      public void noteChanged​(int block)
      Deprecated.
      Notify possible subclass that a block has changed.
      Parameters:
      block - something about a block
    • noteReadCmd

      public void noteReadCmd​(int block)
      Deprecated.
      Notify possible subclass that a read cmd is being handled
      Parameters:
      block - something about a block
    • noteReadReply

      public void noteReadReply​(int block)
      Deprecated.
      Notify possible subclass that a read reply is being handled
      Parameters:
      block - something about a block
    • noteWriteComplete

      public void noteWriteComplete​(int block)
      Deprecated.
      Notify possible subclass that a write operation is complete
      Parameters:
      block - something about a block
    • readMsg

      void readMsg​(LocoNetMessage msg)
      Deprecated.
      Handle ALM_RD_ACCESS message.

      If we're an image, this came from the real implementation and reflects the correct values; capture them.

      If we're not an image, we just sent this, so we'll ignore it.

      Parameters:
      msg - a LocoNet message
    • sendRead

      void sendRead​(int block)
      Deprecated.
      Create and send the LocoNet message to read a particular block.

      The results will return later.

      Parameters:
      block - Which block to read?
    • sendWrite

      void sendWrite​(int block)
      Deprecated.
      Create and send the LocoNet message to read a particular block.

      The waitWriteMessage and handleNextLACK boolean variables are used to control processong of the LACK message that will come from this.

      For a single write, that's not needed, but if you want to know when it is complete you need to:

      1. Recognize when your write command has come back from the LocoNet
      2. Wait for the next LACK
      Hopefully this ALM writer is unique, so there won't be two writes to the same ALM going on at the same time; the LocoNet is not well synchronized against that.
      Parameters:
      block - within the ALM space
    • store

      abstract void store​(int block, int item, int value)
      Deprecated.
      Abstract method invoked to save a new value.

      block*4+item is the ALM address

      Parameters:
      block - The block number, starting with 0
      item - Item number within the block, as 0,1,2,3
      value - The integer argument value to store
    • retrieve

      abstract int retrieve​(int block, int item)
      Deprecated.
      Abstract method invoked to retrieve a value.

      block*4+item is the ALM address

      Parameters:
      block - The block number, starting with 0
      item - Item number within the block, as 0,1,2,3
      Returns:
      The integer argument value
    • initData

      abstract void initData()
      Deprecated.
      Abstract method to initialize the local storage