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.

120 lines
0 B

//
// 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