/// <summary> /// Modifies items that are already part of the subscription. /// </summary> public virtual TsCDaItemResult[] ModifyItems(int masks, TsCDaItem[] items) { LicenseHandler.ValidateFeatures(LicenseHandler.ProductFeature.DataAccess); if (items == null) { throw new ArgumentNullException(nameof(items)); } // check if there is nothing to do. if (items.Length == 0) { return(new TsCDaItemResult[0]); } // modify items. TsCDaItemResult[] results = Subscription.ModifyItems(masks, items); if (results == null || results.Length == 0) { throw new OpcResultException(new OpcResult(OpcResult.E_FAIL.Code, OpcResult.FuncCallType.SysFuncCall, null), "The browse operation cannot continue"); } // update local item - modify item success means all fields were updated successfully. for (int ii = 0; ii < results.Length; ii++) { // check for failure. if (results[ii].Result.Failed()) { continue; } // search local item list. for (int jj = 0; jj < daItems_.Length; jj++) { if (daItems_[jj].ServerHandle.Equals(items[ii].ServerHandle)) { // update locale copy of the item. // item name, item path and client handle may not be returned by server. TsCDaItem item = new TsCDaItem(results[ii]) { ItemName = daItems_[jj].ItemName, ItemPath = daItems_[jj].ItemPath, ClientHandle = daItems_[jj].ClientHandle }; daItems_[jj] = item; break; } } } // update the local state. GetState(); // return results. return(results); }