diff options
author | Aki <please@ignore.pl> | 2021-10-21 21:30:23 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2021-10-21 21:33:03 +0200 |
commit | 648be70f7b676a618fa1753c486e8cb5f4a593f5 (patch) | |
tree | ab4abb204815016a1ba9552291f46f01ad892af0 /library | |
parent | 439f76609407da15096c1f2835b8eb7034211c88 (diff) | |
download | hwd-648be70f7b676a618fa1753c486e8cb5f4a593f5.zip hwd-648be70f7b676a618fa1753c486e8cb5f4a593f5.tar.gz hwd-648be70f7b676a618fa1753c486e8cb5f4a593f5.tar.bz2 |
Moved library client to own file
Diffstat (limited to 'library')
-rw-r--r-- | library/CMakeLists.txt | 1 | ||||
-rw-r--r-- | library/src/client.cpp | 12 | ||||
-rw-r--r-- | library/src/client.h | 6 | ||||
-rw-r--r-- | library/src/gpio.cpp | 13 |
4 files changed, 22 insertions, 10 deletions
diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index a652762..e35c1f4 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -1,5 +1,6 @@ project(library CXX) add_library(${PROJECT_NAME} SHARED + src/client.cpp src/gpio.cpp ) target_link_libraries(${PROJECT_NAME} diff --git a/library/src/client.cpp b/library/src/client.cpp new file mode 100644 index 0000000..187f36e --- /dev/null +++ b/library/src/client.cpp @@ -0,0 +1,12 @@ +#include "client.h" + +#include <rpc/client.h> + +#include <hwd/internal.h> + + +rpc::client & get_client() +{ + static rpc::client c(hwd::internal::host(), hwd::internal::port()); + return c; +} diff --git a/library/src/client.h b/library/src/client.h new file mode 100644 index 0000000..502e05f --- /dev/null +++ b/library/src/client.h @@ -0,0 +1,6 @@ +#pragma once + +#include <rpc/client.h> + + +rpc::client & get_client(); diff --git a/library/src/gpio.cpp b/library/src/gpio.cpp index 18c3cff..e31a845 100644 --- a/library/src/gpio.cpp +++ b/library/src/gpio.cpp @@ -1,16 +1,10 @@ -#include <rpc/client.h> +#include "hwd.h" -#include <hwd/internal.h> +#include "client.h" -namespace hwd -{ -static rpc::client & get_client() +namespace hwd { - static rpc::client c(hwd::internal::host(), hwd::internal::port()); - return c; -} - namespace gpio { @@ -30,5 +24,4 @@ short read(const unsigned port) } } // namespace gpio - } // namespace hwd |