summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barth <msbarth@us.ibm.com>2017-06-02 15:20:56 -0500
committerMatthew Barth <msbarth@us.ibm.com>2017-06-26 09:19:56 -0500
commitcec5ab766709af9b713f94576b6f05bf63fc0718 (patch)
tree131c6efb4e1a9894b35542f14e7fd4a9d31bea8f
parentb751f32d06cb8804bdd4344f3868ca284c0c9e68 (diff)
downloadphosphor-fan-presence-cec5ab766709af9b713f94576b6f05bf63fc0718.tar.gz
phosphor-fan-presence-cec5ab766709af9b713f94576b6f05bf63fc0718.zip
Add interface to uniquely identify properties
The interface is needed on the properties stored to uniquely identify each property used in events. Change-Id: Ia062f25514d7ed04ef1023a02eecad4738711ffb Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
-rw-r--r--control/actions.hpp1
-rwxr-xr-xcontrol/gen-fan-zone-defs.py1
-rw-r--r--control/handlers.hpp5
-rw-r--r--control/zone.cpp1
-rw-r--r--control/zone.hpp13
5 files changed, 16 insertions, 5 deletions
diff --git a/control/actions.hpp b/control/actions.hpp
index 96da323..21d9365 100644
--- a/control/actions.hpp
+++ b/control/actions.hpp
@@ -35,6 +35,7 @@ auto count_state_before_speed(size_t count, bool state, uint64_t speed)
{
return zone.getPropertyValue(
entry.first,
+ std::get<intfPos>(entry.second),
std::get<propPos>(entry.second)) == state;
});
// Update group's fan control active allowed based on action results
diff --git a/control/gen-fan-zone-defs.py b/control/gen-fan-zone-defs.py
index 694477b..20c1534 100755
--- a/control/gen-fan-zone-defs.py
+++ b/control/gen-fan-zone-defs.py
@@ -95,6 +95,7 @@ const std::vector<ZoneGroup> Manager::_zoneLayouts
"${s['property']}",
handler::setProperty<${s['type']}>(
"${s['member']}",
+ "${s['interface']}",
"${s['property']}"
)
))
diff --git a/control/handlers.hpp b/control/handlers.hpp
index 0503c53..79c299b 100644
--- a/control/handlers.hpp
+++ b/control/handlers.hpp
@@ -15,17 +15,18 @@ namespace handler
* an object's path and property names
*
* @param[in] path - Object's path name
+ * @param[in] interface - Object's interface name
* @param[in] property - Object's property name
*
* @return Lambda function
* A lambda function to set/update the property value
*/
template <typename T>
-auto setProperty(const char* path, const char* property)
+auto setProperty(const char* path, const char* interface, const char* property)
{
return [=](auto& zone, T&& arg)
{
- zone.setPropertyValue(path, property, std::forward<T>(arg));
+ zone.setPropertyValue(path, interface, property, std::forward<T>(arg));
};
}
diff --git a/control/zone.cpp b/control/zone.cpp
index 849cd91..7a61c77 100644
--- a/control/zone.cpp
+++ b/control/zone.cpp
@@ -58,6 +58,7 @@ Zone::Zone(Mode mode,
std::get<propPos>(entry.second),
value);
setPropertyValue(entry.first.c_str(),
+ std::get<intfPos>(entry.second).c_str(),
std::get<propPos>(entry.second).c_str(),
value);
}
diff --git a/control/zone.hpp b/control/zone.hpp
index 5825b52..bd6e080 100644
--- a/control/zone.hpp
+++ b/control/zone.hpp
@@ -82,28 +82,32 @@ class Zone
* @brief Sets a given object's property value
*
* @param[in] object - Name of the object containing the property
+ * @param[in] interface - Interface name containing the property
* @param[in] property - Property name
* @param[in] value - Property value
*/
void setPropertyValue(const char* object,
+ const char* interface,
const char* property,
bool value)
{
- _properties[object][property] = value;
+ _properties[object][interface][property] = value;
};
/**
* @brief Get the value of an object's property
*
* @param[in] object - Name of the object containing the property
+ * @param[in] interface - Interface name containing the property
* @param[in] property - Property name
*
* @return - The property value
*/
inline auto getPropertyValue(const std::string& object,
+ const std::string& interface,
const std::string& property)
{
- return _properties[object][property];
+ return _properties[object][interface][property];
};
private:
@@ -136,7 +140,10 @@ class Zone
/**
* @brief Map of object property values
*/
- std::map<std::string, std::map<std::string, bool>> _properties;
+ std::map<std::string,
+ std::map<std::string,
+ std::map<std::string,
+ bool>>> _properties;
/**
* @brief Map of active fan control allowed by groups
OpenPOWER on IntegriCloud