/// <summary> /// Returns the Frame checksum type as a human readable string /// </summary> /// <param name="checksumType">the checksumType object</param> /// <returns>The checksumType as a string</returns> private string getChecksumAsString(Peak.Lin.TLINChecksumType checksumType) { switch (checksumType) { case Peak.Lin.TLINChecksumType.cstAuto: return(Resources.SLinCSTAuto); case Peak.Lin.TLINChecksumType.cstClassic: return(Resources.SLinCSTClassic); case Peak.Lin.TLINChecksumType.cstEnhanced: return(Resources.SLinCSTEnhanced); case Peak.Lin.TLINChecksumType.cstCustom: return(Resources.SLinCSTCustom); } return(""); }
/// <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); }