#ifndef INCLUDE_DI_RPC_CLASS_SENSOR_H_ #define INCLUDE_DI_RPC_CLASS_SENSOR_H_ #include #include #include #include namespace Di { namespace Rpc { class Sensor : public Msg { public: enum Type { SENSOR_TYPE_UNKNOWN, SENSOR_TYPE_STRING, SENSOR_TYPE_NUMBER, SENSOR_TYPE_DOUBLE, SENSOR_TYPE_BOOL, SENSOR_TYPE_OBJECT }; struct sensorInfo { unsigned int id; std::string label; std::string type; }; struct sensorData { unsigned int id; uint64_t time; Type type; std::shared_ptr value; }; std::vector sensorInfoList; std::vector sensorDataList; explicit Sensor(std::shared_ptr msg); static std::string getStringValue(const struct sensorData &message); static int64_t getNumberValue(const struct sensorData &message); static double getDoubleValue(const struct sensorData &message); static bool getBoolValue(const struct sensorData &message); static std::shared_ptr getObjectValue(const struct sensorData &message); private: void __decodePublish(std::shared_ptr message); void __decodeMethodInfo(std::shared_ptr message); unsigned int __getID(std::shared_ptr message); uint64_t __getTime(std::shared_ptr message); std::string __getType(std::shared_ptr message); std::string __getLabel(std::shared_ptr message); std::string __getDescr(std::shared_ptr message); }; } // namespace Rpc } // namespace Di #endif // INCLUDE_DI_RPC_CLASS_SENSOR_H_