/// <summary> /// This method is used to create a Xi List of one of the four supported list types. /// Which are: /// 1) DataList - used to maintain a list of active process values. /// 2) DataJournalList - used to obtain a historical list of process values. /// 3) EventList - used to obtain process events as they occur. /// 4) EventJournalList - used to obtain a historical list of process events. /// </summary> /// <param name="xiList"> The list to be created. </param> /// <param name="updateRate"> /// The requested update rate in milliseconds for the list. The update rate indicates how often /// the server updates the values of elements in the list. A value of 0 indicates that updating is exception-based. The /// server may negotiate this value, up or down as necessary to support its efficient operation. /// </param> /// <param name="bufferingRate"> /// <para> /// An optional-use parameter that indicates that the server is to buffer data updates, rather than overwriting /// them, until either the time span defined by the buffering rate expires or the values are transmitted to the /// client in a callback or poll response. If the time span expires, then the oldest value for a data object is /// discarded when a new value is received from the underlying system. /// </para> /// <para> /// The value of the bufferingRate is set to 0 to indicate that it is not to be used and that new values /// overwrite (replace) existing cached values. /// </para> /// <para> /// When used, this parameter contains the client-requested buffering rate, which the server may negotiate up or /// down, or to 0 if the server does not support the buffering rate. /// </para> /// <para> The FeaturesSupported member of the StandardMib is used to indicate server support for the buffering rate. </para> /// </param> /// <param name="filterSet"> The set of filters to be used to select the elements of the list. </param> /// <returns> The attributes created for the list. </returns> public ListAttributes?DefineList(XiListRoot xiList, uint updateRate, uint bufferingRate, FilterSet?filterSet) { if (_disposed) { throw new ObjectDisposedException("Cannot access a disposed XiContext."); } uint clientListId = _lists.Add(xiList); ListAttributes?listAttrs = null; if (_iResourceManagement is null) { throw new InvalidOperationException(); } try { listAttrs = _iResourceManagement.DefineList(ContextId, clientListId, (uint)xiList.StandardListType, updateRate, bufferingRate, filterSet); SetResourceManagementLastCallUtc(); } catch (Exception ex) { _lists.Remove(clientListId); ProcessRemoteMethodCallException(ex); } _listArray = _lists.ToArray(); return(listAttrs); }
/// <summary> /// This method removes (unassigns) the specified Xi List from the endpoint. /// </summary> /// <param name="xiList"> The specified Xi List. </param> public void UnassignList(XiListRoot xiList) { if (Disposed) { throw new ObjectDisposedException("Cannot access a disposed XiEndpointRoot."); } _assignedXiLists.Remove(xiList); }
/// <summary> /// This method indicates, when TRUE is returned, that the specified XiList /// has been assigned to this endpoint. /// </summary> /// <param name="list"> The specified XiList. </param> /// <returns> Returns TRUE if the specified XiList has been assigned to this endpoint, otherwise FALSE. </returns> public bool HasListAttached(XiListRoot list) { if (Disposed) { throw new ObjectDisposedException("Cannot access a disposed XiEndpointRoot."); } return(_assignedXiLists.Exists(l => l.ServerListId == list.ServerListId)); }
/// <summary> /// This method deletes a list from the Xi Server. /// </summary> /// <param name="xiList"> The list to deleted </param> /// <returns> The results of the deletion. </returns> public AliasResult?RemoveList(XiListRoot xiList) { if (_disposed) { throw new ObjectDisposedException("Cannot access a disposed XiContext."); } if (xiList.ListAttributes is not null) { // Only do the delete of this list from the server // if the context dispose is not running and the // list has list attributes. if (0 != xiList.ServerListId) { var listIds = new List <uint>(); listIds.Add(xiList.ServerListId); List <AliasResult>?listAliasResult = null; if (_iResourceManagement is null) { throw new InvalidOperationException(); } try { listAliasResult = _iResourceManagement.DeleteLists(ContextId, listIds); SetResourceManagementLastCallUtc(); } catch (Exception ex) { ProcessRemoteMethodCallException(ex); } _lists.Remove(xiList.ClientListId); _listArray = _lists.ToArray(); if (null != listAliasResult) { return(listAliasResult[0]); } } } return(null); }