예제 #1
0
파일: WwwObject.cs 프로젝트: McRain/ulib
        private UWebRequest Request(object target, string method, object parameter, RemoteCallback callBack, string back)
        {
            if (_requestPool.Count > 0)
            {
                var request = _requestPool[0];
                _activedRequest.Add(request);
                ActivedCointer++;
                _requestPool.Remove(request);
                RequestCointer--;
                StartCoroutine(request.WaitTime(target is string?target.ToString() : target.GetType().Name, method,
                                                    parameter, callBack, back));
                StartCoroutine(request.StartRequest(target is string?target.ToString() : target.GetType().Name, method,
                                                        parameter, callBack, back));
                return(request);
            }
            var newReqest = /*string.IsNullOrEmpty(Gateway.AppName)
                             *  ? */new UWebRequest(Host + Path + File, this) /*
                                                                               * : new UWebRequest(Gateway.Host + Gateway.Path + Gateway.File, this,
                                                                               * new Hashtable {{Gateway.AppParameter, Gateway.AppName}})*/;

            _activedRequest.Add(newReqest);
            ActivedCointer++;
            StartCoroutine(newReqest.WaitTime(target is string?target.ToString() : target.GetType().Name, method,
                                                  parameter, callBack, back));
            StartCoroutine(newReqest.StartRequest(target is string?target.ToString() : target.GetType().Name, method,
                                                      parameter, callBack, back));
            return(newReqest);
        }
예제 #2
0
 public ManagedEditAndContinueDebuggerService(
     RemoteCallback <IRemoteEditAndContinueService.ICallback> callback,
     RemoteServiceCallbackId callbackId
     )
 {
     _callback   = callback;
     _callbackId = callbackId;
 }
예제 #3
0
파일: UWebRequest.cs 프로젝트: McRain/ulib
        public IEnumerator WaitTime(object target, string method, object parameter, RemoteCallback callback, string back)
        {
            yield return(new WaitForSeconds(5));

            if (!_loaded)
            {
                _parent.ResendRequest(this, target, method, parameter, callback, back);
            }
        }
예제 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        protected virtual void OnCallback(RemoteEventArgs e)
        {
            RemoteCallback handler = Callback;

            if (handler != null)
            {
                handler(RemoteTarget, e);
            }
        }
예제 #5
0
        private void OnPushedHandle(RemoteEventArgs e)
        {
            RemoteCallback handler = PushedHandle;

            if (handler != null)
            {
                handler(this, e);
            }
        }
예제 #6
0
 public DriverReplacement(Guid deviceGuid, string devicePath, RemoteCallback remoteCallback,
                          KeyboardCallback keyboardCallback, MouseCallback mouseCallback)
     : base(deviceGuid, devicePath, remoteCallback, keyboardCallback, mouseCallback)
 {
     if (devicePath.IndexOf(VidSMK, StringComparison.OrdinalIgnoreCase) != -1 ||
         devicePath.IndexOf(VidTopseed, StringComparison.OrdinalIgnoreCase) != -1)
     {
         _deviceType = DeviceType.SmkTopseed;
     }
     else
     {
         _deviceType = DeviceType.Microsoft;
     }
 }
예제 #7
0
        protected Driver(Guid deviceGuid, string devicePath, RemoteCallback remoteCallback,
                         KeyboardCallback keyboardCallback, MouseCallback mouseCallback)
        {
            if (String.IsNullOrEmpty(devicePath))
            {
                throw new ArgumentNullException("devicePath");
            }

            _deviceGuid = deviceGuid;

            _devicePath = devicePath;

            _remoteCallback   = remoteCallback;
            _keyboardCallback = keyboardCallback;
            _mouseCallback    = mouseCallback;
        }
예제 #8
0
    private static void DetectToshiba(int[] timingData, RemoteCallback remoteCallback)
    {
      for (int i = 0; i < timingData.Length; i++)
      {
        int duration = Math.Abs(timingData[i]);
        bool pulse = (timingData[i] > 0);
        bool ignored = true;

        switch (Toshiba_Data.State)
        {
            #region HeaderPulse

          case RemoteDetectionState.HeaderPulse:
            if (pulse && IsBetween(duration, 4300, 4700))
            {
              Toshiba_Data.State = RemoteDetectionState.HeaderSpace;
              ignored = false;
            }

            break;

            #endregion HeaderPulse

            #region HeaderSpace

          case RemoteDetectionState.HeaderSpace:
            if (!pulse && IsBetween(duration, 4300, 4700))
            {
              Toshiba_Data.State = RemoteDetectionState.Data;
              Toshiba_Data.HalfBit = 0;
              Toshiba_Data.Bit = 0;
              Toshiba_Data.Code = 0;
              ignored = false;
            }

            break;

            #endregion HeaderSpace

            #region Data

          case RemoteDetectionState.Data:
            if (pulse && IsBetween(duration, 350, 750))
            {
              Toshiba_Data.HalfBit = 1;
              ignored = false;
            }
            else if (!pulse && IsBetween(duration, 350, 750) && Toshiba_Data.HalfBit == 1)
            {
              Toshiba_Data.Code <<= 1;
              Toshiba_Data.Bit++;
              Toshiba_Data.HalfBit = 0;
              ignored = false;
            }
            else if (!pulse && IsBetween(duration, 1500, 1900) && Toshiba_Data.HalfBit == 1)
            {
              Toshiba_Data.Code <<= 1;
              Toshiba_Data.Code |= 1;
              Toshiba_Data.Bit++;
              Toshiba_Data.HalfBit = 0;
              ignored = false;
            }
            else if (!pulse && duration >= 6100 && Toshiba_Data.HalfBit == 1 && Toshiba_Data.Bit == 32)
            {
              uint custom = (Toshiba_Data.Code >> 24) & 0xFF;
              uint repeatCustom = (Toshiba_Data.Code >> 16) & 0xFF;

              uint data = (Toshiba_Data.Code >> 8) & 0xFF;
              uint notData = Toshiba_Data.Code & 0xFF;

              if (custom == repeatCustom && (data + notData == 0xFF))
              {
                uint code = (custom << 8) + data;
                remoteCallback(IrProtocol.Toshiba, code, false);
                Toshiba_Data.State = RemoteDetectionState.HeaderPulse;
                ignored = false;
              }
            }

            break;

            #endregion Data
        }

        if (ignored && (Toshiba_Data.State != RemoteDetectionState.HeaderPulse))
          Toshiba_Data.State = RemoteDetectionState.HeaderPulse;
      }
    }
예제 #9
0
    private static void DetectSIRC(int[] timingData, RemoteCallback remoteCallback)
    {
      for (int i = 0; i < timingData.Length; i++)
      {
        int duration = Math.Abs(timingData[i]);
        bool pulse = (timingData[i] > 0);
        bool ignored = true;

        switch (SIRC_Data.State)
        {
            #region HeaderPulse

          case RemoteDetectionState.HeaderPulse:
            if (pulse && IsBetween(duration, 2100, 2700))
            {
              SIRC_Data.State = RemoteDetectionState.HeaderSpace;
              ignored = false;
            }

            break;

            #endregion HeaderPulse

            #region HeaderSpace

          case RemoteDetectionState.HeaderSpace:
            if (!pulse && IsBetween(duration, 400, 800))
            {
              SIRC_Data.State = RemoteDetectionState.Data;
              SIRC_Data.Bit = 0;
              SIRC_Data.Code = 0;
              ignored = false;
            }

            break;

            #endregion HeaderSpace

            #region Data

          case RemoteDetectionState.Data:
            if (pulse && IsBetween(duration, 400, 800))
            {
              SIRC_Data.Code <<= 1;
              SIRC_Data.Bit++;
              ignored = false;
            }
            else if (pulse && IsBetween(duration, 1000, 1400))
            {
              SIRC_Data.Code <<= 1;
              SIRC_Data.Code |= 1;
              SIRC_Data.Bit++;
              ignored = false;
            }
            else if (!pulse && IsBetween(duration, 400, 800))
            {
              ignored = false;
            }
            else if (!pulse && duration >= 6000)
            {
              if ((SIRC_Data.Bit == 8) || (SIRC_Data.Bit == 12) || (SIRC_Data.Bit == 15) || (SIRC_Data.Bit == 20))
              {
                remoteCallback(IrProtocol.SIRC, SIRC_Data.Code, false);
                SIRC_Data.State = RemoteDetectionState.HeaderPulse;
                ignored = false;
              }
            }

            break;

            #endregion Data
        }

        if (ignored && (SIRC_Data.State != RemoteDetectionState.HeaderPulse))
          SIRC_Data.State = RemoteDetectionState.HeaderPulse;
      }
    }
