void PluginOSCController::processMessage( const osc::Message& message ){
    string address = boost::to_upper_copy(message.getAddress());
    if( mPluginsOSCMapping.count(address) > 0 ){
        processPluginMessageDirect( message, mPluginsOSCMapping[address] );
        return;
    }
    
    return;

    // TODO fix the group function
    
    vector<string> tokens;
    boost::split(tokens,address,boost::is_any_of("/"));
    tokens.erase (tokens.begin(),tokens.begin()+1);

    bool isPluginMessage = false;
    string sig = boost::to_upper_copy(tokens[0]);
    map<string, vector<BasePlugin*> >::const_iterator itr;
    for(itr = mPluginsDirectory.begin(); itr != mPluginsDirectory.end(); ++itr){
//        console() << "Key: " << (*itr).first << " Value: " << (*itr).second.size();
        if(sig.compare( boost::to_upper_copy( (*itr).first )) == 0 ){
//            console() << " FOUND THE PLUGIN! " << std::endl;
            isPluginMessage = true;
            break;
        }
    }
    
    if(isPluginMessage){
        processPluginMessage( message, tokens );
    }else{
        processInteralMessage( message, tokens );
    }
    
}
void GstVideoServer::sendToClients(const osc::Message &m)
{
	CI_LOG_I("Send to Clients " << m );
	for( auto& clientKey : mConnectedClients){
        auto& client = clientKey.second;
		CI_LOG_I( "Sending " << m.getAddress() << " to " << client.getRemoteEndpoint().address() << ":" << client.getRemoteEndpoint().port() );
        client.send(m);
    }
}
void GstVideoServer::sendToClient( const osc::Message &m, const std::string &address )
{
    const auto& clientKey = mConnectedAdressedClients.find(address);
    if(clientKey != mConnectedAdressedClients.end() ){
        auto& client = clientKey->second->second;
		CI_LOG_I("Sending " << m.getAddress() << " to " << client.getRemoteEndpoint().address() << ":" << client.getRemoteEndpoint().port() );
        client.send(m);
    } else{
		CI_LOG_I( "Couldn't find client with address: " << address );
    }
}
Beispiel #4
0
string toString(osc::Message const& m)
{
	stringstream s;
	s << '[' << m.getAddress() << ' ';
	for (int i=0; i<m.getNumArgs(); ++i)
	{
		s << m.getArgAsString(i, true);
	}
	s << ']';
	return s.str();
}
/**
 * Log incomming OSC msgs
 * Taken from OSCListener example provided with the Cinder OSC block
 */
void OSCController::__logMessage( osc::Message msg )
{
    if( displayMsgLog ){
        console() << "Incomming OSC msg: @ " << getId() << std::endl;
		console() << "Address: " << msg.getAddress() << std::endl;
		if( displayMsgExtended ){
			console() << "Num Arg: " << msg.getNumArgs() << std::endl;
			for (int i = 0; i < msg.getNumArgs(); i++) {
				console() << "-- Argument " << i << std::endl;
				console() << "---- type: " << msg.getArgTypeName(i) << std::endl;
				if (msg.getArgType(i) == osc::TYPE_INT32){
					try {
						console() << "------ value: "<< msg.getArgAsInt32(i) << std::endl;
					}
					catch (...) {
						console() << "Exception reading argument as int32" << std::endl;
					}
					
				}else if (msg.getArgType(i) == osc::TYPE_FLOAT){
					try {
						console() << "------ value: " << msg.getArgAsFloat(i) << std::endl;
					}
					catch (...) {
						console() << "Exception reading argument as float" << std::endl;
					}
					
				}else if (msg.getArgType(i) == osc::TYPE_STRING){
					try {
						console() << "------ value: " << msg.getArgAsString(i).c_str() << std::endl;
					}
					catch (...) {
						console() << "Exception reading argument as string" << std::endl;
					}
					
				}
			}
		}

        
    }
}
Beispiel #6
0
void OscController::sendMessage(const osc::Message message) {
	app::console() << "Sending Address" << message.getAddress() << std::endl;
	mSender.send(message);
}