mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
SCRIPT namespace replacements
This commit is contained in:
committed by
Peter Johnson
parent
ae6c043632
commit
9aca8e0fd6
@@ -10,39 +10,39 @@
|
||||
int main() {
|
||||
CS_Status status = 0;
|
||||
|
||||
for (const auto& caminfo : cs::EnumerateUsbCameras(&status)) {
|
||||
wpi::print("{}: {} ({})\n", caminfo.dev, caminfo.path, caminfo.name);
|
||||
for (const auto& caminfo : wpi::cs::EnumerateUsbCameras(&status)) {
|
||||
wpi::util::print("{}: {} ({})\n", caminfo.dev, caminfo.path, caminfo.name);
|
||||
if (!caminfo.otherPaths.empty()) {
|
||||
std::puts("Other device paths:");
|
||||
for (auto&& path : caminfo.otherPaths) {
|
||||
wpi::print(" {}\n", path);
|
||||
wpi::util::print(" {}\n", path);
|
||||
}
|
||||
}
|
||||
|
||||
cs::UsbCamera camera{"usbcam", caminfo.dev};
|
||||
wpi::cs::UsbCamera camera{"usbcam", caminfo.dev};
|
||||
|
||||
std::puts("Properties:");
|
||||
for (const auto& prop : camera.EnumerateProperties()) {
|
||||
wpi::print(" {}", prop.GetName());
|
||||
wpi::util::print(" {}", prop.GetName());
|
||||
switch (prop.GetKind()) {
|
||||
case cs::VideoProperty::kBoolean:
|
||||
wpi::print(" (bool): value={} default={}", prop.Get(),
|
||||
case wpi::cs::VideoProperty::kBoolean:
|
||||
wpi::util::print(" (bool): value={} default={}", prop.Get(),
|
||||
prop.GetDefault());
|
||||
break;
|
||||
case cs::VideoProperty::kInteger:
|
||||
wpi::print(" (int): value={} min={} max={} step={} default={}",
|
||||
case wpi::cs::VideoProperty::kInteger:
|
||||
wpi::util::print(" (int): value={} min={} max={} step={} default={}",
|
||||
prop.Get(), prop.GetMin(), prop.GetMax(), prop.GetStep(),
|
||||
prop.GetDefault());
|
||||
break;
|
||||
case cs::VideoProperty::kString:
|
||||
wpi::print(" (string): {}", prop.GetString());
|
||||
case wpi::cs::VideoProperty::kString:
|
||||
wpi::util::print(" (string): {}", prop.GetString());
|
||||
break;
|
||||
case cs::VideoProperty::kEnum: {
|
||||
wpi::print(" (enum): value={}", prop.Get());
|
||||
case wpi::cs::VideoProperty::kEnum: {
|
||||
wpi::util::print(" (enum): value={}", prop.Get());
|
||||
auto choices = prop.GetChoices();
|
||||
for (size_t i = 0; i < choices.size(); ++i) {
|
||||
if (!choices[i].empty()) {
|
||||
wpi::print("\n {}: {}", i, choices[i]);
|
||||
wpi::util::print("\n {}: {}", i, choices[i]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -57,20 +57,20 @@ int main() {
|
||||
for (const auto& mode : camera.EnumerateVideoModes()) {
|
||||
const char* pixelFormat;
|
||||
switch (mode.pixelFormat) {
|
||||
case cs::VideoMode::kMJPEG:
|
||||
case wpi::cs::VideoMode::kMJPEG:
|
||||
pixelFormat = "MJPEG";
|
||||
break;
|
||||
case cs::VideoMode::kYUYV:
|
||||
case wpi::cs::VideoMode::kYUYV:
|
||||
pixelFormat = "YUYV";
|
||||
break;
|
||||
case cs::VideoMode::kRGB565:
|
||||
case wpi::cs::VideoMode::kRGB565:
|
||||
pixelFormat = "RGB565";
|
||||
break;
|
||||
default:
|
||||
pixelFormat = "Unknown";
|
||||
break;
|
||||
}
|
||||
wpi::print(" PixelFormat:{} Width:{} Height:{} FPS:{}\n", pixelFormat,
|
||||
wpi::util::print(" PixelFormat:{} Width:{} Height:{} FPS:{}\n", pixelFormat,
|
||||
mode.width, mode.height, mode.fps);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user