Ejemplo n.º 1
0
        /// <summary>
        /// Returns the Frame Direction as a human readable string
        /// </summary>
        /// <param name="direction">the direction object</param>
        /// <returns>The direction as a string</returns>
        private string getDirectionAsString(Peak.Lin.TLINDirection direction)
        {
            switch (direction)
            {
            case Peak.Lin.TLINDirection.dirDisabled:
                return(Resources.SLinDirectionDisabled);

            case Peak.Lin.TLINDirection.dirPublisher:
                return(Resources.SLinDirectionPublisher);

            case Peak.Lin.TLINDirection.dirSubscriber:
                return(Resources.SLinDirectionSubscriber);

            case Peak.Lin.TLINDirection.dirSubscriberAutoLength:
                return(Resources.SLinDirectionAuto);
            }
            return("");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds an CFrameDefinition object with the defined values to the end of the CGlobalFrameTable.
        /// </summary>
        /// <param name="AId">The Frame ID of the CFrameDefinition object to be added to the end of the CGlobalFrameTable.</param>
        /// <param name="ALength">The Frame Length of the CFrameDefinition object to be added to the end of the CGlobalFrameTable.</param>
        /// <param name="AChecksumType">The Frame Checksum Type of the CFrameDefinition object to be added to the end of the CGlobalFrameTable.</param>
        /// <param name="ADirection">The Frame Direction of the CFrameDefinition object to be added to the end of the CGlobalFrameTable.</param>
        /// <returns>Returns the Index of position in the list.</returns>
        private int AddFrameDefinition(int AId, int ALength, Peak.Lin.TLINChecksumType AChecksumType, Peak.Lin.TLINDirection ADirection)
        {
            // Check the Frame-ID for adding.
            // Only ID's from 0 to 63 are allowed to add.
            if ((AId < 0) || (AId > 63))
            {
                // ID is invalid. Do not add it.
                return(-1);
            }
            else
            {
                // The delivered Frame-ID is valid.
                CFrameDefinition lFD;
                byte             lbID;

                // Create a Frame Definition object.
                // and assigned the delivered values to it.
                lFD                 = new CFrameDefinition();
                lFD.m_pParent       = this;
                lFD.m_nID           = AId;
                lFD.m_nLength       = ALength;
                lFD.m_nChecksumType = AChecksumType;
                lFD.m_bDirection    = ADirection;
                // Calculate the Protected-ID with
                // the delivered Frame-ID.
                lbID = Convert.ToByte(AId);
                Peak.Lin.PLinApi.GetPID(ref lbID);
                // Assign the calculated Protected-ID.
                lFD.m_nProtectedID = lbID;
                // Add the created object to the list.
                m_lFrameDefinitions.Add(lFD);
            }
            // Return the position of the new added object.
            // It should be added at the end so the position
            // must be the last entry in the list.
            return(m_lFrameDefinitions.Count - 1);
        }