Skip to content

Commit

Permalink
[wpilib] Include sendable type information in topic metadata (wpilibs…
Browse files Browse the repository at this point in the history
  • Loading branch information
rzblue authored Jun 14, 2024
1 parent d3aa7f8 commit bb8480c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,10 @@ public void addCloseable(AutoCloseable closeable) {
@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);
}
Expand Down

0 comments on commit bb8480c

Please sign in to comment.