void FlowStream::messageHandler(const string& action,AMFReader& message) { if(action=="play") { disengage(); _state = PLAYING; message.read((string&)name); // TODO implements completly NetStream.play method, with possible NetStream.play.failed too! double start = -2000; if(message.available()) start = message.readNumber(); BinaryWriter& data = writer.writeRawMessage(true); data.write8(0x0F); data.write32(0x00); data.write8(0x00); AMFWriter amf(data); amf.write("|RtmpSampleAccess"); amf.writeBool(handler.audioSampleAccess); amf.writeBool(handler.videoSampleAccess); writer.writeStatusResponse("Play.Reset","Playing and resetting " + name); writer.writeStatusResponse("Play.Start","Started playing " + name); handler.streams.subscribe(peer,_index,name,writer,start); } else if(action == "closeStream") { disengage(); } else if(action=="publish") { disengage(); string type; message.read((string&)name); if(message.available()) message.read(type); // TODO recording publication feature! if(handler.streams.publish(peer,_index,name)) { writer.writeStatusResponse("Publish.Start",name +" is now published"); _state = PUBLISHING; } else writer.writeStatusResponse("Publish.BadName",name +" is already publishing"); } else if(_state==PUBLISHING) { if(!_pPublication) { Publications::Iterator it = handler.streams.publications(name); if(it!=handler.streams.publications.end()) _pPublication = it->second; else ERROR("Publication %s unfound, related for the %s message",name.c_str(),action.c_str()); } if(_pPublication) _pPublication->pushDataPacket(peer,action,message.reader); } else Flow::messageHandler(action,message); }
void FlowStream::messageHandler(const string& action,AMFReader& message) { if(action=="play") { disengage(); message.read((string&)name); // TODO implements completly NetStream.play method, with possible NetStream.play.failed too! double start = -2000; if(message.available()) start = message.readNumber(); try { _pListener = &invoker._streams.subscribe(peer,_index,name,writer,start); _state = PLAYING; } catch(...) {} } else if(action == "closeStream") { disengage(); } else if(action=="publish") { disengage(); string type; message.read((string&)name); if(message.available()) message.read(type); // TODO recording publication feature! try { invoker._streams.publish(peer,_index,name,&writer); _state = PUBLISHING; } catch(...) {} } else if(_state==PUBLISHING) { if(!_pPublication) { Publications::Iterator it = invoker.publications(name); if(it!=invoker.publications.end()) _pPublication = it->second; else ERROR("Publication %s unfound, related for the %s message",name.c_str(),action.c_str()); } if(_pPublication) _pPublication->pushDataPacket(action,message.reader); } else if(_pListener && action=="receiveAudio") _pListener->receiveAudio = message.readBoolean(); else if(_pListener && action=="receiveVideo") _pListener->receiveVideo = message.readBoolean(); else Flow::messageHandler(action,message); }
// *************************************************************************** // MVDetails desctructor. // Delete the join graph of the MV. // *************************************************************************** MVDetails::~MVDetails() { if (joinGraph_) deletePtr(joinGraph_); // In outputByColumnName_ we use the ID qualified column name as the key. // For each entry we dynamically allocate this string and initialize it, // so now we need to delete it. // The value of this hash table is a descriptor element, that will be deleted // with the rest of the descriptor. QRElementHashIterator iter(outputByColumnName_); CollIndex maxEntries = iter.entries(); const NAString* key; QRElementPtr value; for (CollIndex i=0; i<maxEntries; i++) { iter.getNext(key, value); delete key; } outputByColumnName_.clear(); if (mvMemoGroups_.entries() > 0) disengage(); outputByExprText_.clear(); }
int depulse_and_get_temp_sysfs() { if (cur_lvl >= DEPULSE_MIN_LVL && cur_lvl <= DEPULSE_MAX_LVL) { disengage(); setfan_sysfs(); } return get_temp_sysfs(); }
// Set the OpenGL mode to use for texture addressing in // the S and T dimensions respectively. void gTexture::setWrap(GLint wrapS, GLint wrapT) { engage(); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapS); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapT); disengage(); }
// Set the OpenGL texture-filtering mode to use for texture // magnification and minification respectively. void gTexture::setFilter(GLint magFilter, GLint minFilter) { engage(); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, magFilter); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minFilter); disengage(); }
void gTexture::loadData(GLint internalFormat, GLint format, GLint type, int width, int height, const void *data, bool mipmaps) { engage(); mWidth = width; mHeight = height; size_t lineSize = width * gTexture::getPixelSize(format, type); GLint alignment; glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment); while ((lineSize & (alignment / 2)) != 0) { glPixelStorei(GL_UNPACK_ALIGNMENT, alignment / 2); glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment); } if (data && mipmaps) { glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format, type, data); glGenerateMipmap(GL_TEXTURE_2D); } else { glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format, type, data); } disengage(); }
void FlowStream::messageHandler(const string& action,AMFReader& message) { if(action=="play") { disengage(); message.read((string&)name); // TODO implements completly NetStream.play method, with possible NetStream.play.failed too! double start = -2000; if(message.available()) start = message.readNumber(); if(invoker._streams.subscribe(peer,_index,name,writer,start)) _state = PLAYING; } else if(action == "closeStream") { disengage(); } else if(action=="publish") { disengage(); string type; message.read((string&)name); if(message.available()) message.read(type); // TODO recording publication feature! try { invoker._streams.publish(peer,_index,name); _state = PUBLISHING; writer.writeStatusResponse("Publish.Start",name +" is now published"); } catch(Exception& ex) { writer.writeStatusResponse(ex.code() == Publication::BADNAME ? "Publish.BadName" : "Publish.Failed", ex.displayText()); } } else if(_state==PUBLISHING) { if(!_pPublication) { Publications::Iterator it = invoker.publications(name); if(it!=invoker.publications.end()) _pPublication = it->second; else ERROR("Publication %s unfound, related for the %s message",name.c_str(),action.c_str()); } if(_pPublication) _pPublication->pushDataPacket(action,message.reader); } else Flow::messageHandler(action,message); }
void gTexture::allocateSpace(GLint internalFormat, GLint format, GLint type, int width, int height) { engage(); mWidth = width; mHeight = height; glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format, type, NULL); disengage(); }
void *gTexture::getData(GLint format, GLint type) { size_t lineSize = mWidth * gTexture::getPixelSize(format, type); GLint alignment; glGetIntegerv(GL_PACK_ALIGNMENT, &alignment); while ((lineSize & (alignment / 2)) != 0) { glPixelStorei(GL_PACK_ALIGNMENT, alignment / 2); glGetIntegerv(GL_PACK_ALIGNMENT, &alignment); } void *data = malloc(lineSize * mHeight); engage(); glGetTexImage(GL_TEXTURE_2D, 0, format, type, data); disengage(); return data; }
int main(int argc, char** argv) { ros::init(argc, argv, "advanced_servo_client"); ros::NodeHandle n; ros::Subscriber servo_sub = n.subscribe("phidgets/servos", 1, servoCallback); client_servo_reference = n.serviceClient<phidgets::servo_reference>("servo_reference"); ros::Rate loop_rate(30); while(ros::ok) { set_servo_reference(1, true, 255/2 - 23, 20,20); set_servo_reference(2, true, 255/2 - 23, 20,20); ros::spinOnce(); loop_rate.sleep(); if ((int)getc(stdin) == 27) break; } disengage(); return 0; }
FlowStream::~FlowStream() { disengage(); }