diff --git a/gobotrpc/.gitignore b/gobotrpc/.gitignore new file mode 100644 index 0000000..303a3cf --- /dev/null +++ b/gobotrpc/.gitignore @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4c6f3a0adc6921469e6cfb8336060479bad013da28a07f458568b89b7a3d9484 +size 10 diff --git a/gobotrpc/.vscode/tasks.json b/gobotrpc/.vscode/tasks.json new file mode 100644 index 0000000..9bf6156 --- /dev/null +++ b/gobotrpc/.vscode/tasks.json @@ -0,0 +1,22 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "taskName": "Run Main", + "command": "python3 generator/main.py", + "type": "shell", + "group": { + "kind": "build", + "isDefault": true + }, + "presentation": { + "reveal": "always", + "panel": "dedicated", + "focus": true, + "clear": true + }, + }, + ] +} \ No newline at end of file diff --git a/gobotrpc/docs/.~lock.Gobot RPC Defintion.ods# b/gobotrpc/docs/.~lock.Gobot RPC Defintion.ods# deleted file mode 100644 index 60d1eaf..0000000 --- a/gobotrpc/docs/.~lock.Gobot RPC Defintion.ods# +++ /dev/null @@ -1 +0,0 @@ -,alexander,ideapad-QZYAFJK,12.01.2025 02:07,file:///home/alexander/.config/libreoffice/4; \ No newline at end of file diff --git a/gobotrpc/generator/main.py b/gobotrpc/generator/main.py index c77f23b..0621b23 100644 --- a/gobotrpc/generator/main.py +++ b/gobotrpc/generator/main.py @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6ebbd1cf8eec314f9a8375a0b1307a03cdb2634ae329aed6abde29e9b1ace653 -size 799 +oid sha256:e4a79b4e2b47b5d3d4c39f613ea632350b795d112380dc03b0b589c86972923d +size 1232 diff --git a/gobotrpc/generator/src/__init__.py b/gobotrpc/generator/src/__init__.py index 2fec1c9..47a3473 100644 --- a/gobotrpc/generator/src/__init__.py +++ b/gobotrpc/generator/src/__init__.py @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cd9b5dd72e86767a2f6ead538996659f027e35b96cf8d7a5189e80dc3b78b1ef -size 3927 +oid sha256:6c7073ec1e3747ab054aa94ac57f3ab05110e858c51b2677f1548489c04b4ebc +size 2704 diff --git a/gobotrpc/generator/src/backend/__init__.py b/gobotrpc/generator/src/backend/__init__.py new file mode 100644 index 0000000..9e061b1 --- /dev/null +++ b/gobotrpc/generator/src/backend/__init__.py @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:37bc22d751b7ed332b6361492e0b8c36a4a31a2131315a5b5d38e85f0a34e2af +size 776 diff --git a/gobotrpc/generator/src/backend/cpp.py b/gobotrpc/generator/src/backend/cpp.py deleted file mode 100644 index a321a07..0000000 --- a/gobotrpc/generator/src/backend/cpp.py +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7819cae611d43c982745c14d253bfa9e0352ed2f82cff48779ededa483cab4d3 -size 1221 diff --git a/gobotrpc/generator/src/backend/cpp/converter.py b/gobotrpc/generator/src/backend/cpp/converter.py new file mode 100644 index 0000000..af0f367 --- /dev/null +++ b/gobotrpc/generator/src/backend/cpp/converter.py @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0561103c22a83e7ee9c9166ae97e7007640062fafcef69365a539cad59db2474 +size 2455 diff --git a/gobotrpc/generator/src/backend/cpp/render.py b/gobotrpc/generator/src/backend/cpp/render.py new file mode 100644 index 0000000..fadb619 --- /dev/null +++ b/gobotrpc/generator/src/backend/cpp/render.py @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f87c1ead777516b574b3dfb9ced92d86b4d5d9b4c134c96f06206d2a58f8ae9d +size 3816 diff --git a/gobotrpc/generator/src/util.py b/gobotrpc/generator/src/util.py index 0503736..61f1eca 100644 --- a/gobotrpc/generator/src/util.py +++ b/gobotrpc/generator/src/util.py @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:10bb3e8a96d23649938b2c4ee93910011746200d9b9d72a7bc7852f2da599e5f -size 111 +oid sha256:bf4fe4452338dacece258887d769bbb7b68bce6fcd56c259a9f7295ef091a88a +size 107 diff --git a/gobotrpc/generator/templates/CMakeLists.txt.j2 b/gobotrpc/generator/templates/CMakeLists.txt.j2 new file mode 100644 index 0000000..11902d9 --- /dev/null +++ b/gobotrpc/generator/templates/CMakeLists.txt.j2 @@ -0,0 +1,13 @@ +add_libary(gobotrpc STATIC) + +target_sources(gobotrpc + PRIVATE + {%- for n in cpp_files %} + {{ n }} + {%- endfor %} +) + +target_include_directories(gobotrpc + PUBLIC + include +) \ No newline at end of file diff --git a/gobotrpc/generator/templates/package_struct_template.hpp.j2 b/gobotrpc/generator/templates/package_struct_template.hpp.j2 new file mode 100644 index 0000000..ad7312b --- /dev/null +++ b/gobotrpc/generator/templates/package_struct_template.hpp.j2 @@ -0,0 +1,29 @@ +#pragma once +/** + * This Header file was auto-generated by the GobotRPC-Protocol-Generator-Tool + */ + +#include {{ "" }} +#include "{{ enum_header_file }}" + +enum {{ prefix }}RPCNames {{"{"}} +{%- for n in rpcNames %} + {{ n }} = {{ rpcNames[n] }}, +{%- endfor %} +{{"}"}}; + +enum {{ prefix }}RPCTypes {{"{"}} +{%- for n in rpcTypes %} + {{ n }} = {{ rpcTypes[n] }}, +{%- endfor %} +{{"}"}}; + +int getPackageSize(uint8_t data); + +{% for struct in package_list %} +struct {{ struct.name }} {{ "{" }} +{% for field in struct.fields -%} +{{ "\t" }}{{ field.type }} {{ field.name }} : {{ field.size_bits }}; +{% endfor -%} +{{ "}" }}; +{% endfor %} diff --git a/gobotrpc/generator/templates/package_util.cpp.j2 b/gobotrpc/generator/templates/package_util.cpp.j2 new file mode 100644 index 0000000..bc24192 --- /dev/null +++ b/gobotrpc/generator/templates/package_util.cpp.j2 @@ -0,0 +1,20 @@ +#pragma once +/** + * This Header file was auto-generated by the GobotRPC-Protocol-Generator-Tool + */ + +#include {{ "" }} +{%- for h in headers %} +#include {{ "\"" + h + "\"" }} +{%- endfor %} + +int getPackageSize(uint8_t data) { + switch(data) { + {%- for n in rpcSizes %} + case {{ prefix }}RPCNames::{{ n }}: + return {{ rpcSizes[n] }}; + {%- endfor %} + default: + return -1; + } +}; diff --git a/gobotrpc/out/cpp/.vscode/tasks.json b/gobotrpc/out/cpp/.vscode/tasks.json new file mode 100644 index 0000000..875a263 --- /dev/null +++ b/gobotrpc/out/cpp/.vscode/tasks.json @@ -0,0 +1,25 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "cmake", + "label": "CMake: build", + "command": "build", + "targets": [ + "all" + ], + "group": "build", + "problemMatcher": [], + "detail": "CMake template build task", + "presentation": { + "echo": true, + "reveal": "always", + "focus": false, + "panel": "dedicated", + "showReuseMessage": true, + "clear": true + } + }, + + ] +} \ No newline at end of file diff --git a/gobotrpc/out/cpp/CMakeLists.txt b/gobotrpc/out/cpp/CMakeLists.txt new file mode 100644 index 0000000..d496ccd --- /dev/null +++ b/gobotrpc/out/cpp/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.28.3) +project(TestingGobotRPCParser) + + +# GoogleTest requires at least C++23 +set(CMAKE_CXX_STANDARD 23) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# Adding gtest +include(FetchContent) +FetchContent_Declare( + googletest + gcov + URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip +) + +FetchContent_MakeAvailable(googletest) + +add_executable(TestingGobotRPCParser test/main.cpp) +target_link_libraries(TestingGobotRPCParser gtest_main) diff --git a/gobotrpc/out/cpp/cov.info b/gobotrpc/out/cpp/cov.info new file mode 100644 index 0000000..e69de29 diff --git a/gobotrpc/out/cpp/gobotrpc.cmake b/gobotrpc/out/cpp/gobotrpc.cmake new file mode 100644 index 0000000..80c0994 --- /dev/null +++ b/gobotrpc/out/cpp/gobotrpc.cmake @@ -0,0 +1,11 @@ +add_libary(gobotrpc STATIC) + +target_sources(gobotrpc + PRIVATE + src/package_util.cpp +) + +target_include_directories(gobotrpc + PUBLIC + include +) \ No newline at end of file diff --git a/gobotrpc/out/cpp/include/enums.hpp b/gobotrpc/out/cpp/include/enums.hpp new file mode 100644 index 0000000..1dae1f9 --- /dev/null +++ b/gobotrpc/out/cpp/include/enums.hpp @@ -0,0 +1,33 @@ +#pragma once +/** + * This Header file was auto-generated by the GobotRPC-Protocol-Generator-Tool + */ + +enum class GOBOTRPC_ENUM_NodeType { + kHub = 0, + kHead = 1, + kCorexy = 2, + kVacun = 3, +}; + +enum class GOBOTRPC_ENUM_NodeStatus { + kReady = 0, + kWorking = 1, + kBusy = 2, + kError = 3, +}; + +enum class GOBOTRPC_ENUM_ErrorCode { +}; + +enum class GOBOTRPC_ENUM_HeadPos { + kUp = 0, + kDown = 1, +}; + +enum class GOBOTRPC_ENUM_StoneStatus { + kEmpty = 0, + kLow = 1, + kFill = 2, +}; + diff --git a/gobotrpc/out/cpp/include/gobotrpc_enums.hpp b/gobotrpc/out/cpp/include/gobotrpc_enums.hpp deleted file mode 100644 index 030da76..0000000 --- a/gobotrpc/out/cpp/include/gobotrpc_enums.hpp +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once -/** - * This Header file was auto-generated by the GobotRPC-Protocol-Generator-Tool - */ - -enum class GOBOTRPC_ENUM_NodeType { - GOBOTRPC_ENUM_kHub = 0, - GOBOTRPC_ENUM_kHead = 1, - GOBOTRPC_ENUM_kCorexy = 2, - GOBOTRPC_ENUM_kVacun = 3, -}; - -enum class GOBOTRPC_ENUM_NodeStatus { - GOBOTRPC_ENUM_kReady = 0, - GOBOTRPC_ENUM_kWorking = 1, - GOBOTRPC_ENUM_kBusy = 2, - GOBOTRPC_ENUM_kError = 3, -}; - -enum class GOBOTRPC_ENUM_ErrorCode { -}; - -enum class GOBOTRPC_ENUM_HeadPos { - GOBOTRPC_ENUM_kUp = 0, - GOBOTRPC_ENUM_kDown = 1, -}; - -enum class GOBOTRPC_ENUM_StoneStatus { - GOBOTRPC_ENUM_kEmpty = 0, - GOBOTRPC_ENUM_kLow = 1, - GOBOTRPC_ENUM_kFill = 2, -}; - diff --git a/gobotrpc/out/cpp/include/package_structs.hpp b/gobotrpc/out/cpp/include/package_structs.hpp new file mode 100644 index 0000000..dc6c3c4 --- /dev/null +++ b/gobotrpc/out/cpp/include/package_structs.hpp @@ -0,0 +1,127 @@ +#pragma once +/** + * This Header file was auto-generated by the GobotRPC-Protocol-Generator-Tool + */ + +#include +#include "enums.hpp" + +enum GOBOTRPC_RPCNames { + kInvalid = 255, + kGetInfo = 1, + kReset = 2, + kResetInfo = 3, + kStatusUpdate = 4, + kError = 5, + kHome = 7, + kGoto = 9, + kSetBoardCorner = 11, + kSetVacumOffset = 13, + kReleaseMotors = 15, + kDrop = 17, + kStoneStatus = 19, + kMoveZAxis = 21, + kSetVacum = 23, +}; + +enum GOBOTRPC_RPCTypes { + kReq = 0, + kRes = 1, +}; + +int getPackageSize(uint8_t data); + + +struct GOBOTRPC_GetInfoReq { +}; + +struct GOBOTRPC_GetInfoRes { + int32_t addr : 32; + GOBOTRPC_ENUM_NodeType type : 8; + GOBOTRPC_ENUM_NodeStatus status : 8; +}; + +struct GOBOTRPC_ResetReq { +}; + +struct GOBOTRPC_ResetInfoRes { + GOBOTRPC_ENUM_NodeStatus status : 8; +}; + +struct GOBOTRPC_StatusUpdateRes { + GOBOTRPC_ENUM_NodeStatus status : 8; +}; + +struct GOBOTRPC_ErrorRes { + GOBOTRPC_ENUM_ErrorCode error : 8; +}; + +struct GOBOTRPC_HomeReq { +}; + +struct GOBOTRPC_HomeRes { + int32_t x : 32; + int32_t y : 32; +}; + +struct GOBOTRPC_GotoReq { + int8_t x : 8; + int8_t y : 8; + bool offset : 8; +}; + +struct GOBOTRPC_GotoRes { +}; + +struct GOBOTRPC_SetBoardCornerReq { + int32_t x1 : 32; + int32_t y1 : 32; + int32_t x2 : 32; + int32_t y2 : 32; +}; + +struct GOBOTRPC_SetBoardCornerRes { +}; + +struct GOBOTRPC_SetVacumOffsetReq { + int32_t x : 32; + int32_t y : 32; +}; + +struct GOBOTRPC_SetVacumOffsetRes { +}; + +struct GOBOTRPC_ReleaseMotorsReq { + bool enable : 8; +}; + +struct GOBOTRPC_ReleaseMotorsRes { +}; + +struct GOBOTRPC_DropReq { +}; + +struct GOBOTRPC_DropRes { + GOBOTRPC_ENUM_StoneStatus status : 8; +}; + +struct GOBOTRPC_StoneStatusReq { +}; + +struct GOBOTRPC_StoneStatusRes { + GOBOTRPC_ENUM_StoneStatus status : 8; +}; + +struct GOBOTRPC_MoveZAxisReq { + GOBOTRPC_ENUM_HeadPos pos : 8; +}; + +struct GOBOTRPC_MoveZAxisRes { +}; + +struct GOBOTRPC_SetVacumReq { + bool enable : 8; +}; + +struct GOBOTRPC_SetVacumRes { +}; diff --git a/gobotrpc/out/cpp/src/package_util.cpp b/gobotrpc/out/cpp/src/package_util.cpp new file mode 100644 index 0000000..8f48d3c --- /dev/null +++ b/gobotrpc/out/cpp/src/package_util.cpp @@ -0,0 +1,63 @@ +#pragma once +/** + * This Header file was auto-generated by the GobotRPC-Protocol-Generator-Tool + */ + +#include +#include "package_structs.hpp" +#include "enums.hpp" + +int getPackageSize(uint8_t data) { + switch(data) { + case RPCNames::GOBOTRPC_GetInfoReq: + return 0; + case RPCNames::GOBOTRPC_GetInfoRes: + return 6; + case RPCNames::GOBOTRPC_ResetReq: + return 0; + case RPCNames::GOBOTRPC_ResetInfoRes: + return 1; + case RPCNames::GOBOTRPC_StatusUpdateRes: + return 1; + case RPCNames::GOBOTRPC_ErrorRes: + return 1; + case RPCNames::GOBOTRPC_HomeReq: + return 0; + case RPCNames::GOBOTRPC_HomeRes: + return 8; + case RPCNames::GOBOTRPC_GotoReq: + return 3; + case RPCNames::GOBOTRPC_GotoRes: + return 0; + case RPCNames::GOBOTRPC_SetBoardCornerReq: + return 16; + case RPCNames::GOBOTRPC_SetBoardCornerRes: + return 0; + case RPCNames::GOBOTRPC_SetVacumOffsetReq: + return 8; + case RPCNames::GOBOTRPC_SetVacumOffsetRes: + return 0; + case RPCNames::GOBOTRPC_ReleaseMotorsReq: + return 1; + case RPCNames::GOBOTRPC_ReleaseMotorsRes: + return 0; + case RPCNames::GOBOTRPC_DropReq: + return 0; + case RPCNames::GOBOTRPC_DropRes: + return 1; + case RPCNames::GOBOTRPC_StoneStatusReq: + return 0; + case RPCNames::GOBOTRPC_StoneStatusRes: + return 1; + case RPCNames::GOBOTRPC_MoveZAxisReq: + return 1; + case RPCNames::GOBOTRPC_MoveZAxisRes: + return 0; + case RPCNames::GOBOTRPC_SetVacumReq: + return 1; + case RPCNames::GOBOTRPC_SetVacumRes: + return 0; + default: + return -1; + } +}; \ No newline at end of file diff --git a/gobotrpc/out/cpp/test/main.cpp b/gobotrpc/out/cpp/test/main.cpp new file mode 100644 index 0000000..80d5842 --- /dev/null +++ b/gobotrpc/out/cpp/test/main.cpp @@ -0,0 +1,14 @@ +#include + +TEST(DummyTest, BasicAssertions) { +// Expect two strings not to be equal. +EXPECT_STRNE("hello", "world"); +// Expect equality. +EXPECT_EQ(7 * 6, 42); +} + + +int main(int argc, char * argv[]) { + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} \ No newline at end of file diff --git a/gobotrpc/requirements.txt b/gobotrpc/requirements.txt index bcc2fe1..2e8987b 100644 --- a/gobotrpc/requirements.txt +++ b/gobotrpc/requirements.txt @@ -1,19 +1,9 @@ -Bottleneck @ file:///croot/bottleneck_1731058641041/work defusedxml==0.7.1 ezodf==0.3.2 Jinja2==3.1.5 lxml==5.3.0 MarkupSafe==3.0.2 mkl-service==2.4.0 -mkl_fft @ file:///io/mkl313/mkl_fft_1730824109137/work -mkl_random @ file:///io/mkl313/mkl_random_1730823916628/work -numexpr @ file:///croot/numexpr_1730215937391/work -numpy @ file:///croot/numpy_and_numpy_base_1725470312869/work/dist/numpy-2.0.1-cp312-cp312-linux_x86_64.whl#sha256=e2374991344fa2241a2153ef3d550d3a1cd2d50cb1f1d51eddc82870abc88021 odfpy==1.4.1 -pandas @ file:///croot/pandas_1732735089971/work/dist/pandas-2.2.3-cp312-cp312-linux_x86_64.whl#sha256=57b66702d418720ec8483f7c4ec7c08d41815316ad7ce09d5b7bbc34eefcfdfd -python-dateutil @ file:///croot/python-dateutil_1716495738603/work -pytz @ file:///croot/pytz_1713974312559/work setuptools==75.1.0 -six @ file:///tmp/build/80754af9/six_1644875935023/work -tzdata @ file:///croot/python-tzdata_1690578112552/work wheel==0.44.0 diff --git a/spec/gobot-spec/.obsidian/workspace.json b/spec/gobot-spec/.obsidian/workspace.json index 428f6dc..14287cb 100644 --- a/spec/gobot-spec/.obsidian/workspace.json +++ b/spec/gobot-spec/.obsidian/workspace.json @@ -34,9 +34,21 @@ "icon": "lucide-file", "title": "CAN Protocol" } + }, + { + "id": "cb5a4191e020890f", + "type": "leaf", + "state": { + "type": "release-notes", + "state": { + "currentVersion": "1.7.7" + }, + "icon": "lucide-file", + "title": "Release Notes 1.7.7" + } } ], - "currentTab": 1 + "currentTab": 2 } ], "direction": "vertical" @@ -178,7 +190,7 @@ "command-palette:Open command palette": false } }, - "active": "e41a6e6ed9e71bfa", + "active": "cb5a4191e020890f", "lastOpenFiles": [ "Untitled.canvas", "CAN Protocol.md",