コード例 #1
0
ファイル: CEtherCATDI6022.cs プロジェクト: jajanuj/GitTest
        private void slaveModuleInitialize()
        {
            bool getSlave = false;

            foreach (var item in SlaveInfos)
            {
                SlaveInfo slaveInfo = item.Value;
                if ((dIOPara.CardNo == slaveInfo.CardNo) && (dIOPara.NodeNo == slaveInfo.NodeID))
                {
                    if (/*slaveInfo.VendorID == 0x1A05 && */ slaveInfo.ProductCode == 0x6002) //R1-EC6002 16-ch Sink/Source Type Digital Input Module with 2ms Filter Function
                    {
                        getSlave = true;
                        break;
                    }
                    if (/*slaveInfo.VendorID == 0x1A05 && */ slaveInfo.ProductCode == 0x6022) //R1-EC6022 16-ch Sink/Source Type Digital Input Module with 2ms Filter Function
                    {
                        getSlave = true;
                        break;
                    }
                }
            }
            if (!getSlave)
            {
                throw new NotImplementedException(string.Format("EtherCAT can't find slave [{0}] from Card No {1} Node No {2}. There have {3} SlaveInfos.", this.DeviceName, dIOPara.CardNo, dIOPara.NodeNo, SlaveInfos.Count));
            }
        }
コード例 #2
0
    private void HandleOnConnectedToMaster(NetworkClient nc)
    {
        NetworkServer.Listen(40000);
        NetworkServer.RegisterHandler((short)CustomMessageTypes.InstanceInitialize, x => { HandleInstanceInitialization(x); });
        NetworkServer.RegisterHandler(MsgType.Disconnect, x =>
        {
            var p = runningInstances.FirstOrDefault(y => y.Value.connectionId == x.conn.connectionId);
            //Since FirstOrDefault doesn't throw, We should make sure if it found the value
            if (p.Value.connectionId == x.conn.connectionId)
            {
                runningInstances.Remove(p.Key);
                InitializedInstances.Remove(p.Key);
            }
        });

        //Send slave info to master.
        SlaveInfo info = new SlaveInfo();

        info.ipAddress = config.IPAddress;
        info.gameNames = new string[config.instances.Length];
        for (int i = 0; i < info.gameNames.Length; ++i)
        {
            info.gameNames[i] = config.instances[i].gameName;
        }
        nc.Send((short)CustomMessageTypes.InstanceSlaveConnectRequest, info);
    }
コード例 #3
0
        public static SlaveInfo RescanDevices(EcSettings settings, SlaveInfo referenceRootSlave)
        {
            var referenceSlaves = default(IEnumerable <SlaveInfo>);

            if (referenceRootSlave != null)
            {
                referenceSlaves = referenceRootSlave.Descendants().ToList();
            }

            var newRootSlave = EcUtilities.ScanDevices(settings.InterfaceName, referenceRootSlave);

            newRootSlave.Descendants().ToList().ForEach(slave =>
            {
                var referenceSlave = slave.Csa == slave.OldCsa
                    ? referenceSlaves?.FirstOrDefault(x => x.Csa == slave.Csa)
                    : null;

                if (referenceSlave != null)
                {
                    slave.Extensions = referenceSlave.Extensions;
                }

                EcUtilities.CreateDynamicData(settings.EsiDirectoryPath, slave);
            });

            return(newRootSlave);
        }