예제 #10
0
    private static void DetectRECS80(int[] timingData, RemoteCallback remoteCallback)
    {
      for (int i = 0; i < timingData.Length; i++)
      {
        int duration = Math.Abs(timingData[i]);
        bool pulse = (timingData[i] > 0);
        bool ignored = true;

        switch (RECS80_Data.State)
        {
            #region HeaderPulse

          case RemoteDetectionState.HeaderPulse:
            if (pulse && IsBetween(duration, 3300, 4100))
            {
              RECS80_Data.State = RemoteDetectionState.HeaderSpace;
              ignored = false;
            }

            break;

            #endregion HeaderPulse

            #region HeaderSpace

          case RemoteDetectionState.HeaderSpace:
            if (!pulse && IsBetween(duration, 1400, 1800))
            {
              RECS80_Data.State = RemoteDetectionState.Data;
              RECS80_Data.HalfBit = 0;
              RECS80_Data.Bit = 48;
              RECS80_Data.Header = 0;
              RECS80_Data.Code = 0;
              ignored = false;
            }

            break;

            #endregion HeaderSpace

            #region Data

          case RemoteDetectionState.Data:
            if ((RECS80_Data.HalfBit % 2) == 0)
            {
              if (!pulse)
                break;

              if (IsBetween(duration, 350, 600))
              {
                RECS80_Data.HalfBit = 1;
                RECS80_Data.Bit--;
                ignored = false;
              }
              else
                break;
            }
            else
            {
              if (pulse)
                break;

              if (IsBetween(duration, 300, 750))
              {
                RECS80_Data.HalfBit = 0;
                ignored = false;
              }
              else if (IsBetween(duration, 1100, 1500))
              {
                RECS80_Data.HalfBit = 0;
                if (RECS80_Data.Bit > 15)
                  RECS80_Data.Header |= (uint) (1 << (RECS80_Data.Bit - 16));
                else
                  RECS80_Data.Code |= (uint) (1 << RECS80_Data.Bit);
                ignored = false;
              }
              else
              {
                break;
              }

              if (RECS80_Data.Bit == 0)
              {
                RECS80_Data.Code &= 0xFFFF;
                remoteCallback(IrProtocol.RECS80, RECS80_Data.Code, false);

                RECS80_Data.State = RemoteDetectionState.HeaderPulse;
              }
            }

            break;

            #endregion Data
        }

        if (ignored && (RECS80_Data.State != RemoteDetectionState.HeaderPulse))
          RECS80_Data.State = RemoteDetectionState.HeaderPulse;
      }
    }
예제 #11
0
    private static void DetectRCA(int[] timingData, RemoteCallback remoteCallback)
    {
      for (int i = 0; i < timingData.Length; i++)
      {
        int duration = Math.Abs(timingData[i]);
        bool pulse = (timingData[i] > 0);
        bool ignored = true;

        switch (RCA_Data.State)
        {
            #region HeaderPulse

          case RemoteDetectionState.HeaderPulse:
            if (pulse && IsBetween(duration, 3800, 4200))
            {
              RCA_Data.State = RemoteDetectionState.HeaderSpace;
              ignored = false;
            }
            break;

            #endregion HeaderPulse

            #region HeaderSpace

          case RemoteDetectionState.HeaderSpace:
            if (!pulse && IsBetween(duration, 3800, 4200))
            {
              RCA_Data.State = RemoteDetectionState.Data;
              RCA_Data.HalfBit = 0;
              RCA_Data.Bit = 0;
              RCA_Data.Code = 0;
              ignored = false;
            }
            break;

            #endregion HeaderSpace

            #region Data

          case RemoteDetectionState.Data:
            if (pulse && IsBetween(duration, 300, 700))
            {
              RCA_Data.HalfBit = 1;
              ignored = false;
            }
            else if (!pulse && IsBetween(duration, 800, 1250) && RCA_Data.HalfBit == 1)
            {
              RCA_Data.Code <<= 1;
              RCA_Data.Bit++;
              RCA_Data.HalfBit = 0;
              ignored = false;
            }
            else if (!pulse && IsBetween(duration, 1800, 2200) && RCA_Data.HalfBit == 1)
            {
              RCA_Data.Code <<= 1;
              RCA_Data.Code |= 1;
              RCA_Data.Bit++;
              RCA_Data.HalfBit = 0;
              ignored = false;
            }

            if (RCA_Data.Bit == 12)
            {
              remoteCallback(IrProtocol.RCA, RCA_Data.Code, false);
              RCA_Data.State = RemoteDetectionState.HeaderPulse;
            }
            break;

            #endregion Data
        }

        if (ignored && (RCA_Data.State != RemoteDetectionState.HeaderPulse))
          RCA_Data.State = RemoteDetectionState.HeaderPulse;
      }
    }
