Prepare cscore for merge into allwpilib.

This commit is contained in:
Peter Johnson
2017-12-20 19:28:58 -08:00
parent 6d3d52f923
commit ea73c10cd8
166 changed files with 0 additions and 335 deletions

View File

@@ -0,0 +1,35 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */
/* 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 <cstdio>
#include <llvm/raw_ostream.h>
#include "cscore.h"
int main() {
llvm::outs() << "hostname: " << cs::GetHostname() << '\n';
llvm::outs() << "IPv4 network addresses:\n";
for (const auto& addr : cs::GetNetworkInterfaces())
llvm::outs() << " " << addr << '\n';
cs::UsbCamera camera{"usbcam", 0};
camera.SetVideoMode(cs::VideoMode::kMJPEG, 320, 240, 30);
cs::MjpegServer mjpegServer{"httpserver", 8081};
mjpegServer.SetSource(camera);
CS_Status status = 0;
cs::AddListener(
[&](const cs::RawEvent& event) {
llvm::outs() << "FPS=" << camera.GetActualFPS()
<< " MBPS=" << (camera.GetActualDataRate() / 1000000.0)
<< '\n';
},
cs::RawEvent::kTelemetryUpdated, false, &status);
cs::SetTelemetryPeriod(1.0);
std::getchar();
}