rtu: add read status register and event support

Add support to read the status registers and generate the appropriate
events.

Tested:
Unit Test -
```
> meson test -t 10 -C builddir/ --print-errorlogs --wrapper="valgrind --error-exitcode=1" test_events
ninja: Entering directory `/host/repos/Modbus/phosphor-modbus/builddir'
ninja: no work to do.
1/1 test_events        OK               9.69s

Ok:                1
Fail:              0
```

Tested on Qemu -
```
Apr 03 15:41:52 ventura phosphor-modbus-rtu[1654]: OPENBMC_MESSAGE_ID={"xyz.openbmc_project.Sensor.SensorFailure":{"SENSOR_NAME":"/xyz/openbmc_project/sensors/RPU_Coolant_Outlet_Thermometer_Status","_SOURCE":{"COLUMN":73,"FILE":"../git/common/ev
ents.cpp","FUNCTION":"sdbusplus::async::task<> phosphor::modbus::events::Events::generateSensorFailureEvent(sdbusplus::message::object_path, bool)","LINE":95,"PID":1654}}}
...
Apr 03 15:41:52 ventura phosphor-modbus-rtu[1654]: OPENBMC_MESSAGE_ID={"xyz.openbmc_project.Sensor.Threshold.ReadingCritical":{"READING_VALUE":1670.6000000000001,"SENSOR_NAME":"/xyz/openbmc_project/sensors/RPU_Coolant_Outlet_Temp_C","UNITS":"xyz
.openbmc_project.Sensor.Value.Unit.DegreesC","_SOURCE":{"COLUMN":67,"FILE":"../git/common/events.cpp","FUNCTION":"sdbusplus::async::task<> phosphor::modbus::events::Events::generateSensorReadingEvent(sdbusplus::message::object_path, phosphor::modbus::events::EventLevel, double, sdbusplus::common::xyz::openbmc_project::sensor::Value::Unit, bool)","LINE":48,"PID":1654}}}
```

Change-Id: Icd78f22cf07798d06916cc077ec3f8bfac9ee8d3
Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
diff --git a/rtu/device/base_device.hpp b/rtu/device/base_device.hpp
index a64d708..3a2f0a8 100644
--- a/rtu/device/base_device.hpp
+++ b/rtu/device/base_device.hpp
@@ -1,6 +1,7 @@
 #pragma once
 
 #include "base_config.hpp"
+#include "common/events.hpp"
 #include "modbus/modbus.hpp"
 #include "port/base_port.hpp"
 
@@ -15,6 +16,7 @@
 using SensorValueIntf =
     sdbusplus::aserver::xyz::openbmc_project::sensor::Value<Device>;
 using PortIntf = phosphor::modbus::rtu::port::BasePort;
+namespace EventIntf = phosphor::modbus::events;
 
 class BaseDevice
 {
@@ -22,18 +24,27 @@
     BaseDevice() = delete;
 
     explicit BaseDevice(sdbusplus::async::context& ctx,
-                        const config::Config& config, PortIntf& serialPort);
+                        const config::Config& config, PortIntf& serialPort,
+                        EventIntf::Events& events);
 
     auto readSensorRegisters() -> sdbusplus::async::task<void>;
 
   private:
     auto createSensors() -> void;
 
+    auto readStatusRegisters() -> sdbusplus::async::task<void>;
+
+    auto generateEvent(const config::StatusBit& statusBit,
+                       const sdbusplus::message::object_path& objectPath,
+                       double sensorValue, SensorValueIntf::Unit sensorUnit,
+                       bool statusAsserted) -> sdbusplus::async::task<void>;
+
     using sensors_map_t =
         std::unordered_map<std::string, std::unique_ptr<SensorValueIntf>>;
     sdbusplus::async::context& ctx;
     const config::Config config;
     PortIntf& serialPort;
+    EventIntf::Events& events;
     sensors_map_t sensors;
 };