ofxOsciPhone receive, only got "unrecognized message"

Hi all,

I’m trying to send OSC Message from Mac to iPhone,
Sending part is use oscSenderExample and OF 0062 osxSL,
Receiving part is use oscReceiveExample and OF 0062 iPhone with ofxOsciPhone from this forum.

But i only got “unrecognized message” till now, (can’t got mouse positions)

Anyone has same problem or any Thoughts?

Thanks so much and really need your help.

here are codes from Receiving part:

testApp.h

  
  
#pragma once  
  
#include "ofMain.h"  
#include "ofxiPhone.h"  
#include "ofxiPhoneExtras.h"  
#include "ofxOsc.h"  
  
// listen on port 7000  
#define PORT 7000  
#define NUM_MSG_STRINGS 10  
  
class testApp : public ofxiPhoneApp {  
	  
public:  
	void setup();  
	void update();  
	void draw();  
	void exit();  
	  
	void touchDown(ofTouchEventArgs &touch);  
	void touchMoved(ofTouchEventArgs &touch);  
	void touchUp(ofTouchEventArgs &touch);  
	void touchDoubleTap(ofTouchEventArgs &touch);  
  
	void lostFocus();  
	void gotFocus();  
	void gotMemoryWarning();  
	void deviceOrientationChanged(int newOrientation);  
	  
	ofTrueTypeFont		font;  
	  
private:  
	ofxOscReceiver	receiver;  
	  
	int				current_msg_string;  
	string		msg_strings[NUM_MSG_STRINGS];  
	float			timers[NUM_MSG_STRINGS];  
	  
	int				mouseX, mouseY;  
	string			mouseButtonState;  
  
};  
  
  

testApp.mm

  
  
#include "testApp.h"  
  
//--------------------------------------------------------------  
void testApp::setup(){	  
	// register touch events  
	ofRegisterTouchEvents(this);  
	  
	// initialize the accelerometer  
	ofxAccelerometer.setup();  
	  
	//iPhoneAlerts will be sent to this.  
	ofxiPhoneAlerts.addListener(this);  
	  
	//If you want a landscape oreintation   
	//iPhoneSetOrientation(OFXIPHONE_ORIENTATION_LANDSCAPE_RIGHT);  
		  
	// listen on the given port  
	cout << "listening for osc messages on port " << PORT << "\n";  
	receiver.setup( PORT );  
	  
	current_msg_string = 0;  
	mouseX = 0;  
	mouseY = 0;  
	mouseButtonState = "";  
	  
	ofBackground( 30, 30, 130 );  
}  
  
//--------------------------------------------------------------  
void testApp::update(){  
	  
	// hide old messages  
	for ( int i=0; i<NUM_MSG_STRINGS; i++ )  
	{  
		if ( timers[i] < ofGetElapsedTimef() )  
			msg_strings[i] = "";  
	}  
	  
	// check for waiting messages  
	while( receiver.hasWaitingMessages() )  
	{  
		// get the next message  
		ofxOscMessage m;  
		receiver.getNextMessage( &m );  
		  
		// check for mouse moved message  
		if ( m.getAddress() == "/mouse/position" )  
		{  
			// both the arguments are int32's  
			mouseX = m.getArgAsInt32( 0 );  
			mouseY = m.getArgAsInt32( 1 );  
		}  
		// check for mouse button message  
		else if ( m.getAddress() == "/mouse/button" )  
		{  
			// the single argument is a string  
			mouseButtonState = m.getArgAsString( 0 ) ;  
		}  
		else  
		{  
			// unrecognized message: display on the bottom of the screen  
			string msg_string;  
			msg_string = m.getAddress();  
			msg_string += ": ";  
			for ( int i=0; i<m.getNumArgs(); i++ )  
			{  
				// get the argument type  
				msg_string += m.getArgTypeName( i );  
				msg_string += ":";  
				// display the argument - make sure we get the right type  
				if( m.getArgType( i ) == OFXOSC_TYPE_INT32 )  
					msg_string += ofToString( m.getArgAsInt32( i ) );  
				else if( m.getArgType( i ) == OFXOSC_TYPE_FLOAT )  
					msg_string += ofToString( m.getArgAsFloat( i ) );  
				else if( m.getArgType( i ) == OFXOSC_TYPE_STRING )  
					msg_string += m.getArgAsString( i );  
				else  
					msg_string += "unknown";  
			}  
			// add to the list of strings to display  
			msg_strings[current_msg_string] = msg_string;  
			timers[current_msg_string] = ofGetElapsedTimef() + 5.0f;  
			current_msg_string = ( current_msg_string + 1 ) % NUM_MSG_STRINGS;  
			// clear the next line  
			msg_strings[current_msg_string] = "";  
		}  
		  
	}  
	  
  
}  
  
//--------------------------------------------------------------  
void testApp::draw(){  
	  
	string buf;  
	buf = "listening for osc messages on port" + ofToString( PORT );  
	ofDrawBitmapString( buf, 10, 20 );  
	  
	// draw mouse state  
	buf = "mouse: " + ofToString( mouseX, 4) +  " " + ofToString( mouseY, 4 );  
	ofDrawBitmapString( buf, 10, 40 );  
	ofDrawBitmapString( mouseButtonState, 10, 60 );  
	  
	for ( int i=0; i<NUM_MSG_STRINGS; i++ )  
	{  
		ofDrawBitmapString( msg_strings[i], 10, 80+15*i );  
	}  
	  
}  
  
//--------------------------------------------------------------  
void testApp::exit(){  
  
}  
  
//--------------------------------------------------------------  
void testApp::touchDown(ofTouchEventArgs &touch){  
  
}  
  
//--------------------------------------------------------------  
void testApp::touchMoved(ofTouchEventArgs &touch){  
  
}  
  
//--------------------------------------------------------------  
void testApp::touchUp(ofTouchEventArgs &touch){  
  
}  
  
//--------------------------------------------------------------  
void testApp::touchDoubleTap(ofTouchEventArgs &touch){  
  
}  
  
//--------------------------------------------------------------  
void testApp::lostFocus(){  
  
}  
  
//--------------------------------------------------------------  
void testApp::gotFocus(){  
  
}  
  
//--------------------------------------------------------------  
void testApp::gotMemoryWarning(){  
  
}  
  
//--------------------------------------------------------------  
void testApp::deviceOrientationChanged(int newOrientation){  
  
}  
  
  
  

Whale, were you able to get this working right? I’m trying the same thing, but mine seems to drop messages a lot.