WPILibC++ 2023.4.3-108-ge5452e3
|
Functions | |
std::vector< NT_Topic > | nt::GetTopics (NT_Inst inst, std::string_view prefix, unsigned int types) |
Get Published Topics. More... | |
std::vector< NT_Topic > | nt::GetTopics (NT_Inst inst, std::string_view prefix, std::span< const std::string_view > types) |
Get Published Topics. More... | |
std::vector< TopicInfo > | nt::GetTopicInfo (NT_Inst inst, std::string_view prefix, unsigned int types) |
Get Topic Information about multiple topics. More... | |
std::vector< TopicInfo > | nt::GetTopicInfo (NT_Inst inst, std::string_view prefix, std::span< const std::string_view > types) |
Get Topic Information about multiple topics. More... | |
TopicInfo | nt::GetTopicInfo (NT_Topic topic) |
Gets Topic Information. More... | |
NT_Topic | nt::GetTopic (NT_Inst inst, std::string_view name) |
Gets Topic Handle. More... | |
std::string | nt::GetTopicName (NT_Topic topic) |
Gets the name of the specified topic. More... | |
NT_Type | nt::GetTopicType (NT_Topic topic) |
Gets the type for the specified topic, or unassigned if non existent. More... | |
std::string | nt::GetTopicTypeString (NT_Topic topic) |
Gets the type string for the specified topic, or empty string if non existent. More... | |
void | nt::SetTopicPersistent (NT_Topic topic, bool value) |
Sets the persistent property of a topic. More... | |
bool | nt::GetTopicPersistent (NT_Topic topic) |
Gets the persistent property of a topic. More... | |
void | nt::SetTopicRetained (NT_Topic topic, bool value) |
Sets the retained property of a topic. More... | |
bool | nt::GetTopicRetained (NT_Topic topic) |
Gets the retained property of a topic. More... | |
bool | nt::GetTopicExists (NT_Handle handle) |
Determine if topic exists (e.g. More... | |
wpi::json | nt::GetTopicProperty (NT_Topic topic, std::string_view name) |
Gets the current value of a property (as a JSON object). More... | |
void | nt::SetTopicProperty (NT_Topic topic, std::string_view name, const wpi::json &value) |
Sets a property value. More... | |
void | nt::DeleteTopicProperty (NT_Topic topic, std::string_view name) |
Deletes a property. More... | |
wpi::json | nt::GetTopicProperties (NT_Topic topic) |
Gets all topic properties as a JSON object. More... | |
bool | nt::SetTopicProperties (NT_Topic topic, const wpi::json &update) |
Updates multiple topic properties. More... | |
NT_Subscriber | nt::Subscribe (NT_Topic topic, NT_Type type, std::string_view typeStr, const PubSubOptions &options=kDefaultPubSubOptions) |
Creates a new subscriber to value changes on a topic. More... | |
void | nt::Unsubscribe (NT_Subscriber sub) |
Stops subscriber. More... | |
NT_Publisher | nt::Publish (NT_Topic topic, NT_Type type, std::string_view typeStr, const PubSubOptions &options=kDefaultPubSubOptions) |
Creates a new publisher to a topic. More... | |
NT_Publisher | nt::PublishEx (NT_Topic topic, NT_Type type, std::string_view typeStr, const wpi::json &properties, const PubSubOptions &options=kDefaultPubSubOptions) |
Creates a new publisher to a topic. More... | |
void | nt::Unpublish (NT_Handle pubentry) |
Stops publisher. More... | |
NT_Entry | nt::GetEntry (NT_Topic topic, NT_Type type, std::string_view typeStr, const PubSubOptions &options=kDefaultPubSubOptions) |
Creates a new entry (subscriber and weak publisher) to a topic. More... | |
void | nt::ReleaseEntry (NT_Entry entry) |
Stops entry subscriber/publisher. More... | |
void | nt::Release (NT_Handle pubsubentry) |
Stops entry/subscriber/publisher. More... | |
NT_Topic | nt::GetTopicFromHandle (NT_Handle pubsubentry) |
Gets the topic handle from an entry/subscriber/publisher handle. More... | |
void nt::DeleteTopicProperty | ( | NT_Topic | topic, |
std::string_view | name | ||
) |
Deletes a property.
Has no effect if the property does not exist.
topic | topic handle |
name | property name |
NT_Entry nt::GetEntry | ( | NT_Topic | topic, |
NT_Type | type, | ||
std::string_view | typeStr, | ||
const PubSubOptions & | options = kDefaultPubSubOptions |
||
) |
Creates a new entry (subscriber and weak publisher) to a topic.
topic | topic handle |
type | type |
typeStr | type string |
options | publish options |
NT_Topic nt::GetTopic | ( | NT_Inst | inst, |
std::string_view | name | ||
) |
bool nt::GetTopicExists | ( | NT_Handle | handle | ) |
Determine if topic exists (e.g.
has at least one publisher).
handle | Topic, entry, or subscriber handle. |
Gets the topic handle from an entry/subscriber/publisher handle.
pubsubentry | entry/subscriber/publisher handle |
std::vector< TopicInfo > nt::GetTopicInfo | ( | NT_Inst | inst, |
std::string_view | prefix, | ||
std::span< const std::string_view > | types | ||
) |
Get Topic Information about multiple topics.
Returns an array of topic information (handle, name, type, and properties). The results are optionally filtered by string prefix and type to only return a subset of all topics.
inst | instance handle |
prefix | name required prefix; only topics whose name starts with this string are returned |
types | array of type strings |
std::vector< TopicInfo > nt::GetTopicInfo | ( | NT_Inst | inst, |
std::string_view | prefix, | ||
unsigned int | types | ||
) |
Get Topic Information about multiple topics.
Returns an array of topic information (handle, name, type, and properties). The results are optionally filtered by string prefix and type to only return a subset of all topics.
inst | instance handle |
prefix | name required prefix; only topics whose name starts with this string are returned |
types | bitmask of NT_Type values; 0 is treated specially as a "don't care" |
std::string nt::GetTopicName | ( | NT_Topic | topic | ) |
Gets the name of the specified topic.
Returns an empty string if the handle is invalid.
topic | topic handle |
bool nt::GetTopicPersistent | ( | NT_Topic | topic | ) |
Gets the persistent property of a topic.
If true, the server retains the topic even when there are no publishers.
topic | topic handle |
Gets all topic properties as a JSON object.
Each key in the object is the property name, and the corresponding value is the property value.
topic | topic handle |
wpi::json nt::GetTopicProperty | ( | NT_Topic | topic, |
std::string_view | name | ||
) |
Gets the current value of a property (as a JSON object).
topic | topic handle |
name | property name |
bool nt::GetTopicRetained | ( | NT_Topic | topic | ) |
Gets the retained property of a topic.
topic | topic handle |
std::vector< NT_Topic > nt::GetTopics | ( | NT_Inst | inst, |
std::string_view | prefix, | ||
std::span< const std::string_view > | types | ||
) |
Get Published Topics.
Returns an array of topic handles. The results are optionally filtered by string prefix and type to only return a subset of all topics.
inst | instance handle |
prefix | name required prefix; only topics whose name starts with this string are returned |
types | array of type strings |
std::vector< NT_Topic > nt::GetTopics | ( | NT_Inst | inst, |
std::string_view | prefix, | ||
unsigned int | types | ||
) |
Get Published Topics.
Returns an array of topic handles. The results are optionally filtered by string prefix and type to only return a subset of all topics.
inst | instance handle |
prefix | name required prefix; only topics whose name starts with this string are returned |
types | bitmask of NT_Type values; 0 is treated specially as a "don't care" |
Gets the type for the specified topic, or unassigned if non existent.
topic | topic handle |
std::string nt::GetTopicTypeString | ( | NT_Topic | topic | ) |
Gets the type string for the specified topic, or empty string if non existent.
This may have more information than the numeric type (especially for raw values).
topic | topic handle |
NT_Publisher nt::Publish | ( | NT_Topic | topic, |
NT_Type | type, | ||
std::string_view | typeStr, | ||
const PubSubOptions & | options = kDefaultPubSubOptions |
||
) |
Creates a new publisher to a topic.
topic | topic handle |
type | type |
typeStr | type string |
options | publish options |
NT_Publisher nt::PublishEx | ( | NT_Topic | topic, |
NT_Type | type, | ||
std::string_view | typeStr, | ||
const wpi::json & | properties, | ||
const PubSubOptions & | options = kDefaultPubSubOptions |
||
) |
Creates a new publisher to a topic.
topic | topic handle |
type | type |
typeStr | type string |
properties | initial properties |
options | publish options |
void nt::Release | ( | NT_Handle | pubsubentry | ) |
Stops entry/subscriber/publisher.
pubsubentry | entry/subscriber/publisher handle |
void nt::ReleaseEntry | ( | NT_Entry | entry | ) |
Stops entry subscriber/publisher.
entry | entry handle |
void nt::SetTopicPersistent | ( | NT_Topic | topic, |
bool | value | ||
) |
Sets the persistent property of a topic.
If true, the stored value is persistent through server restarts.
topic | topic handle |
value | True for persistent, false for not persistent. |
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.
topic | topic handle |
update | JSON object with keys to add/update/delete |
void nt::SetTopicProperty | ( | NT_Topic | topic, |
std::string_view | name, | ||
const wpi::json & | value | ||
) |
Sets a property value.
topic | topic handle |
name | property name |
value | property value |
void nt::SetTopicRetained | ( | NT_Topic | topic, |
bool | value | ||
) |
Sets the retained property of a topic.
topic | topic handle |
value | new retained property value |
NT_Subscriber nt::Subscribe | ( | NT_Topic | topic, |
NT_Type | type, | ||
std::string_view | typeStr, | ||
const PubSubOptions & | options = kDefaultPubSubOptions |
||
) |
Creates a new subscriber to value changes on a topic.
topic | topic handle |
type | expected type |
typeStr | expected type string |
options | subscription options |
void nt::Unpublish | ( | NT_Handle | pubentry | ) |
Stops publisher.
pubentry | publisher/entry handle |
void nt::Unsubscribe | ( | NT_Subscriber | sub | ) |
Stops subscriber.
sub | subscriber handle |