示例#1
0
        /// <summary>
        /// Compares the current instance with another object of the same type.
        /// </summary>
        /// <param name="obj">An object to compare with this instance.</param>
        /// <returns>A 32-bit signed integer that indicates the relative order of the comparands.</returns>
        public virtual int CompareTo(object obj)
        {
            Device device = obj as Device;

            if (device == null)
            {
                throw new ArgumentException();
            }

            return(DeviceNumber.CompareTo(device.DeviceNumber));
        }
        internal byte[] GetRaiseSwitchData(SwitchStatus switchStatus)
        {
            var list = new List <byte>();

            list.AddRange("CC".HexStrToBytes(" ").ToList());
            list.AddRange("EE".HexStrToBytes(" ").ToList());
            list.Add(DeviceNumber.ToByte());
            list.Add(_switchNumber.ToByte());
            list.Add(switchStatus.ToInt32().ToByte());
            list.AddRange("3A".HexStrToBytes(" ").ToList());
            return(list.ToArray());
        }
示例#3
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 6, Configuration.FieldSeparator),
                       Id,
                       DeviceNumber?.ToDelimitedString(),
                       DeviceName,
                       LotNumber?.ToDelimitedString(),
                       ItemIdentifier?.ToDelimitedString(),
                       BarCode
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
示例#4
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 8, Configuration.FieldSeparator),
                       Id,
                       LotNumber?.ToDelimitedString(),
                       DeviceNumber?.ToDelimitedString(),
                       DeviceName,
                       DeviceDataState,
                       LoadStatus,
                       ControlCode.HasValue ? ControlCode.Value.ToString(Consts.NumericFormat, culture) : null,
                       OperatorName
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
 /// <summary>
 /// 是否设置产能
 /// </summary>
 /// <returns></returns>
 public bool IsSet()
 {
     return((!DeviceModel.IsNullOrEmpty() &&
             !DeviceNumber.IsNullOrEmpty() &&
             !DeviceSingle.IsNullOrEmpty() &&
             !DeviceRate.IsNullOrEmpty() &&
             !DeviceWorkTime.IsNullOrEmpty() &&
             !DeviceProductTime.IsNullOrEmpty() &&
             !DeviceSingleCount.IsNullOrEmpty()) ||
            (!OperatorLevel.IsNullOrEmpty() &&
             !OperatorNumber.IsNullOrEmpty() &&
             !OperatorSingle.IsNullOrEmpty() &&
             !OperatorRate.IsNullOrEmpty() &&
             !OperatorWorkTime.IsNullOrEmpty() &&
             !OperatorProductTime.IsNullOrEmpty() &&
             !OperatorSingleCount.IsNullOrEmpty()));
 }
示例#6
0
        public override byte[] GetSendData()
        {
            var deviceNumberHex   = DeviceNumber.ToHex();
            var commandParamsList = new List <object> {
                deviceNumberHex
            };
            var commandParams = GetReplaceCommandParams();

            if (commandParams != null)
            {
                commandParamsList.AddRange(commandParams);
            }
            var commandText = string.Format(SendCommand, commandParamsList.ToArray());
            var crc         = TLAutoBoardDeviceHelper.GetCRCFromHexs(commandText);
            var sendText    = commandText + " " + crc;

            return(TLAutoDeviceHelper.HexStringToByteArray(sendText));
        }
