private void HandleReport(object sender, RpcData rpcData)
        {
            var report = rpcData.GetData(AppInfo.PluginManager);

            tabletVisualizer.SetData(rpcData);

            if (report is IDeviceReport deviceReport)
            {
                reportPeriod += (stopwatch.Restart().TotalMilliseconds - reportPeriod) / 10.0f;
                reportRateBox.Update($"{(uint)(1000 / reportPeriod)}hz");

                string formatted = ReportFormatter.GetStringFormat(deviceReport);
                tabletBox.Update(formatted);

                string raw = ReportFormatter.GetStringRaw(deviceReport);
                rawTabletBox.Update(raw);
            }
        }
Exemple #2
0
        private void HandleReport(object sender, DebugReportData data)
        {
            tabletVisualizer.SetData(data);
            var report = data.ToObject();

            if (report is IDeviceReport deviceReport)
            {
                deviceNameBox.Update(data.Tablet.Properties.Name);

                reportPeriod += (stopwatch.Restart().TotalMilliseconds - reportPeriod) / 10.0f;
                reportRateBox.Update($"{(uint)(1000 / reportPeriod)}hz");

                string formatted = ReportFormatter.GetStringFormat(deviceReport);
                tabletBox.Update(formatted);

                string raw = ReportFormatter.GetStringRaw(deviceReport);
                rawTabletBox.Update(raw);
            }
        }
Exemple #3
0
        public TabletDebugger()
        {
            Title = "Tablet Debugger";

            var debugger = new StackLayout
            {
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                Height  = 400,
                Padding = 5,
                Spacing = 5,
                Items   =
                {
                    new DebuggerGroup
                    {
                        Text    = "Device",
                        Content = deviceName = new Label
                        {
                            Font = Fonts.Monospace(10)
                        }
                    },
                    new StackLayoutItem
                    {
                        Expand  = true,
                        Control = new StackLayout
                        {
                            Orientation = Orientation.Horizontal,
                            VerticalContentAlignment = VerticalAlignment.Stretch,
                            Items =
                            {
                                new StackLayoutItem
                                {
                                    Expand  = true,
                                    Control = new DebuggerGroup
                                    {
                                        Text    = "Raw Tablet Data",
                                        Content = rawTablet = new Label
                                        {
                                            Font = Fonts.Monospace(10)
                                        }
                                    }
                                },
                                new StackLayoutItem
                                {
                                    Expand  = true,
                                    Control = new DebuggerGroup
                                    {
                                        Text    = "Tablet Report",
                                        Content = tablet = new Label
                                        {
                                            Font = Fonts.Monospace(10)
                                        }
                                    }
                                }
                            }
                        }
                    },
                    new DebuggerGroup
                    {
                        Text    = "Report Rate",
                        Content = reportRate = new Label
                        {
                            Font = Fonts.Monospace(10)
                        }
                    },
                    new StackLayoutItem
                    {
                        Control = new StackLayout
                        {
                            Orientation = Orientation.Horizontal,
                            VerticalContentAlignment = VerticalAlignment.Bottom,
                            Items =
                            {
                                new StackLayoutItem
                                {
                                    Expand  = true,
                                    Control = new DebuggerGroup
                                    {
                                        Text    = "Reports Recorded",
                                        Content = reportsRecorded = new Label
                                        {
                                            Font = Fonts.Monospace(10)
                                        }
                                    }
                                },
                                new Group
                                {
                                    Text    = "Options",
                                    Content = enableDataRecording = new CheckBox
                                    {
                                        Text = "Enable Data Recording"
                                    }
                                }
                            }
                        }
                    }
                }
            };

            this.Content = new Splitter
            {
                Orientation = Orientation.Vertical,
                Width       = 640,
                Height      = 800,
                FixedPanel  = SplitterFixedPanel.Panel2,
                Panel1      = new DebuggerGroup
                {
                    Text    = "Visualizer",
                    Content = tabletVisualizer = new TabletVisualizer()
                },
                Panel2 = debugger
            };

            var reportBinding = ReportDataBinding.Child(c => (c.ToObject() as IDeviceReport));

            deviceName.TextBinding.Bind(ReportDataBinding.Child(c => c.Tablet.Properties.Name));
            rawTablet.TextBinding.Bind(reportBinding.Child(c => ReportFormatter.GetStringRaw(c)));
            tablet.TextBinding.Bind(reportBinding.Child(c => ReportFormatter.GetStringFormat(c)));
            reportRate.TextBinding.Bind(ReportPeriodBinding.Convert(c => Math.Round(1000.0 / c) + "hz"));
            reportsRecorded.TextBinding.Bind(NumberOfReportsRecordedBinding.Convert(c => c.ToString()));
            tabletVisualizer.ReportDataBinding.Bind(ReportDataBinding);

            Application.Instance.AsyncInvoke(() =>
            {
                App.Driver.AddConnectionHook(ConnectionHook);
            });

            var outputStream = File.OpenWrite(Path.Join(AppInfo.Current.AppDataDirectory, "tablet-data.txt"));

            dataRecordingOutput = new StreamWriter(outputStream);
        }
