コード例 #1
0
ファイル: ADS1298deviceVM.cs プロジェクト: mgcarmueja/MPTCE
        ///  <summary>
        ///  Constructor.
        ///  </summary>
        public ADS1298deviceVM(ADS1298device model)
            : base()
        {
            this.model = model;
            importSettingsCommand = new RelayCommand(ImportSettings) { IsEnabled = true };
            exportSettingsCommand = new RelayCommand(ExportSettings) { IsEnabled = true };
            resetSettingsCommand = new RelayCommand(ResetSettings) { IsEnabled = true };
            refreshSettingsCommand = new RelayCommand(RefreshSettings) { IsEnabled = true };
            saveSettingsCommand = new RelayCommand(SaveSettings) { IsEnabled = true };

            OnPropertyChanged(String.Empty);

            // Catch settings from the ADS1298 class.
            this.model.PropertyChanged += (sender, e) =>
            {
                OnPropertyChanged(e.PropertyName);
            };
        }
コード例 #2
0
ファイル: DeviceManager.cs プロジェクト: mgcarmueja/MPTCE
        ///  <summary>
        ///  Adds a new attached device.
        ///  </summary>
        ///  <param name="devicePathName"> the device path name to add to the manager. </param>
        private void AddEPdevice(String devicePathName)
        {
            ADS1298device adsDevice = new ADS1298device(this.CLASS_GUID, devicePathName);

            if (adsDevice.InitializeDevice())
            {
                if (adsDevice.ValidateVendorProductID(VENDOR_ID, PRODUCT_ID))
                {
                    _EPdevices.Add(adsDevice);
                    Thread.Sleep(100);
                    EPdevicesVM.Add(new ADS1298deviceVM(adsDevice));
                }
            }
        }
コード例 #3
0
ファイル: DeviceManager.cs プロジェクト: mgcarmueja/MPTCE
        /*
        ///  <summary>
        ///  Destructor.
        ///  </summary>
        ~EPdeviceManager()
        {
            ;
        }
        */
        ///  <summary>
        ///  Check if any devices are already connected and create them.
        ///  </summary>
        ///  
        ///  <param name="WPFhandler"> a pointer to the main handler. </param>
        public void Initialize(IntPtr WPFhandler)
        {
            ADS1298device myADSdevice;
            String[] devicePathNames = { };

            // Check if there are any devices for this class connected.
            if (UsbNotifications.FindDevice(CLASS_GUID, ref devicePathNames))
            {
                foreach (String devicePathName in devicePathNames)
                {
                    // Create device and initialize it.
                    myADSdevice = new ADS1298device(this.CLASS_GUID, devicePathName);

                    if (myADSdevice.InitializeDevice())
                    {
                        if (myADSdevice.ValidateVendorProductID(VENDOR_ID, PRODUCT_ID))
                        {
                            _EPdevices.Add(myADSdevice);
                            Thread.Sleep(500);
                            EPdevicesVM.Add(new ADS1298deviceVM(myADSdevice));
                        }
                    }
                }
            }

            // Register for notifications on this device class.
            UsbNotifications.RegisterForDeviceNotifications(WPFhandler, CLASS_GUID, ref UsbNotificationHandle);
        }