Contents

ColorSyncRegisterDevice(_:_:_:)

Registers a device of the given class with ColorSync.

Declaration

func ColorSyncRegisterDevice(_ deviceClass: CFString!, _ deviceID: CFUUID!, _ deviceInfo: CFDictionary!) -> Bool

Parameters

  • 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 CFDictionary with localized names of the device. Localization keys must be five-character strings containing a language code and region code in the lc_RG format, and must contain (at least) the en_US locale.

  • kColorSyncFactoryProfiles: A CFDictionary of 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 kCFPreferencesCurrentHost or kCFPreferencesAnyHost. If you don’t specify it, the framework assumes kCFPreferencesCurrentHost.

  • kColorSyncDeviceUserScope: The user scope of the device; one of kCFPreferencesCurrentUser or kCFPreferencesAnyUser. If you don’t specify it, the framework assumes kCFPreferencesCurrentUser.

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 CFURLRef of the profile to register.

  • kColorSyncDeviceModeDescriptions: A CFDictionary with localized device mode names for the profile. Localization keys must be five-character strings containing a language code and region code in the lc_RG format, and must contain (at least) the en_US locale. 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
<<

See Also

Registering and enumerating devices