internal static string AsString(this PhysicalAddress Address)
        {
            StringBuilder sb = new StringBuilder();

            foreach (var CurrentByte in Address.GetAddressBytes())
            {
                sb.Append(CurrentByte.ToString("X2"));
                sb.Append(":");
            }

            return(sb.ToString(0, sb.Length - 1));
        }
Пример #2
0
        /// <summary>
        /// Converts a byte array into a readable string
        /// </summary>
        /// <param name="data">The data to convert</param>
        /// <returns>The data as a string</returns>
        //  Revision History
        //  MM/DD/YY Who Version Issue# Description
        //  -------- --- ------- ------ -------------------------------------------
        //  08/09/11 RCG 2.52.00        Created

        public static string ConvertDataToString(byte[] data)
        {
            string DataString = "";

            if (data != null)
            {
                foreach (byte CurrentByte in data)
                {
                    DataString += CurrentByte.ToString("X2", CultureInfo.CurrentCulture) + " ";
                }
            }

            return(DataString);
        }
Пример #3
0
        /// <summary>
        /// Formats the contents of the Entry as a string
        /// </summary>
        /// <returns>The entry as a string</returns>
        //  Revision History
        //  MM/DD/YY Who Version Issue# Description
        //  -------- --- ------- ------ ---------------------------------------------
        //  11/11/11 RCG 2.53.05        Created

        public override string ToString()
        {
            string EntryString = "";

            EntryString += "      Fatal Error Reset Type = " + EnumDescriptionRetriever.RetrieveDescription(ResetType) + "\r\n";
            EntryString += "      Fatal Error Subcode = " + SubCode.ToString(CultureInfo.InvariantCulture) + "\r\n";
            EntryString += "      Current Task ID = " + m_CurrentTaskID.ToString(CultureInfo.InvariantCulture) + "\r\n";
            EntryString += "      Reset State = " + m_ResetState.ToString(CultureInfo.InvariantCulture) + "\r\n";
            EntryString += "      Reset Time = " + ResetTime.ToString("G", CultureInfo.CurrentCulture) + "\r\n";

            for (int Index = 0; Index < m_CondensedRegistrationTable.Count(); Index++)
            {
                EntryString += "      Registration Table Data [" + Index.ToString(CultureInfo.InvariantCulture) + "]\r\n";
                EntryString += m_CondensedRegistrationTable[Index].ToString();
            }

            for (int Index = 0; Index < m_ResetErrors.Count(); Index++)
            {
                EntryString += "      ZigBee Error Log Entry [" + Index.ToString(CultureInfo.InvariantCulture) + "]\r\n";
                EntryString += m_ResetErrors[Index].ToString();
            }

            for (int Index = 0; Index < m_ResetEvents.Count(); Index++)
            {
                EntryString += "      ZigBee Event Log Entry [" + Index.ToString(CultureInfo.InvariantCulture) + "]\r\n";
                EntryString += m_ResetEvents[Index].ToString();
            }

            EntryString += "      Error Specific Data = ";

            foreach (byte CurrentByte in m_SpecificErrorData)
            {
                EntryString += CurrentByte.ToString("X2", CultureInfo.InvariantCulture) + " ";
            }

            EntryString += "\r\n";

            EntryString += "      Mini Core Dump\r\n";
            EntryString += m_MiniCoreDump.ToString();

            return(EntryString);
        }
Пример #4
0
        /// <summary>
        /// Writes the Serial Port Data to the log
        /// </summary>
        /// <param name="direction">The direction of the data</param>
        /// <param name="data">The data to write</param>
        //  Revision History
        //  MM/DD/YY Who Version Issue# Description
        //  -------- --- ------- ------ -------------------------------------------
        //  08/09/11 RCG 2.52.00        Created

        public void WriteSerialData(EZSPLogDirection direction, byte[] data)
        {
            string Output = "";

            if (direction == EZSPLogDirection.Send)
            {
                Output += "S: ";
            }
            else
            {
                Output += "R: ";
            }

            foreach (byte CurrentByte in data)
            {
                Output += CurrentByte.ToString("X2", CultureInfo.InvariantCulture) + " ";
            }

            WriteLine(EZSPLogLevels.SerialPort, Output);
        }