Exemplo n.º 1
0
        public virtual void Cancel()
        {
            if (!string.IsNullOrEmpty(this._uniqueID))
            {
                Client <RequestServiceClient> c = null;

                try
                {
                    RequestToken requestToken = new RequestToken();
                    requestToken.Id = new Guid(this._uniqueID);


                    c = ExternalClientFactory.ConstructRequestServiceClient(ExternalLib.Endpoint.RequestEndpointName, ExternalLib.Endpoint.ExternalUserName, ExternalLib.Endpoint.ExternalUserPassword);
                    c.ServiceClient.CancelRequest(requestToken);
                    c.ServiceClient.Close();
                }
                catch (TimeoutException)
                {
                    throw;
                }
                catch (CommunicationException)
                {
                    throw;
                }
                catch (Exception)
                {
                    throw;
                }
                finally
                {
                    c.ServiceClient.Abort();
                }
            }
        }
Exemplo n.º 2
0
 internal override void Invoke()
 {
     this.m_client   = ExternalClientFactory.ConstructControlServiceClient(ExternalLib.Endpoint.ControlEndpointName, ExternalLib.Endpoint.ExternalUserName, ExternalLib.Endpoint.ExternalUserPassword);
     this._rqstToken = this.m_client.ServiceClient.ActivateCriticalPeakPricingByMeters(_epRequest);
     Thread.Sleep(300000);
     this.m_client.ServiceClient.Close();
 }
Exemplo n.º 3
0
        private void Subscribe()
        {
            Client <SubscriptionServiceClient> c = null;
            SubscribeToEndpointDataRequest     SubscribeEndpointRequest = null;
            SubscriptionRequest SubscriptionRequest = null;

            try
            {
                c = ExternalClientFactory.ConstructSubscriptionServiceClient(ExternalLib.Endpoint.SubscriptionEndpointName, ExternalLib.Endpoint.ExternalUserName, ExternalLib.Endpoint.ExternalUserPassword);

                SubscribeEndpointRequest                     = new SubscribeToEndpointDataRequest();
                SubscriptionRequest                          = new SubscriptionRequest();
                SubscriptionRequest.SystemName               = this._systemName;
                SubscriptionRequest.UriCollection            = new Uri[] { this._systemUri };
                SubscribeEndpointRequest.SubscriptionRequest = SubscriptionRequest;

                c.ServiceClient.SubscribeToEndpointData(SubscribeEndpointRequest);
                c.ServiceClient.Close();
            }
            catch (FaultException <Itron.Ami.Facade.WebServices.Subscriptions.V200908.ClientProxy.DuplicateSubscriberFault> )
            {
            }
            finally
            {
                if ((null != c) && (null != c.ServiceClient) &&
                    (c.ServiceClient.State != CommunicationState.Closed))
                {
                    c.ServiceClient.Close();
                }
            }
        }
Exemplo n.º 4
0
        private void Unsubscribe()
        {
            Client <SubscriptionServiceClient> c = null;

            try
            {
                c = ExternalClientFactory.ConstructSubscriptionServiceClient(ExternalLib.Endpoint.SubscriptionEndpointName, ExternalLib.Endpoint.ExternalUserName, ExternalLib.Endpoint.ExternalUserPassword);

                CancelDataSubscriptionRequest CancelReq = new CancelDataSubscriptionRequest();
                CancelReq.SystemName = this._systemName;

                c.ServiceClient.CancelDataSubscription(CancelReq);
                c.ServiceClient.Close();
            }
            catch (FaultException <Itron.Ami.Facade.WebServices.Subscriptions.V200908.ClientProxy.SubscriberEndpointNotFoundFault> )
            {
            }
            catch (FaultException <Itron.Ami.Facade.WebServices.Subscriptions.V200908.ClientProxy.SubscriberNotFoundFault> )
            {
            }
            finally
            {
                if ((null != c) && (null != c.ServiceClient) &&
                    (c.ServiceClient.State != CommunicationState.Closed))
                {
                    c.ServiceClient.Close();
                }
            }
        }
Exemplo n.º 5
0
        private void Subscribe()
        {
            Client <SubscriptionServiceClient> c = null;
            SubscriptionRequest subRequest       = null;

            try
            {
                if ((null != this._systemName) && (null != this._systemUri))
                {
                    c = ExternalClientFactory.ConstructSubscriptionServiceClient(ExternalLib.Endpoint.SubscriptionEndpointName, ExternalLib.Endpoint.ExternalUserName, ExternalLib.Endpoint.ExternalUserPassword);

                    subRequest               = new SubscriptionRequest();
                    subRequest.SystemName    = this._systemName;
                    subRequest.UriCollection = new Uri[] { this._systemUri };

                    SubscribeToEndpointEventsRequest request = new SubscribeToEndpointEventsRequest();
                    request.SubscriptionRequest = subRequest;

                    c.ServiceClient.SubscribeToEndpointEvents(request);
                    c.ServiceClient.Close();
                }
            }
            catch (FaultException <Itron.Ami.Facade.WebServices.Subscriptions.V200908.ClientProxy.DuplicateSubscriberFault> )
            {
                bool duplicate = false;

                // Subscription already exists (i.e. a data subscription with the same system name already exists)
                // we need to determine whether or not we're going to add this endpoint to the subscription.
                try
                {
                    SubscriberRequest req = new SubscriberRequest();
                    req.SystemName = this._systemName;
                    req.Uri        = this._systemUri;

                    c.ServiceClient.AddEventSubscriberEndpointAddress(req);
                    c.ServiceClient.Close();
                }
                catch (FaultException <Itron.Ami.Facade.WebServices.Subscriptions.V200908.ClientProxy.DuplicateSubscriberEndpointFault> )
                {
                    // Ok, it's clear now that the subscription already exists and that this endpoint address is already a part of that
                    // subscription.  So, we're good to go.
                    duplicate = true;
                }

                if (!duplicate)
                {
                    throw;
                }
            }
            finally
            {
                if ((null != c) && (null != c.ServiceClient) &&
                    (c.ServiceClient.State != CommunicationState.Closed))
                {
                    c.ServiceClient.Close();
                }
            }
        }
