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.
|
2019-05-30 19:12:05 -07:00
|
|
|
|
|
|
|
|
#ifndef CSCORE_CONFIGURABLESOURCEIMPL_H_
|
|
|
|
|
#define CSCORE_CONFIGURABLESOURCEIMPL_H_
|
|
|
|
|
|
|
|
|
|
#include <atomic>
|
|
|
|
|
#include <functional>
|
|
|
|
|
#include <memory>
|
2022-10-15 16:33:14 -07:00
|
|
|
#include <span>
|
2019-05-30 19:12:05 -07:00
|
|
|
#include <string>
|
2021-06-06 16:13:58 -07:00
|
|
|
#include <string_view>
|
2019-05-30 19:12:05 -07:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
#include "SourceImpl.h"
|
|
|
|
|
|
|
|
|
|
namespace cs {
|
|
|
|
|
|
|
|
|
|
class ConfigurableSourceImpl : public SourceImpl {
|
|
|
|
|
protected:
|
2021-06-06 16:13:58 -07:00
|
|
|
ConfigurableSourceImpl(std::string_view name, wpi::Logger& logger,
|
2019-05-30 19:12:05 -07:00
|
|
|
Notifier& notifier, Telemetry& telemetry,
|
|
|
|
|
const VideoMode& mode);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
~ConfigurableSourceImpl() override;
|
|
|
|
|
|
|
|
|
|
void Start() override;
|
|
|
|
|
|
|
|
|
|
bool SetVideoMode(const VideoMode& mode, CS_Status* status) override;
|
|
|
|
|
|
|
|
|
|
void NumSinksChanged() override;
|
|
|
|
|
void NumSinksEnabledChanged() override;
|
|
|
|
|
|
2024-02-12 22:33:03 -08:00
|
|
|
// Frame based specific functions
|
2021-06-06 16:13:58 -07:00
|
|
|
void NotifyError(std::string_view msg);
|
|
|
|
|
int CreateProperty(std::string_view name, CS_PropertyKind kind, int minimum,
|
2019-05-30 19:12:05 -07:00
|
|
|
int maximum, int step, int defaultValue, int value);
|
2021-06-06 16:13:58 -07:00
|
|
|
int CreateProperty(std::string_view name, CS_PropertyKind kind, int minimum,
|
2019-05-30 19:12:05 -07:00
|
|
|
int maximum, int step, int defaultValue, int value,
|
|
|
|
|
std::function<void(CS_Property property)> onChange);
|
2021-06-06 19:51:14 -07:00
|
|
|
void SetEnumPropertyChoices(int property,
|
2022-10-15 16:33:14 -07:00
|
|
|
std::span<const std::string> choices,
|
2019-05-30 19:12:05 -07:00
|
|
|
CS_Status* status);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
std::atomic_bool m_connected{true};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace cs
|
|
|
|
|
|
|
|
|
|
#endif // CSCORE_CONFIGURABLESOURCEIMPL_H_
|