Example #1
0
        public void ThresholdIncrement()
        {
            if (registered)
            {
                double newThreshold;

                if ((threshold + 6553.5) <= 65535)
                {
                    newThreshold = QsysCoreManager.ScaleDown(threshold + 6553.5);
                }
                else
                {
                    newThreshold = QsysCoreManager.ScaleDown(65535);
                }

                ComponentChange newChange = new ComponentChange()
                {
                    Params = new ComponentChangeParams()
                    {
                        Name = cName, Controls = new List <ComponentSetValue>()
                        {
                            new ComponentSetValue()
                            {
                                Name = "threshold", Position = newThreshold
                            }
                        }
                    }
                };

                QsysCoreManager.Cores[coreId].Enqueue(JsonConvert.SerializeObject(newChange, Formatting.None, new JsonSerializerSettings {
                    NullValueHandling = NullValueHandling.Ignore
                }));
            }
        }
Example #2
0
        public void HoldTimeDecrement()
        {
            if (registered)
            {
                double newHoldtime;

                if ((holdTime - 6553.5) >= 0)
                {
                    newHoldtime = QsysCoreManager.ScaleDown(holdTime - 6553.5);
                }
                else
                {
                    newHoldtime = QsysCoreManager.ScaleDown(0);
                }

                ComponentChange newChange = new ComponentChange()
                {
                    Params = new ComponentChangeParams()
                    {
                        Name = cName, Controls = new List <ComponentSetValue>()
                        {
                            new ComponentSetValue()
                            {
                                Name = "hold_time", Position = newHoldtime
                            }
                        }
                    }
                };

                QsysCoreManager.Cores[coreId].Enqueue(JsonConvert.SerializeObject(newChange, Formatting.None, new JsonSerializerSettings {
                    NullValueHandling = NullValueHandling.Ignore
                }));
            }
        }
Example #3
0
        /// <summary>
        /// Sets the current volume.
        /// </summary>
        /// <param name="value">The volume level to set to.</param>
        public void Volume(int value)
        {
            if (registered)
            {
                ComponentChange newVolumeChange = new ComponentChange()
                {
                    Params = new ComponentChangeParams()
                    {
                        Name = cName, Controls = new List <ComponentSetValue>()
                        {
                            new ComponentSetValue()
                            {
                                Name = "gain", Position = QsysCoreManager.ScaleDown(value)
                            }
                        }
                    }
                };

                QsysCoreManager.Cores[coreId].Enqueue(JsonConvert.SerializeObject(newVolumeChange, Formatting.None, new JsonSerializerSettings {
                    NullValueHandling = NullValueHandling.Ignore
                }));
            }
        }
Example #4
0
        public void SetInteger(int value, int scaled)
        {
            if (registered)
            {
                double newValue;
                ControlIntegerChange integer;

                if (scaled == 1)
                {
                    newValue = QsysCoreManager.ScaleDown(value);
                    integer  = new ControlIntegerChange()
                    {
                        Params = new ControlIntegerParams()
                        {
                            Name = cName, Position = newValue
                        }
                    };
                }
                else
                {
                    newValue = value;
                    integer  = new ControlIntegerChange()
                    {
                        Params = new ControlIntegerParams()
                        {
                            Name = cName, Value = newValue
                        }
                    };
                }



                QsysCoreManager.Cores[coreId].Enqueue(JsonConvert.SerializeObject(integer, Formatting.None, new JsonSerializerSettings {
                    NullValueHandling = NullValueHandling.Ignore
                }));
            }
        }