Пример #1
0
void ofxSimpleSerial::read()
{
	// if we've got new bytes
	if(available() > 0)
	{
	   // we wil keep reading until nothing is left
		while (available() > 0)
		{
		   // we'll put the incoming bytes into bytesReturned
		   readBytes(bytesReturned, NUM_BYTES);
		
		   // if we find the splitter we put all the buffered messages 
		   //   in the final message, stop listening for more data and 
		   //   notify a possible listener
		   // else we just keep filling the buffer with incoming bytes. 
		   if(*bytesReturned == '\n')
			{
			   message = messageBuffer;
			   messageBuffer = "";
			   ofRemoveListener(ofEvents().update, this, &ofxSimpleSerial::update);
			   ofNotifyEvent(NEW_MESSAGE,message,this);
			   
			   break;
			}
			else 
			{
			   if(*bytesReturned != '\r')
				   messageBuffer += *bytesReturned;
			}
		    //cout << "  messageBuffer: " << messageBuffer << "\n";
		}
	   
		// clear the message buffer
		memset(bytesReturned,0,NUM_BYTES);
	}
}
//--------------------------------------------------------------
void testApp::setupArduino(const int & version) {
	
	// remove listener because we don't need it anymore
	ofRemoveListener(ard.EInitialized, this, &testApp::setupArduino);
    
    // it is now safe to send commands to the Arduino
    bSetupArduino = true;
    
    // print firmware name and version to the console
    cout << ard.getFirmwareName() << endl; 
    cout << "firmata v" << ard.getMajorFirmwareVersion() << "." << ard.getMinorFirmwareVersion() << endl;
        
    // Note: pins A0 - A5 can be used as digital input and output.
    // Refer to them as pins 14 - 19 if using StandardFirmata from Arduino 1.0.
    // If using Arduino 0022 or older, then use 16 - 21.
    // Firmata pin numbering changed in version 2.3 (which is included in Arduino 1.0)
    
    // set pin A0 to analog input - IR SENSOR #1
    ard.sendAnalogPinReporting(0, ARD_ANALOG);
    
    // set pin A1 to analog input  - IR SENSOR #2
    ard.sendAnalogPinReporting(1, ARD_ANALOG);

    // set pin A2 to analog input
    
    // - UNCOMMENT LINE BELOW for - IR SENSOR #3
    //ard.sendAnalogPinReporting(2, ARD_ANALOG);

    
    // set pin D13 as digital output
	ard.sendDigitalPinMode(13, ARD_OUTPUT);
      
    // Listen for changes on the digital and analog pins
    ofAddListener(ard.EDigitalPinChanged, this, &testApp::digitalPinChanged);
    ofAddListener(ard.EAnalogPinChanged, this, &testApp::analogPinChanged);    
}
//-------------------------------------------------------------------------------------------------------------------------------------
//
void Tweenable1DValue::disableAutoTweenUpdate()
{
	ofRemoveListener(ofEvents().update, this, &Tweenable1DValue::_update);
}
Пример #4
0
ofBitmapFont::~ofBitmapFont(){
#ifdef TARGET_ANDROID
	ofRemoveListener(ofxAndroidEvents().unloadGL,this,&ofBitmapFont::unloadTexture);
#endif
}
Пример #5
0
//--------------------------------------------------------------
void ofxMtlMapping2D::removeListeners() {
	ofRemoveListener(ofEvents().mousePressed, this, &ofxMtlMapping2D::mousePressed);
    //ofRemoveListener(ofEvents().keyPressed, this, &ofxMtlMapping2D::keyPressed);
    //ofRemoveListener(ofEvents().windowResized, this, &ofxMtlMapping2D::windowResized);

}
Пример #6
0
UserInterface::~UserInterface()
{
    ofRemoveListener(buttonSelectEvent, this,&UserInterface::onButtonSelect);
    ofRemoveListener(buttonDeselectEvent, this,&UserInterface::onButtonDeselect);
}
Пример #7
0
void ofxLayout::disableMouseEvents(){
    ofRemoveListener(ofEvents().mouseMoved, this, &ofxLayout::mouseMoved);
    ofRemoveListener(ofEvents().mousePressed, this, &ofxLayout::mousePressed);
    ofRemoveListener(ofEvents().mouseReleased, this, &ofxLayout::mouseReleased);
    ofRemoveListener(ofEvents().mouseDragged, this, &ofxLayout::mouseDragged);
}
ICalendarWatcher::~ICalendarWatcher()
{
    ofRemoveListener(ofEvents().update, this, &ICalendarWatcher::update);
}
//--------------------------------------------------------------
void ofxMSAInteractiveObject::disableAppEvents() {
	ofRemoveListener(ofEvents().setup, this, &ofxMSAInteractiveObject::_setup);
	ofRemoveListener(ofEvents().update, this, &ofxMSAInteractiveObject::_update);
	ofRemoveListener(ofEvents().draw, this, &ofxMSAInteractiveObject::_draw);
	ofRemoveListener(ofEvents().exit, this, &ofxMSAInteractiveObject::_exit);
}
ofxThreadedImageLoaderSingleton::~ofxThreadedImageLoaderSingleton(){
	condition.signal();
    ofRemoveListener(ofEvents().update, this, &ofxThreadedImageLoaderSingleton::update);
	ofRemoveListener(ofURLResponseEvent(),this,&ofxThreadedImageLoaderSingleton::urlResponse);
}
Пример #11
0
ofxQuad::~ofxQuad() {
	ofRemoveListener(ofEvents().keyReleased, this, &ofxQuad::keyPressed);
    	this->initialized = false;
}
Пример #12
0
CalendarWidget::~CalendarWidget()
{
    ofRemoveListener(ofEvents().update, this, &CalendarWidget::update);
}
Пример #13
0
//------------------------------------------------------------------------------
void testApp::exit()
{
    ofRemoveListener(myClass.enabled, this, &testApp::myClassEnabled);
}
Пример #14
0
	//---------------------------------------------------------------------------------------
	void AudioBufferSamples::stop()
	{
		stopped=true;
		ofRemoveListener(source->newFrameEvent,this,&AudioBufferSamples::newAudioFrame);
	}