コード例 #4
0
ファイル: EcUtilities.cs プロジェクト: Bit2Bi/EtherCAT.NET
        /// <summary>
        /// Initializes EtherCAT and returns found slaves.
        /// </summary>
        /// <param name="interfaceName">The name of the network adapter.</param>
        /// <returns>Returns found slave.</returns>
        public static SlaveInfo ScanDevices(IntPtr context, string interfaceName, SlaveInfo referenceSlave = null)
        {
            ec_slave_info_t[] refSlaveIdentifications = null;

            if (referenceSlave != null)
            {
                refSlaveIdentifications = EcUtilities.ToSlaveIdentifications(referenceSlave);
            }
            else
            {
                refSlaveIdentifications = new ec_slave_info_t[] { }
            };

            // scan devices
            var networkInterface = NetworkInterface
                                   .GetAllNetworkInterfaces()
                                   .Where(nic => nic.Name == interfaceName)
                                   .FirstOrDefault();

            if (networkInterface == null)
            {
                throw new Exception($"{ ErrorMessage.SoemWrapper_NetworkInterfaceNotFound } Interface name: '{ interfaceName }'.");
            }

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                interfaceName = $@"rpcap://\Device\NPF_{networkInterface.Id}";
            }

            else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ||
                     RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                interfaceName = $"{interfaceName}";
            }

            else
            {
                throw new PlatformNotSupportedException();
            }

            EcUtilities.CheckErrorCode(context, EcHL.ScanDevices(context, interfaceName, out var slaveIdentifications, out var slaveCount));

            // create slaveInfo from received data
            var offset = 0;
            var newSlaveIdentifications = new ec_slave_info_t[slaveCount + 1]; // correct because EC master = slaveIdentifications[0]

            for (int i = 0; i <= newSlaveIdentifications.Count() - 1; i++)
            {
                newSlaveIdentifications[i] = Marshal.PtrToStructure <ec_slave_info_t>(IntPtr.Add(slaveIdentifications, offset));
                offset += Marshal.SizeOf(typeof(ec_slave_info_t));
            }

            // validate CSA
            while (EcUtilities.EnsureValidCsa(context, newSlaveIdentifications, refSlaveIdentifications))
            {
                //
            }

            return(EcUtilities.ToSlaveInfo(newSlaveIdentifications));
        }
コード例 #5
0
        private static ec_slave_info_t[] ToSlaveIdentifications(SlaveInfo slave)
        {
            var slaveIdentifications = slave.Descendants().ToList().Select(x => new ec_slave_info_t(x)).ToList();

            slaveIdentifications.Insert(0, new ec_slave_info_t(slave));

            return(slaveIdentifications.ToArray());
        }
コード例 #6
0
        private static ec_slave_info_t[] ToSlaveIdentificationSet(SlaveInfo slaveInfo)
        {
            List <ec_slave_info_t> slaveIdentificationSet;

            slaveIdentificationSet = slaveInfo.Descendants().ToList().Select(x => new ec_slave_info_t(x)).ToList();
            slaveIdentificationSet.Insert(0, new ec_slave_info_t(slaveInfo));

            return(slaveIdentificationSet.ToArray());
        }
コード例 #7
0
 internal void ActivateForTappedCard(SlaveInfo Slave)
 {
     lock (MasterServer.Connections)
         try
         {
             Invoke(new Action(() => CheLisBox_ConnectedMachines.SetItemChecked(CheLisBox_ConnectedMachines.Items.IndexOf(Slave.ToString()), true)));
         }
         catch { }
 }
コード例 #8
0
 internal void RemoveFromMachineList(SlaveInfo Slave)
 {
     lock (MasterServer.Connections)
         try
         {
             Invoke(new Action(() => CheLisBox_ConnectedMachines.Items.Remove(Slave.ToString())));
         }
         catch { }
 }
