private CommandResponse SendCommand(SSPCommand cmd) { if (coms.SendCommand(cmd) == false) { return(CommandResponse.PortError); } LogDataEventArgs arg = new LogDataEventArgs() { direction = "TX", packet = coms.GetSSP().SSPLog.TxPacketPlain, timestamp = coms.GetSSP().SSPLog.TxTimeStamp, encrypted_packet = cmd.ESSPCommand ? coms.GetSSP().SSPLog.TxPacketEncrypted : "", }; OnLogData(arg); LogDataEventArgs arg_r = new LogDataEventArgs() { direction = "RX", packet = coms.GetSSP().SSPLog.RxPacketPlain, timestamp = coms.GetSSP().SSPLog.RxTimeStamp, encrypted_packet = cmd.ESSPCommand ? coms.GetSSP().SSPLog.RxPacketEncrypted : "", }; OnLogData(arg_r); return(CommandResponse.OK); }
protected virtual void OnLogData(LogDataEventArgs e) { EventHandler <LogDataEventArgs> handler = LogData; if (handler != null) { handler(this, e); } }
public void OnDataLog(object sender, LogDataEventArgs args) { ThreadPool.QueueUserWorkItem(delegate { SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext(Application.Current.Dispatcher)); SynchronizationContext.Current.Send(pl => { LogCollection.Add(args.Data); }, null); }); }
// FFmpeg uses stderr for output void ErrorDataReceived(object sender, DataReceivedEventArgs e) { if (!String.IsNullOrEmpty(e.Data)) { Debug.WriteLine("FFmpeg: " + e.Data); var matches = Regex.Match(e.Data, PtrnUdpStream); if (matches.Success) { LogDataEventArgs eventArgs = new LogDataEventArgs(); Int32.TryParse(matches.Groups["frame"].Value, out eventArgs.frame); float.TryParse(matches.Groups["fps"].Value, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out eventArgs.fps); float.TryParse(matches.Groups["q"].Value, NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture, out eventArgs.q); Int32.TryParse(matches.Groups["size"].Value, out eventArgs.size); TimeSpan.TryParse(matches.Groups["time"].Value, out eventArgs.time); float.TryParse(matches.Groups["bitrate"].Value, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out eventArgs.bitrate); if (OnLogDataReceived != null) { OnLogDataReceived(this, eventArgs); } } } }
private void OnNewMessage(object sender, LogDataEventArgs e) { counter += 1; this.message = mesheader + e.Message; this.txtView.BeginInvokeOnMainThread(() => (this.txtView.Value = this.message)); }
private void Sys_LogData(object sender, LogDataEventArgs e) { AddLogListItem(listView2, e.timestamp, e.direction, e.packet, e.encrypted_packet); }