Пример #15
0
void BaseJoint::unregisterMouseEvents() {
  ofRemoveListener(ofEvents().mousePressed, this, &BaseJoint::mousePressed);
  ofRemoveListener(ofEvents().mouseDragged, this, &BaseJoint::mouseDragged);
}
Пример #16
0
void ofApp::exit(){
	ofRemoveListener(ofEvents().draw, this, &ofApp::drawMousePosition, OF_EVENT_ORDER_AFTER_APP+1);
}
Пример #17
0
void ofxSimpleSerial::stopContinuesRead()
{
	continuesRead = false;
	ofRemoveListener(ofEvents().update, this, &ofxSimpleSerial::update);
}
//--------------------------------------------------------------
void ofxMSAInteractiveObject::disableMouseEvents() {
	ofRemoveListener(ofEvents().mousePressed, this, &ofxMSAInteractiveObject::_mousePressed);
	ofRemoveListener(ofEvents().mouseMoved, this, &ofxMSAInteractiveObject::_mouseMoved);
	ofRemoveListener(ofEvents().mouseDragged, this, &ofxMSAInteractiveObject::_mouseDragged);
	ofRemoveListener(ofEvents().mouseReleased, this, &ofxMSAInteractiveObject::_mouseReleased);
}
// ---------------------------------------------------------------------------------------------------------------------------------------------------
//
ClientOSCManager::~ClientOSCManager()
{
	ofRemoveListener(ofEvents().update, this, &ClientOSCManager::_update);	
}
Пример #20
0
ofxMouseRuler::~ofxMouseRuler(){
	if(setupDone){
		ofUnregisterMouseEvents(this);
		ofRemoveListener(ofEvents().draw, this, &ofxMouseRuler::draw, OF_EVENT_ORDER_AFTER_APP+1);
	}
}
Пример #21
0
//----------------------------------------
void ofEasyCamExt::disableMouseInput(){
	if(bMouseInputEnabled){
		bMouseInputEnabled = false;
		ofRemoveListener(ofEvents().update, this, &ofEasyCamExt::update);
	}
}
Пример #22
0
 //--------------------------------------------------------------
 Client::~Client(){
     exit();
     ofRemoveListener( ofEvents().update, this, &Client::update);
 }
//--------------------------------------------------------------
void ofxMSAInteractiveObject::disableKeyEvents() {
	ofRemoveListener(ofEvents().keyPressed, this, &ofxMSAInteractiveObject::_keyPressed);
	ofRemoveListener(ofEvents().keyReleased, this, &ofxMSAInteractiveObject::_keyReleased);
}
		void PluginDashboardUIManager::disablePluginLifecycleEvents() {
			ofRemoveListener(ScriptEngineCoreEvents::getInstance().getPluginLifecycleEvents().pluginFound, this, &PluginDashboardUIManager::onNewPlugin);
			ofRemoveListener(ScriptEngineCoreEvents::getInstance().getPluginLifecycleEvents().pluginLoaded, this, &PluginDashboardUIManager::onPluginLoaded);
			ofRemoveListener(ScriptEngineCoreEvents::getInstance().getPluginLifecycleEvents().pluginReady, this, &PluginDashboardUIManager::onPluginReady);
			ofRemoveListener(ScriptEngineCoreEvents::getInstance().getPluginLifecycleEvents().pluginStartError, this, &PluginDashboardUIManager::onPluginStartError);
		}
