예제 #1
0
        private void headsetEventCatcher(object sender, EventArgs e)
        {
            USBHIDDRIVER.List.ListWithEvent a = USBHIDDRIVER.USBInterface.usbBuffer;

            byte[] eve = (byte[])USBHIDDRIVER.USBInterface.usbBuffer[0];
            USBHIDDRIVER.USBInterface.usbBuffer.RemoveAt(0);

            usbOut = "";
            foreach (byte v in eve)
            {
                usbOut += v;
            }
        }
예제 #2
0
        private void Accuchek_ReceivedData(object sender, EventArgs e)
        {
            Console.WriteLine("Received");

            USBHIDDRIVER.List.ListWithEvent list = (USBHIDDRIVER.List.ListWithEvent)sender;

            foreach (Byte [] b in list)
            {
                for (int i = 0; i < b.Length; i++)
                {
                    Console.Write(b[i].ToString("x").ToUpper());
                }
            }//foreach

            if (commandindex < commands.Count)
            {
                ((USBHIDDRIVER.List.ListWithEvent)sender).Clear();
                Send_AccuChek_Command(commands[commandindex++]);
            }//if
        }
예제 #3
0
 public static void handler(object sender, System.EventArgs e)
 {
     USBHIDDRIVER.List.ListWithEvent ev = (USBHIDDRIVER.List.ListWithEvent)sender;
     foreach (object o in ev)
     {
         if (o is byte[])
         {
             byte[] data = (byte[])o;
             string s    = "";
             for (int i = 0; i < data.Length; i++)
             {
                 s += data[i];
                 if (i + 1 < data.Length)
                 {
                     s += ", ";
                 }
             }
             Console.WriteLine("{" + s + "}");
         }
     }
     ev.Clear();
 }
예제 #4
0
        static void HIDhandler(object sender, System.EventArgs e)
        {
            USBHIDDRIVER.List.ListWithEvent ev = (USBHIDDRIVER.List.ListWithEvent)sender;
            foreach (object o in ev)
            {
                if (o is byte[])
                {
                    byte[] data = (byte[])o;
                    byte   stat = data[1];
                    if (FCstatus != FCPedal.Invalid)
                    {
                        if ((((byte)FCPedal.Left) & stat) != 0)
                        {
                            if ((byte)(FCPedal.Left & FCstatus) == 0) //down event
                            {
                                Bleft = true;
                                Console.WriteLine("+" + Left);
                                if (VirtualKeys)
                                {
                                    System.Windows.Forms.SendKeys.SendWait(VKeyLeft);
                                }
                            }
                        }
                        else if (Bleft)
                        {
                            Bleft = false;
                            Console.WriteLine("-" + Left);
                        }

                        if ((((byte)FCPedal.Middle) & stat) != 0)
                        {
                            if ((byte)(FCPedal.Middle & FCstatus) == 0) //down event
                            {
                                Bmiddle = true;
                                Console.WriteLine("+" + Middle);
                                if (VirtualKeys)
                                {
                                    System.Windows.Forms.SendKeys.SendWait(VKeyMiddle);
                                }
                            }
                        }
                        else if (Bmiddle)
                        {
                            Bmiddle = false;
                            Console.WriteLine("-" + Middle);
                        }

                        if ((((byte)FCPedal.Right) & stat) != 0)
                        {
                            if ((byte)(FCPedal.Right & FCstatus) == 0) //down event
                            {
                                Bright = true;
                                Console.WriteLine("+" + Right);
                                if (VirtualKeys)
                                {
                                    System.Windows.Forms.SendKeys.SendWait(VKeyRight);
                                }
                            }
                        }
                        else if (Bright)
                        {
                            Bright = false;
                            Console.WriteLine("-" + Right);
                        }
                    }

                    FCstatus = (FCPedal)stat;
                }
            }
            ev.Clear();
        }