Infinite burst

Interested in integrating USB-UIRT support into an application? Look here!

Moderator: jrhees

Infinite burst

Postby streets97f1 » Thu Jan 31, 2008 10:48 pm

Is there a way to give UIRT a command to infinitly transmit a burst until a halt command is give to stop burst? This would make repeating buttons (ie volume up and down) faster and more reponsive.
streets97f1
 
Posts: 1
Joined: Thu Jan 31, 2008 9:56 pm

Postby canoewhiteh2o » Thu Feb 14, 2008 9:53 pm

Below is code that I use to repeatedly transmit while the mouse button is held down.

Code: Select all
private Thread repeatThread = null;
private int initialLongPause = 200;       
private bool threadStarted = false;
private object repeatSender; //object used to copy button to repeat

        protected void repeatCommand()
        {           
            //Initial long pause
            System.Threading.Thread.Sleep(initialLongPause);
            TimeSpan ts;
            bool senderState = false;
            threadStarted = true;               
            if (repeatSender.GetType() == typeof(System.Windows.Forms.Button))
            {
                Button irsender;
                irsender = ((Button)(repeatSender));
                if (irsender.Enabled) senderState = true;
            }
            while (!senderState)
            {
                System.Threading.Thread.Sleep(10);
            }
        }

        private void MainForm_MouseUp(object sender, MouseEventArgs e)
        {
            buttonVolUp.Enabled = true;
            buttonVolDown.Enabled = true;
            buttonChUp.Enabled = true;
            buttonChDown.Enabled = true;
            threadStarted = false;
            if (repeatThread != null) repeatThread.Abort();//Abort thread


hopefully this may be helpful.

Gary B
canoewhiteh2o
 
Posts: 66
Joined: Thu Dec 28, 2006 1:52 pm

Postby canoewhiteh2o » Fri Feb 15, 2008 1:14 am

canoewhiteh2o
 
Posts: 66
Joined: Thu Dec 28, 2006 1:52 pm


Return to Developers

Who is online

Users browsing this forum: Google [Bot] and 22 guests

cron