S101RobotRunAsync Method | |
Asynchronously simulates S101 communication.
Namespace: Lawo.EmberPlusSharp.S101Assembly: Lawo.EmberPlusSharp (in Lawo.EmberPlusSharp.dll) Version: 1.4.1707.27006
Syntax public static Task RunAsync(
S101Client client,
EmberTypeBag types,
XmlReader logReader,
bool sendFirstMessage
)
Parameters
- client
- Type: Lawo.EmberPlusSharp.S101S101Client
The S101Client to use. - types
- Type: Lawo.EmberPlusSharp.EmberEmberTypeBag
The types to pass to the internal EmberConverter, which is used to convert
between XML payload and EmBER payload. - logReader
- Type: System.XmlXmlReader
The XmlReader to read the messages from. The messages that are
expected to be received from the remote party as well as the ones that will be sent are read with this
reader. The format needs to match the one written by S101Logger. - sendFirstMessage
- Type: SystemBoolean
true to send the first EmberData message read with
logReader; false to wait for the first message from the remote party and match it
to the first EmberData message read with logReader.
Return Value
Type:
TaskA
Task object representing the communication. This task completes when one of the
following events occurs:
- The last message in the log has been sent/received.
- The ConnectionLost event occurred on the client passed to
RunAsync(S101Client, EmberTypeBag, XmlReader, Boolean).
Exceptions Exception | Condition |
---|
ArgumentNullException | client, types and/or
logReader equal null. |
S101Exception | - There was a mismatch between an incoming message and one read from the log.
- The ConnectionLost event occurred on the client passed to
RunAsync(S101Client, EmberTypeBag, XmlReader, Boolean).
|
XmlException | The XML read with logReader is invalid, see
Message for details. |
Remarks Reads messages with logReader and depending on the direction either sends them to
the remote party or matches them to messages received from the remote party. If a message received from the
remote party does not match the one in the log then an appropriate exception is thrown.
Subsequent messages read with logReader that match the direction of the first
message read with logReader are sent if sendFirstMessage equals
true; otherwise such messages are matched to the ones received from the remote party. The opposite
happens with log messages of opposite direction.
See Also