Package apple.corebluetooth.protocol
Interface CBCentralManagerDelegate
-
public interface CBCentralManagerDelegate[@protocol] CBCentralManagerDelegate The delegate of aCBCentralManagerobject must adopt theCBCentralManagerDelegateprotocol. The single required method indicates the availability of the central manager, while the optional methods allow for the discovery and connection of peripherals.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidcentralManagerConnectionEventDidOccurForPeripheral(CBCentralManager central, long event, CBPeripheral peripheral)centralManager:connectionEventDidOccur:forPeripheral: This method is invoked upon the connection or disconnection of a peripheral that matches any of the options provided in {@link registerForConnectionEventsWithOptions:}.default voidcentralManagerDidConnectPeripheral(CBCentralManager central, CBPeripheral peripheral)centralManager:didConnectPeripheral: This method is invoked when a connection initiated by {@link connectPeripheral:options:} has succeeded.default voidcentralManagerDidDisconnectPeripheralError(CBCentralManager central, CBPeripheral peripheral, NSError error)centralManager:didDisconnectPeripheral:error: This method is invoked upon the disconnection of a peripheral that was connected by {@link connectPeripheral:options:}.default voidcentralManagerDidDiscoverPeripheralAdvertisementDataRSSI(CBCentralManager central, CBPeripheral peripheral, NSDictionary<java.lang.String,?> advertisementData, NSNumber RSSI)centralManager:didDiscoverPeripheral:advertisementData:RSSI: This method is invoked while scanning, upon the discovery of peripheral by central.default voidcentralManagerDidFailToConnectPeripheralError(CBCentralManager central, CBPeripheral peripheral, NSError error)centralManager:didFailToConnectPeripheral:error: This method is invoked when a connection initiated by {@link connectPeripheral:options:} has failed to complete.default voidcentralManagerDidUpdateANCSAuthorizationForPeripheral(CBCentralManager central, CBPeripheral peripheral)centralManager:didUpdateANCSAuthorizationForPeripheral: This method is invoked when the authorization status changes for a peripheral connected with {@link connectPeripheral:} optionCBConnectPeripheralOptionRequiresANCS.voidcentralManagerDidUpdateState(CBCentralManager central)centralManagerDidUpdateState: Invoked whenever the central manager's state has been updated.default voidcentralManagerWillRestoreState(CBCentralManager central, NSDictionary<java.lang.String,?> dict)centralManager:willRestoreState: For apps that opt-in to state preservation and restoration, this is the first method invoked when your app is relaunched into the background to complete some Bluetooth-related task.
-
-
-
Method Detail
-
centralManagerDidConnectPeripheral
default void centralManagerDidConnectPeripheral(CBCentralManager central, CBPeripheral peripheral)
centralManager:didConnectPeripheral: This method is invoked when a connection initiated by {@link connectPeripheral:options:} has succeeded.- Parameters:
central- The central manager providing this information.peripheral- TheCBPeripheralthat has connected.
-
centralManagerDidDisconnectPeripheralError
default void centralManagerDidDisconnectPeripheralError(CBCentralManager central, CBPeripheral peripheral, NSError error)
centralManager:didDisconnectPeripheral:error: This method is invoked upon the disconnection of a peripheral that was connected by {@link connectPeripheral:options:}. If the disconnection was not initiated bycancelPeripheralConnection, the cause will be detailed in the error parameter. Once this method has been called, no more methods will be invoked on peripheral'sCBPeripheralDelegate.- Parameters:
central- The central manager providing this information.peripheral- TheCBPeripheralthat has disconnected.error- If an error occurred, the cause of the failure.
-
centralManagerDidDiscoverPeripheralAdvertisementDataRSSI
default void centralManagerDidDiscoverPeripheralAdvertisementDataRSSI(CBCentralManager central, CBPeripheral peripheral, NSDictionary<java.lang.String,?> advertisementData, NSNumber RSSI)
centralManager:didDiscoverPeripheral:advertisementData:RSSI: This method is invoked while scanning, upon the discovery of peripheral by central. A discovered peripheral must be retained in order to use it; otherwise, it is assumed to not be of interest and will be cleaned up by the central manager. For a list of advertisementData keys, seeCBAdvertisementDataLocalNameKeyand other similar constants.- Parameters:
central- The central manager providing this update.peripheral- ACBPeripheralobject.advertisementData- A dictionary containing any advertisement and scan response data.RSSI- The current RSSI of peripheral, in dBm. A value of127is reserved and indicates the RSSI was not available.- See Also:
CBAdvertisementData.h
-
centralManagerDidFailToConnectPeripheralError
default void centralManagerDidFailToConnectPeripheralError(CBCentralManager central, CBPeripheral peripheral, NSError error)
centralManager:didFailToConnectPeripheral:error: This method is invoked when a connection initiated by {@link connectPeripheral:options:} has failed to complete. As connection attempts do not timeout, the failure of a connection is atypical and usually indicative of a transient issue.- Parameters:
central- The central manager providing this information.peripheral- TheCBPeripheralthat has failed to connect.error- The cause of the failure.
-
centralManagerWillRestoreState
default void centralManagerWillRestoreState(CBCentralManager central, NSDictionary<java.lang.String,?> dict)
centralManager:willRestoreState: For apps that opt-in to state preservation and restoration, 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 your app's state with the state of the Bluetooth system.- Parameters:
central- The central manager providing this information.dict- A dictionary containing information about central that was preserved by the system at the time the app was terminated.
-
centralManagerDidUpdateState
void centralManagerDidUpdateState(CBCentralManager central)
centralManagerDidUpdateState: Invoked whenever the central manager's state has been updated. Commands should only be issued when the state isCBCentralManagerStatePoweredOn. A state belowCBCentralManagerStatePoweredOnimplies that scanning has stopped and any connected peripherals have been disconnected. If the state moves belowCBCentralManagerStatePoweredOff, allCBPeripheralobjects obtained from this central manager become invalid and must be retrieved or discovered again.- Parameters:
central- The central manager whose state has changed.- See Also:
state
-
centralManagerConnectionEventDidOccurForPeripheral
default void centralManagerConnectionEventDidOccurForPeripheral(CBCentralManager central, long event, CBPeripheral peripheral)
centralManager:connectionEventDidOccur:forPeripheral: This method is invoked upon the connection or disconnection of a peripheral that matches any of the options provided in {@link registerForConnectionEventsWithOptions:}.- Parameters:
central- The central manager providing this information.event- TheCBConnectionEventthat has occurred.peripheral- TheCBPeripheralthat caused the event.
-
centralManagerDidUpdateANCSAuthorizationForPeripheral
default void centralManagerDidUpdateANCSAuthorizationForPeripheral(CBCentralManager central, CBPeripheral peripheral)
centralManager:didUpdateANCSAuthorizationForPeripheral: This method is invoked when the authorization status changes for a peripheral connected with {@link connectPeripheral:} optionCBConnectPeripheralOptionRequiresANCS.- Parameters:
central- The central manager providing this information.peripheral- TheCBPeripheralthat caused the event.
-
-