public static void WriteData(this XiDataList dataList, WriteData dataObjectToWrite) { dataList.WriteData(new List <WriteValue> { dataObjectToWrite.ToWriteValue() }); }
public static void WriteData(this XiDataList dataList, IEnumerable <WriteData> dataObjectsToWrite) { var objectsToWrite = dataObjectsToWrite.ToWriteValues().ToList(); dataList.WriteData(objectsToWrite); }
public OnDefineListCompleteEventArgs(Exception error, ListAttributes rslt, XiDataList dataList, object asyncState = null) { this.Error = error; this.Rslt = rslt; this.DataList = dataList; this.AsyncState = asyncState; }
public void Start() { if (_isStarted) { throw new InvalidOperationException("AccessChannel cannot start twice"); } _isStarted = true; XiServerProvider.XiServer.Initiate(); var r = XiServerProvider.XiServer .AddDataList( true, _channelConfig.Interval, //update rate auto = 0; 0, null, null, _channelConfig.AccessMode.ToListRWAccessMode(), _channelConfig.SubscriptionMode.ToSubscriptionUpdateMode()); _dataList = r; _dataList.OnInformationReport += _dataList_OnInformationReport; _dataList.OnPollError += _dataList_OnPollError; _isDataListInitialized = true; }
public async Task StartAsync() { if (_isStarted) { throw new InvalidOperationException("AccessChannel cannot start twice"); } _isStarted = true; var initateCompleteEventArgs = await XiServerProvider.XiServer.InitiateAsync(); if (initateCompleteEventArgs.Error != null) { throw new Exception("InitiateEx failed", initateCompleteEventArgs.Error); } var defineListCompleteEventArgs = await XiServerProvider.XiServer.AddDataListAsync( true, _channelConfig.Interval, //update rate auto = 0; 0, null, null, _channelConfig.AccessMode.ToListRWAccessMode(), _channelConfig.SubscriptionMode.ToSubscriptionUpdateMode()); _dataList = defineListCompleteEventArgs.DataList; _dataList.OnInformationReport += _dataList_OnInformationReport; _dataList.OnPollError += _dataList_OnPollError; _isDataListInitialized = true; }
private static List <ReadValue> ReadData(this XiDataList dataList, IEnumerable <uint> serverAliases) { var aliases = serverAliases.ToList(); var readValues = dataList.ReadData(aliases); return(readValues); }
public static ReadData ReadDataEx(this XiDataList dataList, IAccessItemRegistration reg) { ReadValue readValue = dataList.ReadData(reg.ServerAlias); var rd = readValue.ToReadData(reg); return(rd); }
public static void WriteData(this XiDataList dataList, WriteValue dataObjectToWrite, OnWriteDataComplete onComplete, object asyncState) { dataList.WriteData(new List <WriteValue> { dataObjectToWrite }, onComplete, asyncState); }
public static void ReadData(this XiDataList dataList, IEnumerable <IAccessItemRegistration> registrations, OnReadDataComplete onComplete, object asyncState) { var list = registrations.Select(x => x.ServerAlias).ToList(); dataList.ReadData(list, onComplete, asyncState); }
public static void WriteData(this XiDataList dataList, IEnumerable <WriteData> dataObjectsToWrite, OnWriteDataComplete onComplete, object asyncState) { List <WriteValue> objectsToWrite = dataObjectsToWrite.ToWriteValues().ToList(); dataList.WriteData(objectsToWrite, onComplete, asyncState); }
private static ReadValue ReadData(this XiDataList dataList, uint serverAlias) { var aliases = new List <uint> { serverAlias }; var readValues = dataList.ReadData(aliases); return(readValues.First()); }
public static void ReadData(this XiDataList dataList, IAccessItemRegistration registration, OnReadDataComplete onComplete, object asyncState) { var list = new List <uint> { registration.ServerAlias }; dataList.ReadData(list, onComplete, asyncState); }
public static void WriteData(this XiDataList dataList, WriteData dataObjectToWrite, OnWriteDataComplete onComplete, object asyncState) { var xiWriteValue = dataObjectToWrite.ToWriteValue(); dataList.WriteData(new List <WriteValue> { xiWriteValue }, onComplete, asyncState); }
public static IObservable <XiGeneralNotificationArgs> GetOnPollErrorEvent(this XiDataList dataList) { /*var ob = Observable.FromEvent< * XiGeneralNotification, * XiGeneralNotificationArgs>( * ev => dataList.OnPollError += ev, * ev => dataList.OnPollError -= ev); * * return ob;*/ throw new NotImplementedException(); }
public static Task <XiDataListReadDataCompleteResult> ReadDataAsync(this XiDataList dataList, IEnumerable <uint> serverAliases, object asyncState = null) { var t = new TaskCompletionSource <XiDataListReadDataCompleteResult>(); dataList.ReadData(serverAliases.ToList(), (e, readValues, o) => t.TrySetResult(new XiDataListReadDataCompleteResult(e, readValues, o)), asyncState); return(t.Task); }
public static Task WriteDataAsync(this XiDataList dataList, IEnumerable <WriteData> dataObjectsToWrite, object asyncState = null) { var objectsToWrite = dataObjectsToWrite.ToWriteValues().ToList(); var t = new TaskCompletionSource <XiDataListWriteDataCompleteResult>(); dataList.WriteData(objectsToWrite, (e, readValues, o) => t.TrySetResult(new XiDataListWriteDataCompleteResult(e, readValues, o)), asyncState); return(t.Task); }
/// <summary> /// Convert ReadValue to ReadData with Convertion (like LinearConvert) /// </summary> /// <param name="dataList"></param> /// <param name="registrations"></param> /// <returns></returns> public static IEnumerable <ReadData> ReadDataEx(this XiDataList dataList, IEnumerable <IAccessItemRegistration> registrations) { var regs = registrations.ToList(); var dic = new Dictionary <uint, IAccessItemRegistration>(); regs.ForEach(reg => dic.Add(reg.ClientAlias, reg)); var readValues = dataList.ReadData(regs.Select(x => x.ServerAlias)); foreach (var readValue in readValues) { var reg = dic[readValue.ClientAlias]; yield return(readValue.ToReadData(reg)); } }
/// <summary> /// <para> Throws or returns changed IXiDataListItems (not null, but possibly zero-lenghth). </para> /// <para> dataList is not null </para> /// <para> /// This method is used to poll the endpoint for changes to a specific data list. It is also used as a /// keep-alive for the poll endpoint by setting the listId parameter to 0. In this case, null is returned /// immediately. /// </para> /// <para> Changes consists of: </para> /// <para> 1) values for data objects that were added to the list, </para> /// <para> /// 2) values for data objects whose current values have changed since the last time they were reported to the /// client via this interface. If a deadband filter has been defined for the list, floating point values are not /// considered to have changed unless they have changed by the deadband amount. /// </para> /// <para> 3) historical values that meet the list filter criteria, including the deadband. </para> /// <para> /// This method returns the list of changed values to the client application using the ElementValuesCallback /// callback.. The list of changed values is null if this is a keep-alive. The following two standard data objects /// can also be returned. /// </para> /// <para> /// The first is identified by a ListId of 0 and a ClientId of 0. It contains a ServerStatus object value that /// indicates to the client that the server or one of its wrapped servers is shutting down. When present, this will /// always be the first value in the returned OBJECT value array. /// </para> /// <para> /// The second is identified by its ListId and a ClientId of 0. It contains a UInt32 value that indicates to the /// client how many data changes have been discarded for the specified list since the last poll response. If this /// condition persists, the client should increase its poll frequency. When present, this will always be the first /// value in the returned UINT value array. /// </para> /// </summary> /// <param name="dataList"> The data list to poll. </param> public IXiDataListItem[] PollDataChanges(XiDataList dataList) { if (dataList is null) { throw new ArgumentNullException(@"dataList"); } if (_disposed) { throw new ObjectDisposedException("Cannot access a disposed XiContext."); } if (_pollEndpoint is null) { throw new Exception("No Poll Endpoint."); } if (_pollEndpoint.Disposed) { throw new Exception("Poll Endpoint is Disposed."); } DataValueArraysWithAlias?readValueList = null; if (XiEndpointRoot.CreateChannelIfNotCreated(_pollEndpoint)) { try { readValueList = _pollEndpoint.Proxy.PollDataChanges(ContextId, dataList.ServerListId); _pollEndpoint.LastCallUtc = DateTime.UtcNow; } catch (Exception ex) { ProcessRemoteMethodCallException(ex); } } IXiDataListItem[]? changedListItems = ElementValuesCallbackInternal(dataList, readValueList); if (changedListItems is null) { throw new Exception("PollDataChanges() error."); } return(changedListItems); }
private static ReadValue ReadData(this XiDataList dataList, IAccessItemRegistration registration) { return(dataList.ReadData(registration.ServerAlias)); }
private static List <ReadValue> ReadData(this XiDataList dataList, IEnumerable <IAccessItemRegistration> registrations) { return(dataList.ReadData(registrations.Select(x => x.ServerAlias))); }
public static IObservable <OnInformationReportArgs> GetOnInformationReportEvent(this XiDataList dataList) { /*var ob = Observable.FromEvent<xiInformationReport>( * ev => dataList.OnInformationReport += ev, * ev => dataList.OnInformationReport -= ev); * * return ob;*/ throw new NotImplementedException(); }