Re: [Pyobjc-dev] More wiimote wrapping fun!
Brought to you by:
ronaldoussoren
|
From: John H. <joh...@gm...> - 2008-02-21 17:58:00
|
I can't get a signature. Attempting to do so I get:
AttributeError: 'function' object has no attribute 'signature'
calling dir(rawIRData_) gives:
['__call__', '__class__', '__delattr__', '__dict__', '__doc__',
'__get__', '__getattribute__', '__hash__', '__init__', '__module__',
'__name__', '__new__', '__reduce__', '__reduce_ex__', '__repr__',
'__setattr__', '__str__', 'func_closure', 'func_code',
'func_defaults', 'func_dict', 'func_doc', 'func_globals', 'func_name']
What connects the objc.informal_protocol definition with the class
wii_remote_delegate? I can't see anything that seems to use the same
name for the thing in two places. Is that where the problem is?
thanks,
John
On Feb 21, 2008, at 3:20 AM, Ronald Oussoren wrote:
>
> On 20 Feb, 2008, at 1:02, John Harrison wrote:
>
>> 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.
>
> That's odd, it looks like the informal protocol isn't actually
> used. What's the value of rawIRData_.signature? This should be v@:[4
> {IRData=iii}]. Please use the commented-out version of the method
> prototype for this, not the one with '*posargs'.
>
> BTW. I've downloaded the WiiRemote framework a while back and my
> parsing script cannot deal with some features in the header files
> (I haven't even tried fixing that yet). Furthermore, you won't be
> able to use the Mii structure from python because that contains
> bitfields and those aren't supported yet.
>
> Ronald
>>
>>
>> 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
>>
>> ---------------------------------------------------------------------
>> ----
>> This SF.net email is sponsored by: Microsoft
>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> _______________________________________________
>> Pyobjc-dev mailing list
>> Pyo...@li...
>> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev
>
|