コード例 #9
0
ファイル: EcMaster.cs プロジェクト: mschwerin/EtherCAT.NET
        public void Configure(SlaveInfo rootSlaveInfo = null)
        {
            SlaveInfo         actualSlaveInfo;
            IList <SlaveInfo> slaveInfoSet;
            IList <SlaveInfo> actualSlaveInfoSet;
            NetworkInterface  networkInterface;

            networkInterface = NetworkInterface.GetAllNetworkInterfaces().Where(nic => nic.Name == _settings.InterfaceName).FirstOrDefault();

            if (networkInterface?.OperationalStatus != OperationalStatus.Up)
            {
                throw new Exception($"Network interface '{_settings.InterfaceName}' is not linked. Aborting action.");
            }

            #region "PreOp"

            actualSlaveInfo = EcUtilities.ScanDevices(this.Context, _settings.InterfaceName, null);

            if (rootSlaveInfo == null)
            {
                rootSlaveInfo = actualSlaveInfo;

                rootSlaveInfo.Descendants().ToList().ForEach(current =>
                {
                    ExtensibilityHelper.CreateDynamicData(_settings.EsiDirectoryPath, _extensionFactory, current);
                });
            }

            slaveInfoSet       = rootSlaveInfo.Descendants().ToList();
            actualSlaveInfoSet = actualSlaveInfo.Descendants().ToList();

            this.ValidateSlaves(slaveInfoSet, actualSlaveInfoSet);
            this.ConfigureSlaves(slaveInfoSet);
            this.ConfigureIoMap(slaveInfoSet);
            this.ConfigureDc();
            this.ConfigureSync01(slaveInfoSet);

            #endregion

            #region "SafeOp"

            EcUtilities.CheckErrorCode(this.Context, EcHL.CheckSafeOpState(this.Context), nameof(EcHL.CheckSafeOpState));

            #endregion

            #region "Op"

            EcUtilities.CheckErrorCode(this.Context, EcHL.RequestOpState(this.Context), nameof(EcHL.RequestOpState));

            #endregion

            if (_watchdogTask == null)
            {
                _watchdogTask = Task.Run(() => this.WatchdogRoutine(), _cts.Token);
            }
        }
コード例 #10
0
        public void BeginSort(SlaveInfo slaveInfo)
        {
            var upDownMessage = new UpDownMessage
            {
                UpDownCommand = UpDownCommand.BeginSort,
                Message       = $"开始波次"
            };

            SendMsg(upDownMessage);
        }
コード例 #11
0
 public SlaveClient(string IP, int Port = 9999)
 {
     Client = new JSONSocketClient(IP, Port);
     Info   = new SlaveInfo {
         MachineName = $"{ArcadeGameStartAndStopService.MainConfig.MachineName}:{ArcadeGameStartAndStopService.MainConfig.MachineGUID}", IP = Client.AddressInfo.Address.ToString(), Port = Client.AddressInfo.Port.ToString()
     };
     Client.OnMessageReceived = OnMessageReceived;
     Client.OnDisconnect     += Disconnected;
     Console.WriteLine("Connected");
 }
コード例 #12
0
        public static SlaveInfo ScanDevices(string interfaceName, SlaveInfo referenceSlaveInfo = null)
        {
            IntPtr    context;
            SlaveInfo slaveInfo;

            context   = EcHL.CreateContext();
            slaveInfo = EcUtilities.ScanDevices(context, interfaceName, referenceSlaveInfo);
            EcHL.FreeContext(context);

            return(slaveInfo);
        }
コード例 #13
0
ファイル: EcMaster.cs プロジェクト: XzuluX/EtherCAT.NET
        public void Configure(SlaveInfo rootSlave = null)
        {
            var networkInterface = NetworkInterface
                                   .GetAllNetworkInterfaces()
                                   .Where(nic => nic.Name == _settings.InterfaceName)
                                   .FirstOrDefault();

            if (networkInterface?.OperationalStatus != OperationalStatus.Up)
            {
                throw new Exception($"Network interface '{_settings.InterfaceName}' is not linked. Aborting action.");
            }

            #region "PreOp"

            var actualSlave = EcUtilities.ScanDevices(this.Context, _settings.InterfaceName, null);

            if (rootSlave == null)
            {
                rootSlave = actualSlave;

                rootSlave.Descendants().ToList().ForEach(current =>
                {
                    EcUtilities.CreateDynamicData(_settings.EsiDirectoryPath, current);
                });
            }

            var slaves       = rootSlave.Descendants().ToList();
            var actualSlaves = actualSlave.Descendants().ToList();

            this.ValidateSlaves(slaves, actualSlaves);
            this.ConfigureSlaves(slaves);
            this.ConfigureIoMap(slaves);
            this.ConfigureDc();
            this.ConfigureSync01(slaves);

            #endregion

            #region "SafeOp"

            EcUtilities.CheckErrorCode(this.Context, EcHL.CheckSafeOpState(this.Context), nameof(EcHL.CheckSafeOpState));

            #endregion

            #region "Op"

            EcUtilities.CheckErrorCode(this.Context, EcHL.RequestCommonState(this.Context, (UInt16)SlaveState.Operational), nameof(EcHL.RequestCommonState));

            #endregion

            if (_watchdogTask == null)
            {
                _watchdogTask = Task.Run(() => this.WatchdogRoutine(), _cts.Token);
            }
        }
