Example #1
0
        /// <summary>
        /// Construct a new provider handler class.
        /// </summary>
        public MTVProviderHandler()
        {
            // The comparer.
            this.pComparer = new HidContactInfoEqualityComparer();

            // Create the contact list and tables.
            this.lCurrentContacts = new Queue<HidContactInfo>();
            this.dLastContacts = new Dictionary<int, HidContactInfo>();
            this.pContactLock = new Mutex();
        }
Example #2
0
		public DriverCommunicator()
		{
			comparer = new HidContactInfoEqualityComparer();
			lockCurrentContacts = new object();

			device = HidDevices.Enumerate(0xdddd, 0x0001).FirstOrDefault();
			if (device == null)
				throw new InvalidOperationException("Universal Software HID driver was not found. Please ensure that it is installed.");

			device.Open(HidDevice.DeviceMode.Overlapped, HidDevice.DeviceMode.NonOverlapped);

			currentContacts = new Queue<HidContactInfo>();
			lastContactInfo = new Dictionary<int, HidContactInfo>();

			timer = new Timer();
			timer.AutoReset = false;
			timer.Interval = 1000 / 133d;
			timer.Elapsed += timer_Elapsed;
			timer.Start();
		}