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;
网友评论