public readonly void Assert(byte count) { if (FunctionCode != FunctionCode.Read) { S7ProtocolException.ThrowUnexpectedFunctionCode(FunctionCode.Read, FunctionCode); } if (ItemCount != count) { S7ProtocolException.ThrowUnexpectedItemCount(count, ItemCount); } }
public readonly void Assert(FunctionCode functionCode) { if (FunctionCode != functionCode) { S7ProtocolException.ThrowUnexpectedFunctionCode(FunctionCode, functionCode); } if (Reserved != 0) { S7ProtocolException.ThrowIncorrectReserved(Reserved); } }
public readonly void Assert(MessageType messageType) { if (ProtocolId != 0x32) { S7ProtocolException.ThrowProtocolIDDoesNotMatch(ProtocolId); } if (Reserved.High != 0 || Reserved.Low != 0) { S7ProtocolException.ThrowReservedNot0(Reserved); } if ((MessageType == MessageType.AckData || MessageType == MessageType.Ack) && (ErrorClass != HeaderErrorClass.NoError || ErrorCode != 0)) { S7ProtocolException.ThrowCommunicationFailure(MessageType, ErrorClass, ErrorCode); } if (MessageType != messageType) { S7ProtocolException.ThrowIncorrectMessageType(messageType, MessageType); } }