Exemplo n.º 1
0
        public void Send()
        {
            if (Enabled == false || isSend == false)
            {
                return;
            }

            foreach (var item in ChildComponents)
            {
                SendLabel429 label429 = item as SendLabel429;
                if (!label429.IsSelected)
                {
                    return;
                }
                if (label429 != null)
                {
                    currentLabel = label429;
                    Channel429DriverTx driverTx = (Channel429DriverTx)ChannelDriver;
                    uint ret = 0;
                    if (!label429.isAutoIncrement)
                    {
                        ret = driverTx.ChannelSendTx((uint)label429.ActualValue, SendOptA429.BHT_L1_A429_OPT_RANDOM_SEND);
                    }
                    else
                    {
                        label429.ActualValue += 1;
                        ret = driverTx.ChannelSendTx((uint)label429.ActualValue, SendOptA429.BHT_L1_A429_OPT_RANDOM_SEND);
                    }
                    if (ret != 0)
                    {
                        RunningLog.Record(string.Format("return value is {0} when invoke ChannelSendTx", ret));
                        errCount++;
                    }
                    else
                    {
                        labelCount++;
                        FileHelper.WriteLogForSend(Convert.ToString(label429.ActualValue, 2));
                    }
                    MibDataA429 mibDataA429;
                    ret = driverTx.ChannelMibGetTx(out mibDataA429);

                    if (ret != 0)
                    {
                        RunningLog.Record(string.Format("return value is {0} when invoke ChannelMibGetTx", ret));
                        errCount++;
                    }
                    DeviceCount    = mibDataA429.cnt;
                    errDeviceCount = mibDataA429.err_cnt;
                }
            }
        }
Exemplo n.º 2
0
        public override void BuildModule()
        {
            uint devID = ((IDeviceInfo)Owner).DevID;
            Channel429DriverTx driverTx = new Channel429DriverTx(devID, ChannelID);

            ChannelDriver = driverTx;

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

            if (baudRateValue != null)
            {
                BaudRate = (int)baudRateValue;
            }

            uint ret = driverTx.ChannelLoopTx(AbleStatusA429.BHT_L1_OPT_ENABLE);

            LoopEnable = true;
            if (ret != 0)
            {
                RunningLog.Record(string.Format("return value is {0} when invoke ChannelLoopTx", ret));
            }
        }