blob: 07c7897ddcf1c52df5d0410b65609f503db48bba [file] [log] [blame]
#pragma once
#include <chrono>
#include <memory>
#include <ostream>
#include <string>
#include <string_view>
#include <tuple>
namespace interfaces
{
class SensorListener;
class Sensor
{
public:
struct Id
{
Id(std::string_view type, std::string_view service,
std::string_view path) :
type(type),
service(service), path(path)
{}
std::string type;
std::string service;
std::string path;
bool operator<(const Id& other) const
{
return std::tie(type, service, path) <
std::tie(other.type, other.service, other.path);
}
inline std::string str() const
{
return type + ":" + service + ":" + path;
}
};
virtual ~Sensor() = default;
virtual Id id() const = 0;
virtual void registerForUpdates(const std::weak_ptr<SensorListener>&) = 0;
};
} // namespace interfaces