diff options
author | David Wagner <david.wagner@intel.com> | 2014-06-25 11:36:45 +0200 |
---|---|---|
committer | David Wagner <david.wagner@intel.com> | 2014-06-25 11:36:45 +0200 |
commit | bf2f826f20b355f579ab8967ec38b794bbb2a868 (patch) | |
tree | e19fcfd40bca485acee5735a0a132f2575fd180a | |
parent | fb474cce72215e432308264ada9c5a7197a21125 (diff) | |
parent | 0fbd572ff8095725b47a69f08134d5efbc1336e8 (diff) | |
download | external_parameter-framework-bf2f826f20b355f579ab8967ec38b794bbb2a868.zip external_parameter-framework-bf2f826f20b355f579ab8967ec38b794bbb2a868.tar.gz external_parameter-framework-bf2f826f20b355f579ab8967ec38b794bbb2a868.tar.bz2 |
Merge pull request #9 from 01org/dev-features
Realign from internal tree
55 files changed, 2346 insertions, 308 deletions
diff --git a/Schemas/Android.mk b/Schemas/Android.mk new file mode 100644 index 0000000..8ebfb3d --- /dev/null +++ b/Schemas/Android.mk @@ -0,0 +1,119 @@ +# INTEL CONFIDENTIAL +# Copyright (c) 2014 Intel +# Corporation All Rights Reserved. +# +# The source code contained or described herein and all documents related to +# the source code ("Material") are owned by Intel Corporation or its suppliers +# or licensors. Title to the Material remains with Intel Corporation or its +# suppliers and licensors. The Material contains trade secrets and proprietary +# and confidential information of Intel or its suppliers and licensors. The +# Material is protected by worldwide copyright and trade secret laws and +# treaty provisions. No part of the Material may be used, copied, reproduced, +# modified, published, uploaded, posted, transmitted, distributed, or +# disclosed in any way without Intel's prior express written permission. +# +# No license under any patent, copyright, trade secret or other intellectual +# property right is granted to or conferred upon you by disclosure or delivery +# of the Materials, either expressly, by implication, inducement, estoppel or +# otherwise. Any license under such intellectual property rights must be +# express and approved by Intel in writing. + +LOCAL_PATH := $(call my-dir) + +# Resources are not compiled so the prebuild mechanism is used to export them. +# Schemas are only used by host, in order to validate xml files +################################################## + +include $(CLEAR_VARS) +LOCAL_MODULE := ParameterFrameworkConfiguration.xsd +LOCAL_SRC_FILES := $(LOCAL_MODULE) +LOCAL_MODULE_CLASS = ETC +LOCAL_MODULE_PATH := $(HOST_OUT)/etc/parameter-framework/Schemas +LOCAL_IS_HOST_MODULE := true +include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := ConfigurableDomains.xsd +LOCAL_SRC_FILES := $(LOCAL_MODULE) +LOCAL_MODULE_CLASS = ETC +LOCAL_MODULE_PATH := $(HOST_OUT)/etc/parameter-framework/Schemas +LOCAL_IS_HOST_MODULE := true +LOCAL_REQUIRED_MODULES := \ + ParameterSettings.xsd +include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := SystemClass.xsd +LOCAL_SRC_FILES := $(LOCAL_MODULE) +LOCAL_MODULE_CLASS = ETC +LOCAL_MODULE_PATH := $(HOST_OUT)/etc/parameter-framework/Schemas +LOCAL_IS_HOST_MODULE := true +LOCAL_REQUIRED_MODULES := \ + FileIncluder.xsd \ + Subsystem.xsd +include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := ParameterSettings.xsd +LOCAL_SRC_FILES := $(LOCAL_MODULE) +LOCAL_MODULE_CLASS = ETC +LOCAL_MODULE_PATH := $(HOST_OUT)/etc/parameter-framework/Schemas +LOCAL_IS_HOST_MODULE := true +include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := FileIncluder.xsd +LOCAL_SRC_FILES := $(LOCAL_MODULE) +LOCAL_MODULE_CLASS = ETC +LOCAL_MODULE_PATH := $(HOST_OUT)/etc/parameter-framework/Schemas +LOCAL_IS_HOST_MODULE := true +include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := Subsystem.xsd +LOCAL_SRC_FILES := $(LOCAL_MODULE) +LOCAL_MODULE_CLASS = ETC +LOCAL_MODULE_PATH := $(HOST_OUT)/etc/parameter-framework/Schemas +LOCAL_IS_HOST_MODULE := true +LOCAL_REQUIRED_MODULES := \ + ComponentLibrary.xsd +include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := ComponentLibrary.xsd +LOCAL_SRC_FILES := $(LOCAL_MODULE) +LOCAL_MODULE_CLASS = ETC +LOCAL_MODULE_PATH := $(HOST_OUT)/etc/parameter-framework/Schemas +LOCAL_IS_HOST_MODULE := true +LOCAL_REQUIRED_MODULES := \ + ComponentTypeSet.xsd \ + W3cXmlAttributes.xsd +include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := ComponentTypeSet.xsd +LOCAL_SRC_FILES := $(LOCAL_MODULE) +LOCAL_MODULE_CLASS = ETC +LOCAL_MODULE_PATH := $(HOST_OUT)/etc/parameter-framework/Schemas +LOCAL_IS_HOST_MODULE := true +LOCAL_REQUIRED_MODULES := \ + Parameter.xsd \ + W3cXmlAttributes.xsd +include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := W3cXmlAttributes.xsd +LOCAL_SRC_FILES := $(LOCAL_MODULE) +LOCAL_MODULE_CLASS = ETC +LOCAL_MODULE_PATH := $(HOST_OUT)/etc/parameter-framework/Schemas +LOCAL_IS_HOST_MODULE := true +include $(BUILD_PREBUILT) + +include $(CLEAR_VARS) +LOCAL_MODULE := Parameter.xsd +LOCAL_SRC_FILES := $(LOCAL_MODULE) +LOCAL_MODULE_CLASS = ETC +LOCAL_MODULE_PATH := $(HOST_OUT)/etc/parameter-framework/Schemas +LOCAL_IS_HOST_MODULE := true +include $(BUILD_PREBUILT) +################################################## diff --git a/Schemas/ComponentLibrary.xsd b/Schemas/ComponentLibrary.xsd index 09d2e27..fbd70af 100644 --- a/Schemas/ComponentLibrary.xsd +++ b/Schemas/ComponentLibrary.xsd @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2005/08/xml.xsd"/> + <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="W3cXmlAttributes.xsd"/> <xs:include schemaLocation="ComponentTypeSet.xsd"/> <xs:element name="ComponentLibrary" type="ComponentTypeSetType"> <xs:key name="ComponentTypeUniqueness"> diff --git a/Schemas/ComponentTypeSet.xsd b/Schemas/ComponentTypeSet.xsd index d00be00..ec58eba 100644 --- a/Schemas/ComponentTypeSet.xsd +++ b/Schemas/ComponentTypeSet.xsd @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2005/08/xml.xsd"/> + <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="W3cXmlAttributes.xsd"/> <xs:include schemaLocation="Parameter.xsd"/> <xs:complexType name="ComponentType"> <xs:sequence> diff --git a/Schemas/Subsystem.xsd b/Schemas/Subsystem.xsd index ab0fdf6..e803175 100644 --- a/Schemas/Subsystem.xsd +++ b/Schemas/Subsystem.xsd @@ -29,6 +29,7 @@ </xs:simpleType>
</xs:attribute>
<xs:attribute name="Type" use="required"/>
+ <xs:attribute name="Mapping" use="optional"/>
</xs:complexType>
<xs:element name="Subsystem" type="SubsystemType">
<xs:keyref name="InstanceDefinitionComponentTypeNotFound" refer="ComponentTypeUniqueness">
diff --git a/Schemas/W3cXmlAttributes.xsd b/Schemas/W3cXmlAttributes.xsd new file mode 100644 index 0000000..4b2500c --- /dev/null +++ b/Schemas/W3cXmlAttributes.xsd @@ -0,0 +1,146 @@ +<?xml version='1.0'?> +<xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace" xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="en"> + + <xs:annotation> + <xs:documentation> + See http://www.w3.org/XML/1998/namespace.html and + http://www.w3.org/TR/REC-xml for information about this namespace. + + This schema document describes the XML namespace, in a form + suitable for import by other schema documents. + + Note that local names in this namespace are intended to be defined + only by the World Wide Web Consortium or its subgroups. The + following names are currently defined in this namespace and should + not be used with conflicting semantics by any Working Group, + specification, or document instance: + + base (as an attribute name): denotes an attribute whose value + provides a URI to be used as the base for interpreting any + relative URIs in the scope of the element on which it + appears; its value is inherited. This name is reserved + by virtue of its definition in the XML Base specification. + + id (as an attribute name): denotes an attribute whose value + should be interpreted as if declared to be of type ID. + The xml:id specification is not yet a W3C Recommendation, + but this attribute is included here to facilitate experimentation + with the mechanisms it proposes. Note that it is _not_ included + in the specialAttrs attribute group. + + lang (as an attribute name): denotes an attribute whose value + is a language code for the natural language of the content of + any element; its value is inherited. This name is reserved + by virtue of its definition in the XML specification. + + space (as an attribute name): denotes an attribute whose + value is a keyword indicating what whitespace processing + discipline is intended for the content of the element; its + value is inherited. This name is reserved by virtue of its + definition in the XML specification. + + Father (in any context at all): denotes Jon Bosak, the chair of + the original XML Working Group. This name is reserved by + the following decision of the W3C XML Plenary and + XML Coordination groups: + + In appreciation for his vision, leadership and dedication + the W3C XML Plenary on this 10th day of February, 2000 + reserves for Jon Bosak in perpetuity the XML name + xml:Father + </xs:documentation> + </xs:annotation> + + <xs:annotation> + <xs:documentation>This schema defines attributes and an attribute group + suitable for use by + schemas wishing to allow xml:base, xml:lang, xml:space or xml:id + attributes on elements they define. + + To enable this, such a schema must import this schema + for the XML namespace, e.g. as follows: + <schema . . .> + . . . + <import namespace="http://www.w3.org/XML/1998/namespace" + schemaLocation="http://www.w3.org/2005/08/xml.xsd"/> + + Subsequently, qualified reference to any of the attributes + or the group defined below will have the desired effect, e.g. + + <type . . .> + . . . + <attributeGroup ref="xml:specialAttrs"/> + + will define a type which will schema-validate an instance + element with any of those attributes</xs:documentation> + </xs:annotation> + + <xs:annotation> + <xs:documentation>In keeping with the XML Schema WG's standard versioning + policy, this schema document will persist at + http://www.w3.org/2005/08/xml.xsd. + At the date of issue it can also be found at + http://www.w3.org/2001/xml.xsd. + The schema document at that URI may however change in the future, + in order to remain compatible with the latest version of XML Schema + itself, or with the XML namespace itself. In other words, if the XML + Schema or XML namespaces change, the version of this document at + http://www.w3.org/2001/xml.xsd will change + accordingly; the version at + http://www.w3.org/2005/08/xml.xsd will not change. + </xs:documentation> + </xs:annotation> + + <xs:attribute name="lang"> + <xs:annotation> + <xs:documentation>Attempting to install the relevant ISO 2- and 3-letter + codes as the enumerated possible values is probably never + going to be a realistic possibility. See + RFC 3066 at http://www.ietf.org/rfc/rfc3066.txt and the IANA registry + at http://www.iana.org/assignments/lang-tag-apps.htm for + further information. + + The union allows for the 'un-declaration' of xml:lang with + the empty string.</xs:documentation> + </xs:annotation> + <xs:simpleType> + <xs:union memberTypes="xs:language"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:enumeration value=""/> + </xs:restriction> + </xs:simpleType> + </xs:union> + </xs:simpleType> + </xs:attribute> + + <xs:attribute name="space"> + <xs:simpleType> + <xs:restriction base="xs:NCName"> + <xs:enumeration value="default"/> + <xs:enumeration value="preserve"/> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + + <xs:attribute name="base" type="xs:anyURI"> + <xs:annotation> + <xs:documentation>See http://www.w3.org/TR/xmlbase/ for + information about this attribute.</xs:documentation> + </xs:annotation> + </xs:attribute> + + <xs:attribute name="id" type="xs:ID"> + <xs:annotation> + <xs:documentation>See http://www.w3.org/TR/xml-id/ for + information about this attribute.</xs:documentation> + </xs:annotation> + </xs:attribute> + + <xs:attributeGroup name="specialAttrs"> + <xs:attribute ref="xml:base"/> + <xs:attribute ref="xml:lang"/> + <xs:attribute ref="xml:space"/> + </xs:attributeGroup> + +</xs:schema> diff --git a/parameter/Android.mk b/parameter/Android.mk index 9541936..04e201c 100755..100644 --- a/parameter/Android.mk +++ b/parameter/Android.mk @@ -141,7 +141,6 @@ common_c_includes := \ $(LOCAL_PATH)/../remote-processor/ common_shared_libraries := libicuuc -common_static_libraries := libxml2 ############################# # Target build @@ -166,7 +165,7 @@ LOCAL_C_INCLUDES += \ bionic/ LOCAL_SHARED_LIBRARIES := $(common_shared_libraries) libdl libstlport -LOCAL_STATIC_LIBRARIES := libxmlserializer libpfw_utility $(common_static_libraries) +LOCAL_STATIC_LIBRARIES := libxmlserializer libpfw_utility libxml2 include $(BUILD_SHARED_LIBRARY) @@ -189,8 +188,40 @@ LOCAL_C_INCLUDES += \ $(common_c_includes) LOCAL_SHARED_LIBRARIES := $(common_shared_libraries)-host -LOCAL_STATIC_LIBRARIES := libxmlserializer_host libpfw_utility_host $(common_static_libraries) +LOCAL_STATIC_LIBRARIES := libxmlserializer_host libpfw_utility_host libxml2-schemas LOCAL_LDLIBS += -ldl include $(BUILD_HOST_SHARED_LIBRARY) + +################################ +# Export includes for plugins (Target build) + +include $(CLEAR_VARS) + +LOCAL_MODULE := $(common_module)_includes + +LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) + +LOCAL_STATIC_LIBRARIES := \ + libxmlserializer \ + libpfw_utility \ + libxml2 + +include $(BUILD_STATIC_LIBRARY) + +################################ +# Export includes for plugins (Host build) + +include $(CLEAR_VARS) + +LOCAL_MODULE := $(common_module)_includes_host + +LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) + +LOCAL_STATIC_LIBRARIES := \ + libxmlserializer_host \ + libpfw_utility_host \ + libxml2 + +include $(BUILD_HOST_STATIC_LIBRARY) diff --git a/parameter/ArrayParameter.cpp b/parameter/ArrayParameter.cpp index dedb5da..a1184cd 100644 --- a/parameter/ArrayParameter.cpp +++ b/parameter/ArrayParameter.cpp @@ -119,11 +119,9 @@ bool CArrayParameter::accessValue(CPathNavigator& pathNavigator, string& strValu } // Synchronize - if (parameterAccessContext.getAutoSync() && !sync(parameterAccessContext)) { - - // Append parameter path to error - parameterAccessContext.appendToError(" " + getPath()); + if (!sync(parameterAccessContext)) { + appendParameterPathToError(parameterAccessContext); return false; } } else { @@ -326,28 +324,28 @@ void CArrayParameter::getValues(uint32_t uiBaseOffset, string& strValues, CParam template <typename type> bool CArrayParameter::accessValues(vector<type>& values, bool bSet, CParameterAccessContext& parameterAccessContext) const { - bool bSuccess; - if (bSet) { - if (setValues(values, parameterAccessContext)) { + // Set Value + if (!setValues(values, parameterAccessContext)) { - // Synchronize - bSuccess = sync(parameterAccessContext); - } else { + appendParameterPathToError(parameterAccessContext); + return false; + } + if (!sync(parameterAccessContext)) { - bSuccess = false; + appendParameterPathToError(parameterAccessContext); + return false; } } else { + // Get Value + if (!getValues(values, parameterAccessContext)) { - bSuccess = getValues(values, parameterAccessContext); - } - if (!bSuccess) { - - // Append parameter path to error - parameterAccessContext.appendToError(" " + getPath()); + appendParameterPathToError(parameterAccessContext); + return false; + } } - return bSuccess; + return true; } template <typename type> diff --git a/parameter/BaseParameter.cpp b/parameter/BaseParameter.cpp index 65fa8bc..078c9b2 100644 --- a/parameter/BaseParameter.cpp +++ b/parameter/BaseParameter.cpp @@ -49,9 +49,7 @@ bool CBaseParameter::serializeXmlSettings(CXmlElement& xmlConfigurationSettingsE // Write to blackboard if (!doSetValue(xmlConfigurationSettingsElementContent.getTextContent(), getOffset() - configurationAccessContext.getBaseOffset(), configurationAccessContext)) { - // Append parameter path to error - configurationAccessContext.appendToError(" " + getPath()); - + appendParameterPathToError(configurationAccessContext); return false; } } else { @@ -178,17 +176,13 @@ bool CBaseParameter::accessAsString(string& strValue, bool bSet, CParameterAcces // Set Value if (!doSetValue(strValue, getOffset() - parameterAccessContext.getBaseOffset(), parameterAccessContext)) { - // Append parameter path to error - parameterAccessContext.appendToError(" " + getPath()); - + appendParameterPathToError(parameterAccessContext); return false; } // Synchronize - if (parameterAccessContext.getAutoSync() && !sync(parameterAccessContext)) { - - // Append parameter path to error - parameterAccessContext.appendToError(" " + getPath()); + if (!sync(parameterAccessContext)) { + appendParameterPathToError(parameterAccessContext); return false; } @@ -230,3 +224,10 @@ void CBaseParameter::toXml(CXmlElement& xmlElement, CXmlSerializingContext& seri // Delegate to type element getTypeElement()->toXml(xmlElement, serializingContext); } + + +void CBaseParameter::appendParameterPathToError(CParameterAccessContext& parameterAccessContext) +const +{ + parameterAccessContext.appendToError(" " + getPath()); +} diff --git a/parameter/BaseParameter.h b/parameter/BaseParameter.h index 7221fbc..3b1296e 100644 --- a/parameter/BaseParameter.h +++ b/parameter/BaseParameter.h @@ -80,4 +80,11 @@ protected: // Actual value access (to be implemented by derived) virtual bool doSetValue(const string& strValue, uint32_t uiOffset, CParameterAccessContext& parameterAccessContext) const = 0; virtual void doGetValue(string& strValue, uint32_t uiOffset, CParameterAccessContext& parameterAccessContext) const = 0; + + /** + * Append the parameter path to the error. + * + * @param[in:out] parameterAccessContext Parameter Access Context object. + */ + void appendParameterPathToError(CParameterAccessContext& parameterAccessContext) const; }; diff --git a/parameter/BitParameter.cpp b/parameter/BitParameter.cpp index aed9459..d239ed8 100644 --- a/parameter/BitParameter.cpp +++ b/parameter/BitParameter.cpp @@ -79,8 +79,7 @@ bool CBitParameter::accessAsBoolean(bool& bValue, bool bSet, CParameterAccessCon if (static_cast<const CBitParameterType*>(getTypeElement())->getBitSize() != 1) { parameterAccessContext.setError("Type mismatch"); - // Append parameter path to error - parameterAccessContext.appendToError(" " + getPath()); + appendParameterPathToError(parameterAccessContext); return false; } @@ -113,12 +112,16 @@ bool CBitParameter::accessAsInteger(uint64_t& uiValue, bool bSet, CParameterAcce if (bSet) { - // Set and sync - if (!doSet(uiValue, uiOffset, parameterAccessContext) || !sync(parameterAccessContext)) { + // Set Value + if (!doSet(uiValue, uiOffset, parameterAccessContext)) { - // Append parameter path to error - parameterAccessContext.appendToError(" " + getPath()); + appendParameterPathToError(parameterAccessContext); + return false; + } + // Synchronize + if (!sync(parameterAccessContext)) { + appendParameterPathToError(parameterAccessContext); return false; } } else { diff --git a/parameter/ConfigurableElementWithMapping.h b/parameter/ConfigurableElementWithMapping.h new file mode 100644 index 0000000..d241cea --- /dev/null +++ b/parameter/ConfigurableElementWithMapping.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2014, Intel Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#pragma once + +#include "ConfigurableElement.h" +#include <string> + +/** + * Base class for all Configurable Elements that can have a Mapping attribute. + * + * This class acts as an interface: it doesn't implement anything but only + * declares getMappingData as pure virtual fonction. + */ +class CConfigurableElementWithMapping : public CConfigurableElement { +public: + CConfigurableElementWithMapping(const string& strName) : CConfigurableElement(strName) {} + virtual ~CConfigurableElementWithMapping() {} + + /** + * Get the value associated to a mapping key in the object's mapping + * + * @param[in] strKey the mapping key + * @param[out] pStrValue the associated value + * + * @return true if @p strKey is found in the object's mapping, false if not + */ + virtual bool getMappingData(const std::string& strKey, const std::string*& pStrValue) const = 0; +}; diff --git a/parameter/Element.cpp b/parameter/Element.cpp index e5987e1..6d1d418 100755 --- a/parameter/Element.cpp +++ b/parameter/Element.cpp @@ -58,7 +58,9 @@ void CElement::log_info(const string& strMessage, ...) const va_end(listPointer); - doLog(false, pacBuffer); + if (pacBuffer != NULL) { + doLog(false, pacBuffer); + } free(pacBuffer); } @@ -74,7 +76,9 @@ void CElement::log_warning(const string& strMessage, ...) const va_end(listPointer); - doLog(true, pacBuffer); + if (pacBuffer != NULL) { + doLog(true, pacBuffer); + } free(pacBuffer); } diff --git a/parameter/FileIncluderElementBuilder.h b/parameter/FileIncluderElementBuilder.h new file mode 100644 index 0000000..bccb227 --- /dev/null +++ b/parameter/FileIncluderElementBuilder.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2014, Intel Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#pragma once + +#include "ElementBuilder.h" +#include "XmlFileIncluderElement.h" + +/** This is the XmlFileIncluderElement builder class + * + * It is builds the XmlFileIncluderElement with + * a mandatory option specific to xml: + * whether it should be validated with schemas or not + */ +class CFileIncluderElementBuilder : public CElementBuilder +{ +public: + CFileIncluderElementBuilder(bool bValidateWithSchemas) : + CElementBuilder(), + _bValidateWithSchemas(bValidateWithSchemas) + {} + + virtual CElement *createElement(const CXmlElement &xmlElement) const + { + return new CXmlFileIncluderElement(xmlElement.getNameAttribute(), + xmlElement.getType(), _bValidateWithSchemas); + } + +private: + bool _bValidateWithSchemas; +}; diff --git a/parameter/FixedPointParameterType.cpp b/parameter/FixedPointParameterType.cpp index 88d3aa1..c9f736f 100644 --- a/parameter/FixedPointParameterType.cpp +++ b/parameter/FixedPointParameterType.cpp @@ -37,6 +37,7 @@ #include "ParameterAccessContext.h" #include "ConfigurationAccessContext.h" #include <errno.h> +#include <convert.hpp> #define base CParameterType @@ -111,8 +112,7 @@ bool CFixedPointParameterType::fromXml(const CXmlElement& xmlElement, CXmlSerial bool CFixedPointParameterType::toBlackboard(const string& strValue, uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const { - // Hexa - bool bValueProvidedAsHexa = !strValue.compare(0, 2, "0x"); + bool bValueProvidedAsHexa = isHexadecimal(strValue); // Check data integrity if (bValueProvidedAsHexa && !parameterAccessContext.valueSpaceIsRaw()) { @@ -122,59 +122,60 @@ bool CFixedPointParameterType::toBlackboard(const string& strValue, uint32_t& ui return false; } - int64_t iData; - if (parameterAccessContext.valueSpaceIsRaw()) { - errno = 0; - char *pcStrEnd; - // Get data in integer form - iData = strtoll(strValue.c_str(), &pcStrEnd, 0); + if (bValueProvidedAsHexa) { - // Conversion error when the input string does not contain any digit or the number is out of range - bool bConversionSucceeded = !errno && (strValue.c_str() != pcStrEnd); + return convertFromHexadecimal(strValue, uiValue, parameterAccessContext); - if (!bConversionSucceeded || !isEncodable((uint64_t)iData, !bValueProvidedAsHexa)) { + } + return convertFromDecimal(strValue, uiValue, parameterAccessContext); + } + return convertFromQnm(strValue, uiValue, parameterAccessContext); +} - // Illegal value provided - parameterAccessContext.setError(getOutOfRangeError(strValue, parameterAccessContext.valueSpaceIsRaw(), bValueProvidedAsHexa)); +void CFixedPointParameterType::setOutOfRangeError(const string& strValue, CParameterAccessContext& parameterAccessContext) const +{ + ostringstream strStream; - return false; - } - if (bValueProvidedAsHexa) { + strStream << "Value " << strValue << " standing out of admitted "; - // Sign extend - signExtend(iData); - } + if (!parameterAccessContext.valueSpaceIsRaw()) { + // Min/Max computation + double dMin = 0; + double dMax = 0; + getRange(dMin, dMax); + + strStream << fixed << setprecision(_uiFractional) + << "real range [" << dMin << ", " << dMax << "]"; } else { - errno = 0; - char *pcStrEnd; - double dData = strtod(strValue.c_str(), &pcStrEnd); + // Min/Max computation + int32_t iMax = getMaxValue<uint32_t>(); + int32_t iMin = -iMax - 1; + + strStream << "raw range ["; - // Conversion error when the input string does not contain any digit or the number is out of range (int32_t type) - bool bConversionSucceeded = !errno && (strValue.c_str() != pcStrEnd); + if (isHexadecimal(strValue)) { - // Check encodability - if (!bConversionSucceeded || !checkValueAgainstRange(dData)) { + // Format Min + strStream << "0x" << hex << uppercase << + setw(getSize() * 2) << setfill('0') << makeEncodable(iMin); + // Format Max + strStream << ", 0x" << hex << uppercase << + setw(getSize() * 2) << setfill('0') << makeEncodable(iMax); - // Illegal value provided - parameterAccessContext.setError(getOutOfRangeError(strValue, parameterAccessContext.valueSpaceIsRaw(), bValueProvidedAsHexa)); + } else { - return false; + strStream << iMin << ", " << iMax; } - // Do the conversion - iData = asInteger(dData); + strStream << "]"; } + strStream << " for " << getKind(); - // check that the data is encodable and can be safely written to the blackboard - assert(isEncodable((unsigned long int)iData, true)); - - uiValue = (uint32_t)iData; - - return true; + parameterAccessContext.setError(strStream.str()); } bool CFixedPointParameterType::fromBlackboard(string& strValue, const uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const @@ -207,12 +208,9 @@ bool CFixedPointParameterType::fromBlackboard(string& strValue, const uint32_t& signExtend(iData); // Conversion - double dData = asDouble(iData); + double dData = binaryQnmToDouble(iData); - // Set up the precision of the display and notation type - int iPrecision = (_uiFractional * log10(2.0)) + 1; - int iFactor = pow(10.0, iPrecision); - strStream << fixed << ((int64_t)(dData * iFactor)) / (double)iFactor; + strStream << fixed << setprecision(_uiFractional) << dData; } strValue = strStream.str(); @@ -233,7 +231,7 @@ bool CFixedPointParameterType::toBlackboard(double dUserValue, uint32_t& uiValue } // Do the conversion - int32_t iData = asInteger(dUserValue); + int32_t iData = doubleToBinaryQnm(dUserValue); // Check integrity assert(isEncodable((uint32_t)iData, true)); @@ -255,7 +253,7 @@ bool CFixedPointParameterType::fromBlackboard(double& dUserValue, uint32_t uiVal // Sign extend signExtend(iData); - dUserValue = asDouble(iData); + dUserValue = binaryQnmToDouble(iData); return true; } @@ -273,46 +271,59 @@ void CFixedPointParameterType::getRange(double& dMin, double& dMax) const dMin = -(double)(1UL << (_uiIntegral + _uiFractional)) / (1UL << _uiFractional); } -// Out of range error -string CFixedPointParameterType::getOutOfRangeError(const string& strValue, bool bRawValueSpace, bool bHexaValue) const +bool CFixedPointParameterType::isHexadecimal(const string& strValue) const { - ostringstream strStream; + return !strValue.compare(0, 2, "0x"); +} - strStream << "Value " << strValue << " standing out of admitted "; +bool CFixedPointParameterType::convertFromHexadecimal(const string& strValue, uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const +{ + // For hexadecimal representation, we need full 32 bit range conversion. + uint32_t uiData; + if (!convertTo(strValue, uiData) || !isEncodable(uiData, false)) { - if (!bRawValueSpace) { + setOutOfRangeError(strValue, parameterAccessContext); + return false; + } + signExtend((int32_t&)uiData); - // Min/Max computation - double dMin = 0; - double dMax = 0; - getRange(dMin, dMax); + // check that the data is encodable and can been safely written to the blackboard + assert(isEncodable(uiData, true)); + uiValue = uiData; - strStream << "real range [" << dMin << ", "<< dMax << "]"; - } else { + return true; +} - // Min/Max computation - int32_t iMax = getMaxValue<uint32_t>(); - int32_t iMin = -iMax - 1; +bool CFixedPointParameterType::convertFromDecimal(const string& strValue, uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const +{ + int32_t iData; - strStream << "raw range ["; + if (!convertTo(strValue, iData) || !isEncodable((uint32_t)iData, true)) { - if (bHexaValue) { + setOutOfRangeError(strValue, parameterAccessContext); + return false; + } + uiValue = static_cast<uint32_t>(iData); - // Format Min - strStream << "0x" << hex << uppercase << setw(getSize()*2) << setfill('0') << makeEncodable(iMin); - // Format Max - strStream << ", 0x" << hex << uppercase << setw(getSize()*2) << setfill('0') << makeEncodable(iMax); + return true; +} - } else { +bool CFixedPointParameterType::convertFromQnm(const string& strValue, uint32_t& uiValue, + CParameterAccessContext& parameterAccessContext) const +{ + double dData; - strStream << iMin << ", " << iMax; - } + if (!convertTo(strValue, dData) || !checkValueAgainstRange(dData)) { - strStream << "]"; + setOutOfRangeError(strValue, parameterAccessContext); + return false; } - strStream << " for " << getKind(); + uiValue = static_cast<uint32_t>(doubleToBinaryQnm(dData)); - return strStream.str(); + // check that the data is encodable and has been safely written to the blackboard + assert(isEncodable(uiValue, true)); + + return true; } // Check that the value is within available range for this type @@ -326,22 +337,24 @@ bool CFixedPointParameterType::checkValueAgainstRange(double dValue) const } // Data conversion -int32_t CFixedPointParameterType::asInteger(double dValue) const +int32_t CFixedPointParameterType::doubleToBinaryQnm(double dValue) const { - // Do the conversion - int32_t iData = (int32_t)(dValue * (1UL << _uiFractional) + 0.5F - (double)(dValue < 0)); + // For Qn.m number, multiply by 2^n and round to the nearest integer + int32_t iData = static_cast<int32_t>(round(dValue * (1UL << _uiFractional))); // Left justify + // For a Qn.m number, shift 32 - (n + m + 1) bits to the left (the rest of + // the bits aren't used) iData <<= getSize() * 8 - getUtilSizeInBits(); return iData; } -double CFixedPointParameterType::asDouble(int32_t iValue) const + +double CFixedPointParameterType::binaryQnmToDouble(int32_t iValue) const { // Unjustify iValue >>= getSize() * 8 - getUtilSizeInBits(); - // Convert - return (double)iValue / (1UL << _uiFractional); + return static_cast<double>(iValue) / (1UL << _uiFractional); } // From IXmlSource diff --git a/parameter/FixedPointParameterType.h b/parameter/FixedPointParameterType.h index 7f204ff..3ef53eb 100644 --- a/parameter/FixedPointParameterType.h +++ b/parameter/FixedPointParameterType.h @@ -64,13 +64,90 @@ private: uint32_t getUtilSizeInBits() const; // Range computation void getRange(double& dMin, double& dMax) const; - // Out of range error - string getOutOfRangeError(const string& strValue, bool bRawValueSpace, bool bHexaValue) const; + + /** + * Checks if a string has the written representation of an hexadecimal number (Which is + * the prefix "Ox" in C++). + * + * @param[in] strValue Parameter read from the XML file representated as a string. + * + * @return true if the string is written as hexa, false otherwise. + */ + bool isHexadecimal(const string& strValue) const; + + /** + * Convert a decimal raw represented string into an unsigned long integer. + * In case of a failing conversion or encodability, this function set the error to + * illegal value provided and gives the range allowed for the parameter. + * + * @param[in] strValue Parameter read from the XML file representated as a string in decimal + * raw format + * @param[out] uiValue Parameter representated as a long unsigned integer. + * @param[in:out] parameterAccessContext Parameter access context. + * + * @return true if the string was successfully converted, false otherwise. + */ + bool convertFromDecimal(const string& strValue, uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const; + + /** + * Convert an hexadecimal raw represented string into an unsigned long integer. + * In case of a failing conversion or encodability, this function set the error to + * illegal value provided and gives the range allowed for the parameter. + * + * @param[in] strValue Parameter read from the XML file representated as a string in hexadecimal + * raw format + * @param[out] uiValue Parameter representated as a long unsigned integer. + * @param[in:out] parameterAccessContext Parameter access context. + * + * @return true if the string was successfully converted, false otherwise. + */ + bool convertFromHexadecimal(const string& strValue, uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const; + + /** + * Convert a Qn.m represented string into an unsigned long integer. + * In case of a failing conversion or encodability, this function set the error to + * illegal value provided and gives the range allowed for the parameter. + * + * @param[in] strValue Parameter read from the XML file representated as a string in Qn.m + * representation. + * @param[out] uiValue Parameter representated as a long unsigned integer. + * @param[in:out] parameterAccessContext Parameter access context. + * + * @return true if the string was successfully converted, false otherwise. + */ + bool convertFromQnm(const string& strValue, uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const; + + /** + * Set the out of range error. + * In case of a failing conversion or encodability, this function set the error to + * illegal value provided and gives the range allowed for the parameter. + * + * @param[in] strValue Parameter read from the XML file representated as a string + * @param[in:out] parameterAccessContext Parameter Access Context + */ + void setOutOfRangeError(const string& strValue, CParameterAccessContext& parameterAccessContext) const; + // Check if data is encodable bool checkValueAgainstRange(double dValue) const; - // Data conversion - int32_t asInteger(double dValue) const; - double asDouble(int32_t iValue) const; + + /** + * Convert a double towards a Qn.m representation which is stored in binary format. + * This value is rounded if the double is not encodable in the corresponding Qn.m format. + * + * @param[in] dValue the double which should be converted. + * + * @return the integer which contains the converted Qn.m number. + */ + int32_t doubleToBinaryQnm(double dValue) const; + + /** + * Convert a Qn.m binary number towards its double representation. + * + * @param[in] iValue the integer which contains the Qn.m number which should be converted. + * + * @return the double which contains the double representation of iValue. + */ + double binaryQnmToDouble(int32_t iValue) const; // Integral part in Q notation uint32_t _uiIntegral; diff --git a/parameter/InstanceConfigurableElement.cpp b/parameter/InstanceConfigurableElement.cpp index 098fe8f..003a606 100644 --- a/parameter/InstanceConfigurableElement.cpp +++ b/parameter/InstanceConfigurableElement.cpp @@ -35,7 +35,7 @@ #include "ParameterAccessContext.h" #include <assert.h> -#define base CConfigurableElement +#define base CConfigurableElementWithMapping CInstanceConfigurableElement::CInstanceConfigurableElement(const string& strName, const CTypeElement* pTypeElement) : base(strName), _pTypeElement(pTypeElement), _pSyncer(NULL) { @@ -175,9 +175,14 @@ void CInstanceConfigurableElement::fillSyncerSetFromDescendant(CSyncerSet& synce } } -// Sync bool CInstanceConfigurableElement::sync(CParameterAccessContext& parameterAccessContext) const { + if (!parameterAccessContext.getAutoSync()) { + + // AutoSync is disabled, do not perform the sync. + // This is not an error, but the expected behavior so return true anyway. + return true; + } ISyncer* pSyncer = getSyncer(); if (!pSyncer) { @@ -211,4 +216,3 @@ bool CInstanceConfigurableElement::checkPathExhausted(CPathNavigator& pathNaviga } return true; } - diff --git a/parameter/InstanceConfigurableElement.h b/parameter/InstanceConfigurableElement.h index 7d9298e..39a0d94 100644 --- a/parameter/InstanceConfigurableElement.h +++ b/parameter/InstanceConfigurableElement.h @@ -29,14 +29,14 @@ */ #pragma once -#include "ConfigurableElement.h" +#include "ConfigurableElementWithMapping.h" #include "TypeElement.h" class IMapper; class CParameterBlackboard; class CParameterAccessContext; -class CInstanceConfigurableElement : public CConfigurableElement +class CInstanceConfigurableElement : public CConfigurableElementWithMapping { public: enum Type { @@ -53,7 +53,7 @@ public: // Instantiated type const CTypeElement* getTypeElement() const; - bool getMappingData(const string& strKey, const string*& pStrValue) const; + virtual bool getMappingData(const string& strKey, const string*& pStrValue) const; /** * Returns the mapping data associated to the type element of the current @@ -104,8 +104,18 @@ protected: virtual ISyncer* getSyncer() const; // Syncer set (descendant) virtual void fillSyncerSetFromDescendant(CSyncerSet& syncerSet) const; - // Sync + + /** + * Performs the sync if the AutoSync is enabled. + * If AutoSync is disabled, any call to sync will returns true, even if synchronization has not + * been done. It will happen when the AutoSync will be switched back on. + * + * @param[in:out] parameterAccessContext Parameter access context object + * + * @return true if the synchronization succeded or if the AutoSync is off, false otherwise. + */ bool sync(CParameterAccessContext& parameterAccessContext) const; + // Check parameter access path well formed for leaf elements static bool checkPathExhausted(CPathNavigator& pathNavigator, CErrorContext& errorContext); private: diff --git a/parameter/Parameter.cpp b/parameter/Parameter.cpp index 631710d..36903f6 100644 --- a/parameter/Parameter.cpp +++ b/parameter/Parameter.cpp @@ -122,30 +122,34 @@ bool CParameter::accessAsDouble(double& dValue, bool bSet, CParameterAccessConte // Generic Access template <typename type> -bool CParameter::doAccess(type& value, bool bSet, CParameterAccessContext& parameterAccessContext) const +bool CParameter::doAccess(type& value, bool bSet, + CParameterAccessContext& parameterAccessContext) const { - bool bSuccess; - if (bSet) { + // set value + if (!doSet(value, getOffset() - parameterAccessContext.getBaseOffset(), + parameterAccessContext)) { - if (doSet(value, getOffset() - parameterAccessContext.getBaseOffset(), parameterAccessContext)) { + appendParameterPathToError(parameterAccessContext); + return false; - // Synchronize - bSuccess = sync(parameterAccessContext); - } else { + } + // Synchronize + if (!sync(parameterAccessContext)){ - bSuccess = false; + appendParameterPathToError(parameterAccessContext); + return false; } } else { + // get value + if (!doGet(value, getOffset() - parameterAccessContext.getBaseOffset(), + parameterAccessContext)) { - bSuccess = doGet(value, getOffset() - parameterAccessContext.getBaseOffset(), parameterAccessContext); - } - if (!bSuccess) { - - // Append parameter path to error - parameterAccessContext.appendToError(" " + getPath()); + appendParameterPathToError(parameterAccessContext); + return false; + } } - return bSuccess; + return true; } template <typename type> diff --git a/parameter/ParameterAccessContext.cpp b/parameter/ParameterAccessContext.cpp index b48e7c5..579f6bf 100644 --- a/parameter/ParameterAccessContext.cpp +++ b/parameter/ParameterAccessContext.cpp @@ -38,7 +38,7 @@ CParameterAccessContext::CParameterAccessContext(string& strError, uint32_t uiBaseOffset) : base(strError), _pParameterBlackboard(pParameterBlackboard), _bValueSpaceIsRaw(bValueSpaceIsRaw), _bOutputRawFormatIsHex(bOutputRawFormatIsHex), - _bBigEndianSubsystem(false), _bAutoSync(false), _uiBaseOffset(uiBaseOffset) + _bBigEndianSubsystem(false), _bAutoSync(true), _uiBaseOffset(uiBaseOffset) { } @@ -47,14 +47,14 @@ CParameterAccessContext::CParameterAccessContext(string& strError, CParameterBlackboard* pParameterBlackboard, uint32_t uiBaseOffset) : base(strError), _pParameterBlackboard(pParameterBlackboard), _bValueSpaceIsRaw(false), - _bOutputRawFormatIsHex(false), _bBigEndianSubsystem(bBigEndianSubsystem), _bAutoSync(false), + _bOutputRawFormatIsHex(false), _bBigEndianSubsystem(bBigEndianSubsystem), _bAutoSync(true), _uiBaseOffset(uiBaseOffset) { } CParameterAccessContext::CParameterAccessContext(string& strError) : base(strError), _pParameterBlackboard(NULL), _bValueSpaceIsRaw(false), - _bOutputRawFormatIsHex(false), _bBigEndianSubsystem(false), _bAutoSync(false), _uiBaseOffset(0) + _bOutputRawFormatIsHex(false), _bBigEndianSubsystem(false), _bAutoSync(true), _uiBaseOffset(0) { } diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp index 639c59f..32082b3 100644 --- a/parameter/ParameterMgr.cpp +++ b/parameter/ParameterMgr.cpp @@ -1,4 +1,4 @@ - /* +/* * Copyright (c) 2011-2014, Intel Corporation * All rights reserved. * @@ -36,8 +36,10 @@ #include "NamedElementBuilderTemplate.h" #include "KindElementBuilderTemplate.h" #include "ElementBuilderTemplate.h" +#include "XmlFileIncluderElement.h" #include "SelectionCriterionType.h" #include "SubsystemElementBuilder.h" +#include "FileIncluderElementBuilder.h" #include "SelectionCriteria.h" #include "ComponentType.h" #include "ComponentInstance.h" @@ -289,7 +291,9 @@ CParameterMgr::CParameterMgr(const string& strConfigurationFilePath) : _pLogger(NULL), _uiLogDepth(0), _bFailOnMissingSubsystem(true), - _bFailOnFailedSettingsLoad(true) + _bFailOnFailedSettingsLoad(true), + _bValidateSchemasOnStart(false) + { // Tuning Mode Mutex bzero(&_blackboardMutex, sizeof(_blackboardMutex)); @@ -301,9 +305,6 @@ CParameterMgr::CParameterMgr(const string& strConfigurationFilePath) : addChild(new CSystemClass); addChild(new CConfigurableDomains); - // Feed element library - feedElementLibraries(); - _pCommandHandler = new CCommandHandler(this); // Add command parsers @@ -409,6 +410,8 @@ bool CParameterMgr::load(string& strError) { CAutoLog autoLog(this, "Loading"); + feedElementLibraries(); + // Load Framework configuration if (!loadFrameworkConfiguration(strError)) { @@ -644,12 +647,16 @@ bool CParameterMgr::loadSettingsFromConfigFile(string& strError) bool CParameterMgr::xmlParse(CXmlElementSerializingContext& elementSerializingContext, CElement* pRootElement, const string& strXmlFilePath, const string& strXmlFolder, CParameterMgr::ElementLibrary eElementLibrary, const string& strNameAttrituteName) { // Init serializing context - elementSerializingContext.set(_pElementLibrarySet->getElementLibrary(eElementLibrary), strXmlFolder, _strSchemaFolderLocation); + elementSerializingContext.set(_pElementLibrarySet->getElementLibrary( + eElementLibrary), strXmlFolder, _strSchemaFolderLocation); // Get Schema file associated to root element string strXmlSchemaFilePath = _strSchemaFolderLocation + "/" + pRootElement->getKind() + ".xsd"; - CXmlFileDocSource fileDocSource(strXmlFilePath, strXmlSchemaFilePath, pRootElement->getKind(), pRootElement->getName(), strNameAttrituteName); + CXmlFileDocSource fileDocSource(strXmlFilePath, strXmlSchemaFilePath, + pRootElement->getKind(), + pRootElement->getName(), strNameAttrituteName, + _bValidateSchemasOnStart); // Start clean pRootElement->clean(); @@ -776,10 +783,22 @@ void CParameterMgr::setFailureOnFailedSettingsLoad(bool bFail) { _bFailOnFailedSettingsLoad = bFail; } + bool CParameterMgr::getFailureOnFailedSettingsLoad() { return _bFailOnFailedSettingsLoad; } + +void CParameterMgr::setValidateSchemasOnStart(bool bValidate) +{ + _bValidateSchemasOnStart = bValidate; +} + +bool CParameterMgr::getValidateSchemasOnStart() const +{ + return _bValidateSchemasOnStart; +} + /////////////////// Remote command parsers /// Version CParameterMgr::CCommandHandler::CommandStatus CParameterMgr::versionCommandProcess(const IRemoteCommand& remoteCommand, string& strResult) @@ -1619,6 +1638,15 @@ bool CParameterMgr::accessConfigurationValue(const string& strDomain, const stri // Define Configuration context using Base Offset and keep Auto Sync off to prevent access to HW CParameterAccessContext parameterAccessContext(strError, pConfigurationBlackboard, _bValueSpaceIsRaw, _bOutputRawFormatIsHex, uiBaseOffset); + // Deactivate the auto synchronization with the hardware during the Configuration Blackboard + // access (only Main Blackboard shall be synchronized, Configurations Blackboards are copied + // into the Main Blackboard each time a configuration is restored but they are not synchronized + // directly). + if (bSet) { + + parameterAccessContext.setAutoSync(false); + } + // Access Value in the Configuration Blackboard if (!accessValue(parameterAccessContext, strPath, strValue, bSet, strError)) { @@ -1999,14 +2027,16 @@ bool CParameterMgr::importDomainsXml(const string& strXmlSource, bool bWithSetti // when importing from a file strXmlSource is the file name pSource = new CXmlFileDocSource(strXmlSource, strXmlSchemaFilePath, pConfigurableDomains->getKind(), - pConfigurableDomains->getName(), "SystemClassName"); + pConfigurableDomains->getName(), "SystemClassName", + _bValidateSchemasOnStart); } else { // when importing from an xml string, strXmlSource contains the string pSource = new CXmlStringDocSource(strXmlSource, strXmlSchemaFilePath, pConfigurableDomains->getKind(), - pConfigurableDomains->getName(), "SystemClassName"); + pConfigurableDomains->getName(), "SystemClassName", + _bValidateSchemasOnStart); } // Start clean @@ -2063,7 +2093,8 @@ bool CParameterMgr::exportDomainsXml(string& strXmlDest, bool bWithSettings, boo // Use a doc source by loading data from instantiated Configurable Domains CXmlMemoryDocSource memorySource(pConfigurableDomains, pConfigurableDomains->getKind(), - strXmlSchemaFilePath, "parameter-framework", getVersion()); + strXmlSchemaFilePath, "parameter-framework", + getVersion(), _bValidateSchemasOnStart); // Xml Sink CXmlDocSink* pSink; @@ -2181,7 +2212,7 @@ void CParameterMgr::feedElementLibraries() pParameterCreationLibrary->addElementBuilder("EnumParameter", new TNamedElementBuilderTemplate<CEnumParameterType>()); pParameterCreationLibrary->addElementBuilder("ValuePair", new TElementBuilderTemplate<CEnumValuePair>()); pParameterCreationLibrary->addElementBuilder("FixedPointParameter", new TNamedElementBuilderTemplate<CFixedPointParameterType>()); - pParameterCreationLibrary->addElementBuilder("SubsystemInclude", new TKindElementBuilderTemplate<CXmlFileIncluderElement>()); + pParameterCreationLibrary->addElementBuilder("SubsystemInclude", new CFileIncluderElementBuilder(_bValidateSchemasOnStart)); _pElementLibrarySet->addElementLibrary(pParameterCreationLibrary); @@ -2338,7 +2369,8 @@ bool CParameterMgr::getSystemClassXMLString(string& strResult) CXmlSerializingContext xmlSerializingContext(strError); // Use a doc source by loading data from instantiated Configurable Domains - CXmlMemoryDocSource memorySource(pSystemClass, pSystemClass->getKind()); + CXmlMemoryDocSource memorySource(pSystemClass, pSystemClass->getKind(), + _bValidateSchemasOnStart); // Use a doc sink that write the doc data in a string CXmlStringDocSink stringSink(strResult); diff --git a/parameter/ParameterMgr.h b/parameter/ParameterMgr.h index bb38d22..7d64e5c 100644 --- a/parameter/ParameterMgr.h +++ b/parameter/ParameterMgr.h @@ -167,6 +167,24 @@ public: */ bool getFailureOnFailedSettingsLoad(); + /** Should .xml files be validated on start ? + * + * @param[in] bValidate: + * If set to true, parameterMgr will report an error + * when being unable to validate .xml files + * If set to false, no .xml/xsd validation will happen + * (default behaviour) + * + * @return false if unable to set, true otherwise. + */ + void setValidateSchemasOnStart(bool bValidate); + + /** Would .xml files be validated on start? + * + * @return areSchemasValidated + */ + bool getValidateSchemasOnStart() const; + //////////// Tuning ///////////// // Tuning mode bool setTuningMode(bool bOn, string& strError); @@ -508,5 +526,12 @@ private: * will continue the parameterMgr start with no domains. */ bool _bFailOnFailedSettingsLoad; + + /** + * If set to true, parameterMgr will report an error + * when being unable to validate .xml files + * If set to false, no .xml/xsd validation will happen (default behaviour) + */ + bool _bValidateSchemasOnStart; }; diff --git a/parameter/ParameterMgrPlatformConnector.cpp b/parameter/ParameterMgrPlatformConnector.cpp index 9ffde18..bcc9012 100644 --- a/parameter/ParameterMgrPlatformConnector.cpp +++ b/parameter/ParameterMgrPlatformConnector.cpp @@ -126,6 +126,24 @@ bool CParameterMgrPlatformConnector::getFailureOnFailedSettingsLoad() return _pParameterMgr->getFailureOnFailedSettingsLoad(); } +bool CParameterMgrPlatformConnector::setValidateSchemasOnStart( + bool bValidate, std::string& strError) +{ + if (_bStarted) { + + strError = "Can not enable xml validation after the start of the parameter-framework"; + return false; + } + + _pParameterMgr->setValidateSchemasOnStart(bValidate); + return true; +} + +bool CParameterMgrPlatformConnector::getValidateSchemasOnStart() +{ + return _pParameterMgr->getValidateSchemasOnStart(); +} + // Start bool CParameterMgrPlatformConnector::start(string& strError) { diff --git a/parameter/Subsystem.cpp b/parameter/Subsystem.cpp index d4bc7c8..9a550d5 100644 --- a/parameter/Subsystem.cpp +++ b/parameter/Subsystem.cpp @@ -38,9 +38,9 @@ #include <assert.h> #include <sstream> -#define base CConfigurableElement +#define base CConfigurableElementWithMapping -CSubsystem::CSubsystem(const string& strName) : base(strName), _pComponentLibrary(new CComponentLibrary), _pInstanceDefinition(new CInstanceDefinition), _bBigEndian(false) +CSubsystem::CSubsystem(const string& strName) : base(strName), _pComponentLibrary(new CComponentLibrary), _pInstanceDefinition(new CInstanceDefinition), _bBigEndian(false), _pMappingData(NULL) { // Note: A subsystem contains instance components // InstanceDefintion and ComponentLibrary objects are then not chosen to be children @@ -68,6 +68,8 @@ CSubsystem::~CSubsystem() // Order matters! delete _pInstanceDefinition; delete _pComponentLibrary; + + delete _pMappingData; } string CSubsystem::getKind() const @@ -106,6 +108,16 @@ bool CSubsystem::fromXml(const CXmlElement& xmlElement, CXmlSerializingContext& CXmlElement childElement; + // Manage mapping attribute + if (xmlElement.hasAttribute("Mapping")) { + + _pMappingData = new CMappingData; + if (!_pMappingData->fromXml(xmlElement, serializingContext)) { + + return false; + } + } + // XML populate ComponentLibrary xmlElement.getChildElement("ComponentLibrary", childElement); @@ -152,7 +164,11 @@ bool CSubsystem::serializeXmlSettings(CXmlElement& xmlConfigurationSettingsEleme bool CSubsystem::mapSubsystemElements(string& strError) { // Default mapping context - _contextStack.push(CMappingContext(_contextMappingKeyArray.size())); + CMappingContext context(_contextMappingKeyArray.size()); + // Add Subsystem-level mapping data, which will be propagated to all children + handleMappingContext(this, context, strError); + + _contextStack.push(context); // Map all instantiated subelements in subsystem uint32_t uiNbChildren = getNbChildren(); @@ -326,20 +342,30 @@ void CSubsystem::addSubsystemObjectFactory(CSubsystemObjectCreator* pSubsystemOb } // Generic error handling from derived subsystem classes -string CSubsystem::getMappingError(const string& strKey, - const string& strMessage, - const CInstanceConfigurableElement* pInstanceConfigurableElement) -const +string CSubsystem::getMappingError( + const string& strKey, + const string& strMessage, + const CConfigurableElementWithMapping* pConfigurableElementWithMapping) const { return getName() + " " + getKind() + " " + "mapping:\n" + strKey + " " + "error: \"" + strMessage + "\" " + - "for element " + pInstanceConfigurableElement->getPath(); + "for element " + pConfigurableElementWithMapping->getPath(); +} + + +bool CSubsystem::getMappingData(const std::string& strKey, const std::string*& pStrValue) const +{ + if (_pMappingData) { + + return _pMappingData->getValue(strKey, pStrValue); + } + return false; } // Mapping generic context handling bool CSubsystem::handleMappingContext( - const CInstanceConfigurableElement* pInstanceConfigurableElement, + const CConfigurableElementWithMapping* pConfigurableElementWithMapping, CMappingContext& context, string& strError) const { @@ -351,11 +377,11 @@ bool CSubsystem::handleMappingContext( const string& strKey = _contextMappingKeyArray[uiItem]; const string* pStrValue; - if (pInstanceConfigurableElement->getMappingData(strKey, pStrValue)) { + if (pConfigurableElementWithMapping->getMappingData(strKey, pStrValue)) { // Assign item to context if (!context.setItem(uiItem, &strKey, pStrValue)) { - strError = getMappingError(strKey, "Already set", pInstanceConfigurableElement); + strError = getMappingError(strKey, "Already set", pConfigurableElementWithMapping); return false; } diff --git a/parameter/Subsystem.h b/parameter/Subsystem.h index 6b15181..a03a2ef 100644 --- a/parameter/Subsystem.h +++ b/parameter/Subsystem.h @@ -30,6 +30,7 @@ #pragma once #include "ConfigurableElement.h" +#include "ConfigurableElementWithMapping.h" #include "Mapper.h" #include "MappingContext.h" #include <stack> @@ -40,8 +41,9 @@ class CComponentLibrary; class CSubsystemObject; class CSubsystemObjectCreator; class CInstanceConfigurableElement; +class CMappingData; -class CSubsystem : public CConfigurableElement, private IMapper +class CSubsystem : public CConfigurableElementWithMapping, private IMapper { // Subsystem objects iterator typedef list<CSubsystemObject*>::const_iterator SubsystemObjectListIterator; @@ -67,6 +69,8 @@ public: // from CElement virtual string getKind() const; + virtual bool getMappingData(const std::string& strKey, const std::string*& pStrValue) const; + /** * Fetch mapping data of an element. * @@ -130,13 +134,14 @@ private: * * @param[in] strKey The key on which the error refers * @param[in] strMessage The error message - * @param[in] pInstanceConfigurableElement The element on wich the error refers + * @param[in] pConfigurableElementWithMapping The element on which the error refers * * returns The formated error string */ - string getMappingError(const string& strKey, - const string& strMessage, - const CInstanceConfigurableElement* pInstanceConfigurableElement) const; + string getMappingError( + const string& strKey, + const string& strMessage, + const CConfigurableElementWithMapping* pConfigurableElementWithMapping) const; /** * Format the mapping data of the ConfigurableElements that have been gathered through recursive @@ -193,15 +198,16 @@ private: * * Feed context with mapping data of the current element * - * @param[in] pInstanceConfigurableElement The element containing mapping data + * @param[in] pConfigurableElementWithMapping The element containing mapping data * @param[out] context The context mapping to update with the current element mapping values * @param[out] strError The formated error string * * @return true on success */ - bool handleMappingContext(const CInstanceConfigurableElement* pInstanceConfigurableElement, - CMappingContext& context, - string& strError) const; + bool handleMappingContext( + const CConfigurableElementWithMapping* pConfigurableElementWithMapping, + CMappingContext& context, + string& strError) const; /** * Looks if a subsystem object needs to be instantiated for the given configurable @@ -239,4 +245,7 @@ private: // Endianness bool _bBigEndian; + + //! Contains the mapping info at Subsystem level + CMappingData* _pMappingData; }; diff --git a/parameter/SubsystemObject.cpp b/parameter/SubsystemObject.cpp index fd263c6..fb635c8 100755 --- a/parameter/SubsystemObject.cpp +++ b/parameter/SubsystemObject.cpp @@ -222,7 +222,9 @@ void CSubsystemObject::log_info(const string& strMessage, ...) const va_end(listPointer); - _pInstanceConfigurableElement->log_info(pacBuffer); + if (pacBuffer != NULL) { + _pInstanceConfigurableElement->log_info(pacBuffer); + } free(pacBuffer); } @@ -238,7 +240,9 @@ void CSubsystemObject::log_warning(const string& strMessage, ...) const va_end(listPointer); - _pInstanceConfigurableElement->log_warning(pacBuffer); + if (pacBuffer != NULL) { + _pInstanceConfigurableElement->log_warning(pacBuffer); + } free(pacBuffer); } diff --git a/parameter/SystemClass.cpp b/parameter/SystemClass.cpp index e4fab19..8ab7c94 100644 --- a/parameter/SystemClass.cpp +++ b/parameter/SystemClass.cpp @@ -219,9 +219,13 @@ bool CSystemClass::loadPlugins(list<string>& lstrPluginFiles, list<string>& lstr if (!lib_handle) { + const char *err = dlerror(); // Failed - lstrError.push_back("Plugin load failed: " + string(dlerror())); - + if (err == NULL) { + lstrError.push_back("dlerror failed"); + } else { + lstrError.push_back("Plugin load failed: " + string(err)); + } // Next plugin ++it; diff --git a/parameter/XmlFileIncluderElement.cpp b/parameter/XmlFileIncluderElement.cpp index 8543744..2e97bdb 100644 --- a/parameter/XmlFileIncluderElement.cpp +++ b/parameter/XmlFileIncluderElement.cpp @@ -36,9 +36,12 @@ #include <assert.h> #define base CKindElement - -CXmlFileIncluderElement::CXmlFileIncluderElement(const string& strName, const string& strKind) : base(strName, strKind) +CXmlFileIncluderElement::CXmlFileIncluderElement(const string& strName, + const string& strKind, + bool bValidateWithSchemas) : base(strName, + strKind) { + _bValidateSchemasOnStart = bValidateWithSchemas; } // From IXmlSink @@ -58,13 +61,18 @@ bool CXmlFileIncluderElement::fromXml(const CXmlElement& xmlElement, CXmlSeriali // Instantiate parser string strIncludedElementType = getIncludedElementType(); - { // Open a log section titled with loading file path CAutoLog autolog(this, "Loading " + strPath); // Use a doc source that load data from a file - CXmlFileDocSource fileDocSource(strPath, elementSerializingContext.getXmlSchemaPathFolder() + "/" + strIncludedElementType + ".xsd", strIncludedElementType); + string strPathToXsdFile = elementSerializingContext.getXmlSchemaPathFolder() + "/" + + strIncludedElementType + ".xsd"; + + CXmlFileDocSource fileDocSource(strPath, + strPathToXsdFile, + strIncludedElementType, + _bValidateSchemasOnStart); if (!fileDocSource.isParsable(elementSerializingContext)) { diff --git a/parameter/XmlFileIncluderElement.h b/parameter/XmlFileIncluderElement.h index 7471962..1a88ce2 100644 --- a/parameter/XmlFileIncluderElement.h +++ b/parameter/XmlFileIncluderElement.h @@ -35,11 +35,13 @@ class CXmlFileIncluderElement : public CKindElement { public: - CXmlFileIncluderElement(const string& strName, const string& strKind); - + CXmlFileIncluderElement(const string& strName, + const string& strKind, + bool bValidateWithSchemas); // From IXmlSink virtual bool fromXml(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext); private: // Element type string getIncludedElementType() const; + bool _bValidateSchemasOnStart; }; diff --git a/parameter/include/ParameterMgrPlatformConnector.h b/parameter/include/ParameterMgrPlatformConnector.h index 71819f9..d489545 100644 --- a/parameter/include/ParameterMgrPlatformConnector.h +++ b/parameter/include/ParameterMgrPlatformConnector.h @@ -114,6 +114,23 @@ public: */ bool getFailureOnFailedSettingsLoad(); + /** Should .xml files be validated on start ? + * + * @param[in] bValidate: + * If set to true, parameterMgr will abort when being unable to validate .xml files + * If set to false, no .xml/xsd validation will happen (default behaviour) + * @param[out] strResult a string containing the result of the command. + * + * @return false if unable to set, true otherwise. + */ + bool setValidateSchemasOnStart(bool bValidate, std::string &strError); + + /** Would .xml files be validated on start? + * + * @return areSchemasValidated + */ + bool getValidateSchemasOnStart(); + private: CParameterMgrPlatformConnector(const CParameterMgrPlatformConnector&); CParameterMgrPlatformConnector& operator=(const CParameterMgrPlatformConnector&); @@ -129,4 +146,3 @@ private: // Private logging CParameterMgrLogger* _pParameterMgrLogger; }; - diff --git a/remote-process/main.cpp b/remote-process/main.cpp index 2daa055..bcf825b 100644 --- a/remote-process/main.cpp +++ b/remote-process/main.cpp @@ -98,17 +98,21 @@ public: bool sendAndDisplayCommand(CConnectionSocket &connectionSocket, CRequestMessage &requestMessage) { - if (!requestMessage.serialize(&connectionSocket, true)) { + string strError; + + if (requestMessage.serialize(&connectionSocket, true, strError) + != CRequestMessage::success) { - cerr << "Unable to send command to target" << endl; + cerr << "Unable to send command to target: " << strError << endl; return false; } ///// Get answer CAnswerMessage answerMessage; - if (!answerMessage.serialize(&connectionSocket, false)) { + if (answerMessage.serialize(&connectionSocket, false, strError) + != CRequestMessage::success) { - cerr << "No answer received from target" << endl; + cerr << "Unable to received answer from target: " << strError << endl; return false; } diff --git a/remote-processor/Message.cpp b/remote-processor/Message.cpp index 8efec1f..8591847 100644 --- a/remote-processor/Message.cpp +++ b/remote-processor/Message.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 2011-2014, Intel Corporation * All rights reserved. * @@ -33,6 +33,7 @@ #include "RemoteProcessorProtocol.h" #include <string.h> #include <assert.h> +#include <errno.h> CMessage::CMessage(uint8_t ucMsgId) : _ucMsgId(ucMsgId), _pucData(NULL), _uiDataSize(0), _uiIndex(0) { @@ -123,7 +124,7 @@ uint32_t CMessage::getRemainingDataSize() const } // Send/Receive -bool CMessage::serialize(CSocket* pSocket, bool bOut) +CMessage::Result CMessage::serialize(CSocket* pSocket, bool bOut, string& strError) { if (bOut) { @@ -141,7 +142,10 @@ bool CMessage::serialize(CSocket* pSocket, bool bOut) if (!pSocket->write(&uiSyncWord, sizeof(uiSyncWord))) { - return false; + if (pSocket->hasPeerDisconnected()) { + return peerDisconnected; + } + return error; } // Size @@ -149,19 +153,22 @@ bool CMessage::serialize(CSocket* pSocket, bool bOut) if (!pSocket->write(&uiSize, sizeof(uiSize))) { - return false; + strError += string("Size write failed:Â ") + strerror(errno); + return error; } // Msg Id if (!pSocket->write(&_ucMsgId, sizeof(_ucMsgId))) { - return false; + strError += string("Msg write failed:Â ") + strerror(errno); + return error; } // Data if (!pSocket->write(_pucData, _uiDataSize)) { - return false; + strError = string("Data write failed:Â ") + strerror(errno); + return error; } // Checksum @@ -169,7 +176,8 @@ bool CMessage::serialize(CSocket* pSocket, bool bOut) if (!pSocket->write(&ucChecksum, sizeof(ucChecksum))) { - return false; + strError = string("Checksum write failed:Â ") + strerror(errno); + return error; } } else { @@ -178,13 +186,18 @@ bool CMessage::serialize(CSocket* pSocket, bool bOut) if (!pSocket->read(&uiSyncWord, sizeof(uiSyncWord))) { - return false; + strError = string("Sync read failed:Â ") + strerror(errno); + if (pSocket->hasPeerDisconnected()) { + return peerDisconnected; + } + return error; } // Check Sync word if (uiSyncWord != SYNC_WORD) { - return false; + strError = "Sync word incorrect"; + return error; } // Size @@ -192,13 +205,15 @@ bool CMessage::serialize(CSocket* pSocket, bool bOut) if (!pSocket->read(&uiSize, sizeof(uiSize))) { - return false; + strError = string("Size read failed:Â ") + strerror(errno); + return error; } // Msg Id if (!pSocket->read(&_ucMsgId, sizeof(_ucMsgId))) { - return false; + strError = string("Msg id read failed:Â ") + strerror(errno); + return error; } // Data @@ -209,7 +224,8 @@ bool CMessage::serialize(CSocket* pSocket, bool bOut) // Data receive if (!pSocket->read(_pucData, _uiDataSize)) { - return false; + strError = string("Data read failed:Â ") + strerror(errno); + return error; } // Checksum @@ -217,19 +233,21 @@ bool CMessage::serialize(CSocket* pSocket, bool bOut) if (!pSocket->read(&ucChecksum, sizeof(ucChecksum))) { - return false; + strError = string("Checksum read failed:Â ") + strerror(errno); + return error; } // Compare if (ucChecksum != computeChecksum()) { - return false; + strError = "Received checksum != computed checksum"; + return error; } // Collect data in derived collectReceivedData(); } - return true; + return success; } // Checksum diff --git a/remote-processor/Message.h b/remote-processor/Message.h index 799a525..feafc83 100644 --- a/remote-processor/Message.h +++ b/remote-processor/Message.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 2011-2014, Intel Corporation * All rights reserved. * @@ -43,8 +43,25 @@ public: CMessage(); virtual ~CMessage(); - // Send/Receive - bool serialize(CSocket* pSocket, bool bOut); + enum Result { + success, + peerDisconnected, + error + }; + + /** Write or read the message on pSocket. + * + * @param[in,out] pSocket is the socket on wich IO operation will be made. + * @param[in] bOut if true message should be read, + * if false it should be written. + * @param[out] strError on failure, a string explaining the error, + * on success, undefined. + * + * @return success if a correct message could be recv/send + * peerDisconnected if the peer disconnected before the first socket access. + * error if the message could not be read/write for any other reason + */ + Result serialize(CSocket* pSocket, bool bOut, std::string &strError); protected: // Msg Id diff --git a/remote-processor/RemoteProcessorServer.cpp b/remote-processor/RemoteProcessorServer.cpp index daa4894..8c66109 100644 --- a/remote-processor/RemoteProcessorServer.cpp +++ b/remote-processor/RemoteProcessorServer.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 2011-2014, Intel Corporation * All rights reserved. * @@ -29,6 +29,8 @@ */ #include "RemoteProcessorServer.h" #include "ListeningSocket.h" +#include <iostream> +#include <memory> #include <assert.h> #include <poll.h> #include <unistd.h> @@ -146,15 +148,15 @@ void CRemoteProcessorServer::run() // New connection void CRemoteProcessorServer::handleNewConnection() { - CSocket* pClientSocket = _pListeningSocket->accept(); + const auto_ptr<CSocket> clientSocket(_pListeningSocket->accept()); - if (!pClientSocket) { + if (clientSocket.get() == NULL) { return; } // Set timeout - pClientSocket->setTimeout(5000); + clientSocket->setTimeout(5000); // Process all incoming requests from the client while (true) { @@ -163,11 +165,20 @@ void CRemoteProcessorServer::handleNewConnection() // Create command message CRequestMessage requestMessage; + string strError; ///// Receive command - if (!requestMessage.serialize(pClientSocket, false)) { - - // Bail out - break; + CRequestMessage::Result res; + res = requestMessage.serialize(clientSocket.get(), false, strError); + + switch (res) { + case CRequestMessage::error: + cout << "Error while receiving message: " << strError << endl; + // fall through + case CRequestMessage::peerDisconnected: + // Consider peer disconnection as normal, no log + return; // Bail out + case CRequestMessage::success: + break; // No error, continue } // Actually process the request @@ -191,12 +202,17 @@ void CRemoteProcessorServer::handleNewConnection() CAnswerMessage answerMessage(strResult, bSuccess); ///// Send answer - if (!answerMessage.serialize(pClientSocket, true)) { - - // Bail out - break; + res = answerMessage.serialize(clientSocket.get(), true, strError); + + switch (res) { + case CRequestMessage::peerDisconnected: + // Peer should not disconnect while waiting for an answer + // Fall through to log the error and bail out + case CRequestMessage::error: + cout << "Error while receiving message: " << strError << endl; + return; // Bail out + case CRequestMessage::success: + break; // No error, continue } } - // Remove client socket - delete pClientSocket; } diff --git a/remote-processor/Socket.cpp b/remote-processor/Socket.cpp index d79b45a..b36d32f 100644 --- a/remote-processor/Socket.cpp +++ b/remote-processor/Socket.cpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 2011-2014, Intel Corporation * All rights reserved. * @@ -34,6 +34,7 @@ #include <assert.h> #include <netdb.h> #include <strings.h> +#include <errno.h> #include <fcntl.h> #include <netinet/in.h> #include <netinet/tcp.h> @@ -109,12 +110,24 @@ bool CSocket::read(void* pvData, uint32_t uiSize) int32_t iAccessedSize = ::recv(_iSockFd, &pucData[uiOffset], uiSize, MSG_NOSIGNAL); - if (!iAccessedSize || iAccessedSize == -1) { - + switch (iAccessedSize) { + case 0: + // recv return value is 0 when the peer has performed an orderly shutdown. + _disconnected = true; + errno = ECONNRESET; // Warn the client that the client disconnected. return false; + + case -1: + // errno == EINTR => The recv system call was interrupted, try again + if (errno != EINTR) { + return false; + } + break; + + default: + uiSize -= iAccessedSize; + uiOffset += iAccessedSize; } - uiSize -= iAccessedSize; - uiOffset += iAccessedSize; } return true; } @@ -129,12 +142,19 @@ bool CSocket::write(const void* pvData, uint32_t uiSize) int32_t iAccessedSize = ::send(_iSockFd, &pucData[uiOffset], uiSize, MSG_NOSIGNAL); - if (!iAccessedSize || iAccessedSize == -1) { - - return false; + if (iAccessedSize == -1) { + if (errno == ECONNRESET) { + // Peer has disconnected + _disconnected = true; + } + // errno == EINTR => The send system call was interrupted, try again + if (errno != EINTR) { + return false; + } + } else { + uiSize -= iAccessedSize; + uiOffset += iAccessedSize; } - uiSize -= iAccessedSize; - uiOffset += iAccessedSize; } return true; } @@ -144,3 +164,7 @@ int CSocket::getFd() const { return _iSockFd; } + +bool CSocket::hasPeerDisconnected() { + return _disconnected; +} diff --git a/remote-processor/Socket.h b/remote-processor/Socket.h index 9ecc38a..e8d360f 100644 --- a/remote-processor/Socket.h +++ b/remote-processor/Socket.h @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 2011-2014, Intel Corporation * All rights reserved. * @@ -37,6 +37,14 @@ using namespace std; struct sockaddr_in; struct in_addr; +/** Readable and writable socket. + * + * The class does not encapsulate completely it's internal file descriptor as + * it can be retrieve by the getFd method. + * + * This "feature" means that it's state consistency can not + * be enforced by the class but rather by clients. + */ class CSocket { public: @@ -50,16 +58,56 @@ public: // Communication timeout void setTimeout(uint32_t uiMilliseconds); - // Read + /* Read data + * + * On failure errno will be set appropriately (see send). + * If the client disconnects, false will be returned and + * - hasPeerDisconnected will return true + * - errno is set to ECONNRESET. + * @param[in] pvData - on success: will contain the sent data + * - on failure: undefined + * @param[in] uiSize size of the data to receive. + * + * @return true if all data could be read, false otherwise. + */ bool read(void* pvData, uint32_t uiSize); - // Write + + /* Write data + * + * On failure errno will be set (see recv) + * @param[in] pvData data to send. + * @param[in] uiSize is the size of the data to send. + * + * @return true if all data could be read, false otherwise. + */ bool write(const void* pvData, uint32_t uiSize); - // Fd + /** @return the managed file descriptor. + * + * The client can then bind/connect/accept/listen/... the socket. + */ int getFd() const; + + /** @return true if the peer has disconnected. + * + * The internal fd is returned by getFd and clients can use it for + * bind/connect/read/write/... as a result it's state can not be tracked. + * + * Thus hasPeerDisconnected returns true only if the disconnection + * was notified during a call to CSocket::write or CSocket::read. + */ + bool hasPeerDisconnected(); + protected: // Socket address init void initSockAddrIn(struct sockaddr_in* pSockAddrIn, uint32_t uiInAddr, uint16_t uiPort) const; private: int _iSockFd; + /** If the peer disconnected. + * + * This is not the state of _iSockFd (connected/disconnected) + * + * See hasPeerDisconnected for more details. + */ + bool _disconnected; }; diff --git a/test/test-fixed-point-parameter/Main.py b/test/test-fixed-point-parameter/Main.py new file mode 100755 index 0000000..09cff28 --- /dev/null +++ b/test/test-fixed-point-parameter/Main.py @@ -0,0 +1,240 @@ +#!/usr/bin/python2.7 +# +# Copyright (c) 2014, Intel Corporation +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation and/or +# other materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import sys +import subprocess +from decimal import Decimal + +class FixedPointTester(): + """ Made for testing a particular Qn.m number + + As a convention, we use: + * n is the fractional part + * m is the integral part + + This class computes several specific numbers for a given Qn.m number. + + For each of those numbers, we run 4 checks: + * Bound check + * Sanity check + * Consistency check + * Bijectivity check + Which are documented below. + """ + def __init__(self, pfwClient, integral, fractional): + self._pfwClient = pfwClient + self._paramPath = '/Test/test/q%d.%d' % (integral, fractional) + + # quantum is the step we have between two numbers + # encoded in Qn.m format + self._quantum = 2 ** -fractional + + # The maximum value we can encode for a given Qn.m. + # Since we also need to encode the 0, we have one quantum missing on + # the positive maximum + self._upperAllowedBound = (2 ** integral) - self._quantum + + # The minimum value that we can encode for a given Qn.m. + # This one does not need a quantum substraction since we already did + # that on the maximum + self._lowerAllowedBound = -(2 ** integral) + + self._shouldWork = [ + Decimal(0), + Decimal(self._lowerAllowedBound), + Decimal(self._upperAllowedBound) + ] + + # bigValue is to be sure a value far out of range is refused + bigValue = (2 * self._quantum) + # little is to be sure a value just out of range is refused + littleValue = 10 ** -fractional + self._shouldBreak = [ + Decimal(self._lowerAllowedBound) - Decimal(bigValue), + Decimal(self._upperAllowedBound) + Decimal(bigValue), + Decimal(self._lowerAllowedBound) - Decimal(littleValue), + Decimal(self._upperAllowedBound) + Decimal(littleValue) + ] + + + def run(self): + """ Runs the test suite for a given Qn.m number + """ + for value in self._shouldWork: + print('Testing %s for %s' % (value, self._paramPath)) + value, success = self.checkBounds(value) + if not success: + print('Bound ERROR for %s' % self._paramPath) + continue + + value, success = self.checkSanity(value) + if not success: + print('Sanity ERROR %s' % self._paramPath) + continue + + value, success = self.checkConsistency(value) + if not success: + print('Consistency ERROR %s' % self._paramPath) + continue + + value, success = self.checkBijectivity(value) + if not success: + print('Bijectivity ERROR %s' % self._paramPath) + continue + + for value in self._shouldBreak: + print('Testing invalid value %s for %s' % (value, self._paramPath)) + value, success = self.checkBounds(value) + if success: + print("ERROR: This test should have failed but it has not") + + def checkBounds(self, valueToSet): + """ Checks if we are able to set valueToSet via the parameter-framework + + valueToSet -- the value we are trying to set + + returns: the value we are trying to set + returns: True if we are able to set, False otherwise + """ + returnCode = self._pfwClient.set(self._paramPath, str(valueToSet)) + if returnCode != 0: + return (valueToSet, False) + + return (valueToSet, True) + + + def checkSanity(self, valuePreviouslySet): + """ Checks if the value we get is still approximately the same + as we attempted to set. The value can have a slight round error which + is tolerated. + + valuePreviouslySet -- the value we had previously set + + returns: the value the parameter-framework returns us after the get + returns: True if we are able to set, False otherwise + """ + firstGet = self._pfwClient.get(self._paramPath) + + try: + returnValue = Decimal(firstGet) + except ValueError: + print("ERROR: Can't convert %s to a decimal" % firstGet) + return firstGet, False + + upperAllowedValue = Decimal(valuePreviouslySet) + (Decimal(self._quantum) / Decimal(2)) + lowerAllowedValue = Decimal(valuePreviouslySet) - (Decimal(self._quantum) / Decimal(2)) + + if not (lowerAllowedValue <= returnValue <= upperAllowedValue): + print('%s <= %s <= %s is not true' % + (lowerAllowedValue, returnValue, upperAllowedValue)) + return firstGet, False + + return firstGet, True + + def checkConsistency(self, valuePreviouslyGotten): + """ Checks if we are able to set the value that the parameter framework + just returned to us. + + valuePreviouslyGotten -- the value we are trying to set + + valueToSet -- the value we are trying to set + returns: True if we are able to set, False otherwise + """ + returnCode = pfw.set(self._paramPath, valuePreviouslyGotten) + if returnCode != 0: + return valuePreviouslyGotten, False + + return valuePreviouslyGotten, True + + def checkBijectivity(self, valuePreviouslySet): + """ Checks that the second get value is strictly equivalent to the + consistency set. This ensures that the parameter-framework behaves as + expected. + + valuePreviouslySet -- the value we had previously set + + returns: value the parameter-framework returns us after the second get + returns: True if we are able to set, False otherwise + """ + secondGet = pfw.get(self._paramPath) + if secondGet != valuePreviouslySet: + return secondGet, False + + return secondGet, True + +class PfwClient(): + + def __init__(self, configPath): + self._address = 'localhost' + self._port = '5066' + self._testPlatformPort = '5063' + self._pathToExec = 'remote-process_host' + self._configPath = configPath + + def __enter__(self): + # launch test platform in deamon mode + subprocess.call(['test-platform_host', '-d', self._configPath, self._testPlatformPort]) + subprocess.call([self._pathToExec, self._address, self._testPlatformPort, 'start']) + self._callCommand(['setTuningMode', 'on']) + return self + + def __exit__(self, type, value, traceback): + subprocess.call([self._pathToExec, self._address, self._testPlatformPort, 'exit']) + + def _callCommand(self, commandList): + shellCommand = [self._pathToExec, self._address, self._port] + shellCommand.extend(commandList) + # pipes are used to redirect the command output to a variable + subProc = subprocess.Popen(shellCommand, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + commandOutPut, _ = subProc.communicate() + returnCode = subProc.returncode + return commandOutPut, returnCode + + def set(self, parameter, value): + print('set %s <--- %s' % (parameter, value)) + (returnValue, returnCode) = self._callCommand(['setParameter', parameter, value]) + return returnCode + + def get(self, parameter): + (returnValue, _) = self._callCommand(['getParameter', parameter]) + print('get %s ---> %s' % (parameter, returnValue.strip())) + return returnValue.strip() + +if __name__ == '__main__': + # It is necessary to add a ./ in front of the path, otherwise the parameter-framework + # does not recognize the string as a path. + configPath = './ParameterFrameworkConfiguration.xml' + + with PfwClient(configPath) as pfw: + for integral in range(0, 31): + for fractional in range (0, 31 - integral): + tester = FixedPointTester(pfw, integral, fractional) + tester.run() + diff --git a/test/test-fixed-point-parameter/ParameterFrameworkConfiguration.xml b/test/test-fixed-point-parameter/ParameterFrameworkConfiguration.xml new file mode 100644 index 0000000..e803682 --- /dev/null +++ b/test/test-fixed-point-parameter/ParameterFrameworkConfiguration.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ParameterFrameworkConfiguration SystemClassName="Test" ServerPort="5066" TuningAllowed="true"> + <SubsystemPlugins> + </SubsystemPlugins> + <StructureDescriptionFileLocation Path="TestClass.xml"/> +</ParameterFrameworkConfiguration> diff --git a/test/test-fixed-point-parameter/Schemas b/test/test-fixed-point-parameter/Schemas new file mode 120000 index 0000000..6b039cb --- /dev/null +++ b/test/test-fixed-point-parameter/Schemas @@ -0,0 +1 @@ +../../Schemas/
\ No newline at end of file diff --git a/test/test-fixed-point-parameter/TestClass.xml b/test/test-fixed-point-parameter/TestClass.xml new file mode 100644 index 0000000..db1b0bc --- /dev/null +++ b/test/test-fixed-point-parameter/TestClass.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<SystemClass Name="Test"> + <SubsystemInclude Path="VirtualSubsystem.xml"/> +</SystemClass> diff --git a/test/test-fixed-point-parameter/VirtualSubsystem.xml b/test/test-fixed-point-parameter/VirtualSubsystem.xml new file mode 100644 index 0000000..fccaf2c --- /dev/null +++ b/test/test-fixed-point-parameter/VirtualSubsystem.xml @@ -0,0 +1,715 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Subsystem Name="test" Type="Virtual" Endianness="Little"> + <ComponentLibrary> + </ComponentLibrary> + <InstanceDefinition> + + <!-- 32b --> + <FixedPointParameter Name="q0.0" Size="32" Integral="0" Fractional="0"/> + <FixedPointParameter Name="q0.1" Size="32" Integral="0" Fractional="1"/> + <FixedPointParameter Name="q0.2" Size="32" Integral="0" Fractional="2"/> + <FixedPointParameter Name="q0.3" Size="32" Integral="0" Fractional="3"/> + <FixedPointParameter Name="q0.4" Size="32" Integral="0" Fractional="4"/> + <FixedPointParameter Name="q0.5" Size="32" Integral="0" Fractional="5"/> + <FixedPointParameter Name="q0.6" Size="32" Integral="0" Fractional="6"/> + <FixedPointParameter Name="q0.7" Size="32" Integral="0" Fractional="7"/> + <FixedPointParameter Name="q0.8" Size="32" Integral="0" Fractional="8"/> + <FixedPointParameter Name="q0.9" Size="32" Integral="0" Fractional="9"/> + <FixedPointParameter Name="q0.10" Size="32" Integral="0" Fractional="10"/> + <FixedPointParameter Name="q0.11" Size="32" Integral="0" Fractional="11"/> + <FixedPointParameter Name="q0.12" Size="32" Integral="0" Fractional="12"/> + <FixedPointParameter Name="q0.13" Size="32" Integral="0" Fractional="13"/> + <FixedPointParameter Name="q0.14" Size="32" Integral="0" Fractional="14"/> + <FixedPointParameter Name="q0.15" Size="32" Integral="0" Fractional="15"/> + <FixedPointParameter Name="q0.16" Size="32" Integral="0" Fractional="16"/> + <FixedPointParameter Name="q0.17" Size="32" Integral="0" Fractional="17"/> + <FixedPointParameter Name="q0.18" Size="32" Integral="0" Fractional="18"/> + <FixedPointParameter Name="q0.19" Size="32" Integral="0" Fractional="19"/> + <FixedPointParameter Name="q0.20" Size="32" Integral="0" Fractional="20"/> + <FixedPointParameter Name="q0.21" Size="32" Integral="0" Fractional="21"/> + <FixedPointParameter Name="q0.22" Size="32" Integral="0" Fractional="22"/> + <FixedPointParameter Name="q0.23" Size="32" Integral="0" Fractional="23"/> + <FixedPointParameter Name="q0.24" Size="32" Integral="0" Fractional="24"/> + <FixedPointParameter Name="q0.25" Size="32" Integral="0" Fractional="25"/> + <FixedPointParameter Name="q0.26" Size="32" Integral="0" Fractional="26"/> + <FixedPointParameter Name="q0.27" Size="32" Integral="0" Fractional="27"/> + <FixedPointParameter Name="q0.28" Size="32" Integral="0" Fractional="28"/> + <FixedPointParameter Name="q0.29" Size="32" Integral="0" Fractional="29"/> + <FixedPointParameter Name="q0.30" Size="32" Integral="0" Fractional="30"/> + <FixedPointParameter Name="q0.31" Size="32" Integral="0" Fractional="31"/> + <FixedPointParameter Name="q1.0" Size="32" Integral="1" Fractional="0"/> + <FixedPointParameter Name="q1.1" Size="32" Integral="1" Fractional="1"/> + <FixedPointParameter Name="q1.2" Size="32" Integral="1" Fractional="2"/> + <FixedPointParameter Name="q1.3" Size="32" Integral="1" Fractional="3"/> + <FixedPointParameter Name="q1.4" Size="32" Integral="1" Fractional="4"/> + <FixedPointParameter Name="q1.5" Size="32" Integral="1" Fractional="5"/> + <FixedPointParameter Name="q1.6" Size="32" Integral="1" Fractional="6"/> + <FixedPointParameter Name="q1.7" Size="32" Integral="1" Fractional="7"/> + <FixedPointParameter Name="q1.8" Size="32" Integral="1" Fractional="8"/> + <FixedPointParameter Name="q1.9" Size="32" Integral="1" Fractional="9"/> + <FixedPointParameter Name="q1.10" Size="32" Integral="1" Fractional="10"/> + <FixedPointParameter Name="q1.11" Size="32" Integral="1" Fractional="11"/> + <FixedPointParameter Name="q1.12" Size="32" Integral="1" Fractional="12"/> + <FixedPointParameter Name="q1.13" Size="32" Integral="1" Fractional="13"/> + <FixedPointParameter Name="q1.14" Size="32" Integral="1" Fractional="14"/> + <FixedPointParameter Name="q1.15" Size="32" Integral="1" Fractional="15"/> + <FixedPointParameter Name="q1.16" Size="32" Integral="1" Fractional="16"/> + <FixedPointParameter Name="q1.17" Size="32" Integral="1" Fractional="17"/> + <FixedPointParameter Name="q1.18" Size="32" Integral="1" Fractional="18"/> + <FixedPointParameter Name="q1.19" Size="32" Integral="1" Fractional="19"/> + <FixedPointParameter Name="q1.20" Size="32" Integral="1" Fractional="20"/> + <FixedPointParameter Name="q1.21" Size="32" Integral="1" Fractional="21"/> + <FixedPointParameter Name="q1.22" Size="32" Integral="1" Fractional="22"/> + <FixedPointParameter Name="q1.23" Size="32" Integral="1" Fractional="23"/> + <FixedPointParameter Name="q1.24" Size="32" Integral="1" Fractional="24"/> + <FixedPointParameter Name="q1.25" Size="32" Integral="1" Fractional="25"/> + <FixedPointParameter Name="q1.26" Size="32" Integral="1" Fractional="26"/> + <FixedPointParameter Name="q1.27" Size="32" Integral="1" Fractional="27"/> + <FixedPointParameter Name="q1.28" Size="32" Integral="1" Fractional="28"/> + <FixedPointParameter Name="q1.29" Size="32" Integral="1" Fractional="29"/> + <FixedPointParameter Name="q1.30" Size="32" Integral="1" Fractional="30"/> + <FixedPointParameter Name="q2.0" Size="32" Integral="2" Fractional="0"/> + <FixedPointParameter Name="q2.1" Size="32" Integral="2" Fractional="1"/> + <FixedPointParameter Name="q2.2" Size="32" Integral="2" Fractional="2"/> + <FixedPointParameter Name="q2.3" Size="32" Integral="2" Fractional="3"/> + <FixedPointParameter Name="q2.4" Size="32" Integral="2" Fractional="4"/> + <FixedPointParameter Name="q2.5" Size="32" Integral="2" Fractional="5"/> + <FixedPointParameter Name="q2.6" Size="32" Integral="2" Fractional="6"/> + <FixedPointParameter Name="q2.7" Size="32" Integral="2" Fractional="7"/> + <FixedPointParameter Name="q2.8" Size="32" Integral="2" Fractional="8"/> + <FixedPointParameter Name="q2.9" Size="32" Integral="2" Fractional="9"/> + <FixedPointParameter Name="q2.10" Size="32" Integral="2" Fractional="10"/> + <FixedPointParameter Name="q2.11" Size="32" Integral="2" Fractional="11"/> + <FixedPointParameter Name="q2.12" Size="32" Integral="2" Fractional="12"/> + <FixedPointParameter Name="q2.13" Size="32" Integral="2" Fractional="13"/> + <FixedPointParameter Name="q2.14" Size="32" Integral="2" Fractional="14"/> + <FixedPointParameter Name="q2.15" Size="32" Integral="2" Fractional="15"/> + <FixedPointParameter Name="q2.16" Size="32" Integral="2" Fractional="16"/> + <FixedPointParameter Name="q2.17" Size="32" Integral="2" Fractional="17"/> + <FixedPointParameter Name="q2.18" Size="32" Integral="2" Fractional="18"/> + <FixedPointParameter Name="q2.19" Size="32" Integral="2" Fractional="19"/> + <FixedPointParameter Name="q2.20" Size="32" Integral="2" Fractional="20"/> + <FixedPointParameter Name="q2.21" Size="32" Integral="2" Fractional="21"/> + <FixedPointParameter Name="q2.22" Size="32" Integral="2" Fractional="22"/> + <FixedPointParameter Name="q2.23" Size="32" Integral="2" Fractional="23"/> + <FixedPointParameter Name="q2.24" Size="32" Integral="2" Fractional="24"/> + <FixedPointParameter Name="q2.25" Size="32" Integral="2" Fractional="25"/> + <FixedPointParameter Name="q2.26" Size="32" Integral="2" Fractional="26"/> + <FixedPointParameter Name="q2.27" Size="32" Integral="2" Fractional="27"/> + <FixedPointParameter Name="q2.28" Size="32" Integral="2" Fractional="28"/> + <FixedPointParameter Name="q2.29" Size="32" Integral="2" Fractional="29"/> + <FixedPointParameter Name="q3.0" Size="32" Integral="3" Fractional="0"/> + <FixedPointParameter Name="q3.1" Size="32" Integral="3" Fractional="1"/> + <FixedPointParameter Name="q3.2" Size="32" Integral="3" Fractional="2"/> + <FixedPointParameter Name="q3.3" Size="32" Integral="3" Fractional="3"/> + <FixedPointParameter Name="q3.4" Size="32" Integral="3" Fractional="4"/> + <FixedPointParameter Name="q3.5" Size="32" Integral="3" Fractional="5"/> + <FixedPointParameter Name="q3.6" Size="32" Integral="3" Fractional="6"/> + <FixedPointParameter Name="q3.7" Size="32" Integral="3" Fractional="7"/> + <FixedPointParameter Name="q3.8" Size="32" Integral="3" Fractional="8"/> + <FixedPointParameter Name="q3.9" Size="32" Integral="3" Fractional="9"/> + <FixedPointParameter Name="q3.10" Size="32" Integral="3" Fractional="10"/> + <FixedPointParameter Name="q3.11" Size="32" Integral="3" Fractional="11"/> + <FixedPointParameter Name="q3.12" Size="32" Integral="3" Fractional="12"/> + <FixedPointParameter Name="q3.13" Size="32" Integral="3" Fractional="13"/> + <FixedPointParameter Name="q3.14" Size="32" Integral="3" Fractional="14"/> + <FixedPointParameter Name="q3.15" Size="32" Integral="3" Fractional="15"/> + <FixedPointParameter Name="q3.16" Size="32" Integral="3" Fractional="16"/> + <FixedPointParameter Name="q3.17" Size="32" Integral="3" Fractional="17"/> + <FixedPointParameter Name="q3.18" Size="32" Integral="3" Fractional="18"/> + <FixedPointParameter Name="q3.19" Size="32" Integral="3" Fractional="19"/> + <FixedPointParameter Name="q3.20" Size="32" Integral="3" Fractional="20"/> + <FixedPointParameter Name="q3.21" Size="32" Integral="3" Fractional="21"/> + <FixedPointParameter Name="q3.22" Size="32" Integral="3" Fractional="22"/> + <FixedPointParameter Name="q3.23" Size="32" Integral="3" Fractional="23"/> + <FixedPointParameter Name="q3.24" Size="32" Integral="3" Fractional="24"/> + <FixedPointParameter Name="q3.25" Size="32" Integral="3" Fractional="25"/> + <FixedPointParameter Name="q3.26" Size="32" Integral="3" Fractional="26"/> + <FixedPointParameter Name="q3.27" Size="32" Integral="3" Fractional="27"/> + <FixedPointParameter Name="q3.28" Size="32" Integral="3" Fractional="28"/> + <FixedPointParameter Name="q4.0" Size="32" Integral="4" Fractional="0"/> + <FixedPointParameter Name="q4.1" Size="32" Integral="4" Fractional="1"/> + <FixedPointParameter Name="q4.2" Size="32" Integral="4" Fractional="2"/> + <FixedPointParameter Name="q4.3" Size="32" Integral="4" Fractional="3"/> + <FixedPointParameter Name="q4.4" Size="32" Integral="4" Fractional="4"/> + <FixedPointParameter Name="q4.5" Size="32" Integral="4" Fractional="5"/> + <FixedPointParameter Name="q4.6" Size="32" Integral="4" Fractional="6"/> + <FixedPointParameter Name="q4.7" Size="32" Integral="4" Fractional="7"/> + <FixedPointParameter Name="q4.8" Size="32" Integral="4" Fractional="8"/> + <FixedPointParameter Name="q4.9" Size="32" Integral="4" Fractional="9"/> + <FixedPointParameter Name="q4.10" Size="32" Integral="4" Fractional="10"/> + <FixedPointParameter Name="q4.11" Size="32" Integral="4" Fractional="11"/> + <FixedPointParameter Name="q4.12" Size="32" Integral="4" Fractional="12"/> + <FixedPointParameter Name="q4.13" Size="32" Integral="4" Fractional="13"/> + <FixedPointParameter Name="q4.14" Size="32" Integral="4" Fractional="14"/> + <FixedPointParameter Name="q4.15" Size="32" Integral="4" Fractional="15"/> + <FixedPointParameter Name="q4.16" Size="32" Integral="4" Fractional="16"/> + <FixedPointParameter Name="q4.17" Size="32" Integral="4" Fractional="17"/> + <FixedPointParameter Name="q4.18" Size="32" Integral="4" Fractional="18"/> + <FixedPointParameter Name="q4.19" Size="32" Integral="4" Fractional="19"/> + <FixedPointParameter Name="q4.20" Size="32" Integral="4" Fractional="20"/> + <FixedPointParameter Name="q4.21" Size="32" Integral="4" Fractional="21"/> + <FixedPointParameter Name="q4.22" Size="32" Integral="4" Fractional="22"/> + <FixedPointParameter Name="q4.23" Size="32" Integral="4" Fractional="23"/> + <FixedPointParameter Name="q4.24" Size="32" Integral="4" Fractional="24"/> + <FixedPointParameter Name="q4.25" Size="32" Integral="4" Fractional="25"/> + <FixedPointParameter Name="q4.26" Size="32" Integral="4" Fractional="26"/> + <FixedPointParameter Name="q4.27" Size="32" Integral="4" Fractional="27"/> + <FixedPointParameter Name="q5.0" Size="32" Integral="5" Fractional="0"/> + <FixedPointParameter Name="q5.1" Size="32" Integral="5" Fractional="1"/> + <FixedPointParameter Name="q5.2" Size="32" Integral="5" Fractional="2"/> + <FixedPointParameter Name="q5.3" Size="32" Integral="5" Fractional="3"/> + <FixedPointParameter Name="q5.4" Size="32" Integral="5" Fractional="4"/> + <FixedPointParameter Name="q5.5" Size="32" Integral="5" Fractional="5"/> + <FixedPointParameter Name="q5.6" Size="32" Integral="5" Fractional="6"/> + <FixedPointParameter Name="q5.7" Size="32" Integral="5" Fractional="7"/> + <FixedPointParameter Name="q5.8" Size="32" Integral="5" Fractional="8"/> + <FixedPointParameter Name="q5.9" Size="32" Integral="5" Fractional="9"/> + <FixedPointParameter Name="q5.10" Size="32" Integral="5" Fractional="10"/> + <FixedPointParameter Name="q5.11" Size="32" Integral="5" Fractional="11"/> + <FixedPointParameter Name="q5.12" Size="32" Integral="5" Fractional="12"/> + <FixedPointParameter Name="q5.13" Size="32" Integral="5" Fractional="13"/> + <FixedPointParameter Name="q5.14" Size="32" Integral="5" Fractional="14"/> + <FixedPointParameter Name="q5.15" Size="32" Integral="5" Fractional="15"/> + <FixedPointParameter Name="q5.16" Size="32" Integral="5" Fractional="16"/> + <FixedPointParameter Name="q5.17" Size="32" Integral="5" Fractional="17"/> + <FixedPointParameter Name="q5.18" Size="32" Integral="5" Fractional="18"/> + <FixedPointParameter Name="q5.19" Size="32" Integral="5" Fractional="19"/> + <FixedPointParameter Name="q5.20" Size="32" Integral="5" Fractional="20"/> + <FixedPointParameter Name="q5.21" Size="32" Integral="5" Fractional="21"/> + <FixedPointParameter Name="q5.22" Size="32" Integral="5" Fractional="22"/> + <FixedPointParameter Name="q5.23" Size="32" Integral="5" Fractional="23"/> + <FixedPointParameter Name="q5.24" Size="32" Integral="5" Fractional="24"/> + <FixedPointParameter Name="q5.25" Size="32" Integral="5" Fractional="25"/> + <FixedPointParameter Name="q5.26" Size="32" Integral="5" Fractional="26"/> + <FixedPointParameter Name="q6.0" Size="32" Integral="6" Fractional="0"/> + <FixedPointParameter Name="q6.1" Size="32" Integral="6" Fractional="1"/> + <FixedPointParameter Name="q6.2" Size="32" Integral="6" Fractional="2"/> + <FixedPointParameter Name="q6.3" Size="32" Integral="6" Fractional="3"/> + <FixedPointParameter Name="q6.4" Size="32" Integral="6" Fractional="4"/> + <FixedPointParameter Name="q6.5" Size="32" Integral="6" Fractional="5"/> + <FixedPointParameter Name="q6.6" Size="32" Integral="6" Fractional="6"/> + <FixedPointParameter Name="q6.7" Size="32" Integral="6" Fractional="7"/> + <FixedPointParameter Name="q6.8" Size="32" Integral="6" Fractional="8"/> + <FixedPointParameter Name="q6.9" Size="32" Integral="6" Fractional="9"/> + <FixedPointParameter Name="q6.10" Size="32" Integral="6" Fractional="10"/> + <FixedPointParameter Name="q6.11" Size="32" Integral="6" Fractional="11"/> + <FixedPointParameter Name="q6.12" Size="32" Integral="6" Fractional="12"/> + <FixedPointParameter Name="q6.13" Size="32" Integral="6" Fractional="13"/> + <FixedPointParameter Name="q6.14" Size="32" Integral="6" Fractional="14"/> + <FixedPointParameter Name="q6.15" Size="32" Integral="6" Fractional="15"/> + <FixedPointParameter Name="q6.16" Size="32" Integral="6" Fractional="16"/> + <FixedPointParameter Name="q6.17" Size="32" Integral="6" Fractional="17"/> + <FixedPointParameter Name="q6.18" Size="32" Integral="6" Fractional="18"/> + <FixedPointParameter Name="q6.19" Size="32" Integral="6" Fractional="19"/> + <FixedPointParameter Name="q6.20" Size="32" Integral="6" Fractional="20"/> + <FixedPointParameter Name="q6.21" Size="32" Integral="6" Fractional="21"/> + <FixedPointParameter Name="q6.22" Size="32" Integral="6" Fractional="22"/> + <FixedPointParameter Name="q6.23" Size="32" Integral="6" Fractional="23"/> + <FixedPointParameter Name="q6.24" Size="32" Integral="6" Fractional="24"/> + <FixedPointParameter Name="q6.25" Size="32" Integral="6" Fractional="25"/> + <FixedPointParameter Name="q7.0" Size="32" Integral="7" Fractional="0"/> + <FixedPointParameter Name="q7.1" Size="32" Integral="7" Fractional="1"/> + <FixedPointParameter Name="q7.2" Size="32" Integral="7" Fractional="2"/> + <FixedPointParameter Name="q7.3" Size="32" Integral="7" Fractional="3"/> + <FixedPointParameter Name="q7.4" Size="32" Integral="7" Fractional="4"/> + <FixedPointParameter Name="q7.5" Size="32" Integral="7" Fractional="5"/> + <FixedPointParameter Name="q7.6" Size="32" Integral="7" Fractional="6"/> + <FixedPointParameter Name="q7.7" Size="32" Integral="7" Fractional="7"/> + <FixedPointParameter Name="q7.8" Size="32" Integral="7" Fractional="8"/> + <FixedPointParameter Name="q7.9" Size="32" Integral="7" Fractional="9"/> + <FixedPointParameter Name="q7.10" Size="32" Integral="7" Fractional="10"/> + <FixedPointParameter Name="q7.11" Size="32" Integral="7" Fractional="11"/> + <FixedPointParameter Name="q7.12" Size="32" Integral="7" Fractional="12"/> + <FixedPointParameter Name="q7.13" Size="32" Integral="7" Fractional="13"/> + <FixedPointParameter Name="q7.14" Size="32" Integral="7" Fractional="14"/> + <FixedPointParameter Name="q7.15" Size="32" Integral="7" Fractional="15"/> + <FixedPointParameter Name="q7.16" Size="32" Integral="7" Fractional="16"/> + <FixedPointParameter Name="q7.17" Size="32" Integral="7" Fractional="17"/> + <FixedPointParameter Name="q7.18" Size="32" Integral="7" Fractional="18"/> + <FixedPointParameter Name="q7.19" Size="32" Integral="7" Fractional="19"/> + <FixedPointParameter Name="q7.20" Size="32" Integral="7" Fractional="20"/> + <FixedPointParameter Name="q7.21" Size="32" Integral="7" Fractional="21"/> + <FixedPointParameter Name="q7.22" Size="32" Integral="7" Fractional="22"/> + <FixedPointParameter Name="q7.23" Size="32" Integral="7" Fractional="23"/> + <FixedPointParameter Name="q7.24" Size="32" Integral="7" Fractional="24"/> + <FixedPointParameter Name="q8.0" Size="32" Integral="8" Fractional="0"/> + <FixedPointParameter Name="q8.1" Size="32" Integral="8" Fractional="1"/> + <FixedPointParameter Name="q8.2" Size="32" Integral="8" Fractional="2"/> + <FixedPointParameter Name="q8.3" Size="32" Integral="8" Fractional="3"/> + <FixedPointParameter Name="q8.4" Size="32" Integral="8" Fractional="4"/> + <FixedPointParameter Name="q8.5" Size="32" Integral="8" Fractional="5"/> + <FixedPointParameter Name="q8.6" Size="32" Integral="8" Fractional="6"/> + <FixedPointParameter Name="q8.7" Size="32" Integral="8" Fractional="7"/> + <FixedPointParameter Name="q8.8" Size="32" Integral="8" Fractional="8"/> + <FixedPointParameter Name="q8.9" Size="32" Integral="8" Fractional="9"/> + <FixedPointParameter Name="q8.10" Size="32" Integral="8" Fractional="10"/> + <FixedPointParameter Name="q8.11" Size="32" Integral="8" Fractional="11"/> + <FixedPointParameter Name="q8.12" Size="32" Integral="8" Fractional="12"/> + <FixedPointParameter Name="q8.13" Size="32" Integral="8" Fractional="13"/> + <FixedPointParameter Name="q8.14" Size="32" Integral="8" Fractional="14"/> + <FixedPointParameter Name="q8.15" Size="32" Integral="8" Fractional="15"/> + <FixedPointParameter Name="q8.16" Size="32" Integral="8" Fractional="16"/> + <FixedPointParameter Name="q8.17" Size="32" Integral="8" Fractional="17"/> + <FixedPointParameter Name="q8.18" Size="32" Integral="8" Fractional="18"/> + <FixedPointParameter Name="q8.19" Size="32" Integral="8" Fractional="19"/> + <FixedPointParameter Name="q8.20" Size="32" Integral="8" Fractional="20"/> + <FixedPointParameter Name="q8.21" Size="32" Integral="8" Fractional="21"/> + <FixedPointParameter Name="q8.22" Size="32" Integral="8" Fractional="22"/> + <FixedPointParameter Name="q8.23" Size="32" Integral="8" Fractional="23"/> + <FixedPointParameter Name="q9.0" Size="32" Integral="9" Fractional="0"/> + <FixedPointParameter Name="q9.1" Size="32" Integral="9" Fractional="1"/> + <FixedPointParameter Name="q9.2" Size="32" Integral="9" Fractional="2"/> + <FixedPointParameter Name="q9.3" Size="32" Integral="9" Fractional="3"/> + <FixedPointParameter Name="q9.4" Size="32" Integral="9" Fractional="4"/> + <FixedPointParameter Name="q9.5" Size="32" Integral="9" Fractional="5"/> + <FixedPointParameter Name="q9.6" Size="32" Integral="9" Fractional="6"/> + <FixedPointParameter Name="q9.7" Size="32" Integral="9" Fractional="7"/> + <FixedPointParameter Name="q9.8" Size="32" Integral="9" Fractional="8"/> + <FixedPointParameter Name="q9.9" Size="32" Integral="9" Fractional="9"/> + <FixedPointParameter Name="q9.10" Size="32" Integral="9" Fractional="10"/> + <FixedPointParameter Name="q9.11" Size="32" Integral="9" Fractional="11"/> + <FixedPointParameter Name="q9.12" Size="32" Integral="9" Fractional="12"/> + <FixedPointParameter Name="q9.13" Size="32" Integral="9" Fractional="13"/> + <FixedPointParameter Name="q9.14" Size="32" Integral="9" Fractional="14"/> + <FixedPointParameter Name="q9.15" Size="32" Integral="9" Fractional="15"/> + <FixedPointParameter Name="q9.16" Size="32" Integral="9" Fractional="16"/> + <FixedPointParameter Name="q9.17" Size="32" Integral="9" Fractional="17"/> + <FixedPointParameter Name="q9.18" Size="32" Integral="9" Fractional="18"/> + <FixedPointParameter Name="q9.19" Size="32" Integral="9" Fractional="19"/> + <FixedPointParameter Name="q9.20" Size="32" Integral="9" Fractional="20"/> + <FixedPointParameter Name="q9.21" Size="32" Integral="9" Fractional="21"/> + <FixedPointParameter Name="q9.22" Size="32" Integral="9" Fractional="22"/> + <FixedPointParameter Name="q10.0" Size="32" Integral="10" Fractional="0"/> + <FixedPointParameter Name="q10.1" Size="32" Integral="10" Fractional="1"/> + <FixedPointParameter Name="q10.2" Size="32" Integral="10" Fractional="2"/> + <FixedPointParameter Name="q10.3" Size="32" Integral="10" Fractional="3"/> + <FixedPointParameter Name="q10.4" Size="32" Integral="10" Fractional="4"/> + <FixedPointParameter Name="q10.5" Size="32" Integral="10" Fractional="5"/> + <FixedPointParameter Name="q10.6" Size="32" Integral="10" Fractional="6"/> + <FixedPointParameter Name="q10.7" Size="32" Integral="10" Fractional="7"/> + <FixedPointParameter Name="q10.8" Size="32" Integral="10" Fractional="8"/> + <FixedPointParameter Name="q10.9" Size="32" Integral="10" Fractional="9"/> + <FixedPointParameter Name="q10.10" Size="32" Integral="10" Fractional="10"/> + <FixedPointParameter Name="q10.11" Size="32" Integral="10" Fractional="11"/> + <FixedPointParameter Name="q10.12" Size="32" Integral="10" Fractional="12"/> + <FixedPointParameter Name="q10.13" Size="32" Integral="10" Fractional="13"/> + <FixedPointParameter Name="q10.14" Size="32" Integral="10" Fractional="14"/> + <FixedPointParameter Name="q10.15" Size="32" Integral="10" Fractional="15"/> + <FixedPointParameter Name="q10.16" Size="32" Integral="10" Fractional="16"/> + <FixedPointParameter Name="q10.17" Size="32" Integral="10" Fractional="17"/> + <FixedPointParameter Name="q10.18" Size="32" Integral="10" Fractional="18"/> + <FixedPointParameter Name="q10.19" Size="32" Integral="10" Fractional="19"/> + <FixedPointParameter Name="q10.20" Size="32" Integral="10" Fractional="20"/> + <FixedPointParameter Name="q10.21" Size="32" Integral="10" Fractional="21"/> + <FixedPointParameter Name="q11.0" Size="32" Integral="11" Fractional="0"/> + <FixedPointParameter Name="q11.1" Size="32" Integral="11" Fractional="1"/> + <FixedPointParameter Name="q11.2" Size="32" Integral="11" Fractional="2"/> + <FixedPointParameter Name="q11.3" Size="32" Integral="11" Fractional="3"/> + <FixedPointParameter Name="q11.4" Size="32" Integral="11" Fractional="4"/> + <FixedPointParameter Name="q11.5" Size="32" Integral="11" Fractional="5"/> + <FixedPointParameter Name="q11.6" Size="32" Integral="11" Fractional="6"/> + <FixedPointParameter Name="q11.7" Size="32" Integral="11" Fractional="7"/> + <FixedPointParameter Name="q11.8" Size="32" Integral="11" Fractional="8"/> + <FixedPointParameter Name="q11.9" Size="32" Integral="11" Fractional="9"/> + <FixedPointParameter Name="q11.10" Size="32" Integral="11" Fractional="10"/> + <FixedPointParameter Name="q11.11" Size="32" Integral="11" Fractional="11"/> + <FixedPointParameter Name="q11.12" Size="32" Integral="11" Fractional="12"/> + <FixedPointParameter Name="q11.13" Size="32" Integral="11" Fractional="13"/> + <FixedPointParameter Name="q11.14" Size="32" Integral="11" Fractional="14"/> + <FixedPointParameter Name="q11.15" Size="32" Integral="11" Fractional="15"/> + <FixedPointParameter Name="q11.16" Size="32" Integral="11" Fractional="16"/> + <FixedPointParameter Name="q11.17" Size="32" Integral="11" Fractional="17"/> + <FixedPointParameter Name="q11.18" Size="32" Integral="11" Fractional="18"/> + <FixedPointParameter Name="q11.19" Size="32" Integral="11" Fractional="19"/> + <FixedPointParameter Name="q11.20" Size="32" Integral="11" Fractional="20"/> + <FixedPointParameter Name="q12.0" Size="32" Integral="12" Fractional="0"/> + <FixedPointParameter Name="q12.1" Size="32" Integral="12" Fractional="1"/> + <FixedPointParameter Name="q12.2" Size="32" Integral="12" Fractional="2"/> + <FixedPointParameter Name="q12.3" Size="32" Integral="12" Fractional="3"/> + <FixedPointParameter Name="q12.4" Size="32" Integral="12" Fractional="4"/> + <FixedPointParameter Name="q12.5" Size="32" Integral="12" Fractional="5"/> + <FixedPointParameter Name="q12.6" Size="32" Integral="12" Fractional="6"/> + <FixedPointParameter Name="q12.7" Size="32" Integral="12" Fractional="7"/> + <FixedPointParameter Name="q12.8" Size="32" Integral="12" Fractional="8"/> + <FixedPointParameter Name="q12.9" Size="32" Integral="12" Fractional="9"/> + <FixedPointParameter Name="q12.10" Size="32" Integral="12" Fractional="10"/> + <FixedPointParameter Name="q12.11" Size="32" Integral="12" Fractional="11"/> + <FixedPointParameter Name="q12.12" Size="32" Integral="12" Fractional="12"/> + <FixedPointParameter Name="q12.13" Size="32" Integral="12" Fractional="13"/> + <FixedPointParameter Name="q12.14" Size="32" Integral="12" Fractional="14"/> + <FixedPointParameter Name="q12.15" Size="32" Integral="12" Fractional="15"/> + <FixedPointParameter Name="q12.16" Size="32" Integral="12" Fractional="16"/> + <FixedPointParameter Name="q12.17" Size="32" Integral="12" Fractional="17"/> + <FixedPointParameter Name="q12.18" Size="32" Integral="12" Fractional="18"/> + <FixedPointParameter Name="q12.19" Size="32" Integral="12" Fractional="19"/> + <FixedPointParameter Name="q13.0" Size="32" Integral="13" Fractional="0"/> + <FixedPointParameter Name="q13.1" Size="32" Integral="13" Fractional="1"/> + <FixedPointParameter Name="q13.2" Size="32" Integral="13" Fractional="2"/> + <FixedPointParameter Name="q13.3" Size="32" Integral="13" Fractional="3"/> + <FixedPointParameter Name="q13.4" Size="32" Integral="13" Fractional="4"/> + <FixedPointParameter Name="q13.5" Size="32" Integral="13" Fractional="5"/> + <FixedPointParameter Name="q13.6" Size="32" Integral="13" Fractional="6"/> + <FixedPointParameter Name="q13.7" Size="32" Integral="13" Fractional="7"/> + <FixedPointParameter Name="q13.8" Size="32" Integral="13" Fractional="8"/> + <FixedPointParameter Name="q13.9" Size="32" Integral="13" Fractional="9"/> + <FixedPointParameter Name="q13.10" Size="32" Integral="13" Fractional="10"/> + <FixedPointParameter Name="q13.11" Size="32" Integral="13" Fractional="11"/> + <FixedPointParameter Name="q13.12" Size="32" Integral="13" Fractional="12"/> + <FixedPointParameter Name="q13.13" Size="32" Integral="13" Fractional="13"/> + <FixedPointParameter Name="q13.14" Size="32" Integral="13" Fractional="14"/> + <FixedPointParameter Name="q13.15" Size="32" Integral="13" Fractional="15"/> + <FixedPointParameter Name="q13.16" Size="32" Integral="13" Fractional="16"/> + <FixedPointParameter Name="q13.17" Size="32" Integral="13" Fractional="17"/> + <FixedPointParameter Name="q13.18" Size="32" Integral="13" Fractional="18"/> + <FixedPointParameter Name="q14.0" Size="32" Integral="14" Fractional="0"/> + <FixedPointParameter Name="q14.1" Size="32" Integral="14" Fractional="1"/> + <FixedPointParameter Name="q14.2" Size="32" Integral="14" Fractional="2"/> + <FixedPointParameter Name="q14.3" Size="32" Integral="14" Fractional="3"/> + <FixedPointParameter Name="q14.4" Size="32" Integral="14" Fractional="4"/> + <FixedPointParameter Name="q14.5" Size="32" Integral="14" Fractional="5"/> + <FixedPointParameter Name="q14.6" Size="32" Integral="14" Fractional="6"/> + <FixedPointParameter Name="q14.7" Size="32" Integral="14" Fractional="7"/> + <FixedPointParameter Name="q14.8" Size="32" Integral="14" Fractional="8"/> + <FixedPointParameter Name="q14.9" Size="32" Integral="14" Fractional="9"/> + <FixedPointParameter Name="q14.10" Size="32" Integral="14" Fractional="10"/> + <FixedPointParameter Name="q14.11" Size="32" Integral="14" Fractional="11"/> + <FixedPointParameter Name="q14.12" Size="32" Integral="14" Fractional="12"/> + <FixedPointParameter Name="q14.13" Size="32" Integral="14" Fractional="13"/> + <FixedPointParameter Name="q14.14" Size="32" Integral="14" Fractional="14"/> + <FixedPointParameter Name="q14.15" Size="32" Integral="14" Fractional="15"/> + <FixedPointParameter Name="q14.16" Size="32" Integral="14" Fractional="16"/> + <FixedPointParameter Name="q14.17" Size="32" Integral="14" Fractional="17"/> + <FixedPointParameter Name="q15.0" Size="32" Integral="15" Fractional="0"/> + <FixedPointParameter Name="q15.1" Size="32" Integral="15" Fractional="1"/> + <FixedPointParameter Name="q15.2" Size="32" Integral="15" Fractional="2"/> + <FixedPointParameter Name="q15.3" Size="32" Integral="15" Fractional="3"/> + <FixedPointParameter Name="q15.4" Size="32" Integral="15" Fractional="4"/> + <FixedPointParameter Name="q15.5" Size="32" Integral="15" Fractional="5"/> + <FixedPointParameter Name="q15.6" Size="32" Integral="15" Fractional="6"/> + <FixedPointParameter Name="q15.7" Size="32" Integral="15" Fractional="7"/> + <FixedPointParameter Name="q15.8" Size="32" Integral="15" Fractional="8"/> + <FixedPointParameter Name="q15.9" Size="32" Integral="15" Fractional="9"/> + <FixedPointParameter Name="q15.10" Size="32" Integral="15" Fractional="10"/> + <FixedPointParameter Name="q15.11" Size="32" Integral="15" Fractional="11"/> + <FixedPointParameter Name="q15.12" Size="32" Integral="15" Fractional="12"/> + <FixedPointParameter Name="q15.13" Size="32" Integral="15" Fractional="13"/> + <FixedPointParameter Name="q15.14" Size="32" Integral="15" Fractional="14"/> + <FixedPointParameter Name="q15.15" Size="32" Integral="15" Fractional="15"/> + <FixedPointParameter Name="q15.16" Size="32" Integral="15" Fractional="16"/> + <FixedPointParameter Name="q16.0" Size="32" Integral="16" Fractional="0"/> + <FixedPointParameter Name="q16.1" Size="32" Integral="16" Fractional="1"/> + <FixedPointParameter Name="q16.2" Size="32" Integral="16" Fractional="2"/> + <FixedPointParameter Name="q16.3" Size="32" Integral="16" Fractional="3"/> + <FixedPointParameter Name="q16.4" Size="32" Integral="16" Fractional="4"/> + <FixedPointParameter Name="q16.5" Size="32" Integral="16" Fractional="5"/> + <FixedPointParameter Name="q16.6" Size="32" Integral="16" Fractional="6"/> + <FixedPointParameter Name="q16.7" Size="32" Integral="16" Fractional="7"/> + <FixedPointParameter Name="q16.8" Size="32" Integral="16" Fractional="8"/> + <FixedPointParameter Name="q16.9" Size="32" Integral="16" Fractional="9"/> + <FixedPointParameter Name="q16.10" Size="32" Integral="16" Fractional="10"/> + <FixedPointParameter Name="q16.11" Size="32" Integral="16" Fractional="11"/> + <FixedPointParameter Name="q16.12" Size="32" Integral="16" Fractional="12"/> + <FixedPointParameter Name="q16.13" Size="32" Integral="16" Fractional="13"/> + <FixedPointParameter Name="q16.14" Size="32" Integral="16" Fractional="14"/> + <FixedPointParameter Name="q16.15" Size="32" Integral="16" Fractional="15"/> + <FixedPointParameter Name="q17.0" Size="32" Integral="17" Fractional="0"/> + <FixedPointParameter Name="q17.1" Size="32" Integral="17" Fractional="1"/> + <FixedPointParameter Name="q17.2" Size="32" Integral="17" Fractional="2"/> + <FixedPointParameter Name="q17.3" Size="32" Integral="17" Fractional="3"/> + <FixedPointParameter Name="q17.4" Size="32" Integral="17" Fractional="4"/> + <FixedPointParameter Name="q17.5" Size="32" Integral="17" Fractional="5"/> + <FixedPointParameter Name="q17.6" Size="32" Integral="17" Fractional="6"/> + <FixedPointParameter Name="q17.7" Size="32" Integral="17" Fractional="7"/> + <FixedPointParameter Name="q17.8" Size="32" Integral="17" Fractional="8"/> + <FixedPointParameter Name="q17.9" Size="32" Integral="17" Fractional="9"/> + <FixedPointParameter Name="q17.10" Size="32" Integral="17" Fractional="10"/> + <FixedPointParameter Name="q17.11" Size="32" Integral="17" Fractional="11"/> + <FixedPointParameter Name="q17.12" Size="32" Integral="17" Fractional="12"/> + <FixedPointParameter Name="q17.13" Size="32" Integral="17" Fractional="13"/> + <FixedPointParameter Name="q17.14" Size="32" Integral="17" Fractional="14"/> + <FixedPointParameter Name="q18.0" Size="32" Integral="18" Fractional="0"/> + <FixedPointParameter Name="q18.1" Size="32" Integral="18" Fractional="1"/> + <FixedPointParameter Name="q18.2" Size="32" Integral="18" Fractional="2"/> + <FixedPointParameter Name="q18.3" Size="32" Integral="18" Fractional="3"/> + <FixedPointParameter Name="q18.4" Size="32" Integral="18" Fractional="4"/> + <FixedPointParameter Name="q18.5" Size="32" Integral="18" Fractional="5"/> + <FixedPointParameter Name="q18.6" Size="32" Integral="18" Fractional="6"/> + <FixedPointParameter Name="q18.7" Size="32" Integral="18" Fractional="7"/> + <FixedPointParameter Name="q18.8" Size="32" Integral="18" Fractional="8"/> + <FixedPointParameter Name="q18.9" Size="32" Integral="18" Fractional="9"/> + <FixedPointParameter Name="q18.10" Size="32" Integral="18" Fractional="10"/> + <FixedPointParameter Name="q18.11" Size="32" Integral="18" Fractional="11"/> + <FixedPointParameter Name="q18.12" Size="32" Integral="18" Fractional="12"/> + <FixedPointParameter Name="q18.13" Size="32" Integral="18" Fractional="13"/> + <FixedPointParameter Name="q19.0" Size="32" Integral="19" Fractional="0"/> + <FixedPointParameter Name="q19.1" Size="32" Integral="19" Fractional="1"/> + <FixedPointParameter Name="q19.2" Size="32" Integral="19" Fractional="2"/> + <FixedPointParameter Name="q19.3" Size="32" Integral="19" Fractional="3"/> + <FixedPointParameter Name="q19.4" Size="32" Integral="19" Fractional="4"/> + <FixedPointParameter Name="q19.5" Size="32" Integral="19" Fractional="5"/> + <FixedPointParameter Name="q19.6" Size="32" Integral="19" Fractional="6"/> + <FixedPointParameter Name="q19.7" Size="32" Integral="19" Fractional="7"/> + <FixedPointParameter Name="q19.8" Size="32" Integral="19" Fractional="8"/> + <FixedPointParameter Name="q19.9" Size="32" Integral="19" Fractional="9"/> + <FixedPointParameter Name="q19.10" Size="32" Integral="19" Fractional="10"/> + <FixedPointParameter Name="q19.11" Size="32" Integral="19" Fractional="11"/> + <FixedPointParameter Name="q19.12" Size="32" Integral="19" Fractional="12"/> + <FixedPointParameter Name="q20.0" Size="32" Integral="20" Fractional="0"/> + <FixedPointParameter Name="q20.1" Size="32" Integral="20" Fractional="1"/> + <FixedPointParameter Name="q20.2" Size="32" Integral="20" Fractional="2"/> + <FixedPointParameter Name="q20.3" Size="32" Integral="20" Fractional="3"/> + <FixedPointParameter Name="q20.4" Size="32" Integral="20" Fractional="4"/> + <FixedPointParameter Name="q20.5" Size="32" Integral="20" Fractional="5"/> + <FixedPointParameter Name="q20.6" Size="32" Integral="20" Fractional="6"/> + <FixedPointParameter Name="q20.7" Size="32" Integral="20" Fractional="7"/> + <FixedPointParameter Name="q20.8" Size="32" Integral="20" Fractional="8"/> + <FixedPointParameter Name="q20.9" Size="32" Integral="20" Fractional="9"/> + <FixedPointParameter Name="q20.10" Size="32" Integral="20" Fractional="10"/> + <FixedPointParameter Name="q20.11" Size="32" Integral="20" Fractional="11"/> + <FixedPointParameter Name="q21.0" Size="32" Integral="21" Fractional="0"/> + <FixedPointParameter Name="q21.1" Size="32" Integral="21" Fractional="1"/> + <FixedPointParameter Name="q21.2" Size="32" Integral="21" Fractional="2"/> + <FixedPointParameter Name="q21.3" Size="32" Integral="21" Fractional="3"/> + <FixedPointParameter Name="q21.4" Size="32" Integral="21" Fractional="4"/> + <FixedPointParameter Name="q21.5" Size="32" Integral="21" Fractional="5"/> + <FixedPointParameter Name="q21.6" Size="32" Integral="21" Fractional="6"/> + <FixedPointParameter Name="q21.7" Size="32" Integral="21" Fractional="7"/> + <FixedPointParameter Name="q21.8" Size="32" Integral="21" Fractional="8"/> + <FixedPointParameter Name="q21.9" Size="32" Integral="21" Fractional="9"/> + <FixedPointParameter Name="q21.10" Size="32" Integral="21" Fractional="10"/> + <FixedPointParameter Name="q22.0" Size="32" Integral="22" Fractional="0"/> + <FixedPointParameter Name="q22.1" Size="32" Integral="22" Fractional="1"/> + <FixedPointParameter Name="q22.2" Size="32" Integral="22" Fractional="2"/> + <FixedPointParameter Name="q22.3" Size="32" Integral="22" Fractional="3"/> + <FixedPointParameter Name="q22.4" Size="32" Integral="22" Fractional="4"/> + <FixedPointParameter Name="q22.5" Size="32" Integral="22" Fractional="5"/> + <FixedPointParameter Name="q22.6" Size="32" Integral="22" Fractional="6"/> + <FixedPointParameter Name="q22.7" Size="32" Integral="22" Fractional="7"/> + <FixedPointParameter Name="q22.8" Size="32" Integral="22" Fractional="8"/> + <FixedPointParameter Name="q22.9" Size="32" Integral="22" Fractional="9"/> + <FixedPointParameter Name="q23.0" Size="32" Integral="23" Fractional="0"/> + <FixedPointParameter Name="q23.1" Size="32" Integral="23" Fractional="1"/> + <FixedPointParameter Name="q23.2" Size="32" Integral="23" Fractional="2"/> + <FixedPointParameter Name="q23.3" Size="32" Integral="23" Fractional="3"/> + <FixedPointParameter Name="q23.4" Size="32" Integral="23" Fractional="4"/> + <FixedPointParameter Name="q23.5" Size="32" Integral="23" Fractional="5"/> + <FixedPointParameter Name="q23.6" Size="32" Integral="23" Fractional="6"/> + <FixedPointParameter Name="q23.7" Size="32" Integral="23" Fractional="7"/> + <FixedPointParameter Name="q23.8" Size="32" Integral="23" Fractional="8"/> + <FixedPointParameter Name="q24.0" Size="32" Integral="24" Fractional="0"/> + <FixedPointParameter Name="q24.1" Size="32" Integral="24" Fractional="1"/> + <FixedPointParameter Name="q24.2" Size="32" Integral="24" Fractional="2"/> + <FixedPointParameter Name="q24.3" Size="32" Integral="24" Fractional="3"/> + <FixedPointParameter Name="q24.4" Size="32" Integral="24" Fractional="4"/> + <FixedPointParameter Name="q24.5" Size="32" Integral="24" Fractional="5"/> + <FixedPointParameter Name="q24.6" Size="32" Integral="24" Fractional="6"/> + <FixedPointParameter Name="q24.7" Size="32" Integral="24" Fractional="7"/> + <FixedPointParameter Name="q25.0" Size="32" Integral="25" Fractional="0"/> + <FixedPointParameter Name="q25.1" Size="32" Integral="25" Fractional="1"/> + <FixedPointParameter Name="q25.2" Size="32" Integral="25" Fractional="2"/> + <FixedPointParameter Name="q25.3" Size="32" Integral="25" Fractional="3"/> + <FixedPointParameter Name="q25.4" Size="32" Integral="25" Fractional="4"/> + <FixedPointParameter Name="q25.5" Size="32" Integral="25" Fractional="5"/> + <FixedPointParameter Name="q25.6" Size="32" Integral="25" Fractional="6"/> + <FixedPointParameter Name="q26.0" Size="32" Integral="26" Fractional="0"/> + <FixedPointParameter Name="q26.1" Size="32" Integral="26" Fractional="1"/> + <FixedPointParameter Name="q26.2" Size="32" Integral="26" Fractional="2"/> + <FixedPointParameter Name="q26.3" Size="32" Integral="26" Fractional="3"/> + <FixedPointParameter Name="q26.4" Size="32" Integral="26" Fractional="4"/> + <FixedPointParameter Name="q26.5" Size="32" Integral="26" Fractional="5"/> + <FixedPointParameter Name="q27.0" Size="32" Integral="27" Fractional="0"/> + <FixedPointParameter Name="q27.1" Size="32" Integral="27" Fractional="1"/> + <FixedPointParameter Name="q27.2" Size="32" Integral="27" Fractional="2"/> + <FixedPointParameter Name="q27.3" Size="32" Integral="27" Fractional="3"/> + <FixedPointParameter Name="q27.4" Size="32" Integral="27" Fractional="4"/> + <FixedPointParameter Name="q28.0" Size="32" Integral="28" Fractional="0"/> + <FixedPointParameter Name="q28.1" Size="32" Integral="28" Fractional="1"/> + <FixedPointParameter Name="q28.2" Size="32" Integral="28" Fractional="2"/> + <FixedPointParameter Name="q28.3" Size="32" Integral="28" Fractional="3"/> + <FixedPointParameter Name="q29.0" Size="32" Integral="29" Fractional="0"/> + <FixedPointParameter Name="q29.1" Size="32" Integral="29" Fractional="1"/> + <FixedPointParameter Name="q29.2" Size="32" Integral="29" Fractional="2"/> + <FixedPointParameter Name="q30.0" Size="32" Integral="30" Fractional="0"/> + <FixedPointParameter Name="q30.1" Size="32" Integral="30" Fractional="1"/> + <FixedPointParameter Name="q31.0" Size="32" Integral="31" Fractional="0"/> + + <!-- 16b --> + <FixedPointParameter Name="q0.0" Size="16" Integral="0" Fractional="0"/> + <FixedPointParameter Name="q0.1" Size="16" Integral="0" Fractional="1"/> + <FixedPointParameter Name="q0.2" Size="16" Integral="0" Fractional="2"/> + <FixedPointParameter Name="q0.3" Size="16" Integral="0" Fractional="3"/> + <FixedPointParameter Name="q0.4" Size="16" Integral="0" Fractional="4"/> + <FixedPointParameter Name="q0.5" Size="16" Integral="0" Fractional="5"/> + <FixedPointParameter Name="q0.6" Size="16" Integral="0" Fractional="6"/> + <FixedPointParameter Name="q0.7" Size="16" Integral="0" Fractional="7"/> + <FixedPointParameter Name="q0.8" Size="16" Integral="0" Fractional="8"/> + <FixedPointParameter Name="q0.9" Size="16" Integral="0" Fractional="9"/> + <FixedPointParameter Name="q0.10" Size="16" Integral="0" Fractional="10"/> + <FixedPointParameter Name="q0.11" Size="16" Integral="0" Fractional="11"/> + <FixedPointParameter Name="q0.12" Size="16" Integral="0" Fractional="12"/> + <FixedPointParameter Name="q0.13" Size="16" Integral="0" Fractional="13"/> + <FixedPointParameter Name="q0.14" Size="16" Integral="0" Fractional="14"/> + <FixedPointParameter Name="q0.15" Size="16" Integral="0" Fractional="15"/> + <FixedPointParameter Name="q1.0" Size="16" Integral="1" Fractional="0"/> + <FixedPointParameter Name="q1.1" Size="16" Integral="1" Fractional="1"/> + <FixedPointParameter Name="q1.2" Size="16" Integral="1" Fractional="2"/> + <FixedPointParameter Name="q1.3" Size="16" Integral="1" Fractional="3"/> + <FixedPointParameter Name="q1.4" Size="16" Integral="1" Fractional="4"/> + <FixedPointParameter Name="q1.5" Size="16" Integral="1" Fractional="5"/> + <FixedPointParameter Name="q1.6" Size="16" Integral="1" Fractional="6"/> + <FixedPointParameter Name="q1.7" Size="16" Integral="1" Fractional="7"/> + <FixedPointParameter Name="q1.8" Size="16" Integral="1" Fractional="8"/> + <FixedPointParameter Name="q1.9" Size="16" Integral="1" Fractional="9"/> + <FixedPointParameter Name="q1.10" Size="16" Integral="1" Fractional="10"/> + <FixedPointParameter Name="q1.11" Size="16" Integral="1" Fractional="11"/> + <FixedPointParameter Name="q1.12" Size="16" Integral="1" Fractional="12"/> + <FixedPointParameter Name="q1.13" Size="16" Integral="1" Fractional="13"/> + <FixedPointParameter Name="q1.14" Size="16" Integral="1" Fractional="14"/> + <FixedPointParameter Name="q2.0" Size="16" Integral="2" Fractional="0"/> + <FixedPointParameter Name="q2.1" Size="16" Integral="2" Fractional="1"/> + <FixedPointParameter Name="q2.2" Size="16" Integral="2" Fractional="2"/> + <FixedPointParameter Name="q2.3" Size="16" Integral="2" Fractional="3"/> + <FixedPointParameter Name="q2.4" Size="16" Integral="2" Fractional="4"/> + <FixedPointParameter Name="q2.5" Size="16" Integral="2" Fractional="5"/> + <FixedPointParameter Name="q2.6" Size="16" Integral="2" Fractional="6"/> + <FixedPointParameter Name="q2.7" Size="16" Integral="2" Fractional="7"/> + <FixedPointParameter Name="q2.8" Size="16" Integral="2" Fractional="8"/> + <FixedPointParameter Name="q2.9" Size="16" Integral="2" Fractional="9"/> + <FixedPointParameter Name="q2.10" Size="16" Integral="2" Fractional="10"/> + <FixedPointParameter Name="q2.11" Size="16" Integral="2" Fractional="11"/> + <FixedPointParameter Name="q2.12" Size="16" Integral="2" Fractional="12"/> + <FixedPointParameter Name="q2.13" Size="16" Integral="2" Fractional="13"/> + <FixedPointParameter Name="q3.0" Size="16" Integral="3" Fractional="0"/> + <FixedPointParameter Name="q3.1" Size="16" Integral="3" Fractional="1"/> + <FixedPointParameter Name="q3.2" Size="16" Integral="3" Fractional="2"/> + <FixedPointParameter Name="q3.3" Size="16" Integral="3" Fractional="3"/> + <FixedPointParameter Name="q3.4" Size="16" Integral="3" Fractional="4"/> + <FixedPointParameter Name="q3.5" Size="16" Integral="3" Fractional="5"/> + <FixedPointParameter Name="q3.6" Size="16" Integral="3" Fractional="6"/> + <FixedPointParameter Name="q3.7" Size="16" Integral="3" Fractional="7"/> + <FixedPointParameter Name="q3.8" Size="16" Integral="3" Fractional="8"/> + <FixedPointParameter Name="q3.9" Size="16" Integral="3" Fractional="9"/> + <FixedPointParameter Name="q3.10" Size="16" Integral="3" Fractional="10"/> + <FixedPointParameter Name="q3.11" Size="16" Integral="3" Fractional="11"/> + <FixedPointParameter Name="q3.12" Size="16" Integral="3" Fractional="12"/> + <FixedPointParameter Name="q4.0" Size="16" Integral="4" Fractional="0"/> + <FixedPointParameter Name="q4.1" Size="16" Integral="4" Fractional="1"/> + <FixedPointParameter Name="q4.2" Size="16" Integral="4" Fractional="2"/> + <FixedPointParameter Name="q4.3" Size="16" Integral="4" Fractional="3"/> + <FixedPointParameter Name="q4.4" Size="16" Integral="4" Fractional="4"/> + <FixedPointParameter Name="q4.5" Size="16" Integral="4" Fractional="5"/> + <FixedPointParameter Name="q4.6" Size="16" Integral="4" Fractional="6"/> + <FixedPointParameter Name="q4.7" Size="16" Integral="4" Fractional="7"/> + <FixedPointParameter Name="q4.8" Size="16" Integral="4" Fractional="8"/> + <FixedPointParameter Name="q4.9" Size="16" Integral="4" Fractional="9"/> + <FixedPointParameter Name="q4.10" Size="16" Integral="4" Fractional="10"/> + <FixedPointParameter Name="q4.11" Size="16" Integral="4" Fractional="11"/> + <FixedPointParameter Name="q5.0" Size="16" Integral="5" Fractional="0"/> + <FixedPointParameter Name="q5.1" Size="16" Integral="5" Fractional="1"/> + <FixedPointParameter Name="q5.2" Size="16" Integral="5" Fractional="2"/> + <FixedPointParameter Name="q5.3" Size="16" Integral="5" Fractional="3"/> + <FixedPointParameter Name="q5.4" Size="16" Integral="5" Fractional="4"/> + <FixedPointParameter Name="q5.5" Size="16" Integral="5" Fractional="5"/> + <FixedPointParameter Name="q5.6" Size="16" Integral="5" Fractional="6"/> + <FixedPointParameter Name="q5.7" Size="16" Integral="5" Fractional="7"/> + <FixedPointParameter Name="q5.8" Size="16" Integral="5" Fractional="8"/> + <FixedPointParameter Name="q5.9" Size="16" Integral="5" Fractional="9"/> + <FixedPointParameter Name="q5.10" Size="16" Integral="5" Fractional="10"/> + <FixedPointParameter Name="q6.0" Size="16" Integral="6" Fractional="0"/> + <FixedPointParameter Name="q6.1" Size="16" Integral="6" Fractional="1"/> + <FixedPointParameter Name="q6.2" Size="16" Integral="6" Fractional="2"/> + <FixedPointParameter Name="q6.3" Size="16" Integral="6" Fractional="3"/> + <FixedPointParameter Name="q6.4" Size="16" Integral="6" Fractional="4"/> + <FixedPointParameter Name="q6.5" Size="16" Integral="6" Fractional="5"/> + <FixedPointParameter Name="q6.6" Size="16" Integral="6" Fractional="6"/> + <FixedPointParameter Name="q6.7" Size="16" Integral="6" Fractional="7"/> + <FixedPointParameter Name="q6.8" Size="16" Integral="6" Fractional="8"/> + <FixedPointParameter Name="q6.9" Size="16" Integral="6" Fractional="9"/> + <FixedPointParameter Name="q7.0" Size="16" Integral="7" Fractional="0"/> + <FixedPointParameter Name="q7.1" Size="16" Integral="7" Fractional="1"/> + <FixedPointParameter Name="q7.2" Size="16" Integral="7" Fractional="2"/> + <FixedPointParameter Name="q7.3" Size="16" Integral="7" Fractional="3"/> + <FixedPointParameter Name="q7.4" Size="16" Integral="7" Fractional="4"/> + <FixedPointParameter Name="q7.5" Size="16" Integral="7" Fractional="5"/> + <FixedPointParameter Name="q7.6" Size="16" Integral="7" Fractional="6"/> + <FixedPointParameter Name="q7.7" Size="16" Integral="7" Fractional="7"/> + <FixedPointParameter Name="q7.8" Size="16" Integral="7" Fractional="8"/> + <FixedPointParameter Name="q8.0" Size="16" Integral="8" Fractional="0"/> + <FixedPointParameter Name="q8.1" Size="16" Integral="8" Fractional="1"/> + <FixedPointParameter Name="q8.2" Size="16" Integral="8" Fractional="2"/> + <FixedPointParameter Name="q8.3" Size="16" Integral="8" Fractional="3"/> + <FixedPointParameter Name="q8.4" Size="16" Integral="8" Fractional="4"/> + <FixedPointParameter Name="q8.5" Size="16" Integral="8" Fractional="5"/> + <FixedPointParameter Name="q8.6" Size="16" Integral="8" Fractional="6"/> + <FixedPointParameter Name="q8.7" Size="16" Integral="8" Fractional="7"/> + <FixedPointParameter Name="q9.0" Size="16" Integral="9" Fractional="0"/> + <FixedPointParameter Name="q9.1" Size="16" Integral="9" Fractional="1"/> + <FixedPointParameter Name="q9.2" Size="16" Integral="9" Fractional="2"/> + <FixedPointParameter Name="q9.3" Size="16" Integral="9" Fractional="3"/> + <FixedPointParameter Name="q9.4" Size="16" Integral="9" Fractional="4"/> + <FixedPointParameter Name="q9.5" Size="16" Integral="9" Fractional="5"/> + <FixedPointParameter Name="q9.6" Size="16" Integral="9" Fractional="6"/> + <FixedPointParameter Name="q10.0" Size="16" Integral="10" Fractional="0"/> + <FixedPointParameter Name="q10.1" Size="16" Integral="10" Fractional="1"/> + <FixedPointParameter Name="q10.2" Size="16" Integral="10" Fractional="2"/> + <FixedPointParameter Name="q10.3" Size="16" Integral="10" Fractional="3"/> + <FixedPointParameter Name="q10.4" Size="16" Integral="10" Fractional="4"/> + <FixedPointParameter Name="q10.5" Size="16" Integral="10" Fractional="5"/> + <FixedPointParameter Name="q11.0" Size="16" Integral="11" Fractional="0"/> + <FixedPointParameter Name="q11.1" Size="16" Integral="11" Fractional="1"/> + <FixedPointParameter Name="q11.2" Size="16" Integral="11" Fractional="2"/> + <FixedPointParameter Name="q11.3" Size="16" Integral="11" Fractional="3"/> + <FixedPointParameter Name="q11.4" Size="16" Integral="11" Fractional="4"/> + <FixedPointParameter Name="q12.0" Size="16" Integral="12" Fractional="0"/> + <FixedPointParameter Name="q12.1" Size="16" Integral="12" Fractional="1"/> + <FixedPointParameter Name="q12.2" Size="16" Integral="12" Fractional="2"/> + <FixedPointParameter Name="q12.3" Size="16" Integral="12" Fractional="3"/> + <FixedPointParameter Name="q13.0" Size="16" Integral="13" Fractional="0"/> + <FixedPointParameter Name="q13.1" Size="16" Integral="13" Fractional="1"/> + <FixedPointParameter Name="q13.2" Size="16" Integral="13" Fractional="2"/> + <FixedPointParameter Name="q14.0" Size="16" Integral="14" Fractional="0"/> + <FixedPointParameter Name="q14.1" Size="16" Integral="14" Fractional="1"/> + <FixedPointParameter Name="q15.0" Size="16" Integral="15" Fractional="0"/> + + <!-- 8b --> + <FixedPointParameter Name="q0.0" Size="8" Integral="0" Fractional="0"/> + <FixedPointParameter Name="q0.1" Size="8" Integral="0" Fractional="1"/> + <FixedPointParameter Name="q0.2" Size="8" Integral="0" Fractional="2"/> + <FixedPointParameter Name="q0.3" Size="8" Integral="0" Fractional="3"/> + <FixedPointParameter Name="q0.4" Size="8" Integral="0" Fractional="4"/> + <FixedPointParameter Name="q0.5" Size="8" Integral="0" Fractional="5"/> + <FixedPointParameter Name="q0.6" Size="8" Integral="0" Fractional="6"/> + <FixedPointParameter Name="q0.7" Size="8" Integral="0" Fractional="7"/> + <FixedPointParameter Name="q1.0" Size="8" Integral="1" Fractional="0"/> + <FixedPointParameter Name="q1.1" Size="8" Integral="1" Fractional="1"/> + <FixedPointParameter Name="q1.2" Size="8" Integral="1" Fractional="2"/> + <FixedPointParameter Name="q1.3" Size="8" Integral="1" Fractional="3"/> + <FixedPointParameter Name="q1.4" Size="8" Integral="1" Fractional="4"/> + <FixedPointParameter Name="q1.5" Size="8" Integral="1" Fractional="5"/> + <FixedPointParameter Name="q1.6" Size="8" Integral="1" Fractional="6"/> + <FixedPointParameter Name="q2.0" Size="8" Integral="2" Fractional="0"/> + <FixedPointParameter Name="q2.1" Size="8" Integral="2" Fractional="1"/> + <FixedPointParameter Name="q2.2" Size="8" Integral="2" Fractional="2"/> + <FixedPointParameter Name="q2.3" Size="8" Integral="2" Fractional="3"/> + <FixedPointParameter Name="q2.4" Size="8" Integral="2" Fractional="4"/> + <FixedPointParameter Name="q2.5" Size="8" Integral="2" Fractional="5"/> + <FixedPointParameter Name="q3.0" Size="8" Integral="3" Fractional="0"/> + <FixedPointParameter Name="q3.1" Size="8" Integral="3" Fractional="1"/> + <FixedPointParameter Name="q3.2" Size="8" Integral="3" Fractional="2"/> + <FixedPointParameter Name="q3.3" Size="8" Integral="3" Fractional="3"/> + <FixedPointParameter Name="q3.4" Size="8" Integral="3" Fractional="4"/> + <FixedPointParameter Name="q4.0" Size="8" Integral="4" Fractional="0"/> + <FixedPointParameter Name="q4.1" Size="8" Integral="4" Fractional="1"/> + <FixedPointParameter Name="q4.2" Size="8" Integral="4" Fractional="2"/> + <FixedPointParameter Name="q4.3" Size="8" Integral="4" Fractional="3"/> + <FixedPointParameter Name="q5.0" Size="8" Integral="5" Fractional="0"/> + <FixedPointParameter Name="q5.1" Size="8" Integral="5" Fractional="1"/> + <FixedPointParameter Name="q5.2" Size="8" Integral="5" Fractional="2"/> + <FixedPointParameter Name="q6.0" Size="8" Integral="6" Fractional="0"/> + <FixedPointParameter Name="q6.1" Size="8" Integral="6" Fractional="1"/> + <FixedPointParameter Name="q7.0" Size="8" Integral="7" Fractional="0"/> + + + </InstanceDefinition> +</Subsystem> diff --git a/test/test-platform/TestPlatform.cpp b/test/test-platform/TestPlatform.cpp index 6bf6350..aaa3d02 100644 --- a/test/test-platform/TestPlatform.cpp +++ b/test/test-platform/TestPlatform.cpp @@ -27,6 +27,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + #include <strings.h> #include <iostream> #include <stdlib.h> @@ -120,6 +121,17 @@ CTestPlatform::CTestPlatform(const string& strClass, int iPortNumber, sem_t& exi 0, "", "Get policy for failed settings load, either abort start or continue without domains."); + _pCommandHandler->addCommandParser( + "setValidateSchemasOnStart", + &CTestPlatform::setter<&CParameterMgrPlatformConnector::setValidateSchemasOnStart>, + 1, "true|false", + "Set policy for schema validation based on .xsd files (false by default)."); + _pCommandHandler->addCommandParser( + "getValidateSchemasOnStart", + &CTestPlatform::getter<&CParameterMgrPlatformConnector::getValidateSchemasOnStart>, + 0, "", + "Get policy for schema validation based on .xsd files."); + // Create server _pRemoteProcessorServer = new CRemoteProcessorServer(iPortNumber, _pCommandHandler); diff --git a/tools/xmlGenerator/Android.mk b/tools/xmlGenerator/Android.mk index 2ca8fe0..452668e 100644 --- a/tools/xmlGenerator/Android.mk +++ b/tools/xmlGenerator/Android.mk @@ -61,7 +61,17 @@ LOCAL_REQUIRED_MODULES := \ hostConfig.py \ portAllocator.py \ test-platform_host \ - remote-process_host + remote-process_host \ + ParameterFrameworkConfiguration.xsd \ + ConfigurableDomains.xsd \ + SystemClass.xsd \ + ParameterSettings.xsd \ + FileIncluder.xsd \ + Subsystem.xsd \ + ComponentLibrary.xsd \ + ComponentTypeSet.xsd \ + W3cXmlAttributes.xsd \ + Parameter.xsd LOCAL_MODULE_CLASS := EXECUTABLES LOCAL_IS_HOST_MODULE := true include $(BUILD_PREBUILT) diff --git a/tools/xmlGenerator/hostDomainGenerator.sh b/tools/xmlGenerator/hostDomainGenerator.sh index 5b27513..4cfce4d 100755 --- a/tools/xmlGenerator/hostDomainGenerator.sh +++ b/tools/xmlGenerator/hostDomainGenerator.sh @@ -45,13 +45,18 @@ then shift exec 1>/dev/null else - exec 1> >(sed 's/^/Info: /' >&2) + exec 1> >(sed "s/^/($$) Info: /" >&2) fi # Prefix all warning and error log lines and redirect them to stderr -exec 5> >(sed 's/^/Warning: /' >&2) -exec 2> >(sed 's/^/Error: /' >&2) +exec 5> >(sed "s/^/($$) Warning: /" >&2) +exec 2> >(sed "s/^/($$) Error: /" >&2) # Get script arguments +validationEnabled="false" +if [ "$1" = "--validate" ]; then + validationEnabled="true" + shift +fi PFWconfigurationFilePath="$1"; shift CriterionFilePath="$1"; shift xmlDomainFilePath="$1"; shift @@ -64,8 +69,8 @@ hostConfig="hostConfig.py" PFWScriptGenerator="PFWScriptGenerator.py" portAllocator="portAllocator.py" -TPHost=localhost -PFWHost=localhost +TPHost=127.0.0.1 +PFWHost=127.0.0.1 TPCreated=false HostRoot="$ANDROID_HOST_OUT" @@ -76,7 +81,8 @@ TPSocket=5003 PFWSocket=5000 PFWStartTimeout=60 -tmpFile=$(mktemp) +tmpDir=$(mktemp -d) +tmpFile=$(mktemp --tmpdir="$tmpDir") # [Workaround] # The build system does not preserve execution right in external prebuild @@ -91,6 +97,16 @@ export LD_LIBRARY_PATH="$HostRoot/lib:${LD_LIBRARY_PATH:-}" # Setup clean trap, it will be called automatically on exit clean_up () { status=$? + set +e # An error should not abort clean up + + ( if test $status -ne 0 + then + echo "$0 is exiting on error, printing debug information." + echo "Test platform port: $TPSocket" + echo "PFW port: $PFWSocket" + netstat --program --all --numeric --extend --tcp + ps -ejHlf + fi ) >&5 # Exit the test-platform only if it was created by this process if $TPCreated @@ -102,6 +118,12 @@ clean_up () { echo "Cleaning $tmpFile ..." rm "$tmpFile" || true + if [ "$validationEnabled" = "true" ]; then + echo "Cleaning $tmpDir/Schemas ..." + rm -r "$tmpDir/Schemas" || true + rmdir "$tmpDir" || true + fi + echo "Cleaning status: $status ..." return $status } @@ -191,6 +213,7 @@ launchTestPlatform () { $TPSendCommand setFailureOnMissingSubsystem false $TPSendCommand setFailureOnFailedSettingsLoad false + $TPSendCommand setValidateSchemasOnStart $validationEnabled echo "Asking test-platform (port $TPSocket) to start a new PFW instance (listening on port $PFWSocket) ..." $TPSendCommand start @@ -253,6 +276,15 @@ deleteEscapedNewLines () { sed -r ':a;/\\$/{N;s/\\\n//;ba}' } +copySchemaFiles() { + cp -r "$HostRoot"/etc/parameter-framework/Schemas "$tmpDir/Schemas" +} + +# Copy the schema files needed for validation +if [ "$validationEnabled" = "true" ]; then + copySchemaFiles +fi + # The PFW looks for a libremote-processor.so library, not a libremote-processor_host.so linkLibrary libremote-processor_host.so libremote-processor.so @@ -267,8 +299,8 @@ $PFWSendCommand setTuningMode on # Send the xml domain tunning file if test -s "$xmlDomainFilePath" then - echo "Send the xml domain tunning file: $xmlDomainFilePath" - $PFWSendCommand setDomainsWithSettingsXML "$(cat $xmlDomainFilePath)" + echo "Import the xml domain tunning file: $(readlink -e $xmlDomainFilePath)" + $PFWSendCommand importDomainsWithSettingsXML "$(readlink -e $xmlDomainFilePath)" fi # Send the extended domain description routing files converted to pfw commands diff --git a/tools/xmlGenerator/portAllocator.py b/tools/xmlGenerator/portAllocator.py index 79a1c6b..64e1175 100755 --- a/tools/xmlGenerator/portAllocator.py +++ b/tools/xmlGenerator/portAllocator.py @@ -32,8 +32,8 @@ import sys, socket serversock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: - # Create a listening socket on a random available port - serversock.bind(('localhost',0)) + # Create a listening socket on a random available port on localhost + serversock.bind(('127.0.0.1',0)) serversock.listen(0) # Print the chosen port @@ -41,7 +41,7 @@ try: serversock.close() except socket.error, (errno,message): - print("Socket creation error " + str(errno) + ": " + message) + sys.stderr.write("portAllocator: Socket creation error " + str(errno) + ": " + message + '\n') if serversock: serversock.close() sys.exit(1) diff --git a/utility/convert.hpp b/utility/convert.hpp index 273abd5..55146f7 100755 --- a/utility/convert.hpp +++ b/utility/convert.hpp @@ -34,6 +34,7 @@ #include <sstream> #include <string> #include <stdint.h> +#include <cmath> /* details namespace is here to hide implementation details to header end user. It * is NOT intended to be used outside. */ @@ -53,32 +54,15 @@ template<> struct ConvertionAllowed<int32_t> {}; template<> struct ConvertionAllowed<uint16_t> {}; template<> struct ConvertionAllowed<int16_t> {}; template<> struct ConvertionAllowed<float> {}; +template<> struct ConvertionAllowed<double> {}; -} // namespace details - -/** - * Convert a string to a given type. - * - * This template function read the value of the type T in the given string. - * The function does not allow to have white spaces around the value to parse - * and tries to parse the whole string, which means that if some bytes were not - * read in the string, the function fails. - * Hexadecimal representation (ie numbers starting with 0x) is supported only - * for integral types conversions. - * Result may be modified, even in case of failure. - * - * @param[in] str the string to parse. - * @param[out] result reference to object where to store the result. - * - * @return true if conversion was successful, false otherwise. - */ template<typename T> static inline bool convertTo(const std::string &str, T &result) { /* Check that conversion to that type is allowed. * If this fails, this means that this template was not intended to be used * with this type, thus that the result is undefined. */ - details::ConvertionAllowed<T>(); + ConvertionAllowed<T>(); if (str.find_first_of(std::string("\r\n\t\v ")) != std::string::npos) { return false; @@ -110,6 +94,29 @@ static inline bool convertTo(const std::string &str, T &result) return ss.eof() && !ss.fail() && !ss.bad(); } +} // namespace details + +/** + * Convert a string to a given type. + * + * This template function read the value of the type T in the given string. + * The function does not allow to have white spaces around the value to parse + * and tries to parse the whole string, which means that if some bytes were not + * read in the string, the function fails. + * Hexadecimal representation (ie numbers starting with 0x) is supported only + * for integral types conversions. + * Result may be modified, even in case of failure. + * + * @param[in] str the string to parse. + * @param[out] result reference to object where to store the result. + * + * @return true if conversion was successful, false otherwise. + */ +template<typename T> +static inline bool convertTo(const std::string &str, T &result) +{ + return details::convertTo<T>(str, result); +} /** * Specialization for int16_t of convertTo template function. @@ -143,6 +150,66 @@ inline bool convertTo<int16_t>(const std::string &str, int16_t &result) } /** + * Specialization for float of convertTo template function. + * + * This function follows the same paradigm than it's generic version and is + * based on it but makes furthers checks on the returned value. + * + * The specific implementation is made necessary because the stlport conversion + * from string to float behaves differently than GNU STL: overflow produce + * +/-Infinity rather than an error. + * + * @param[in] str the string to parse. + * @param[out] result reference to object where to store the result. + * + * @return true if conversion was successful, false otherwise. + */ +template<> +inline bool convertTo<float>(const std::string &str, float &result) +{ + if (!details::convertTo(str, result)) { + return false; + } + + if (std::abs(result) == std::numeric_limits<float>::infinity() || + result == std::numeric_limits<float>::quiet_NaN()) { + return false; + } + + return true; +} + +/** + * Specialization for double of convertTo template function. + * + * This function follows the same paradigm than it's generic version and is + * based on it but makes furthers checks on the returned value. + * + * The specific implementation is made necessary because the stlport conversion + * from string to double behaves differently than GNU STL: overflow produce + * +/-Infinity rather than an error. + * + * @param[in] str the string to parse. + * @param[out] result reference to object where to store the result. + * + * @return true if conversion was successful, false otherwise. + */ +template<> +inline bool convertTo<double>(const std::string &str, double &result) +{ + if (!details::convertTo(str, result)) { + return false; + } + + if (std::abs(result) == std::numeric_limits<double>::infinity() || + result == std::numeric_limits<double>::quiet_NaN()) { + return false; + } + + return true; +} + +/** * Specialization for boolean of convertTo template function. * * This function follows the same paradigm than it's generic version. diff --git a/xmlserializer/Android.mk b/xmlserializer/Android.mk index 0e4efeb..8dca27f 100755..100644 --- a/xmlserializer/Android.mk +++ b/xmlserializer/Android.mk @@ -60,8 +60,6 @@ common_c_includes := \ common_shared_libraries := libicuuc common_static_libraries := libxml2 -common_ldlibs := -Lexternal/libxml2/lib - ############################# # Target build @@ -82,8 +80,6 @@ LOCAL_C_INCLUDES += \ LOCAL_SHARED_LIBRARIES := $(common_shared_libraries) libstlport LOCAL_STATIC_LIBRARIES := $(common_static_libraries) -LOCAL_LDLIBS += $(common_ldlibs) - LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) include $(BUILD_STATIC_LIBRARY) @@ -100,14 +96,93 @@ LOCAL_MODULE_TAGS := $(common_module_tags) LOCAL_CFLAGS := $(common_cflags) -LOCAL_C_INCLUDES += \ - $(common_c_includes) +# We must enforce this flag, otherwise schemas are never used. +# This is due to the fact that libxml2-schemas.a is compiled +# with those features enabled, but the xmlversion.h does +# not include those defines. +LOCAL_CFLAGS += -DLIBXML_SCHEMAS_ENABLED + +LOCAL_C_INCLUDES += $(common_c_includes) LOCAL_SHARED_LIBRARIES := $(common_shared_libraries)-host -LOCAL_STATIC_LIBRARIES := $(common_static_libraries) +LOCAL_STATIC_LIBRARIES := libxml2-schemas -LOCAL_LDLIBS += $(common_ldlibs) +LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) + +include $(BUILD_HOST_STATIC_LIBRARY) +################################ +# Export includes for plugins (Target build) +include $(CLEAR_VARS) +LOCAL_MODULE := $(common_module)_includes LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) +LOCAL_STATIC_LIBRARIES := libxml2 +include $(BUILD_STATIC_LIBRARY) + +################################ +# Export includes for plugins (Host build) +include $(CLEAR_VARS) +LOCAL_MODULE := $(common_module)_includes +LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) +LOCAL_STATIC_LIBRARIES := libxml2 +include $(BUILD_HOST_STATIC_LIBRARY) +# +# libxml2-schemas +# +LOCAL_PATH := external/libxml2 +include $(CLEAR_VARS) +LOCAL_SRC_FILES := \ + SAX.c \ + entities.c \ + encoding.c \ + error.c \ + parserInternals.c \ + parser.c \ + tree.c \ + hash.c \ + list.c \ + xmlIO.c \ + xmlmemory.c \ + uri.c \ + valid.c \ + xlink.c \ + HTMLparser.c \ + HTMLtree.c \ + debugXML.c \ + xpath.c \ + xpointer.c \ + xinclude.c \ + nanohttp.c \ + nanoftp.c \ + DOCBparser.c \ + catalog.c \ + globals.c \ + threads.c \ + c14n.c \ + xmlstring.c \ + xmlregexp.c \ + xmlschemas.c \ + xmlschemastypes.c \ + xmlunicode.c \ + xmlreader.c \ + relaxng.c \ + dict.c \ + SAX2.c \ + legacy.c \ + chvalid.c \ + pattern.c \ + xmlsave.c \ + xmlmodule.c \ + xmlwriter.c \ + schematron.c + +LOCAL_C_INCLUDES := $(LOCAL_PATH)/include external/icu4c/common +LOCAL_CFLAGS := \ + -DLIBXML_EXPR_ENABLED \ + -DLIBXML_REGEXP_ENABLED \ + -DLIBXML_PATTERN_ENABLED \ + -DLIBXML_SCHEMAS_ENABLED \ + -DLIBXML_UNICODE_ENABLED +LOCAL_MODULE:= libxml2-schemas include $(BUILD_HOST_STATIC_LIBRARY) diff --git a/xmlserializer/XmlDocSource.cpp b/xmlserializer/XmlDocSource.cpp index 476e415..5e53a81 100644 --- a/xmlserializer/XmlDocSource.cpp +++ b/xmlserializer/XmlDocSource.cpp @@ -36,14 +36,16 @@ // Schedule for libxml2 library bool CXmlDocSource::_bLibXml2CleanupScheduled; -CXmlDocSource::CXmlDocSource(_xmlDoc *pDoc, _xmlNode *pRootNode): +CXmlDocSource::CXmlDocSource(_xmlDoc *pDoc, _xmlNode *pRootNode, + bool bValidateWithSchema) : _pDoc(pDoc), _pRootNode(pRootNode), _strXmlSchemaFile(""), _strRootElementType(""), _strRootElementName(""), _strNameAttrituteName(""), - _bNameCheck(false) + _bNameCheck(false), + _bValidateWithSchema(bValidateWithSchema) { init(); } @@ -59,20 +61,41 @@ CXmlDocSource::CXmlDocSource(_xmlDoc *pDoc, _strRootElementType(strRootElementType), _strRootElementName(strRootElementName), _strNameAttrituteName(strNameAttrituteName), - _bNameCheck(true) + _bNameCheck(true), + _bValidateWithSchema(false) { init(); } CXmlDocSource::CXmlDocSource(_xmlDoc* pDoc, const string& strXmlSchemaFile, - const string& strRootElementType) : + const string& strRootElementType, + bool bValidateWithSchema) : _pDoc(pDoc), _pRootNode(NULL), _strXmlSchemaFile(strXmlSchemaFile), _strRootElementType(strRootElementType), _strRootElementName(""), _strNameAttrituteName(""), - _bNameCheck(false) + _bNameCheck(false), + _bValidateWithSchema(bValidateWithSchema) +{ + init(); +} + +CXmlDocSource::CXmlDocSource(_xmlDoc *pDoc, + const string& strXmlSchemaFile, + const string& strRootElementType, + const string& strRootElementName, + const string& strNameAttrituteName, + bool bValidateWithSchema) : + _pDoc(pDoc), + _pRootNode(NULL), + _strXmlSchemaFile(strXmlSchemaFile), + _strRootElementType(strRootElementType), + _strRootElementName(strRootElementName), + _strNameAttrituteName(strNameAttrituteName), + _bNameCheck(true), + _bValidateWithSchema(bValidateWithSchema) { init(); } @@ -118,12 +141,15 @@ bool CXmlDocSource::validate(CXmlSerializingContext& serializingContext) return false; } - // Validate - if (!isInstanceDocumentValid()) { + // Validate if necessary + if (_bValidateWithSchema) + { + if (!isInstanceDocumentValid()) { - serializingContext.setError("Document is not valid"); + serializingContext.setError("Document is not valid"); - return false; + return false; + } } // Check Root element type diff --git a/xmlserializer/XmlDocSource.h b/xmlserializer/XmlDocSource.h index 9b780e5..fd9a693 100644 --- a/xmlserializer/XmlDocSource.h +++ b/xmlserializer/XmlDocSource.h @@ -52,8 +52,9 @@ public: * * @param[out] pDoc a pointer to the xml document that will be filled by the class * @param[in] pRootNode a pointer to the root element of the document. + * @param[in] bValidateWithSchema a boolean that toggles schema validation */ - CXmlDocSource(_xmlDoc* pDoc, _xmlNode* pRootNode = NULL); + CXmlDocSource(_xmlDoc* pDoc, _xmlNode* pRootNode = NULL, bool bValidateWithSchema = false); /** * Constructor @@ -76,8 +77,26 @@ public: * @param[out] pDoc a pointer to the xml document that will be filled by the class * @param[in] strXmlSchemaFile a string containing the path to the schema file * @param[in] strRootElementType a string containing the root element type + * @param[in] strRootElementName a string containing the root element name + * @param[in] strNameAttributeName a string containing the name of the root name attribute + * @param[in] bValidateWithSchema a boolean that toggles schema validation */ - CXmlDocSource(_xmlDoc* pDoc, const string& strXmlSchemaFile, const string& strRootElementType); + CXmlDocSource(_xmlDoc* pDoc, + const string& strXmlSchemaFile, + const string& strRootElementType, + const string& strRootElementName, + const string& strNameAttrituteName, + bool bValidateWithSchema); + + /** + * Constructor + * + * @param[out] pDoc a pointer to the xml document that will be filled by the class + * @param[in] strXmlSchemaFile a string containing the path to the schema file + * @param[in] strRootElementType a string containing the root element type + */ + CXmlDocSource(_xmlDoc* pDoc, const string& strXmlSchemaFile, const string& strRootElementType, + bool bValidateWithSchema); /** * Destructor @@ -197,4 +216,9 @@ private: * Boolean that enables the root element name attribute check */ bool _bNameCheck; + + /** + * Boolean that enables the validation via xsd files + */ + bool _bValidateWithSchema; }; diff --git a/xmlserializer/XmlElement.cpp b/xmlserializer/XmlElement.cpp index d0ab91a..bda3973 100644 --- a/xmlserializer/XmlElement.cpp +++ b/xmlserializer/XmlElement.cpp @@ -86,6 +86,9 @@ string CXmlElement::getAttributeString(const string &strAttributeName) const return ""; } xmlChar* pucXmlValue = xmlGetProp((xmlNode*)_pXmlElement, (const xmlChar*)strAttributeName.c_str()); + if (pucXmlValue == NULL) { + return ""; + } string strValue((const char*)pucXmlValue); @@ -130,6 +133,9 @@ double CXmlElement::getAttributeDouble(const string &strAttributeName) const string CXmlElement::getTextContent() const { xmlChar* pucXmlContent = xmlNodeGetContent(_pXmlElement); + if (pucXmlContent == NULL) { + return ""; + } string strContent((const char*)pucXmlContent); diff --git a/xmlserializer/XmlFileDocSource.cpp b/xmlserializer/XmlFileDocSource.cpp index 0fb3962..908c13b 100644 --- a/xmlserializer/XmlFileDocSource.cpp +++ b/xmlserializer/XmlFileDocSource.cpp @@ -38,22 +38,26 @@ CXmlFileDocSource::CXmlFileDocSource(const string& strXmlInstanceFile, const string& strXmlSchemaFile, const string& strRootElementType, const string& strRootElementName, - const string& strNameAttrituteName) : + const string& strNameAttrituteName, + bool bValidateWithSchema) : base(readFile(strXmlInstanceFile), strXmlSchemaFile, strRootElementType, strRootElementName, - strNameAttrituteName), + strNameAttrituteName, + bValidateWithSchema), _strXmlInstanceFile(strXmlInstanceFile) { } CXmlFileDocSource::CXmlFileDocSource(const string& strXmlInstanceFile, const string& strXmlSchemaFile, - const string& strRootElementType) : + const string& strRootElementType, + bool bValidateWithSchema) : base(readFile(strXmlInstanceFile), strXmlSchemaFile, - strRootElementType), + strRootElementType, + bValidateWithSchema), _strXmlInstanceFile(strXmlInstanceFile) { } diff --git a/xmlserializer/XmlFileDocSource.h b/xmlserializer/XmlFileDocSource.h index 7a8bb8d..b8b0c6b 100644 --- a/xmlserializer/XmlFileDocSource.h +++ b/xmlserializer/XmlFileDocSource.h @@ -47,20 +47,24 @@ public: * @param[in] strRootElementType a string containing the root element type * @param[in] strRootElementName a string containing the root element name * @param[in] strNameAttributeName a string containing the name of the root name attribute + * @param[in] bValidateWithSchema a boolean that toggles schema validation */ CXmlFileDocSource(const string& strXmlInstanceFile, const string& strXmlSchemaFile, const string& strRootElementType, const string& strRootElementName, - const string& strNameAttrituteName); + const string& strNameAttrituteName, + bool bValidateWithSchema); /** * Constructor * * @param[in] strXmlInstanceFile a string containing the path to the xml file * @param[in] strXmlSchemaFile a string containing the path to the schema file * @param[in] strRootElementType a string containing the root element type + * @param[in] bValidateWithSchema a boolean that toggles schema validation */ - CXmlFileDocSource(const string& strXmlInstanceFile, const string& strXmlSchemaFile, const string& strRootElementType); + CXmlFileDocSource(const string& strXmlInstanceFile, const string& strXmlSchemaFile, const string& strRootElementType, + bool bValidateWithSchema); /** * CXmlDocSource method implementation. diff --git a/xmlserializer/XmlMemoryDocSource.cpp b/xmlserializer/XmlMemoryDocSource.cpp index b60ee41..85abbfc 100644 --- a/xmlserializer/XmlMemoryDocSource.cpp +++ b/xmlserializer/XmlMemoryDocSource.cpp @@ -38,8 +38,10 @@ CXmlMemoryDocSource::CXmlMemoryDocSource(const IXmlSource* pXmlSource, const string& strRootElementType, const string& strXmlSchemaFile, const string& strProduct, - const string& strVersion): - base(xmlNewDoc(BAD_CAST "1.0"), xmlNewNode(NULL, BAD_CAST strRootElementType.c_str())), + const string& strVersion, + bool bValidateWithSchema): + base(xmlNewDoc(BAD_CAST "1.0"), xmlNewNode(NULL, BAD_CAST strRootElementType.c_str()), + bValidateWithSchema), _pXmlSource(pXmlSource), _strXmlSchemaFile(strXmlSchemaFile), _bWithHeader(true), _strProduct(strProduct), _strVersion(strVersion) { @@ -47,8 +49,10 @@ CXmlMemoryDocSource::CXmlMemoryDocSource(const IXmlSource* pXmlSource, } CXmlMemoryDocSource::CXmlMemoryDocSource(const IXmlSource* pXmlSource, - const string& strRootElementType): - base(xmlNewDoc(BAD_CAST "1.0"), xmlNewNode(NULL, BAD_CAST strRootElementType.c_str())), + const string& strRootElementType, + bool bValidateWithSchema): + base(xmlNewDoc(BAD_CAST "1.0"), xmlNewNode(NULL, BAD_CAST strRootElementType.c_str()), + bValidateWithSchema), _pXmlSource(pXmlSource), _bWithHeader(false) { init(); diff --git a/xmlserializer/XmlMemoryDocSource.h b/xmlserializer/XmlMemoryDocSource.h index 1e549ff..072cb06 100644 --- a/xmlserializer/XmlMemoryDocSource.h +++ b/xmlserializer/XmlMemoryDocSource.h @@ -50,10 +50,12 @@ public: * @param[in] strXmlSchemaFile a string containing the path to the schema file * @param[in] strProduct a string containing the product name * @param[in] strVersion a string containing the version number + * @param[in] bValidateWithSchema a boolean that toggles schema validation */ CXmlMemoryDocSource(const IXmlSource* pXmlSource, const string& strRootElementType, const string& strXmlSchemaFile, const string& strProduct, - const string& strVersion); + const string& strVersion, + bool bValidateWithSchema); /** * Constructor @@ -61,8 +63,9 @@ public: * @param[in] pXmlSource a pointer to a parameter-framework structure that can generate * an xml description of itself * @param[in] strRootElementType a string containing the root element type + * @param[in] bValidateWithSchema a boolean that toggles schema validation */ - CXmlMemoryDocSource(const IXmlSource* pXmlSource, const string& strRootElementType); + CXmlMemoryDocSource(const IXmlSource* pXmlSource, const string& strRootElementType, bool bValidateWithSchema); /** * Implementation of CXmlDocSource::populate() method. diff --git a/xmlserializer/XmlStringDocSource.cpp b/xmlserializer/XmlStringDocSource.cpp index b360322..12307f2 100644 --- a/xmlserializer/XmlStringDocSource.cpp +++ b/xmlserializer/XmlStringDocSource.cpp @@ -37,12 +37,14 @@ CXmlStringDocSource::CXmlStringDocSource(const string& strXmlInput, const string& strXmlSchemaFile, const string& strRootElementType, const string& strRootElementName, - const string& strNameAttrituteName) : + const string& strNameAttrituteName, + bool bValidateWithSchema) : base(xmlReadMemory(strXmlInput.c_str(), strXmlInput.size(), "", NULL, 0), - strXmlSchemaFile, - strRootElementType, - strRootElementName, - strNameAttrituteName) + strXmlSchemaFile, + strRootElementType, + strRootElementName, + strNameAttrituteName, + bValidateWithSchema) { } diff --git a/xmlserializer/XmlStringDocSource.h b/xmlserializer/XmlStringDocSource.h index 312d72b..d7cde9b 100644 --- a/xmlserializer/XmlStringDocSource.h +++ b/xmlserializer/XmlStringDocSource.h @@ -47,12 +47,14 @@ public: * @param[in] strRootElementType a string containing the root element type * @param[in] strRootElementName a string containing the root element name * @param[in] strNameAttributeName a string containing the name of the root name attribute + * @param[in] bValidateWithSchema a boolean that toggles schema validation */ CXmlStringDocSource(const string& strXmlInput, const string& strXmlSchemaFile, const string& strRootElementType, const string& strRootElementName, - const string& strNameAttrituteName); + const string& strNameAttrituteName, + bool bValidateWithSchema); /** * CXmlDocSource method implementation. |