Пример #1
0
        internal bool Open(HidDevice device, IDeviceReportParser reportParser)
        {
            Close();
            Tablet = device;
            if (Tablet != null)
            {
                Log.Write("Detect", $"Found device '{Tablet.GetFriendlyName()}'.");
                Log.Write("Detect", $"Using report parser type '{reportParser.GetType().FullName}'.");
                if (Debugging)
                {
                    Log.Debug($"Device path: {Tablet.DevicePath}");
                }

                TabletReader        = new DeviceReader <IDeviceReport>(Tablet);
                TabletReader.Parser = reportParser;
                TabletReader.Start();
                TabletReader.Report += HandleReport;
                // Post tablet opened event
                TabletSuccessfullyOpened?.Invoke(this, TabletProperties);
                return(true);
            }
            else
            {
                if (Debugging)
                {
                    Log.Write("Detect", "Tablet not found.", true);
                }
                return(false);
            }
        }
Пример #2
0
        internal bool OpenAux(HidDevice auxDevice, IDeviceReportParser reportParser)
        {
            if (auxDevice != null)
            {
                if (Debugging)
                {
                    Log.Debug($"Found aux device with report length {auxDevice.GetMaxInputReportLength()}.");
                    Log.Debug($"Device path: {auxDevice.DevicePath}");
                }

                AuxReader        = new DeviceReader <IDeviceReport>(auxDevice);
                AuxReader.Parser = reportParser;
                AuxReader.Start();
                AuxReader.Report += HandleReport;
                return(true);
            }
            else
            {
                if (Debugging)
                {
                    Log.Write("Detect", "Failed to open aux device.");
                }
                return(false);
            }
        }
Пример #3
0
        internal bool Open(HidDevice device, IDeviceReportParser reportParser)
        {
            Close();
            Tablet = device;
            if (Tablet != null)
            {
                Log.Write("Detect", $"Found device '{Tablet.GetFriendlyName()}'.");
                Log.Write("Detect", $"Using report parser type '{reportParser.GetType().FullName}'.");
                Log.Debug($"Device path: {Tablet.DevicePath}");

                TabletReader        = new DeviceReader <IDeviceReport>(Tablet);
                TabletReader.Parser = reportParser;
                TabletReader.Start();
                TabletReader.Report += HandleReport;

                if (TabletProperties.FeatureInitReport != null && TabletProperties.FeatureInitReport.Length > 0)
                {
                    Log.Debug($"Setting feature: " + BitConverter.ToString(TabletProperties.FeatureInitReport));
                    TabletReader.ReportStream.SetFeature(TabletProperties.FeatureInitReport);
                }

                // Post tablet opened event
                TabletSuccessfullyOpened?.Invoke(this, TabletProperties);
                return(true);
            }
            else
            {
                return(false);
            }
        }