예제 #1
0
        /// <summary>
        /// Load the extended parameters
        /// </summary>
        internal void LoadExtendedParameters(XPathDocument document)
        {
            XPathNavigator navigator = document.CreateNavigator();

            foreach (XPathNavigator node in navigator.Select(
                         "/logger/protocols/protocol/ecuparams/ecuparam/ecu[@id='" + this.EcuIdentifier + "']"))
            {
                node.MoveToFirstChild();
                int address = SsmParameterSource.GetMemoryAddress(node);
                int length  = SsmParameterSource.GetMemoryLength(node);
                node.MoveToParent();
                node.MoveToParent();

                string name = node.GetAttribute("name", "");
                string id   = node.GetAttribute("id", "");

                XPathNodeIterator iterator    = node.Select("conversions/conversion");
                List <Conversion> conversions = SsmParameterSource.GetConversions(iterator);

                SsmParameter parameter = new SsmParameter(
                    this,
                    id,
                    name,
                    address,
                    length,
                    conversions.AsReadOnly());

                // TODO: remove this when the duplicates in logger.xml are cleaned up
                if (!this.Parameters.Contains(parameter))
                {
                    this.AddParameter(parameter);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Load the standard parameters
        /// </summary>
        internal void LoadStandardParameters(XPathDocument document)
        {
            XPathNavigator navigator = document.CreateNavigator();

            foreach (XPathNavigator node in navigator.Select(
                         "/logger/protocols/protocol/parameters/parameter"))
            {
                string id   = node.GetAttribute("id", string.Empty);
                string name = node.GetAttribute("name", string.Empty);

                int byteIndex = SsmParameterSource.GetIndexFromAttribute(node, "ecubyteindex");
                int bitIndex  = SsmParameterSource.GetIndexFromAttribute(node, "ecubit");

                XPathNodeIterator children = node.Select("address");
                children.MoveNext();
                int address = SsmParameterSource.GetMemoryAddress(children.Current);
                int length  = SsmParameterSource.GetMemoryLength(children.Current);

                children.MoveNext();
                children = node.Select("conversions/conversion");
                List <Conversion> conversions = SsmParameterSource.GetConversions(children);

                children = node.Select("depends/ref");
                ReadOnlyCollection <Parameter> dependencies = this.GetDependencies(children);

                if (this.EcuSupports(byteIndex, bitIndex))
                {
                    SsmParameter parameter = new SsmParameter(
                        this,
                        id,
                        name,
                        address,
                        length,
                        conversions.AsReadOnly(),
                        byteIndex,
                        bitIndex,
                        dependencies);

                    this.AddParameter(parameter);
                }
                else
                {
                    Trace.WriteLine("Skipping parameter " + id + " / " + name);
                }
            }
        }