예제 #12
0
    private static void DetectRC6(int[] timingData, RemoteCallback remoteCallback)
    {
      for (int i = 0; i < timingData.Length; i++)
      {
        int duration = Math.Abs(timingData[i]);
        bool pulse = (timingData[i] > 0);
        bool ignored = true;

        //Trace.WriteLine(String.Format("RC6 - {0}: {1}", Enum.GetName(typeof(RemoteDetectionState), RC6_Data.State), timingData[i]));

        switch (RC6_Data.State)
        {
            #region HeaderPulse

          case RemoteDetectionState.HeaderPulse:
            if (pulse && IsBetween(duration, 2600, 3300))
            {
              RC6_Data.State = RemoteDetectionState.HeaderSpace;
              RC6_Data.Header = 0x000FC000;
              RC6_Data.Bit = 12;
              RC6_Data.HalfBit = 0;
              RC6_Data.Code = 0;
              RC6_Data.LongPulse = false;
              RC6_Data.LongSpace = false;
              RC6_Data.Toggle &= 0xFE;
              ignored = false;
            }
            break;

            #endregion HeaderPulse

            #region HeaderSpace

          case RemoteDetectionState.HeaderSpace:
            if (!pulse && IsBetween(duration, 750, 1000))
            {
              RC6_Data.State = RemoteDetectionState.PreData;
              ignored = false;
            }
            break;

            #endregion HeaderSpace

            #region PreData

          case RemoteDetectionState.PreData:
            if (pulse)
            {
              if (IsBetween(duration, 300, 600))
              {
                ignored = false;
                if (RC6_Data.Bit != 0) RC6_Data.Header |= (uint) (1 << --RC6_Data.Bit);
              }
              else if (IsBetween(duration, 750, 1000))
              {
                ignored = false;
                if (RC6_Data.Bit != 0) RC6_Data.Header |= (uint) (1 << --RC6_Data.Bit);
                if (RC6_Data.Bit != 0) RC6_Data.Header |= (uint) (1 << --RC6_Data.Bit);
              }
              else if (IsBetween(duration, 1200, 1600))
              {
                ignored = false;
                if (RC6_Data.Bit != 0) RC6_Data.Header |= (uint) (1 << --RC6_Data.Bit);
                if (RC6_Data.Bit != 0) RC6_Data.Header |= (uint) (1 << --RC6_Data.Bit);
                if (RC6_Data.Bit != 0) RC6_Data.Header |= (uint) (1 << --RC6_Data.Bit);
                else
                {
                  RC6_Data.HalfBit = 1;
                  RC6_Data.LongPulse = true;
                }
              }
            }
            else
            {
              if (IsBetween(duration, 300, 600))
              {
                RC6_Data.Bit--;
                ignored = false;
              }
              else if (IsBetween(duration, 750, 1000))
              {
                ignored = false;
                if (RC6_Data.Bit > 2)
                  RC6_Data.Bit -= 2;
                else
                  RC6_Data.Bit = 0;
              }
              else if (IsBetween(duration, 1200, 1600))
              {
                ignored = false;
                if (RC6_Data.Bit >= 3)
                {
                  RC6_Data.Bit -= 3;
                }
                else
                {
                  RC6_Data.HalfBit = 1;
                  RC6_Data.LongSpace = true;
                  RC6_Data.Bit = 0;
                  RC6_Data.Toggle |= 1;
                }
              }
            }

            if (!ignored && RC6_Data.Bit == 0)
              RC6_Data.State = RemoteDetectionState.Data;

            break;

            #endregion PreData

            #region Data

          case RemoteDetectionState.Data:
            if ((RC6_Data.HalfBit % 2) == 0)
            {
              if (pulse && IsBetween(duration, 300, 600))
              {
                ignored = false;
                RC6_Data.LongPulse = true;
                RC6_Data.HalfBit++;
              }
              else if (!pulse && IsBetween(duration, 300, 600))
              {
                ignored = false;
                RC6_Data.LongSpace = true;
                RC6_Data.HalfBit++;
              }
              else if (!pulse && duration > 4000)
              {
                if (RC6_Data.Bit == 16 || RC6_Data.Bit == 20 || RC6_Data.Bit == 24 || RC6_Data.Bit == 32)
                  RC6_Data.State = RemoteDetectionState.KeyCode;
              }

              break;
            }

            if (RC6_Data.LongPulse)
            {
              RC6_Data.LongPulse = false;

              if (pulse)
                break;

              if (IsBetween(duration, 750, 1000))
              {
                RC6_Data.Bit++;
                RC6_Data.Code = RC6_Data.Code << 1;

                RC6_Data.LongSpace = true;
                RC6_Data.HalfBit += 2;
                ignored = false;
              }
              else if (IsBetween(duration, 300, 600))
              {
                RC6_Data.Bit++;
                RC6_Data.Code = RC6_Data.Code << 1;

                RC6_Data.HalfBit++;
                ignored = false;
              }
              else if (duration > 4000)
              {
                RC6_Data.Bit++;
                RC6_Data.Code = RC6_Data.Code << 1;

                if (RC6_Data.Bit == 16 || RC6_Data.Bit == 20 || RC6_Data.Bit == 24 || RC6_Data.Bit == 32)
                  RC6_Data.State = RemoteDetectionState.KeyCode;
              }
            }
            else if (RC6_Data.LongSpace)
            {
              RC6_Data.LongSpace = false;

              if (!pulse)
                break;

              //if (RC6_Data.Bit == 32)
              //RC6_Data.Bit = 24;

              //if (RC6_Data.Bit == 24)
              //RC6_Data.Bit = 32;

              if (IsBetween(duration, 750, 1000))
              {
                RC6_Data.Bit++;
                RC6_Data.Code = RC6_Data.Code << 1;
                RC6_Data.Code |= 1;

                RC6_Data.LongPulse = true;
                RC6_Data.HalfBit += 2;
                ignored = false;
              }
              else if (IsBetween(duration, 300, 600))
              {
                RC6_Data.Bit++;
                RC6_Data.Code = RC6_Data.Code << 1;
                RC6_Data.Code |= 1;

                RC6_Data.HalfBit++;
                ignored = false;
              }
              else if (duration > 4000)
              {
                if (RC6_Data.Bit == 16 || RC6_Data.Bit == 20 || RC6_Data.Bit == 24 || RC6_Data.Bit == 32)
                  RC6_Data.State = RemoteDetectionState.KeyCode;
              }
            }
            break;

            #endregion Data
        }

        if (RC6_Data.State == RemoteDetectionState.KeyCode)
        {
          bool first = false;

          IrProtocol protocolVariation = IrProtocol.RC6;

          if ((~RC6_Data.Code >> 16) == CustomerMce) // MCE RC6 variation
          {
            bool toggleOn = ((RC6_Data.Code & ToggleBitMce) == ToggleBitMce);

            if ((toggleOn && RC6_Data.Toggle != 8) || (!toggleOn && RC6_Data.Toggle != 16))
              first = true;

            // Use this to signal toggle in MCE RC6 variation
            RC6_Data.Toggle = toggleOn ? 8 : 16;

            RC6_Data.Code &= ToggleMaskMce;

            protocolVariation = IrProtocol.RC6_MCE;
          }
          else // Non-MCE RC6 variations
          {
            bool toggleOn = (RC6_Data.Toggle & 1) == 1;

            if (RC6_Data.Toggle == 0 || RC6_Data.Toggle == 1 || RC6_Data.Toggle == 2 || RC6_Data.Toggle == 5)
              first = true;

            // Use this to signal toggle in standard RC6
            if (toggleOn)
              RC6_Data.Toggle = 2;
            else
              RC6_Data.Toggle = 4;

            if (RC6_Data.Bit == 16)
              protocolVariation = IrProtocol.RC6_16;
            else if (RC6_Data.Bit == 20)
              protocolVariation = IrProtocol.RC6_20;
            else if (RC6_Data.Bit == 24)
              protocolVariation = IrProtocol.RC6_24;
            else if (RC6_Data.Bit == 32)
              protocolVariation = IrProtocol.RC6_32;
            else
              break;
          }

          remoteCallback(protocolVariation, RC6_Data.Code, first);

          RC6_Data.State = RemoteDetectionState.HeaderPulse;
          ignored = false;
        }

        if (ignored && (RC6_Data.State != RemoteDetectionState.HeaderPulse))
          RC6_Data.State = RemoteDetectionState.HeaderPulse;
      }
    }
예제 #13
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="procedureName"></param>
        /// <param name="bindType"></param>
        /// <param name="resultClass"></param>
        /// <param name="callback"></param>
        /// <param name="bindparam"></param>
        public static void Call(string procedureName, string bindType, string resultClass, RemoteCallback callback, params object[] bindparam)
        {
            var obj = new object[bindparam.Length + 1];

            obj[0] = bindType;
            for (var i = 1; i <= bindparam.Length; i++)
            {
                obj[i] = bindparam[i - 1];
            }
            Gateway.GetSender().Call(Instance, "Call", new Hashtable
            {
                { keySql, procedureName },
                { keyBind, obj },
                { keyResultClass, resultClass }
            }, callback);
        }
예제 #14
0
    private static void DetectJVC(int[] timingData, RemoteCallback remoteCallback)
    {
      for (int i = 0; i < timingData.Length; i++)
      {
        int duration = Math.Abs(timingData[i]);
        bool pulse = (timingData[i] > 0);
        bool ignored = true;

        //Trace.WriteLine("JVC - {0}: {1}", Enum.GetName(typeof(RemoteDetectionState), JVC_Data.State), timingData[i]);

        switch (JVC_Data.State)
        {
            #region HeaderPulse

          case RemoteDetectionState.HeaderPulse:
            if (pulse && IsBetween(duration, 8300, 8500))
            {
              JVC_Data.State = RemoteDetectionState.HeaderSpace;
              ignored = false;
            }
            break;

            #endregion HeaderPulse

            #region HeaderSpace

          case RemoteDetectionState.HeaderSpace:
            if (!pulse && IsBetween(duration, 4100, 4300))
            {
              JVC_Data.Toggle = 0;

              JVC_Data.State = RemoteDetectionState.Data;
              JVC_Data.HalfBit = 0;
              JVC_Data.Bit = 0;
              JVC_Data.Code = 0;
              ignored = false;
            }
            break;

            #endregion HeaderSpace

            #region Data

          case RemoteDetectionState.Data:
            if (pulse && IsBetween(duration, 450, 650))
            {
              JVC_Data.HalfBit = 1;
              ignored = false;
            }
            else if (!pulse && IsBetween(duration, 450, 650) && JVC_Data.HalfBit == 1)
            {
              JVC_Data.Code <<= 1;
              JVC_Data.Bit++;
              JVC_Data.HalfBit = 0;
              ignored = false;
            }
            else if (!pulse && IsBetween(duration, 1450, 1700) && JVC_Data.HalfBit == 1)
            {
              JVC_Data.Code <<= 1;
              JVC_Data.Code |= 1;
              JVC_Data.Bit++;
              JVC_Data.HalfBit = 0;
              ignored = false;
            }
            else if (!pulse && duration >= 10000)
            {
              if (JVC_Data.Bit == 16)
              {
                bool first = false;
                if (JVC_Data.Code != JVC_Data.Toggle)
                  first = true;

                remoteCallback(IrProtocol.JVC, JVC_Data.Code, first);
                ignored = false;

                JVC_Data.Toggle = (int) JVC_Data.Code;

                if (duration > 25000)
                  JVC_Data.State = RemoteDetectionState.HeaderPulse;
                else
                  JVC_Data.State = RemoteDetectionState.Data;

                JVC_Data.HalfBit = 0;
                JVC_Data.Bit = 0;
                JVC_Data.Code = 0;
              }
              else if (JVC_Data.Bit == 32)
              {
                remoteCallback(IrProtocol.Unknown, JVC_Data.Code, false);
              }
              else
              {
                //Trace.WriteLine("JVC Error");
              }
            }
            else
            {
              //Trace.WriteLine("JVC Error");
            }

            break;

            #endregion Data
        }

        if (ignored && (JVC_Data.State != RemoteDetectionState.HeaderPulse))
          JVC_Data.State = RemoteDetectionState.HeaderPulse;
      }
    }
