iOS Developer Library

Developer

CoreBluetooth Framework Reference CBUUID Class Reference

Options
Deployment Target:

On This Page
Language:

CBUUID

Instances of the CBUUID class represent the 128-bit universally unique identifiers (UUIDs) of attributes used in Bluetooth low energy communication, such as a peripheral’s services, characteristics, and characteristic descriptors. This class provides a number of factory methods for dealing with long UUIDs when developing your app. For example, instead of passing around the string representation of a 128-bit Bluetooth low energy attribute in your code, you can create a CBUUID object that represents it, and pass that around instead. More...

Inheritance


Conforms To


Import Statement


import CoreBluetooth @import CoreBluetooth;

Availability


Available in iOS 5.0 and later.
  • Creates and returns a CBUUID object from a 16-bit or 128-bit UUID string.

    Declaration

    Swift

    init!(string theString: String!) -> CBUUID

    Objective-C

    + (CBUUID *)UUIDWithString:(NSString *)theString

    Parameters

    theString

    A string containing a 16-bit or 128-bit UUID.

    Return Value

    A new CBUUID object for the specified UUID string.

    Discussion

    The expected format for 128-bit UUIDs is a string punctuated by hyphens, for example, 68753A44-4D6F-1226-9C60-0050E4C00067. For an example of how to use this method, see Services and Characteristics Are Identified by UUIDs in Core Bluetooth Programming Guide and Create Your Own UUIDs for Custom Services and Characteristics in Core Bluetooth Programming Guide.

    Import Statement

    import CoreBluetooth

    Availability

    Available in iOS 5.0 and later.

  • Creates and returns a CBUUID object from a 16-bit or 128-bit UUID data container.

    Declaration

    Swift

    init!(data theData: NSData!) -> CBUUID

    Objective-C

    + (CBUUID *)UUIDWithData:(NSData *)theData

    Parameters

    theData

    Data containing a 16-bit or 128-bit UUID.

    Return Value

    A new CBUUID object for the specified UUID data.

    Discussion

    This method is useful when the UUID of a Bluetooth attribute is formatted in raw bytes.

    Import Statement

    import CoreBluetooth

    Availability

    Available in iOS 5.0 and later.

  • Creates and returns a CBUUID object from a CFUUIDRef object.

    Declaration

    Swift

    init!(CFUUID theUUID: CFUUID!) -> CBUUID

    Objective-C

    + (CBUUID *)UUIDWithCFUUID:(CFUUIDRef)theUUID

    Parameters

    theUUID

    A UUID represented by a CFUUIDRef object.

    Return Value

    A new CBUUID object for the specified UUID.

    Import Statement

    import CoreBluetooth

    Availability

    Available in iOS 5.0 and later.

  • Creates and returns a CBUUID object from an NSUUID object.

    Declaration

    Swift

    init!(NSUUID theUUID: NSUUID!) -> CBUUID

    Objective-C

    + (CBUUID *)UUIDWithNSUUID:(NSUUID *)theUUID

    Parameters

    theUUID

    A UUID represented by an NSUUID object.

    Return Value

    A new CBUUID object for the specified UUID.

    Import Statement

    import CoreBluetooth

    Availability

    Available in iOS 7.0 and later.

  • data data Property

    The data of the UUID. (read-only)

    Declaration

    Swift

    var data: NSData! { get }

    Objective-C

    @property(nonatomic, readonly) NSData *data

    Import Statement

    import CoreBluetooth

    Availability

    Available in iOS 5.0 and later.

  • The UUID represented as a string. (read-only)

    Declaration

    Swift

    var UUIDString: String! { get }

    Objective-C

    @property(nonatomic, readonly) NSString *UUIDString

    Import Statement

    import CoreBluetooth

    Availability

    Available in iOS 7.1 and later.

  • Values representing the UUIDs of the characteristic descriptors.

    Declaration

    Swift

    let CBUUIDCharacteristicExtendedPropertiesString: NSString! let CBUUIDCharacteristicUserDescriptionString: NSString! let CBUUIDClientCharacteristicConfigurationString: NSString! let CBUUIDServerCharacteristicConfigurationString: NSString! let CBUUIDCharacteristicFormatString: NSString! let CBUUIDCharacteristicAggregateFormatString: NSString!

    Objective-C

    NSString *const CBUUIDCharacteristicExtendedPropertiesString; NSString *const CBUUIDCharacteristicUserDescriptionString; NSString *const CBUUIDClientCharacteristicConfigurationString; NSString *const CBUUIDServerCharacteristicConfigurationString; NSString *const CBUUIDCharacteristicFormatString; NSString *const CBUUIDCharacteristicAggregateFormatString;

    Constants

    • CBUUIDCharacteristicExtendedPropertiesString

      CBUUIDCharacteristicExtendedPropertiesString

      The string representation of the UUID for the extended properties descriptor. The corresponding value for this descriptor is an NSNumber object.

      Available in iOS 5.0 and later.

    • CBUUIDCharacteristicUserDescriptionString

      CBUUIDCharacteristicUserDescriptionString

      The string representation of the UUID for the user description descriptor. The corresponding value for this descriptor is an NSString object.

      Available in iOS 5.0 and later.

    • CBUUIDClientCharacteristicConfigurationString

      CBUUIDClientCharacteristicConfigurationString

      The string representation of the UUID for the client configuration descriptor. The corresponding value for this descriptor is an NSNumber object.

      Available in iOS 5.0 and later.

    • CBUUIDServerCharacteristicConfigurationString

      CBUUIDServerCharacteristicConfigurationString

      The string representation of the UUID for the server configuration descriptor. The corresponding value for this descriptor is an NSNumber object.

      Available in iOS 5.0 and later.

    • CBUUIDCharacteristicFormatString

      CBUUIDCharacteristicFormatString

      The string representation of the UUID for the presentation format descriptor. The corresponding value for this descriptor is an NSData object.

      Available in iOS 5.0 and later.

    • CBUUIDCharacteristicAggregateFormatString

      CBUUIDCharacteristicAggregateFormatString

      The string representation of the UUID for the aggregate descriptor.

      Available in iOS 5.0 and later.

    Import Statement

  • Values representing the UUIDs of the GAP and GATT service.

    There are no replacements for these constants.

    Declaration

    Objective-C

    NSString *const CBUUIDGenericAccessProfileString; NSString *const CBUUIDGenericAttributeProfileString;

    Constants

    • CBUUIDGenericAccessProfileString

      CBUUIDGenericAccessProfileString

      The string representation of the GAP service UUID.

      Available in iOS 5.0 and later.

      Deprecated in iOS 7.0.

    • CBUUIDGenericAttributeProfileString

      CBUUIDGenericAttributeProfileString

      The string representation of the GATT service UUID.

      Available in iOS 5.0 and later.

      Deprecated in iOS 7.0.

    Import Statement

  • Values representing the UUIDs of the GAP characteristics.

    There are no replacements for these constants.

    Declaration

    Objective-C

    NSString *const CBUUIDDeviceNameString; NSString *const CBUUIDAppearanceString; NSString *const CBUUIDPeripheralPrivacyFlagString; NSString *const CBUUIDReconnectionAddressString; NSString *const CBUUIDPeripheralPreferredConnectionParametersString;

    Constants

    • CBUUIDDeviceNameString

      CBUUIDDeviceNameString

      The string representation of the GAP device name UUID.

      Available in iOS 5.0 and later.

      Deprecated in iOS 7.0.

    • CBUUIDAppearanceString

      CBUUIDAppearanceString

      The string representation of the GAP appearance UUID.

      Available in iOS 5.0 and later.

      Deprecated in iOS 7.0.

    • CBUUIDPeripheralPrivacyFlagString

      CBUUIDPeripheralPrivacyFlagString

      The string representation of the GAP privacy flag UUID.

      Available in iOS 5.0 and later.

      Deprecated in iOS 7.0.

    • CBUUIDReconnectionAddressString

      CBUUIDReconnectionAddressString

      The string representation of the GAP reconnection address UUID.

      Available in iOS 5.0 and later.

      Deprecated in iOS 7.0.

    • CBUUIDPeripheralPreferredConnectionParametersString

      CBUUIDPeripheralPreferredConnectionParametersString

      The string representation of the GAP preferred connection parameter UUID.

      Available in iOS 5.0 and later.

      Deprecated in iOS 7.0.

    Import Statement

  • Value representing the GAP service changed UUID.

    There is no replacement for this constant.

    Declaration

    Objective-C

    NSString *const CBUUIDServiceChangedString;

    Constants

    • CBUUIDServiceChangedString

      CBUUIDServiceChangedString

      The string representation of the GATT service changed UUID.

      Available in iOS 5.0 and later.

      Deprecated in iOS 7.0.

    Import Statement