Beispiel #1
0
        public void OnSampleRateUpdate(std_msgs.Int32 sample_rate)
        {
            var changed = false;

            lock (config.ConfigLock)
            {
                if (config.sample_rate != sample_rate.data)
                {
                    config.sample_rate = sample_rate.data;
                    changed            = true;
                }
            }
            if (changed)
            {
                OnSettingsChanged();
            }
        }
Beispiel #2
0
        public void OnNumChannelUpdate(std_msgs.Int32 num_channels)
        {
            var changed = false;

            lock (config.ConfigLock)
            {
                if (config.num_channels != num_channels.data)
                {
                    config.num_channels = num_channels.data;
                    changed             = true;
                }
            }


            if (changed)
            {
                OnSettingsChanged();
            }
        }
Beispiel #3
0
        public void Loop()
        {
            var msec_pause = (config.controller_hz < 1) ? 1 : 1000 / config.controller_hz;

            std_msgs.Int32 msg_nchan = new std_msgs.Int32();
            std_msgs.Int32 msg_srate = new std_msgs.Int32();
            while (true)
            {
                lock (config.ConfigLock)
                {
                    msg_nchan.data = config.num_channels;
                    msg_srate.data = config.sample_rate;
                }
                lock (config.SocketLock)
                {
                    config.socket.Publish(config.get_nchan_topic_id, msg_nchan);
                    config.socket.Publish(config.get_srate_topic_id, msg_srate);
                }
                Thread.Sleep(msec_pause);
            }
        }