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>
|
|
|
|
|
|
2018-12-30 14:45:41 -05:00
|
|
|
#include <wpi/DenseMap.h>
|
|
|
|
|
|
|
|
|
|
#include "frc/smartdashboard/SendableBuilder.h"
|
2019-09-14 15:22:54 -05:00
|
|
|
#include "frc/smartdashboard/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(
|
|
|
|
|
CS_Source source) {
|
|
|
|
|
static wpi::DenseMap<int, std::shared_ptr<SendableCameraWrapper>> wrappers;
|
|
|
|
|
return wrappers[static_cast<int>(source)];
|
2018-12-30 14:45:41 -05:00
|
|
|
}
|
|
|
|
|
|
2019-10-27 08:37:30 -07:00
|
|
|
void AddToSendableRegistry(frc::Sendable* sendable, std::string name) {
|
|
|
|
|
SendableRegistry::GetInstance().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
|
|
|
|
|
|
|
|
void SendableCameraWrapper::InitSendable(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
|