diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2016-04-12 20:06:47 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2016-04-12 20:06:47 +0200 |
commit | 2ca532122d60cff4dbdc7f24fbc5783bcc5ad68d (patch) | |
tree | 19f9ce796886e216a608fa5e938bd2bd4f0d0b55 /apps/sm-get-value.cpp | |
parent | ce07550c57172443c10a66957b50085e273d20b3 (diff) | |
download | ble-toys-2ca532122d60cff4dbdc7f24fbc5783bcc5ad68d.tar.gz ble-toys-2ca532122d60cff4dbdc7f24fbc5783bcc5ad68d.tar.bz2 ble-toys-2ca532122d60cff4dbdc7f24fbc5783bcc5ad68d.tar.xz ble-toys-2ca532122d60cff4dbdc7f24fbc5783bcc5ad68d.zip |
Soil Moisture: Adding support for controlling lights.
Bluetooth: refectorying, trying to be more c++ idiomatic and modern.
SM/Diller: adding bluetooth to Diller bridge.
Diffstat (limited to 'apps/sm-get-value.cpp')
-rw-r--r-- | apps/sm-get-value.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/apps/sm-get-value.cpp b/apps/sm-get-value.cpp index 0572155..42f5da3 100644 --- a/apps/sm-get-value.cpp +++ b/apps/sm-get-value.cpp @@ -35,9 +35,9 @@ public: vector<pair<unsigned int, string>> sensors; KeyDictionary dict; - SampleKey *hostname_key = dict.indexOf("hostname"); - SampleKey *device_key = dict.indexOf("device"); - SampleKey *timestamp_key = dict.indexOf("timestamp_ms"); + const SampleKey *hostname_key = dict.indexOf("hostname"); + const SampleKey *device_key = dict.indexOf("device"); + const 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); @@ -96,10 +96,10 @@ public: } while (loop); return EXIT_SUCCESS; - } catch (std::runtime_error ex) { + } catch (std::runtime_error &ex) { cout << "std::runtime_error: " << ex.what() << endl; return EXIT_FAILURE; - } catch (std::exception ex) { + } catch (std::exception &ex) { cout << "std::exception: " << ex.what() << endl; return EXIT_FAILURE; } @@ -118,7 +118,7 @@ public: auto tempO = soilMoisture.readTemperature(); if (tempO) { - sample.set(dict.indexOf("temperature"), std::to_string(tempO.get())); + sample.set(dict.indexOf("temperature"), std::to_string(tempO.value())); } int i = 0; |