void Sbs2EmocapDataReader::execute()
{
    int counter = 0;
    int cc = 0;
    int uu = 0;
    int res = 0;
    while(1)
    {
        if(!running)
            return;
#ifdef Q_OS_MAC
        if (testDummyRead)
        {
            counter = (counter +1)%1024000;
            if (counter > 0)
                continue;
        }
        else
        {
	    res = hid_read(handle, (unsigned char*)buffer_main, sizeof(buffer_main));
	    if (res > 0)
		cc = 1;
	    if (res == -1)
	    {
		uu += (1-cc);
		if (uu == 100000)
		{
		    resetHandle();
		    uu = 0;
		}
		continue;
	    }

        }
#else
        if (testDummyRead)
        {
            counter = (counter +1)%1024000;
            if (counter > 0)
                continue;
        }
        else
        {
            rawFile.read(buffer_main, 32);

        }
#endif

        ++framesRead;
        sbs2EmotivDecryptor->decrypt(buffer_main,buffer_final);
        sbs2Packets[currentIndex] -> update(buffer_final);
        sbs2Callback->getData(sbs2Packets[currentIndex]);
        currentIndex = (currentIndex+1)%256;
    }
}
Example #2
0
		void Container::renew() {
			update();

			HWND handle = getHandle();
			if (handle != nullptr) {
				::DestroyWindow(handle);
				resetHandle();
			}

			for (Control* child : childs) {
				child->resetHandle();
			}

			refresh();
		}