CFDictionary in a CFArray

Hi all.


I'm trying to follow the HIDManager documentation to setup some Joystick/Gampage code to my app.

In my obj-c class I have started two methods (see below).


The first is incomplete as I have hit a warning that I don't understand and wish to get rid of this :


Passing 'CFArrayRef' (aka 'const struct__CFArray *') to parameter of type 'CFMutableArrayRef' ( 'const struct__CFArray *') discards qualifiers.


What's that exactly mean and how would I rectify my code to remove the warning?


Cheers

Steve



- (void) openHardwareConnection

{

HIDManager = IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDOptionsTypeNone);


CFArrayRef matchingCFArrayRef = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);

CFDictionaryRef matchingCFDictRef = [selfbuildDeviceMatchingCFDictionaryRef : kHIDPage_GenericDesktop : kHIDUsage_GD_Joystick];

CFArrayAppendValue(matchingCFArrayRef, matchingCFDictRef); // WARNING HERE

matchingCFDictRef = [selfbuildDeviceMatchingCFDictionaryRef : kHIDPage_GenericDesktop : kHIDUsage_GD_GamePad];

CFArrayAppendValue(matchingCFArrayRef, matchingCFDictRef); // WARNING HERE

CFRelease(matchingCFDictRef);

//...... more hid stuff to follow

}




- (CFMutableDictionaryRef) buildDeviceMatchingCFDictionaryRef : (UInt32) inUsagePage : (UInt32) inUsage

{

// Create a dictionary to add usage page/usages to

CFMutableDictionaryRef HIDDeviceMatchingCFDictionaryRef = CFDictionaryCreateMutable( kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks );

CFNumberRef pageCFNumberRef = CFNumberCreate( kCFAllocatorDefault, kCFNumberIntType, &inUsagePage );

CFDictionarySetValue( HIDDeviceMatchingCFDictionaryRef, CFSTR(kIOHIDDeviceUsagePageKey), pageCFNumberRef );

CFRelease(pageCFNumberRef);


CFNumberRef usageCFNumberRef = CFNumberCreate( kCFAllocatorDefault, kCFNumberIntType, &inUsage );

CFDictionarySetValue(HIDDeviceMatchingCFDictionaryRef, CFSTR(kIOHIDDeviceUsageKey), usageCFNumberRef);

CFRelease(usageCFNumberRef);

return HIDDeviceMatchingCFDictionaryRef;

}

Mac OS X (10.7.3)

Posted on Feb 12, 2013 5:35 AM

Reply
2 replies

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

CFDictionary in a CFArray

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.