diff options
-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 |