Example #1
0
        public void SetString(string _value)
        {
            ControlSetValue cs = new ControlSetValue();

            cs.method = "Control.Set";
            cs.Params = new ControlSetValueParams {
                Name = this.controlName, Value = _value
            };
            this.myCore.Enqueue(JsonConvert.SerializeObject(cs));
        }
Example #2
0
 public void Trigger()
 {
     if (ControlType == eControlType.isTrigger)
     {
         ControlSetValue cs = new ControlSetValue();
         cs.method = "Control.Set";
         cs.Params = new ControlSetValueParams {
             Name = this.controlName, Value = "1"
         };
         this.myCore.Enqueue(JsonConvert.SerializeObject(cs));
     }
 }
Example #3
0
 public void SetState(bool _value)
 {
     if (this.ControlType == eControlType.isButton)
     {
         ControlSetValue cs = new ControlSetValue();
         cs.method = "Control.Set";
         cs.Params = new ControlSetValueParams {
             Name = this.controlName, Value = _value ? "1":"0"
         };
         this.myCore.Enqueue(JsonConvert.SerializeObject(cs));
     }
 }
Example #4
0
 public void SetStateToggle()
 {
     if (ControlType == eControlType.isButton)
     {
         this.controlBool = !this.controlBool;
         ControlSetValue cs = new ControlSetValue();
         cs.method = "Control.Set";
         cs.Params = new ControlSetValueParams {
             Name = this.controlName, Value = this.controlBool ? "1":"0"
         };
         this.myCore.Enqueue(JsonConvert.SerializeObject(cs));
     }
 }
Example #5
0
 public void SetValue(double _value)
 {
     if (this.controlType == eControlType.isIntegerValue || this.controlType == eControlType.isFloatValue)
     {
         ControlSetValue cs = new ControlSetValue();
         cs.method = "Control.Set";
         cs.Params = new ControlSetValueParams {
             Name = this.controlName, Value = Math.Round(_value, 8).ToString(), Ramp = this.rampTime
         };
         CrestronConsole.PrintLine(String.Format("setting val to {0}", _value.ToString()));
         this.myCore.Enqueue(JsonConvert.SerializeObject(cs));
     }
 }
Example #6
0
 public void SetPosition(double _position)
 {
     if (this.controlType == eControlType.isIntegerValue || this.controlType == eControlType.isFloatValue)
     {
         double          p  = clamp(_position, 0.0, 1.0);
         ControlSetValue cs = new ControlSetValue();
         cs.method = "Control.Set";
         cs.Params = new ControlSetValueParams {
             Name = this.controlName, Position = Math.Round(p, 8), Ramp = this.rampTime, typePos = true
         };
         this.myCore.Enqueue(JsonConvert.SerializeObject(cs));
     }
 }