public override byte[] ToBytes() { byte[] b = ConvertBytes.HostToNetwork((uint)value); byte[] bout = new byte[BaseTypeLength]; Array.Copy(b, 4 - BaseTypeLength, bout, 0, bout.Length); return(bout); }
public override double Parse(byte[] msg, int offset) { UInt16 x = ConvertBytes.NetworktoHostUint16(msg, offset); value = x * scale + offset; return(value); }
public override double Parse(byte[] msg, int offset) { byte[] b = new byte[sizeof(uint)]; Array.Copy(msg, offset, b, 4 - BaseTypeLength, BaseTypeLength); uint bits = ConvertBytes.NetworktoHostUint32(b, 0); value = bits; return(value); }
public override byte[] ToBytes() { double x = (value + offset) / scale; if (x > UInt16.MaxValue) { x = UInt16.MaxValue; } if (x < UInt16.MinValue) { x = UInt16.MinValue; } return(ConvertBytes.HostToNetwork((UInt16)x)); }
public override double Parse(byte[] msg, int offset) { value = ConvertBytes.NetworkToHostDouble(msg, offset); return(value); }
/// <summary> /// Convert a double to a byte stream /// </summary> /// <returns></returns> public override byte[] ToBytes() { return(ConvertBytes.HostToNetwork(value)); }