public override ErrorCode Submit()
        {
            int       iTransferred;
            ErrorCode eReturn = ErrorCode.Success;

            if (mTransferCancelEvent.WaitOne(0, false))
            {
                return(ErrorCode.IoCancelled);
            }
            if (!mTransferCompleteEvent.WaitOne(0, UsbConstants.EXIT_CONTEXT))
            {
                return(ErrorCode.ResourceBusy);
            }

            mHasWaitBeenCalled = false;
            mTransferCompleteEvent.Reset();
            Overlapped.ClearAndSetEvent(mTransferCompleteEvent.SafeWaitHandle.DangerousGetHandle());

            int ret = EndpointBase.PipeTransferSubmit(NextBufPtr,
                                                      RequestCount,
                                                      out iTransferred,
                                                      mIsoPacketSize,
                                                      Overlapped.GlobalOverlapped);

            if (ret != 0 && ret != (int)UsbStatusClodes.ErrorIoPending)
            {
                mTransferCompleteEvent.Set();
                UsbError usbErr = UsbError.Error(ErrorCode.Win32Error, Marshal.GetLastWin32Error(), "PipeTransferSubmit", EndpointBase);

                eReturn = usbErr.ErrorCode;
            }
            return(eReturn);
        }
示例#2
0
        /// <summary>
        /// Gets the endpoint URL.
        /// </summary>
        /// <param name="endpoint">The endpoint.</param>
        /// <param name="parameters">The parameters. The parameter key should be without curly braces.</param>
        /// <returns>
        /// An <see cref="Uri" /> instance.
        /// </returns>
        public Uri GetEndpointUrl(EndpointBase endpoint, IDictionary <string, string> parameters = null)
        {
            if ((parameters == null) || !parameters.Any())
            {
                return(new Uri(this.baseUrl, endpoint.Path));
            }

            var formattedPath = new StringBuilder(endpoint.Path);

            foreach (var parameter in parameters)
            {
                formattedPath.Replace(string.Format(CultureInfo.InvariantCulture, "{{{0}}}", parameter.Key), parameter.Value);
            }

            return(new Uri(this.baseUrl, formattedPath.ToString()));
        }
示例#3
0
        /// <summary>
        /// Sends the JSON request asynchronously.
        /// </summary>
        /// <param name="httpMethod">The HTTP method.</param>
        /// <param name="endpoint">The endpoint configuration.</param>
        /// <param name="accessToken">The access token.</param>
        /// <param name="endpointParameters">The endpoint parameters.</param>
        /// <param name="queryString">The query string.</param>
        /// <param name="requestContent">Content of the request.</param>
        /// <returns>The response content.</returns>
        protected virtual async Task <string> SendJsonRequestAsync(
            HttpMethod httpMethod,
            EndpointBase endpoint,
            string accessToken,
            IDictionary <string, string> endpointParameters = null,
            NameValueCollection queryString = null,
            string requestContent           = null)
        {
            var uri = this.endpointsConfiguration.GetEndpointUrl(endpoint, endpointParameters);

            if (queryString != null)
            {
                uri = new UriBuilder(uri)
                {
                    Query = queryString.ToString()
                }.Uri;
            }

            return(await this.SendJsonRequestAsync(httpMethod, uri, accessToken, requestContent));
        }
 /// <summary>
 /// Initializes a new instance of the ProcessFilter class.
 /// </summary>
 public ProcessFilter(EndpointBase endpoint)
 {
     _endpoint = endpoint;
 }
示例#5
0
		/// <summary>
		/// Initializes a new instance of the ProcessFilter class.
		/// </summary>
		public ProcessFilter(EndpointBase endpoint) {
			_endpoint = endpoint;
		}
示例#6
0
 public MessageFilter(EndpointBase endpoint)
 {
     _endpoint = endpoint;
 }
示例#7
0
		public MessageFilter(EndpointBase endpoint) {
			_endpoint = endpoint;
		}
 public AuthenticationFilter(EndpointBase endpoint)
 {
     this._endpoint = endpoint;
 }
示例#9
0
		/// <summary>
		/// Initializes a new instance of the ServiceMapFilter class.
		/// </summary>
		/// <param name="endpoint"></param>
		public ServiceMapFilter(EndpointBase endpoint) {
			_endpoint = endpoint;
		}
示例#10
0
 /// <summary>
 /// Initializes a new instance of the ServiceMapFilter class.
 /// </summary>
 /// <param name="endpoint"></param>
 public ServiceMapFilter(EndpointBase endpoint)
 {
     _endpoint = endpoint;
 }
示例#11
0
		/// <summary>
		/// Initializes a new instance of the AuthenticationFilter class.
		/// </summary>
		/// <param name="endpoint"></param>
		public AuthenticationFilter(EndpointBase endpoint) {
			_endpoint = endpoint;
		}