Esempio n. 1
0
        public override int ReceiveAlert(CecAlert alert, CecParameter data)
        {
            switch (alert)
            {
            case CecAlert.ServiceDevice:
                MessageBox.Show(Resources.alert_service_device, Resources.cec_alert, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                break;

            case CecAlert.ConnectionLost:
                MessageBox.Show(Resources.alert_connection_lost, Resources.cec_alert, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                break;

            case CecAlert.PermissionError:
                MessageBox.Show(Resources.alert_permission_error, Resources.cec_alert, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                break;

            case CecAlert.PortBusy:
                MessageBox.Show(Resources.alert_port_busy, Resources.cec_alert, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                break;

            case CecAlert.PhysicalAddressError:
                MessageBox.Show(Resources.alert_physical_address_error, Resources.cec_alert, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                break;

            case CecAlert.TVPollFailed:
                MessageBox.Show(Resources.alert_tv_poll_failed, Resources.cec_alert, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                break;
            }
            return(1);
        }
Esempio n. 2
0
        public override int ReceiveAlert(CecAlert alert, CecParameter data)
        {
            WriteLog("Received libcec Alert: " + alert.ToString());

            if (alert == CecAlert.ConnectionLost)
            {
                WriteLog("Cecremote: RECONNECT");

                short retries = 1;
                bool  reconn  = false;

                DeInit();

                while (retries < 4 && !reconn)
                {
                    OnStart();
                    reconn = _connected;

                    WriteLog("Reconnection attempt " + retries.ToString() + " ... connected: " + reconn.ToString());

                    retries++;
                }
            }

            return(1);
        }
Esempio n. 3
0
 public override int ReceiveAlert(CecAlert alert, CecParameter data)
 {
     if (!CecWarnings.Contains(alert))
     {
         CecWarnings.AddLast(alert);
         UpdateAlertStatus();
     }
     return(1);
 }
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="alert"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public override int ReceiveAlert(CecAlert alert, CecParameter data)
        {
            string log = "CEC alert: " + alert.ToString();

            if (data != null && data.Type == CecParameterType.ParameterTypeString)
            {
                log += " " + data.Data;
            }

            Trace.WriteLine(log);

            Close();
            //Try reconnect
            Open(1000);
            return(1);
        }
Esempio n. 5
0
 public override int ReceiveAlert(CecAlert alert, CecParameter data)
 {
   switch (alert)
   {
     case CecAlert.ServiceDevice:
       MessageBox.Show(Resources.alert_service_device, Resources.cec_alert, MessageBoxButtons.OK, MessageBoxIcon.Warning);
       break;
     case CecAlert.ConnectionLost:
       MessageBox.Show(Resources.alert_connection_lost, Resources.cec_alert, MessageBoxButtons.OK, MessageBoxIcon.Warning);
       break;
     case CecAlert.PermissionError:
       MessageBox.Show(Resources.alert_permission_error, Resources.cec_alert, MessageBoxButtons.OK, MessageBoxIcon.Warning);
       break;
     case CecAlert.PortBusy:
       MessageBox.Show(Resources.alert_port_busy, Resources.cec_alert, MessageBoxButtons.OK, MessageBoxIcon.Warning);
       break;
     case CecAlert.PhysicalAddressError:
       MessageBox.Show(Resources.alert_physical_address_error, Resources.cec_alert, MessageBoxButtons.OK, MessageBoxIcon.Warning);
       break;
     case CecAlert.TVPollFailed:
       MessageBox.Show(Resources.alert_tv_poll_failed, Resources.cec_alert, MessageBoxButtons.OK, MessageBoxIcon.Warning);
       break;
   }
   return 1;
 }
Esempio n. 6
0
    public override int ReceiveAlert(CecAlert alert, CecParameter data)
    {
      WriteLog("Received libcec Alert: " + alert.ToString());

      if (alert == CecAlert.ConnectionLost)
      {
          WriteLog("Cecremote: RECONNECT");
          
          short retries = 1;
          bool reconn = false;

          DeInit();

          while (retries < 4 && !reconn)
          {
              OnStart();
              reconn = _connected;

              WriteLog("Reconnection attempt " + retries.ToString() + " ... connected: " + reconn.ToString());
              
              retries++;
          }
          
      }
      
      return 1;
    }