Esempio n. 1
0
        void myKeypad_ButtonStateChange(GenericBase device, ButtonEventArgs args)
        {
            CrestronConsole.PrintLine("Keypad ID: {0:x}, ButtonNo: {1}, ButtonState: (2)", device.ID, args.Button.Number, args.Button.State);  // Keypad first excercise  If you do {0} will print decimal  :x does Hex.
            myEISC.StringInput[1].StringValue = String.Format("Keypad ButtonName: {0}, ButtonNo: {1}, State: {2}", args.Button.Name, args.Button.Number, args.Button.State);
            if (args.Button.State == eButtonState.Pressed)
            {
                this.VersiPorts[args.Button.Number].DigitalOut = true;
                switch (args.Button.Name)
                {
                case eButtonName.Up:
                    myPort.Press("UP_ARROW");
                    ComPorts[1].Send("Test Transmission please ignore");
                    break;

                case eButtonName.Down:
                    myPort.Press("DN_ARROW");
                    ComPorts[1].Send("\n");
                    break;

                default:
                    CrestronConsole.PrintLine("Key Not Programmed: {0}", args.Button.Number);
                    break;
                }
            }
            if (args.Button.State == eButtonState.Released)
            {
                myPort.Release();
                this.VersiPorts[args.Button.Number].DigitalOut = false;
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Starts and stops IR command on driver. Safe for missing commands
 /// </summary>
 public virtual void PressRelease(string command, bool state)
 {
     Debug.Console(2, this, "IR:'{0}'={1}", command, state);
     if (IrPort == null)
     {
         Debug.Console(2, this, "WARNING No IR Port assigned to controller");
         return;
     }
     if (!DriverIsLoaded)
     {
         Debug.Console(2, this, "WARNING IR driver is not loaded");
         return;
     }
     if (state)
     {
         if (IrPort.IsIRCommandAvailable(IrPortUid, command))
         {
             IrPort.Press(IrPortUid, command);
         }
         else
         {
             NoIrCommandError(command);
         }
     }
     else
     {
         IrPort.Release();
     }
 }
Esempio n. 3
0
        public void PressDn_Pressed(uint i)
        {
            if (GV.MyControlSystem.SupportsVersiport && GV.MyControlSystem.NumberOfVersiPorts >= i)
            {
                Versiport myVersiport = GV.MyControlSystem.VersiPorts[i];
                myVersiport.DigitalOut = true;
            }

            if (GV.MyControlSystem.SupportsIROut && GV.MyControlSystem.NumberOfIROutputPorts >= 1)
            {
                IROutputPort myIRPort = GV.MyControlSystem.IROutputPorts[1];
                myIRPort.Press("DN_ARROW");
            }

            if (GV.MyControlSystem.SupportsComPort && GV.MyControlSystem.NumberOfComPorts >= i)
            {
                ComPort myComPort = GV.MyControlSystem.ComPorts[i];
                myComPort.Send("\n");
            }
        }
Esempio n. 4
0
        public void PressUp_Pressed(uint i)
        {
            if (GV.MyControlSystem.SupportsVersiport && GV.MyControlSystem.NumberOfVersiPorts >= i)
            {
                Versiport myVersiport = GV.MyControlSystem.VersiPorts[i];
                myVersiport.DigitalOut = true;
            }

            if (GV.MyControlSystem.SupportsIROut && GV.MyControlSystem.NumberOfIROutputPorts >= 1)
            {
                IROutputPort myIRPort = GV.MyControlSystem.IROutputPorts[1];
                myIRPort.Press("UP_ARROW");
            }

            if (GV.MyControlSystem.SupportsComPort && GV.MyControlSystem.NumberOfComPorts >= i)
            {
                ComPort myComPort = GV.MyControlSystem.ComPorts[i];
                myComPort.Send("Test transmition, please ignore");
            }
        }
Esempio n. 5
0
        public void ButtonPress(AppleTVButtonCommands command)
        {
            if (_cec != null)
            {
                switch (command)
                {
                case AppleTVButtonCommands.Select:
                    _cec.Send.StringValue = "\x04\x44\x00";
                    break;

                case AppleTVButtonCommands.Up:
                    _cec.Send.StringValue = "\x04\x44\x01";
                    break;

                case AppleTVButtonCommands.Down:
                    _cec.Send.StringValue = "\x04\x44\x02";
                    break;

                case AppleTVButtonCommands.Left:
                    _cec.Send.StringValue = "\x04\x44\x03";
                    break;

                case AppleTVButtonCommands.Right:
                    _cec.Send.StringValue = "\x04\x44\x04";
                    break;

                case AppleTVButtonCommands.Menu:
                    _cec.Send.StringValue = "\x04\x44\x0D";
                    break;

                case AppleTVButtonCommands.Home:
                    _cec.Send.StringValue = "\x04\x44\x10";
                    break;

                case AppleTVButtonCommands.PlayPause:
                    _cec.Send.StringValue = "\x04\x44\x44";
                    break;
                }
            }
            else if (_irPort != null)
            {
                switch (command)
                {
                case AppleTVButtonCommands.Select:
                    _irPort.Press("SELECT");
                    break;

                case AppleTVButtonCommands.Up:
                    _irPort.Press("UP_ARROW");
                    break;

                case AppleTVButtonCommands.Down:
                    _irPort.Press("DOWN_ARROW");
                    break;

                case AppleTVButtonCommands.Left:
                    _irPort.Press("LEFT_ARROW");
                    break;

                case AppleTVButtonCommands.Right:
                    _irPort.Press("RIGHT_ARROW");
                    break;

                case AppleTVButtonCommands.Menu:
                    _irPort.Press("MENU");
                    break;

                case AppleTVButtonCommands.Home:
                    _irPort.Press("MENU");
                    break;

                case AppleTVButtonCommands.PlayPause:
                    _irPort.Press("PLAY/PAUSE");
                    break;
                }
            }
        }