private void SetGatherParam(Channe429Receive channelInfoUi)
        {
            ChannelGatherParamA429Rx gatherParamA429 = new ChannelGatherParamA429Rx();

            if (channelInfoUi.isFilter == true)    //过滤
            {
                gatherParamA429.gather_enable = 0;
            }
            else    //不过滤
            {
                gatherParamA429.gather_enable = 1;
            }
            if (channelInfoUi.receiveType == "队列")
            {
                gatherParamA429.recv_mode = RecvModeA429.BHT_L1_A429_RECV_MODE_LIST;
            }
            else
            {
                gatherParamA429.recv_mode = RecvModeA429.BHT_L1_A429_RECV_MODE_SAMPLE;
            }
            if (!string.IsNullOrEmpty(channelInfoUi.deepCount))
            {
                gatherParamA429.threshold_count = (ushort)Convert.ToInt32(channelInfoUi.deepCount);
            }
            if (!string.IsNullOrEmpty(channelInfoUi.timeCount))
            {
                gatherParamA429.threshold_time = (ushort)Convert.ToInt32(channelInfoUi.timeCount);
            }
            uint ret = ((Channel429DriverRx)(channelInfoUi.ChannelDriver)).ChannelGatherParam(ref gatherParamA429,
                                                                                              ParamOptionA429.BHT_L1_PARAM_OPT_SET);

            if (ret != 0)
            {
                RunningLog.Record(string.Format("return value is {0} when invoke ChannelGatherParam", ret));
            }
        }
Beispiel #2
0
        public void SaveSetting()
        {
            _deviceInfo.sendSet   = new List <SendSetting>();
            _deviceInfo.LoopSet   = new List <LoopTxSetting>();
            _deviceInfo.GatherSet = new List <GatherSetting>();
            _deviceInfo.devMsg    = new DeviceMessage();
            //_deviceInfo.FilterSet = new FilterSetting();
            //FilterSetting filterStr = new FilterSetting();
            //filterStr.filter = _device429.filterStr;
            DeviceMessage devMessage = new DeviceMessage();

            devMessage.BoardNo      = _device429.BoardNo;
            devMessage.BoardType    = _device429.BoardType;
            devMessage.ChannelCount = _device429.ChannelCount;
            devMessage.ChannelType  = _device429.ChannelType;
            devMessage.DevID        = _device429.DevID;
            devMessage.filter       = _device429.filterStr;
            _deviceInfo.devMsg      = devMessage;
            foreach (var item in _device429.SendComponents)
            {
                Channe429Send sendChanel = (Channe429Send)item;

                //赋值发送配置信息
                SendSetting sendSet = new SendSetting();
                sendSet.AliasName   = sendChanel.AliasName;
                sendSet.BaudRate    = sendChanel.BaudRate;
                sendSet.ChannelID   = sendChanel.ChannelID;
                sendSet.ChannelType = sendChanel.ChannelType;
                sendSet.Enabled     = sendChanel.Enabled;
                sendSet.labelInfos  = new List <LabelInfo>();
                for (int i = 0; i <= 377; i++)
                {
                    LabelInfo    label    = new LabelInfo();
                    SendLabel429 label429 = (SendLabel429)sendChanel.GetSpecificItem(i);
                    if (label429 != null)
                    {
                        label.Data        = label429.Data;
                        label.Label       = label429.Label;
                        label.Parity      = label429.Parity;
                        label.SDI         = label429.SDI;
                        label.SymbolState = label429.SymbolState;
                        sendSet.labelInfos.Add(label);
                    }
                }
                _deviceInfo.sendSet.Add(sendSet);//记录发送设置信息
            }
            //赋值接收配置信息
            _deviceInfo.RevSet = new List <ReceiveSetting>();
            //赋值接收配置信息
            foreach (var item in _device429.ReceiveComponents)
            {
                ReceiveSetting   RevSet    = new ReceiveSetting();
                Channe429Receive RevChanel = (Channe429Receive)item;
                RevSet.AliasName   = RevChanel.AliasName;
                RevSet.BaudRate    = RevChanel.BaudRate;
                RevSet.ChannelID   = RevChanel.ChannelID;
                RevSet.ChannelType = RevChanel.ChannelType;
                RevSet.Enabled     = RevChanel.Enabled;
                _deviceInfo.RevSet.Add(RevSet);

                GatherSetting            GatherSet       = new GatherSetting();
                ChannelGatherParamA429Rx gatherParamA429 = new ChannelGatherParamA429Rx();
                uint ret = ((Channel429DriverRx)(RevChanel.ChannelDriver)).ChannelGatherParam(ref gatherParamA429,
                                                                                              ParamOptionA429.BHT_L1_PARAM_OPT_GET);
                GatherSet.chanelID       = RevChanel.ChannelID;
                GatherSet.gatherType     = gatherParamA429.recv_mode;
                GatherSet.isFilter       = gatherParamA429.gather_enable;
                GatherSet.ThresholdCount = gatherParamA429.threshold_count;
                GatherSet.ThresholdTime  = gatherParamA429.threshold_time;
                _deviceInfo.GatherSet.Add(GatherSet);

                LoopTxSetting loopTxSetting = new LoopTxSetting();
                loopTxSetting.chanelID = RevChanel.ChannelID;
                loopTxSetting.IsLoop   = RevChanel.isLoop;
                _deviceInfo.LoopSet.Add(loopTxSetting);
            }
        }