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