Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

CBPeripheralMBS.Constructor(Peripheral as CBPeripheralMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Bluetooth MBS Bluetooth Plugin 18.1 Yes No No Yes, macOS only No
Function: The constructor.
Notes: You can subclass this class and fill events. Than when you get a Peripheral, you can call this constructor to make a new object of your subclass with the given Peripheral and connect the event.

Feedback, Comments & Corrections

CBPeripheralMBS.Destructor
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Bluetooth MBS Bluetooth Plugin 18.1 Yes No No Yes, macOS only No
Function: The destructor.

Feedback, Comments & Corrections

CBPeripheralMBS.discoverCharacteristics(characteristicUUIDs() as CBUUIDMBS = nil, service as CBServiceMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Bluetooth MBS Bluetooth Plugin 18.1 Yes No No Yes, macOS only No
Function: Discovers the specified characteristics of a service.
Notes:
characteristicUUIDs: An array of CBUUID objects that you are interested in. Here, each CBUUID object represents a UUID that identifies the type of a characteristic you want to discover.
service: The service whose characteristics you want to discover.

An array of CBUUID objects—representing characteristic UUIDs—can be provided in the characteristicUUIDs parameter. As a result, the peripheral returns only the characteristics of the service that your app is interested in (recommended). If the characteristicUUIDs parameter is nil, all the characteristics of the service are returned; setting the parameter to nil is considerably slower and is not recommended. When the peripheral discovers one or more characteristics of the specified service, it calls the didDiscoverCharacteristicsForService event. If the characteristics of a service are successfully discovered, you can access them through the service’s characteristics property.

Feedback, Comments & Corrections

CBPeripheralMBS.discoverDescriptorsForCharacteristic(Characteristic as CBCharacteristicMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Bluetooth MBS Bluetooth Plugin 18.1 Yes No No Yes, macOS only No
Function: Discovers the descriptors of a characteristic.
Notes:
characteristic: The characteristic whose descriptors you want to discover.

When the peripheral discovers one or more descriptors of the specified characteristic, it calls the didDiscoverDescriptorsForCharacteristic event. If the descriptors of a characteristic are successfully discovered, you can access them through the characteristic’s descriptors property.

Feedback, Comments & Corrections

CBPeripheralMBS.discoverIncludedServices(includedServiceUUIDs() as CBUUIDMBS = nil, service as CBServiceMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Bluetooth MBS Bluetooth Plugin 18.1 Yes No No Yes, macOS only No
Function: Discovers the specified included services of a service.
Notes:
includedServiceUUIDs: An array of CBUUID objects that you are interested in. Here, each CBUUID object represents a UUID that identifies the type of included service you want to discover.
service: The service whose included services you want to discover.

You can provide an array of CBUUID objects—representing included service UUIDs—in the includedServiceUUIDs parameter. When you do, the peripheral returns only the included services of the service that your app is interested in (recommended). If the includedServicesUUIDs parameter is nil, all the included services of the service are returned; setting the parameter to nil is considerably slower and is not recommended. When the peripheral discovers one or more included services of the specified service, it calls the didDiscoverIncludedServicesForService event. If the included services of a service are successfully discovered, you can access them through the service's includedServices property.

Feedback, Comments & Corrections

CBPeripheralMBS.discoverServices(serviceUUIDs() as CBUUIDMBS = nil)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Bluetooth MBS Bluetooth Plugin 18.1 Yes No No Yes, macOS only No
Function: Discovers the specified services of the peripheral.
Notes:
serviceUUIDs: An array of CBUUID objects that you are interested in. Here, each CBUUID object represents a UUID that identifies the type of service you want to discover.

You can provide an array of CBUUID objects—representing service UUIDs—in the serviceUUIDs parameter. When you do, the peripheral returns only the services of the peripheral that your app is interested in (recommended). If the servicesUUIDs parameter is nil, all the available services of the peripheral are returned; setting the parameter to nil is considerably slower and is not recommended. When the peripheral discovers one or more services, it calls the didDiscoverServices event. If the services of the peripheral are successfully discovered, you can access them through the peripheral’s services property.

Feedback, Comments & Corrections

CBPeripheralMBS.maximumWriteValueLengthForType(Type as Integer) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Bluetooth MBS Bluetooth Plugin 18.1 Yes No No Yes, macOS only No
Function: The maximum amount of data, in bytes, that can be sent to a characteristic in a single write type.
Notes: Type can be kWriteWithResponse or kWriteWithoutResponse.

Feedback, Comments & Corrections

CBPeripheralMBS.readRSSI
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Bluetooth MBS Bluetooth Plugin 18.1 Yes No No Yes, macOS only No
Function: Retrieves the current RSSI value for the peripheral while it is connected to the central manager.
Notes: In macOS, when you call this method to retrieve the RSSI of the peripheral while it is currently connected to the central manager, the peripheral calls the peripheralDidUpdateRSSI event. If the RSSI value of the peripheral is successfully retrieved, you can access it through the peripheral’s RSSI property.

Feedback, Comments & Corrections

CBPeripheralMBS.readValueForCharacteristic(Characteristic as CBCharacteristicMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Bluetooth MBS Bluetooth Plugin 18.1 Yes No No Yes, macOS only No
Function: Retrieves the value of a specified characteristic.
Notes:
characteristic: The characteristic whose value you want to read.

When you call this method to read the value of a characteristic, the peripheral calls the peripheral:didUpdateValueForCharacteristic:error: method of its delegate object. If the value of the characteristic is successfully retrieved, you can access it through the characteristic’s value property.
Not all characteristics are guaranteed to have a readable value. You can determine whether a characteristic’s value is readable by accessing the relevant properties of the CBCharacteristicProperties enumeration, which are detailed in CBCharacteristic.

Feedback, Comments & Corrections

CBPeripheralMBS.readValueForDescriptor(descriptor as CBDescriptorMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Bluetooth MBS Bluetooth Plugin 18.1 Yes No No Yes, macOS only No
Function: Retrieves the value of a specified characteristic descriptor.
Notes:
descriptor: The characteristic descriptor whose value you want to read.

When you call this method to read the value of a characteristic descriptor, the peripheral calls the didUpdateValueForDescriptor event. If the value of the characteristic descriptor is successfully retrieved, you can access it through the characteristic descriptor’s value property.

Feedback, Comments & Corrections

CBPeripheralMBS.services as CBServiceMBS()
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Bluetooth MBS Bluetooth Plugin 18.1 Yes No No Yes, macOS only No
Function: A list of services on the peripheral that have been discovered.
Notes: Returns an array of services (represented by CBService objects) that were discovered on the peripheral through a successful call to the discoverServices method. If you have yet to call the discoverServices method to discover the services of the peripheral, or if there was an error in doing so, the value of this property is nil.

Feedback, Comments & Corrections

CBPeripheralMBS.setNotifyValue(enabled as Boolean, Characteristic as CBCharacteristicMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Bluetooth MBS Bluetooth Plugin 18.1 Yes No No Yes, macOS only No
Function: Sets notifications or indications for the value of a specified characteristic.
Notes:
enabled: A Boolean value indicating whether you wish to receive notifications or indications whenever the characteristic’s value changes. true if you want to enable notifications or indications for the characteristic’s value. false if you do not want to receive notifications or indications whenever the characteristic’s value changes.

characteristic: The specified characteristic.

When you enable notifications for the characteristic’s value, the peripheral calls the didUpdateNotificationStateForCharacteristic event to indicate whether or not the action succeeded. If successful, the peripheral then calls the didUpdateValueForCharacteristic event whenever the characteristic value changes. Because it is the peripheral that chooses when to send an update, your app should be prepared to handle them as long as notifications or indications remain enabled. If the specified characteristic is configured to allow both notifications and indications, calling this method enables notifications only. You can disable notifications and indications for a characteristic’s value by calling this method with the enabled parameter set to false.

Feedback, Comments & Corrections

CBPeripheralMBS.writeValue(data as MemoryBlock, Characteristic as CBCharacteristicMBS, Type as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Bluetooth MBS Bluetooth Plugin 18.1 Yes No No Yes, macOS only No
Function: Writes the value of a characteristic.
Notes:
data: The value to be written.
characteristic: The characteristic whose value is to be written.
type: The type of write to be executed. For a list of the possible types of writes to a characteristic’s value, see CBCharacteristicWriteType.

When you call this method to write the value of a characteristic, the peripheral calls the didWriteValueForCharacteristic event only if you specified the write type as CBCharacteristicMBS.kWriteWithResponse. The response you receive through the didWriteValueForCharacteristic event indicates whether the write was successful; if the write failed, it details the cause of the failure in an error. If you specify the write type as CBCharacteristicWriteWithoutResponse, the write is best-effort and not guaranteed. If the write does not succeed in this case, you are not notified nor do you receive an error indicating the cause of the failure. The data passed into the data parameter is copied, and you can dispose of it after the method returns.
Characteristics may allow only certain type of writes to be performed on their value. To determine which types of writes are permitted to a characteristic’s value, you access the relevant properties of the CBCharacteristicProperties enumeration, which are detailed in CBCharacteristic.

See also:

Feedback, Comments & Corrections

CBPeripheralMBS.writeValue(data as MemoryBlock, Descriptor as CBDescriptorMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Bluetooth MBS Bluetooth Plugin 18.1 Yes No No Yes, macOS only No
Function: Writes the value of a characteristic descriptor.
Notes:
data: The value to be written.
descriptor: The descriptor whose value is to be written.

When you call this method to write the value of a characteristic descriptor, the peripheral calls the peripheral:didWriteValueForDescriptor:error: method of its delegate object. The data passed into the data parameter is copied, and you can dispose of it after the method returns.
You cannot use this method to write the value of a client configuration descriptor (represented by the CBUUIDClientCharacteristicConfigurationString constant), which describes how notification or indications are configured for a characteristic’s value with respect to a client. If you want to manage notifications or indications for a characteristic’s value, you must use the setNotifyValue method instead.

See also:

Feedback, Comments & Corrections

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





Links
MBS Xojo PDF Plugins