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.

129 lines
3.2 KiB

//
// HPlusBluetoothManager.h
// HPlusBluetooth_Example
//
// Created by lemo. on 2019/5/14.
// Copyright © 2019 chentingfeng. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreBluetooth/CoreBluetooth.h>
#import <ECellBluetooth/ECellBluetoothDelegate.h>
#import <ECellBluetooth/ECellPeripheralModel.h>
#import <ECellBluetooth/ECellBLEEnum.h>
#import <ECellBluetooth/ECellBLEConst.h>
#import <ECellBluetooth/ECellBLEItem.h>
NS_ASSUME_NONNULL_BEGIN
@interface ECellBluetoothManager : NSObject
/**
| Setting up the agent
*/
@property (nonatomic,weak) id<ECellBluetoothDelegate> delegate;
/**
| Bluetooth Management Center
*/
@property (nonatomic,strong) CBCentralManager *centralManager;
/**
| Peripherals
*/
@property (nullable, nonatomic,strong) CBPeripheral *currenPeripheral;
/** 请求结果回调 */
@property (nonatomic, copy ) ResultBlock result;
/**
| Is Bluetooth enabled?
*/
@property (nonatomic,assign,readonly) BOOL poweredOn;
/**
| Bluetooth is connected
*/
@property (nonatomic,assign,readonly) BOOL connected;
/**
| Is the current connected device bound?
*/
@property (nonatomic,assign) BOOL isBind;
/**
(NO,) | Is it Jerry right now
*/
@property (nonatomic,assign) BOOL isJL;
/**
* 80 80
* Set the device with weak scan filtering signal. Default value 80 is greater than 80 will be filtered.
*/
@property (nonatomic,assign) NSInteger rssiNum;
/**
* 5
* Send command timeout defaults to 5 seconds by default
*/
@property (nonatomic, assign) NSInteger commandTimeOutNumber;
/**
| Start scanning
*/
- (void)startScan;
/**
| Stop scanning
*/
- (void)stopScan;
/**
* @brief | Select peripheral connection
* @param model ECellPeripheralModel | ECellPeripheralModel object
*/
- (void)connectDeviceWithModel:(ECellPeripheralModel *)model;
/**
() | Disconnect the current peripheral device (The device information will be cleared and will not be reconnected)
*/
- (void)cancelCurrentPeripheralConnection;
/**
SDK服务 | Register for SDK service
@param outputSdkLog (NO) | Whether to output the Bluetooth protocol running log (default NO)
@param isReconnect (YES) | Whether a reconnect mechanism is required (default YES)
*/
- (void)registrationServices:(BOOL)outputSdkLog
IsReconnect:(BOOL)isReconnect;
/**
* @brief
* Initialize the Bluetooth Management Center object
* @return HPlusBluetoothManager
*/
+ (__kindof ECellBluetoothManager *)shareInstance;
- (void)writeWithBleItem:(ECellBLEItem *)item;
/**
*
*/
- (void)handleReceiveData:(NSData *)receiveData ParseResult:(ParseCmdResultBlock)resultBlock;
/**
*/
- (void)startAndStopReconnect;
@end
NS_ASSUME_NONNULL_END