示例#7
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 9, Configuration.FieldSeparator),
                       Id,
                       NumberOfDecontaminationSterilizationDevices.HasValue ? NumberOfDecontaminationSterilizationDevices.Value.ToString(Consts.NumericFormat, culture) : null,
                       LaborCalculationType?.ToDelimitedString(),
                       DateFormat?.ToDelimitedString(),
                       DeviceNumber?.ToDelimitedString(),
                       DeviceName,
                       DeviceModelName,
                       DeviceType?.ToDelimitedString(),
                       LotControl?.ToDelimitedString()
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
        private void button_StartSearchDev_Click(object sender, EventArgs e)
        {
            int    DeviceNumber, paraInt;
            string DevID;

            DeviceNumber = ZLDM.StartSearchDev();

            this.dataGridView1.Rows.Clear();
            if (DeviceNumber > 0)
            {
                this.dataGridView1.Rows.Add(DeviceNumber);
            }

            for (int i = 0; i < DeviceNumber; i++)
            {
                //设备ID
                //DevID = ZLDM.GetDevID(0);//只能显示第一个设备
                DevID = ZLDM.GetDevID(i);
                this.dataGridView1.Rows[i].Cells[Index设备ID].Value = DevID;
                //类型
                paraInt = ZLDM.GetDevParamInt(DevID, ZLDM.PARAM_DEV_EXIST_IN_SUBNET);
                this.dataGridView1.Rows[i].Cells[Index类型].Value = Enum.Parse(typeof(ParamDevExitInSubnet), paraInt.ToString()).ToString();
                //设备名称
                this.dataGridView1.Rows[i].Cells[Index设备名称].Value = ZLDM.GetDevParamString(DevID, ZLDM.PARAM_DEV_NAME);
                //设备IP
                this.dataGridView1.Rows[i].Cells[Index设备IP].Value = ZLDM.GetDevParamString(DevID, ZLDM.PARAM_DEV_LOCAL_IP);
                //目的IP
                this.dataGridView1.Rows[i].Cells[Index目的IP].Value = ZLDM.GetDevParamString(DevID, ZLDM.PARAM_DEST_IP);
                //模式
                paraInt = ZLDM.GetDevParamInt(DevID, ZLDM.PARAM_WORK_MODE);
                this.dataGridView1.Rows[i].Cells[Index模式].Value = Enum.Parse(typeof(ParamWorkMode), paraInt.ToString()).ToString();
                //TCP连接状态
                paraInt = ZLDM.GetDevParamInt(DevID, ZLDM.PARAM_LINK_STATUS);
                this.dataGridView1.Rows[i].Cells[IndexTCP连接].Value = Enum.Parse(typeof(ParamLinkStatus), paraInt.ToString()).ToString();
            }


            this.toolStripStatusLabel1.Text = "搜索到" + DeviceNumber.ToString() + "个设备";
        }
示例#9
0
        public void WriteConfigFile(XmlTextWriter xmlWriter)
        {
            if (DeviceName.Length < 1)
            {
                DeviceName = "Settings " + DateTime.Now;
            }

            xmlWriter.WriteStartElement("CameraSettings");

            Settings.WriteElement(xmlWriter, "DeviceName", DeviceName);
            Settings.WriteElement(xmlWriter, "DeviceNumber", DeviceNumber.ToString());
            Settings.WriteElement(xmlWriter, "DeviceMode", DeviceMode.ToString());

            Settings.WriteElement(xmlWriter, "Brightness", Brightness.ToString());
            Settings.WriteElement(xmlWriter, "BrightnessAuto", BrightnessAuto.ToString());

            Settings.WriteElement(xmlWriter, "Contrast", Contrast.ToString());
            Settings.WriteElement(xmlWriter, "ContrastAuto", ContrastAuto.ToString());

            Settings.WriteElement(xmlWriter, "Saturation", Saturation.ToString());
            Settings.WriteElement(xmlWriter, "SaturationAuto", SaturationAuto.ToString());

            Settings.WriteElement(xmlWriter, "Sharpness", Sharpness.ToString());
            Settings.WriteElement(xmlWriter, "SharpnessAuto", SharpnessAuto.ToString());

            Settings.WriteElement(xmlWriter, "Zoom", Zoom.ToString());
            Settings.WriteElement(xmlWriter, "ZoomAuto", ZoomAuto.ToString());

            Settings.WriteElement(xmlWriter, "Focus", Focus.ToString());
            Settings.WriteElement(xmlWriter, "FocusAuto", FocusAuto.ToString());

            Settings.WriteElement(xmlWriter, "Exposure", Exposure.ToString());
            Settings.WriteElement(xmlWriter, "ExposureAuto", ExposureAuto.ToString());

            Settings.WriteElement(xmlWriter, "FlipImage", FlipImage.ToString());

            xmlWriter.WriteEndElement();
        }
示例#10
0
文件: Rs232.cs 项目: paulyao46/Piano
    public void OpenComport(DeviceNumber p_deviceNumber, BaudRate p_baudrate, parity_mode p_parity, data_bits p_dataBits, stop_bits p_stopBits)
    {
        try {
            deviceNumber  = p_deviceNumber;
            receiveBuffer = new byte[receiveBufferSize];

            RS232_SetAttributes(p_parity, p_dataBits, p_stopBits);
            int _errorCode = RS232_OpenComport((int)p_deviceNumber, (int)p_baudrate);
            if (_errorCode == 0)
            {
                comportThread = new Thread(RunThread);
                comportThread.IsBackground = true;
                running = true;
                comportThread.Start();
            }
            else
            {
                throw new Exception("OpenComport Failed, Error Code : " + _errorCode);
            }
        } catch (System.Exception ex) {
            errorlogStr = "[Error] : " + ex.ToString() + "\n";
            Debug.LogError(errorlogStr);
        }
    }
示例#11
0
 public override string ToString()
 {
     return($"AdapterIndex={AdapterIndex.ToString()},BusNumber={BusNumber.ToString()},DeviceNumber={DeviceNumber.ToString()},AdapterName={AdapterName}");
 }