mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpilib] Add metadata to all dashboard ".type" entries (#6799)
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include <wpi/DataLog.h>
|
||||
#include <wpi/EventVector.h>
|
||||
#include <wpi/condition_variable.h>
|
||||
#include <wpi/json.h>
|
||||
#include <wpi/mutex.h>
|
||||
#include <wpi/timestamp.h>
|
||||
|
||||
@@ -45,8 +46,11 @@ class MatchDataSenderEntry {
|
||||
public:
|
||||
MatchDataSenderEntry(const std::shared_ptr<nt::NetworkTable>& table,
|
||||
std::string_view key,
|
||||
typename Topic::ParamType initialVal)
|
||||
: publisher{Topic{table->GetTopic(key)}.Publish()}, prevVal{initialVal} {
|
||||
typename Topic::ParamType initialVal,
|
||||
wpi::json topicProperties = {{}})
|
||||
: publisher{Topic{table->GetTopic(key)}.PublishEx(Topic::kTypeString,
|
||||
topicProperties)},
|
||||
prevVal{initialVal} {
|
||||
publisher.Set(initialVal);
|
||||
}
|
||||
|
||||
@@ -62,10 +66,16 @@ class MatchDataSenderEntry {
|
||||
typename Topic::ValueType prevVal;
|
||||
};
|
||||
|
||||
static constexpr std::string_view kSmartDashboardType = "FMSInfo";
|
||||
|
||||
struct MatchDataSender {
|
||||
std::shared_ptr<nt::NetworkTable> table =
|
||||
nt::NetworkTableInstance::GetDefault().GetTable("FMSInfo");
|
||||
MatchDataSenderEntry<nt::StringTopic> typeMetaData{table, ".type", "FMSInfo"};
|
||||
MatchDataSenderEntry<nt::StringTopic> typeMetaData{
|
||||
table,
|
||||
".type",
|
||||
kSmartDashboardType,
|
||||
{{"SmartDashboard", kSmartDashboardType}}};
|
||||
MatchDataSenderEntry<nt::StringTopic> gameSpecificMessage{
|
||||
table, "GameSpecificMessage", ""};
|
||||
MatchDataSenderEntry<nt::StringTopic> eventName{table, "EventName", ""};
|
||||
|
||||
Reference in New Issue
Block a user