ColorSyncRegisterDevice(_:_:_:)
Registers a device of the given class with ColorSync.
Declaration
func ColorSyncRegisterDevice(_ deviceClass: CFString!, _ deviceID: CFUUID!, _ deviceInfo: CFDictionary!) -> BoolParameters
- deviceClass:
The class of the device to register.
- deviceID:
The identifier of the device to register.
- deviceInfo:
A dictionary containing the information needed to register a device.
Return Value
true on success and false in case of failure.
Discussion
The deviceInfo dictionary requires the following keys:
kColorSyncDeviceDescriptions: A
CFDictionarywith localized names of the device. Localization keys must be five-character strings containing a language code and region code in thelc_RGformat, and must contain (at least) theen_USlocale.kColorSyncFactoryProfiles: A
CFDictionaryof factory profile info dictionaries. The keys are the profile IDs and the values are the profile info dictionaries.
It may also include the following optional keys:
kColorSyncDeviceHostScope: The host scope of the device; one of
kCFPreferencesCurrentHostorkCFPreferencesAnyHost. If you don’t specify it, the framework assumeskCFPreferencesCurrentHost.kColorSyncDeviceUserScope: The user scope of the device; one of
kCFPreferencesCurrentUserorkCFPreferencesAnyUser. If you don’t specify it, the framework assumeskCFPreferencesCurrentUser.
The factory profiles dictionary (the value for the key kColorSyncFactoryProfiles in deviceInfo) requires the following keys and values. A ProfileID (of CFStringRef type) identifies each profile and serves as the key. The value associated with the key is a profile info dictionary that describes an individual device profile.
kColorSyncDeviceDefaultProfileID: The associated value must be one of the ProfileIDs present in the dictionary. Presence of this key is not required if there is only one factory profile.
Each profile info CFDictionary requires the following keys:
kColorSyncDeviceProfileURL: The
CFURLRefof the profile to register.kColorSyncDeviceModeDescriptions: A
CFDictionarywith localized device mode names for the profile. Localization keys must be five-character strings containing a language code and region code in thelc_RGformat, and must contain (at least) theen_USlocale. For example,en_US“Glossy Paper with best quality”.
Example of a deviceInfo dictionary:
<<
kColorSyncDeviceDescriptions <<
en_US My Little Printer
de_DE Mein Kleiner Drucker
fr_FR Mon petit immprimeur
...
>>
kColorSyncFactoryProfiles <<
CFSTR("Profile 1") <<
kColorSyncDeviceProfileURL {CFURLRef}
kColorSyncDeviceModeDescriptions <<
en_US Glossy Paper
de_DE Glanzpapier
fr_FR Papier glace
...
>>
...
kColorSyncDeviceDefaultProfileID CFSTR("Profile 1")
>>
kColorSyncDeviceUserScope kCFPreferencesAnyUser
kColorSyncDeviceHostScope kCFPreferencesCurrentHost
<<