2018-12-30 14:45:41 -05:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2020-06-27 20:39:00 -07:00
|
|
|
/* Copyright (c) 2019-2020 FIRST. All Rights Reserved. */
|
2018-12-30 14:45:41 -05:00
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#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
|