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
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
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
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