예제 #1
0
        private void btnOpenUSBInterface_Click(object sender, EventArgs e)
        {
            if (bWithHardware)
            {
                if (USBInterface.Open(cboSelectUSBInterface.Text))
                {
                    lblStatus.Text      = "USB-Interface opened! Success!";
                    lblStatus.BackColor = Color.Green;

                    lblVoltage.BackColor              = Color.Green;
                    lblDistance.BackColor             = Color.Green;
                    USBInterface.DigitalOutLine[2, 0] = true;
                    //Start Samplingtimer
                    tmrSampling.Start();
                }
                else
                {
                    lblStatus.Text      = "USB-Interface open failed! Lockekopf Raus, Tanktop rein! Error!";
                    lblStatus.BackColor = Color.Red;
                }
            }
            else // No hardware -> simulation
            {
                lblStatus.Text      = "USB-Interface simulated";
                lblStatus.BackColor = Color.Orange;

                lblVoltage.BackColor  = Color.Orange;
                lblDistance.BackColor = Color.Orange;

                //Start Samplingtimer for simulation
                tmrSampling.Start();
            }
        }
예제 #2
0
        private void btnOpenUSBInterface_Click(object sender, EventArgs e)
        {
            if (bWithHardware)
            {
                if (USBInterface.Open(cboSelectUSBInterface.Text))
                {
                    lblStatus.Text      = "USB-Interface opened";
                    lblStatus.BackColor = Color.Green;

                    // Abtasttimer starten
                    tmrSampling.Start();
                }
                else
                {
                    lblStatus.Text      = "USB-Interface open failed";
                    lblStatus.BackColor = Color.Red;
                }
            }
            else // without hardware
            {
                lblStatus.Text      = "USB-Interface simulated";
                lblStatus.BackColor = Color.Orange;

                // Abtasttimer starten
                tmrSampling.Start();
            }
        }
예제 #3
0
파일: BT200C60.cs 프로젝트: gitllama/Tips
        /*状態*/



        /*機能*/


        /* -------------------- */


        protected override bool _Reset()
        {
            if (Status == StatusEnum.Close)
            {
                USBIF = USBinterfaceExtensions200C.CreateUSB();

                if (!USBIF.Open())
                {
                    throw new IOException("can't open device");                             //オープン・初期化動作
                }
                if (!USBIF.isUSB3())
                {
                    System.Windows.MessageBox.Show("connected USB 2.0");                    //USB3.0の確認
                }
                if (!USBIF.Reset())
                {
                    throw new IOException("can't reset device"); //USBのリセット動作
                }
                rw.data = USBIF.CISReg;                          //<-!!!意味がないというかただの配列サイズ初期化
                ResetGain();                                     //ここでいい?

                ResetIris();

                /****/

                //サイズの初期化

                USBIFSTATUS sTATUS;
                uint        ysize = 0u;
                uint        xsize = 0u;

                sTATUS = USBIF.ReadReg(10u, ref xsize, 0u);
                Width  = (int)(sTATUS != USBIFSTATUS.E_OK ? 2256u : xsize * 2u);
                sTATUS = USBIF.ReadReg(3u, ref ysize, 0u);
                Height = (int)(sTATUS != USBIFSTATUS.E_OK ? 1178u : ysize * 2u);

                Size        = Width * Height;
                RX_BUF_SIZE = btc_GetImageSize();

                img_io2uint = new uint[RX_BUF_SIZE];
            }
            else if (Status == StatusEnum.Run)
            {
                Stop();
                if (!USBIF.Open())
                {
                    return(false);
                }
            }
            else
            {
                //初期化動作
                if (!USBIF.Open())
                {
                    return(false);
                }
            }


            return(true);
        }