Expand description
§Bindings to the CoreBluetooth
framework
See Apple’s docs and the general docs on framework crates for more information.
Structs§
- CBATT
Error CBError
- Apple’s documentation
- CBATT
Request CBATTRequest
- Represents a read or write request from a central.
- CBAttribute
CBAttribute
- Apple’s documentation
- CBAttribute
Permissions CBCharacteristic
- Read, write, and encryption permissions for an ATT attribute. Can be combined.
- CBCentral
CBCentral
andCBPeer
- Represents a remote central.
- CBCentral
Manager CBCentralManager
andCBManager
- Entry point to the central role. Commands should only be issued when its state is
CBCentralManagerStatePoweredOn
. - CBCentral
Manager Feature CBCentralManager
- The set of device specific features.
- CBCentral
Manager State Deprecated CBCentralManager
- Represents the current state of a CBCentralManager.
- CBCharacteristic
CBAttribute
andCBCharacteristic
- Represents a service’s characteristic.
- CBCharacteristic
Properties CBCharacteristic
- Characteristic properties determine how the characteristic value can be used, or how the descriptor(s) can be accessed. Can be combined. Unless otherwise specified, properties are valid for local characteristics published via
- CBCharacteristic
Write Type CBPeripheral
- Specifies which type of write is to be performed on a CBCharacteristic.
- CBConnection
Event CBCentralManager
- Represents the connection state of a peer.
- CBDescriptor
CBAttribute
andCBDescriptor
- Represents a characteristic’s descriptor.
- CBError
CBError
- The possible errors returned during LE transactions.
- CBL2CAP
Channel CBL2CAPChannel
- A CBL2CAPChannel represents a live L2CAP connection to a remote device
- CBManager
CBManager
- Apple’s documentation
- CBManager
Authorization CBManager
- Represents the current authorization state of a CBManager.
- CBManager
State CBManager
- Represents the current state of a CBManager.
- CBMutable
Characteristic CBAttribute
andCBCharacteristic
- Used to create a local characteristic, which can be added to the local database via
CBPeripheralManager
. Once a characteristic is published, it is cached and can no longer be changed. If a characteristic value is specified, it will be cached and markedCBCharacteristicPropertyRead
andCBAttributePermissionsReadable
. If a characteristic value needs to be writeable, or may change during the lifetime of the publishedCBService
, it is considered a dynamic value and will be requested on-demand. Dynamic values are identified by a value of nil . - CBMutable
Descriptor CBAttribute
andCBDescriptor
- Used to create a local characteristic descriptor, which can be added to the local database via
CBPeripheralManager
. Once a descriptor is published, it is cached and can no longer be changed. Descriptor types are detailed in - CBMutable
Service CBAttribute
andCBService
- Used to create a local service or included service, which can be added to the local database via
CBPeripheralManager
. Once a service is published, it is cached and can no longer be changed. This class adds write access to all properties in the - CBPeer
CBPeer
- Apple’s documentation
- CBPeripheral
CBPeer
andCBPeripheral
- Represents a peripheral.
- CBPeripheral
Manager CBManager
andCBPeripheralManager
- The
CBPeripheralManager
class is an abstraction of the Peripheral and Broadcaster GAP roles, and the GATT Server role. Its primary function is to allow you to manage published services within the GATT database, and to advertise these services to other devices. Each application has sandboxed access to the shared GATT database. You can add services to the database by calling { - CBPeripheral
Manager Authorization Status Deprecated CBPeripheralManager
- Represents the current state of a CBPeripheralManager.
- CBPeripheral
Manager Connection Latency CBPeripheralManager
- The latency of a peripheral-central connection controls how frequently messages can be exchanged.
- CBPeripheral
Manager State Deprecated CBPeripheralManager
- Represents the current state of a CBPeripheralManager.
- CBPeripheral
State CBPeripheral
- Represents the current connection state of a CBPeripheral.
- CBService
CBAttribute
andCBService
- Represents a peripheral’s service or a service’s included service.
- CBUUID
CBUUID
- A 16-bit, 32-bit, or 128-bit Bluetooth UUID. 16-bit and 32-bit UUIDs are implicitly pre-filled with the Bluetooth Base UUID.
Statics§
- CBATT
Error ⚠Domain CBError
- Apple’s documentation
- CBAdvertisement
Data ⚠IsConnectable CBAdvertisementData
- An NSNumber (Boolean) indicating whether or not the advertising event type was connectable. This can be used to determine whether or not a peripheral is connectable in that instant.
- CBAdvertisement
Data ⚠Local Name Key CBAdvertisementData
- A
NSString
containing the local name of a peripheral. - CBAdvertisement
Data ⚠Manufacturer Data Key CBAdvertisementData
- A
NSData
object containing the manufacturer data of a peripheral. - CBAdvertisement
Data ⚠Overflow ServiceUUI DsKey CBAdvertisementData
- A list of one or more
CBUUID
objects, representingCBService
UUIDs that were found in the “overflow” area of the advertising data. Due to the nature of the data stored in this area, UUIDs listed here are “best effort” and may not always be accurate. - CBAdvertisement
Data ⚠Service Data Key CBAdvertisementData
- A dictionary containing service-specific advertisement data. Keys are
CBUUID
objects, representingCBService
UUIDs. Values areNSData
objects. - CBAdvertisement
Data ⚠ServiceUUI DsKey CBAdvertisementData
- A list of one or more
CBUUID
objects, representingCBService
UUIDs. - CBAdvertisement
Data ⚠Solicited ServiceUUI DsKey CBAdvertisementData
- A list of one or more
CBUUID
objects, representingCBService
UUIDs. - CBAdvertisement
Data ⚠TxPower Level Key CBAdvertisementData
- A
NSNumber
containing the transmit power of a peripheral. - CBCentral
Manager ⚠Option Device Access ForMedia CBCentralManagerConstants
- A Boolean representing the CBCentralManager init purpose is for DeviceAccess for media only. This will limit the functionality of this manager and only allow media device access without prompting the user for Bluetooth generic TCC.
- CBCentral
Manager ⚠Option Restore Identifier Key CBCentralManagerConstants
- An NSString containing a unique identifier (UID) for the
CBCentralManager
that is being instantiated. This UID is used by the system to identify a specificCBCentralManager
instance for restoration and, therefore, must remain the same for subsequent application executions in order for the manager to be restored. - CBCentral
Manager ⚠Option Show Power Alert Key CBCentralManagerConstants
- An NSNumber (Boolean) indicating that the system should, if Bluetooth is powered off when
CBCentralManager
is instantiated, display a warning dialog to the user. - CBCentral
Manager ⚠Restored State Peripherals Key CBCentralManagerConstants
- An NSArray of
CBPeripheral
objects containing all peripherals that were connected or pending connection at the time the application was terminated by the system. When possible, all known information for each peripheral will be restored, including any discovered services, characteristics and descriptors, as well as characteristic notification states. - CBCentral
Manager ⚠Restored State Scan Options Key CBCentralManagerConstants
- An NSDictionary containing the scan options at the time the application was terminated by the system.
- CBCentral
Manager ⚠Restored State Scan Services Key CBCentralManagerConstants
- An NSArray of
CBUUID
objects containing the service(s) being scanned for at the time the application was terminated by the system. - CBCentral
Manager ⚠Scan Option Allow Duplicates Key CBCentralManagerConstants
- An NSNumber (Boolean) indicating that the scan should run without duplicate filtering. By default, multiple discoveries of the same peripheral are coalesced into a single discovery event. Specifying this option will cause a discovery event to be generated every time the peripheral is seen, which may be many times per second. This can be useful in specific situations, such as making a connection based on a peripheral’s RSSI, but may have an adverse affect on battery-life and application performance.
- CBCentral
Manager ⚠Scan Option Solicited ServiceUUI DsKey CBCentralManagerConstants
- An NSArray of
CBUUID
objects respresenting service UUIDs. Causes the scan to also look for peripherals soliciting any of the services contained in the list. - CBConnect
Peripheral ⚠Option Enable Auto Reconnect CBCentralManagerConstants
- An NSNumber (Boolean) indicating that the AutoReconnect is enabled for the peripheral is connected. After peripheral device is connected, this will allow the system to initiate connect to the peer device automatically when link is dropped. Caller will get notified about the disconnection with potential delay via {
- CBConnect
Peripheral ⚠Option Enable Transport Bridging Key CBCentralManagerConstants
- An NSNumber (Boolean) indicating that the system will bring up classic transport profiles when low energy transport for peripheral is connected.
- CBConnect
Peripheral ⚠Option Notify OnConnection Key CBCentralManagerConstants
- An NSNumber (Boolean) indicating that the system should display a connection alert for a given peripheral, if the application is suspended
when a successful connection is made.
This is useful for applications that have not specified the
bluetooth-central
background mode and cannot display their own alert. If more than one application has requested notification for a given peripheral, the one that was most recently in the foreground will receive the alert. - CBConnect
Peripheral ⚠Option Notify OnDisconnection Key CBCentralManagerConstants
- An NSNumber (Boolean) indicating that the system should display a disconnection alert for a given peripheral, if the application
is suspended at the time of the disconnection.
This is useful for applications that have not specified the
bluetooth-central
background mode and cannot display their own alert. If more than one application has requested notification for a given peripheral, the one that was most recently in the foreground will receive the alert. - CBConnect
Peripheral ⚠Option Notify OnNotification Key CBCentralManagerConstants
- An NSNumber (Boolean) indicating that the system should display an alert for all notifications received from a given peripheral, if
the application is suspended at the time.
This is useful for applications that have not specified the
bluetooth-central
background mode and cannot display their own alert. If more than one application has requested notification for a given peripheral, the one that was most recently in the foreground will receive the alert. - CBConnect
Peripheral ⚠Option RequiresANCS CBCentralManagerConstants
- An NSNumber (Boolean) indicating that the ANCS (Apple Notification Center Service) is required for the peripheral is connected.
- CBConnect
Peripheral ⚠Option Start Delay Key CBCentralManagerConstants
- An NSNumber indicating the number of seconds for the system to wait before starting a connection.
- CBConnection
Event ⚠Matching Option PeripheralUUI Ds CBCentralManagerConstants
- An NSArray of
NSUUID
objects respresenting peripheral identifiers. A connected peer with any matching identifier(s) will result in a call to { - CBConnection
Event ⚠Matching Option ServiceUUI Ds CBCentralManagerConstants
- An NSArray of
CBUUID
objects respresenting service UUIDs. A connected peer with any matching service UUIDs will result in a call to { - CBError
Domain ⚠CBError
- Apple’s documentation
- CBPeripheral
Manager ⚠Option Restore Identifier Key CBPeripheralManagerConstants
- An NSString containing a unique identifier (UID) for the
CBPeripheralManager
that is being instantiated. This UID is used by the system to identify a specificCBPeripheralManager
instance for restoration and, therefore, must remain the same for subsequent application executions in order for the manager to be restored. - CBPeripheral
Manager ⚠Option Show Power Alert Key CBPeripheralManagerConstants
- An NSNumber (Boolean) indicating that the system should, if Bluetooth is powered off when
CBPeripheralManager
is instantiated, display a warning dialog to the user. - CBPeripheral
Manager ⚠Restored State Advertisement Data Key CBPeripheralManagerConstants
- An NSDictionary containing the data being advertised at the time the application was terminated by the system.
- CBPeripheral
Manager ⚠Restored State Services Key CBPeripheralManagerConstants
- An NSArray of
CBMutableService
objects containing all services that were published to the local database at the time the application was terminated by the system. All information for each service will be restored, including all discovered services, characteristics and descriptors, as well as characteristic notification states. - CBUUID
Characteristic ⚠Aggregate Format String CBUUID
- The string representation of the UUID for the aggregate descriptor.
- CBUUID
Characteristic ⚠Extended Properties String CBUUID
- The string representation of the UUID for the extended properties descriptor.
The corresponding value for this descriptor is an
NSNumber
object. - CBUUID
Characteristic ⚠Format String CBUUID
- The string representation of the UUID for the presentation format descriptor.
The corresponding value for this descriptor is an
NSData
object. - CBUUID
Characteristic ⚠Observation Schedule String CBUUID
- Data representing the observation schedule for a characteristic.
- CBUUID
Characteristic ⚠User Description String CBUUID
- The string representation of the UUID for the user description descriptor.
The corresponding value for this descriptor is an
NSString
object. - CBUUID
Characteristic ⚠Valid Range String CBUUID
- Data representing the valid min/max values accepted for a characteristic.
- CBUUID
Client ⚠Characteristic Configuration String CBUUID
- The string representation of the UUID for the client configuration descriptor.
The corresponding value for this descriptor is an
NSNumber
object. - CBUUID
L2CAPPSM ⚠Characteristic String CBUUID
- The PSM (a little endian uint16_t) of an L2CAP Channel associated with the GATT service containing this characteristic. Servers can publish this characteristic with the UUID ABDD3056-28FA-441D-A470-55A75A52553A
- CBUUID
Server ⚠Characteristic Configuration String CBUUID
- The string representation of the UUID for the server configuration descriptor.
The corresponding value for this descriptor is an
NSNumber
object.
Traits§
- CBCentral
Manager Delegate CBCentralManager
- The delegate of a {
- CBPeripheral
Delegate CBPeripheral
- Delegate for CBPeripheral.
- CBPeripheral
Manager Delegate CBPeripheralManager
- The delegate of a
Type Aliases§
- CBConnection
Event Matching Option CBCentralManagerConstants
- Apple’s documentation
- CBL2CAPPSM
CBL2CAPChannel
- Apple’s documentation