コード例 #14
0
        /// <summary>
        /// 开始分拣
        /// </summary>
        public void BeginSort(SlaveInfo slaveInfo)
        {
            Parallel.ForEach(service, o => o.BeginSort(slaveInfo));
            //WaitPut
            var latticeInfoWaitPut = slaveInfo.LatticeInfo.Where(o => o.Status == LatticeStatus.WaitPut).ToList();

            latticeInfoWaitPut.ForEach(o =>
            {
                var productCodeWaitPut = o.Product.First(p => p.Status == ProductStatus.WaitPut).BarCode;
                WaitPut(latticeInfoWaitPut, productCodeWaitPut);
            });

            //BlockError
            var latticeInfoBlockError = slaveInfo.LatticeInfo.Where(o => o.Status == LatticeStatus.BlockError).ToList();

            if (latticeInfoBlockError.Count > 0)
            {
                BlockError(new UpDownMessage()
                {
                    LatticeByUpDown = latticeInfoBlockError.Select(o => new LatticeByUpDown()
                    {
                        LatticeNo = o.LatticeNo
                    }).ToList()
                });
            }
            //PutError
            var latticeInfoPutError = slaveInfo.LatticeInfo.Where(o => o.Status == LatticeStatus.PutError).ToList();

            if (latticeInfoPutError.Count > 0)
            {
                PutError(new UpDownMessage()
                {
                    LatticeByUpDown = latticeInfoPutError.Select(o => new LatticeByUpDown()
                    {
                        LatticeNo = o.LatticeNo
                    }).ToList()
                });
            }
            //LatticeComplete
            var latticeInfoComplete = slaveInfo.LatticeInfo.Where(o => o.IsComplete && o.Product.Count > 0).ToList();

            if (latticeInfoComplete.Count > 0)
            {
                LatticeComplete(new UpDownMessage()
                {
                    LatticeByUpDown = latticeInfoComplete.Select(o => new LatticeByUpDown()
                    {
                        LatticeNo = o.LatticeNo
                    }).ToList()
                });
            }
        }
コード例 #15
0
        public static SlaveInfo ScanDevices(string interfaceName, SlaveInfo referenceRootSlave = null)
        {
            if (NetworkInterface.GetAllNetworkInterfaces().Where(x => x.Name == interfaceName).FirstOrDefault()?.OperationalStatus != OperationalStatus.Up)
            {
                throw new Exception($"The network interface '{interfaceName}' is not linked. Aborting action.");
            }

            var context   = EcHL.CreateContext();
            var rootSlave = EcUtilities.ScanDevices(context, interfaceName, referenceRootSlave);

            EcHL.FreeContext(context);

            return(rootSlave);
        }
