Exemplo n.º 1
0
void ofApp::onSerialBuffer(const ofx::IO::SerialBufferEventArgs& args)
{
    // Decoded serial packets will show up here.
    SerialMessage message(args.getBuffer().toString(), "", 255);
    serialMessages.push_back(message);
    
    // ofLogNotice("onSerialBuffer") << "got serial buffer : " << message.message;
}
Exemplo n.º 2
0
void ofApp::onSerialBuffer(const ofx::IO::SerialBufferEventArgs& args)
{
    // Buffers will show up here when the marker character is found.
    SerialMessage message(args.getBuffer().toString(), "", 500);
    serialMessages.push_back(message);
}
Exemplo n.º 3
0
void chladniRC::onSerialBuffer(const ofx::IO::SerialBufferEventArgs& args){
	
	// Buffers will show up here when the marker character is found.
	string message(args.getBuffer().toString());
	//serialMessages.push_back(message);
	
	// get pingback
	string compareString("pingback:");
	if(message.length()>=compareString.length() ){
		if( message.compare(0,compareString.length(),compareString,0,compareString.length())==0){
			arduinoLastPingReturn = message.substr(compareString.length()-1,message.npos);
			return;
		}
	}
	
	//
	compareString = "EVStatus:";
	if(message.length()>=compareString.length() ){
		if( message.compare(0,compareString.length(),compareString,0,compareString.length())==0){
			
			string rawValue = message.substr(compareString.length(),message.npos);
			
			auto dash = rawValue.find("-");
			if(dash != rawValue.npos){
				int valveID = ofToInt( rawValue.substr(0,dash) );
				
				if( valveID>=0 && valveID<KM_CHLADNI_NUM_ELECTROVALVES){
				
					int valveValue = ofToInt( rawValue.substr(dash+1,rawValue.npos-(dash+1) ) );
					waterControlSettings.waterFlowRate[valveID] = ((float)valveValue)/255.f;
				}
				
			}
			return;
		}
	}
	
	// get the manual LED strip value
	compareString = "ledStripIntensityManu:";
	if(message.length()>=compareString.length() ){
		if( message.compare(0,compareString.length(),compareString,0,compareString.length())==0){
			
			string rawValue = message.substr(compareString.length(),message.npos);
			
			auto dash = rawValue.find("-");
			if(dash != rawValue.npos){
				int lightID = ofToInt( rawValue.substr(0,dash) );
				
				if( lightID>=0 && lightID<KM_CHLADNI_NUM_LED_STRIPS){
					
					int lightValue = ofToInt( rawValue.substr(dash+1,rawValue.npos-(dash+1) ) );
					waterControlSettings.LEDStripsIntensityManu[lightID] = ((float)lightValue)/255.f;
				}
				
			}
			return;
		}
	}
	
	// still not returned? --> unrecognised message
	cout << "Unrecognised chladni SERIAL message:\t" << message << endl;
}
Exemplo n.º 4
0
void ofApp::onSerialBuffer(const ofx::IO::SerialBufferEventArgs& args)
{
    // Decoded serial packets will show up here.
    SerialMessage message(args.getBuffer().toString(), "", 255);
    serialMessages.push_back(message);
}
void serialControllerV1::onSerialBuffer(const ofx::IO::SerialBufferEventArgs& args){
	// Buffers will show up here when the marker character is found.
	karmaSerialMsg<string> message("addr", args.getBuffer().toString());
	incomingMessages.send( std::move(message) );
	//cout << "onSerialBuffer! : " << message.getValue() << endl;
}
Exemplo n.º 6
0
void tinyG::onSerialBuffer(const ofx::IO::SerialBufferEventArgs& args)
{
    SerialMessage message(args.getBuffer().toString(), "", 10000);
    statusReport = message;

}