예제 #15
0
    private static void DetectNRC17(int[] timingData, RemoteCallback remoteCallback)
    {
      for (int i = 0; i < timingData.Length; i++)
      {
        int duration = Math.Abs(timingData[i]);
        bool pulse = (timingData[i] > 0);
        bool ignored = true;

        //Trace.WriteLine("NRC17 - {0}: {1}", Enum.GetName(typeof(RemoteDetectionState), NRC17_Data.State), timingData[i]);

        switch (NRC17_Data.State)
        {
            #region HeaderPulse

          case RemoteDetectionState.HeaderPulse:

            if (pulse && IsBetween(duration, 400, 650))
            {
              NRC17_Data.State = RemoteDetectionState.HeaderSpace;
              ignored = false;
            }
            break;

            #endregion HeaderPulse

            #region HeaderSpace

          case RemoteDetectionState.HeaderSpace:

            if (!pulse &&
                (IsBetween(duration, 2350, 2600) || // Normal battery
                 IsBetween(duration, 3350, 3600))) // Low battery              
            {
              NRC17_Data.State = RemoteDetectionState.Data;
              NRC17_Data.HalfBit = 0;
              NRC17_Data.Bit = 17;
              NRC17_Data.Header = 0;
              NRC17_Data.Code = 0;
              ignored = false;
            }
            break;

            #endregion HeaderSpace

            #region Data

          case RemoteDetectionState.Data:
            if (NRC17_Data.HalfBit == 0)
            {
              if (pulse && IsBetween(duration, 300, 700))
              {
                // Logic 1
                NRC17_Data.HalfBit = 1;
                NRC17_Data.Code |= (uint) (1 << NRC17_Data.Bit--);
                ignored = false;
              }
              else if (!pulse && IsBetween(duration, 300, 700))
              {
                // Logic 0
                NRC17_Data.HalfBit = 1;
                NRC17_Data.Bit--;
                ignored = false;
              }
            }
            else
            {
              if (!pulse && IsBetween(duration, 300, 700))
              {
                NRC17_Data.HalfBit = 0;
                ignored = false;
              }
              else if (pulse && IsBetween(duration, 300, 700))
              {
                NRC17_Data.HalfBit = 0;
                ignored = false;
              }
              else if (!pulse && IsBetween(duration, 800, 1200))
              {
                NRC17_Data.HalfBit = 1;
                NRC17_Data.Bit--;
                ignored = false;
              }
              else if (pulse && IsBetween(duration, 800, 1200))
              {
                NRC17_Data.HalfBit = 1;
                NRC17_Data.Code |= (uint) (1 << NRC17_Data.Bit--);
                ignored = false;
              }
            }

            if (NRC17_Data.Bit == 0)
            {
              NRC17_Data.Code &= 0xFFFF; // 16-bits (Ignore leading bit which is always 1)
              remoteCallback(IrProtocol.NRC17, NRC17_Data.Code, false);

              NRC17_Data.State = RemoteDetectionState.HeaderPulse;
            }

            break;

            #endregion Data
        }

        if (ignored && (NRC17_Data.State != RemoteDetectionState.HeaderPulse))
          NRC17_Data.State = RemoteDetectionState.HeaderPulse;
      }
    }
예제 #16
0
    private static void DetectMitsubishi(int[] timingData, RemoteCallback remoteCallback)
    {
      for (int i = 0; i < timingData.Length; i++)
      {
        int duration = Math.Abs(timingData[i]);
        bool pulse = (timingData[i] > 0);
        bool ignored = true;

        //Trace.WriteLine("Mitsubishi - {0}: {1}", Enum.GetName(typeof(RemoteDetectionState), Mitsubishi_Data.State), timingData[i]);

        switch (Mitsubishi_Data.State)
        {
            #region HeaderPulse

          case RemoteDetectionState.HeaderPulse:
            if (pulse && IsBetween(duration, 7800, 8200))
            {
              Mitsubishi_Data.State = RemoteDetectionState.HeaderSpace;
              ignored = false;
            }

            break;

            #endregion HeaderPulse

            #region HeaderSpace

          case RemoteDetectionState.HeaderSpace:
            if (!pulse && IsBetween(duration, 3800, 4200))
            {
              Mitsubishi_Data.State = RemoteDetectionState.Data;
              Mitsubishi_Data.HalfBit = 0;
              Mitsubishi_Data.Bit = 0;
              Mitsubishi_Data.Code = 0;
              ignored = false;
            }

            break;

            #endregion HeaderSpace

            #region Data

          case RemoteDetectionState.Data:
            if (pulse && IsBetween(duration, 350, 650))
            {
              Mitsubishi_Data.HalfBit = 1;
              ignored = false;
            }
            else if (!pulse && IsBetween(duration, 350, 650) && Mitsubishi_Data.HalfBit == 1)
            {
              Mitsubishi_Data.Code <<= 1;
              Mitsubishi_Data.Bit++;
              Mitsubishi_Data.HalfBit = 0;
              ignored = false;
            }
            else if (!pulse && IsBetween(duration, 1300, 1700) && Mitsubishi_Data.HalfBit == 1)
            {
              Mitsubishi_Data.Code <<= 1;
              Mitsubishi_Data.Code |= 1;
              Mitsubishi_Data.Bit++;
              Mitsubishi_Data.HalfBit = 0;
              ignored = false;
            }
            else if (!pulse && IsBetween(duration, 3800, 4200) && Mitsubishi_Data.HalfBit == 1 && Mitsubishi_Data.Bit == 8)
            {
              Mitsubishi_Data.HalfBit = 0;
              ignored = false;
            }
            else if (!pulse && duration >= 20000 && Mitsubishi_Data.HalfBit == 1 && Mitsubishi_Data.Bit == 16)
            {
              remoteCallback(IrProtocol.Mitsubishi, Mitsubishi_Data.Code, false);
              Mitsubishi_Data.State = RemoteDetectionState.HeaderPulse;
              Mitsubishi_Data.HalfBit = 0;
              ignored = false;
            }

            break;

            #endregion Data
        }

        if (ignored && (Mitsubishi_Data.State != RemoteDetectionState.HeaderPulse))
        {
          //Trace.WriteLine("ignored");
          Mitsubishi_Data.State = RemoteDetectionState.HeaderPulse;
        }
      }
    }
 public DriverReplacement(Guid deviceGuid, string devicePath, RemoteCallback remoteCallback,
                          KeyboardCallback keyboardCallback, MouseCallback mouseCallback)
   : base(deviceGuid, devicePath, remoteCallback, keyboardCallback, mouseCallback)
 {
   if (devicePath.IndexOf(VidSMK, StringComparison.OrdinalIgnoreCase) != -1 ||
       devicePath.IndexOf(VidTopseed, StringComparison.OrdinalIgnoreCase) != -1)
     _deviceType = DeviceType.SmkTopseed;
   else
     _deviceType = DeviceType.Microsoft;
 }
