Esempio n. 1
0
 public override void Cancel()
 {
     if (null != this._jobKey)
     {
         Client <InternalAPIManagerServiceClient> c = null;
         c = InternalClientFactory.ConstructInternalAPIManagerServiceClient(InternalLib.Endpoint.InternalEndpointName, InternalLib.Endpoint.InternalUserName, InternalLib.Endpoint.InternalUserPassword);
         c.ServiceClient.IInternalAPIManagerServiceCancelJob(this._jobKey);
         c.ServiceClient.Close();
     }
 }
Esempio n. 2
0
        public override void Cancel()
        {
            if (!string.IsNullOrEmpty(UniqueID))
            {
                RequestToken requestToken = new RequestToken();
                requestToken.Id = new Guid(UniqueID);

                Client <RequestServiceClient> c = null;
                c = InternalClientFactory.ConstructRequestServiceClient(InternalLib.Endpoint.RequestEndpointName, InternalLib.Endpoint.ExternalUserName, InternalLib.Endpoint.ExternalUserPassword);
                c.ServiceClient.CancelRequest(requestToken);
                c.ServiceClient.Close();
            }
        }
Esempio n. 3
0
        internal override void Invoke()
        {
            if (string.IsNullOrEmpty(UniqueID))
            {
                _requestID = Guid.NewGuid().ToString();

                _client = InternalClientFactory.ConstructInternalAPIManagerServiceClient(InternalLib.Endpoint.InternalEndpointName, InternalLib.Endpoint.InternalUserName, InternalLib.Endpoint.InternalUserPassword);
                _client.ServiceClient.InternalInteractiveRead(this._esn, this._params, this._requestID, InternalLib.Listener.InternalAPIController.HttpUri);
                _client.ServiceClient.Close();

                _uniqueID = _requestID;
            }
        }
Esempio n. 4
0
        private void GetFirmwareDownloadsReport()
        {
            //TODO: Request that firmware download API accept callback parameter then wouldn't have to request a report and poll.
            Client <ReportServiceClient> c = null;

            c = InternalClientFactory.ConstructReportServiceClient(InternalLib.Endpoint.ReportEndpointName, InternalLib.Endpoint.ExternalUserName, InternalLib.Endpoint.ExternalUserPassword);
            FirmwareDownloadsReportInput fwdlReportInput = new FirmwareDownloadsReportInput();

            //Request all fwdl jobs between the begin
            fwdlReportInput.StartTime = _fwdl.FWDLBegin;
            fwdlReportInput.StopTime  = DateTime.Now;
            this._fwdlsRunningReport  = c.ServiceClient.GetFirmwareDownloadsReport(fwdlReportInput);
            c.ServiceClient.Close();
        }
Esempio n. 5
0
        public int GetEndpointsCompletedForCurrentJob()
        {
            int iEndpointsComplete = 0;
            //TODO: Request that firmware download API accept callback parameter then wouldn't have to request a report and poll.
            Client <ReportServiceClient> c = null;

            c = InternalClientFactory.ConstructReportServiceClient(InternalLib.Endpoint.ReportEndpointName, InternalLib.Endpoint.ExternalUserName, InternalLib.Endpoint.ExternalUserPassword);
            FirmwareDownloadsReportInput fwdlReportInput = new FirmwareDownloadsReportInput();

            //Request all fwdl jobs between the begin
            fwdlReportInput.StartTime = FWDLBegin;
            fwdlReportInput.StopTime  = DateTime.Now;
            FirmwareDownloadsReport _fwdlsRunningReport = c.ServiceClient.GetFirmwareDownloadsReport(fwdlReportInput);

            c.ServiceClient.Close();


            //TODO: FirmwareDownloadItems[0].Status is an EnumJobStatus type that is not exposed in web services, thus test status against hard string.  Request EnumJobStatus be exposed.
            if (null != _fwdlsRunningReport)
            {
                if (0 < _fwdlsRunningReport.FirmwareDownloadItems.Length)
                {
                    //firmware download running
                    foreach (FirmwareDownloadItem fwdlItem in _fwdlsRunningReport.FirmwareDownloadItems)
                    {
                        if (fwdlItem.JobId == CurrentFWDLJob.JobKey.value.ToString())
                        {
                            iEndpointsComplete = fwdlItem.CountOfEndpointsComplete;
                            break;
                        }
                    }
                }
            }

            return(iEndpointsComplete);
        }
