Example #1
0
UIntN ActivePolicy::findTripPointCrossed(SpecificInfo& tripPoints, const Temperature& temperature)
{
    auto trips = tripPoints.getSortedByKey();
    for (UIntN index = 0; index < trips.size(); index++)
    {
        if (temperature.getTemperature() >= trips[index].second)
        {
            UIntN acIndex = trips[index].first - ParticipantSpecificInfoKey::AC0;
            return acIndex;
        }
    }
    return Constants::Invalid;
}
Example #2
0
UIntN ActivePolicy::determineUpperTemperatureThreshold(const Temperature& currentTemperature, SpecificInfo& tripPoints) const
{
    auto trips = tripPoints.getSortedByKey();
    UIntN upperTemperatureThreshold = Constants::Invalid;
    for (UIntN ac = 0; ac < trips.size(); ++ac)
    {
        if ((currentTemperature.getTemperature() < trips[ac].second) &&
            (trips[ac].second != Constants::Invalid))
        {
            upperTemperatureThreshold = trips[ac].second;
        }
    }
    return upperTemperatureThreshold;
}
Example #3
0
UIntN ActivePolicy::determineLowerTemperatureThreshold(const Temperature& currentTemperature, SpecificInfo& tripPoints) const
{
    auto trips = tripPoints.getSortedByKey();
    UIntN lowerTemperatureThreshold = Constants::Invalid;
    for (UIntN ac = 0; ac < trips.size(); ++ac)
    {
        if (currentTemperature.getTemperature() >= trips[ac].second)
        {
            lowerTemperatureThreshold = trips[ac].second;
            break;
        }
    }
    return lowerTemperatureThreshold;
}
void ParticipantGetSpecificInfo_001::RequestPrimitiveTemperatureAndAddToMap(esif_primitive_type primitive,
    ParticipantSpecificInfoKey::Type key, std::map<ParticipantSpecificInfoKey::Type, UIntN>& resultMap,
    UIntN instance)
{
    try
    {
        Temperature temp = m_participantServicesInterface->primitiveExecuteGetAsTemperatureC(primitive,
            Constants::Esif::NoDomain, static_cast<UInt8>(instance));
        resultMap.insert(std::pair<ParticipantSpecificInfoKey::Type, UIntN>(key, temp.getTemperature()));
    }
    catch (...)
    {
        // if the primitive isn't available we receive an exception and we don't add this item to the map
    }
}