45 lines
1.5 KiB
C
45 lines
1.5 KiB
C
|
|
//
|
||
|
|
// ENNativeDevice.h
|
||
|
|
// ENBLEProject
|
||
|
|
//
|
||
|
|
// Created by lvwang2002 on 16/4/7.
|
||
|
|
// Copyright © 2016年 Facebook. All rights reserved.
|
||
|
|
//
|
||
|
|
|
||
|
|
#import <Foundation/Foundation.h>
|
||
|
|
#import <CoreBluetooth/CoreBluetooth.h>
|
||
|
|
#import "BLEDevice.h"
|
||
|
|
|
||
|
|
@class BLEDevice;
|
||
|
|
@protocol ENNativeDeviceProtocal;
|
||
|
|
@interface ENNativeDevice : NSObject{
|
||
|
|
@public
|
||
|
|
__weak CBPeripheral *_peripheral;
|
||
|
|
__weak CBCentralManager *_centralManager;
|
||
|
|
__weak BLEDevice *_device;
|
||
|
|
}
|
||
|
|
@property(nonatomic,weak)id<ENNativeDeviceProtocal>deviceDelegate;
|
||
|
|
|
||
|
|
-(instancetype)initWithPeripheral:(CBPeripheral *)peripheral WithCentralManager:(CBCentralManager *)centerManager WithDevice:(BLEDevice *)device;
|
||
|
|
|
||
|
|
+(ENNativeDevice *)getNativeDeviceWithDevice:(BLEDevice *)device
|
||
|
|
WithPeripheral:(CBPeripheral *)peripheral
|
||
|
|
CentralManager:(CBCentralManager *)centerManager;
|
||
|
|
-(NSString *)getConnectedStatus;
|
||
|
|
|
||
|
|
/** 得到设备显示名字 */
|
||
|
|
-(NSString *)getDeviceDisplayName;
|
||
|
|
|
||
|
|
- (void)peripheral:(CBPeripheral *)peripheral didDiscoverServices:(NSError *)error;
|
||
|
|
- (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error;
|
||
|
|
- (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error;
|
||
|
|
|
||
|
|
- (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForReceiveData:(NSData *)data UUID:(CBUUID *)uuid error:(NSError *)error;
|
||
|
|
@end
|
||
|
|
|
||
|
|
@protocol ENNativeDeviceProtocal <NSObject>
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
@end
|