Skip to content

Instantly share code, notes, and snippets.

@clausjoergensen
Created November 30, 2011 11:43
Show Gist options
  • Save clausjoergensen/1408780 to your computer and use it in GitHub Desktop.
Save clausjoergensen/1408780 to your computer and use it in GitHub Desktop.
public override byte[] Create()
{
var stream = new MemoryStream();
using (var writer = new BinaryWriter(stream))
{
writer.Write(CommunicationAddress);
writer.Write(CommandId);
unchecked
{
writer.Write((byte)(CommunicationPassword >> 8));
writer.Write((byte)(CommunicationPassword));
writer.Write((byte)(registerId >> 8));
writer.Write((byte)(registerId));
}
writer.Write(registerUnit);
writer.Write(sizeof(byte));
writer.Write(signAndExponent);
writer.Write(registerValue);
}
return CreatePhysicalLayerFrame(stream.ToArray().AddCRC());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment