Beispiel #1
0
        /// <summary>
        /// Initialize resources, open usb driver, register for
        /// USB events
        /// </summary>
        /// <returns>true on success, false otherwise</returns>
        public override bool Init()
        {
            Settings.PreferencesFilePath = UserManager.GetFullPath(SettingsFileName);
            WordsPlusActuatorSettings = Settings.Load();

            // register for USB events "PID_0303";
            _usbDevice = new USBDevice(WordsPlusVid, _wordsPlusPID);
            _usbDevice.EvtReadDataNotify += _usbDevice_EvtReadDataNotify;
            _usbDevice.EvtDeviceDisconnected += _usbDevice_EvtDeviceDisconnected;

            // timer is used, in case the USB device is
            // not connected.  Let's poll periodically to
            // see if it is plugged in
            _timer = new Timer {Interval = WordsPlusActuatorSettings.WordsPlusKeyCheckInterval};
            _timer.Elapsed += _timer_Elapsed;

            // open usb device and begin reading data
            if (!openAndBeginRead())
            {
                _timer.Start();
            }

            return true;
        }
Beispiel #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 public WordsPlusActuator()
     : base()
 {
     WordsPlusActuatorSettings = new Settings();
 }