Esempio n. 1
1
		void Button_Click_1(object sender, RoutedEventArgs e)
		{
			UsbDevice = new UsbLibrary.UsbHidPort();
			UsbDevice.VendorId = 0xC251;
			UsbDevice.ProductId = 0x1303;
			UsbDevice.CheckDevicePresent();

			UsbDevice.SpecifiedDevice.DataRecieved += new UsbLibrary.DataRecievedEventHandler(SpecifiedDevice_DataRecieved);
		}
Esempio n. 2
0
        //class constructor
        public Turret()
        {
            if (!built)//ensure singleton status
            {
                built = true;
                this.UP = new byte[10];
                this.UP[1] = 2;
                this.UP[2] = 2;

                this.DOWN = new byte[10];
                this.DOWN[1] = 2;
                this.DOWN[2] = 1;

                this.LEFT = new byte[10];
                this.LEFT[1] = 2;
                this.LEFT[2] = 4;

                this.RIGHT = new byte[10];
                this.RIGHT[1] = 2;
                this.RIGHT[2] = 8;

                this.FIRE = new byte[10];
                this.FIRE[1] = 2;
                this.FIRE[2] = 0x10;

                this.STOP = new byte[10];
                this.STOP[1] = 2;
                this.STOP[2] = 0x20;

                this.LED_ON = new byte[9];
                this.LED_ON[1] = 3;
                this.LED_ON[2] = 1;

                this.LED_OFF = new byte[9];
                this.LED_OFF[1] = 3;

                this.USB = new UsbHidPort();
                this.USB.ProductId = 0;
                this.USB.SpecifiedDevice = null;
                this.USB.VendorId = 2123;
                this.USB.OnSpecifiedDeviceRemoved += new EventHandler(this.USB_OnSpecifiedDeviceRemoved);
                this.USB.OnDataRecieved += new DataRecievedEventHandler(this.USB_OnDataRecieved);
                this.USB.OnSpecifiedDeviceArrived += new EventHandler(this.USB_OnSpecifiedDeviceArrived);

                this.USB.VID_List[0] = 0xa81;
                this.USB.PID_List[0] = 0x701;
                this.USB.VID_List[1] = 0x2123;
                this.USB.PID_List[1] = 0x1010;
                this.USB.ID_List_Cnt = 2;

                IntPtr handle = new IntPtr();
                this.USB.RegisterHandle(handle);
            }
            else throw new SingletonException("Thats no Moon!!!! i.e thats a singleton dumbass!");
            //throw singleton exception if call violates singleton status
        }
Esempio n. 3
0
 public FS20PCSDevice()
 {
     this.usb = new UsbHidPort();            
     this.usb.VendorId = 0x18EF; // VendorID von ELV z.B. aus Windows Gerätemanager zu entnehmen
     this.usb.ProductId = 0xE015; // ProductID des FS20 PCSz.B. aus Windows Gerätemanager zu entnehmen
     this.usb.OnSpecifiedDeviceArrived += new EventHandler(this.OnSpecifiedDeviceArrived);
     
     // Prüfen ob Gerät angeschlossen
     this.usb.CheckDevicePresent();
 }
Esempio n. 4
0
        public Launcher()
        {
            this.UP = new byte[10];
            this.UP[1] = 2;
            this.UP[2] = 2;

            this.DOWN = new byte[10];
            this.DOWN[1] = 2;
            this.DOWN[2] = 1;

            this.LEFT = new byte[10];
            this.LEFT[1] = 2;
            this.LEFT[2] = 4;

            this.RIGHT = new byte[10];
            this.RIGHT[1] = 2;
            this.RIGHT[2] = 8;

            this.FIRE = new byte[10];
            this.FIRE[1] = 2;
            this.FIRE[2] = 0x10;

            this.STOP = new byte[10];
            this.STOP[1] = 2;
            this.STOP[2] = 0x20;

            this.LED_ON = new byte[9];
            this.LED_ON[1] = 3;
            this.LED_ON[2] = 1;

            this.LED_OFF = new byte[9];
            this.LED_OFF[1] = 3;

            this.USB = new UsbHidPort();
            this.USB.ProductId = 0;
            this.USB.SpecifiedDevice = null;
            this.USB.VendorId = 0;
            this.USB.OnSpecifiedDeviceRemoved += new EventHandler(this.USB_OnSpecifiedDeviceRemoved);
            this.USB.OnDataRecieved += new DataRecievedEventHandler(this.USB_OnDataRecieved);
            this.USB.OnSpecifiedDeviceArrived += new EventHandler(this.USB_OnSpecifiedDeviceArrived);

            this.USB.VID_List[0] = 0xa81;
            this.USB.PID_List[0] = 0x701;
            this.USB.VID_List[1] = 0x2123;
            this.USB.PID_List[1] = 0x1010;
            this.USB.ID_List_Cnt = 2;

            IntPtr handle = new IntPtr();
            this.USB.RegisterHandle(handle);
        }
