private int _IM_BeAlignmentConnect()
        {
            byte[] buf = new byte[5];
            int    devAddr;

            if ((tbBeAlignmentPassword123.Text.Length == 0) ||
                (tbBeAlignmentPassword124.Text.Length == 0) ||
                (tbBeAlignmentPassword125.Text.Length == 0) ||
                (tbBeAlignmentPassword126.Text.Length == 0))
            {
                MessageBox.Show("Before connect need input 4 int password!!");
                return(-1);
            }

            if (imBeAlignment.ConnectApi(100) < 0)
            {
                return(-1);
            }

            imBeAlignment.SetTimeoutApi(50);

            if (imBeAlignment.connected == false)
            {
                cbBeAlignmentConnected.Checked = false;
                return(-1);
            }

            buf[0] = Convert.ToByte(tbBeAlignmentPassword123.Text);
            buf[1] = Convert.ToByte(tbBeAlignmentPassword124.Text);
            buf[2] = Convert.ToByte(tbBeAlignmentPassword125.Text);
            buf[3] = Convert.ToByte(tbBeAlignmentPassword126.Text);
            buf[4] = 8;

            devAddr = ucLensAlignment.GetBeAlignmentDeviceAddrApi();
            if (devAddr < 0)
            {
                goto Disconnect;
            }

            if (_IM_BeAlignmentWrite((byte)devAddr, 123, 5, buf) < 0)
            {
                goto Disconnect;
            }

            cbBeAlignmentConnected.Checked = true;

            //if (cbLightSourceConnected.Checked == true)
            cbStartMonitor.Enabled = true;

            return(0);

Disconnect:
            _IM_BeAlignmentDisconnect();
            return(-1);
        }
Пример #2
0
        private int _QsfpI2cConnect()
        {
            if (qsfpI2cMaster.ConnectApi(100) < 0)
            {
                return(-1);
            }

            qsfpI2cMaster.SetTimeoutApi(50);

            cbI2cAdapterConnected.Checked = true;

            return(0);
        }
        private int _RssiMeasureI2cConnect()
        {
            if (rssiMeasureI2cAdapter.ConnectApi(100) < 0)
            {
                return(-1);
            }

            if (rssiMeasureI2cAdapter.connected == true)
            {
                rssiMeasureI2cAdapter.SetTimeoutApi(50);
                cbRssiMeasureI2cConnected.Checked = true;
            }
            else
            {
                cbRssiMeasureI2cConnected.Checked = false;
            }

            return(0);
        }
        private int _LightSourceI2cConnect()
        {
            if (lightSourceI2cAdapter.ConnectApi(100) < 0)
            {
                return(-1);
            }

            if (lightSourceI2cAdapter.connected == true)
            {
                lightSourceI2cAdapter.SetTimeoutApi(50);
                cbLightSourceI2cConnected.Checked = true;
            }
            else
            {
                cbLightSourceI2cConnected.Checked = false;
            }

            return(0);
        }
Пример #5
0
        private int _PowerMeterQsfpI2cConnect()
        {
            if (powerMeterQsfpI2cAdapter.ConnectApi(100) < 0)
            {
                return(-1);
            }

            if (powerMeterQsfpI2cAdapter.connected == true)
            {
                powerMeterQsfpI2cAdapter.SetTimeoutApi(50);
                cbPowerMeterQsfpConnected.Checked = true;
            }
            else
            {
                cbMeasuredObjectI2cAdapterConnected.Checked = false;
            }

            return(0);
        }
        private int _IM_LightSourceConnect()
        {
            if (imLightSoutce.ConnectApi(100) < 0)
            {
                return(-1);
            }

            imLightSoutce.SetTimeoutApi(50);

            if (imLightSoutce.connected == false)
            {
                cbLightSourceConnected.Checked = false;
                return(-1);
            }

            cbLightSourceConnected.Checked = true;

            if (cbBeAlignmentConnected.Checked == true)
            {
                cbStartMonitor.Enabled = true;
            }

            return(0);
        }