public static byte[] ToXbeeFrame(UInt64 value) { // numbers are big endian in XBee frames if (BitConverter.IsLittleEndian) { value = AdapterHelper.ReverseBytes(value); } return(BitConverter.GetBytes(value)); }
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)); }
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); }
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); }