private int _SetQsfpMode(byte mode)
        {
            byte[] data = new byte[] { 0xaa };

            if (i2cMaster.WriteApi(80, 127, 1, data) < 0)
            {
                return(-1);
            }

            data[0] = mode;

            if (i2cMaster.WriteApi(80, 164, 1, data) < 0)
            {
                return(-1);
            }

            return(0);
        }
Пример #2
0
        private int _I2cWrite(byte devAddr, byte regAddr, byte length, byte[] data)
        {
            byte[] passwd;
            int    rv;

            if (i2cMaster.connected == false)
            {
                if (_I2cMasterConnect() < 0)
                {
                    return(-1);
                }
            }

            if (tbPassword.Text.Length != 4)
            {
                tbPassword.Text = "";
                MessageBox.Show("Before modify value need input 4 char password!!");
                return(-1);
            }

            passwd = Encoding.Default.GetBytes(tbPassword.Text);

            if (i2cMaster.WriteApi(80, 123, 4, passwd) < 0)
            {
                return(-1);
            }

            rv = i2cMaster.WriteApi(devAddr, regAddr, length, data);
            if (rv < 0)
            {
                MessageBox.Show("QSFP+ module no response!!");
                _I2cMasterDisconnect();
            }

            return(rv);
        }
Пример #3
0
        private int _MeasuredObjectI2cWrite(byte devAddr, byte regAddr, byte length, byte[] data)
        {
            int rv;

            if (measuredObjectI2cAdapter.connected == false)
            {
                return(0);
            }

            rv = measuredObjectI2cAdapter.WriteApi(devAddr, regAddr, length, data);
            if (rv < 0)
            {
                MessageBox.Show("QSFP+ module no response!!");
                return(-1);
            }

            return(rv);
        }
Пример #4
0
        private int _PowerMeterQsfpI2cWrite(byte devAddr, byte regAddr, byte length, byte[] data)
        {
            int rv;

            if (powerMeterQsfpI2cAdapter.connected == false)
            {
                return(0);
            }

            rv = powerMeterQsfpI2cAdapter.WriteApi(devAddr, regAddr, length, data);
            if (rv < 0)
            {
                MessageBox.Show("Power Meter QSFP module no response!!");
                return(-1);
            }

            return(rv);
        }
        private int _IM_LightSourceWrite(byte devAddr, byte regAddr, byte length, byte[] data)
        {
            int rv;

            if (imLightSoutce.connected == false)
            {
                if (_IM_LightSourceConnect() < 0)
                {
                    return(-1);
                }
            }

            rv = imLightSoutce.WriteApi(devAddr, regAddr, length, data);
            if (rv < 0)
            {
                MessageBox.Show("QSFP+ module no response!!");
                _IM_LightSourceDisconnect();
            }

            return(rv);
        }
        private int _IM_BeAlignmentWrite(byte devAddr, byte regAddr, byte length, byte[] data)
        {
            int rv;

            if (imBeAlignment.connected == false)
            {
                if (_IM_BeAlignmentConnect() < 0)
                {
                    return(-1);
                }
            }

            rv = imBeAlignment.WriteApi(devAddr, regAddr, length, data);
            if (rv < 0)
            {
                MessageBox.Show("QSFP+ module no response!!");
                _IM_BeAlignmentDisconnect();
            }

            return(rv);
        }
Пример #7
0
        private int _I2cWrite(byte devAddr, byte regAddr, byte length, byte[] data)
        {
            int rv;

            if (i2cMaster.connected == false)
            {
                if (_I2cMasterConnect() < 0)
                {
                    return(-1);
                }
            }

            rv = i2cMaster.WriteApi(devAddr, regAddr, length, data);
            if (rv < 0)
            {
                MessageBox.Show("QSFP+ module no response!!");
                _I2cMasterDisconnect();
            }

            return(rv);
        }
        private int _LightSourceI2cWrite(byte devAddr, byte regAddr, byte length, byte[] data)
        {
            int rv;

            if (lightSourceI2cAdapter.connected == false)
            {
                if (_LightSourceI2cConnect() < 0)
                {
                    return(-1);
                }
            }

            rv = lightSourceI2cAdapter.WriteApi(devAddr, regAddr, length, data);
            if (rv < 0)
            {
                MessageBox.Show("Light Source module no response!!");
                return(-1);
            }

            return(rv);
        }
        private int _RssiMeasureI2cWrite(byte devAddr, byte regAddr, byte length, byte[] data)
        {
            int rv;

            if (rssiMeasureI2cAdapter.connected == false)
            {
                if (_RssiMeasureI2cConnect() < 0)
                {
                    return(-1);
                }
            }

            rv = rssiMeasureI2cAdapter.WriteApi(devAddr, regAddr, length, data);
            if (rv < 0)
            {
                MessageBox.Show("RSSI Measure module no response!!");
                return(-1);
            }

            return(rv);
        }