Esempio n. 5
0
		public bool Open()
		{
			UsbHidPort = new UsbHidPort()
			{
				VendorId = 0xC251,
				ProductId = 0x1303
			};
			UsbHidPort.CheckDevicePresent();
			if (UsbHidPort.SpecifiedDevice == null)
				return false;
			UsbHidPort.SpecifiedDevice.DataRecieved += new DataRecievedEventHandler(OnDataRecieved);
			UsbHidPort.SpecifiedDevice.OnDeviceRemoved += new EventHandler(UsbHidPort_OnDeviceRemoved);
			return true;
		}
 public GHWTDrumController(FrmMain main, int pid, int vid)
 {
     m_UsbDrum = new UsbHidPort();
     m_UsbDrum.ProductId = pid;
     m_UsbDrum.VendorId = vid;
     m_UsbDrum.OnSpecifiedDeviceArrived += UsbOnSpecifiedDeviceArrived;
     m_UsbDrum.OnSpecifiedDeviceRemoved += UsbOnSpecifiedDeviceRemoved;
     m_UsbDrum.OnDataRecieved += UsbOnDataRecieved;
     
     m_HitFilter = new HitFilter(main, 6, m_GuiTranslater);
     m_CheckForDrumTimer = new Timer();
     m_CheckForDrumTimer.Interval = 1000;
     m_CheckForDrumTimer.Tick += CheckForDrumsTick;
     m_CheckForDrumTimer.Start();
 }
        public ProDrumController(FrmMain main, int pid, int vid)
        {
            m_UsbDrum = new UsbHidPort();
            m_UsbDrum.ProductId = pid;
            m_UsbDrum.VendorId = vid;
            m_UsbDrum.OnSpecifiedDeviceArrived += new System.EventHandler(UsbOnSpecifiedDeviceArrived);
            m_UsbDrum.OnSpecifiedDeviceRemoved += new System.EventHandler(UsbOnSpecifiedDeviceRemoved);
            m_UsbDrum.OnDataRecieved += new UsbLibrary.DataRecievedEventHandler(UsbOnDataRecieved);

            m_HitFilter = new HitFilter(main, NUM_PADS, m_GuiTranslater);
            m_CheckForDrumTimer = new Timer();
            m_CheckForDrumTimer.Interval = 1000;
            m_CheckForDrumTimer.Tick += CheckForDrumsTick;
            m_CheckForDrumTimer.Start();
        }
Esempio n. 8
0
		public static List<UsbHidPort> FindDevices(int nVid, int nPid)
		{
			var result = new List<UsbHidPort>();
			var usbHidDevices = HIDDevice.FindAllDevice(nVid, nPid, typeof(SpecifiedDevice));
			foreach (var usbHidDevice in usbHidDevices)
			{
				var usbHidPort = new UsbHidPort()
				{
					VendorId = 0xC251,
					ProductId = 0x1303
				};
				usbHidPort.SpecifiedDevice = (SpecifiedDevice)usbHidDevice;
				result.Add(usbHidPort);
				usbHidPort.SetSpecifiedDevice((SpecifiedDevice)usbHidDevice);
			}
			return result;
		}