Exemple #4
0
        public TabletDebugger()
            : base(Application.Instance.MainForm)
        {
            Title = "Tablet Debugger";

            var debugger = new StackLayout
            {
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                Height  = 320,
                Padding = SPACING,
                Spacing = SPACING,
                Items   =
                {
                    new StackLayoutItem
                    {
                        Control = new StackLayout
                        {
                            Orientation = Orientation.Horizontal,
                            VerticalContentAlignment = VerticalAlignment.Bottom,
                            Items =
                            {
                                new StackLayoutItem
                                {
                                    Expand  = true,
                                    Control = new DebuggerGroup
                                    {
                                        Text    = "Device",
                                        Content = deviceName = new Label
                                        {
                                            Font = Fonts.Monospace(LARGE_FONTSIZE)
                                        }
                                    }
                                },
                                new DebuggerGroup
                                {
                                    Text    = "Report Rate",
                                    Width   = LARGE_FONTSIZE * 6,
                                    Content = reportRate = new Label
                                    {
                                        Font = Fonts.Monospace(LARGE_FONTSIZE)
                                    }
                                },
                                new StackLayoutItem
                                {
                                    Control = new DebuggerGroup
                                    {
                                        Text    = "Reports Recorded",
                                        Width   = LARGE_FONTSIZE * 10,
                                        Content = reportsRecorded = new Label
                                        {
                                            Font = Fonts.Monospace(LARGE_FONTSIZE)
                                        }
                                    }
                                },
                                new Group
                                {
                                    Text    = "Options",
                                    Content = enableDataRecording = new CheckBox
                                    {
                                        Text = "Enable Data Recording"
                                    }
                                }
                            }
                        }
                    },
                    new StackLayoutItem
                    {
                        Expand  = true,
                        Control = new StackLayout
                        {
                            Orientation = Orientation.Horizontal,
                            VerticalContentAlignment = VerticalAlignment.Stretch,
                            Height = 240,
                            Items  =
                            {
                                new StackLayoutItem
                                {
                                    Expand  = true,
                                    Control = new DebuggerGroup
                                    {
                                        Text    = "Raw Tablet Data",
                                        Width   = FONTSIZE * 33,
                                        Content = rawTablet = new Label
                                        {
                                            Font = Fonts.Monospace(FONTSIZE)
                                        }
                                    }
                                },
                                new StackLayoutItem
                                {
                                    Control = new DebuggerGroup
                                    {
                                        Text    = "Tablet Report",
                                        Width   = FONTSIZE * 33,
                                        Content = tablet = new Label
                                        {
                                            Font = Fonts.Monospace(FONTSIZE)
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            };

            var splitter = new Splitter
            {
                Orientation = Orientation.Vertical,
                Width       = 660,
                Height      = 800,
                FixedPanel  = SplitterFixedPanel.Panel2,
                Panel1      = new DebuggerGroup
                {
                    Height  = 200,
                    Text    = "Visualizer",
                    Content = tabletVisualizer = new TabletVisualizer()
                },
                Panel2 = debugger
            };

            this.Content = new Scrollable
            {
                Content = splitter
            };

            var reportBinding = ReportDataBinding.Child(c => (c.ToObject() as IDeviceReport));

            deviceName.TextBinding.Bind(ReportDataBinding.Child(c => c.Tablet.Properties.Name));
            rawTablet.TextBinding.Bind(reportBinding.Child(c => ReportFormatter.GetStringRaw(c)));
            tablet.TextBinding.Bind(reportBinding.Child(c => ReportFormatter.GetStringFormat(c)));
            reportRate.TextBinding.Bind(ReportPeriodBinding.Convert(c => Math.Round(1000.0 / c) + "hz"));
            reportsRecorded.TextBinding.Bind(NumberOfReportsRecordedBinding.Convert(c => c.ToString()));
            tabletVisualizer.ReportDataBinding.Bind(ReportDataBinding);

            App.Driver.DeviceReport   += HandleReport;
            App.Driver.TabletsChanged += HandleTabletsChanged;
            App.Driver.Instance.SetTabletDebug(true);

            var outputStream = File.OpenWrite(Path.Join(AppInfo.Current.AppDataDirectory, "tablet-data.txt"));

            dataRecordingOutput = new StreamWriter(outputStream);
        }