public static string ToSml(this SecsMessage msg) { if (msg is null) { return(null); } using (var sw = new StringWriter()) { msg.WriteTo(sw); return(sw.ToString()); } }
public static void WriteTo(this SecsMessage msg, TextWriter writer, int indent = 4) { if (msg is null) { return; } writer.WriteLine(msg.ToString()); if (msg.SecsItem != null) { msg.SecsItem.Write(writer, indent); } writer.Write('.'); }
public static async Task WriteToAsync(this SecsMessage msg, TextWriter writer, int indent = 4) { if (msg is null) { return; } await writer.WriteLineAsync(msg.ToString()); if (msg.SecsItem != null) { await WriteAsync(writer, msg.SecsItem, indent); } await writer.WriteAsync('.'); }
public SecsException(SecsMessage msg, string description) : base(description) { SecsMsg = msg; }
public void MessageOut(SecsMessage msg, int systembyte) => WriteLine($"--> [0x{systembyte:X8}] {msg}");
public void MessageIn(SecsMessage msg, int systembyte) => WriteLine($"<-- [0x{systembyte:X8}] {msg}");
public static bool IsMatch(this SecsMessage src, in SecsMessage target)