Update rpiConfigServer formatting
This commit is contained in:
parent
bea3ad80b1
commit
7b78c412b0
1
deps/tools/.clang
vendored
Normal file
1
deps/tools/.clang
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
-std=c++11 -I../allwpilib/src/main/native/include
|
107
deps/tools/.clang-format
vendored
Normal file
107
deps/tools/.clang-format
vendored
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
---
|
||||||
|
Language: Cpp
|
||||||
|
BasedOnStyle: Google
|
||||||
|
AccessModifierOffset: -1
|
||||||
|
AlignAfterOpenBracket: Align
|
||||||
|
AlignConsecutiveAssignments: false
|
||||||
|
AlignConsecutiveDeclarations: false
|
||||||
|
AlignEscapedNewlines: Left
|
||||||
|
AlignOperands: true
|
||||||
|
AlignTrailingComments: true
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: true
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: All
|
||||||
|
AllowShortIfStatementsOnASingleLine: true
|
||||||
|
AllowShortLoopsOnASingleLine: true
|
||||||
|
AlwaysBreakAfterDefinitionReturnType: None
|
||||||
|
AlwaysBreakAfterReturnType: None
|
||||||
|
AlwaysBreakBeforeMultilineStrings: true
|
||||||
|
AlwaysBreakTemplateDeclarations: true
|
||||||
|
BinPackArguments: true
|
||||||
|
BinPackParameters: true
|
||||||
|
BraceWrapping:
|
||||||
|
AfterClass: false
|
||||||
|
AfterControlStatement: false
|
||||||
|
AfterEnum: false
|
||||||
|
AfterFunction: false
|
||||||
|
AfterNamespace: false
|
||||||
|
AfterObjCDeclaration: false
|
||||||
|
AfterStruct: false
|
||||||
|
AfterUnion: false
|
||||||
|
BeforeCatch: false
|
||||||
|
BeforeElse: false
|
||||||
|
IndentBraces: false
|
||||||
|
SplitEmptyFunction: true
|
||||||
|
SplitEmptyRecord: true
|
||||||
|
SplitEmptyNamespace: true
|
||||||
|
BreakBeforeBinaryOperators: None
|
||||||
|
BreakBeforeBraces: Attach
|
||||||
|
BreakBeforeInheritanceComma: false
|
||||||
|
BreakBeforeTernaryOperators: true
|
||||||
|
BreakConstructorInitializersBeforeComma: false
|
||||||
|
BreakConstructorInitializers: BeforeColon
|
||||||
|
BreakAfterJavaFieldAnnotations: false
|
||||||
|
BreakStringLiterals: true
|
||||||
|
ColumnLimit: 80
|
||||||
|
CommentPragmas: '^ IWYU pragma:'
|
||||||
|
CompactNamespaces: false
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||||
|
ConstructorInitializerIndentWidth: 4
|
||||||
|
ContinuationIndentWidth: 4
|
||||||
|
Cpp11BracedListStyle: true
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
DisableFormat: false
|
||||||
|
ExperimentalAutoDetectBinPacking: false
|
||||||
|
FixNamespaceComments: true
|
||||||
|
ForEachMacros:
|
||||||
|
- foreach
|
||||||
|
- Q_FOREACH
|
||||||
|
- BOOST_FOREACH
|
||||||
|
IncludeCategories:
|
||||||
|
- Regex: '^<.*\.h>'
|
||||||
|
Priority: 1
|
||||||
|
- Regex: '^<.*'
|
||||||
|
Priority: 2
|
||||||
|
- Regex: '.*'
|
||||||
|
Priority: 3
|
||||||
|
IncludeIsMainRegex: '([-_](test|unittest))?$'
|
||||||
|
IndentCaseLabels: true
|
||||||
|
IndentWidth: 2
|
||||||
|
IndentWrappedFunctionNames: false
|
||||||
|
JavaScriptQuotes: Leave
|
||||||
|
JavaScriptWrapImports: true
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||||
|
MacroBlockBegin: ''
|
||||||
|
MacroBlockEnd: ''
|
||||||
|
MaxEmptyLinesToKeep: 1
|
||||||
|
NamespaceIndentation: None
|
||||||
|
ObjCBlockIndentWidth: 2
|
||||||
|
ObjCSpaceAfterProperty: false
|
||||||
|
ObjCSpaceBeforeProtocolList: false
|
||||||
|
PenaltyBreakAssignment: 2
|
||||||
|
PenaltyBreakBeforeFirstCallParameter: 1
|
||||||
|
PenaltyBreakComment: 300
|
||||||
|
PenaltyBreakFirstLessLess: 120
|
||||||
|
PenaltyBreakString: 1000
|
||||||
|
PenaltyExcessCharacter: 1000000
|
||||||
|
PenaltyReturnTypeOnItsOwnLine: 200
|
||||||
|
PointerAlignment: Left
|
||||||
|
ReflowComments: true
|
||||||
|
SortIncludes: false
|
||||||
|
SortUsingDeclarations: true
|
||||||
|
SpaceAfterCStyleCast: false
|
||||||
|
SpaceAfterTemplateKeyword: true
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
SpaceBeforeParens: ControlStatements
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
|
SpacesBeforeTrailingComments: 2
|
||||||
|
SpacesInAngles: false
|
||||||
|
SpacesInContainerLiterals: true
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
|
SpacesInParentheses: false
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
Standard: Auto
|
||||||
|
TabWidth: 8
|
||||||
|
UseTab: Never
|
||||||
|
...
|
6
deps/tools/rpiConfigServer_src/DataHistory.h
vendored
6
deps/tools/rpiConfigServer_src/DataHistory.h
vendored
|
@ -5,8 +5,8 @@
|
||||||
/* the project. */
|
/* the project. */
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef WPIUTIL_DATAHISTORY_H_
|
#ifndef RPICONFIGSERVER_DATAHISTORY_H_
|
||||||
#define WPIUTIL_DATAHISTORY_H_
|
#define RPICONFIGSERVER_DATAHISTORY_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
@ -53,4 +53,4 @@ class DataHistory {
|
||||||
size_t m_qty = 0;
|
size_t m_qty = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WPIUTIL_DATAHISTORY_H_
|
#endif // RPICONFIGSERVER_DATAHISTORY_H_
|
||||||
|
|
|
@ -7,9 +7,10 @@
|
||||||
|
|
||||||
#include "MyHttpConnection.h"
|
#include "MyHttpConnection.h"
|
||||||
|
|
||||||
|
#include <wpi/UrlParser.h>
|
||||||
|
#include <wpi/raw_ostream.h>
|
||||||
|
|
||||||
#include "WebSocketHandlers.h"
|
#include "WebSocketHandlers.h"
|
||||||
#include "wpi/UrlParser.h"
|
|
||||||
#include "wpi/raw_ostream.h"
|
|
||||||
|
|
||||||
// static resources
|
// static resources
|
||||||
namespace wpi {
|
namespace wpi {
|
||||||
|
|
|
@ -5,14 +5,14 @@
|
||||||
/* the project. */
|
/* the project. */
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef WPIUTIL_MYHTTPCONNECTION_H_
|
#ifndef RPICONFIGSERVER_MYHTTPCONNECTION_H_
|
||||||
#define WPIUTIL_MYHTTPCONNECTION_H_
|
#define RPICONFIGSERVER_MYHTTPCONNECTION_H_
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "wpi/HttpServerConnection.h"
|
#include <wpi/HttpServerConnection.h>
|
||||||
#include "wpi/WebSocketServer.h"
|
#include <wpi/WebSocketServer.h>
|
||||||
#include "wpi/uv/Stream.h"
|
#include <wpi/uv/Stream.h>
|
||||||
|
|
||||||
class MyHttpConnection : public wpi::HttpServerConnection,
|
class MyHttpConnection : public wpi::HttpServerConnection,
|
||||||
public std::enable_shared_from_this<MyHttpConnection> {
|
public std::enable_shared_from_this<MyHttpConnection> {
|
||||||
|
@ -25,4 +25,4 @@ class MyHttpConnection : public wpi::HttpServerConnection,
|
||||||
wpi::WebSocketServerHelper m_websocketHelper;
|
wpi::WebSocketServerHelper m_websocketHelper;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WPIUTIL_MYHTTPCONNECTION_H_
|
#endif // RPICONFIGSERVER_MYHTTPCONNECTION_H_
|
||||||
|
|
12
deps/tools/rpiConfigServer_src/SystemStatus.cpp
vendored
12
deps/tools/rpiConfigServer_src/SystemStatus.cpp
vendored
|
@ -7,12 +7,12 @@
|
||||||
|
|
||||||
#include "SystemStatus.h"
|
#include "SystemStatus.h"
|
||||||
|
|
||||||
#include "wpi/SmallString.h"
|
#include <wpi/SmallString.h>
|
||||||
#include "wpi/SmallVector.h"
|
#include <wpi/SmallVector.h>
|
||||||
#include "wpi/StringRef.h"
|
#include <wpi/StringRef.h>
|
||||||
#include "wpi/json.h"
|
#include <wpi/json.h>
|
||||||
#include "wpi/raw_istream.h"
|
#include <wpi/raw_istream.h>
|
||||||
#include "wpi/raw_ostream.h"
|
#include <wpi/raw_ostream.h>
|
||||||
|
|
||||||
std::shared_ptr<SystemStatus> SystemStatus::GetInstance() {
|
std::shared_ptr<SystemStatus> SystemStatus::GetInstance() {
|
||||||
static auto sysStatus = std::make_shared<SystemStatus>(private_init{});
|
static auto sysStatus = std::make_shared<SystemStatus>(private_init{});
|
||||||
|
|
|
@ -5,13 +5,14 @@
|
||||||
/* the project. */
|
/* the project. */
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef WPIUTIL_SYSTEMSTATUS_H_
|
#ifndef RPICONFIGSERVER_SYSTEMSTATUS_H_
|
||||||
#define WPIUTIL_SYSTEMSTATUS_H_
|
#define RPICONFIGSERVER_SYSTEMSTATUS_H_
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include <wpi/Signal.h>
|
||||||
|
|
||||||
#include "DataHistory.h"
|
#include "DataHistory.h"
|
||||||
#include "wpi/Signal.h"
|
|
||||||
|
|
||||||
namespace wpi {
|
namespace wpi {
|
||||||
class json;
|
class json;
|
||||||
|
@ -57,4 +58,4 @@ class SystemStatus {
|
||||||
DataHistory<NetworkData, 6> m_network;
|
DataHistory<NetworkData, 6> m_network;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WPIUTIL_SYSTEMSTATUS_H_
|
#endif // RPICONFIGSERVER_SYSTEMSTATUS_H_
|
||||||
|
|
22
deps/tools/rpiConfigServer_src/VisionStatus.cpp
vendored
22
deps/tools/rpiConfigServer_src/VisionStatus.cpp
vendored
|
@ -7,24 +7,22 @@
|
||||||
|
|
||||||
#include "VisionStatus.h"
|
#include "VisionStatus.h"
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include "wpi/SmallString.h"
|
#include <wpi/SmallString.h>
|
||||||
#include "wpi/StringRef.h"
|
#include <wpi/StringRef.h>
|
||||||
#include "wpi/json.h"
|
#include <wpi/json.h>
|
||||||
#include "wpi/raw_ostream.h"
|
#include <wpi/raw_ostream.h>
|
||||||
#include "wpi/uv/Buffer.h"
|
#include <wpi/uv/Buffer.h>
|
||||||
#include "wpi/uv/Pipe.h"
|
#include <wpi/uv/Pipe.h>
|
||||||
#include "wpi/uv/Process.h"
|
#include <wpi/uv/Process.h>
|
||||||
#include "wpi/uv/Work.h"
|
#include <wpi/uv/Work.h>
|
||||||
|
|
||||||
namespace uv = wpi::uv;
|
namespace uv = wpi::uv;
|
||||||
|
|
||||||
|
@ -37,7 +35,6 @@ std::shared_ptr<VisionStatus> VisionStatus::GetInstance() {
|
||||||
|
|
||||||
void VisionStatus::RunSvc(const char* cmd,
|
void VisionStatus::RunSvc(const char* cmd,
|
||||||
std::function<void(wpi::StringRef)> onFail) {
|
std::function<void(wpi::StringRef)> onFail) {
|
||||||
#ifndef _WIN32
|
|
||||||
struct SvcWorkReq : public uv::WorkReq {
|
struct SvcWorkReq : public uv::WorkReq {
|
||||||
SvcWorkReq(const char* cmd_, std::function<void(wpi::StringRef)> onFail_)
|
SvcWorkReq(const char* cmd_, std::function<void(wpi::StringRef)> onFail_)
|
||||||
: cmd(cmd_), onFail(onFail_) {}
|
: cmd(cmd_), onFail(onFail_) {}
|
||||||
|
@ -69,7 +66,6 @@ void VisionStatus::RunSvc(const char* cmd,
|
||||||
});
|
});
|
||||||
|
|
||||||
uv::QueueWork(m_loop, workReq);
|
uv::QueueWork(m_loop, workReq);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisionStatus::Up(std::function<void(wpi::StringRef)> onFail) {
|
void VisionStatus::Up(std::function<void(wpi::StringRef)> onFail) {
|
||||||
|
@ -93,7 +89,6 @@ void VisionStatus::Kill(std::function<void(wpi::StringRef)> onFail) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisionStatus::UpdateStatus() {
|
void VisionStatus::UpdateStatus() {
|
||||||
#ifndef _WIN32
|
|
||||||
struct StatusWorkReq : public uv::WorkReq {
|
struct StatusWorkReq : public uv::WorkReq {
|
||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
wpi::SmallString<128> status;
|
wpi::SmallString<128> status;
|
||||||
|
@ -178,7 +173,6 @@ void VisionStatus::UpdateStatus() {
|
||||||
});
|
});
|
||||||
|
|
||||||
uv::QueueWork(m_loop, workReq);
|
uv::QueueWork(m_loop, workReq);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VisionStatus::ConsoleLog(uv::Buffer& buf, size_t len) {
|
void VisionStatus::ConsoleLog(uv::Buffer& buf, size_t len) {
|
||||||
|
|
10
deps/tools/rpiConfigServer_src/VisionStatus.h
vendored
10
deps/tools/rpiConfigServer_src/VisionStatus.h
vendored
|
@ -5,14 +5,14 @@
|
||||||
/* the project. */
|
/* the project. */
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef WPIUTIL_VISIONSTATUS_H_
|
#ifndef RPICONFIGSERVER_VISIONSTATUS_H_
|
||||||
#define WPIUTIL_VISIONSTATUS_H_
|
#define RPICONFIGSERVER_VISIONSTATUS_H_
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "wpi/Signal.h"
|
#include <wpi/Signal.h>
|
||||||
#include "wpi/StringRef.h"
|
#include <wpi/StringRef.h>
|
||||||
|
|
||||||
namespace wpi {
|
namespace wpi {
|
||||||
class json;
|
class json;
|
||||||
|
@ -54,4 +54,4 @@ class VisionStatus {
|
||||||
std::shared_ptr<wpi::uv::Loop> m_loop;
|
std::shared_ptr<wpi::uv::Loop> m_loop;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WPIUTIL_VISIONSTATUS_H_
|
#endif // RPICONFIGSERVER_VISIONSTATUS_H_
|
||||||
|
|
|
@ -9,16 +9,17 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include <wpi/SmallVector.h>
|
||||||
|
#include <wpi/WebSocket.h>
|
||||||
|
#include <wpi/json.h>
|
||||||
|
#include <wpi/raw_ostream.h>
|
||||||
|
#include <wpi/raw_uv_ostream.h>
|
||||||
|
#include <wpi/uv/Loop.h>
|
||||||
|
#include <wpi/uv/Pipe.h>
|
||||||
|
#include <wpi/uv/Process.h>
|
||||||
|
|
||||||
#include "SystemStatus.h"
|
#include "SystemStatus.h"
|
||||||
#include "VisionStatus.h"
|
#include "VisionStatus.h"
|
||||||
#include "wpi/SmallVector.h"
|
|
||||||
#include "wpi/WebSocket.h"
|
|
||||||
#include "wpi/json.h"
|
|
||||||
#include "wpi/raw_ostream.h"
|
|
||||||
#include "wpi/raw_uv_ostream.h"
|
|
||||||
#include "wpi/uv/Loop.h"
|
|
||||||
#include "wpi/uv/Pipe.h"
|
|
||||||
#include "wpi/uv/Process.h"
|
|
||||||
|
|
||||||
namespace uv = wpi::uv;
|
namespace uv = wpi::uv;
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
/* the project. */
|
/* the project. */
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef WPIUTIL_WEBSOCKETHANDLERS_H_
|
#ifndef RPICONFIGSERVER_WEBSOCKETHANDLERS_H_
|
||||||
#define WPIUTIL_WEBSOCKETHANDLERS_H_
|
#define RPICONFIGSERVER_WEBSOCKETHANDLERS_H_
|
||||||
|
|
||||||
#include "wpi/StringRef.h"
|
#include <wpi/StringRef.h>
|
||||||
|
|
||||||
namespace wpi {
|
namespace wpi {
|
||||||
class WebSocket;
|
class WebSocket;
|
||||||
|
@ -17,4 +17,4 @@ class WebSocket;
|
||||||
void InitWs(wpi::WebSocket& ws);
|
void InitWs(wpi::WebSocket& ws);
|
||||||
void ProcessWsText(wpi::WebSocket& ws, wpi::StringRef msg);
|
void ProcessWsText(wpi::WebSocket& ws, wpi::StringRef msg);
|
||||||
|
|
||||||
#endif // WPIUTIL_WEBSOCKETHANDLERS_H_
|
#endif // RPICONFIGSERVER_WEBSOCKETHANDLERS_H_
|
||||||
|
|
21
deps/tools/rpiConfigServer_src/main.cpp
vendored
21
deps/tools/rpiConfigServer_src/main.cpp
vendored
|
@ -8,19 +8,20 @@
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
|
#include <wpi/ArrayRef.h>
|
||||||
|
#include <wpi/StringRef.h>
|
||||||
|
#include <wpi/raw_ostream.h>
|
||||||
|
#include <wpi/raw_uv_ostream.h>
|
||||||
|
#include <wpi/timestamp.h>
|
||||||
|
#include <wpi/uv/Loop.h>
|
||||||
|
#include <wpi/uv/Process.h>
|
||||||
|
#include <wpi/uv/Tcp.h>
|
||||||
|
#include <wpi/uv/Timer.h>
|
||||||
|
#include <wpi/uv/Udp.h>
|
||||||
|
|
||||||
#include "MyHttpConnection.h"
|
#include "MyHttpConnection.h"
|
||||||
#include "SystemStatus.h"
|
#include "SystemStatus.h"
|
||||||
#include "VisionStatus.h"
|
#include "VisionStatus.h"
|
||||||
#include "wpi/ArrayRef.h"
|
|
||||||
#include "wpi/StringRef.h"
|
|
||||||
#include "wpi/raw_ostream.h"
|
|
||||||
#include "wpi/raw_uv_ostream.h"
|
|
||||||
#include "wpi/timestamp.h"
|
|
||||||
#include "wpi/uv/Loop.h"
|
|
||||||
#include "wpi/uv/Process.h"
|
|
||||||
#include "wpi/uv/Tcp.h"
|
|
||||||
#include "wpi/uv/Timer.h"
|
|
||||||
#include "wpi/uv/Udp.h"
|
|
||||||
|
|
||||||
namespace uv = wpi::uv;
|
namespace uv = wpi::uv;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user