Пример #1
0
        public async void SendSignalAsync(IRCode iRCode, string BlasterName)
        {
            if (iRCode.Command != null && iRCode.Command != "")
            {
                Rm RMBlaster = GetRMBlasterByName(BlasterName);
                WLog("Send {0} via {1}", iRCode.Name, BlasterName);
                var x = await RMBlaster.Auth();

                if (x)
                {
                    var data = StringHelper.CreateBytesFromHexString(iRCode.Command);
                    x = await RMBlaster.SendData(data);

                    if (x)
                    {
                        WLog("OK");
                    }
                    else
                    {
                        WLog("! Blaster [{0}] not respond", BlasterName);
                    }
                }
                else
                {
                    WLog("! Blaster [{0}] not respond", BlasterName);
                }
            }
        }
Пример #2
0
        public async void LearnIRCodeAsync(IRCode irCode, string BlasterName)
        {
            Rm RMBlaster = GetRMBlasterByName(BlasterName);

            WLog("Enter learning mode on {0}", BlasterName);
            var x = await RMBlaster.Auth();

            if (x)
            {
                x = await RMBlaster.EnterLearning();

                if (x)
                {
                    MessageBox.Show(" Point the remote control to be learned to RM Pro, and press the button. Hit OK finally", "Learning...", MessageBoxButtons.OK);
                    var data = await RMBlaster.CheckData();

                    if (data.Length > 0)
                    {
                        string code = StringHelper.CreateHexPrintableString(data);
                        WLog("Code={0}", code);
                        irCode.Command = code;
                    }
                }
                else
                {
                    WLog("! Blaster [{0}] not respond", BlasterName);
                }
            }
            else
            {
                WLog("! Blaster [{0}] not respond", BlasterName);
            }
        }
Пример #3
0
 public void ProcessDigitalEvent(int iJoin, bool Data)
 {
     //throw new NotImplementedException();
     if (Data)
     {
         IRCode irc = PluginSettings.IRCodes[iJoin - 1];
         SendSignalAsync(irc, irc.Blaster);
     }
 }