Beispiel #1
0
 public CUsb(uint nVendor, uint nProductID, uint nReadBuffer, uint nWriteBuffer)
 {
     this.hUsb                = 0U;
     this.hUsb                = CUsb.USBOpen(this.hUsb, nVendor, nProductID, nReadBuffer, nWriteBuffer, (CUsb.UsbEventHandler)null);
     this.eventTimer          = new Timer();
     this.eventTimer.Interval = 50;
     this.eventTimer.Enabled  = true;
     this.eventTimer.Tick    += new EventHandler(this.eventTimer_Tick);
 }
Beispiel #2
0
 public usb_access(string DataPath)
 {
     this._job            = 0;
     this._exitfg         = false;
     this._locksuccess    = false;
     this._DataPath       = DataPath;
     this.UsbObj          = new CUsb(4400U, 26625U, 1024U, 1024U);
     this.usb_timer       = new System.Windows.Forms.Timer();
     this.usb_timer.Tick += new EventHandler(this.usb_timer_Tick);
 }
Beispiel #3
0
 public CUsb(uint nVendor, uint nProductID, uint nReadBuffer, uint nWriteBuffer, int option)
 {
     this.hUsb = 0U;
     if (option == 0)
     {
         this.hUsb                = CUsb.USBOpen(this.hUsb, nVendor, nProductID, nReadBuffer, nWriteBuffer, (CUsb.UsbEventHandler)null);
         this.eventTimer          = new Timer();
         this.eventTimer.Interval = 50;
         this.eventTimer.Enabled  = true;
         this.eventTimer.Tick    += new EventHandler(this.eventTimer_Tick);
     }
     else
     {
         CUsb.UsbEventHandler USBProc = new CUsb.UsbEventHandler(this._UsbEvent);
         this.hUsb = CUsb.USBOpen(this.hUsb, nVendor, nProductID, nReadBuffer, nWriteBuffer, USBProc);
     }
 }
Beispiel #4
0
 public uint Read(byte[] Buffer, uint nNumByte)
 {
     return(CUsb.USBRead(this.hUsb, Buffer, nNumByte));
 }
Beispiel #5
0
 public uint Send(byte[] Buffer, uint nNumByte)
 {
     return(CUsb.USBWrite(this.hUsb, Buffer, nNumByte, 0U));
 }