}//CheckResponseFrame #endregion #region PUBLIC #region Receiver internal virtual void InitMsg(FrameStateMachine request) { if (request == null) { throw new ArgumentNullException("txmsg", "Message cannot be null"); } userDataLength = userBuffLength; FrameAttribute = AttributeCharacter.ResponseData; //To pass unit test: ResponseWriteValue expectedFrameAttribute = request.ExpectedResultFrameType(); DataType = request.DataType; userDataLength = request.FrameResponseLength(); offset = 0; Count = 0; Rxdcrc = 0; Part = FramePart.Head; rxMsgCurrError = CheckResponseResult.CR_OK; crc.clear(); }
/// <summary> /// Prepares the frame to be send, i.e. copy the frame from <paramref name="sourceFrame"/> and adds crc and escape sequence. /// </summary> /// <param name="sourceFrame">To be send frame.</param> internal void PrepareFrameToBeSend(FrameStateMachine sourceFrame) { int length = sourceFrame.userDataLength; offset = 0; userDataLength = userBuffLength; crc.clear(); byte ch = 0; for (int idx = 0; idx < length; idx++) { ch = sourceFrame[idx]; CopyNextByte(ch); } ushort Crc = (ushort)crc.getCrc(); WriteCRC(Crc); userDataLength = (ushort)(offset); }
internal override void InitMsg(FrameStateMachine txmsg) { base.InitMsg(txmsg); DLESeq = false; }