Esempio n. 9
0
        private void Begin()
        {
            _usb = new UsbLibrary.UsbHidPort();
            _usb.OnSpecifiedDeviceRemoved += new EventHandler(USB_OnSpecifiedDeviceRemoved);
            _usb.OnDataRecieved += new DataRecievedEventHandler(USB_OnDataRecieved);
            _usb.OnSpecifiedDeviceArrived += new EventHandler(USB_OnSpecifiedDeviceArrived);
            _usb.VID_List[0] = 7476;
            _usb.PID_List[0] = 13; //18
            _usb.ID_List_Cnt = 1;
            _usb.RegisterHandle(Process.GetCurrentProcess().MainWindowHandle);

            _timer = new Timer(50);
            _timer.Elapsed += TimerOnElapsed;
            _timer.Start();

            for (; ;) //ever
            {
            }
        }
        public void Connect()
        {
            var container = new Container();
            _usb = new UsbHidPort(container);
            _usb.ProductId = 0;
            _usb.VendorId = 0;

            _usb.SpecifiedDevice = null;
            _usb.OnSpecifiedDeviceRemoved += OnSpecifiedDeviceRemoved;
            _usb.OnDataRecieved += OnDataRecieved;
            _usb.OnSpecifiedDeviceArrived += OnSpecifiedDeviceArrived;

            _usb.VID_List[0] = 2689;
            _usb.PID_List[0] = 1793;
            _usb.VID_List[1] = 8483;
            _usb.PID_List[1] = 4112;
            _usb.ID_List_Cnt = 2;
            _usb.RegisterHandle(Process.GetCurrentProcess().MainWindowHandle);
            _isConnected = true;
        }
Esempio n. 11
0
        /// <summary>
        /// class constructor
        /// </summary>
        private TurretManager()
        {
            this.UP = new byte[10];
            this.UP[1] = 2;
            this.UP[2] = 2;

            this.DOWN = new byte[10];
            this.DOWN[1] = 2;
            this.DOWN[2] = 1;

            this.LEFT = new byte[10];
            this.LEFT[1] = 2;
            this.LEFT[2] = 4;

            this.RIGHT = new byte[10];
            this.RIGHT[1] = 2;
            this.RIGHT[2] = 8;

            this.FIRE = new byte[10];
            this.FIRE[1] = 2;
            this.FIRE[2] = 0x10;

            this.STOP = new byte[10];
            this.STOP[1] = 2;
            this.STOP[2] = 0x20;

            this.LED_ON = new byte[9];
            this.LED_ON[1] = 3;
            this.LED_ON[2] = 1;

            this.LED_OFF = new byte[9];
            this.LED_OFF[1] = 3;

            this.USB = new UsbHidPort();
            this.USB.ProductId = 0;
            this.USB.SpecifiedDevice = null;
            this.USB.VendorId = 2123;
            this.USB.OnSpecifiedDeviceRemoved += new EventHandler(this.USB_OnSpecifiedDeviceRemoved);
            this.USB.OnDataRecieved += new DataRecievedEventHandler(this.USB_OnDataRecieved);
            this.USB.OnSpecifiedDeviceArrived += new EventHandler(this.USB_OnSpecifiedDeviceArrived);

            this.USB.VID_List[0] = 0xa81;
            this.USB.PID_List[0] = 0x701;
            this.USB.VID_List[1] = 0x2123;
            this.USB.PID_List[1] = 0x1010;
            this.USB.ID_List_Cnt = 2;

            IntPtr handle = new IntPtr();
            this.USB.RegisterHandle(handle);
            /*this reset was causing issues at startup, so changed where the reset occurs --Chris*/
            //reset turret so its ready
            //this.ResetToOrigin();
        }
Esempio n. 12
0
		public void SetUsbHidPort(UsbHidPort usbHidPort)
		{
			UsbHidPort = usbHidPort;
			UsbHidPort.SpecifiedDevice.DataRecieved += new DataRecievedEventHandler(OnDataRecieved);
			UsbHidPort.SpecifiedDevice.OnDeviceRemoved += new EventHandler(UsbHidPort_OnDeviceRemoved);
		}