예제 #18
0
파일: UWebRequest.cs 프로젝트: McRain/ulib
        public IEnumerator StartRequest(object target, string method, object parameter, RemoteCallback callback, string back)
        {
            _loaded = false;
            _status = WebReqestStat.Work;
            _form   = new WWWForm();
            if (!string.IsNullOrEmpty(Gateway.AppName))
            {
                _form.AddField(Gateway.AppParameter, Gateway.AppName);
            }
            _form.AddField(Gateway.ClassKey, target is string?target.ToString() : target.GetType().Name);
            _form.AddField(Gateway.MethodKey, method);
            _form.AddField(Gateway.AppParameter, Gateway.AppName);
            if (parameter != null)
            {
                _form.AddBinaryData("data", /*_parent.Encode(parameter)*/ new Serializer().Encode(parameter));
            }

            /*if (!Application.isWebPlayer && !string.IsNullOrEmpty(Gateway.Key))
             * {
             *  _headers = new Dictionary<string, string>();
             *  _form.headers["Cookie"] = Gateway.KeyName + "=" + Gateway.Key;
             *  Loader = new WWW(_url, _form.data, _headers);
             * }
             * else*/
            Loader = new WWW(_url, _form);
            yield return(Loader);

            _loaded = true;
            if (Loader.error != null)
            {
                Debug.LogError("UWebRequest: loader ERROR " + Loader.error);
                if (callback != null)
                {
                    callback(Loader.error);
                }
                _status = WebReqestStat.Error;
                _parent.PutRequestToError(this);
                ErrorCount++;
            }
            else
            {
                var decode = true;
                if (Loader.responseHeaders != null)
                {
                    if (!Application.isWebPlayer && Loader.responseHeaders.ContainsKey("SET-COOKIE"))
                    {
                        var cookies = Loader.responseHeaders["SET-COOKIE"].Split(';');
                        foreach (
                            var cook in
                            cookies.Select(cooky => cooky.Split('='))
                            .Where(cook => cook[0].Trim().Equals(Gateway.KeyName)))
                        {
                            Gateway.Key = cook[1].Trim();
                        }
                    }
                    if (Loader.responseHeaders.ContainsKey("NODECODE"))
                    {
                        decode = false;
                    }
                }
                object val;
                if (decode)
                {
                    val = new Serializer().Decode(Loader.bytes) ?? Loader.text;
                }
                else
                {
                    val = Loader.text;
                }
                if (val is UError)
                {
                    _status = WebReqestStat.Error;
                    _parent.PutRequestToError(this);
                    ErrorCount++;
                }
                else
                {
                    if (back != null)
                    {
                        SetBack(back, ref target, val);
                    }
                    if (callback != null)
                    {
                        callback(val);
                    }
                    _status = WebReqestStat.Wait;
                    _parent.BackRequestToPool(this);
                }
            }
        }
예제 #19
0
파일: WwwObject.cs 프로젝트: McRain/ulib
 public void Call(object target, string method, RemoteCallback callBack, params object[] parameters)
 {
     throw new NotImplementedException();
 }
예제 #20
0
        protected void btnDownload_Click(object sender, System.EventArgs e)
        {
            Timer1.Enabled = true;

            //Label1.Text = "Refreshed at " +
            //DateTime.Now.ToString();
            bool blnServiceStarted;
            bool blnNoError;

            try
            {
                objCommonMethods = new CommonMethods();
                objCController   = new CController();
                objIController   = (CController)objCController;

                objCMWException  = new CMWException();
                objCommonMethods = new CommonMethods();

                objIController.SetFilePath(strProjectDBPath);
                Shared.udtNetworkType = objIController.GetNetworkType(strProjectDBPath);
                ResgistrySettings RegSettings;
                RegSettings = objIController.GetRegistrySettings();

                Shared.ProjectDBPath   = strProjectDBPath;
                Shared.ApplicationPath = RegSettings.InstallationPath;
                objDownloadSettings    = new DownloadSettings();

                //start downloader Service
                blnServiceStarted = objCommonMethods.StartDownloaderService();
                //Communication Type
                objDownloadSettings.TCP       = true;
                objDownloadSettings.ipAddress = "159.99.185.100";
                //Port number
                objDownloadSettings.portNumber = Constants.portNumber;
                //Gateway type
                objDownloadSettings.enumDownloadGateway = GateWay.E3NGA;
                //NetworkType
                objDownloadSettings.enumNetworkType = Shared.udtNetworkType;
                //Node type
                objDownloadSettings.enumBoardTypeID = BoardTypeID.ILI_S_E3;
                //Node Number
                objDownloadSettings.NodeNumber = 2;
                //Firmware path
                objDownloadSettings.FirmwarePath = "";
                //7100 network card
                objDownloadSettings.Do7100CardDownload = false;
                //RPT card
                objDownloadSettings.DoRPTDownload = false;
                //LCD-SLP load
                objDownloadSettings.DoLCDSLPDownload = false;
                //LCD-SLP Graphics
                objDownloadSettings.DoLCDSLPGraphicsDownload = false;
                //Project Path
                objDownloadSettings.ProjectPath = Shared.ProjectDBPath;
                //Level 4 Password
                objDownloadSettings.L4Password = "******";
                //Download Type
                objDownloadSettings.DownloadTypes = (int)DownloadTypes.CAMOnly | (int)DownloadTypes.ConfigOnly | (int)DownloadTypes.LabelsOnly;
                //Installer ID
                objDownloadSettings.InstallerID = "1234";
                //Virtual Switch
                objDownloadSettings.LoadVirtualSwitch = false;
                //Site Specific key
                objDownloadSettings.SiteSpecificKey = 1234;
                //Application path
                objDownloadSettings.ApplicationPath = Shared.ApplicationPath;
                OnCommandCompleted          = new DelegateCommandCompleted(Query_OnCommandCompleted);
                objCallback                 = new CallbackClass();
                objCallback.OnHostToClient += new RemoteCallback(Status_Changed);
                //call back delegate
                RemoteCallback wire = new RemoteCallback(objCallback.HandleToClient);
                //Parameters to be passed between the client and CAMWorksDownloader service.
                CallbackEventArgs objCallBckArgs = new CallbackEventArgs();
                objCallBckArgs.CallBack = wire;
                objCallBckArgs.IsError  = false;

                objCallBckArgs.Finished = false;

                objCallBckArgs.CommandId = CommandName.ConfigDownload;

                objCallBckArgs.State = 0;

                objCallBckArgs.Sender = GetType().ToString();

                objCallBckArgs.Parameters = objDownloadSettings;

                blnNoError = objIController.DownloadConfigData(objCallBckArgs);

                if (!blnNoError)
                {
                    arListStatus.Add(objCMWException.GetExceptions(objCMWException.LastException, ""));

                    // IsDownloadSuucessful = false;

                    OnCommandCompleted();
                }

                //objCMWException = null;

                objCallBckArgs = null;

                objDownloadSettings = null;
            }
            catch (Exception Ex)
            {
            }
        }
예제 #21
0
파일: WwwObject.cs 프로젝트: McRain/ulib
 /// <summary>
 /// Call remote method
 /// </summary>
 /// <param name="target">An object that has the same class name with the server object, or name of a server class.</param>
 /// <param name="method">Name of target Method in Server class</param>
 /// <param name="parameter">sended parameters(object, dictionary, class ... etc)</param>
 /// <param name="callBack">Callback for recived server answer</param>
 public void Call(object target, string method, object parameter, RemoteCallback callBack)
 {
     Call(target, method, parameter, callBack, null);
 }
