Example #1
0
        /// <summary>
        /// Copies this byte array to the provided CANMessage <paramref name="c"/>.
        /// </summary>
        /// <param name="e">The source byte array.</param>
        /// <param name="c">The CAN Message to copy to.</param>
        /// <param name="sourceIndex">The location to start in the source array.</param>
        /// <param name="destIndex">The location to start in the CAN Message.</param>
        /// <param name="length">The number of bytes to copy over.</param>
        public static void CopyTo(this byte[] e, CANMessage c, int sourceIndex, int destIndex, int length)
        {
            if (sourceIndex >= e.Length || sourceIndex < 0)
            {
                throw new ArgumentOutOfRangeException("sourceIndex");
            }
            if (destIndex < 0 || destIndex > c.Count)
            {
                throw new ArgumentOutOfRangeException("destIndex");
            }

            for (
                int i = sourceIndex, j = destIndex;
                i < length && i < e.Length && j < c.Count;
                i++, j++)
            {
                c[j] = e[i];
            }
        }
Example #2
0
 /// <summary>
 /// Generate a Message ID for the provided CANMessage.
 /// </summary>
 /// <param name="cm">The CAN Message to identify.</param>
 public MessageID(CANMessage cm)
 {
     this.cm = cm;
 }