Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# parameter-framework

[![Build Status](https://travis-ci.org/01org/parameter-framework.svg?branch=master)](https://travis-ci.org/01org/parameter-framework)
[![Coverage Status](https://coveralls.io/repos/01org/parameter-framework/badge.svg?branch=master)](https://coveralls.io/r/01org/parameter-framework)
[![Build Status](https://travis-ci.org/01org/parameter-framework.svg?branch=next)](https://travis-ci.org/01org/parameter-framework)
[![Coverage Status](https://coveralls.io/repos/01org/parameter-framework/badge.svg?branch=next)](https://coveralls.io/r/01org/parameter-framework)

## Introduction

Expand Down
22 changes: 16 additions & 6 deletions bindings/c/ParameterFramework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,24 @@ class LogWrapper : public CParameterMgrPlatformConnector::ILogger
LogWrapper() : mLogger() {}
virtual ~LogWrapper() {}
private:
virtual void log(bool bIsWarning, const string &strLog)
virtual void info(const string &msg)
{
log(pfwLogInfo, msg);
}

virtual void warning(const string &msg)
{
log(pfwLogWarning, msg);
}

void log(PfwLogLevel level, const string &strLog)
{
// A LogWrapper should NOT be register to the pfw (thus log called)
// if logCb is NULL.
assert(mLogger.logCb != NULL);
mLogger.logCb(mLogger.userCtx,
bIsWarning ? pfwLogWarning : pfwLogInfo,
strLog.c_str());
mLogger.logCb(mLogger.userCtx, level, strLog.c_str());
}

PfwLogger mLogger;
};

Expand Down Expand Up @@ -196,9 +205,10 @@ bool PfwHandler::createCriteria(const PfwCriterion criteriaArray[], size_t crite
value = valueIndex;
}
const char * valueName = criterion.values[valueIndex];
if(not type->addValuePair(value, valueName)) {
string error;
if(not type->addValuePair(value, valueName, error)) {
return status.failure("Could not add value " + string(valueName) +
" to criterion " + criterion.name);
" to criterion " + criterion.name + ": " + error);
}
}
// Create criterion and add it to the pfw
Expand Down
11 changes: 11 additions & 0 deletions bindings/c/Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,17 @@ TEST_CASE_METHOD(Test, "Parameter-framework c api use") {
REQUIRE(value == 3);
}
}
WHEN("Set a new value to a criterion without committing first") {
const char *criterionName = criteria[0].name;
REQUIRE_SUCCESS(pfwSetCriterion(pfw, criterionName, 0));
THEN("A warning message should have been displayed") {
INFO("Previous pfw log: \n" + logLines);
size_t logPos = logLines.find("Warning: Selection criterion "
"'inclusiveCrit' has been modified 1 time(s)"
" without any configuration application");
CHECK(logPos != std::string::npos);
}
}
}
WHEN("Commit criteria without a pfw") {
REQUIRE(not pfwApplyConfigurations(NULL));
Expand Down
5 changes: 3 additions & 2 deletions bindings/python/pfw.i
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ public:
class ILogger
{
public:
virtual void log(bool bIsWarning, const std::string& strLog) = 0;
virtual void info(const std::string& log) = 0;
virtual void warning(const std::string& log) = 0;
protected:
virtual ~ILogger() {}
};
Expand All @@ -197,7 +198,7 @@ class ISelectionCriterionTypeInterface
%}

public:
virtual bool addValuePair(int iValue, const std::string& strValue) = 0;
virtual bool addValuePair(int iValue, const std::string& strValue, std::string& strError) = 0;
virtual bool getNumericalValue(const std::string& strValue, int& iValue) const = 0;
virtual bool getLiteralValue(int iValue, std::string& strValue) const = 0;
virtual bool isTypeInclusive() const = 0;
Expand Down
9 changes: 6 additions & 3 deletions parameter/Android.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2011-2014, Intel Corporation
# Copyright (c) 2011-2015, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -44,7 +44,6 @@ common_copy_headers := \
common_src_files := \
AreaConfiguration.cpp \
ArrayParameter.cpp \
AutoLog.cpp \
BaseParameter.cpp \
BinarySerializableElement.cpp \
BinaryStream.cpp \
Expand Down Expand Up @@ -129,6 +128,7 @@ common_cflags := \

common_c_includes := \
$(LOCAL_PATH)/include/ \
$(LOCAL_PATH)/log/include/ \
$(LOCAL_PATH)/../utility/ \
$(LOCAL_PATH)/../xmlserializer/ \
$(LOCAL_PATH)/../remote-processor/
Expand Down Expand Up @@ -197,7 +197,10 @@ include $(CLEAR_VARS)
LOCAL_MODULE := $(common_module)_includes
LOCAL_MODULE_OWNER := intel

LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
LOCAL_EXPORT_C_INCLUDE_DIRS := \
$(LOCAL_PATH) \
$(LOCAL_PATH)/log/include


LOCAL_STATIC_LIBRARIES := \
libxmlserializer \
Expand Down
8 changes: 5 additions & 3 deletions parameter/AreaConfiguration.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2014, Intel Corporation
* Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -54,14 +54,16 @@ void CAreaConfiguration::save(const CParameterBlackboard* pMainBlackboard)
}

// Apply data to current
bool CAreaConfiguration::restore(CParameterBlackboard* pMainBlackboard, bool bSync, std::list<std::string>* plstrError) const
bool CAreaConfiguration::restore(CParameterBlackboard* pMainBlackboard,
bool bSync,
core::Results* errors) const
{
assert(_bValid);

copyTo(pMainBlackboard, _pConfigurableElement->getOffset());

// Synchronize if required
return !bSync || _pSyncerSet->sync(*pMainBlackboard, false, plstrError);
return !bSync || _pSyncerSet->sync(*pMainBlackboard, false, errors);
}

// Ensure validity
Expand Down
13 changes: 10 additions & 3 deletions parameter/AreaConfiguration.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2014, Intel Corporation
* Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -32,6 +32,7 @@
#include "ParameterBlackboard.h"
#include "BinaryStream.h"
#include "SyncerSet.h"
#include "Results.h"

class CConfigurableElement;
class CXmlElement;
Expand All @@ -48,8 +49,14 @@ class CAreaConfiguration
// Save data from current
void save(const CParameterBlackboard* pMainBlackboard);

// Apply data to current
bool restore(CParameterBlackboard* pMainBlackboard, bool bSync, std::list<std::string>* plstrError) const;
/** Restore the configuration area
*
* @param[in] pMainBlackboard the application main blackboard
* @param[in] bSync indicates if a synchronisation has to be done
* @param[out] errors, errors encountered during restoration
* @return true if success false otherwise
*/
bool restore(CParameterBlackboard* pMainBlackboard, bool bSync, core::Results* errors) const;

// Ensure validity
void validate(const CParameterBlackboard* pMainBlackboard);
Expand Down
8 changes: 5 additions & 3 deletions parameter/ArrayParameter.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2014, Intel Corporation
* Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -34,6 +34,7 @@
#include "ParameterAccessContext.h"
#include "ConfigurationAccessContext.h"
#include "ParameterBlackboard.h"
#include "Utility.h"
#include <assert.h>

#define base CParameter
Expand Down Expand Up @@ -62,7 +63,7 @@ void CArrayParameter::showProperties(string& strResult) const

// Array length
strResult += "Array length: ";
strResult += toString(getArrayLength());
strResult += CUtility::toString(getArrayLength());
strResult += "\n";
}

Expand Down Expand Up @@ -281,7 +282,8 @@ bool CArrayParameter::setValues(uint32_t uiStartIndex, uint32_t uiBaseOffset, co
if (!doSetValue(astrValues[uiValueIndex], uiOffset, parameterAccessContext)) {

// Append parameter path to error
parameterAccessContext.appendToError(" " + getPath() + "/" + toString(uiValueIndex + uiStartIndex));
parameterAccessContext.appendToError(" " + getPath() + "/" +
CUtility::toString(uiValueIndex + uiStartIndex));

return false;
}
Expand Down
5 changes: 3 additions & 2 deletions parameter/BitParameterBlockType.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2014, Intel Corporation
* Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -29,6 +29,7 @@
*/
#include "BitParameterBlockType.h"
#include "BitParameterBlock.h"
#include "Utility.h"

#define base CTypeElement

Expand Down Expand Up @@ -74,7 +75,7 @@ CInstanceConfigurableElement* CBitParameterBlockType::doInstantiate() const
void CBitParameterBlockType::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
{
// Size
xmlElement.setAttributeString("Size", toString(_uiSize * 8));
xmlElement.setAttributeString("Size", CUtility::toString(_uiSize * 8));

base::toXml(xmlElement, serializingContext);
}
15 changes: 8 additions & 7 deletions parameter/BitParameterType.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2014, Intel Corporation
* Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -33,6 +33,7 @@
#include <sstream>
#include "ParameterAccessContext.h"
#include "BitParameterBlockType.h"
#include "Utility.h"

#define base CTypeElement

Expand All @@ -55,17 +56,17 @@ void CBitParameterType::showProperties(string& strResult) const

// Bit Pos
strResult += "Bit pos: ";
strResult += toString(_uiBitPos);
strResult += CUtility::toString(_uiBitPos);
strResult += "\n";

// Bit size
strResult += "Bit size: ";
strResult += toString(_uiBitSize);
strResult += CUtility::toString(_uiBitSize);
strResult += "\n";

// Max
strResult += "Max: ";
strResult += toString(_uiMax);
strResult += CUtility::toString(_uiMax);
strResult += "\n";
}

Expand Down Expand Up @@ -245,13 +246,13 @@ bool CBitParameterType::isEncodable(uint64_t uiData) const
void CBitParameterType::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
{
// Position
xmlElement.setAttributeString("Pos", toString(_uiBitPos));
xmlElement.setAttributeString("Pos", CUtility::toString(_uiBitPos));

// Size
xmlElement.setAttributeString("Size", toString(_uiBitSize));
xmlElement.setAttributeString("Size", CUtility::toString(_uiBitSize));

// Maximum
xmlElement.setAttributeString("Max", toString(_uiMax));
xmlElement.setAttributeString("Max", CUtility::toString(_uiMax));

base::toXml(xmlElement, serializingContext);

Expand Down
11 changes: 6 additions & 5 deletions parameter/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2014, Intel Corporation
# Copyright (c) 2014-2015, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -29,7 +29,6 @@
add_library(parameter SHARED
AreaConfiguration.cpp
ArrayParameter.cpp
AutoLog.cpp
BaseParameter.cpp
BinarySerializableElement.cpp
BinaryStream.cpp
Expand Down Expand Up @@ -107,7 +106,8 @@ include_directories(
include
"${PROJECT_SOURCE_DIR}/xmlserializer"
"${PROJECT_SOURCE_DIR}/utility"
"${PROJECT_SOURCE_DIR}/remote-processor")
"${PROJECT_SOURCE_DIR}/remote-processor"
"${PROJECT_SOURCE_DIR}/parameter/log/include")

# No need to link with libremote-processor: it is accessed via dlopen()
find_library(dl dl)
Expand All @@ -125,7 +125,6 @@ install(FILES
DESTINATION "include/parameter/client")
# Core (plugin) headers
install(FILES
AutoLog.h
BitParameterBlockType.h
ConfigurableElement.h
ConfigurableElementWithMapping.h
Expand All @@ -138,7 +137,7 @@ install(FILES
InstanceConfigurableElement.h
Mapper.h
MappingContext.h
NamedElementBuilderTemplate.h
LoggingElementBuilderTemplate.h
ParameterBlockType.h
ParameterType.h
PathNavigator.h
Expand All @@ -151,3 +150,5 @@ install(FILES
TypeElement.h
VirtualSubsystem.h
DESTINATION "include/parameter/plugin")
install(DIRECTORY log/include/log/
DESTINATION "include/parameter/plugin/log")
Loading