예제 #1
0
        public override void BuildModule()
        {
            uint devID = ((IDeviceInfo)Owner).DevID;

            ChannelDriver = new Channel429DriverRx(devID, ChannelID);

            object baudRateValue = App.Instance.ConfigManager.GetParameter(this.Path + "_BaudRate");

            if (baudRateValue != null)
            {
                BaudRate = (int)baudRateValue;
            }
            rxpA429Result = new RxpA429()
            {
                timestamp = 0,
                data      = 0
            };
            DataProcessModule = new DataProcessModule(this);
            SummaryModule     = new SummaryModule(this);
            FilterModule      = new FilterModule(this);
            GetGatherParam();
        }
예제 #2
0
        public void Receive()
        {
            if (Enabled == false || isSend == false)
            {
                return;
            }
            rxpA429Result.data = 0;
            Channel429DriverRx driverRx = (Channel429DriverRx)ChannelDriver;
            RxpA429            rxpA429  = new RxpA429();
            uint           maxRxp       = 1;
            int            rxpNum;
            WaitStatusA429 opt = WaitStatusA429.BHT_L1_OPT_NOWAIT;
            uint           ret = driverRx.ChannelRecvRx(out rxpA429, maxRxp, out rxpNum, opt);//这里设置为存储一个数据,那么可以操作的data只有一个

            if (ret != 0)
            {
                errCount++;
                RunningLog.Record(string.Format("return value is {0} when receive data", ret));
            }
            else if (rxpNum > 0 && ret == 0)
            {
                count++;
                rxpA429Result = rxpA429;//这里将out的数据保存到类中
                FileHelper.WriteLogForReceive(Convert.ToString(rxpA429.data, 2));
            }
            MibDataA429 mibDataA429;

            ret = driverRx.ChannelMibGetRx(out mibDataA429);
            if (ret != 0)
            {
                RunningLog.Record(string.Format("return value is {0} when ChannelMibGetRx data", ret));
            }
            DeviceCount    = mibDataA429.cnt;
            errDeviceCount = mibDataA429.err_cnt;
            if (IsFileSaveAllow)//如果允许保存文件,那么就执行这一步操作
            {
                DataProcessModule.Save(rxpA429, rxpNum);
            }
        }