summaryrefslogtreecommitdiffstats
path: root/dbus/dbusactiveread.hpp
blob: 235f038afac7ae03186a6b023e210e81e9dab4c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once

#include "interfaces.hpp"
#include "util.hpp"

#include <memory>
#include <sdbusplus/bus.hpp>
#include <string>

/*
 * This ReadInterface will actively reach out over dbus upon calling read to
 * get the value from whomever owns the associated dbus path.
 */
class DbusActiveRead : public ReadInterface
{
  public:
    DbusActiveRead(sdbusplus::bus::bus& bus, const std::string& path,
                   const std::string& service, DbusHelperInterface* helper) :
        ReadInterface(),
        _bus(bus), _path(path), _service(service), _helper(helper)
    {
    }

    ReadReturn read(void) override;

  private:
    sdbusplus::bus::bus& _bus;
    const std::string _path;
    const std::string _service; // the sensor service.
    DbusHelperInterface* _helper;
};
OpenPOWER on IntegriCloud