Platforms to show: All Mac Windows Linux Cross-Platform

Back to CBPeripheralManagerMBS class.

CBPeripheralManagerMBS.DidAddService(service as CBServiceMBS, error as NSErrorMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ❌ No
Invoked when you publish a service, and any of its associated characteristics and characteristic descriptors, to the local Generic Attribute Profile (GATT) database.

service: The service that was added to the local GATT database.
error: If an error occurred, the cause of the failure.

This event is invoked when your app calls the addService method to publish a service to the local peripheral’s GATT database. If the service is successfully published to the local database, the error parameter is nil. If unsuccessful, the error parameter returns the cause of the failure.

CBPeripheralManagerMBS.DidOpenL2CAPChannel(channel as CBL2CAPChannelMBS, error as NSErrorMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ❌ No
Did open L2CAP channel.

CBPeripheralManagerMBS.DidPublishL2CAPChannel(PSM as Integer, error as NSErrorMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ❌ No
This event is the response to a publishL2CAPChannel call.

PSM: The PSM of the channel that was published.
error: If an error occurred, the cause of the failure.

The PSM will contain the PSM that was assigned for the published channel

CBPeripheralManagerMBS.DidReceiveReadRequest(Request as CBATTRequestMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ❌ No
Invoked when a local peripheral device receives an Attribute Protocol (ATT) read request for a characteristic that has a dynamic value.

request: A CBATTRequest object that represents a request to read a characteristic’s value.

Each time this method is invoked, you call the respondToRequest method of the CBPeripheralManager class exactly once to respond to the read request.

CBPeripheralManagerMBS.DidReceiveWriteRequests(requests() as CBATTRequestMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ❌ No
Invoked when a local peripheral device receives an Attribute Protocol (ATT) write request for a characteristic that has a dynamic value.

requests: A list of one or more CBATTRequest objects, each representing a request to write the value of a characteristic.

In the same way that you respond to a read request, each time this method is invoked, you call the respondToRequest:withResult: method of the CBPeripheralManager class exactly once. If the requests parameter contains multiple requests, treat them as you would a single request—if any individual request cannot be fulfilled, you should not fulfill any of them. Instead, call the respondToRequest method immediately, and provide a result that indicates the cause of the failure.

When you respond to a write request, note that the first parameter of the respondToRequest method expects a single CBATTRequest object, even though you received an array of them from the didReceiveWriteRequests event. To respond properly, pass in the first request of the requests array.

CBPeripheralManagerMBS.DidStartAdvertising(error as NSErrorMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ❌ No
Adverising did start.

error: If an error occurred, the cause of the failure.

This event returns the result of a startAdvertising call. If advertisement could not be started, the cause will be detailed in the error parameter.

CBPeripheralManagerMBS.DidSubscribeToCharacteristic(central as CBCentralMBS, characteristic as CBCharacteristicMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ❌ No
Invoked when a remote central device subscribes to a characteristic’s value.

central: The remote central device that subscribed to the characteristic’s value.
characteristic: The characteristic whose value has been subscribed to.

This method is invoked when a remote central device subscribes to the value of one of the local peripheral’s characteristics, by enabling notifications or indications on the characteristic’s value. You should use the invocation of this method as a cue to start sending the subscribed central updates as the characteristic’s value changes. To send updated characteristic values to subscribed centrals, use the updateValue method of the CBPeripheralManager class.

CBPeripheralManagerMBS.DidUnpublishL2CAPChannel(PSM as Integer, error as NSErrorMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ❌ No
This event is the response to a unpublishL2CAPChannel call.

PSM: The PSM of the channel that was published.
error: If an error occurred, the cause of the failure.

CBPeripheralManagerMBS.DidUnsubscribeFromCharacteristic(central as CBCentralMBS, characteristic as CBCharacteristicMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ❌ No
Invoked when a remote central device unsubscribes from a characteristic’s value.

central: The remote central device that subscribed to the characteristic’s value.
characteristic: The characteristic whose value has been unsubscribed from.

This method is invoked when a remote central device unsubscribes from the value of one of the local peripheral’s characteristics, by disabling notifications or indications on the characteristic’s value. You should use the invocation of this method as a cue to stop sending the subscribed central updates as the characteristic’s value changes.

CBPeripheralManagerMBS.DidUpdateState

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ❌ No
Invoked when the peripheral manager's state is updated.

You implement this required method to ensure that Bluetooth low energy is supported and available to use on the local peripheral device. Issue commands to the peripheral manager only when the state of the peripheral manager is powered on, as indicated by the kStatePoweredOn constant. A state with a value lower than CBPeripheralManagerStatePoweredOn implies that advertising has stopped and that any connected centrals have been disconnected. If the state moves below CBPeripheralManagerStatePoweredOff, advertising has stopped and must be explicitly restarted. In addition, the local database is cleared and all services must be explicitly added again. For a complete list and discussion of the possible values representing the state of the peripheral manager, see the CBPeripheralManagerState enumeration in CBPeripheralManager.

CBPeripheralManagerMBS.IsReadyToUpdateSubscribers

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ❌ No
Invoked when a local peripheral device is again ready to send characteristic value updates.

When a call to the updateValue method fails because the underlying queue used to transmit the updated characteristic value is full, the peripheralManagerIsReadyToUpdateSubscribers: method is invoked when more space in the transmit queue becomes available. You can then implement this event to resend the value.

CBPeripheralManagerMBS.WillRestoreState(dic as dictionary)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ❌ No
Invoked when the peripheral manager is about to be restored by the system.

dict: A dictionary containing information about the peripheral manager that was preserved by the system at the time the app was terminated. For the available keys to this dictionary, see Peripheral Manager State Restoration Options.

For apps that opt in to the state preservation and restoration feature of Core Bluetooth, this is the first method invoked when your app is relaunched into the background to complete some Bluetooth-related task. Use this method to synchronize the state of your app with the state of the Bluetooth system.

The items on this page are in the following plugins: MBS Bluetooth Plugin.


The biggest plugin in space...