FROM : Bridger Maxwell
DATE : Sat Jan 05 08:27:41 2008
Hello,
I am very new to Cocoa, so I apologize if this question seems very basic.
Right now I am trying to read data from a program that is sending data in
the "TUIO" protocol. I have read the data from the socket, and assigned it
to a NSData object with this code:
NSData *messageData = [[notification userInfo]
objectForKey:NSFileHandleNotificationDataItem];
Now how do I translate that data to integer and float values? I have sample
code from C++ and Java, but I don't know how to translate them to Cocoa. In
Java, it looks like this:
Object[] args = message.getArguments();
String command = (String)args[0];
String address = message.getAddress();
int s_id = ((Integer)args[1]).intValue();
int f_id = ((Integer)args[2]).intValue();
float x = ((Float)args[3]).floatValue();
float y = ((Float)args[4]).floatValue();
In C++ it looks like this:
ReceivedMessageArgumentStream args = msg.ArgumentStream();
ReceivedMessage::const_iterator arg = msg.ArgumentsBegin();
int32 s_id, f_id;
float xpos, ypos, angle, xspeed, yspeed, rspeed, maccel,
raccel;
args >> s_id >> f_id >> xpos >> ypos >> angle >> xspeed >>
yspeed >> rspeed >> maccel >> raccel >> EndMessage;
I would also be happy on a hint on what framework to use to do something
like this, but right now I am not even sure where to start looking.
Thank You,
Bridger Maxwell
DATE : Sat Jan 05 08:27:41 2008
Hello,
I am very new to Cocoa, so I apologize if this question seems very basic.
Right now I am trying to read data from a program that is sending data in
the "TUIO" protocol. I have read the data from the socket, and assigned it
to a NSData object with this code:
NSData *messageData = [[notification userInfo]
objectForKey:NSFileHandleNotificationDataItem];
Now how do I translate that data to integer and float values? I have sample
code from C++ and Java, but I don't know how to translate them to Cocoa. In
Java, it looks like this:
Object[] args = message.getArguments();
String command = (String)args[0];
String address = message.getAddress();
int s_id = ((Integer)args[1]).intValue();
int f_id = ((Integer)args[2]).intValue();
float x = ((Float)args[3]).floatValue();
float y = ((Float)args[4]).floatValue();
In C++ it looks like this:
ReceivedMessageArgumentStream args = msg.ArgumentStream();
ReceivedMessage::const_iterator arg = msg.ArgumentsBegin();
int32 s_id, f_id;
float xpos, ypos, angle, xspeed, yspeed, rspeed, maccel,
raccel;
args >> s_id >> f_id >> xpos >> ypos >> angle >> xspeed >>
yspeed >> rspeed >> maccel >> raccel >> EndMessage;
I would also be happy on a hint on what framework to use to do something
like this, but right now I am not even sure where to start looking.
Thank You,
Bridger Maxwell
| Related mails | Author | Date |
|---|---|---|
| Bridger Maxwell | Jan 5, 08:27 | |
| Nick Zitzmann | Jan 5, 23:03 |






Cocoa mail archive

