public class SmartDashboard extends java.lang.Object
SmartDashboard
class is the bridge between robot programs and the SmartDashboard on
the laptop.
When a value is put into the SmartDashboard here, it pops up on the SmartDashboard on the laptop. Users can put values into and get values from the SmartDashboard.
Constructor and Description |
---|
SmartDashboard() |
Modifier and Type | Method and Description |
---|---|
void |
clearFlags(java.lang.String key,
int flags)
Clears flags on the specified key in this table.
|
void |
clearPersistent(java.lang.String key)
Stop making a key's value persistent through program restarts.
|
static boolean |
containsKey(java.lang.String key)
Checks the table and tells if it contains the specified key.
|
void |
delete(java.lang.String key)
Deletes the specified key in this table.
|
static boolean |
getBoolean(java.lang.String key)
Deprecated.
This exception-raising method has been replaced by the
default-taking method
getBoolean(String, boolean) . |
static boolean |
getBoolean(java.lang.String key,
boolean defaultValue)
Returns the boolean the key maps to.
|
boolean[] |
getBooleanArray(java.lang.String key)
Deprecated.
This exception-raising method has been replaced by the
default-taking method
getBooleanArray(String, boolean[]) . |
boolean[] |
getBooleanArray(java.lang.String key,
boolean[] defaultValue)
Returns the boolean array the key maps to.
|
java.lang.Boolean[] |
getBooleanArray(java.lang.String key,
java.lang.Boolean[] defaultValue)
Returns the boolean array the key maps to.
|
static Sendable |
getData(java.lang.String key)
Returns the value at the specified key.
|
static double |
getDouble(java.lang.String key)
Deprecated.
Use
getNumber instead |
static double |
getDouble(java.lang.String key,
double defaultValue)
Deprecated.
Use
getNumber instead. |
int |
getFlags(java.lang.String key)
Returns the flags for the specified key.
|
static int |
getInt(java.lang.String key)
Deprecated.
Use
getNumber instead |
static int |
getInt(java.lang.String key,
int defaultValue)
Deprecated.
Use
getNumber instead |
java.util.Set<java.lang.String> |
getKeys() |
java.util.Set<java.lang.String> |
getKeys(int types) |
static double |
getNumber(java.lang.String key)
Deprecated.
This exception-raising method has been replaced by the
default-taking method
getNumber(String, double) . |
static double |
getNumber(java.lang.String key,
double defaultValue)
Returns the number the key maps to.
|
double[] |
getNumberArray(java.lang.String key)
Deprecated.
This exception-raising method has been replaced by the
default-taking method
getNumberArray(String, double[]) . |
double[] |
getNumberArray(java.lang.String key,
double[] defaultValue)
Returns the number array the key maps to.
|
java.lang.Double[] |
getNumberArray(java.lang.String key,
java.lang.Double[] defaultValue)
Returns the number array the key maps to.
|
byte[] |
getRaw(java.lang.String key)
Deprecated.
This exception-raising method has been replaced by the
default-taking method
getRaw(String, byte[]) . |
byte[] |
getRaw(java.lang.String key,
byte[] defaultValue)
Returns the raw value (byte array) the key maps to.
|
static java.lang.String |
getString(java.lang.String key)
Deprecated.
This exception-raising method has been replaced by the
default-taking method
getString(String, String) . |
static java.lang.String |
getString(java.lang.String key,
java.lang.String defaultValue)
Returns the string the key maps to.
|
java.lang.String[] |
getStringArray(java.lang.String key)
Deprecated.
This exception-raising method has been replaced by the
default-taking method
getStringArray(String, String[]) . |
java.lang.String[] |
getStringArray(java.lang.String key,
java.lang.String[] defaultValue)
Returns the string array the key maps to.
|
boolean |
isPersistent(java.lang.String key)
Returns whether the value is persistent through program restarts.
|
static boolean |
putBoolean(java.lang.String key,
boolean value)
Put a boolean in the table.
|
boolean |
putBooleanArray(java.lang.String key,
boolean[] value)
Put a boolean array in the table.
|
boolean |
putBooleanArray(java.lang.String key,
java.lang.Boolean[] value)
Put a boolean array in the table.
|
static void |
putData(NamedSendable value)
Maps the specified key (where the key is the name of the
NamedSendable
SmartDashboardNamedData to the specified value in this table. |
static void |
putData(java.lang.String key,
Sendable data)
Maps the specified key to the specified value in this table.
|
static void |
putDouble(java.lang.String key,
double value)
Deprecated.
Use
putNumber instead |
static void |
putInt(java.lang.String key,
int value)
Deprecated.
Use
putNumber method instead |
static boolean |
putNumber(java.lang.String key,
double value)
Put a number in the table.
|
boolean |
putNumberArray(java.lang.String key,
double[] value)
Put a number array in the table.
|
boolean |
putNumberArray(java.lang.String key,
java.lang.Double[] value)
Put a number array in the table.
|
boolean |
putRaw(java.lang.String key,
byte[] value)
Put a raw value (byte array) in the table.
|
boolean |
putRaw(java.lang.String key,
java.nio.ByteBuffer value,
int len)
Put a raw value (bytes from a byte buffer) in the table.
|
static boolean |
putString(java.lang.String key,
java.lang.String value)
Put a string in the table.
|
boolean |
putStringArray(java.lang.String key,
java.lang.String[] value)
Put a string array in the table.
|
boolean |
setDefaultBoolean(java.lang.String key,
boolean defaultValue)
Gets the current value in the table, setting it if it does not exist.
|
boolean |
setDefaultBooleanArray(java.lang.String key,
boolean[] defaultValue)
Gets the current value in the table, setting it if it does not exist.
|
boolean |
setDefaultBooleanArray(java.lang.String key,
java.lang.Boolean[] defaultValue)
Gets the current value in the table, setting it if it does not exist.
|
boolean |
setDefaultNumber(java.lang.String key,
double defaultValue)
Gets the current value in the table, setting it if it does not exist.
|
boolean |
setDefaultNumberArray(java.lang.String key,
double[] defaultValue)
Gets the current value in the table, setting it if it does not exist.
|
boolean |
setDefaultNumberArray(java.lang.String key,
java.lang.Double[] defaultValue)
Gets the current value in the table, setting it if it does not exist.
|
boolean |
setDefaultRaw(java.lang.String key,
byte[] defaultValue)
Gets the current value in the table, setting it if it does not exist.
|
boolean |
setDefaultString(java.lang.String key,
java.lang.String defaultValue)
Gets the current value in the table, setting it if it does not exist.
|
boolean |
setDefaultStringArray(java.lang.String key,
java.lang.String[] defaultValue)
Gets the current value in the table, setting it if it does not exist.
|
void |
setFlags(java.lang.String key,
int flags)
Sets flags on the specified key in this table.
|
void |
setPersistent(java.lang.String key)
Makes a key's value persistent through program restarts.
|
public SmartDashboard()
public static void putData(java.lang.String key, Sendable data)
key
- the keydata
- the valuejava.lang.IllegalArgumentException
- If key is nullpublic static void putData(NamedSendable value)
NamedSendable
SmartDashboardNamedData to the specified value in this table. The value can be retrieved by
calling the get method with a key that is equal to the original key.value
- the valuejava.lang.IllegalArgumentException
- If key is nullpublic static Sendable getData(java.lang.String key)
key
- the keyNetworkTableKeyNotDefined
- if there is no value mapped to by the keyjava.lang.IllegalArgumentException
- if the key is nullpublic static boolean containsKey(java.lang.String key)
key
- the key to search forpublic java.util.Set<java.lang.String> getKeys(int types)
types
- bitmask of types; 0 is treated as a "don't care".public java.util.Set<java.lang.String> getKeys()
public void setPersistent(java.lang.String key)
key
- the key namepublic void clearPersistent(java.lang.String key)
key
- the key namepublic boolean isPersistent(java.lang.String key)
key
- the key namepublic void setFlags(java.lang.String key, int flags)
key
- the key nameflags
- the flags to set (bitmask)public void clearFlags(java.lang.String key, int flags)
key
- the key nameflags
- the flags to clear (bitmask)public int getFlags(java.lang.String key)
key
- the key namepublic void delete(java.lang.String key)
key
- the key namepublic static boolean putBoolean(java.lang.String key, boolean value)
key
- the key to be assigned tovalue
- the value that will be assignedpublic boolean setDefaultBoolean(java.lang.String key, boolean defaultValue)
key
- the keydefaultValue
- the default value to set if key doens't exist.@Deprecated public static boolean getBoolean(java.lang.String key) throws TableKeyNotDefinedException
getBoolean(String, boolean)
.key
- the key to look upTableKeyNotDefinedException
- if there is no value associated with
the given keypublic static boolean getBoolean(java.lang.String key, boolean defaultValue)
key
- the key to look updefaultValue
- the value to be returned if no value is foundpublic static boolean putNumber(java.lang.String key, double value)
key
- the key to be assigned tovalue
- the value that will be assignedpublic boolean setDefaultNumber(java.lang.String key, double defaultValue)
key
- the keydefaultValue
- the default value to set if key doens't exist.@Deprecated public static double getNumber(java.lang.String key) throws TableKeyNotDefinedException
getNumber(String, double)
.key
- the key to look upTableKeyNotDefinedException
- if there is no value associated with
the given keypublic static double getNumber(java.lang.String key, double defaultValue)
key
- the key to look updefaultValue
- the value to be returned if no value is foundpublic static boolean putString(java.lang.String key, java.lang.String value)
key
- the key to be assigned tovalue
- the value that will be assignedpublic boolean setDefaultString(java.lang.String key, java.lang.String defaultValue)
key
- the keydefaultValue
- the default value to set if key doens't exist.@Deprecated public static java.lang.String getString(java.lang.String key) throws TableKeyNotDefinedException
getString(String, String)
.key
- the key to look upTableKeyNotDefinedException
- if there is no value associated with
the given keypublic static java.lang.String getString(java.lang.String key, java.lang.String defaultValue)
key
- the key to look updefaultValue
- the value to be returned if no value is foundpublic boolean putBooleanArray(java.lang.String key, boolean[] value)
key
- the key to be assigned tovalue
- the value that will be assignedpublic boolean putBooleanArray(java.lang.String key, java.lang.Boolean[] value)
key
- the key to be assigned tovalue
- the value that will be assignedpublic boolean setDefaultBooleanArray(java.lang.String key, boolean[] defaultValue)
key
- the keydefaultValue
- the default value to set if key doens't exist.public boolean setDefaultBooleanArray(java.lang.String key, java.lang.Boolean[] defaultValue)
key
- the keydefaultValue
- the default value to set if key doens't exist.@Deprecated public boolean[] getBooleanArray(java.lang.String key) throws TableKeyNotDefinedException
getBooleanArray(String, boolean[])
.key
- the key to look upTableKeyNotDefinedException
- if there is no value associated with
the given keypublic boolean[] getBooleanArray(java.lang.String key, boolean[] defaultValue)
key
- the key to look updefaultValue
- the value to be returned if no value is foundpublic java.lang.Boolean[] getBooleanArray(java.lang.String key, java.lang.Boolean[] defaultValue)
key
- the key to look updefaultValue
- the value to be returned if no value is foundpublic boolean putNumberArray(java.lang.String key, double[] value)
key
- the key to be assigned tovalue
- the value that will be assignedpublic boolean putNumberArray(java.lang.String key, java.lang.Double[] value)
key
- the key to be assigned tovalue
- the value that will be assignedpublic boolean setDefaultNumberArray(java.lang.String key, double[] defaultValue)
key
- the keydefaultValue
- the default value to set if key doens't exist.public boolean setDefaultNumberArray(java.lang.String key, java.lang.Double[] defaultValue)
key
- the keydefaultValue
- the default value to set if key doens't exist.@Deprecated public double[] getNumberArray(java.lang.String key) throws TableKeyNotDefinedException
getNumberArray(String, double[])
.key
- the key to look upTableKeyNotDefinedException
- if there is no value associated with
the given keypublic double[] getNumberArray(java.lang.String key, double[] defaultValue)
key
- the key to look updefaultValue
- the value to be returned if no value is foundpublic java.lang.Double[] getNumberArray(java.lang.String key, java.lang.Double[] defaultValue)
key
- the key to look updefaultValue
- the value to be returned if no value is foundpublic boolean putStringArray(java.lang.String key, java.lang.String[] value)
key
- the key to be assigned tovalue
- the value that will be assignedpublic boolean setDefaultStringArray(java.lang.String key, java.lang.String[] defaultValue)
key
- the keydefaultValue
- the default value to set if key doens't exist.@Deprecated public java.lang.String[] getStringArray(java.lang.String key) throws TableKeyNotDefinedException
getStringArray(String, String[])
.key
- the key to look upTableKeyNotDefinedException
- if there is no value associated with
the given keypublic java.lang.String[] getStringArray(java.lang.String key, java.lang.String[] defaultValue)
key
- the key to look updefaultValue
- the value to be returned if no value is foundpublic boolean putRaw(java.lang.String key, byte[] value)
key
- the key to be assigned tovalue
- the value that will be assignedpublic boolean putRaw(java.lang.String key, java.nio.ByteBuffer value, int len)
key
- the key to be assigned tovalue
- the value that will be assignedlen
- the length of the valuepublic boolean setDefaultRaw(java.lang.String key, byte[] defaultValue)
key
- the keydefaultValue
- the default value to set if key doens't exist.@Deprecated public byte[] getRaw(java.lang.String key) throws TableKeyNotDefinedException
getRaw(String, byte[])
.key
- the key to look upTableKeyNotDefinedException
- if there is no value associated with
the given keypublic byte[] getRaw(java.lang.String key, byte[] defaultValue)
key
- the key to look updefaultValue
- the value to be returned if no value is found@Deprecated public static void putInt(java.lang.String key, int value)
putNumber method
insteadThe key can not be null. The value can be retrieved by calling the get method with a key that is equal to the original key.
key
- the keyvalue
- the valuejava.lang.IllegalArgumentException
- if key is null@Deprecated public static int getInt(java.lang.String key) throws TableKeyNotDefinedException
getNumber
insteadkey
- the keyTableKeyNotDefinedException
- if there is no value mapped to by the keyjava.lang.IllegalArgumentException
- if the value mapped to by the key is not an intjava.lang.IllegalArgumentException
- if the key is null@Deprecated public static int getInt(java.lang.String key, int defaultValue) throws TableKeyNotDefinedException
getNumber
insteadkey
- the keydefaultValue
- the value returned if the key is undefinedTableKeyNotDefinedException
- if there is no value mapped to by the keyjava.lang.IllegalArgumentException
- if the value mapped to by the key is not an intjava.lang.IllegalArgumentException
- if the key is null@Deprecated public static void putDouble(java.lang.String key, double value)
putNumber
insteadThe key can not be null. The value can be retrieved by calling the get method with a key that is equal to the original key.
key
- the keyvalue
- the valuejava.lang.IllegalArgumentException
- if key is null@Deprecated public static double getDouble(java.lang.String key) throws TableKeyNotDefinedException
getNumber
insteadkey
- the keyTableKeyNotDefinedException
- if there is no value mapped to by the keyjava.lang.IllegalArgumentException
- if the value mapped to by the key is not a doublejava.lang.IllegalArgumentException
- if the key is null@Deprecated public static double getDouble(java.lang.String key, double defaultValue)
getNumber
instead.key
- the keydefaultValue
- the value returned if the key is undefinedjava.lang.IllegalArgumentException
- if the value mapped to by the key is not a doublejava.lang.IllegalArgumentException
- if the key is null