首页 > 代码库 > CBCentralManager

CBCentralManager

Initializing a Central Manager

- (instancetype)initWithDelegate:(id<CBCentralManagerDelegate>)delegate queue:(dispatch_queue_t)queue- (instancetype)initWithDelegate:(id<CBCentralManagerDelegate>)delegate queue:(dispatch_queue_t)queue options:(NSDictionary *)options

 

Establishing or Canceling Connections with Peripherals

- (void)connectPeripheral:(CBPeripheral *)peripheral options:(NSDictionary *)options- (void)cancelPeripheralConnection:(CBPeripheral *)peripheral

 

Retrieving Lists of Peripherals

- (void)retrieveConnectedPeripherals- (NSArray *)retrieveConnectedPeripheralsWithServices:(NSArray *)serviceUUIDs- (void)retrievePeripherals:(NSArray *)peripheralUUIDs- (NSArray *)retrievePeripheralsWithIdentifiers:(NSArray *)identifiers

 

Scanning or Stopping Scans of Peripherals

- (void)scanForPeripheralsWithServices:(NSArray *)serviceUUIDs options:(NSDictionary *)options- (void)stopScan

 

Monitoring Properties

@property(readonly) CBCentralManagerState state@property(weak, nonatomic) id< CBCentralManagerDelegate > delegate

 

Constants

  

Central Manager Initialization Options

NSString *const  CBCentralManagerOptionShowPowerAlertKey ;NSString *const  CBCentralManagerOptionRestoreIdentifierKey;

  

Peripheral Scanning Options

NSString *const  CBCentralManagerScanOptionAllowDuplicatesKey ;NSString *const  CBCentralManagerScanOptionSolicitedServiceUUIDsKey;

 


Peripheral Connection Options

NSString *const  CBConnectPeripheralOptionNotifyOnConnectionKey ;NSString *const  CBConnectPeripheralOptionNotifyOnDisconnectionKey ;NSString *const  CBConnectPeripheralOptionNotifyOnNotificationKey;

 

Central Manager State

typedef enum {   CBCentralManagerStateUnknown  = 0,   CBCentralManagerStateResetting ,   CBCentralManagerStateUnsupported ,   CBCentralManagerStateUnauthorized ,   CBCentralManagerStatePoweredOff ,   CBCentralManagerStatePoweredOn ,} CBCentralManagerState;

 

CBCentralManager