CBUUID Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/CoreBluetooth.framework
Availability
Available in iOS 5.0 and later.
Companion guide
Declared in
CBUUID.h
Related sample code

Overview

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.

Though not all UUIDs that identify Bluetooth-specific attributes are predefined by the Bluetooth Special Interest Group (SIG), Bluetooth SIG has defined and published a number of commonly used UUIDs that have been shortened to 16-bits for convenience. The CBUUID class provides methods that automatically transform these predefined 16-bit UUIDs into their 128-bit equivalent UUIDs. When you create a CBUUID object from a predefined 16-bit UUID, Core Bluetooth prefills the rest of the 128-bit UUID with the Bluetooth base UUID, which is defined in the Bluetooth 4.0 specification, Volume 3, Part F, Section 3.2.1.

In addition to providing methods for creating CBUUID objects, this class defines constants that represent the UUIDs of the Bluetooth-defined characteristic descriptors, which are defined in the Bluetooth 4.0 specification, Volume 3, Part G, Section 3.3.3.

Tasks

Creating New CBUUID Objects

Properties

data

The data of the UUID. (read-only)

@property(nonatomic, readonly) NSData *data
Availability
  • Available in iOS 5.0 and later.
Declared In
CBUUID.h

UUIDString

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

@property(nonatomic, readonly) NSString *UUIDString
Availability
  • Available in iOS 7.1 and later.
Declared In
CBUUID.h

Class Methods

UUIDWithCFUUID:

Creates and returns a CBUUID object from a CFUUIDRef object.

+ (CBUUID *)UUIDWithCFUUID:(CFUUIDRef)theUUID
Parameters
theUUID

A UUID represented by a CFUUIDRef object.

Return Value

A new CBUUID object for the specified UUID.

Availability
  • Available in iOS 5.0 and later.
Declared In
CBUUID.h

UUIDWithData:

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

+ (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.

Availability
  • Available in iOS 5.0 and later.
Declared In
CBUUID.h

UUIDWithNSUUID:

Creates and returns a CBUUID object from an NSUUID object.

+ (CBUUID *)UUIDWithNSUUID:(NSUU)theUUID
Parameters
theUUID

A UUID represented by an NSUUID object.

Return Value

A new CBUUID object for the specified UUID.

Availability
  • Available in iOS 7.0 and later.
Declared In
CBUUID.h

UUIDWithString:

Creates and returns a CBUUID object from a 16-bit or 128-bit UUID string.

+ (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.

Availability
  • Available in iOS 5.0 and later.
Declared In
CBUUID.h

Constants

Characteristic Descriptors

Values representing the UUIDs of the characteristic descriptors.

NSString *const CBUUIDCharacteristicExtendedPropertiesString;
NSString *const CBUUIDCharacteristicUserDescriptionString;
NSString *const CBUUIDClientCharacteristicConfigurationString;
NSString *const CBUUIDServerCharacteristicConfigurationString;
NSString *const CBUUIDCharacteristicFormatString;
NSString *const CBUUIDCharacteristicAggregateFormatString;
Constants
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.

Declared in CBUUID.h.

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.

Declared in CBUUID.h.

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.

Declared in CBUUID.h.

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.

Declared in CBUUID.h.

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.

Declared in CBUUID.h.

CBUUIDCharacteristicAggregateFormatString

The string representation of the UUID for the aggregate descriptor.

Available in iOS 5.0 and later.

Declared in CBUUID.h.

GAP and GATT Service UUIDs

Values representing the UUIDs of the GAP and GATT service. (Deprecated. There are no replacements for these constants.)

NSString *const CBUUIDGenericAccessProfileString;
NSString *const CBUUIDGenericAttributeProfileString;
Constants
CBUUIDGenericAccessProfileString

The string representation of the GAP service UUID.

Available in iOS 5.0 and later.

Deprecated in iOS 7.0.

Declared in CBUUID.h.

CBUUIDGenericAttributeProfileString

The string representation of the GATT service UUID.

Available in iOS 5.0 and later.

Deprecated in iOS 7.0.

Declared in CBUUID.h.

GAP Characteristics

Values representing the UUIDs of the GAP characteristics. (Deprecated. There are no replacements for these constants.)

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

The string representation of the GAP device name UUID.

Available in iOS 5.0 and later.

Deprecated in iOS 7.0.

Declared in CBUUID.h.

CBUUIDAppearanceString

The string representation of the GAP appearance UUID.

Available in iOS 5.0 and later.

Deprecated in iOS 7.0.

Declared in CBUUID.h.

CBUUIDPeripheralPrivacyFlagString

The string representation of the GAP privacy flag UUID.

Available in iOS 5.0 and later.

Deprecated in iOS 7.0.

Declared in CBUUID.h.

CBUUIDReconnectionAddressString

The string representation of the GAP reconnection address UUID.

Available in iOS 5.0 and later.

Deprecated in iOS 7.0.

Declared in CBUUID.h.

CBUUIDPeripheralPreferredConnectionParametersString

The string representation of the GAP preferred connection parameter UUID.

Available in iOS 5.0 and later.

Deprecated in iOS 7.0.

Declared in CBUUID.h.

GATT Service Changed UUID

Value representing the GAP service changed UUID. (Deprecated. There is no replacement for this constant.)

NSString *const CBUUIDServiceChangedString;
Constants
CBUUIDServiceChangedString

The string representation of the GATT service changed UUID.

Available in iOS 5.0 and later.

Deprecated in iOS 7.0.

Declared in CBUUID.h.