OBEXHeadersToBytes(_:)
Converts a dictionary of headers to a data pointer, from which you can extract as bytes and pass to the OBEX command/response functions.
Declaration
func OBEXHeadersToBytes(_ dictionaryOfHeaders: CFDictionary!) -> Unmanaged<CFMutableData>!Parameters
- dictionaryOfHeaders:
Dictionary that you have added headers to with the above OBEXAddXXXHeader functions.
Return Value
Mutable data ref containing the bytes of all headers.
Discussion
Returns a CFMutableDataRef containing all the header data found in the dictionary, formatted according to the OBEX/IrMC spec. YOU MUST RELEASE IT when you are finished with it (ie. when the OBEX request is complete). All OBEX-specification defined headers are supported and should be returned to the dictionary. Use the keys defined above to get headers from dictionary. Example usage:
Example usage:
CFMutableDictionaryRef dictionary;
CFMutableDataRef mGetHeadersDataRef;
uint8_t* headerDataPtr;
uint32_t headerDataLength;
dictionary = CFDictionaryCreateMutable( kCFAllocatorDefault, 0, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks );
// Package up desired headers.
OBEXAddTypeHeader( CFSTR( "text/x-vCard" ), dictionary );
mGetHeadersDataRef = OBEXHeadersToBytes( dictionary );
headerDataPtr = CFDataGetBytePtr( mGetHeadersDataRef );
headerDataLength = CFDataGetLength( mGetHeadersDataRef );
// From here I can pass it to any OBEX command, such as OBEXPut...
See Also
Miscellaneous
OBEXAddApplicationParameterHeader(_:_:_:)OBEXAddAuthorizationChallengeHeader(_:_:_:)OBEXAddAuthorizationResponseHeader(_:_:_:)OBEXAddBodyHeader(_:_:_:_:)OBEXAddByteSequenceHeader(_:_:_:)OBEXAddConnectionIDHeader(_:_:_:)OBEXAddCountHeader(_:_:)OBEXAddDescriptionHeader(_:_:)OBEXAddHTTPHeader(_:_:_:)OBEXAddLengthHeader(_:_:)OBEXAddNameHeader(_:_:)OBEXAddObjectClassHeader(_:_:_:)OBEXAddTargetHeader(_:_:_:)OBEXAddTime4ByteHeader(_:_:)OBEXAddTimeISOHeader(_:_:_:)