[wpilib] Include sendable type information in topic metadata (#6741)

This commit is contained in:
Ryan Blue
2024-06-14 10:12:18 -04:00
committed by GitHub
parent d3aa7f85dd
commit bb8480c690
2 changed files with 7 additions and 2 deletions

View File

@@ -16,6 +16,7 @@
#include <networktables/StringArrayTopic.h>
#include <ntcore_cpp.h>
#include <wpi/SmallVector.h>
#include <wpi/json.h>
#include "frc/smartdashboard/SmartDashboard.h"
@@ -94,7 +95,8 @@ void SendableBuilderImpl::ClearProperties() {
void SendableBuilderImpl::SetSmartDashboardType(std::string_view type) {
if (!m_typePublisher) {
m_typePublisher = m_table->GetStringTopic(".type").Publish();
m_typePublisher = m_table->GetStringTopic(".type").PublishEx(
nt::StringTopic::kTypeString, {{"SmartDashboard", type}});
}
m_typePublisher.Set(type);
}

View File

@@ -251,7 +251,10 @@ public class SendableBuilderImpl implements NTSendableBuilder {
@Override
public void setSmartDashboardType(String type) {
if (m_typePub == null) {
m_typePub = m_table.getStringTopic(".type").publish();
m_typePub =
m_table
.getStringTopic(".type")
.publishEx(StringTopic.kTypeString, "{\"SmartDashboard\":\"" + type + "\"}");
}
m_typePub.set(type);
}