public async Task PullPointAsync(System.Threading.CancellationToken cancellationToken) { if (m_PullPointSubscriptionClient == null) { } // var pullPointSubscriptionClient = _onvifClientFactory.CreateClient<PullPointSubscription>(endPointAddress, _connectionParameters, // MessageVersion.Soap12WSAddressing10); // var subscriptionManagerClient = _onvifClientFactory.CreateClient<SubscriptionManager>(endPointAddress, _connectionParameters, // MessageVersion.Soap12WSAddressing10); try { var pullRequest = new PullMessagesRequest("PT1S", 1024, null); pullRequest.MessageLimit = 1024; pullRequest.Timeout = "PT1S"; // int renewIntervalMs = (int)(m_subscriptionTerminationTime.TotalMilliseconds / 2); // int lastTimeRenewMade = Environment.TickCount; TimeUtil timeutil = new TimeUtil(m_subscriptionTerminationTime.TotalMilliseconds / 2); while (!cancellationToken.IsCancellationRequested) { PullMessagesResponse response = await m_PullPointSubscriptionClient.PullMessagesAsync(pullRequest); foreach (var messageHolder in response.NotificationMessage) { if (messageHolder.Message == null) { continue; } string var = messageHolder.Message.Value; var @event = new DeviceEvent(messageHolder.Message.Value); OnEventReceived(@event); } if (timeutil.IsTimeover()) { timeutil.Time = System.DateTime.Now; // lastTimeRenewMade = Environment.TickCount; var renew = new Renew { TerminationTime = GetTerminationTime() }; // var renewrequ = new RenewRequest(); // renewrequ.Renew = renew; await m_SubscriptionManagerClient.RenewAsync(renew); } } //new UnsubscribeRequest(new Unsubscribe()) OnVifServices.OnvifEvent10.Unsubscribe unsub = new Unsubscribe(); await m_SubscriptionManagerClient.UnsubscribeAsync(unsub); } catch (Exception ex) { m_ErrorMessage = ex.Message; } }
private void OnEventReceived(DeviceEvent @event) { throw new NotImplementedException(); }