Пример #25
0
void ofExitCallback(){

	ofNotifyExit();

	ofRemoveAllURLRequests();
	ofStopURLLoader();
	Poco::Net::uninitializeSSL();

    ofRemoveListener(ofEvents().setup,OFSAptr.get(),&ofBaseApp::setup,OF_EVENT_ORDER_APP);
    ofRemoveListener(ofEvents().update,OFSAptr.get(),&ofBaseApp::update,OF_EVENT_ORDER_APP);
    ofRemoveListener(ofEvents().draw,OFSAptr.get(),&ofBaseApp::draw,OF_EVENT_ORDER_APP);
    ofRemoveListener(ofEvents().exit,OFSAptr.get(),&ofBaseApp::exit,OF_EVENT_ORDER_APP);
    ofRemoveListener(ofEvents().keyPressed,OFSAptr.get(),&ofBaseApp::keyPressed,OF_EVENT_ORDER_APP);
    ofRemoveListener(ofEvents().keyReleased,OFSAptr.get(),&ofBaseApp::keyReleased,OF_EVENT_ORDER_APP);
    ofRemoveListener(ofEvents().mouseMoved,OFSAptr.get(),&ofBaseApp::mouseMoved,OF_EVENT_ORDER_APP);
    ofRemoveListener(ofEvents().mouseDragged,OFSAptr.get(),&ofBaseApp::mouseDragged,OF_EVENT_ORDER_APP);
    ofRemoveListener(ofEvents().mousePressed,OFSAptr.get(),&ofBaseApp::mousePressed,OF_EVENT_ORDER_APP);
    ofRemoveListener(ofEvents().mouseReleased,OFSAptr.get(),&ofBaseApp::mouseReleased,OF_EVENT_ORDER_APP);
    ofRemoveListener(ofEvents().windowResized,OFSAptr.get(),&ofBaseApp::windowResized,OF_EVENT_ORDER_APP);
    ofRemoveListener(ofEvents().windowEntered,OFSAptr.get(),&ofBaseApp::windowEntry,OF_EVENT_ORDER_APP);
    ofRemoveListener(ofEvents().messageEvent,OFSAptr.get(),&ofBaseApp::messageReceived,OF_EVENT_ORDER_APP);
    ofRemoveListener(ofEvents().fileDragEvent,OFSAptr.get(),&ofBaseApp::dragged,OF_EVENT_ORDER_APP);

	#ifndef TARGET_NO_SOUND
	//------------------------
	// try to close engine if needed:
	ofSoundShutdown();
	//------------------------
	#endif

	// try to close quicktime, for non-linux systems:
	#if defined(OF_VIDEO_CAPTURE_QUICKTIME) || defined(OF_VIDEO_PLAYER_QUICKTIME)
	closeQuicktime();
	#endif


	//------------------------
	// try to close freeImage:
	ofCloseFreeImage();

	//------------------------
	// try to close free type:
	ofTrueTypeFont::finishLibraries();

	#ifdef WIN32_HIGH_RES_TIMING
		timeEndPeriod(1);
	#endif

}
Пример #26
0
ramActorsScene::~ramActorsScene()
{
	ofRemoveListener(ofEvents().fileDragEvent, this, &ramActorsScene::onFileDrop);
}
Пример #27
0
ImageButton::~ImageButton()
{
    ofRemoveListener(ofEvents().mouseReleased, this, &ImageButton::mouseReleased);
}
Пример #28
0
void ofxDatGuiComponent::onFocusLost()
{
    mFocused = false;
    mMouseDown = false;
    ofRemoveListener(ofEvents().keyPressed, this, &ofxDatGuiComponent::onKeyPressed);
}
Пример #29
0
void ofxLayout::disableTuioEvents(){
    tuioEnabled = false;
    ofRemoveListener(tuioClient.cursorAdded,this,&ofxLayout::tuioPressed);
    ofRemoveListener(tuioClient.cursorRemoved,this,&ofxLayout::tuioRemoved);
    ofRemoveListener(tuioClient.cursorUpdated,this,&ofxLayout::tuioUpdated);
}
Пример #30
0
ofxPS3EyeGrabber::~ofxPS3EyeGrabber()
{
    ofRemoveListener(ofEvents().exit, this, &ofxPS3EyeGrabber::exit);
    stop();
    _cam.reset();
}