コード例 #16
0
        private void NewConnection(JSONServerSocket e)
        {
            JSONResponse <SlaveInfo> NewConnectionInfo = e.TransmitJSONCommand <PlayGameModel, SlaveInfo>(new JSONAction <PlayGameModel> {
                ActionName = "GetSlaveInfo", ActionData = new PlayGameModel {
                    GUID = AttendantConsole.GUIDGameSelection
                }
            });

            Thread.Sleep(100);
            SlaveInfo Info = NewConnectionInfo.ActionData;

            Info.Connection = e;
            lock (Connections)
                Connections.Add(Info.ToString(), Info);
            AttendantConsole.Log($"{Info} Has Connected.");
            AttendantConsole.AddToMachineList(Info);
        }
コード例 #17
0
ファイル: SlaveInfoService.cs プロジェクト: liusile/WGProject
        /// <summary>
        /// 初始化波次
        /// </summary>
        public void InitSlaveInfo()
        {
            List <LatticeInfo> latticeInfoList = new List <LatticeInfo>();

            Enumerable.Range(1, 50).ToList().ForEach(o => latticeInfoList.Add(
                                                         new LatticeInfo
            {
                LatticeNo = o.ToString(),
                Status    = LatticeStatus.None,
                Product   = new List <Product>()
            }
                                                         ));
            SlaveInfo = new SlaveInfo
            {
                LatticeInfo = latticeInfoList
            };
        }
コード例 #18
0
 internal void MarkGameAsStoped(SlaveInfo Slave)
 {
     lock (MasterServer.Connections)
         try
         {
             Invoke(new Action(() =>
             {
                 RunningMachines.Remove(Slave.ToString());
                 LisBox_RunningMachines.Items.Remove(Slave.ToString());
                 if (RunningMachines.Count == 0)
                 {
                     Bu_Start.Enabled = true;
                     Bu_Stop.Enabled  = false;
                 }
             }));
         }
         catch { }
 }
コード例 #19
0
ファイル: SlaveInfoService.cs プロジェクト: liusile/WGProject
 /// <summary>
 /// 取消波次分拣
 /// </summary>
 /// <param name="slaveInfo">波次信息</param>
 public bool DeleteSlaveInfo(SlaveInfo slaveInfo = null)
 {
     if (slaveInfo == null)
     {
         slaveInfo = SlaveInfo;
     }
     using (var db = new SortingDbContext())
     {
         db.WaveApi.AddOrUpdate(new WaveApi()
         {
             WaveNo = slaveInfo.WaveNo,
             Status = WaveStatus.Unwork
         });
         var entity = db.SlaveInfo.Include("LatticeInfo").Include("LatticeInfo.Product").FirstOrDefault(o => o.WaveNo == slaveInfo.WaveNo);
         db.SlaveInfo.Remove(entity);
         bool isSuccess = db.SaveChanges() > 0;
         return(isSuccess);
     }
 }
コード例 #20
0
        public static void UpdateSlaveExtensions(IExtensionFactory extensionFactory, SlaveInfo slaveInfo, SlaveInfo referenceEcSlaveInfo = null)
        {
            IEnumerable <Type> referenceTypeSet;
            IEnumerable <SlaveExtensionSettingsBase> referenceSet;
            IEnumerable <SlaveExtensionSettingsBase> newSet;
            TargetSlaveAttribute targetSlaveAttribute;

            referenceSet = referenceEcSlaveInfo?.SlaveExtensionSet;

            if (referenceSet == null)
            {
                referenceSet = slaveInfo.SlaveExtensionSet;
            }

            referenceTypeSet = referenceSet.Select(x => x.GetType()).ToList();

            newSet = extensionFactory.Get <SlaveExtensionSettingsBase>().Where(type =>
            {
                if (!referenceTypeSet.Contains(type))
                {
                    if (type == typeof(DistributedClocksSettings))
                    {
                        return(slaveInfo.SlaveEsi.Dc != null);
                    }
                    else
                    {
                        targetSlaveAttribute = type.GetFirstAttribute <TargetSlaveAttribute>();

                        return(targetSlaveAttribute.Manufacturer == slaveInfo.Manufacturer && targetSlaveAttribute.ProductCode == slaveInfo.ProductCode);
                    }
                }
                else
                {
                    return(false);
                }
            }).Select(type => (SlaveExtensionSettingsBase)Activator.CreateInstance(type, slaveInfo)).ToList();

            slaveInfo.SlaveExtensionSet = referenceSet.Concat(newSet).ToList();

            // Improve: only required after deserialization, not after construction as the slaveInfo is passed a constructor parameter
            slaveInfo.SlaveExtensionSet.ToList().ForEach(slaveExtension => slaveExtension.SlaveInfo = slaveInfo);
        }
