Fix the Sensor Offset in the host_pdr_handler

The commit fixes the issue being faced by composite state
sensor for more than one element.

Prior to the fix the sensor offset was hardcoded to the last
sensor which works for the case when only one element is
there but for more than one element issue arises as always
the last sensor is updated.

The commit updates the sensor offset value iteratively.

RESOLVES : https://github.com/openbmc/pldm/issues/35

Change-Id: I94ce27af44266f3d10158e35d2b8caa366a8f3aa
Signed-off-by: Riya Dixit <riyadixitagra@gmail.com>
diff --git a/host-bmc/host_pdr_handler.cpp b/host-bmc/host_pdr_handler.cpp
index 52b6206..f201965 100644
--- a/host-bmc/host_pdr_handler.cpp
+++ b/host-bmc/host_pdr_handler.cpp
@@ -733,12 +733,13 @@
 
                     uint8_t eventState;
                     uint8_t previousEventState;
-                    uint8_t sensorOffset = comp_sensor_count - 1;
 
-                    for (size_t i = 0; i < comp_sensor_count; i++)
+                    for (uint8_t sensorOffset = 0;
+                         sensorOffset < comp_sensor_count; sensorOffset++)
                     {
-                        eventState = stateField[i].present_state;
-                        previousEventState = stateField[i].previous_state;
+                        eventState = stateField[sensorOffset].present_state;
+                        previousEventState =
+                            stateField[sensorOffset].previous_state;
 
                         emitStateSensorEventSignal(tid, sensorId, sensorOffset,
                                                    eventState,