/// <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(); } }
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; } }
public void ButtonRelease() { if (_cec != null) { _cec.Send.StringValue = "\x04\x45"; } else if (_irPort != null) { _irPort.Release(); } }
public void PressUp_Released(uint i) { if (GV.MyControlSystem.SupportsVersiport && GV.MyControlSystem.NumberOfVersiPorts >= i) { Versiport myVersiport = GV.MyControlSystem.VersiPorts[i]; myVersiport.DigitalOut = false; } if (GV.MyControlSystem.SupportsIROut && GV.MyControlSystem.NumberOfIROutputPorts >= 1) { IROutputPort myIRPort = GV.MyControlSystem.IROutputPorts[1]; myIRPort.Release(); } if (GV.MyControlSystem.SupportsComPort && GV.MyControlSystem.NumberOfComPorts >= i) { ComPort myComPort = GV.MyControlSystem.ComPorts[i]; myComPort.Send(" "); } }