2018-12-30 14:45:41 -05:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2019-09-14 15:22:54 -05:00
|
|
|
/* Copyright (c) 2018-2019 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. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
#include <cscore_c.h>
|
|
|
|
|
|
2019-09-14 15:22:54 -05:00
|
|
|
#include "frc/smartdashboard/Sendable.h"
|
|
|
|
|
#include "frc/smartdashboard/SendableHelper.h"
|
2018-12-30 14:45:41 -05:00
|
|
|
|
|
|
|
|
namespace cs {
|
|
|
|
|
class VideoSource;
|
|
|
|
|
} // namespace cs
|
|
|
|
|
|
|
|
|
|
namespace frc {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A wrapper to make video sources sendable and usable from Shuffleboard.
|
|
|
|
|
*/
|
2019-09-14 15:22:54 -05:00
|
|
|
class SendableCameraWrapper : public Sendable,
|
|
|
|
|
public SendableHelper<SendableCameraWrapper> {
|
2018-12-30 14:45:41 -05:00
|
|
|
private:
|
|
|
|
|
struct private_init {};
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
/**
|
|
|
|
|
* Creates a new sendable wrapper. Private constructor to avoid direct
|
|
|
|
|
* instantiation with multiple wrappers floating around for the same camera.
|
|
|
|
|
*
|
|
|
|
|
* @param source the source to wrap
|
|
|
|
|
*/
|
|
|
|
|
SendableCameraWrapper(CS_Source source, const private_init&);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets a sendable wrapper object for the given video source, creating the
|
|
|
|
|
* wrapper if one does not already exist for the source.
|
|
|
|
|
*
|
|
|
|
|
* @param source the video source to wrap
|
|
|
|
|
* @return a sendable wrapper object for the video source, usable in
|
|
|
|
|
* Shuffleboard via ShuffleboardTab::Add() and ShuffleboardLayout::Add()
|
|
|
|
|
*/
|
|
|
|
|
static SendableCameraWrapper& Wrap(const cs::VideoSource& source);
|
|
|
|
|
static SendableCameraWrapper& Wrap(CS_Source source);
|
|
|
|
|
|
|
|
|
|
void InitSendable(SendableBuilder& builder) override;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
std::string m_uri;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace frc
|