public AdsErrorCode TryCreateHandles(out ISumHandleCollection handles) { IList <SumDataEntity> list = this.CreateSumEntityInfos(); handles = null; AdsErrorCode[] returnCodes = null; IList <byte[]> readData = null; int[] readDataSizes = null; AdsErrorCode code = base.Execute(null, out readData, out readDataSizes, out returnCodes); if (code == AdsErrorCode.NoError) { handles = new SumHandleList(); for (int i = 0; i < list.Count; i++) { uint notificationHandle = 0; if (returnCodes[i] == AdsErrorCode.NoError) { notificationHandle = BitConverter.ToUInt32(readData[i], 0); } handles.Add(new SumNotificationHandleEntry(this._variableHandles[i], notificationHandle, returnCodes[i])); } } return(code); }
public AdsErrorCode TryCreateHandles(out ISumHandleCollection handles) { IList <SumDataEntity> sumEntities = this.CreateSumEntityInfos(); handles = null; AdsErrorCode[] returnCodes = null; List <byte[]> writeData = new List <byte[]>(); IList <byte[]> readData = null; foreach (InstancePathSumEntity entity in sumEntities) { writeData.Add(entity.GetWriteBytes()); } base.innerCommand = new SumReadWrite(this._connection, sumEntities, TwinCAT.Ads.SumCommand.SumCommand.SumAccessMode.AquireHandleByName); AdsErrorCode code = base.innerCommand.TryReadWriteRaw(writeData, out readData, out returnCodes); if (code == AdsErrorCode.NoError) { handles = new SumHandleList(); for (int i = 0; i < sumEntities.Count; i++) { uint handle = 0; if (returnCodes[i] == AdsErrorCode.NoError) { handle = BitConverter.ToUInt32(readData[i], 0); } handles.Add(new SumHandleInstancePathEntry(this._instancePaths[i], handle, returnCodes[i])); } } return(code); }