CBPeripheralManager

typedef NS_ENUM(NSInteger, CBPeripheralManagerAuthorizationStatus) {
    CBPeripheralManagerAuthorizationStatusNotDetermined = 0,
    CBPeripheralManagerAuthorizationStatusRestricted,
    CBPeripheralManagerAuthorizationStatusDenied,
    CBPeripheralManagerAuthorizationStatusAuthorized,       
} NS_ENUM_AVAILABLE(NA, 7_0);

typedef NS_ENUM(NSInteger, CBPeripheralManagerState) {
    CBPeripheralManagerStateUnknown = CBManagerStateUnknown,
    CBPeripheralManagerStateResetting = CBManagerStateResetting,
    CBPeripheralManagerStateUnsupported = CBManagerStateUnsupported,
    CBPeripheralManagerStateUnauthorized = CBManagerStateUnauthorized,
    CBPeripheralManagerStatePoweredOff = CBManagerStatePoweredOff,
    CBPeripheralManagerStatePoweredOn = CBManagerStatePoweredOn,
} NS_DEPRECATED(NA, NA, 6_0, 10_0, "Use CBManagerState instead");


typedef NS_ENUM(NSInteger, CBPeripheralManagerConnectionLatency) {
    CBPeripheralManagerConnectionLatencyLow = 0,
    CBPeripheralManagerConnectionLatencyMedium,
    CBPeripheralManagerConnectionLatencyHigh
} NS_ENUM_AVAILABLE(NA, 6_0);

@property(nonatomic, weak, nullable) id<CBPeripheralManagerDelegate> delegate;

@property(nonatomic, assign, readonly) BOOL isAdvertising;

+ (CBPeripheralManagerAuthorizationStatus)authorizationStatus NS_AVAILABLE(NA, 7_0);

- (instancetype)init;

- (instancetype)initWithDelegate:(nullable id<CBPeripheralManagerDelegate>)delegate
                           queue:(nullable dispatch_queue_t)queue __TVOS_PROHIBITED;

- (instancetype)initWithDelegate:(nullable id<CBPeripheralManagerDelegate>)delegate
                           queue:(nullable dispatch_queue_t)queue
                         options:(nullable NSDictionary<NSString *, id> *)options NS_AVAILABLE(NA, 7_0) NS_DESIGNATED_INITIALIZER __TVOS_PROHIBITED;

- (void)startAdvertising:(nullable NSDictionary<NSString *, id> *)advertisementData;

- (void)stopAdvertising;

- (void)setDesiredConnectionLatency:(CBPeripheralManagerConnectionLatency)latency forCentral:(CBCentral *)central;

- (void)addService:(CBMutableService *)service;

- (void)removeService:(CBMutableService *)service;

- (void)removeAllServices;

- (void)respondToRequest:(CBATTRequest *)request withResult:(CBATTError)result;

- (BOOL)updateValue:(NSData *)value forCharacteristic:(CBMutableCharacteristic *)characteristic onSubscribedCentrals:(nullable NSArray<CBCentral *> *)centrals;

- (void)peripheralManagerDidUpdateState:(CBPeripheralManager *)peripheral;

- (void)peripheralManager:(CBPeripheralManager *)peripheral willRestoreState:(NSDictionary<NSString *, id> *)dict;

- (void)peripheralManagerDidStartAdvertising:(CBPeripheralManager *)peripheral error:(nullable NSError *)error;

- (void)peripheralManager:(CBPeripheralManager *)peripheral didAddService:(CBService *)service error:(nullable NSError *)error;

- (void)peripheralManager:(CBPeripheralManager *)peripheral central:(CBCentral *)central didSubscribeToCharacteristic:(CBCharacteristic *)characteristic;

- (void)peripheralManager:(CBPeripheralManager *)peripheral central:(CBCentral *)central didUnsubscribeFromCharacteristic:(CBCharacteristic *)characteristic;

- (void)peripheralManager:(CBPeripheralManager *)peripheral didReceiveReadRequest:(CBATTRequest *)request;

- (void)peripheralManager:(CBPeripheralManager *)peripheral didReceiveWriteRequests:(NSArray<CBATTRequest *> *)requests;

- (void)peripheralManagerIsReadyToUpdateSubscribers:(CBPeripheralManager *)peripheral;











最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容

  • 夏天真的是要來了,天氣都變得有些炎熱,連我也開始躁動不安。不過,我有讓自己平靜下來的方法,那就是練字和種花。 說來...
    夏野閱讀 135評論 0 0
  • 這本書的作者是伊朗作家絲芭·沙克布,在這本書中,作者給我們講述了一個阿拉伯女人錫林―戈爾的一生,錫林―戈爾的意思是...
    荷然閱讀 995評論 0 0
  • 爬上眼前那座陌生的山 山的平頂上布滿了一座座墳 墓碑上刻著陌生人的名字 名字前立著永不凋零的花 我從它們身旁走過 ...
    君涼閱讀 312評論 9 19
  • 昨天晚上快速瀏覽了一遍俄羅斯電影《他是龍》,剛開始以為是一部驚悚片,后來發現這根本就是一部跨越物種的人獸戀愛養成系...
    陽光滿堂閱讀 488評論 0 1