CBATTRequest Class Reference

Inherits from
Conforms to
Availability
Available in iOS 6.0 and later.
Companion guide
Declared in
CBATTRequest.h

Overview

The CBATTRequest class represents Attribute Protocol (ATT) read and write requests from remote central devices (represented by CBCentral objects). Remote centrals use these ATT requests to read and write characteristic values on local peripherals (represented by CBPeripheralManager objects). Local peripherals, on the other hand, use the properties of CBATTRequest objects to respond to the read and write requests appropriately, using the respondToRequest:withResult: method of the CBPeripheralManager class.

Tasks

Requesting to Read and Write Characteristic Values

Properties

central

The remote central device that originated the request. (read-only)

@property(readonly, retain, nonatomic) CBCentral *central
Availability
  • Available in iOS 6.0 and later.
Declared In
CBATTRequest.h

characteristic

The characteristic whose value is to be read or written. (read-only)

@property(readonly, retain, nonatomic) CBCharacteristic *characteristic
Availability
  • Available in iOS 6.0 and later.
Declared In
CBATTRequest.h

offset

The zero-based index of the first byte for the read or write request. (read-only)

@property(readonly, nonatomic) NSUInteger offset
Discussion

You can use the value of this property to ensure that the ATT request is attempting to read or write within the proper bounds of the characteristic’s value. For an example of how to take a request’s offset property into account when responding to a read or write request, see “Responding to Read and Write Requests from a Central” in Core Bluetooth Programming Guide.

Availability
  • Available in iOS 6.0 and later.
Declared In
CBATTRequest.h

value

The data being read or written.

@property(readwrite, copy) NSData *value
Discussion

The value of this property differs according to the type of request. For read requests, the property of this value is nil and should be set before responding to the remote central through the respondToRequest:withResult: method. For write requests, the value of this property is the data that is to be written to the characteristic’s value.

Availability
  • Available in iOS 6.0 and later.
See Also
  •   @property offset
Declared In
CBATTRequest.h