From 0374af511d7efdb856af372f126e66e5a78841d7 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 19 Jul 2015 20:02:00 +0200 Subject: o Applying clang-format to all apps. --- apps/sm-get-value.h | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) (limited to 'apps/sm-get-value.h') diff --git a/apps/sm-get-value.h b/apps/sm-get-value.h index c98d1d4..5893d23 100644 --- a/apps/sm-get-value.h +++ b/apps/sm-get-value.h @@ -21,7 +21,6 @@ using namespace trygvis::sensor; using namespace trygvis::sensor::io; class sm_get_value : public app { - public: sm_get_value() : app("sm-get-value") { } @@ -35,25 +34,24 @@ public: vector> sensors; KeyDictionary dict; - SampleKey* hostname_key = dict.indexOf("hostname"); - SampleKey* device_key = dict.indexOf("device"); - SampleKey* timestamp_key = dict.indexOf("timestamp_ms"); + SampleKey *hostname_key = dict.indexOf("hostname"); + SampleKey *device_key = dict.indexOf("device"); + SampleKey *timestamp_key = dict.indexOf("timestamp_ms"); void add_options(po::options_description_easy_init &options) override { auto default_sleep = po::value<>(&sleepTime)->default_value(0); auto default_format = po::value(&format)->default_value(sample_format_type::KEY_VALUE); - options - ("device", po::value()->required(), "MAC of device to poll") - ("sensor", po::value>(&sensorIndexes)->multitoken(), "Sensor to poll, defaults to all") - ("sleep", default_sleep, - "How long to sleep in seconds between each poll. If not given, it will exit after first poll") - ("format", default_format, "Output format"); + options("device", po::value()->required(), "MAC of device to poll"); + options("sensor", po::value>(&sensorIndexes)->multitoken(), + "Sensor to poll, defaults to all"); + options("sleep", default_sleep, + "How long to sleep in seconds between each poll. If not given, it will exit after first poll"); + options("format", default_format, "Output format"); } int main(app_execution &execution) override { - __attribute__((unused)) - BluetoothSystem bluetoothSystem; + __attribute__((unused)) BluetoothSystem bluetoothSystem; auto desc = execution.desc; auto vm = execution.vm; @@ -86,7 +84,8 @@ public: } if (loop) { - LOG4CPLUS_DEBUG(execution.logger, "Sleeping for " + std::to_string(sleepTime) + " seconds after failure."); + LOG4CPLUS_DEBUG(execution.logger, + "Sleeping for " + std::to_string(sleepTime) + " seconds after failure."); auto targetTime = system_clock::now() + seconds(sleepTime); this_thread::sleep_until(targetTime); @@ -106,8 +105,7 @@ public: void read_sensors(SoilMoisture &soilMoisture, string mac) { auto epoch = system_clock::now().time_since_epoch(); auto timestamp = duration_cast(epoch).count(); - auto unique_output_stream = open_sample_output_stream(shared_ptr(&cout, noop_deleter), - dict, format); + auto unique_output_stream = open_sample_output_stream(shared_ptr(&cout, noop_deleter), dict, format); shared_ptr output_stream{std::move(unique_output_stream)}; int i = 0; @@ -121,11 +119,11 @@ public: auto sensor_name_key = dict.indexOf("sensor_name" + std::to_string(i)); auto sample = SampleRecord(dict) - .set(hostname_key, get_hostname()) - .set(device_key, mac) - .set(timestamp_key, std::to_string(timestamp)) - .set(sensor_key, std::to_string(value)) - .set(sensor_name_key, name); + .set(hostname_key, get_hostname()) + .set(device_key, mac) + .set(timestamp_key, std::to_string(timestamp)) + .set(sensor_key, std::to_string(value)) + .set(sensor_name_key, name); output_stream->write(sample); @@ -178,6 +176,5 @@ public: } } }; - } } -- cgit v1.2.3