コード例 #21
0
        private static SlaveInfo ToSlaveInfo(IList <ec_slave_info_t> slaveIdentifications)
        {
            var slaves = new List <SlaveInfo>();

            for (int i = 0; i < slaveIdentifications.Count(); i++)
            {
                SlaveInfo currentSlave;

                currentSlave = new SlaveInfo(slaveIdentifications[i]);

                if (i > 0)
                {
                    slaves[slaveIdentifications[i].parentIndex].Children.Add(currentSlave);
                }

                slaves.Add(currentSlave);
            }

            return(slaves.First());
        }
コード例 #22
0
        private void slaveModuleInitialize()
        {
            bool getSlave = false;

            foreach (var item in SlaveInfos)
            {
                SlaveInfo slaveInfo = item.Value;
                if ((adcPara.CardNo == slaveInfo.CardNo) && (adcPara.NodeNo == slaveInfo.NodeID))
                {
                    if (/*slaveInfo.VendorID == 0x1A05 && */ slaveInfo.ProductCode == 0x8124) //Analog Input Terminals (R1-EC81xx)
                    {
                        getSlave = true;
                        break;
                    }
                }
            }
            if (!getSlave)
            {
                throw new NotImplementedException(string.Format("EtherCAT can't find slave [{0}] from Card No {1} Node No {2}. There have {3} SlaveInfos.", this.DeviceName, adcPara.CardNo, adcPara.NodeNo, SlaveInfos.Count));
            }
        }
コード例 #23
0
        private static SlaveInfo ToSlaveInfo(IList <ec_slave_info_t> slaveIdentificationSet)
        {
            List <SlaveInfo> slaveInfoSet;

            slaveInfoSet = new List <SlaveInfo>();

            for (int i = 0; i < slaveIdentificationSet.Count(); i++)
            {
                SlaveInfo currentSlaveInfo;

                currentSlaveInfo = new SlaveInfo(slaveIdentificationSet[i]);

                if (i > 0)
                {
                    slaveInfoSet[slaveIdentificationSet[i].parentIndex].ChildSet.Add(currentSlaveInfo);
                }

                slaveInfoSet.Add(currentSlaveInfo);
            }

            return(slaveInfoSet.First());
        }
コード例 #24
0
        private JSONResponse <dynamic> OnMessageReceived(JSONAction <dynamic> Message)
        {
            switch (Message.ActionName)
            {
            case "NotifyOfGamesEnd":
            {
                SlaveInfo Data = Message.DynamicAutoCast <SlaveInfo>().ActionData;
                AttendantConsole.MarkGameAsStoped(Data);
                AttendantConsole.Log($"{Data} Has stopped its game.");
                JSONResponse <dynamic> Return = new JSONResponse <dynamic>()
                {
                    ActionName = Message.ActionName, ActionData = new { }, RequestStatus = JSONResponseStatus.Success
                };
                return(Return.ToDynamic());
            }

            case "CardTapped":
            {
                SlaveInfo Data = Message.DynamicAutoCast <SlaveInfo>().ActionData;
                AttendantConsole.ActivateForTappedCard(Message.DynamicAutoCast <SlaveInfo>().ActionData);
                AttendantConsole.Log($"{Data} Has detected a card tap. Setting to active start.");
                JSONResponse <dynamic> Return = new JSONResponse <dynamic>()
                {
                    ActionName = Message.ActionName, ActionData = new { }, RequestStatus = JSONResponseStatus.Success
                };
                return(Return.ToDynamic());
            }

            default:
            {
                JSONResponse <dynamic> Return = new JSONResponse <dynamic>()
                {
                    ActionName = Message.ActionName, ActionData = Message.ActionData, Message = "The Client has failed to find the requested action.", RequestStatus = JSONResponseStatus.ActionNotFound
                };
                Console.WriteLine($"Returing with:\n{Return}");
                return(Return);
            }
            }
        }
