zoukankan      html  css  js  c++  java
  • CBCentralManager

    Initializing a Central Manager

    - (instancetype)initWithDelegate:(id<CBCentralManagerDelegate>)delegate queue:(dispatch_queue_t)queue//建立Center
    - (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//获取已经连接的设备。回调centralManager:didRetrieveConnectedPeripherals。如果与其他Center连接也会获得。
    - (NSArray *)retrieveConnectedPeripheralsWithServices:(NSArray *)serviceUUIDs//直接返回peripherals列表,无需回调。IOS7新增以取代上个方法。
    - (void)retrievePeripherals:(NSArray *)peripheralUUIDs//根据UUID获得设备。回调centralManager:didRetrievePeripherals。
    - (NSArray *)retrievePeripheralsWithIdentifiers:(NSArray *)identifiers//直接返回peripherals列表。 

     

    Scanning or Stopping Scans of Peripherals

    - (void)scanForPeripheralsWithServices:(NSArray *)serviceUUIDs options:(NSDictionary *)options//启动扫描。回调diddiscover
    - (void)stopScan//停止扫描
    

    Monitoring Properties

    @property(readonly) CBCentralManagerState state//状态。系统调用centralManagerDidUpdateState更新状态。主要为当前蓝牙状态。
    @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 ,//不允许此APP使用低功耗蓝牙
       CBCentralManagerStatePoweredOff ,//蓝牙关闭
       CBCentralManagerStatePoweredOn ,//蓝牙打开并可以正常使用
    } CBCentralManagerState;
    
  • 相关阅读:
    ThreadLocal的设计理念与作用
    生产者消费者模式
    Java 线程池
    对象锁(包括方法锁)和类锁
    C++入门经典-例2.12-求逻辑表达式的值
    C++入门经典-例2.11-流输出小数控制
    C++入门经典-例2.10-控制输出精确度
    C++入门经典-例2.9-输出十六进制数以及大写的十六进制数
    C++入门经典-例2.8-输出整数,控制打印格式
    C++入门经典-例2.7-控制cout打印格式程序
  • 原文地址:https://www.cnblogs.com/zhongriqianqian/p/3980906.html
Copyright © 2011-2022 走看看