private void SendSingleIndicationReport(DeviceIndicationReport report, string marsName) { if (_marsClients.ContainsKey(marsName)) { if (!ValidateMessages || report.IsValid(out var exception)) { _marsClients[marsName].SoapClient.BegindoDeviceIndicationReport(report, null, null); MessageSent?.BeginInvoke(report, marsName, null, null); } else { ValidationErrorOccured?.Invoke(this, new InvalidMessageException(report, exception)); } } }
public void SendFullDeviceStatusReport(string clientName) { if (_marsClients.ContainsKey(clientName)) { if (!ValidateMessages || StatusReport.IsValid(out var exception)) { _socket.SendAsync(_marsClients[clientName].IPPort, StatusReport.ToXml()); MessageSent?.BeginInvoke(StatusReport, clientName, null, null); } else { ValidationErrorOccured?.BeginInvoke(this, new InvalidMessageException(StatusReport, exception), null, null); } } }
/// <summary> /// Send a custom <see cref="DeviceStatusReport"/> message to a specific mars client /// </summary> /// <param name="statusReport">the status report</param> /// <param name="clientName">mars name (can be found in <see cref="_marsClients"/>)</param> public void SendCustomDeviceStatusReport(DeviceStatusReport statusReport, string clientName) { if (_marsClients.ContainsKey(clientName)) { var emptyStatus = GetEmptyStatus(StatusReport); if (!ValidateMessages || emptyStatus.IsValid(out var exception)) { _marsClients[clientName].SoapClient.BegindoDeviceStatusReport(emptyStatus, null, null); MessageSent?.BeginInvoke(statusReport, clientName, null, null); } else { ValidationErrorOccured?.Invoke(this, new InvalidMessageException(emptyStatus, exception)); } } }