Example #1
0
        private void SocketOnResponseReceived(QsysSocket socket, QsysResponse response)
        {
#if DEBUG
            //CloudLog.Debug("{0}.SocketOnResponseReceived(), ID = {1}{2}", GetType().Name, response.Id,
            //    response.IsError ? string.Format(", Error: {0}", response.ErrorMessage) : " OK");
#endif
            if (_awaitingEvents.ContainsKey(response.Id))
            {
#if DEBUG
                //CrestronConsole.PrintLine("Found awaiting CEvent for response ID {0}", response.Id);
#endif
                _awaitingResponsesLocked.Enter();
                _awaitingResponses[response.Id] = response;
                _awaitingResponsesLocked.Leave();
                _awaitingEvents[response.Id].Set();
                return;
            }
            if (!_awaitingAsyncRequests.ContainsKey(response.Id))
            {
                return;
            }
            try
            {
                _awaitingAsyncRequests[response.Id](response);
            }
            catch (Exception e)
            {
                CloudLog.Exception(e);
            }
            _awaitingAsyncRequestsLocked.Enter();
            _awaitingAsyncRequests.Remove(response.Id);
            _awaitingAsyncRequestsLocked.Leave();
        }
Example #2
0
 private static void OnRequestResponse(QsysResponse response)
 {
     /*if (response.IsAck)
      * {
      *  CrestronConsole.PrintLine("ChangeGroup Response: OK");
      *  CrestronConsole.PrintLine(" {0}:\r\n{1}", response.Request.Method, response.Request.Args);
      * }
      * else if (response.IsError)
      *  CrestronConsole.PrintLine("ChangeGroup Response: {0}", response.ErrorMessage);
      */
 }
Example #3
0
        protected virtual void OnResponseReceived(QsysSocket socket, QsysResponse response)
        {
#if DEBUG
            //Debug.WriteSuccess(string.Format("{0}.OnResponseReceived()", GetType().Name));
            //Debug.WriteNormal(Debug.AnsiBlue + response + Debug.AnsiReset);
#endif
            var handler = ResponseReceived;
            if (handler != null)
            {
                handler(socket, response);
            }
        }
Example #4
0
 private void OnUpdateResponse(QsysResponse response)
 {
     if (response.IsError)
     {
         return;
     }
     if (response.IsAck)
     {
         //CrestronConsole.PrintLine("{0}.{1} - Control.Set Response OK", Component.Name, Name);
         var id = UpdateAsync();
         //CrestronConsole.PrintLine("Requested update: {0}", id);
     }
     else
     {
         //CrestronConsole.PrintLine("Received update: {0}", response.Id);
         UpdateFromData(response.Result["Controls"].First);
         //CrestronConsole.PrintLine("UpdateFromData(data)\r\n{0}", response.Result.ToString(Formatting.Indented));
     }
 }