Beispiel #1
0
 private static void WriteData(USBInterface usb, byte secondByteValue)
 {
     var command = new byte[] { 0, 2 };
     command[1] = secondByteValue;
     usb.UsbDevice.writeDataSimple(command);
     Thread.Sleep(50);
 }
Beispiel #2
0
 private static void Main(string[] args)
 {
     var usb = new USBInterface(@"vid_0a81", @"pid_ff01");
     usb.Connect();
     WriteData(usb, 64);
     WriteData(usb, 16);
     WriteData(usb, 64);
     WriteData(usb, 64);
     WriteData(usb, 32);
     Console.ReadLine();
 }
Beispiel #3
0
        public static void Start()
        {
            usb = new USBInterface(vid, pid);
            Console.WriteLine("USB Connection: "+usb.Connect());

            usb.startRead();

            //usb.stopRead();

            //MyPause();
        }
Beispiel #4
0
 public UsbHID(string vendorId, string productId)
 {
     usb = new USBInterface(vendorId, productId);
     if (!usb.Connect())
     {
         throw new InvalidOperationException("Usb can't connect to devices");
         return;
     }
     usbLog = new Log(productId, vendorId);
     usbLog.connectLog();
 }
Beispiel #5
0
 private static void Main(string[] args)
 {
     _device = new USBInterface("vid_1294", "pid_1320");
     _device.Connect();
     var line = Console.ReadLine();
     while (line != null && line != "E")
     {
         var b = Convert.ToByte(line);
         WriteDataEx(b);
         line = Console.ReadLine();
     }
     Console.ReadLine();
 }
Beispiel #6
0
        public LightController()
        {
            const string vendorId = "vid_1294"; 
            const string productId = "pid_1320"; 
            _device = new USBInterface(vendorId, productId);

            if (_connected)
            {
                return;
            }
            _device.enableUsbBufferEvent(UsbDeviceEventCacher);
            _connected = true;
        }
Beispiel #7
0
 static void Main(string[] args)
 {
     var usb = new USBInterface(@"vid_0a81", @"pid_ff01");
     usb.Connect();
     // sample to file a missile
     WriteData(usb, 8);
     Thread.Sleep(2000);
     WriteData(usb, 0);
     Thread.Sleep(2500);
     WriteData(usb, 8);
     Thread.Sleep(2500);
     WriteData(usb, 0);
     Thread.Sleep(2500);
     Console.ReadLine();
 }
Beispiel #8
0
        private static void Main(string[] args)
        {
            Console.WriteLine("Press key (1 ... 8) to change color in Light Notifier");
            Console.WriteLine("Press key (E) to exit app");
            Console.WriteLine("Press other key to crash the app");

            _device = new USBInterface("vid_1294", "pid_1320");
            _device.Connect();
            var line = Console.ReadLine();
            while (line != null && line.ToUpper() != "E")
            {
                var b = Convert.ToByte(line);
                WriteDataEx(b);
                line = Console.ReadLine();
            }
            Console.ReadLine();
        }
 public static void Find()
 {
     USBInterface = new USBInterface("vid_067b", "pid_2303");
     USBInterface.Connect();
 }
Beispiel #10
0
        static void Main(string[] args)
        {
            try
            {

                if (args.Length > 0)
                    VirtualKeys = false;
                string VID = ConfigurationManager.AppSettings["VID"] ?? "vid_05f3";
                string PID = ConfigurationManager.AppSettings["PID"] ?? "pid_00ff";

                Left = ConfigurationManager.AppSettings["Left"] ?? "L";
                Middle = ConfigurationManager.AppSettings["Middle"] ?? "M";
                Right = ConfigurationManager.AppSettings["Right"] ?? "R";

                VKeyLeft = ConfigurationManager.AppSettings["Left"] ?? "{LEFT}";
                VKeyMiddle = ConfigurationManager.AppSettings["Middle"] ?? " ";
                VKeyRight = ConfigurationManager.AppSettings["Right"] ?? "{RIGHT}";

                usbI = new USBInterface(VID, PID);
                savehandle = new EventHandler(HIDhandler);

                bool conn = usbI.Connect();

                if (conn)
                {
                    usbI.enableUsbBufferEvent(savehandle);
                    Thread.Sleep(5);
                    usbI.startRead();

                }

                Console.Read();
                if (conn)
                {
                    usbI.stopRead();
                    try
                    {
                        usbI.Disconnect();
                    }
                    catch { }
                }

            }
            finally
            {
                Environment.Exit(0); //Force close application
            }
        }
Beispiel #11
0
        static void Main(string[] args)
        {
            if (args.Length > 0)
                VirtualKeys = false;
            string VID = ConfigurationManager.AppSettings["VID"] ?? "vid_05f3";
            string PID = ConfigurationManager.AppSettings["PID"] ?? "pid_00ff";

            Left = ConfigurationManager.AppSettings["Left"] ?? "L";
            Middle = ConfigurationManager.AppSettings["Middle"] ?? "M";
            Right = ConfigurationManager.AppSettings["Right"] ?? "R";

            VKeyLeft = ConfigurationManager.AppSettings["Left"] ?? "{LEFT}";
            VKeyMiddle = ConfigurationManager.AppSettings["Middle"] ?? " ";
            VKeyRight = ConfigurationManager.AppSettings["Right"] ?? "{RIGHT}";
            usbI = new USBInterface(VID, PID);

            savehandle = new EventHandler(HIDhandler);
            bool conn = usbI.Connect();
            if (conn)
            {
                usbI.enableUsbBufferEvent(savehandle);
                Thread.Sleep(5);
                usbI.startRead();

            }
            else
                Console.WriteLine("Cannot connect to device");

            Console.Read();
            if (conn)
            {
                usbI.stopRead();
                try
                {
                    usbI.Disconnect();
                }
                catch { }
            }
            System.Diagnostics.Process.GetCurrentProcess().Kill();
        }
Beispiel #12
0
 public Rocket(string vendorID, string productID, MoveMode moveMode = MoveMode.Continuous)
 {
     _vendorId = vendorID;
     _moveMode = moveMode;
     _device = new USBInterface(_vendorId, productID);
 }