public class NTServer extends java.lang.Object implements NTThread.NTRunnable, NTEntryStore.TableListenerManager
| Modifier and Type | Field and Description |
|---|---|
private NTConnectionList |
m_connectionList |
private NTEntryStore |
m_entryStore |
private NTThread |
m_monitorThread |
private java.net.ServerSocket |
m_server |
private java.util.List<ITableListener> |
m_tableListeners |
private NTEntryTypeManager |
m_typeManager |
private NTWriteManager |
m_writeManager |
| Constructor and Description |
|---|
NTServer()
Create a NetworkTable Server
|
| Modifier and Type | Method and Description |
|---|---|
NTSocketStream |
acceptConnection() |
void |
addTableListener(ITableListener listener,
boolean immediateNotify) |
void |
close()
close all networking activity related to this node
|
boolean |
containsKey(java.lang.String key) |
void |
fireTableListeners(java.lang.String key,
java.lang.Object value,
boolean isNew)
Called when the object should fire it's listeners
|
boolean |
getBoolean(java.lang.String name) |
double |
getDouble(java.lang.String name) |
NTEntryStore |
getEntryStore() |
java.lang.String |
getString(java.lang.String name) |
java.lang.Object |
getValue(java.lang.String name) |
boolean |
isConnected() |
boolean |
isServer() |
void |
onNewConnection(NTConnectionAdapter connectionAdapter)
Called on create of a new connection
|
void |
putBoolean(java.lang.String name,
boolean value) |
void |
putComplex(java.lang.String name,
ComplexData value) |
void |
putDouble(java.lang.String name,
double value) |
void |
putString(java.lang.String name,
java.lang.String value) |
void |
putValue(NTTableEntry entry,
java.lang.Object value) |
void |
putValue(java.lang.String name,
NTEntryType type,
java.lang.Object value)
Put a value with a specific network table type
|
void |
putValue(java.lang.String name,
java.lang.Object value) |
void |
removeTableListener(ITableListener listener) |
void |
retrieveValue(java.lang.String name,
java.lang.Object externalData) |
void |
run()
the method that will be called periodically on a thread
|
void |
start()
Start the monitor thread
|
void |
stop()
Stop the monitor thread
|
private final NTWriteManager m_writeManager
private final NTConnectionList m_connectionList
private final NTEntryStore m_entryStore
private final NTEntryTypeManager m_typeManager
private final java.net.ServerSocket m_server
private final java.util.List<ITableListener> m_tableListeners
private NTThread m_monitorThread
public NTServer()
throws java.io.IOException
java.io.IOExceptionpublic NTSocketStream acceptConnection() throws java.io.IOException
java.io.IOExceptionpublic void close()
public void start()
public void stop()
public void run()
NTThread.NTRunnablerun in interface NTThread.NTRunnablepublic void onNewConnection(NTConnectionAdapter connectionAdapter)
connectionAdapter - the server connection adapterpublic boolean isConnected()
public boolean isServer()
public NTEntryStore getEntryStore()
public void putBoolean(java.lang.String name,
boolean value)
public boolean getBoolean(java.lang.String name)
throws java.util.NoSuchElementException
java.util.NoSuchElementExceptionpublic void putDouble(java.lang.String name,
double value)
public double getDouble(java.lang.String name)
throws java.util.NoSuchElementException
java.util.NoSuchElementExceptionpublic void putString(java.lang.String name,
java.lang.String value)
public java.lang.String getString(java.lang.String name)
throws java.util.NoSuchElementException
java.util.NoSuchElementExceptionpublic void putComplex(java.lang.String name,
ComplexData value)
public void retrieveValue(java.lang.String name,
java.lang.Object externalData)
throws java.util.NoSuchElementException
java.util.NoSuchElementExceptionpublic void putValue(java.lang.String name,
java.lang.Object value)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic void putValue(java.lang.String name,
NTEntryType type,
java.lang.Object value)
name - the name of the entry to associate with the given valuetype - the type of the entryvalue - the actual value of the entrypublic void putValue(NTTableEntry entry, java.lang.Object value)
public java.lang.Object getValue(java.lang.String name)
throws java.util.NoSuchElementException
java.util.NoSuchElementExceptionpublic boolean containsKey(java.lang.String key)
key - the key to check for existencepublic void addTableListener(ITableListener listener, boolean immediateNotify)
public void removeTableListener(ITableListener listener)
public void fireTableListeners(java.lang.String key,
java.lang.Object value,
boolean isNew)
NTEntryStore.TableListenerManagerfireTableListeners in interface NTEntryStore.TableListenerManager