Beispiel #1
0
        static void Run()
        {
            USBHIDDRIVER.USBInterface usb = new USBInterface("vid_11fa", "pid_0202");

            usb.Connect();

            usb.enableUsbBufferEvent(new System.EventHandler(MyEventCacher));

            usb.startRead();

            Console.Write("Press CTRL+C To Quit" + Environment.NewLine);
            Console.CancelKeyPress += (sender, eArgs) =>
            {
                _quitEvent.Set();
                eArgs.Cancel = true;
            };

            _quitEvent.WaitOne();

            usb.stopRead();

            while (true)
            {
                System.Threading.Thread.Sleep(1000);
            }
        }
        public InputSourceBaanto()
        {
            USBInterface usb = new USBInterface("vid_2453", "pid_0100");

            usb.Connect();
            usb.enableUsbBufferEvent(incomingData);
            usb.startRead();
        }
Beispiel #3
0
        public void Start()
        {
            device = new USBInterface("vid_1244", "pid_d237");

            if (!device.Connect())
            {
                throw new Exception("Victor 70C Multimeter cannot be found");
            }

            device.enableUsbBufferEvent(new System.EventHandler(myEventCacher));

            Thread.Sleep(5);
            device.startRead();
        }
Beispiel #4
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 #5
0
        public MainWindow()
        {
            InitializeComponent();
            IDuplexTypedMessagesFactory aTypedMessagesFactory = new DuplexTypedMessagesFactory();

            mySender = aTypedMessagesFactory.CreateDuplexTypedMessageSender <MyResponse, MyRequest>();
            mySender.ResponseReceived += OnResponseReceived;

            // Create messaging based on TCP.
            IMessagingSystemFactory aMessagingSystemFactory = new TcpMessagingSystemFactory();
            IDuplexOutputChannel    anOutputChannel         = aMessagingSystemFactory.CreateDuplexOutputChannel("tcp://192.168.2.9:8060/");

            // Attach output channel and be able to send messages and receive response messages.
            mySender.AttachDuplexOutputChannel(anOutputChannel);
            MyRequest test = new MyRequest {
                side = "L", strength = 10
            };

            mySender.SendRequestMessage(test);
            MyRequest reset = new MyRequest {
                side = "L", strength = 0
            };

            mySender.SendRequestMessage(reset);
            try
            {
                USBInterface usb = new USBInterface("vid_044f", "pid_b108");
                usb.Connect();
                usb.enableUsbBufferEvent(new System.EventHandler(myEventCacher));
                usb.startRead();

                Console.ReadLine();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }