All Packages  This Package  Class Hierarchy  Class Search  Index

Class bmsi.sna.JBMStatus
java.lang.Object
   |
   +----bmsi.sna.JBMStatus

  Summary

public class  JBMStatus
     extends java.lang.Object
     implements java.lang.Runnable
{
          // Constructors 1
     public JBMStatus(String, String, String) throws IOException;

          // Methods 18
     public static void main(String[]);
     public static String stateMsg(byte, byte);

     public synchronized void addStateListener(JBMStatus.StateListener);
     public synchronized void close() throws IOException;
     public String dump(int, int) throws IOException;
     public String getAppVersion() throws IOException;
     public int getLUStat(int);
     public int getTotRecv();
     public int getTotSent();
     public int getXID() throws IOException;
     public void poll() throws IOException;
     public int read(int, byte[]) throws IOException;
     public synchronized void removeStateListener(JBMStatus.StateListener);
     public synchronized void reset() throws IOException;
     public void run();
     public synchronized String sendcmd(String) throws IOException;
     public void setPollInterval(long);
     public synchronized void waitSent(int) throws InterruptedException;

          // Inner Classes 1
     public static interface JBMStatus.StateListener
}

Manage a control connection to a JBM Gateway 50 to monitor status and run commands.

Author:
Stuart D. Gathman Copyright (C) 1999 Business Management Systems, Inc.




  Constructors

· JBMStatus

Summary  |  Top

   public JBMStatus(String host, 
                    String user, 
                    String pwd)  throws IOException

Create a telnet connection to a Gateway 50.

Parameter Description
host the hostname or IP address of the Gateway
user the telnet user name for the Gateway
pwd the telnet password for the Gateway



  Methods

· getLUStat

Summary  |  Top
   public int getLUStat(int lu) 

Return the status an of LU. The state returned is one of:

  0	PU Inactive
  1	PU Active
  3	LU Active
  5	BIND accepted
  7	Session Active
  

Parameter Description
lu the LU index from 1 to 256

Returns:
the current state


· getTotSent

Summary  |  Top
   public int getTotSent() 

Return the total packets sent by the Gateway since reset.



· waitSent

Summary  |  Top
   public synchronized void waitSent(int start)  throws InterruptedException

Wait until total sent is greater than start and stops changing. This was used by Gateway50 to pace data sent to avoid a buffer control bug in firmare versions prior to 117. However, a better way is to use the REQ_CONFIRMATION bit in JBMLU.

Parameter Description
start starting point for detecting changes in total sent



· getTotRecv

Summary  |  Top
   public int getTotRecv() 

Return the total packets received by the Gateway since reset.



· addStateListener

Summary  |  Top
   public synchronized void addStateListener(JBMStatus.StateListener listener) 


· removeStateListener

Summary  |  Top
   public synchronized void removeStateListener(JBMStatus.StateListener l) 


· stateMsg

Summary  |  Top
   public static String stateMsg(byte old, 
                                 byte stat) 

Return a message describing a change in LU state. The messages match those used by Apertus SNA 1.0 and the BMS interface to the Black Box AS/4. This lets our existing scripts work without change.



· sendcmd

Summary  |  Top
   public synchronized String sendcmd(String s)  throws IOException

Issue a Gateway 50 telnet command.

Parameter Description
s the command to send

Returns:
the output from the command


· getAppVersion

Summary  |  Top
   public String getAppVersion()  throws IOException

Return the currently loaded firmware version in the Gateway.



· poll

Summary  |  Top
   public void poll()  throws IOException

Update LU status.



· reset

Summary  |  Top
   public synchronized void reset()  throws IOException

Reset the Gateway and reconnect.



· close

Summary  |  Top
   public synchronized void close()  throws IOException

Close this Gateway 50 control connection.



· setPollInterval

Summary  |  Top
   public void setPollInterval(long v) 

Set the number of milliseconds between polls for status.

Parameter Description
v the number of milliseconds between polls, default is 4000



· run

Summary  |  Top
   public void run() 

Poll for status every 5 seconds until interrupted.

Implements:
run in interface Runnable


· dump

Summary  |  Top
   public String dump(int addr, 
                      int len)  throws IOException

Return a formatted dump of memory on the Gateway unit.

Parameter Description
addr Starting address
len the number of bytes to dump

Returns:
the formatted dump


· read

Summary  |  Top
   public int read(int addr, 
                   byte[] buf)  throws IOException

Copy memory from the Gateway unit to a buffer. BUGS: this currently works only for a buffer size of 16 or less.

Parameter Description
addr Starting address
buf The buffer to copy memory to

Returns:
The actual number of bytes copies.


· getXID

Summary  |  Top
   public int getXID()  throws IOException

Return the XID currently programmed into this Gateway. FIXME: the memory offset for firmware ver 118 is hardwired. Further research is needed to handle other firmware versions.

Returns:
the currently programmed XID
Throws: IOException
if the XID is not at the expected offset or the Gateway is not communicating


· main

Summary  |  Top
   public static void main(String[] argv) 

Display the firmware version and XID for Gateway units listed on the command line. Login and password are specified using FTP syntax as per the Gateway50 constructor.



All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7