Skip to content

Commit 14b3ded

Browse files
author
Cédric Jimenez
committed
[init] Initial source code
1 parent 561f702 commit 14b3ded

File tree

276 files changed

+55621
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

276 files changed

+55621
-0
lines changed

.clang-format

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
Language: Cpp
3+
BasedOnStyle: Microsoft
4+
ColumnLimit: 140
5+
AlignConsecutiveAssignments: true
6+
AlignConsecutiveDeclarations: true
7+
AllowShortBlocksOnASingleLine: Empty
8+
AllowShortIfStatementsOnASingleLine: false
9+
AllowShortLoopsOnASingleLine: false
10+
AllowShortFunctionsOnASingleLine: Inline
11+
AlignEscapedNewlines: Left
12+
AlignOperands: true
13+
AlignTrailingComments: true
14+
AllowShortBlocksOnASingleLine: false
15+
BreakConstructorInitializers: BeforeColon
16+
ReflowComments: false
17+
AllowShortCaseLabelsOnASingleLine: false
18+
BinPackParameters: false
19+
BinPackArguments: false
20+
PointerAlignment: Left
21+
IndentCaseLabels: true
22+
BreakBeforeBraces: Allman
23+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
24+
SpaceInEmptyBlock: true
25+
AlwaysBreakTemplateDeclarations: Yes

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
build
2+
build_*
3+
bin/*
4+
.vscode/settings.json
5+
__pycache__
6+
*.pyc

.vscode/c_cpp_properties.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "Linux",
5+
"includePath": [
6+
"${workspaceFolder}/**",
7+
"/usr/local/include",
8+
"/usr/local/include/openocpp"
9+
],
10+
"defines": [],
11+
"compilerPath": "/usr/bin/clang",
12+
"cStandard": "c17",
13+
"cppStandard": "c++17",
14+
"intelliSenseMode": "linux-clang-x64"
15+
}
16+
],
17+
"version": 4
18+
}

.vscode/launch.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Supervisor",
9+
"type": "python",
10+
"request": "launch",
11+
"program": "${workspaceRoot}/src/supervisor/main.py",
12+
"console": "integratedTerminal",
13+
"justMyCode": true,
14+
"cwd": "${workspaceRoot}/src/supervisor"
15+
},
16+
{
17+
"type": "gdb",
18+
"request": "launch",
19+
"name": "Launcher",
20+
"target": "${workspaceRoot}/bin/gcc_native/launcher",
21+
"cwd": "${workspaceRoot}/bin/gcc_native/",
22+
"arguments": "-w .",
23+
"valuesFormatting": "parseText"
24+
},
25+
{
26+
"type": "gdb",
27+
"request": "launch",
28+
"name": "Charge Point",
29+
"target": "${workspaceRoot}/bin/gcc_native/chargepoint",
30+
"cwd": "${workspaceRoot}/bin/gcc_native/",
31+
"arguments": "-w ./chargepoints/Simulated_CP -t ws://127.0.0.1:8080/openocpp/ -c Simulated_CP -s SN123456 -n 2 -p 3",
32+
"valuesFormatting": "parseText"
33+
}
34+
]
35+
}

.vscode/tasks.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "build GCC native",
8+
"type": "shell",
9+
"command": "make",
10+
"args": [
11+
"gcc-native",
12+
"BUILD_TYPE=Debug"
13+
],
14+
"problemMatcher": "$gcc",
15+
"group": {
16+
"kind": "build",
17+
"isDefault": true
18+
}
19+
},
20+
{
21+
"label": "clean GCC native",
22+
"type": "shell",
23+
"command": "make",
24+
"args": [
25+
"clean-gcc-native",
26+
"BUILD_TYPE=Debug"
27+
],
28+
"group": "build"
29+
}
30+
]
31+
}

3rdparty/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
# Rapidjson is an header only library
3+
add_library(rapidjson INTERFACE)
4+
target_include_directories(rapidjson INTERFACE rapidjson/include)
5+
6+
# JSON tools library is an interface wrapper for the rapidjson
7+
# library which disable the warnings coming from the rapidjson's headers
8+
# and provides some helper classes
9+
add_library(json INTERFACE)
10+
target_include_directories(json INTERFACE .)
11+
target_link_libraries(json INTERFACE rapidjson)

3rdparty/json.h

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
MIT License
3+
4+
Copyright (c) 2022 Cedric Jimenez
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.
23+
*/
24+
25+
#ifndef JSON_H
26+
#define JSON_H
27+
28+
// Disable GCC warnings
29+
#ifdef __GNUC__
30+
#pragma GCC diagnostic push
31+
#ifdef __clang__
32+
#pragma GCC diagnostic ignored "-Wexceptions"
33+
#else
34+
#pragma GCC diagnostic ignored "-Wclass-memaccess"
35+
#endif
36+
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
37+
#endif // __GNUC__
38+
39+
// Use exception for critical parse errors
40+
// instead of asserts
41+
#include <stdexcept>
42+
namespace rapidjson
43+
{
44+
/** @brief Specific exception class dedicated to critical parse errors */
45+
class parse_exception : public std::logic_error
46+
{
47+
public:
48+
/** @brief Default constructor */
49+
parse_exception(const char* reason) : std::logic_error(reason) { }
50+
};
51+
} // namespace rapidjson
52+
#define EXCEPTION_REASON_STRINGIFY(x) #x
53+
#define RAPIDJSON_ASSERT(x) \
54+
if (!(x)) \
55+
throw parse_exception(EXCEPTION_REASON_STRINGIFY(x))
56+
57+
// Include rapidjson's headers
58+
#include "rapidjson/document.h"
59+
#include "rapidjson/error/en.h"
60+
#include "rapidjson/schema.h"
61+
#include "rapidjson/stringbuffer.h"
62+
#include "rapidjson/writer.h"
63+
64+
// Restore GCC warnings
65+
#ifdef __GNUC__
66+
#pragma GCC diagnostic pop
67+
#endif // __GNUC__
68+
69+
#endif // JSON_H

3rdparty/rapidjson/.gitattributes

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text=auto
3+
4+
# Explicitly declare text files you want to always be normalized and converted
5+
# to native line endings on checkout.
6+
*.cpp text
7+
*.h text
8+
*.txt text
9+
*.md text
10+
*.cmake text
11+
*.svg text
12+
*.dot text
13+
*.yml text
14+
*.in text
15+
*.sh text
16+
*.autopkg text
17+
Dockerfile text
18+
19+
# Denote all files that are truly binary and should not be modified.
20+
*.png binary
21+
*.jpg binary
22+
*.json binary

3rdparty/rapidjson/.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/bin/*
2+
!/bin/data
3+
!/bin/encodings
4+
!/bin/jsonchecker
5+
!/bin/types
6+
/build
7+
/doc/html
8+
/doc/doxygen_*.db
9+
*.a
10+
11+
# Temporary files created during CMake build
12+
CMakeCache.txt
13+
CMakeFiles
14+
cmake_install.cmake
15+
CTestTestfile.cmake
16+
Makefile
17+
RapidJSON*.cmake
18+
RapidJSON.pc
19+
Testing
20+
/googletest
21+
install_manifest.txt
22+
Doxyfile
23+
Doxyfile.zh-cn
24+
DartConfiguration.tcl
25+
*.nupkg

3rdparty/rapidjson/.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "thirdparty/gtest"]
2+
path = thirdparty/gtest
3+
url = https://github.com/google/googletest.git

0 commit comments

Comments
 (0)