Esempio n. 6
0
 public static bool SetClientEndpointAddress(string clientEndpointName, string address)
 {
     return(InternalClientFactory.SetClientEndpointAddress(clientEndpointName, address));
 }
Esempio n. 7
0
        internal override void Invoke()
        {
            if (string.IsNullOrEmpty(UniqueID))
            {
                _jobResult   = null;
                this._client = InternalClientFactory.ConstructInternalAPIManagerServiceClient(InternalLib.Endpoint.InternalEndpointName, InternalLib.Endpoint.InternalUserName, InternalLib.Endpoint.InternalUserPassword);

                if (FirmwareDownload.FWDL_JOB_TYPE.Enter == _fwdlDaddy.JobType)
                {
                    FirmwareJobKey fwjobKey;

                    // Restart the CE simulator to look for this job
                    RestartCESimulator(this);

                    _jobResult = this._client.ServiceClient.StartFirmwareDownload(out fwjobKey, out _jobKey, _fwdlDaddy.EndpointGroupKey, _fwdlDaddy.FirmwareKey);
                    _fwdlDaddy.FirmwareJobKey = fwjobKey;
                }
                else if (FirmwareDownload.FWDL_JOB_TYPE.Download == _fwdlDaddy.JobType)
                {
                    // Restart the CE simulator to look for this job
                    RestartCESimulator(this);

                    _jobResult = this._client.ServiceClient.FirmwareDownload(out _jobKey, _fwdlDaddy.FirmwareJobKey);
                }
                else if (FirmwareDownload.FWDL_JOB_TYPE.Transfer == _fwdlDaddy.JobType)
                {
                    // Restart the CE simulator to look for this job
                    RestartCESimulator(this);

                    //Transfer immediately
                    _jobResult = this._client.ServiceClient.TransferHanFirmware(out _jobKey, _fwdlDaddy.FirmwareJobKey, DateTime.UtcNow, true);
                }
                else if (FirmwareDownload.FWDL_JOB_TYPE.Activate == _fwdlDaddy.JobType)
                {
                    // Restart the CE simulator to look for this job
                    RestartCESimulator(this);

                    //Activate immediately
                    _jobResult = this._client.ServiceClient.FirmwareActivate(out _jobKey, _fwdlDaddy.FirmwareJobKey, ((FirmwareDownloadActivate)this).ActivationTime, true);
                }
                else if (FirmwareDownload.FWDL_JOB_TYPE.Exit == _fwdlDaddy.JobType)
                {
                    // Restart the CE simulator to look for this job
                    RestartCESimulator(this);

                    _jobResult = this._client.ServiceClient.CancelFirmwareDownload(out _jobKey, _fwdlDaddy.FirmwareJobKey);
                }
                else if (FirmwareDownload.FWDL_JOB_TYPE.ChangePhase == _fwdlDaddy.JobType)
                {
                    if (null != _fwdlDaddy.FirmwareJobKey)
                    {
                        _jobResult    = this._client.ServiceClient.ChangeFirmwareDownloadPhase(_fwdlDaddy.FirmwareJobKey, _fwdlDaddy.Phase);
                        _jobKey       = new JobKey();
                        _jobKey.value = 0;
                    }
                    else
                    {
                        _jobResult    = new Result();
                        _jobKey       = new JobKey();
                        _jobKey.value = 0;

                        if (FirmwareDownloadPhase.Initial == _fwdlDaddy.Phase)
                        {
                            JobResult.ActionResultType = EnumResultCodeType.SUCCESS;
                        }
                        else
                        {
                            JobResult.ActionResultType = EnumResultCodeType.FAILURE;
                        }
                    }
                }

                this._client.ServiceClient.Close();
                _uniqueID = _jobKey.value.ToString();
            }
        }