2020-12-26 14:12:05 -08:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
2018-12-30 14:45:41 -05:00
|
|
|
|
|
|
|
|
#include "frc/shuffleboard/SendableCameraWrapper.h"
|
|
|
|
|
|
2019-10-27 08:37:30 -07:00
|
|
|
#include <functional>
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <string>
|
|
|
|
|
|
2022-01-01 10:10:37 -08:00
|
|
|
#include <wpi/StringMap.h>
|
2021-06-13 16:38:05 -07:00
|
|
|
#include <wpi/sendable/SendableBuilder.h>
|
|
|
|
|
#include <wpi/sendable/SendableRegistry.h>
|
2018-12-30 14:45:41 -05:00
|
|
|
|
2019-10-27 08:37:30 -07:00
|
|
|
namespace frc {
|
|
|
|
|
namespace detail {
|
|
|
|
|
std::shared_ptr<SendableCameraWrapper>& GetSendableCameraWrapper(
|
2022-01-01 10:10:37 -08:00
|
|
|
std::string_view cameraName) {
|
|
|
|
|
static wpi::StringMap<std::shared_ptr<SendableCameraWrapper>> wrappers;
|
|
|
|
|
return wrappers[cameraName];
|
2018-12-30 14:45:41 -05:00
|
|
|
}
|
|
|
|
|
|
2022-01-01 10:10:37 -08:00
|
|
|
void AddToSendableRegistry(wpi::Sendable* sendable, std::string_view name) {
|
2021-06-15 23:06:03 -07:00
|
|
|
wpi::SendableRegistry::Add(sendable, name);
|
2018-12-30 14:45:41 -05:00
|
|
|
}
|
2019-10-27 08:37:30 -07:00
|
|
|
} // namespace detail
|
2018-12-30 14:45:41 -05:00
|
|
|
|
2021-06-13 16:38:05 -07:00
|
|
|
void SendableCameraWrapper::InitSendable(wpi::SendableBuilder& builder) {
|
2020-06-27 20:39:00 -07:00
|
|
|
builder.AddStringProperty(
|
|
|
|
|
".ShuffleboardURI", [this] { return m_uri; }, nullptr);
|
2018-12-30 14:45:41 -05:00
|
|
|
}
|
2019-10-27 08:37:30 -07:00
|
|
|
} // namespace frc
|