Re: How to use OBEXAddTargetHeader ?
Re: How to use OBEXAddTargetHeader ?
- Subject: Re: How to use OBEXAddTargetHeader ?
- From: Bubba Giles <email@hidden>
- Date: Thu, 02 Jan 2003 11:16:16 -0800
>
Ok. I give up. What does one have to pass to the OBEXAddTargetHeader
>
(and similar functions). The documentation makes is sound like it's the
>
same as say, OBEXAddTypeHeader. They are both supposed to 'Add a
>
CFStringRef to a dictionary of OBEXheaders'.
You are right, the headerdoc is misleading - some clone-and-zone copy
pasting going on in there. Sorry about thet confusion. I'll update it for
the next developer release.
Since the target header is a byte sequence you just need to pass a pointer
to the data you want to use, and the length of the data.
For example, if you wanted to add an FTP target identifier, it must be the
value F9EC7BC4-953C-11D2-984E-525400DC9E09, so do this:
uint8_t targetUUID[] = { 0xF9, 0xEC, 0x7B, 0xC4, 0x95, 0x3C, 0x11,
0xD2, 0x98, 0x4E, 0x52, 0x54, 0x00, 0xDC, 0x9E, 0x09 };
OBEXAddTargetHeader( targetUUID, sizeof( targetUUID ), dictionary );
>
But obviously they are not the same at all. Where OBEXAddTypeHeader
>
specifically takes a CFStringRef OBEXAddTargetHeader takes a void
>
pointer and a length of the data in it. I have tried to put the data
>
into it in may different ways now. And all of them results in the
>
following message on the console when calling OBEXHeadersToBytes:
>
>
****** leaking object added to OBEX headers dictionary; the passed
>
dictionary needs to use the default value callbacks! ******
This error is because you are probably creating the dictionary with NULL
callbacks. Create it like this instead:
dictionary = CFDictionaryCreateMutable(
kCFAllocatorDefault,
1,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks );
That should get rid of that warning and make it so your app is not leaking
memory when using the OBEX header stuff.
I hope that clarifies things a bit,
Jason
email@hidden
_______________________________________________
bluetooth-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/bluetooth-dev
Do not post admin requests to the list. They will be ignored.