public void UpdataDevice(Device429 device429) { for (int i = 0; i < 16; i++) { Channe429Send channel = (Channe429Send)device429.GetSpecificItem(i + 16);//注意这里 ChannelInfoUiSend channelInfoUi = _channels[i]; channel.AliasName = channelInfoUi.Name; if (channelInfoUi.Parity == BaudRate.偶校验.ToString()) { channel.Parity = 1; } else if (channelInfoUi.Parity == BaudRate.奇校验.ToString()) { channel.Parity = 0; } else { channel.Parity = 2; } channel.BaudRate = channelInfoUi.BaudRate; channel.LoopEnable = channelInfoUi.LoopEnable; channel.Enabled = channelInfoUi.Enabled; ChannelParamA429 paramA429 = new ChannelParamA429() { work_mode = ChannelWorkModeA429.A429ChannelWorkModeNABLE }; if (channel.Parity == 0) { paramA429.par = ParityA429.BHT_L1_A429_PARITY_ODD; } else if (channel.Parity == 1) { paramA429.par = ParityA429.BHT_L1_A429_PARITY_EVEN; } else { paramA429.par = ParityA429.BHT_L1_A429_PARITY_NONE; } if (channelInfoUi.BaudRate == 12500) { paramA429.baud = BaudA429.BHT_L1_A429_BAUD_12_5K; } else if (channelInfoUi.BaudRate == 50000) { paramA429.baud = BaudA429.BHT_L1_A429_BAUD_50K; } else if (channelInfoUi.BaudRate == 100000) { paramA429.baud = BaudA429.BHT_L1_A429_BAUD_100K; } uint ret = ((Channel429DriverTx)(channel.ChannelDriver)).ChannelParamTx(ref paramA429, ParamOptionA429.BHT_L1_PARAM_OPT_SET); if (ret != 0) { RunningLog.Record(string.Format("return value is {0} when invoke ChannelParamRx", ret)); } if (channel.LoopEnable) { Channel429DriverTx driverTx = new Channel429DriverTx(device429.DevID, channel.ChannelID); ret = driverTx.ChannelLoopTx(AbleStatusA429.BHT_L1_OPT_ENABLE); } else { Channel429DriverTx driverTx = new Channel429DriverTx(device429.DevID, channel.ChannelID); ret = driverTx.ChannelLoopTx(AbleStatusA429.BHT_L1_OPT_DISABLE); } } }
public void UpdataDevice(Device429 device429) { for (int i = 0; i < 16; i++) { Channe429Receive channel = (Channe429Receive)device429.GetSpecificItem(i); ChannelInfoUiReceive channelInfoUi = _channels[i]; channel.AliasName = channelInfoUi.Name; if (channelInfoUi.Parity == BaudRate.偶校验.ToString()) { channel.Parity = 1; } else if (channelInfoUi.Parity == BaudRate.奇校验.ToString()) { channel.Parity = 0; } else { channel.Parity = 2; } channel.Enabled = channelInfoUi.Enabled; channel.BaudRate = channelInfoUi.BaudRate; channel.isFilter = channelInfoUi.IsFilter; channel.receiveType = channelInfoUi.ReceiveType; channel.deepCount = channelInfoUi.DeepCount; channel.timeCount = channelInfoUi.TimeCount; ChannelParamA429 paramA429 = new ChannelParamA429() { work_mode = ChannelWorkModeA429.A429ChannelWorkModeNABLE }; if (channel.Parity == 0) { paramA429.par = ParityA429.BHT_L1_A429_PARITY_ODD; } else if (channel.Parity == 1) { paramA429.par = ParityA429.BHT_L1_A429_PARITY_EVEN; } else { paramA429.par = ParityA429.BHT_L1_A429_PARITY_NONE; } if (channelInfoUi.BaudRate == 12500) { paramA429.baud = BaudA429.BHT_L1_A429_BAUD_12_5K; } else if (channelInfoUi.BaudRate == 50000) { paramA429.baud = BaudA429.BHT_L1_A429_BAUD_50K; } else if (channelInfoUi.BaudRate == 100000) { paramA429.baud = BaudA429.BHT_L1_A429_BAUD_100K; } uint ret = ((Channel429DriverRx)(channel.ChannelDriver)).ChannelParamRx(ref paramA429, ParamOptionA429.BHT_L1_PARAM_OPT_SET); if (ret != 0) { RunningLog.Record(string.Format("return value is {0} when invoke ChannelParamRx", ret)); } SetGatherParam(channel); } }