Exemplo n.º 6
0
 internal override void Invoke()
 {
     if (string.IsNullOrEmpty(UniqueID))
     {
         this._client     = ExternalClientFactory.ConstructReportServiceClient(ExternalLib.Endpoint.ReportEndpointName, ExternalLib.Endpoint.ExternalUserName, ExternalLib.Endpoint.ExternalUserPassword);
         this._FWDLReport = this._client.ServiceClient.GetFirmwareDownloadsRunningReport();
         this._client.ServiceClient.Close();
     }
 }
Exemplo n.º 7
0
        internal override void Invoke()
        {
            this._client = ExternalClientFactory.ConstructDataServiceClient(ExternalLib.Endpoint.DataEndpointName, ExternalLib.Endpoint.ExternalUserName, ExternalLib.Endpoint.ExternalUserPassword);

            this._rqstToken = this._client.ServiceClient.InteractiveReadByEndpoint(this._epRequest);


            this._client.ServiceClient.Close();

            this._uniqueID = this._rqstToken.Id.ToString();
        }
Exemplo n.º 8
0
        internal override void Invoke()
        {
            if (string.IsNullOrEmpty(UniqueID))
            {
                this._client    = ExternalClientFactory.ConstructControlServiceClient(ExternalLib.Endpoint.ControlEndpointName, ExternalLib.Endpoint.ExternalUserName, ExternalLib.Endpoint.ExternalUserPassword);
                this._rqstToken = this._client.ServiceClient.DownloadConfigurationByGroup(_requestDownloadConfig);
                this._client.ServiceClient.Close();

                _uniqueID = _rqstToken.Id.ToString();
            }
        }
Exemplo n.º 9
0
        internal override void Invoke()
        {
            this._client = ExternalClientFactory.ConstructControlServiceClient(ExternalLib.Endpoint.ControlEndpointName, ExternalLib.Endpoint.ExternalUserName, ExternalLib.Endpoint.ExternalUserPassword);

            RequestToken Token = new RequestToken();

            Token.Id = new Guid(_uniqueID);

            this._result = this._client.ServiceClient.GetDownloadConfigurationByGroupResult(Token);

            this._client.ServiceClient.Close();
        }
Exemplo n.º 10
0
        internal override void Invoke()
        {
            this._client = ExternalClientFactory.ConstructOpticalSignedAuthorizationService(ExternalLib.Endpoint.SecurityEndpointName, ExternalLib.Endpoint.ExternalUserName, ExternalLib.Endpoint.ExternalUserPassword);

            if (null != _rsaRequest)
            {
                _saResult = this._client.ServiceClient.RequestSignedAuthorization(_rsaRequest);
            }

            if (null != _rsaEpRequest)
            {
                _saResult = this._client.ServiceClient.RequestSignedAuthorizationByEndpoint(_rsaEpRequest);
            }

            this._client.ServiceClient.Close();
        }
Exemplo n.º 11
0
        internal override void Invoke()
        {
            this._client = ExternalClientFactory.ConstructDataServiceClient(ExternalLib.Endpoint.DataEndpointName, ExternalLib.Endpoint.ExternalUserName, ExternalLib.Endpoint.ExternalUserPassword);

            if (null != this._grpRequest)
            {
                this._rqstToken = this._client.ServiceClient.InterrogateByGroup(this._grpRequest.InterrogateByGroupRequest);
            }
            else
            {
                this._rqstToken = this._client.ServiceClient.InterrogateByEndpoints(this._epRequest.InterrogateByEndpointsRequest);
            }

            this._client.ServiceClient.Close();

            this._uniqueID = this._rqstToken.Id.ToString();
        }
