示例#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);
            }
        }