//
//  EZIoTBLECenterDelegate.h
//  AFNetworking
//
//  Created by yuqian on 2023/8/15.
//

#import <Foundation/Foundation.h>
#import <CoreBluetooth/CoreBluetooth.h>

NS_ASSUME_NONNULL_BEGIN

@class EZIoTBLECenterMgr,EZIoTPeripheral;

@protocol EZIoTBLECenterDelegate <NSObject>

#pragma mark - Connect
- (void)centralManagerDidUpdateState:(EZIoTBLECenterMgr *)central state:(CBManagerState )state;
- (void)centralManager:(EZIoTBLECenterMgr *)central didDiscoverPeripheral:(EZIoTPeripheral *)peripheral advertisementData:(NSDictionary<NSString *, id> *)advertisementData RSSI:(NSNumber *)RSSI;
- (void)centralManager:(EZIoTBLECenterMgr *)central didConnectPeripheral:(EZIoTPeripheral *)peripheral;
- (void)centralManager:(EZIoTBLECenterMgr *)central didFailToConnectPeripheral:(EZIoTPeripheral *)peripheral error:(nullable NSError *)error;
- (void)centralManager:(EZIoTBLECenterMgr *)central didDisconnectPeripheral:(EZIoTPeripheral *)peripheral error:(nullable NSError *)error;
- (void)centralManager:(EZIoTBLECenterMgr *)central willRestoreState:(NSDictionary<NSString *, id> *)dict;
// 连接成功之后进行查询特征值判断
- (void)centralManager:(EZIoTBLECenterMgr *)central didUpdateNotificationStateForConnectPeripheral:(EZIoTPeripheral *)peripheral;

#pragma mark - Service & Character
- (void)peripheral:(EZIoTPeripheral *)peripheral didDiscoverServices:(NSError *)error;
- (void)peripheral:(EZIoTPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error;
- (void)peripheral:(EZIoTPeripheral *)peripheral didWriteValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error;
- (void)peripheral:(EZIoTPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error;
- (void)peripheral:(EZIoTPeripheral *)peripheral didUpdateNotificationStateForCharacteristic:(nonnull CBCharacteristic *)characteristic error:(nullable NSError *)error;

@end

NS_ASSUME_NONNULL_END
