/// <summary> /// Sends a text value to the connected EV3. /// </summary> /// <param name="title">The title of the message. /// The length of the title may be atmost 254 characters.</param> /// <param name="value">The value of the message. /// The length of the value may be atmost 254 characters. /// Note: The EV3 protocol allows a text value to be of size 65534, but thats way too long for the slow transmission speed) /// </param> /// <returns>True if the message was send, false otherwise.</returns> public bool SendMessage(string title, string value) { if (title == null) { throw new ArgumentNullException("title"); } if (title.Length > 254) { throw new ArgumentException("title", "The title may be at most 254 characters long."); } if (value == null) { throw new ArgumentNullException("value"); } if (value.Length > 254) { throw new ArgumentException("value", "The value may be at most 254 characters long."); } byte[] rawMessage = RawMessage.Create(title, value); Debug.WriteLine("Going to send message <" + title + ": " + value + ">."); return(communicator.Send(rawMessage)); }
// Schedule the transmission of a message on the serial port at a // given time and priority. public void send(command_queue cq, ReadOnlySpan <byte> msg, ulong min_clock = 0, ulong req_clock = 0) { RawMessage qm = RawMessage.Create(msg); qm.min_clock = min_clock; qm.req_clock = req_clock; send_batch(cq, new Span <RawMessage>(&qm, 1)); }
internal void ExecuteTest() { var config = PrepareConfiguration(); var consumer = config.Container.Resolve <PrimaryConsumer>(); var transport = (DefaultTransport)config.Transport; var result = consumer.ProcessMessage(RawMessage.Create(this.scenario.Message)); // Check Result Type if (this.scenario.ExpectedResultType != null) { this.testAdapter.Assert(result.GetType() == this.scenario.ExpectedResultType, String.Format("Expected a {0}, actual was {1}", scenario.ExpectedResultType, result)); if (this.scenario.ResultValidationCallback != null) { this.scenario.ResultValidationCallback(result); } } // Check Published Message Counts if (this.scenario.ShouldPublishNothing) { this.testAdapter.Assert(this.interceptor.Messages.Count == 0, "Messages were published when not expected"); } // Check for expected messages and values foreach (var expectedMessage in this.scenario.ExpectedMessages) { var actualMessage = this.interceptor.Messages.FirstOrDefault(m => m.GetType() == expectedMessage.Key); this.testAdapter.Assert(actualMessage != null, String.Format("Expected message {0} was not published", expectedMessage.Key)); if (expectedMessage.Value != null) { expectedMessage.Value(actualMessage); } } }
public void Send(string subscription, object message) { this.Send(subscription, RawMessage.Create(message)); }
/// <summary> /// Sends a message to all queues that subscribe to the subscription /// </summary> /// <param name="subscription"></param> /// <param name="message"></param> public void Send <T>(string subscription, IMessage <T> message) { this.Send(subscription, RawMessage.Create(message)); }