示例#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
        private async void SendSignalAsync(int join)
        {
            Rm RMBlaster = GetRMBlasterByName(IRCodes[join].Blaster);

            WLog("Send {0} via {1}", IRCodes[join].Name, IRCodes[join].Blaster);
            var x = await RMBlaster.Auth();

            if (x)
            {
                var data = StringHelper.CreateBytesFromHexString(IRCodes[join].Command);
                x = await RMBlaster.SendData(data);

                if (x)
                {
                    WLog("OK");
                }
                else
                {
                    WLog("! Blaster [{0}] not respond", IRCodes[join].Blaster);
                }
            }
            else
            {
                WLog("! Blaster [{0}] not respond", IRCodes[join].Blaster);
            }
        }
示例#3
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);
            }
        }
示例#4
0
        private async void StartLearningAsync()
        {
            var DevName   = ((IRCode)dgvIRCodes.CurrentRow.DataBoundItem).Blaster;
            Rm  RMBlaster = GetRMBlasterByName(DevName);

            WLog("Enter learning mode on {0}", DevName);
            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)dgvIRCodes.CurrentRow.DataBoundItem).Command = code;
                        dgvIRCodes.Refresh();
                    }
                }
                else
                {
                    WLog("! Blaster [{0}] not respond", DevName);
                }
            }
            else
            {
                WLog("! Blaster [{0}] not respond", DevName);
            }
        }