Instance Method

updateValue(_:for:onSubscribedCentrals:)

Sends an updated characteristic value to one or more subscribed centrals, via a notification or indication.

Declaration

func updateValue(_ value: Data, for characteristic: CBMutableCharacteristic, onSubscribedCentrals centrals: [CBCentral]?) -> Bool

Parameters

value

The characteristic value you want to send via a notification or indication.

characteristic

The characteristic whose value has changed.

centrals

A list of centrals (represented by CBCentral objects) that have subscribed to receive updates of the characteristic’s value. If nil, all subscribed centrals are updated. Centrals that have not subscribed to a characteristic’s value are ignored.

Return Value

true if the update is successfully sent to the subscribed central or centrals. false if the update is not successfully sent because the underlying transmit queue is full.

Discussion

You use this method to send updates of a characteristic’s value—through a notification or indication—to selected centrals that have subscribed to that characteristic’s value. If the method returns false because the underlying transmit queue is full, the peripheral manager calls the peripheralManagerIsReady(toUpdateSubscribers:) method of its delegate object when more space in the transmit queue becomes available. After this delegate method is called, you may resend the update.

If the length of the value parameter exceeds the length of the maximumUpdateValueLength property of a subscribed CBCentral, the value parameter is truncated accordingly.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software