Пример #1
0
 /// <summary>
 /// Send SUT Control Request Message
 /// </summary>
 /// <param name="sutControlRequest">Request message</param>
 /// <returns>True if success, otherwise false</returns>
 public bool SendSUTControlRequestMessage(SUT_Control_Request_Message sutControlRequest)
 {
     byte[] rawData = sutControlRequest.Encode();
     try
     {
         netDataStream.Write(rawData, 0, rawData.Length);
         return(true);
     }
     catch
     {
     }
     return(false);
 }
        private void TriggerRDPDisconnectAllByProtocol()
        {
            string helpMessage = "Trigger RDP client to disconnect all connections.";

            byte[] payload = null;
            ushort reqId   = ++requestId;
            SUT_Control_Request_Message requestMessage = new SUT_Control_Request_Message(SUTControl_TestsuiteId.RDP_TESTSUITE, (ushort)RDPSUTControl_CommandId.CLOSE_RDP_CONNECTION, "RDPClientPlugin",
                                                                                         reqId, helpMessage, payload);
            TCPSUTControlTransport transport = new TCPSUTControlTransport();
            IPAddress  sutIP         = GetHostIP(detectInfo.SUTName);
            IPEndPoint agentEndpoint = new IPEndPoint(sutIP, detectInfo.AgentListenPort);

            transport.Connect(timeout, agentEndpoint);
            transport.SendSUTControlRequestMessage(requestMessage);
            transport.Disconnect();
        }
        private void TriggerRDPConnectionByProtocol()
        {
            RDP_Connection_Payload payLoad = new RDP_Connection_Payload();

            payLoad.type = RDP_Connect_Payload_Type.PARAMETERS_STRUCT;
            payLoad.configureParameters = GenerateRDPConnectionConfigParameters(LocalIPAddress(), port, false, false);
            byte[] payload = payLoad.Encode();

            ushort reqId       = ++requestId;
            string helpMessage = "Trigger RDP client to start an RDP connection by SUT Remote Control Protocol.";
            SUT_Control_Request_Message requestMessage = new SUT_Control_Request_Message(SUTControl_TestsuiteId.RDP_TESTSUITE, (ushort)RDPSUTControl_CommandId.START_RDP_CONNECTION, "RDPClientPlugin",
                                                                                         reqId, helpMessage, payload);

            TCPSUTControlTransport transport = new TCPSUTControlTransport();
            IPAddress sutIP = GetHostIP(detectInfo.SUTName);

            IPEndPoint agentEndpoint = new IPEndPoint(sutIP, detectInfo.AgentListenPort);

            transport.Connect(timeout, agentEndpoint);
            transport.SendSUTControlRequestMessage(requestMessage);
            transport.Disconnect();
        }