mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-04 03:11:43 +00:00
[wpilib] Include sendable type information in topic metadata (#6741)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user