[Pyobjc-dev] More wiimote wrapping fun!
Brought to you by:
ronaldoussoren
|
From: John H. <joh...@gm...> - 2008-02-20 00:02:55
|
I've been following the discussions concerning the wiimote wrapper
with interest as I have this insane dream of integrating head
tracking into my laser/pySight controlled video game in order to make
it even sillier than it currently is. Alas, I have encountered
problems along the way.
Working with some people that I've found on this list and the
darwiinremote project I've got something that works somewhat for
button presses and the irPointMovedX_Y_ method. My problem is that I
want to capture the raw IR data, and this portion of the code seem to
not work.
Here is the relevant information from the most recent WiiRemote.h file:
typedef struct {
int x, y, s;
} IRData;
@interface NSObject (WiiRemoteDelegate)
- (void) rawIRData: (IRData[4]) irData;
in python I have the following:
WiiRemoteDelegate = objc.informal_protocol(
"WiiRemoteDelegate",
[
objc.selector(None,
selector="irPointMovedX:Y:",
signature="v@:ff", isRequired=False),
objc.selector(None,
selector="rawIRData:",
signature="v@:[4{IRData=iii}]", isRequired=False)
...
def rawIRData_(self, *posargs, **kwdargs):
#def rawIRData_(self, irData):
#print 'rawIRData: %s' % (irData,)
for x in posargs:
print '%x' % (x)
No matter what I do I get the same data in my delegate, formatted as
hex here:
1322f2c
13
bfffe350
1313b20
1313b00
bfffe3a0
0
154c396
94aa0ca4
142b9c8
1322ed0
13
This looks to me like I'm not getting the ints that I would expect
but that I'm getting references to the IRData struct or something.
Is there something wrong with selector and/or signature? Do I need
to add method encodings to the signature? What would a properly
encoded signature look like? If these are pointers is there a way to
dereference them in python?
I've been banging my head against this for more time than I'd like to
admit and keep getting either bus errors or junk data.
Thanks!
John
|