Exemplo n.º 1
0
 /// <summary>
 /// Send a command to the driver
 /// </summary>
 /// <param name="requestData">Details of the command to send</param>
 public void DriverCommand(RequestData requestData)
 {
     try // Process the command
     {
         if (ServerForm.DebugTraceState)
         {
             ServerForm.LogMessage1(requestData, requestData.Elements[ServerForm.URL_ELEMENT_METHOD], string.Format("DriverCommand has received a command for {0} on thread {1}", deviceKey, Thread.CurrentThread.ManagedThreadId));
         }
         Application.DoEvents();
         restServer.ProcessDriverCommand(requestData);
         if (ServerForm.DebugTraceState)
         {
             ServerForm.LogMessage1(requestData, requestData.Elements[ServerForm.URL_ELEMENT_METHOD], string.Format("DriverCommand has completed the command for {0} on thread {1}", deviceKey, Thread.CurrentThread.ManagedThreadId));
         }
     }
     catch (Exception ex) // Something serious has gone wrong with the ASCOM Rest server itself so report this to the user
     {
         ServerForm.LogException1(requestData, "DriverCommand", ex.ToString());
         restServer.Return500Error(requestData, "Internal server error (DriverOnSeparateThread): " + ex.ToString());
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Send a command to the driver
 /// </summary>
 /// <param name="requestData">Details of the command to send</param>
 public void DriverCommand(RequestData requestData)
 {
     try // Process the command
     {
         if (ServerForm.DebugTraceState)
         {
             ServerForm.LogMessage(requestData.ClientID, requestData.ClientTransactionID, requestData.ServerTransactionID, "DriverCommand", string.Format("Received command for {0} on thread {1}", deviceKey, Thread.CurrentThread.ManagedThreadId));
         }
         Application.DoEvents();
         restServer.ProcessDriverCommand(requestData.ClientID, requestData.ClientTransactionID, requestData.ServerTransactionID, requestData.SuppliedParameters, requestData.Request, requestData.Response, requestData.Elements, requestData.DeviceKey);
         if (ServerForm.DebugTraceState)
         {
             ServerForm.LogMessage(requestData.ClientID, requestData.ClientTransactionID, requestData.ServerTransactionID, "DriverCommand", string.Format("Completed command for {0} on thread {1}", deviceKey, Thread.CurrentThread.ManagedThreadId));
         }
     }
     catch (Exception ex) // Something serious has gone wrong with the ASCOM Rest server itself so report this to the user
     {
         ServerForm.LogException(requestData.ClientID, requestData.ClientTransactionID, requestData.ServerTransactionID, "DriverCommand", ex.ToString());
         restServer.Return500Error(requestData.Request, requestData.Response, "Internal server error (DriverOnSeparateThread): " + ex.ToString(), requestData.ClientID, requestData.ClientTransactionID, requestData.ServerTransactionID);
     }
 }
Exemplo n.º 3
0
 void ProcessCommand(object requestData)
 {
     restServer.ProcessDriverCommand((RequestData)requestData);
 }