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;
    
  • 相关阅读:
    ie浏览器下,get请求缓存问题
    grunt 单独压缩多个js和css文件【转】
    初次接触nodejs,请多指教。
    浮躁是一种流行病【转】
    php安装配置那些事(本文纯属个人记事与技术无关)
    读取年份数组中的所有周六周天
    C#窗体中读取修改xml文件
    Power BI brief introduction
    D365 CRM online trial application
    TalkingData Cocos2dx集成指南【最新】
  • 原文地址:https://www.cnblogs.com/zhongriqianqian/p/3980906.html
Copyright © 2011-2022 走看看