コード例 #25
0
 public AnybusXGatewaySettings(SlaveInfo slaveInfo) : base(slaveInfo)
 {
     this.ModuleSet = new List <OneDasModule>();
 }
コード例 #26
0
        public SlaveExtensionSettingsBase(SlaveInfo slaveInfo)
        {
            Contract.Requires(slaveInfo != null);

            this.SlaveInfo = slaveInfo;
        }
コード例 #27
0
 public static List <DistributedClocksOpMode> GetOpModes(this SlaveInfo slaveInfo)
 {
     return(slaveInfo.SlaveEsi.Dc.OpMode.Select(opMode => new DistributedClocksOpMode(opMode)).ToList());
 }
コード例 #28
0
        public static SlaveInfo ReloadHardware(string esiDirectoryPath, IExtensionFactory extensionFactory, string interfaceName, SlaveInfo referenceRootSlaveInfo)
        {
            IntPtr    context;
            SlaveInfo newRootSlaveInfo;
            SlaveInfo referenceSlaveInfo;
            IEnumerable <SlaveInfo> referenceSlaveInfoSet;

            referenceSlaveInfo    = null;
            referenceSlaveInfoSet = null;

            if (NetworkInterface.GetAllNetworkInterfaces().Where(x => x.GetPhysicalAddress().ToString() == interfaceName).FirstOrDefault()?.OperationalStatus != OperationalStatus.Up)
            {
                throw new Exception($"The network interface '{interfaceName}' is not linked. Aborting action.");
            }

            context          = EcHL.CreateContext();
            newRootSlaveInfo = EcUtilities.ScanDevices(context, interfaceName, referenceRootSlaveInfo);
            EcHL.FreeContext(context);

            if (referenceRootSlaveInfo != null)
            {
                referenceSlaveInfoSet = referenceRootSlaveInfo.Descendants().ToList();
            }

            newRootSlaveInfo.Descendants().ToList().ForEach(slaveInfo =>
            {
                referenceSlaveInfo = slaveInfo.Csa == slaveInfo.OldCsa ? referenceSlaveInfoSet?.FirstOrDefault(x => x.Csa == slaveInfo.Csa) : null;
                ExtensibilityHelper.GetDynamicSlaveInfoData(esiDirectoryPath, extensionFactory, slaveInfo);
                ExtensibilityHelper.UpdateSlaveExtensions(extensionFactory, slaveInfo, referenceSlaveInfo);
            });

            return(newRootSlaveInfo);
        }
コード例 #29
0
        public static SlaveInfoDynamicData GetDynamicSlaveInfoData(string esiDirectoryPath, IExtensionFactory extensionFactory, SlaveInfo slaveInfo)
        {
            if (slaveInfo.Csa > 0)
            {
                ExtensibilityHelper.CreateDynamicData(esiDirectoryPath, extensionFactory, slaveInfo);

                return(slaveInfo.DynamicData);
            }
            else
            {
                return(new SlaveInfoDynamicData("EtherCAT Master", "EtherCAT Master", new List <SlavePdo>(), new byte[] { }));
            }
        }
コード例 #30
0
 public EL6731_0010Settings(SlaveInfo slaveInfo) : base(slaveInfo)
 {
     this.SelectedModuleSet = new List <EL6731_0010Module>();
     this.StationNumber     = 1;
 }