"

2013 FRC Java API

"

edu.wpi.first.wpilibj.networktables2.server
Class ServerConnectionAdapter

java.lang.Object
  extended by edu.wpi.first.wpilibj.networktables2.server.ServerConnectionAdapter
All Implemented Interfaces:
ConnectionAdapter, FlushableOutgoingEntryReceiver, IncomingEntryReceiver, OutgoingEntryReceiver

public class ServerConnectionAdapter
extends Object
implements ConnectionAdapter, IncomingEntryReceiver, FlushableOutgoingEntryReceiver

Object that adapts messages from a client to the server

Author:
Mitchell

Field Summary
 NetworkTableConnection connection
          the connection this adapter uses
 
Fields inherited from interface edu.wpi.first.wpilibj.networktables2.IncomingEntryReceiver
NULL
 
Constructor Summary
ServerConnectionAdapter(IOStream stream, ServerNetworkTableEntryStore entryStore, IncomingEntryReceiver transactionReceiver, ServerAdapterManager adapterListener, NetworkTableEntryTypeManager typeManager, NTThreadManager threadManager)
          Create a server connection adapter for a given stream
 
Method Summary
 void badMessage(BadMessageException e)
          called if a bad message exception is thrown
 void clientHello(char protocolRevision)
          Called when the connection receives a client hello message
 void ensureAlive()
           
 void flush()
           
 ServerConnectionState getConnectionState()
           
 NetworkTableEntry getEntry(char id)
          get an entry (used by a connection when filling an update entry
 void ioException(IOException e)
          called if an io exception is thrown
 void keepAlive()
          Called when the connection receives a keep alive message
 void offerIncomingAssignment(NetworkTableEntry entry)
           
 void offerIncomingUpdate(NetworkTableEntry entry, char sequenceNumber, Object value)
           
 void offerOutgoingAssignment(NetworkTableEntry entry)
           
 void offerOutgoingUpdate(NetworkTableEntry entry)
           
 void protocolVersionUnsupported(char protocolRevision)
          Called when the connection receives a protocol unsupported message
 void serverHelloComplete()
           
 void shutdown(boolean closeStream)
          stop the read thread and close the stream
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connection

public final NetworkTableConnection connection
the connection this adapter uses

Constructor Detail

ServerConnectionAdapter

public ServerConnectionAdapter(IOStream stream,
                               ServerNetworkTableEntryStore entryStore,
                               IncomingEntryReceiver transactionReceiver,
                               ServerAdapterManager adapterListener,
                               NetworkTableEntryTypeManager typeManager,
                               NTThreadManager threadManager)
Create a server connection adapter for a given stream

Parameters:
stream -
transactionPool -
entryStore -
transactionReceiver -
adapterListener -
threadManager -
Method Detail

badMessage

public void badMessage(BadMessageException e)
Description copied from interface: ConnectionAdapter
called if a bad message exception is thrown

Specified by:
badMessage in interface ConnectionAdapter

ioException

public void ioException(IOException e)
Description copied from interface: ConnectionAdapter
called if an io exception is thrown

Specified by:
ioException in interface ConnectionAdapter

shutdown

public void shutdown(boolean closeStream)
stop the read thread and close the stream


keepAlive

public void keepAlive()
               throws IOException
Description copied from interface: ConnectionAdapter
Called when the connection receives a keep alive message

Specified by:
keepAlive in interface ConnectionAdapter
Throws:
IOException

clientHello

public void clientHello(char protocolRevision)
                 throws IOException
Description copied from interface: ConnectionAdapter
Called when the connection receives a client hello message

Specified by:
clientHello in interface ConnectionAdapter
Throws:
IOException

protocolVersionUnsupported

public void protocolVersionUnsupported(char protocolRevision)
                                throws IOException
Description copied from interface: ConnectionAdapter
Called when the connection receives a protocol unsupported message

Specified by:
protocolVersionUnsupported in interface ConnectionAdapter
Parameters:
protocolRevision - the protocol version the server reported it supports
Throws:
IOException

serverHelloComplete

public void serverHelloComplete()
                         throws IOException
Specified by:
serverHelloComplete in interface ConnectionAdapter
Throws:
IOException

offerIncomingAssignment

public void offerIncomingAssignment(NetworkTableEntry entry)
Specified by:
offerIncomingAssignment in interface IncomingEntryReceiver

offerIncomingUpdate

public void offerIncomingUpdate(NetworkTableEntry entry,
                                char sequenceNumber,
                                Object value)
Specified by:
offerIncomingUpdate in interface IncomingEntryReceiver

getEntry

public NetworkTableEntry getEntry(char id)
Description copied from interface: ConnectionAdapter
get an entry (used by a connection when filling an update entry

Specified by:
getEntry in interface ConnectionAdapter
Returns:
the entry or null if the entry does not exist

offerOutgoingAssignment

public void offerOutgoingAssignment(NetworkTableEntry entry)
Specified by:
offerOutgoingAssignment in interface OutgoingEntryReceiver

offerOutgoingUpdate

public void offerOutgoingUpdate(NetworkTableEntry entry)
Specified by:
offerOutgoingUpdate in interface OutgoingEntryReceiver

flush

public void flush()
Specified by:
flush in interface FlushableOutgoingEntryReceiver

getConnectionState

public ServerConnectionState getConnectionState()
Returns:
the state of the connection

ensureAlive

public void ensureAlive()
Specified by:
ensureAlive in interface FlushableOutgoingEntryReceiver

"

2013 FRC Java API

"

"
For updated information see the Java FRC site
"