public void Parse(Core.Frames.Frame commandFrame, Core.Frames.Frame responseFrame) { FinsResponseFrame response; FinsCommandFrame command; var MRC = (int)FinsCommandFrame.FinsCommandFields.MRC; var SRC = (int)FinsCommandFrame.FinsCommandFields.SRC; Contract.Requires(commandFrame.GetByte(MRC) == (byte)FinsCommandFrame.FinsMainRequestCodes.StatusReading, "The command frame has a Main Request code this is not valid for a Read cycle time command."); Contract.Requires(commandFrame.GetByte(SRC) == (byte)FinsCommandFrame.FinsSubRequestCodes.CycleTimeRead, "The command frame has a Sub Request code this is not valid for a Read cycle time command."); //TODO: Validate End code //Assuming we're here then the response must be valid. response = new FinsResponseFrame(responseFrame); command = new Omron.Commands.Frames.Fins.FinsCommandFrame(commandFrame); }
public void Parse(Frame commandFrame, Frame responseFrame) { // byte[] bytes = commandFrame.GetRange(commandFrame.Length, responseFrame.Length - commandFrame.Length); //Bytes will be the bit or words returned. // string value = Convert.ToString(bytes); // response = Convert.ToInt32(value); var finsFrame = new FinsResponseFrame(responseFrame); byte[] data = finsFrame.Data; //is this a read of bits or bytes (words) Omron.Commands.Frames.Fins.FinsCommandFrame command = new Commands.Frames.Fins.FinsCommandFrame(commandFrame); Omron.Commands.Frames.Fins.FinsReadCommandParameter param = Commands.Frames.Fins.FinsReadCommandParameter.FromBytes(command.Parameter); }