Set up wpiformat

This commit is contained in:
Tyler Veness
2017-08-19 23:08:27 -07:00
committed by Peter Johnson
parent 4514ff8071
commit 19f7a5f108
107 changed files with 1146 additions and 910 deletions

View File

@@ -1,3 +1,10 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2017. 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 <chrono>
#include <climits>
#include <cstdio>
@@ -7,20 +14,19 @@
int main() {
auto inst = nt::GetDefaultInstance();
nt::AddLogger(
inst,
[](const nt::LogMessage& msg) {
std::fputs(msg.message.c_str(), stderr);
std::fputc('\n', stderr);
},
0, UINT_MAX);
nt::AddLogger(inst,
[](const nt::LogMessage& msg) {
std::fputs(msg.message.c_str(), stderr);
std::fputc('\n', stderr);
},
0, UINT_MAX);
nt::StartClient(inst, "127.0.0.1", 10000);
std::this_thread::sleep_for(std::chrono::seconds(2));
auto foo = nt::GetEntry(inst, "/foo");
auto foo_val = nt::GetEntryValue(foo);
if (foo_val && foo_val->IsDouble())
printf("Got foo: %g\n", foo_val->GetDouble());
std::printf("Got foo: %g\n", foo_val->GetDouble());
auto bar = nt::GetEntry(inst, "/bar");
nt::SetEntryValue(bar, nt::Value::MakeBoolean(false));