Platforms to show: All Mac Windows Linux Cross-Platform

Back to CBPeripheralManagerMBS class.

CBPeripheralManagerMBS.addService(service as CBMutableServiceMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Publishes a service and any of its associated characteristics and characteristic descriptors to the local GATT database.

service: The service you want to publish.

When you add a service to the database, the peripheral manager calls the didAddService:error event. If the service contains any included services, you must publish them first.

CBPeripheralManagerMBS.Constructor(options as Dictionary = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes the peripheral manager.

CBPeripheralManagerMBS.Destructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ✅ Yes All
The destructor.

CBPeripheralManagerMBS.removeAllServices

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Removes all published services from the local GATT database.

Because the GATT database is shared among apps on the local peripheral device, this method removes only the services that you have added using the addService method. Any services that have been published by other apps on the local peripheral device are not removed from the GATT database.

CBPeripheralManagerMBS.removeService(service as CBMutableServiceMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Removes a specified published service from the local GATT database.

service: The service you want to remove.

Because the GATT database is shared among apps on the local peripheral device, more than one instance of a service may exist in the database. As a result, this method removes only the instance of the service that your app added to the database (using the addService method). If the service is included by any other services, you must remove them first.

CBPeripheralManagerMBS.respondToRequest(request as CBATTRequestMBS, error as integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Responds to a read or write request from a connected central.

request: The read or write request that was received from the connected central. For more information about read and write requests, see CBATTRequest.
result: The result of attempting to fulfill the request. For a list of possible results, see Core Bluetooth Constants.

When the peripheral manager receives a request (represented as a CBATTRequest object) from a connected central to read or write a characteristic’s value, it calls the didReceiveReadRequest or didReceiveWriteRequests event. Each time one of these events is called, you call this method to respond to the corresponding read or write request.

CBPeripheralManagerMBS.setDesiredConnectionLatency(latency as integer, central as CBCentralMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the desired connection latency for an existing connection to a central device.

latency: The desired connection latency. For a list of the possible connection latency values that you may set for the peripheral manager, see CBPeripheralManagerConnectionLatency.
central: The central that the peripheral manager is currently connected to.

The latency of a peripheral-central connection controls how frequently messages can be exchanged between the peripheral and the central to which the peripheral is connected. By setting a desired connection latency, you manage the relationship between the frequency with which data is exchanged and the resulting battery performance of the peripheral device. When you call this method to set the connection latency, note that connection latency changes are not guaranteed. And so, the resultant latency may vary. If you do not explicitly set a latency, the connection latency is set to the latency that was chosen by the central device when the connection was first established. Typically, it is not necessary to change the connection latency.

CBPeripheralManagerMBS.startAdvertising(advertisementData as Dictionary)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Invoked when you start advertising the local peripheral device’s data.

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

This event is invoked when your app calls the startAdvertising method to begin advertising the local peripheral device’s data. If successful, the error parameter is nil. If there is a problem advertising the data, the error parameter returns the cause of the failure.

CBPeripheralManagerMBS.stopAdvertising

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Stops advertising peripheral manager data.

Call this method when you no longer want to advertise peripheral manager data.

CBPeripheralManagerMBS.updateValue(value as MemoryBlock, characteristic as CBMutableCharacteristicMBS, onSubscribedCentrals() as CBCentralMBS = nil) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Bluetooth MBS Bluetooth Plugin 18.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Sends an updated characteristic value to one or more subscribed centrals, via a notification or indication.

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.

Returns 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.

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 peripheralManagerIsReadyToUpdateSubscribers event 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.

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


The biggest plugin in space...