Example #1
0
 public static byte[] ToXbeeFrame(UInt64 value)
 {
     // numbers are big endian in XBee frames
     if (BitConverter.IsLittleEndian)
     {
         value = AdapterHelper.ReverseBytes(value);
     }
     return(BitConverter.GetBytes(value));
 }
Example #2
0
 public static byte[] ToZigBeeFrame(UInt64 value)
 {
     // numbers are little endian in ZigBee frames (ZDO and ZCL)
     if (!BitConverter.IsLittleEndian)
     {
         value = AdapterHelper.ReverseBytes(value);
     }
     return(BitConverter.GetBytes(value));
 }
Example #3
0
        public static UInt16 UInt16FromXbeeFrame(byte[] buffer, int offset)
        {
            // numbers are big endian in XBee frames
            UInt16 value = BitConverter.ToUInt16(buffer, offset);

            if (BitConverter.IsLittleEndian)
            {
                value = AdapterHelper.ReverseBytes(value);
            }
            return(value);
        }
Example #4
0
        public static UInt64 UInt64FromZigBeeFrame(byte[] buffer, int offset)
        {
            // numbers are little endian in ZigBee frames (ZDO and ZCL)
            UInt64 value = BitConverter.ToUInt64(buffer, offset);

            if (!BitConverter.IsLittleEndian)
            {
                value = AdapterHelper.ReverseBytes(value);
            }
            return(value);
        }