// // ELSmartRingManager.h // Elink // // Created by 周鹏 on 2023/11/17. // Copyright © 2023 iot_iMac. All rights reserved. // #import #import "ELAILinkBleManager+SmartRing.h" #import "ELSmartRingBleHeader.h" #import "ELSmartRingBleParser.h" #import "AICareComponentRingBleSDK_Version.h" NS_ASSUME_NONNULL_BEGIN @class ELSmartRingBleModel; @protocol ELSmartRingManagerDelegate; @interface ELSmartRingManager : NSObject /* 蓝牙连接状态*/ @property (nonatomic, assign) NELBleManagerConnectState bleConnectState; @property (nonatomic, assign) CBManagerState centralState; //电池状态 @property (nonatomic, assign) struct ELBatteryStruct battery; @property (nonatomic, weak) id delegate; //判断是否需要常链接 @property (nonatomic, assign) BOOL needLongConnected; //监测间隔 @property (nonatomic, assign) NSInteger interval; //日常监测 type RRI @property (nonatomic, assign) NSInteger RRIType; //佩戴状态 @property (nonatomic, assign) NSInteger wearStatue; //判断是否开启日常监测 @property (nonatomic, assign) BOOL isOpenMonitoring; // @property (nonatomic, copy) NSString *bmVersion; + (instancetype)sharedManager; - (NSString *)sdkVersion; + (NSString *)sdkVersion; - (void)scanAll; - (void)scanFilterWithCidArray:(NSArray *_Nonnull)cidArray; - (void)scanFilterWithMacArray:(NSArray *_Nonnull)macArray; - (void)scanFilterWithCidArray:(NSArray *_Nonnull)cidArray macArray:(NSArray *_Nonnull)macArray; - (void)stopScan; - (void)connectAILinkPeripheral:(ELAILinkPeripheral *)ailinkPeripheral; -(void)smartRingGetDeviceStatus;//获取设备状态,电量和佩戴状况 -(void)smartRingReocrdWithType:(NSInteger)type;//获取日常检测历史记录 //0 开始获取 1 继续获取 2 结束获取 3 删除历史记录 - (void)smartRingSleepReocrdWithType:(NSInteger)type;//获取睡眠步数历史记录 //0 开始获取 1 继续获取 2 结束获取 3 删除历史记录 -(void)smartRingSetUnix;//设置Unix时间 -(void)syncMCUNowDate; // 同步时间到设备 -(void)smartRingGetVersion;//获取Bleversion -(void)smartRingGetAutoCheckOpen;//获取日常检测是否关闭 -(void)smartRingSetAutoCheckOpen:(BOOL)open;//APP启动/关闭日常检测 -(void)smartRingStartCheck;//开始体检 -(void)smartRingCloseCheck;//结束体检 -(void)smartRingSetDetectionPeriodWith:(NSInteger)interval;//APP设置/获取日常检测周期 0获取 其他为设置时间 单位(分钟) -(void)smartRingGetJFInfo;//获取Mcu版本信息 -(void)startBleOTAWithPath:(NSString *)path;//开始升级 -(void)startMcuOTAWithPath:(NSString *)path;//开始升级 -(void)smartRingGetRRI;//获取体检模式 -(void)smartRingSetRRIWithType:(NSInteger)type;//设置体检模式 0 全面模式 72条RRI 1 快速模式 30条RRI - (void)disconnectPeripheral; - (void)clearInformation; - (void)clearUserInformation; @end @protocol ELSmartRingManagerDelegate @optional //设备固件bmVersion - (void)smartRingManager:(ELSmartRingManager *)smartRingManager getBmVersion:(NSString *)bmVersion; //蓝牙状态 - (void)smartRingManager:(ELSmartRingManager *)smartRingManager managerDidUpdateState:(CBCentralManager *)central; // 扫描到设备 - (void)smartRingManager:(ELSmartRingManager *)smartRingManager managerDidDiscoverPeripheral:(ELAILinkPeripheral *)peripheral; //:连接状态 - (void)smartRingManager:(ELSmartRingManager *)smartRingManager ConnectState:(NELBleManagerConnectState)bleConnectState; //:APP 获取设备状态,电量和佩戴状况 -(void)smartRingManager:(ELSmartRingManager *)smartRingManager DeviceStatus:(ELSmartRingDeviceStatus)deviceStatus Battery:(struct ELBatteryStruct)battery wearStatue:(NSInteger)wearStatue; //0x00:无功能 0x01:静置状态 x02:非静置状态 ///* 获取RRI */(Type:10) -(void)smartRingManager:(ELSmartRingManager *)smartRingManager RRI:(NSInteger)RRI; //日常检测周期(Type:08)开关 -(void)smartRingManager:(ELSmartRingManager *)smartRingManager AutoCheck:(BOOL)open; //日常检测历史记录(Type:05)//日常检测历史记录(Type:05) 一次有可给能两条数据 isEnd为Yes 表示当次记录返回结束 可以获取下一条数据 isEnd为 NO 代表 当前记录没有返回结束 -(void)smartRingManager:(ELSmartRingManager *)smartRingManager record:(ELSmartRingBleModel *)smartRingBleModel isEnd:(BOOL)isEnd; //设备产生历史记录提示 -(void)smartRingManager:(ELSmartRingManager *)smartRingManager haveRecord:(NSInteger)haveRecord; //MCU 设置体检模式(Type:03) - (void)smartRingManager:(ELSmartRingManager *)smartRingManager SetCheck:(ELSmartRingBleModel *)smartRingBleModel; //日常检测周期(Type:04) - (void)smartRingManager:(ELSmartRingManager *)smartRingManager DetectionPeriod:(NSUInteger)interval; //日常检测历史记录(Type:05) - (void)smartRingReloadRecord; // isEnd 有时候收多组数据 判断是否时最后一组; //version - (void)smartRingGetVersionWith:(NSString *)version; // ; //* 获取JF传感器信息 */(Type:09) -(void)smartRingManager:(ELSmartRingManager *)smartRingManager GetJFInfo:(NSString *)info; //OTA下载成功 //OTA 进度 - (void)smartRingOTAUpdateProgress:(double)progress; //OTA 失败或成功回调 - (void)smartRingOTAUpdateResult:(BOOL)isSuccess errorMsg:(NSString*)errorMsg; // 步数/睡眠数据记录 - (void)smartRingManager:(ELSmartRingManager *)smartRingManager SleepRecordArray:(nonnull NSArray *)smartRingBleModelArray; @end NS_ASSUME_NONNULL_END