From 648be70f7b676a618fa1753c486e8cb5f4a593f5 Mon Sep 17 00:00:00 2001 From: Aki Date: Thu, 21 Oct 2021 21:30:23 +0200 Subject: Moved library client to own file --- library/CMakeLists.txt | 1 + library/src/client.cpp | 12 ++++++++++++ library/src/client.h | 6 ++++++ library/src/gpio.cpp | 13 +++---------- 4 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 library/src/client.cpp create mode 100644 library/src/client.h (limited to 'library') 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 + +#include + + +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 & 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 +#include "hwd.h" -#include +#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 -- cgit v1.1