From: Dominic L. <ma...@us...> - 2005-05-04 19:22:49
|
Update of /cvsroot/robotflow/RobotFlow/Devices/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22557/src Modified Files: SNCRZ30.cc Log Message: waiting on socket, adding speed configuration Index: SNCRZ30.cc =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/Devices/src/SNCRZ30.cc,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** SNCRZ30.cc 29 Mar 2005 15:20:39 -0000 1.22 --- SNCRZ30.cc 4 May 2005 19:22:36 -0000 1.23 *************** *** 82,85 **** --- 82,90 ---- * @parameter_description Continuously grab images ? * + * @parameter_name TRANSMIT_SPEED + * @parameter_type int + * @parameter_value 0 + * @parameter_description transfer rate FPS [0=FASTEST] + * * @parameter_name WAIT_REPLY * @parameter_type bool *************** *** 141,149 **** m_wait_reply = dereference_cast<bool>(parameters.get("WAIT_REPLY")); m_inquiryPosition = dereference_cast<bool>(parameters.get("INQUIRY_POSITION")); ! //initialize camera position m_currentZoom = 0; m_currentTilt = 0; m_currentPan = 0; } --- 146,156 ---- m_wait_reply = dereference_cast<bool>(parameters.get("WAIT_REPLY")); m_inquiryPosition = dereference_cast<bool>(parameters.get("INQUIRY_POSITION")); ! m_transmitSpeed = dereference_cast<int>(parameters.get("TRANSMIT_SPEED")); ! //initialize camera position m_currentZoom = 0; m_currentTilt = 0; m_currentPan = 0; + } *************** *** 308,312 **** //send periodic images on image socket... ostringstream my_stream; ! my_stream << "GET http://"<<m_host<<":"<<m_port<<"/image?speed=0 HTTP/1.1\r\n"<<endl; int sent_size = m_imageSocket.send_packet((unsigned char*)my_stream.str().c_str(), my_stream.str().size()); //cerr<<"sent request size "<<sent_size<<endl; --- 315,319 ---- //send periodic images on image socket... ostringstream my_stream; ! my_stream << "GET http://"<<m_host<<":"<<m_port<<"/image?speed="<<m_transmitSpeed<<" HTTP/1.1\r\n"<<endl; int sent_size = m_imageSocket.send_packet((unsigned char*)my_stream.str().c_str(), my_stream.str().size()); //cerr<<"sent request size "<<sent_size<<endl; *************** *** 622,643 **** //read data on socket ! char buffer[32768]; int size = m_imageSocket.recv_packet((unsigned char*)buffer,32768); //cerr<<"SNCRZ30::update_data got size :"<<size<<endl; - - int last_image_num = process_image_data(buffer,size); ! //reading all images in the buffer ! while(1) { ! ! int temp_image_num = process_image_data(NULL,0); ! ! if (temp_image_num == last_image_num){ ! break; } else { ! last_image_num = temp_image_num; ! } } } --- 629,650 ---- //read data on socket ! static char buffer[32768]; ! static int current_image_num = 0; + //read data int size = m_imageSocket.recv_packet((unsigned char*)buffer,32768); //cerr<<"SNCRZ30::update_data got size :"<<size<<endl; ! if (size > 0) { ! //process data ! int last_image_num = process_image_data(buffer,size); ! ! //look for a new image ! if (last_image_num > current_image_num) { ! current_image_num = last_image_num; } else { ! update_data(); ! } } } |