예제 #22
0
    /// <summary>
    /// Decode timing data to discover IR Protocol and packet payload.
    /// </summary>
    /// <param name="timingData">Input timing data.</param>
    /// <param name="remoteCallback">Method to call when Remote button decoded.</param>
    /// <param name="keyboardCallback">Method to call when Keyboard event decoded.</param>
    /// <param name="mouseCallback">Method to call when Mouse event decoded.</param>
    public static void DecodeIR(int[] timingData, RemoteCallback remoteCallback, KeyboardCallback keyboardCallback,
                                MouseCallback mouseCallback)
    {
      if (timingData == null)
        return;

      try
      {
        DetectDaewoo(timingData, remoteCallback);
        //DetectITT(timingData, remoteCallback);
        DetectJVC(timingData, remoteCallback);
        DetectMatsushita(timingData, remoteCallback);
        DetectMitsubishi(timingData, remoteCallback);
        DetectNEC(timingData, remoteCallback);
        DetectNRC17(timingData, remoteCallback);
        DetectPanasonic(timingData, remoteCallback);
        DetectRC5(timingData, remoteCallback);
        DetectRC6(timingData, remoteCallback);
        DetectRCA(timingData, remoteCallback);
        //DetectRCMM(timingData, remoteCallback);
        DetectRECS80(timingData, remoteCallback);
        //DetectSharp(timingData, remoteCallback);
        DetectSIRC(timingData, remoteCallback);
        DetectToshiba(timingData, remoteCallback);
        //DetectXSAT(timingData, remoteCallback);

        DetectMCE(timingData, keyboardCallback, mouseCallback);
        //DetectIMon(timingData, keyboardCallback, mouseCallback);
      }
#if TRACE
      catch (Exception ex)
      {
        Trace.WriteLine(ex.ToString());
#else
      catch
      {
#endif
        Daewoo_Data = new RemoteDetectionData();
        JVC_Data = new RemoteDetectionData();
        Matsushita_Data = new RemoteDetectionData();
        Mitsubishi_Data = new RemoteDetectionData();
        NEC_Data = new RemoteDetectionData();
        NRC17_Data = new RemoteDetectionData();
        Panasonic_Data = new RemoteDetectionData();
        RC5_Data = new RemoteDetectionData();
        RC6_Data = new RemoteDetectionData();
        RCA_Data = new RemoteDetectionData();
        RECS80_Data = new RemoteDetectionData();
        SIRC_Data = new RemoteDetectionData();
        Toshiba_Data = new RemoteDetectionData();

        MCE_Data = new MceDetectionData();
      }
    }
예제 #23
0
    private static void DetectDaewoo(int[] timingData, RemoteCallback remoteCallback)
    {
      for (int i = 0; i < timingData.Length; i++)
      {
        int duration = Math.Abs(timingData[i]);
        bool pulse = (timingData[i] > 0);
        bool ignored = true;

        //Trace.WriteLine("Daewoo - {0}: {1}", Enum.GetName(typeof(RemoteDetectionState), Daewoo_Data.State), timingData[i]);

        switch (Daewoo_Data.State)
        {
            #region HeaderPulse

          case RemoteDetectionState.HeaderPulse:
            if (pulse && IsBetween(duration, 7800, 8200))
            {
              Daewoo_Data.State = RemoteDetectionState.HeaderSpace;
              ignored = false;
            }
            break;

            #endregion HeaderPulse

            #region HeaderSpace

          case RemoteDetectionState.HeaderSpace:
            if (!pulse && IsBetween(duration, 3800, 4200))
            {
              Daewoo_Data.State = RemoteDetectionState.Data;
              Daewoo_Data.HalfBit = 0;
              Daewoo_Data.Bit = 0;
              Daewoo_Data.Code = 0;
              ignored = false;
            }
            else if (!pulse && IsBetween(duration, 10000, 40000)) // For Repeats
            {
              Daewoo_Data.State = RemoteDetectionState.Data;
              Daewoo_Data.HalfBit = 0;
              Daewoo_Data.Bit = 0;
              Daewoo_Data.Code = 0;
              ignored = false;
            }
            break;

            #endregion HeaderSpace

            #region Data

          case RemoteDetectionState.Data:
            if (pulse && IsBetween(duration, 350, 750))
            {
              Daewoo_Data.HalfBit = 1;
              ignored = false;
            }
            else if (!pulse && IsBetween(duration, 250, 650) && Daewoo_Data.HalfBit == 1)
            {
              Daewoo_Data.Code <<= 1;
              Daewoo_Data.Bit++;
              Daewoo_Data.HalfBit = 0;
              ignored = false;
            }
            else if (!pulse && IsBetween(duration, 1250, 1650) && Daewoo_Data.HalfBit == 1)
            {
              Daewoo_Data.Code <<= 1;
              Daewoo_Data.Code |= 1;
              Daewoo_Data.Bit++;
              Daewoo_Data.HalfBit = 0;
              ignored = false;
            }
            else
            {
              //Trace.WriteLine("Daewoo Error");
            }

            if (Daewoo_Data.Bit == 16)
            {
              remoteCallback(IrProtocol.Daewoo, Daewoo_Data.Code, false);
              Daewoo_Data.State = RemoteDetectionState.Leading;
            }
            break;

            #endregion Data

            #region Leading

          case RemoteDetectionState.Leading:
            if (pulse && IsBetween(duration, 350, 750))
            {
              Daewoo_Data.State = RemoteDetectionState.HeaderSpace;
              ignored = false;
            }
            break;

            #endregion Leading
        }

        if (ignored && (Daewoo_Data.State != RemoteDetectionState.HeaderPulse))
          Daewoo_Data.State = RemoteDetectionState.HeaderPulse;
      }
    }
예제 #24
0
파일: WwwObject.cs 프로젝트: McRain/ulib
 public void ResendRequest(UWebRequest request, object target, string method, object parameters, RemoteCallback callback, string back)
 {
     if (_requestPool.Contains(request))
     {
         _requestPool.Remove(request);
     }
     if (_activedRequest.Contains(request))
     {
         _activedRequest.Remove(request);
     }
     Request(target, method, parameters, callback, back);
 }
예제 #25
0
    private static void DetectMatsushita(int[] timingData, RemoteCallback remoteCallback)
    {
      for (int i = 0; i < timingData.Length; i++)
      {
        int duration = Math.Abs(timingData[i]);
        bool pulse = (timingData[i] > 0);
        bool ignored = true;

        //Trace.WriteLine("Matsushita - {0}: {1}", Enum.GetName(typeof(RemoteDetectionState), Matsushita_Data.State), timingData[i]);

        switch (Matsushita_Data.State)
        {
            #region HeaderPulse

          case RemoteDetectionState.HeaderPulse:
            if (pulse && IsBetween(duration, 3300, 3700))
            {
              Matsushita_Data.State = RemoteDetectionState.HeaderSpace;
              ignored = false;
            }
            //else
            //Trace.WriteLine("HeaderPulse fall through");

            break;

            #endregion HeaderPulse

            #region HeaderSpace

          case RemoteDetectionState.HeaderSpace:
            if (!pulse && IsBetween(duration, 3300, 3700))
            {
              Matsushita_Data.State = RemoteDetectionState.Data;
              Matsushita_Data.HalfBit = 0;
              Matsushita_Data.Bit = 0;
              Matsushita_Data.Code = 0;
              ignored = false;
            }
            //else
            //Trace.WriteLine("HeaderSpace fell through");

            break;

            #endregion HeaderSpace

            #region Data

          case RemoteDetectionState.Data:
            if (pulse && IsBetween(duration, 650, 1050))
            {
              Matsushita_Data.HalfBit = 1;
              ignored = false;
            }
            else if (!pulse && IsBetween(duration, 650, 1050) && Matsushita_Data.HalfBit == 1)
            {
              Matsushita_Data.Code <<= 1;
              Matsushita_Data.Bit++;
              Matsushita_Data.HalfBit = 0;
              ignored = false;
            }
            else if (!pulse && IsBetween(duration, 2450, 2850) && Matsushita_Data.HalfBit == 1)
            {
              Matsushita_Data.Code <<= 1;
              Matsushita_Data.Code |= 1;
              Matsushita_Data.Bit++;
              Matsushita_Data.HalfBit = 0;
              ignored = false;
            }
            else if (!pulse && duration >= 20000 && Matsushita_Data.HalfBit == 1)
            {
              if (Matsushita_Data.Bit != 22)
                break;

              uint code = Matsushita_Data.Code >> 12;
              remoteCallback(IrProtocol.Matsushita, code, false);
              Matsushita_Data.State = RemoteDetectionState.HeaderPulse;
              Matsushita_Data.HalfBit = 0;
              ignored = false;
            }
            else
            {
              //Trace.WriteLine("Matsushita Error");
            }

            break;

            #endregion Data
        }

        if (ignored && (Matsushita_Data.State != RemoteDetectionState.HeaderPulse))
        {
          //Trace.WriteLine("ignored");
          Matsushita_Data.State = RemoteDetectionState.HeaderPulse;
        }
      }
    }
예제 #26
0
파일: WwwObject.cs 프로젝트: McRain/ulib
 /// <summary>
 /// Call remote method
 /// </summary>
 /// <param name="target"></param>
 /// <param name="method"></param>
 /// <param name="parameters"></param>
 /// <param name="callback"></param>
 /// <param name="backTarget"></param>
 public UWebRequest Call(object target, string method, object parameters, RemoteCallback callback, string backTarget)
 {
     return(Request(target, method, parameters, callback, backTarget));
 }
예제 #27
0
    private static void DetectNEC(int[] timingData, RemoteCallback remoteCallback)
    {
      for (int i = 0; i < timingData.Length; i++)
      {
        int duration = Math.Abs(timingData[i]);
        bool pulse = (timingData[i] > 0);
        bool ignored = true;

        //Trace.WriteLine(String.Format("NEC - {0}: {1}", Enum.GetName(typeof(RemoteDetectionState), NEC_Data.State), timingData[i]));

        switch (NEC_Data.State)
        {
            #region HeaderPulse

          case RemoteDetectionState.HeaderPulse:
            if (pulse && IsBetween(duration, 8800, 9200))
            {
              NEC_Data.State = RemoteDetectionState.HeaderSpace;
              ignored = false;
            }

            break;

            #endregion HeaderPulse

            #region HeaderSpace

          case RemoteDetectionState.HeaderSpace:
            if (!pulse && IsBetween(duration, 4300, 4700))
            {
              NEC_Data.State = RemoteDetectionState.Data;
              NEC_Data.HalfBit = 0;
              NEC_Data.Bit = 0;
              NEC_Data.Code = 0;
              ignored = false;
            }
            else if (!pulse && IsBetween(duration, 2050, 2450)) // For Repeats
            {
              //Trace.Write("Repeat");

              if (NEC_Data.Code != 0)
              {
                uint address = (NEC_Data.Code >> 24) & 0xFF;
                uint command = (NEC_Data.Code >> 8) & 0xFF;

                uint code = (address << 8) + command;

                //Trace.WriteLine(" Code: {0}", code);

                remoteCallback(IrProtocol.NEC, code, false);

                NEC_Data.State = RemoteDetectionState.Leading;
                ignored = false;
              }
            }

            break;

            #endregion HeaderSpace

            #region Data

          case RemoteDetectionState.Data:
            if (pulse && IsBetween(duration, 350, 750))
            {
              NEC_Data.HalfBit = 1;
              ignored = false;
            }
            else if (!pulse && IsBetween(duration, 350, 650) && NEC_Data.HalfBit == 1)
            {
              NEC_Data.Code <<= 1;
              NEC_Data.Bit++;
              NEC_Data.HalfBit = 0;
              ignored = false;
            }
            else if (!pulse && IsBetween(duration, 1200, 2800) && NEC_Data.HalfBit == 1)
            {
              NEC_Data.Code <<= 1;
              NEC_Data.Code |= 1;
              NEC_Data.Bit++;
              NEC_Data.HalfBit = 0;
              ignored = false;
            }
            else if (!pulse && duration >= 12000)
            {
              if (NEC_Data.Bit != 32)
              {
                if (NEC_Data.Code != 0)
                {
                  //Trace.WriteLine("Invalid NEC: {0}bit, {1:X}", NEC_Data.Bit, NEC_Data.Code);
                  remoteCallback(IrProtocol.Unknown, NEC_Data.Code, false);
                }
                break;
              }

              uint address = (NEC_Data.Code >> 24) & 0xFF;
              uint notAddress = (NEC_Data.Code >> 16) & 0xFF;

              uint command = (NEC_Data.Code >> 8) & 0xFF;
              uint notCommand = NEC_Data.Code & 0xFF;

              if ((address + notAddress == 0xFF) && (command + notCommand == 0xFF))
              {
                uint code = (address << 8) + command;
                remoteCallback(IrProtocol.NEC, code, true);
                NEC_Data.State = RemoteDetectionState.HeaderPulse;
                ignored = false;
              }
              else
              {
                //Trace.WriteLine("Invalid NEC: {0:X}", NEC_Data.Code);
                remoteCallback(IrProtocol.Unknown, NEC_Data.Code, false);
              }
            }

            break;

            #endregion Data

            #region Leading

          case RemoteDetectionState.Leading:
            if (pulse && IsBetween(duration, 400, 800))
            {
              ignored = false;
            }
            else if (!pulse && duration > 10000)
            {
              ignored = false;
              NEC_Data.State = RemoteDetectionState.HeaderPulse;
            }

            break;

            #endregion Leading
        }

        if (ignored && (NEC_Data.State != RemoteDetectionState.HeaderPulse))
          NEC_Data.State = RemoteDetectionState.HeaderPulse;
      }
    }
예제 #28
0
    protected Driver(Guid deviceGuid, string devicePath, RemoteCallback remoteCallback,
                     KeyboardCallback keyboardCallback, MouseCallback mouseCallback)
    {
      if (String.IsNullOrEmpty(devicePath))
        throw new ArgumentNullException("devicePath");

      _deviceGuid = deviceGuid;
      _devicePath = devicePath;

      _remoteCallback = remoteCallback;
      _keyboardCallback = keyboardCallback;
      _mouseCallback = mouseCallback;
    }
예제 #29
0
    private static void DetectPanasonic(int[] timingData, RemoteCallback remoteCallback)
    {
      for (int i = 0; i < timingData.Length; i++)
      {
        int duration = Math.Abs(timingData[i]);
        bool pulse = (timingData[i] > 0);
        bool ignored = true;

        switch (Panasonic_Data.State)
        {
            #region HeaderPulse

          case RemoteDetectionState.HeaderPulse:
            if (pulse && IsBetween(duration, 3150, 3900))
            {
              Panasonic_Data.State = RemoteDetectionState.HeaderSpace;
              ignored = false;
            }

            break;

            #endregion HeaderPulse

            #region HeaderSpace

          case RemoteDetectionState.HeaderSpace:
            if (!pulse && IsBetween(duration, 3150, 3900))
            {
              Panasonic_Data.State = RemoteDetectionState.Data;
              Panasonic_Data.HalfBit = 0;
              Panasonic_Data.Bit = 0;
              Panasonic_Data.Code = 0;
              ignored = false;
            }
            else if (!pulse && IsBetween(duration, 2050, 2450)) // For Repeats
            {
              //Trace.Write("Repeat");

              if (Panasonic_Data.Code != 0)
              {
                uint address = (Panasonic_Data.Code >> 24) & 0xFF;
                uint command = (Panasonic_Data.Code >> 8) & 0xFF;

                uint code = (address << 8) + command;

                //Trace.WriteLine(" Code: {0}", code);

                remoteCallback(IrProtocol.Panasonic, code, false);

                Panasonic_Data.State = RemoteDetectionState.Leading;
                ignored = false;
              }
            }

            break;

            #endregion HeaderSpace

            #region Data

          case RemoteDetectionState.Data:
            if (pulse && IsBetween(duration, 600, 1150))
            {
              Panasonic_Data.HalfBit = 1;
              ignored = false;
            }
            else if (!pulse && IsBetween(duration, 600, 1150) && Panasonic_Data.HalfBit == 1)
            {
              Panasonic_Data.Code <<= 1;
              Panasonic_Data.Bit++;
              Panasonic_Data.HalfBit = 0;
              ignored = false;
            }
            else if (!pulse && IsBetween(duration, 1800, 3450) && Panasonic_Data.HalfBit == 1)
            {
              Panasonic_Data.Code <<= 1;
              Panasonic_Data.Code |= 1;
              Panasonic_Data.Bit++;
              Panasonic_Data.HalfBit = 0;
              ignored = false;
            }
            else if (!pulse && duration >= 8000)
            {
              if (Panasonic_Data.Bit != 22)
                break;

              uint custom = (Panasonic_Data.Code >> 17) & 0x1F;
              uint data = (Panasonic_Data.Code >> 11) & 0x3F;

              uint notCustom = (Panasonic_Data.Code >> 6) & 0x1F;
              uint notData = Panasonic_Data.Code & 0x3F;

              if ((custom + notCustom == 0x1F) && (data + notData == 0x3F))
              {
                uint code = (custom << 8) + data;
                remoteCallback(IrProtocol.Panasonic, code, true);
                Panasonic_Data.State = RemoteDetectionState.HeaderPulse;
                ignored = false;
              }
              else
              {
                //Trace.WriteLine("custom != notCustom || data != notData    fall through");
                //Trace.WriteLine("{0:X}", Panasonic_Data.Code);
              }
            }

            break;

            #endregion Data

            #region Leading

          case RemoteDetectionState.Leading:
            if (pulse && IsBetween(duration, 400, 800))
            {
              ignored = false;
            }
            else if (!pulse && IsBetween(duration, 38000, 40000)) // First Repeat
            {
              ignored = false;
              Panasonic_Data.State = RemoteDetectionState.HeaderPulse;
            }
            else if (!pulse && IsBetween(duration, 94600, 95000)) // Multiple Repeats
            {
              ignored = false;
              Panasonic_Data.State = RemoteDetectionState.HeaderPulse;
            }

            break;

            #endregion Leading
        }

        if (ignored && (Panasonic_Data.State != RemoteDetectionState.HeaderPulse))
        {
          //Trace.WriteLine("Panasonic Ignored");
          Panasonic_Data.State = RemoteDetectionState.HeaderPulse;
        }
      }
    }
예제 #30
0
    private static void DetectRC5(int[] timingData, RemoteCallback remoteCallback)
    {
      for (int i = 0; i < timingData.Length; i++)
      {
        int duration = Math.Abs(timingData[i]);
        bool pulse = (timingData[i] > 0);
        bool ignored = true;

        switch (RC5_Data.State)
        {
            #region HeaderPulse

          case RemoteDetectionState.HeaderPulse:
            if (pulse)
            {
              if (IsBetween(duration, 700, 1100))
              {
                RC5_Data.State = RemoteDetectionState.HeaderSpace;
                RC5_Data.Bit = 13;
                RC5_Data.Code = (uint) 1 << RC5_Data.Bit;
                ignored = false;
              }
              else if (IsBetween(duration, 1500, 2000))
              {
                RC5_Data.State = RemoteDetectionState.Data;
                RC5_Data.Bit = 13;
                RC5_Data.Code = (uint) 1 << RC5_Data.Bit;
                RC5_Data.HalfBit = 0;
                ignored = false;
              }
            }
            break;

            #endregion HeaderPulse

            #region HeaderSpace

          case RemoteDetectionState.HeaderSpace:
            if (!pulse && IsBetween(duration, 700, 1100))
            {
              RC5_Data.State = RemoteDetectionState.Data;
              RC5_Data.HalfBit = 0;
              ignored = false;
            }
            break;

            #endregion HeaderSpace

            #region Data

          case RemoteDetectionState.Data:
            if (RC5_Data.HalfBit == 0)
            {
              if (pulse)
              {
                if (IsBetween(duration, 700, 1100) || IsBetween(duration, 1500, 2000))
                {
                  RC5_Data.HalfBit = (byte) ((duration >= 1500) ? 0 : 1);
                  RC5_Data.Bit--;
                  RC5_Data.Code |= (uint) 1 << RC5_Data.Bit;
                  ignored = false;

                  if (RC5_Data.Bit == 0 || (RC5_Data.Bit == 1 && duration >= 1500))
                    RC5_Data.State = RemoteDetectionState.KeyCode;
                }
              }
              else
              {
                if (IsBetween(duration, 700, 1100) || IsBetween(duration, 1500, 2000))
                {
                  RC5_Data.HalfBit = (byte) ((duration >= 1500) ? 0 : 1);
                  RC5_Data.Bit--;
                  ignored = false;

                  if (RC5_Data.Bit == 0)
                    RC5_Data.State = RemoteDetectionState.KeyCode;
                }
                else if (RC5_Data.Bit == 7 && (IsBetween(duration, 4300, 4700) || IsBetween(duration, 5200, 5600)))
                {
                  ignored = false;
                  RC5_Data.HalfBit = (byte) ((duration >= 5200) ? 0 : 1);
                  RC5_Data.Code <<= 6;
                  RC5_Data.Bit += 5;
                }
              }
            }
            else // RC5_Data.HalfBit != 0
            {
              if (IsBetween(duration, 700, 1100))
              {
                RC5_Data.HalfBit = 0;
                ignored = false;

                if ((RC5_Data.Bit == 1) && pulse)
                  RC5_Data.State = RemoteDetectionState.KeyCode;
              }
              else if (RC5_Data.Bit == 7 && (IsBetween(duration, 3400, 3800) || IsBetween(duration, 4300, 4700)))
              {
                RC5_Data.HalfBit = (byte) ((duration >= 4300) ? 0 : 1);
                RC5_Data.Code <<= 6;
                RC5_Data.Bit += 6;
                ignored = false;
              }
            }

            break;

            #endregion Data
        }

        if (RC5_Data.State == RemoteDetectionState.KeyCode)
        {
          bool toggleOn;

          bool first = true;
          bool RC5X;

          if (RC5_Data.Code > 0xFFFF) // RC5X
          {
            toggleOn = ((RC5_Data.Code & ToggleBitRC5X) == ToggleBitRC5X);
            RC5_Data.Code &= ToggleMaskRC5X;
            RC5X = true;
          }
          else // RC5
          {
            toggleOn = ((RC5_Data.Code & ToggleBitRC5) == ToggleBitRC5);
            RC5_Data.Code &= ToggleMaskRC5;
            RC5X = false;
          }

          if ((toggleOn && RC5_Data.Toggle == 1) || (!toggleOn && RC5_Data.Toggle == 2))
            first = false;

          RC5_Data.Toggle = toggleOn ? 1 : 2;

          if (RC5X)
            remoteCallback(IrProtocol.RC5X, RC5_Data.Code, first);
          else
            remoteCallback(IrProtocol.RC5, RC5_Data.Code, first);

          RC5_Data.State = RemoteDetectionState.HeaderPulse;
          ignored = false;
        }

        if (ignored && (RC5_Data.State != RemoteDetectionState.Leading) &&
            (RC5_Data.State != RemoteDetectionState.HeaderPulse))
          RC5_Data.State = RemoteDetectionState.HeaderPulse;
      }
    }
예제 #31
0
 public DriverVista(Guid deviceGuid, string devicePath, RemoteCallback remoteCallback,
                    KeyboardCallback keyboardCallback, MouseCallback mouseCallback)
   : base(deviceGuid, devicePath, remoteCallback, keyboardCallback, mouseCallback)
 {
 }
예제 #32
0
        protected void btnDownload_Click(object sender, System.EventArgs e)
        {
            Timer1.Enabled = true;

            //Label1.Text = "Refreshed at " +
            //DateTime.Now.ToString();
            bool blnServiceStarted;
            bool blnNoError;
            try
            {
                objCommonMethods = new CommonMethods();
                objCController = new CController();
                objIController = (CController)objCController;

                objCMWException = new CMWException();
                objCommonMethods = new CommonMethods();

                objIController.SetFilePath(strProjectDBPath);
                Shared.udtNetworkType = objIController.GetNetworkType(strProjectDBPath);
                ResgistrySettings RegSettings;
                RegSettings = objIController.GetRegistrySettings();

                Shared.ProjectDBPath = strProjectDBPath;
                Shared.ApplicationPath = RegSettings.InstallationPath;
                objDownloadSettings = new DownloadSettings();

                //start downloader Service
                blnServiceStarted = objCommonMethods.StartDownloaderService();
                //Communication Type
                objDownloadSettings.TCP = true;
                objDownloadSettings.ipAddress = "159.99.185.100";
                //Port number
                objDownloadSettings.portNumber = Constants.portNumber;
                //Gateway type
                objDownloadSettings.enumDownloadGateway = GateWay.E3NGA;
                //NetworkType
                objDownloadSettings.enumNetworkType = Shared.udtNetworkType;
                //Node type
                objDownloadSettings.enumBoardTypeID = BoardTypeID.ILI_S_E3;
                //Node Number
                objDownloadSettings.NodeNumber = 2;
                //Firmware path
                objDownloadSettings.FirmwarePath = "";
                //7100 network card
                objDownloadSettings.Do7100CardDownload = false;
                //RPT card
                objDownloadSettings.DoRPTDownload = false;
                //LCD-SLP load
                objDownloadSettings.DoLCDSLPDownload = false;
                //LCD-SLP Graphics
                objDownloadSettings.DoLCDSLPGraphicsDownload = false;
                //Project Path
                objDownloadSettings.ProjectPath = Shared.ProjectDBPath;
                //Level 4 Password
                objDownloadSettings.L4Password = "******";
                //Download Type
                objDownloadSettings.DownloadTypes = (int)DownloadTypes.CAMOnly | (int)DownloadTypes.ConfigOnly | (int)DownloadTypes.LabelsOnly;
                //Installer ID
                objDownloadSettings.InstallerID = "1234";
                //Virtual Switch
                objDownloadSettings.LoadVirtualSwitch = false;
                //Site Specific key
                objDownloadSettings.SiteSpecificKey = 1234;
                //Application path
                objDownloadSettings.ApplicationPath = Shared.ApplicationPath;
                OnCommandCompleted = new DelegateCommandCompleted(Query_OnCommandCompleted);
                objCallback = new CallbackClass();
                objCallback.OnHostToClient += new RemoteCallback(Status_Changed);
                //call back delegate
                RemoteCallback wire = new RemoteCallback(objCallback.HandleToClient);
                //Parameters to be passed between the client and CAMWorksDownloader service.
                CallbackEventArgs objCallBckArgs = new CallbackEventArgs();
                objCallBckArgs.CallBack = wire;
                objCallBckArgs.IsError = false;

                objCallBckArgs.Finished = false;

                objCallBckArgs.CommandId = CommandName.ConfigDownload;

                objCallBckArgs.State = 0;

                objCallBckArgs.Sender = GetType().ToString();

                objCallBckArgs.Parameters = objDownloadSettings;

                blnNoError = objIController.DownloadConfigData(objCallBckArgs);

                if (!blnNoError)
                {

                    arListStatus.Add(objCMWException.GetExceptions(objCMWException.LastException, ""));

                    // IsDownloadSuucessful = false;

                    OnCommandCompleted();

                }

                //objCMWException = null;

                objCallBckArgs = null;

                objDownloadSettings = null;

            }
            catch (Exception Ex)
            {

            }
        }