public override EusbPdu ParsePdu(byte[] data)
        {
            EusbPdu pdu;

            switch (GetPduType(data))
            {
                case EusbType.RIM_EXCHANGE_CAPABILITY_REQUEST:
                    pdu = new EusbRimExchangeCapRequestPdu();
                    break;
                case EusbType.CHANNEL_CREATED:
                    pdu = new EusbChannelCreatedPdu(true);
                    break;
                case EusbType.REGISTER_REQUEST_CALLBACK:
                    pdu = new EusbRegisterRequestCallbackPdu();
                    break;
                case EusbType.QUERY_DEVICE_TEXT:
                    pdu = new EusbQueryDeviceTextRequestPdu();
                    break;
                case EusbType.IO_CONTROL:
                    pdu = new EusbIoControlPdu();
                    break;
                case EusbType.INTERNAL_IO_CONTROL:
                    pdu = new EusbInternalIoControlPdu();
                    break;
                case EusbType.TRANSFER_IN_REQUEST:
                    pdu = new EusbTransferInRequestPdu();
                    break;
                case EusbType.TRANSFER_OUT_REQUEST:
                    pdu = new EusbTransferOutRequestPdu();
                    break;
                case EusbType.CANCEL_REQUEST:
                    pdu = new EusbCancelRequestPdu();
                    break;
                case EusbType.RETRACT_DEVICE:
                    pdu = new EusbRetractDevicePdu();
                    break;
                default:
                    return base.ParsePdu(data);
            }

            if (!PduMarshaler.Unmarshal(data, pdu))
            {
                pdu = new EusbUnknownPdu();
                PduMarshaler.Unmarshal(data, pdu);
            }
            return pdu;
        }
        /// <summary>
        /// Queries the USB device's text from the client.
        /// </summary>
        /// <param name="device">The context of the device which is being operated.</param>
        /// <param name="textType">This value represents the type of text to query as described in [MSFT-W2KDDK], Volume 1, 
        /// Part 1, Chapter 2.</param>
        /// <param name="localeId">This value represents the locale of the text to query as described in [MSFT-W2KDDK], 
        /// Volume 1, Part 1, Chapter 2.</param>
        public void QueryDeviceText(EusbDeviceContext device, uint textType, uint localeId)
        {
            Site.Log.Add(LogEntryKind.Debug, "Sending QUERY_DEVICE_TEXT. Device: {0}, Text type: {1}, Locale ID: {2}.", device, textType, localeId);

            EusbQueryDeviceTextRequestPdu requestPdu = new EusbQueryDeviceTextRequestPdu(device.UsbDeviceInterfaceId);
            requestPdu.TextType = textType;
            requestPdu.LocaleId = localeId;
            SendPdu(requestPdu, device.VirtualChannel);

            Site.Log.Add(LogEntryKind.Debug, "Receiving EusbQueryDeviceTextResponsePdu.");
            EusbQueryDeviceTextResponsePdu responsePdu = this.rdpeusbServer.ExpectRdpeusbPdu<EusbQueryDeviceTextResponsePdu>(device.VirtualChannel.ChannelId, waitTime);

            #region Verify QUERY_DEVICE_TEXT_RSP

            Site.Assert.IsNotNull(
                responsePdu,
                "Expect that the response from the client is EusbQueryDeviceTextResponsePdu.");

            Site.Assert.AreEqual<uint>(
                requestPdu.InterfaceId,
                responsePdu.InterfaceId,
                "Expect that the InterfaceId in the response PDU equals the InterfaceId in the request. The actual value is 0x{0:x8}.",
                responsePdu.InterfaceId);

            Site.Assert.AreEqual<uint>(
                requestPdu.MessageId,
                responsePdu.MessageId,
                "Expect that the MessageId in the response PDU equals the MessageId in the request. The actual value is 0x{0:x8}.",
                responsePdu.MessageId);

            Site.Assert.AreEqual<Mask_Values>(
                Mask_Values.STREAM_ID_STUB,
                responsePdu.Mask,
                "Expect that the Mask in the response PDU is STREAM_ID_STUB.");

            Site.Assert.AreNotEqual<uint>(
                0x00000000,
                responsePdu.cchDeviceDescription,
                "Expect that the cchDeviceDescription in the response PDU is not zero. The actual value is 0x{0:x8}.",
                responsePdu.cchDeviceDescription);

            Site.Assert.AreEqual<uint>(
                0x00000000,
                responsePdu.HResult,
                "Expect that the HResult in the response PDU is zero. The actual value is 0x{0:x8}.",
                responsePdu.HResult);

            #endregion
        }