You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

119 lines
4.4 KiB

//
// ECellBluetoothDelegate.h
// ECellBluetooth_Example
//
// Created by lemo. on 2019/5/14.
// Copyright © 2019 chentingfeng. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <ECellBluetooth/ECellBLEEnum.h>
#import <ECellBluetooth/ECellPeripheralModel.h>
NS_ASSUME_NONNULL_BEGIN
@class ECellBluetoothManager;
@protocol ECellBluetoothDelegate <NSObject>
@optional
/**
* @brief 蓝牙管理状态 | Bluetooth management status
* @param manager HPlus蓝牙管理中心 | HPlus Bluetooth Management Center
* @param state 状态 | Status
*/
- (void)bluetoothManager:(ECellBluetoothManager *)manager
didUpdateState:(ECell_BLE_MANAGER_STATE)state;
/**
* @brief 扫描所有外围设备 | Scan all peripherals
* @param manager HPlus蓝牙管理中心 | HPlus Bluetooth Management Center
* @param allDevices 扫描所有外围设备(包括OTA设备集合) | Scan all peripherals (including OTA device collections)
* @param otaDevices OTA 设备集合 | OTA Device Collection
*/
- (void)bluetoothManager:(ECellBluetoothManager *)manager
allDevices:(NSArray <ECellPeripheralModel *>*)allDevices
otaDevices:(NSArray <ECellPeripheralModel *>*)otaDevices;
/**
* @brief 连接设备成功回调 | Connected device successfully callback
* @param manager HPlus蓝牙管理中心 | HPlus Bluetooth Management Center
* @param centerManager 蓝牙管理中心 | Bluetooth Management Center
* @param peripheral 外围设备 | Peripherals
* @param isOtaMode 连接是否在OTA模式 | Is the connection in OTA mode?
*/
- (void)bluetoothManager:(ECellBluetoothManager *)manager
centerManager:(CBCentralManager *)centerManager
didConnectPeripheral:(CBPeripheral *)peripheral
isOatMode:(BOOL)isOtaMode;
/**
* @brief 连接设备错误回调,当解绑设备断开连接时不会回调此方法
* Connection Device Error Callback,This method is not called back when the unbound device is disconnected.
* @param manager HPlus蓝牙管理中心 | HPlus Bluetooth Management Center
* @param error 错误信息 | Error message
*/
- (void)bluetoothManager:(ECellBluetoothManager *)manager
connectPeripheralError:(NSError *)error;
/**
* @brief 设备断开连接回调 | Device disconnect callback
* @param manager HPlus蓝牙管理中心 | HPlus Bluetooth Management Center
* @param centerManager 蓝牙管理中心 | Bluetooth Management Center
* @param peripheral 外围设备 | Peripherals
* @param isOtaMode 连接是否在OTA模式 | Is the connection in OTA mode?
*/
- (void)bluetoothManager:(ECellBluetoothManager *)manager
centerManager:(CBCentralManager *)centerManager
disConnectPeripheral:(CBPeripheral *)peripheral
isOatMode:(BOOL)isOtaMode;
/**
* @method bluetoothPeripheral:didDiscoverServices:
*
* @param peripheral The peripheral providing this information.
* @param error If an error occurred, the cause of the failure.
*/
- (void)bluetoothPeripheral:(CBPeripheral *)peripheral
didDiscoverServices:(NSError *)error;
/**
* @method bluetoothPeripheral:didDiscoverCharacteristicsForService:error:
*
* @param peripheral The peripheral providing this information.
* @param service The <code>CBService</code> object containing the characteristic(s).
* @param error If an error occurred, the cause of the failure.
*/
- (void)bluetoothPeripheral:(CBPeripheral *)peripheral
didDiscoverCharacteristicsForService:(CBService *)service
error:(NSError *)error;
/**
* @method bluetoothPeripheral:didUpdateValueForCharacteristic:error:
*
* @param peripheral The peripheral providing this information.
* @param characteristic A <code>CBCharacteristic</code> object.
* @param error If an error occurred, the cause of the failure.
*/
- (void)bluetoothPeripheral:(CBPeripheral *)peripheral
didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic
error:(NSError *)error;
/**
* @method peripheral:didUpdateNotificationStateForCharacteristic:error:
*
* @param peripheral The peripheral providing this information.
* @param characteristic A <code>CBCharacteristic</code> object.
* @param error If an error occurred, the cause of the failure.
*/
- (void)bluetoothPeripheral:(CBPeripheral *)peripheral
didUpdateNotificationStateForCharacteristic:(CBCharacteristic *)characteristic
error:(nullable NSError *)error;
@end
NS_ASSUME_NONNULL_END