RobotCore 1.0
WPILib port to raspberry Pi
Loading...
Searching...
No Matches
org.wpilib.networktables.Topic Class Reference
Inheritance diagram for org.wpilib.networktables.Topic:
org.wpilib.networktables.BooleanArrayTopic org.wpilib.networktables.BooleanTopic org.wpilib.networktables.DoubleArrayTopic org.wpilib.networktables.DoubleTopic org.wpilib.networktables.FloatArrayTopic org.wpilib.networktables.FloatTopic org.wpilib.networktables.IntegerArrayTopic org.wpilib.networktables.IntegerTopic org.wpilib.networktables.ProtobufTopic< T > org.wpilib.networktables.RawTopic org.wpilib.networktables.StringArrayTopic org.wpilib.networktables.StringTopic org.wpilib.networktables.StructArrayTopic< T > org.wpilib.networktables.StructTopic< T >

Public Member Functions

boolean isValid ()
int getHandle ()
NetworkTableInstance getInstance ()
String getName ()
NetworkTableType getType ()
String getTypeString ()
TopicInfo getInfo ()
void setPersistent (boolean persistent)
boolean isPersistent ()
void setRetained (boolean retained)
boolean isRetained ()
void setCached (boolean cached)
boolean isCached ()
boolean exists ()
String getProperty (String name)
void setProperty (String name, String value)
void deleteProperty (String name)
String getProperties ()
void setProperties (String properties)
GenericSubscriber genericSubscribe (PubSubOption... options)
GenericSubscriber genericSubscribe (String typeString, PubSubOption... options)
GenericPublisher genericPublish (String typeString, PubSubOption... options)
GenericPublisher genericPublishEx (String typeString, String properties, PubSubOption... options)
GenericEntry getGenericEntry (PubSubOption... options)
GenericEntry getGenericEntry (String typeString, PubSubOption... options)
boolean equals (Object other)
int hashCode ()

Protected Attributes

final NetworkTableInstance m_inst
final int m_handle

Detailed Description

NetworkTables Topic.

Definition at line 8 of file Topic.java.

Member Function Documentation

◆ deleteProperty()

void org.wpilib.networktables.Topic.deleteProperty ( String name)

Deletes a property. Has no effect if the property does not exist.

Parameters
nameproperty name

Definition at line 174 of file Topic.java.

◆ equals()

boolean org.wpilib.networktables.Topic.equals ( Object other)

Definition at line 323 of file Topic.java.

◆ exists()

boolean org.wpilib.networktables.Topic.exists ( )

Determines if the topic is currently being published.

Returns
True if the topic exists, false otherwise.

Definition at line 144 of file Topic.java.

◆ genericPublish()

GenericPublisher org.wpilib.networktables.Topic.genericPublish ( String typeString,
PubSubOption... options )

Create a new publisher to the topic.

The publisher is only active as long as the returned object is not closed.

It is not possible to publish two different data types to the same topic. Conflicts between publishers are typically resolved by the server on a first-come, first-served basis. Any published values that do not match the topic's data type are dropped (ignored). To determine if the data type matches, use the appropriate Topic functions.

Parameters
typeStringtype string
optionspublish options
Returns
publisher

Definition at line 245 of file Topic.java.

◆ genericPublishEx()

GenericPublisher org.wpilib.networktables.Topic.genericPublishEx ( String typeString,
String properties,
PubSubOption... options )

Create a new publisher to the topic, with type string and initial properties.

The publisher is only active as long as the returned object is not closed.

It is not possible to publish two different data types to the same topic. Conflicts between publishers are typically resolved by the server on a first-come, first-served basis. Any published values that do not match the topic's data type are dropped (ignored). To determine if the data type matches, use the appropriate Topic functions.

Parameters
typeStringtype string
propertiesJSON properties
optionspublish options
Returns
publisher
Exceptions
IllegalArgumentExceptionif properties is not a JSON object

Definition at line 268 of file Topic.java.

◆ genericSubscribe() [1/2]

GenericSubscriber org.wpilib.networktables.Topic.genericSubscribe ( PubSubOption... options)

Create a new subscriber to the topic.

The subscriber is only active as long as the returned object is not closed.

Parameters
optionssubscribe options
Returns
subscriber

Definition at line 208 of file Topic.java.

◆ genericSubscribe() [2/2]

GenericSubscriber org.wpilib.networktables.Topic.genericSubscribe ( String typeString,
PubSubOption... options )

Create a new subscriber to the topic.

The subscriber is only active as long as the returned object is not closed.

Subscribers that do not match the published data type do not return any values. To determine if the data type matches, use the appropriate Topic functions.

Parameters
typeStringtype string
optionssubscribe options
Returns
subscriber

Definition at line 224 of file Topic.java.

◆ getGenericEntry() [1/2]

GenericEntry org.wpilib.networktables.Topic.getGenericEntry ( PubSubOption... options)

Create a new generic entry for the topic.

Entries act as a combination of a subscriber and a weak publisher. The subscriber is active as long as the entry is not closed. The publisher is created when the entry is first written to, and remains active until either unpublish() is called or the entry is closed.

It is not possible to publish two different data types to the same topic. Conflicts between publishers are typically resolved by the server on a first-come, first-served basis. Any published values that do not match the topic's data type are dropped (ignored). To determine if the data type matches, use the appropriate Topic functions.

