aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2015-03-22 17:29:35 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2015-03-22 17:29:35 +0100
commitd7d545575250f616f0b9e2243e08544ab2794a03 (patch)
tree3ac666251499b8b665d82681920f1afee645cb51
parentaad1eaa291460509a5cf94092609ae22ebef5494 (diff)
downloadble-toys-d7d545575250f616f0b9e2243e08544ab2794a03.tar.gz
ble-toys-d7d545575250f616f0b9e2243e08544ab2794a03.tar.bz2
ble-toys-d7d545575250f616f0b9e2243e08544ab2794a03.tar.xz
ble-toys-d7d545575250f616f0b9e2243e08544ab2794a03.zip
o Renaming trygvis::soil_moisture to trygvis::sample.
-rw-r--r--README.md4
-rw-r--r--apps/SoilMoisture.cpp2
-rw-r--r--apps/SoilMoisture.h7
-rw-r--r--apps/apps.h5
-rw-r--r--apps/sample-convert.cpp6
-rw-r--r--apps/sample-select.cpp4
-rw-r--r--apps/sample-timestamp.cpp4
-rw-r--r--apps/sm-get-value.cpp4
-rw-r--r--apps/sm-serial-read-all.cpp4
-rw-r--r--apps/sm-serial-read.cpp4
-rw-r--r--sensor/CMakeLists.txt5
-rw-r--r--sensor/include/trygvis/SensorSample.h (renamed from sensor/include/SensorSample.h)8
-rw-r--r--sensor/main/SensorSample.cpp6
13 files changed, 29 insertions, 34 deletions
diff --git a/README.md b/README.md
index ec9c88c..e4603e4 100644
--- a/README.md
+++ b/README.md
@@ -8,3 +8,7 @@ Building:
make -j
This will build a Debug release by default. Add `-DCMAKE_BUILD_TYPE=Release` to build a release build.
+
+# CMake notes
+
+Header files are added as sources so the IDEs will search/index them properly.
diff --git a/apps/SoilMoisture.cpp b/apps/SoilMoisture.cpp
index f998d74..89c2fe5 100644
--- a/apps/SoilMoisture.cpp
+++ b/apps/SoilMoisture.cpp
@@ -1,7 +1,7 @@
#include "SoilMoisture.h"
namespace trygvis {
-namespace soil_moisture {
+namespace sensor {
#define BLUETOOTH_UUID_INITIALIZER \
{ \
diff --git a/apps/SoilMoisture.h b/apps/SoilMoisture.h
index ea64032..2016c9a 100644
--- a/apps/SoilMoisture.h
+++ b/apps/SoilMoisture.h
@@ -1,11 +1,10 @@
-#ifndef SOIL_MOISTURE_H
-#define SOIL_MOISTURE_H
+#pragma once
#include <ble/Bluetooth.h>
#include <boost/uuid/uuid.hpp>
namespace trygvis {
-namespace soil_moisture {
+namespace sensor {
using namespace trygvis::bluetooth;
@@ -43,5 +42,3 @@ private:
}
}
-
-#endif
diff --git a/apps/apps.h b/apps/apps.h
index 03ec68f..727e554 100644
--- a/apps/apps.h
+++ b/apps/apps.h
@@ -1,5 +1,4 @@
-#ifndef UTILS_H
-#define UTILS_H
+#pragma once
#include <boost/program_options.hpp>
@@ -47,5 +46,3 @@ static inline void noop_deleter(void *) {
}
}
-
-#endif
diff --git a/apps/sample-convert.cpp b/apps/sample-convert.cpp
index 4834732..6ce83e8 100644
--- a/apps/sample-convert.cpp
+++ b/apps/sample-convert.cpp
@@ -1,4 +1,4 @@
-#include "SensorSample.h"
+#include "trygvis/SensorSample.h"
#include "json.hpp"
#include "apps.h"
#include <fstream>
@@ -9,7 +9,7 @@ namespace apps {
using namespace std;
using namespace trygvis::apps;
-using namespace trygvis::soil_moisture;
+using namespace trygvis::sensor;
using boost::tokenizer;
namespace po = boost::program_options;
@@ -66,7 +66,7 @@ public:
}
std::vector<sample_output_stream_option *> options;
- trygvis::soil_moisture::timestamp_field tf(timestamp_field);
+ trygvis::sensor::timestamp_field tf(timestamp_field);
if (!timestamp_field.empty()) {
options.push_back(&tf);
diff --git a/apps/sample-select.cpp b/apps/sample-select.cpp
index 8180709..fc50f41 100644
--- a/apps/sample-select.cpp
+++ b/apps/sample-select.cpp
@@ -1,4 +1,4 @@
-#include "SensorSample.h"
+#include "trygvis/SensorSample.h"
#include "apps.h"
#include <boost/tokenizer.hpp>
@@ -7,7 +7,7 @@ namespace apps {
using namespace std;
using namespace trygvis::apps;
-using namespace trygvis::soil_moisture;
+using namespace trygvis::sensor;
using boost::tokenizer;
namespace po = boost::program_options;
diff --git a/apps/sample-timestamp.cpp b/apps/sample-timestamp.cpp
index 018ecb0..c95f7a3 100644
--- a/apps/sample-timestamp.cpp
+++ b/apps/sample-timestamp.cpp
@@ -1,4 +1,4 @@
-#include "SensorSample.h"
+#include "trygvis/SensorSample.h"
#include "apps.h"
#include <fstream>
#include <sys/stat.h>
@@ -8,7 +8,7 @@ namespace apps {
using namespace std;
using namespace trygvis::apps;
-using namespace trygvis::soil_moisture;
+using namespace trygvis::sensor;
namespace po = boost::program_options;
enum class time_resolution {
diff --git a/apps/sm-get-value.cpp b/apps/sm-get-value.cpp
index b8fa983..25f1c3e 100644
--- a/apps/sm-get-value.cpp
+++ b/apps/sm-get-value.cpp
@@ -5,7 +5,7 @@
#include <thread>
#include "ble/Bluetooth.h"
#include "SoilMoisture.h"
-#include "SensorSample.h"
+#include "trygvis/SensorSample.h"
#include "json.hpp"
#include "apps.h"
@@ -14,7 +14,7 @@ using namespace std;
using namespace std::chrono;
using namespace trygvis::apps;
using namespace trygvis::bluetooth;
-using namespace trygvis::soil_moisture;
+using namespace trygvis::sensor;
namespace po = boost::program_options;
using json = nlohmann::json;
diff --git a/apps/sm-serial-read-all.cpp b/apps/sm-serial-read-all.cpp
index 7241864..eb1f112 100644
--- a/apps/sm-serial-read-all.cpp
+++ b/apps/sm-serial-read-all.cpp
@@ -1,4 +1,4 @@
-#include "SensorSample.h"
+#include "trygvis/SensorSample.h"
#include "json.hpp"
#include "apps.h"
#include <thread>
@@ -11,7 +11,7 @@ using namespace boost::asio;
using namespace std;
using namespace std::chrono;
using namespace trygvis::apps;
-using namespace trygvis::soil_moisture;
+using namespace trygvis::sensor;
namespace po = boost::program_options;
using json = nlohmann::json;
diff --git a/apps/sm-serial-read.cpp b/apps/sm-serial-read.cpp
index a8d528a..68cdea7 100644
--- a/apps/sm-serial-read.cpp
+++ b/apps/sm-serial-read.cpp
@@ -1,4 +1,4 @@
-#include "SensorSample.h"
+#include "trygvis/SensorSample.h"
#include "json.hpp"
#include "apps.h"
#include <chrono>
@@ -12,7 +12,7 @@ using namespace boost::asio;
using namespace std;
using namespace std::chrono;
using namespace trygvis::apps;
-using namespace trygvis::soil_moisture;
+using namespace trygvis::sensor;
namespace po = boost::program_options;
using json = nlohmann::json;
diff --git a/sensor/CMakeLists.txt b/sensor/CMakeLists.txt
index 5d7612f..7cee42b 100644
--- a/sensor/CMakeLists.txt
+++ b/sensor/CMakeLists.txt
@@ -1,5 +1,8 @@
+file(GLOB INCLUDES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} include/*.h)
+
add_library(trygvis-sensor
- main/SensorSample.cpp)
+ main/SensorSample.cpp
+ ${INCLUDES})
include_directories("${PROJECT_SOURCE_DIR}/json/src")
include_directories(include)
diff --git a/sensor/include/SensorSample.h b/sensor/include/trygvis/SensorSample.h
index 386296a..438e2ae 100644
--- a/sensor/include/SensorSample.h
+++ b/sensor/include/trygvis/SensorSample.h
@@ -1,5 +1,4 @@
-#ifndef SOIL_MOISTURE_IO_H
-#define SOIL_MOISTURE_IO_H
+#pragma once
#include <ostream>
#include <vector>
@@ -12,9 +11,8 @@
#include <functional>
#include <mutex>
-// TODO: rename to trygvis::sample
namespace trygvis {
-namespace soil_moisture {
+namespace sensor {
using namespace std;
using namespace boost::asio;
@@ -423,5 +421,3 @@ public:
}
}
-
-#endif
diff --git a/sensor/main/SensorSample.cpp b/sensor/main/SensorSample.cpp
index 6ec6dfc..5f0e9c6 100644
--- a/sensor/main/SensorSample.cpp
+++ b/sensor/main/SensorSample.cpp
@@ -1,4 +1,4 @@
-#include "SensorSample.h"
+#include "trygvis/SensorSample.h"
#include "json.hpp"
#include <set>
@@ -6,7 +6,7 @@
#include <chrono>
namespace trygvis {
-namespace soil_moisture {
+namespace sensor {
using namespace std;
using json = nlohmann::json;
@@ -441,11 +441,9 @@ unique_ptr<SampleOutputStream> open_sample_output_stream(
}
}
-//template<typename T>
ThreadSafeSampleOutputStream::ThreadSafeSampleOutputStream(unique_ptr<SampleOutputStream> underlying) : underlying(move(underlying)) {
}
-//template<typename T>
void ThreadSafeSampleOutputStream::write(SampleRecord const &sample) {
std::unique_lock<std::mutex> lock(mutex);