/// <summary> /// Method to create a RDPINPUT_RESUME_TOUCH_PDU. /// </summary> /// <returns>RDPINPUT_RESUME_TOUCH_PDU</returns> public RDPINPUT_RESUME_TOUCH_PDU CreateRdpInputResumeTouchPdu() { RDPINPUT_RESUME_TOUCH_PDU pdu = new RDPINPUT_RESUME_TOUCH_PDU(); pdu.header.eventId = EventId_Values.EVENTID_RESUME_TOUCH; pdu.header.pduLength = pdu.Length(); return(pdu); }
/// <summary> /// Method to send a RDPINPUT_RESUME_TOUCH_PDU to client. /// </summary> /// <param name="pdu">A RDPINPUT_RESUME_TOUCH_PDU structure.</param> public void SendRdpInputResumeTouchPdu(RDPINPUT_RESUME_TOUCH_PDU pdu) { byte[] data = PduMarshaler.Marshal(pdu); // Sleep some time to avoid this packet to be merged with other packets in TCP level. System.Threading.Thread.Sleep(PacketsInterval); if (rdpeiDVC == null) { throw new InvalidOperationException("DVC instance of RDPEI is null, Dynamic virtual channel must be created before sending data."); } rdpeiDVC.Send(data); }
public void Rdpei_TouchControlTest_Negative_DuplicatedResume() { Site.Log.Add(LogEntryKind.Debug, "Establishing RDP connection ..."); StartRDPConnection(); Site.Log.Add(LogEntryKind.Debug, "Creating dynamic virtual channels for MS-RDPEI ..."); bool bProtocolSupported = this.rdpeiServer.CreateRdpeiDvc(waitTime); TestSite.Assert.IsTrue(bProtocolSupported, "Client should support this protocol."); // RDPEI initializing phase Site.Log.Add(LogEntryKind.Debug, "Sending a RDPINPUT_SC_READY_PDU."); RDPINPUT_SC_READY_PDU scReadyPdu = this.rdpeiServer.CreateRdpInputScReadyPdu(); this.rdpeiServer.SendRdpInputScReadyPdu(scReadyPdu); Site.Log.Add(LogEntryKind.Debug, "Expecting RDPINPUT_CS_READY_PDU ..."); RDPINPUT_CS_READY_PDU csReadyPdu = this.rdpeiServer.ExpectRdpInputCsReadyPdu(waitTime); TestSite.Assert.IsTrue(csReadyPdu != null, "Client is expected to send RDPINPUT_CS_READY_PDU to the server."); // RDPEI running phase Site.Log.Add(LogEntryKind.Debug, "Sending a RDPINPUT_SUSPEND_TOUCH_PDU."); RDPINPUT_SUSPEND_TOUCH_PDU suspendPdu = this.rdpeiServer.CreateRdpInputSuspendTouchPdu(); this.rdpeiServer.SendRdpInputSuspendTouchPdu(suspendPdu); Site.Log.Add(LogEntryKind.Debug, "Sending a RDPINPUT_RESUME_TOUCH_PDU."); RDPINPUT_RESUME_TOUCH_PDU resumePdu = this.rdpeiServer.CreateRdpInputResumeTouchPdu(); this.rdpeiServer.SendRdpInputResumeTouchPdu(resumePdu); // Send a duplicated resume message to test the client will ignore it, since the Touch Remoting Suspended ADM element is already set to FALSE. Site.Log.Add(LogEntryKind.Debug, "Sending a RDPINPUT_RESUME_TOUCH_PDU."); this.rdpeiServer.SendRdpInputResumeTouchPdu(resumePdu); this.rdpeiSUTControlAdapter.TriggerOneTouchEventOnClient(this.TestContext.TestName); Site.Log.Add(LogEntryKind.Debug, "Expecting RDPINPUT_TOUCH_EVENT_PDU ..."); RDPINPUT_TOUCH_EVENT_PDU touchEventPdu = this.rdpeiServer.ExpectRdpInputTouchEventPdu(waitTime); VerifyRdpInputTouchEventPdu(touchEventPdu, true); if (isManagedAdapter) { RdpeiUtility.SendConfirmImage(); } }
/// <summary> /// The callback method to receive data from transport layer. /// </summary> private void OnDataReceived(byte[] data, uint channelID) { lock (receivedList) { RDPINPUT_PDU pdu = new RDPINPUT_PDU(); bool fResult = PduMarshaler.Unmarshal(data, pdu); if (fResult) { byte[] pduData = new byte[pdu.header.pduLength]; Array.Copy(data, pduData, pduData.Length); RDPINPUT_PDU msg = pdu; if (pdu.header.eventId == EventId_Values.EVENTID_SC_READY) { RDPINPUT_SC_READY_PDU request = new RDPINPUT_SC_READY_PDU(); if (PduMarshaler.Unmarshal(pduData, request)) { msg = request; } } else if (pdu.header.eventId == EventId_Values.EVENTID_SUSPEND_TOUCH) { RDPINPUT_SUSPEND_TOUCH_PDU request = new RDPINPUT_SUSPEND_TOUCH_PDU(); if (PduMarshaler.Unmarshal(pduData, request)) { msg = request; } } else if (pdu.header.eventId == EventId_Values.EVENTID_RESUME_TOUCH) { RDPINPUT_RESUME_TOUCH_PDU request = new RDPINPUT_RESUME_TOUCH_PDU(); if (PduMarshaler.Unmarshal(pduData, request)) { msg = request; } } receivedList.Add(msg); } } }