Created
November 30, 2011 11:43
-
-
Save clausjoergensen/1408780 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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