Exemplo n.º 12
0
        private void Unsubscribe()
        {
            Client <SubscriptionServiceClient> c = null;

            try
            {
                if ((null != this._systemName) && (null != this._systemUri))
                {
                    c = ExternalClientFactory.ConstructSubscriptionServiceClient(ExternalLib.Endpoint.SubscriptionEndpointName, ExternalLib.Endpoint.ExternalUserName, ExternalLib.Endpoint.ExternalUserPassword);

                    SubscriberRequest req = new SubscriberRequest();
                    req.SystemName = this._systemName;
                    req.Uri        = this._systemUri;

                    c.ServiceClient.DeleteEventSubscriberEndpointAddress(req);
                    c.ServiceClient.Close();
                }
            }
            catch (FaultException <Itron.Ami.Facade.WebServices.Subscriptions.V200908.ClientProxy.ArgumentFault> )
            {
                // Looks like this is the last endpoint for the service.  So, we'll simply cancel the subscription at this point.

                CancelEventSubscriptionRequest request = new CancelEventSubscriptionRequest();
                request.SystemName = this._systemName;
                c.ServiceClient.CancelEventSubscription(request);
                c.ServiceClient.Close();
            }
            catch (FaultException <Itron.Ami.Facade.WebServices.Subscriptions.V200908.ClientProxy.SubscriberEndpointNotFoundFault> )
            {
            }
            catch (FaultException <Itron.Ami.Facade.WebServices.Subscriptions.V200908.ClientProxy.SubscriberNotFoundFault> )
            {
            }
            finally
            {
                if ((null != c) && (null != c.ServiceClient) &&
                    (c.ServiceClient.State != CommunicationState.Closed))
                {
                    c.ServiceClient.Close();
                }
            }
        }
Exemplo n.º 13
0
 internal override void Invoke()
 {
     if (string.IsNullOrEmpty(UniqueID))
     {
         this._client    = ExternalClientFactory.ConstructControlServiceClient(ExternalLib.Endpoint.ControlEndpointName, ExternalLib.Endpoint.ExternalUserName, ExternalLib.Endpoint.ExternalUserPassword);
         this._rqstToken = this._client.ServiceClient.PingByEndpoints(_requestPing);
         bool blTryAgain = true;
         int  retryCount = 4;
         _uniqueID = _rqstToken.Id.ToString();
         while (blTryAgain)
         {
             if (retryCount == 0)
             {
                 blTryAgain = false;
             }
             try
             {
                 Thread.Sleep(60000);
                 this._rqstResult = this._client.ServiceClient.GetPingByEndpointsResult(this._rqstToken);
                 if (this._rqstResult != null)
                 {
                     blTryAgain = false;
                 }
             }
             catch (Exception e)
             {
                 Console.WriteLine("Exception from DisconnectMeter: " + e);
                 retryCount--;
             }
             if (this._rqstResult == null)
             {
                 retReslt = "Unknown";
             }
             else
             {
                 retReslt = this._rqstResult.Result.ToString();
             }
         }
         this._client.ServiceClient.Close();
     }
 }
Exemplo n.º 14
0
        internal override void Invoke()
        {
            this.m_client = ExternalClientFactory.ConstructEndpointMembershipServiceClient(ExternalLib.Endpoint.MembershipEndpointName, ExternalLib.Endpoint.ExternalUserName, ExternalLib.Endpoint.ExternalUserPassword);
            System.IO.Stream ESNStream = this.m_client.ServiceClient.GetMemberEsnListByGroup(m_strGroupNameRequest);

            System.IO.StreamReader strmReader = new System.IO.StreamReader(ESNStream);

            string strESN = string.Empty;

            while (false == strmReader.EndOfStream)
            {
                strESN = strmReader.ReadLine();

                if (false == string.IsNullOrEmpty(strESN))
                {
                    m_lstESNs.Add(strESN);
                }
            }

            this.m_client.ServiceClient.Close();
        }
Exemplo n.º 15
0
 internal override void Invoke()
 {
     this.m_client = ExternalClientFactory.ConstructProvisioningServiceClient(ExternalLib.Endpoint.ProvisioningEndpointName, ExternalLib.Endpoint.ExternalUserName, ExternalLib.Endpoint.ExternalUserPassword);
     m_Result      = this.m_client.ServiceClient.RemoveMeterDefinitions(m_MeterDefinitions);
     this.m_client.ServiceClient.Close();
 }
Exemplo n.º 16
0
 internal override void Invoke()
 {
     this.m_client    = ExternalClientFactory.ConstructHanServiceClient(ExternalLib.Endpoint.HANEndpointName, ExternalLib.Endpoint.ExternalUserName, ExternalLib.Endpoint.ExternalUserPassword);
     this.m_rqstToken = this.m_client.ServiceClient.AddDeviceWithInstallationCodeByMeter(m_Request);
     this.m_client.ServiceClient.Close();
 }
Exemplo n.º 17
0
 public static bool SetClientEndpointAddress(string clientEndpointName, string address)
 {
     return(ExternalClientFactory.SetClientEndpointAddress(clientEndpointName, address));
 }
Exemplo n.º 18
0
 internal override void Invoke()
 {
     this.m_client = ExternalClientFactory.ConstructProvisioningServiceClient(ExternalLib.Endpoint.ProvisioningEndpointName, ExternalLib.Endpoint.ExternalUserName, ExternalLib.Endpoint.ExternalUserPassword);
     m_Result      = this.m_client.ServiceClient.ChangeConfigurationGroup(m_ConfigGroupInput);
     this.m_client.ServiceClient.Close();
 }