Parameters
optionspublish and/or subscribe options
Returns
entry

Definition at line 295 of file Topic.java.

◆ getGenericEntry() [2/2]

GenericEntry org.wpilib.networktables.Topic.getGenericEntry ( String typeString,
PubSubOption... options )

Create a new generic entry for the topic.

Entries act as a combination of a subscriber and a weak publisher. The subscriber is active as long as the entry is not closed. The publisher is created when the entry is first written to, and remains active until either unpublish() is called or the entry is closed.

It is not possible to publish two different data types to the same topic. Conflicts between publishers are typically resolved by the server on a first-come, first-served basis. Any published values that do not match the topic's data type are dropped (ignored). To determine if the data type matches, use the appropriate Topic functions.

Parameters
typeStringtype string
optionspublish and/or subscribe options
Returns
entry

Definition at line 315 of file Topic.java.

◆ getHandle()

int org.wpilib.networktables.Topic.getHandle ( )

Gets the native handle for the topic.

Returns
Native handle

Definition at line 34 of file Topic.java.

◆ getInfo()

TopicInfo org.wpilib.networktables.Topic.getInfo ( )

Gets combined information about the topic.

Returns
Topic information

Definition at line 80 of file Topic.java.

◆ getInstance()

NetworkTableInstance org.wpilib.networktables.Topic.getInstance ( )

Gets the instance for the topic.

Returns
Instance

Definition at line 43 of file Topic.java.

◆ getName()

String org.wpilib.networktables.Topic.getName ( )

Gets the name of the topic.

Returns
the topic's name

Definition at line 52 of file Topic.java.

◆ getProperties()

String org.wpilib.networktables.Topic.getProperties ( )

Gets all topic properties as a JSON object string. Each key in the object is the property name, and the corresponding value is the property value.

Returns
JSON string

Definition at line 184 of file Topic.java.

◆ getProperty()

String org.wpilib.networktables.Topic.getProperty ( String name)

Gets the current value of a property (as a JSON string).

Parameters
nameproperty name
Returns
JSON string; "null" if the property does not exist.

Definition at line 154 of file Topic.java.

◆ getType()

NetworkTableType org.wpilib.networktables.Topic.getType ( )

Gets the type of the topic.

Returns
the topic's type

Definition at line 61 of file Topic.java.

◆ getTypeString()

String org.wpilib.networktables.Topic.getTypeString ( )

Gets the type string of the topic. This may have more information than the numeric type (especially for raw values).

Returns
the topic's type

Definition at line 71 of file Topic.java.

◆ hashCode()

int org.wpilib.networktables.Topic.hashCode ( )

Definition at line 328 of file Topic.java.

◆ isCached()

boolean org.wpilib.networktables.Topic.isCached ( )

Returns whether the topic's last value is stored.

Returns
True if the topic is cached.

Definition at line 135 of file Topic.java.

◆ isPersistent()

boolean org.wpilib.networktables.Topic.isPersistent ( )

Returns whether the value is persistent through server restarts.

Returns
True if the value is persistent.

Definition at line 98 of file Topic.java.

◆ isRetained()

boolean org.wpilib.networktables.Topic.isRetained ( )

Returns whether the topic is retained by server when there are no publishers.

Returns
True if the topic is retained.

Definition at line 116 of file Topic.java.

◆ isValid()

boolean org.wpilib.networktables.Topic.isValid ( )

Determines if the native handle is valid.

Returns
True if the native handle is valid, false otherwise.

Definition at line 25 of file Topic.java.

◆ setCached()

void org.wpilib.networktables.Topic.setCached ( boolean cached)

Allow storage of the topic's last value, allowing the value to be read (and not just accessed through event queues and listeners).

Parameters
cachedTrue for cached, false for not cached.

Definition at line 126 of file Topic.java.

◆ setPersistent()

void org.wpilib.networktables.Topic.setPersistent ( boolean persistent)

Make value persistent through server restarts.

Parameters
persistentTrue for persistent, false for not persistent.

Definition at line 89 of file Topic.java.

◆ setProperties()

void org.wpilib.networktables.Topic.setProperties ( String properties)

Updates multiple topic properties. Each key in the passed-in object is the name of the property to add/update, and the corresponding value is the property value to set for that property. Null values result in deletion of the corresponding property.

Parameters
propertiesJSON object string with keys to add/update/delete
Exceptions
IllegalArgumentExceptionif properties is not a JSON object

Definition at line 196 of file Topic.java.

◆ setProperty()

void org.wpilib.networktables.Topic.setProperty ( String name,
String value )

Sets a property value.

Parameters
nameproperty name
valueproperty value (JSON string)
Exceptions
IllegalArgumentExceptionif properties is not parseable as JSON

Definition at line 165 of file Topic.java.

◆ setRetained()

void org.wpilib.networktables.Topic.setRetained ( boolean retained)

Make the server retain the topic even when there are no publishers.

Parameters
retainedTrue for retained, false for not retained.

Definition at line 107 of file Topic.java.

Member Data Documentation

◆ m_handle

final int org.wpilib.networktables.Topic.m_handle
protected

NetworkTables handle.

Definition at line 336 of file Topic.java.

◆ m_inst

final NetworkTableInstance org.wpilib.networktables.Topic.m_inst
protected

NetworkTables instance.

Definition at line 333 of file Topic.java.


The documentation for this class was generated from the following file: