void MyControlBox::receiveClickedNode(Node* node, int control){ if (g != NULL) { g->widget->updateDisplay = 0; } if (control == 1){ setValue(node->getScale()[1][1]); } else if (control == 2) { setValue(node->getTranslation()[0][2]); } else if (control ==3){ setValue(node->getTranslation()[1][2]); } else if( control == 4){ float rotate = node->rotateValue; if (node->hasGeometry()){ setValue(node->getPolygon()->getSides()); // cout<<"GEOMETRY FOUND" << node->getPolygon()->getSides()<<endl; float* colors = (node->getPolygon())->getColors(); float red = colors[0]; float green = colors[1]; float blue = colors[2]; emit passData(red, green, blue, rotate, node->hasGeometry(), 0 ); } else { setValue(0); emit passData(0,0,0,rotate,0,0); } emit sendName(node->getName()); } if (g != NULL) { g->widget->updateDisplay = 1; } emit sendClickedNode(node, (++control)); }
void Server::runLoop(){ timeval timeValue; char* data; bool resend = false; int x; int y; timeval returnedTime; while(true){ //sleep(1);//for testng only. Otherwise it is way too fast if(!resend){ //NOTE: TO BE REPLACED WITH SYSTEM CALL TO BLAST BUS SOMEHOW gettimeofday(&timeValue, NULL);//gets a time value if(abs(lagTime.tv_sec - timeValue.tv_sec) > 300){ updateLag(); gettimeofday(&timeValue, NULL); } } printf("sending data: %ld seconds, %ld microseconds\n", timeValue.tv_sec, timeValue.tv_usec); sendData(timeValue);//sends the query time to the laptop resend = false; data = recieveData();//recieves the response if(!strcmp(data, "resend\n")){//if there was a resend request printf("Resending old data\n"); resend = true; free(data); continue; }else{ if(!strcmp(data, "")){//if there was an error printf("Exiting\n"); free(data); return; } //extracts data from the string sscanf(data, "X=%d;Y=%d;s=%ld;us=%ld\n", &x, &y, &returnedTime.tv_sec, &returnedTime.tv_usec); passData(x, y, returnedTime);//passes data back to the blast bus free(data); } } }