diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-09-29 13:51:43 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:04:02 -0800 |
commit | 21605b4e8b58053f4fa91a0a5136261da33e3bfb (patch) | |
tree | 551c8313dcff1047598bcf4a0f00cf0bdd9323e2 /host/include | |
parent | aeaea4936011665e2bbad66e1fdf4628e2b940f2 (diff) | |
download | uhd-21605b4e8b58053f4fa91a0a5136261da33e3bfb.tar.gz uhd-21605b4e8b58053f4fa91a0a5136261da33e3bfb.tar.bz2 uhd-21605b4e8b58053f4fa91a0a5136261da33e3bfb.zip |
types: sensor_value_t can now be created from map
- Adds unit tests for sensor_value_t also
Diffstat (limited to 'host/include')
-rw-r--r-- | host/include/uhd/types/sensors.hpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/host/include/uhd/types/sensors.hpp b/host/include/uhd/types/sensors.hpp index 6dede02dd..66501a7e9 100644 --- a/host/include/uhd/types/sensors.hpp +++ b/host/include/uhd/types/sensors.hpp @@ -8,6 +8,7 @@ #define INCLUDED_UHD_TYPES_SENSORS_HPP #include <uhd/config.hpp> +#include <map> #include <string> namespace uhd{ @@ -25,6 +26,7 @@ namespace uhd{ * //prints Temperature: 38.5 C */ struct UHD_API sensor_value_t{ + typedef std::map<std::string, std::string> sensor_map_t; /*! * Create a sensor value from a boolean. @@ -81,6 +83,18 @@ namespace uhd{ ); /*! + * Create a sensor value from a map. + * + * The map must have the following keys: name, type, value, and unit. + * + * type must one of the following strings: BOOLEAN, INTEGER, REALNUM, + * or STRING (see data_type_t). + */ + sensor_value_t( + const std::map<std::string, std::string> &sensor_dict + ); + + /*! * Create a sensor value from another sensor value. * \param source the source sensor value to copy */ |