1 #pragma once
2 
3 #include "data_types.hpp"
4 
5 namespace phosphor
6 {
7 namespace dbus
8 {
9 namespace monitoring
10 {
11 
12 /** @class Watch
13  *  @brief Watch interface.
14  *
15  *  The start method is invoked by main() on all watches of any type
16  *  at application startup, to allow watches to perform custom setup
17  *  or initialization.  Typical implementations might register dbus
18  *  callbacks or perform queries.
19  *
20  *  The callback method is invoked by main() on all watches of any
21  *  type at application startup, after all watches have performed
22  *  their setup.  Typical implementations will forward the call
23  *  to their associated callback.
24  */
25 class Watch
26 {
27   public:
28     Watch() = default;
29     Watch(const Watch&) = default;
30     Watch(Watch&&) = default;
31     Watch& operator=(const Watch&) = default;
32     Watch& operator=(Watch&&) = default;
33     virtual ~Watch() = default;
34 
35     /** @brief Start the watch. */
36     virtual void start() = 0;
37 
38     /** @brief Invoke the callback associated with the watch. */
39     virtual void callback(Context ctx) = 0;
40 
41     /** @brief Invoke the callback associated with the watch. */
42     virtual void callback(Context ctx, sdbusplus::message::message& msg){};
43 };
44 
45 } // namespace monitoring
46 } // namespace dbus
47 } // namespace phosphor
48