Browse Source

修改:更新版本 增加睡眠/步数数据解析 A7回复指令处理

main
yc.chen 2 months ago
parent
commit
21e20edf99

+ 4
- 2
healthRingDemo.xcodeproj/project.pbxproj View File

4022F2E32BA2CD7900891BEF /* RingTestDemoVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 4022F2D12BA2CD7900891BEF /* RingTestDemoVC.m */; }; 4022F2E32BA2CD7900891BEF /* RingTestDemoVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 4022F2D12BA2CD7900891BEF /* RingTestDemoVC.m */; };
4022F2E42BA2CD7900891BEF /* RingTestDemoVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4022F2D22BA2CD7900891BEF /* RingTestDemoVC.xib */; }; 4022F2E42BA2CD7900891BEF /* RingTestDemoVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4022F2D22BA2CD7900891BEF /* RingTestDemoVC.xib */; };
4022F2E52BA2CD7900891BEF /* ELDemoScanVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4022F2D32BA2CD7900891BEF /* ELDemoScanVC.xib */; }; 4022F2E52BA2CD7900891BEF /* ELDemoScanVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4022F2D32BA2CD7900891BEF /* ELDemoScanVC.xib */; };
402947A02BA44E3400822888 /* AICareComponentRingBleSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4029479F2BA44E3400822888 /* AICareComponentRingBleSDK.framework */; };
418693CB2DA79EFF00A4D507 /* AICareComponentRingBleSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4029479F2BA44E3400822888 /* AICareComponentRingBleSDK.framework */; };
418693CC2DA79EFF00A4D507 /* AICareComponentRingBleSDK.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4029479F2BA44E3400822888 /* AICareComponentRingBleSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */


/* Begin PBXContainerItemProxy section */ /* Begin PBXContainerItemProxy section */
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
418693CC2DA79EFF00A4D507 /* AICareComponentRingBleSDK.framework in CopyFiles */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
402947A02BA44E3400822888 /* AICareComponentRingBleSDK.framework in Frameworks */,
418693CB2DA79EFF00A4D507 /* AICareComponentRingBleSDK.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

BIN
healthRingDemo.xcodeproj/project.xcworkspace/xcuserdata/elinkthings.xcuserdatad/UserInterfaceState.xcuserstate View File


+ 14
- 0
healthRingDemo.xcodeproj/xcuserdata/elinkthings.xcuserdatad/xcschemes/xcschememanagement.plist View File

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>healthRingDemo.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>

BIN
healthRingDemo/AICareComponentRingBleSDK.framework/AICareComponentRingBleSDK View File


+ 1
- 1
healthRingDemo/AICareComponentRingBleSDK.framework/Headers/AICareComponentRingBleSDK_Version.h View File

#define AICareComponentRingBleSDK_Version #define AICareComponentRingBleSDK_Version


//版本号 SDK Version //版本号 SDK Version
#define AICareComponentRingBleSDKVersion @"1.0.0" // 20231211
#define AICareComponentRingBleSDKVersion @"1.0.1" // 20250410


#endif /* AILinkBleSDK_Version_h */ #endif /* AILinkBleSDK_Version_h */

+ 10
- 0
healthRingDemo/AICareComponentRingBleSDK.framework/Headers/ELAILinkBleManager+SmartRing.h View File

/* 获取RRI */ /* 获取RRI */
- (NSData *)smartRingGetRRI; - (NSData *)smartRingGetRRI;


/* 设置/获取睡眠步数周期 */
-(NSData *)smartRingSetSleepDetectionPeriodWithInterval:(NSInteger)interval;

/* 获取睡眠步数历史记录 */
-(NSData *)smartRingSleepReocrdWithType:(NSInteger)type;

/* 1. APP 收到任何 A7 指令,都需要返回一组确认指令
2. 返回确认指令后,再返回其他通信指令 */
- (NSData *)receiveA7Reply;

@end @end


NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

+ 8
- 0
healthRingDemo/AICareComponentRingBleSDK.framework/Headers/ELSmartRingBleHeader.h View File

ELSmartRingCMDSetRRI_Type010 = 0x0b,// /* APP 设置定时监测rri 数量 */ ELSmartRingCMDSetRRI_Type010 = 0x0b,// /* APP 设置定时监测rri 数量 */
ELSmartRingCMDHaveRecord_Type011 = 0x0c,// /* 设备产生历史记录提示 */ ELSmartRingCMDHaveRecord_Type011 = 0x0c,// /* 设备产生历史记录提示 */
ELSmartRingCMDSetSleepPeriod_Type12 = 0x10,// / /* 设置/获取睡眠步数周期 */
ELSmartRingCMDGetSleepReocrd_Type13 = 0x11,// 获取睡眠/步数历史记录


ELSmartRingCMDHaveSleepReocrd_Type14 = 0x12,// /* 设备产生睡眠/步数历史记录提示 */
ELSmartRingCMDReceviceA7Reply_Type88 = 0x88,// /* APP 收到任何 A7 指令,都需要返回一组确认指令 */
}; };




ELSmartRingDeviceStatus_success = 0x02, //历史时间已就绪(此状态才可获取设备历史记录) ELSmartRingDeviceStatus_success = 0x02, //历史时间已就绪(此状态才可获取设备历史记录)
}; };

#endif /* ELSmartRingBleHeader_h */ #endif /* ELSmartRingBleHeader_h */

+ 27
- 0
healthRingDemo/AICareComponentRingBleSDK.framework/Headers/ELSmartRingBleParser.h View File

- (void)smartRingBleParser:(ELSmartRingBleParser *)bleParser - (void)smartRingBleParser:(ELSmartRingBleParser *)bleParser
RRI:(NSInteger)RRI; RRI:(NSInteger)RRI;



///* 设备产生数据提示*/(Type:11) ///* 设备产生数据提示*/(Type:11)
- (void)smartRingBleParser:(ELSmartRingBleParser *)bleParser - (void)smartRingBleParser:(ELSmartRingBleParser *)bleParser
haveRecord:(NSInteger)haveRecord; haveRecord:(NSInteger)haveRecord;


///* /* 设置/获取睡眠步数周期 */*/(Type:12)
- (void)smartRingBleParser:(ELSmartRingBleParser *)bleParser
SleepDetectionPeriod:(NSUInteger)interval;

///* 备产生睡眠/步数历史记录提示*/(Type:14)
- (void)smartRingBleParser:(ELSmartRingBleParser *)bleParser
haveSleepRecord:(NSInteger)haveRecord;

// /* 设备产生睡眠/步数历史记录提示 */
- (void)smartRingBleParser:(ELSmartRingBleParser *)bleParser SleepRecordArray:(NSArray *)smartRingBleModelArray;

@end @end


@interface ELSmartRingBleModel : NSObject @interface ELSmartRingBleModel : NSObject


@property (nonatomic, assign) BOOL isDataValid; //数据是否有效 @property (nonatomic, assign) BOOL isDataValid; //数据是否有效


//睡眠状态
@property (nonatomic, assign) UInt8 sleepType;
//步数
@property (nonatomic, assign) long long step;


@end @end





@interface ELSmartRingSleepDataModel: NSObject
//时间戳
@property (nonatomic, assign) long long uploadTime;
//睡眠状态(等级: 深睡,浅睡等由app划分区间,一般0-2:清醒,3-5:浅睡,6-7:深睡)
@property (nonatomic, assign) NSInteger type;
//步数
@property (nonatomic, assign) NSInteger step;

@end

NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

+ 13
- 1
healthRingDemo/AICareComponentRingBleSDK.framework/Headers/ELSmartRingManager.h View File



@property (nonatomic, weak) id<ELSmartRingManagerDelegate> delegate; @property (nonatomic, weak) id<ELSmartRingManagerDelegate> delegate;


//判断是否需要常链接
@property (nonatomic, assign) BOOL needLongConnected;

//监测间隔 //监测间隔
@property (nonatomic, assign) NSInteger interval; @property (nonatomic, assign) NSInteger interval;


-(void)smartRingGetDeviceStatus;//获取设备状态,电量和佩戴状况 -(void)smartRingGetDeviceStatus;//获取设备状态,电量和佩戴状况


-(void)smartRingReocrdWithType:(NSInteger)type;//获取日常检测历史记录 //0 开始获取 1 继续获取 2 结束获取 3 删除历史记录 -(void)smartRingReocrdWithType:(NSInteger)type;//获取日常检测历史记录 //0 开始获取 1 继续获取 2 结束获取 3 删除历史记录
- (void)smartRingSleepReocrdWithType:(NSInteger)type;//获取睡眠步数历史记录 //0 开始获取 1 继续获取 2 结束获取 3 删除历史记录
-(void)smartRingSetUnix;//设置Unix时间 -(void)smartRingSetUnix;//设置Unix时间
-(void)syncMCUNowDate; // 同步时间到设备 -(void)syncMCUNowDate; // 同步时间到设备




- (void)disconnectPeripheral; - (void)disconnectPeripheral;


- (void)clearInformation;
- (void)clearUserInformation;


@end @end


@protocol ELSmartRingManagerDelegate <NSObject> @protocol ELSmartRingManagerDelegate <NSObject>
//设备固件bmVersion //设备固件bmVersion
- (void)smartRingManager:(ELSmartRingManager *)smartRingManager getBmVersion:(NSString *)bmVersion; - (void)smartRingManager:(ELSmartRingManager *)smartRingManager getBmVersion:(NSString *)bmVersion;




//蓝牙状态 //蓝牙状态
- (void)smartRingManager:(ELSmartRingManager *)smartRingManager managerDidUpdateState:(CBCentralManager *)central; - (void)smartRingManager:(ELSmartRingManager *)smartRingManager managerDidUpdateState:(CBCentralManager *)central;


//OTA 失败或成功回调 //OTA 失败或成功回调
- (void)smartRingOTAUpdateResult:(BOOL)isSuccess errorMsg:(NSString*)errorMsg; - (void)smartRingOTAUpdateResult:(BOOL)isSuccess errorMsg:(NSString*)errorMsg;


// 步数/睡眠数据记录
- (void)smartRingManager:(ELSmartRingManager *)smartRingManager SleepRecordArray:(nonnull NSArray *)smartRingBleModelArray;

@end @end





BIN
healthRingDemo/AICareComponentRingBleSDK.framework/Info.plist View File


+ 17
- 0
healthRingDemo/RingTestDemoVC/RingTestDemoVC.m View File

- (IBAction)shareLogAction:(id)sender { - (IBAction)shareLogAction:(id)sender {
} }

- (IBAction)sleepStepDataAction:(UIButton *)sender {
[[ELSmartRingManager sharedManager] smartRingSleepReocrdWithType:0];
}

#pragma mark - BleManagerDelegate #pragma mark - BleManagerDelegate


- (void)initBle { - (void)initBle {


} }


//步数,睡眠数据
- (void)smartRingBleParser:(ELSmartRingBleParser *)bleParser SleepRecordArray:(nonnull NSArray *)smartRingBleModelArray {
for (ELSmartRingBleModel * smartRingBleModel in smartRingBleModelArray) {
ELSmartRingSleepDataModel *model = [[ELSmartRingSleepDataModel alloc]init];
model.type = smartRingBleModel.sleepType;
model.step = smartRingBleModel.step;
model.uploadTime = smartRingBleModel.recordTime/1000;
NSLog(@"%s smartRingBleModelArray :%@", __func__, model);
}
}


#pragma mark - addLog #pragma mark - addLog


- (void)addLog:(NSString *)log { - (void)addLog:(NSString *)log {

+ 18
- 8
healthRingDemo/RingTestDemoVC/RingTestDemoVC.xib View File

<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/> <device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/> <capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="K5I-eH-HGA"> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="K5I-eH-HGA">
<rect key="frame" x="16" y="540" width="31" height="30"/>
<rect key="frame" x="16" y="540" width="30" height="30"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="清空"/> <state key="normal" title="清空"/>
<connections> <connections>
</connections> </connections>
</button> </button>
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="lwE-Xr-Dac"> <button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="lwE-Xr-Dac">
<rect key="frame" x="346" y="540" width="31" height="30"/>
<rect key="frame" x="347" y="540" width="30" height="30"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="分享"/> <state key="normal" title="分享"/>
<connections> <connections>
<state key="normal" title="Button"/> <state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="filled" title="McuVersion"/> <buttonConfiguration key="configuration" style="filled" title="McuVersion"/>
<connections> <connections>
<action selector="getMcuVersionAction:" destination="-1" eventType="touchUpInside" id="oVb-mw-Y4Z"/>
<action selector="getMcuVersionAction:" destination="-1" eventType="touchUpInside" id="TyZ-tx-zBR"/>
</connections> </connections>
</button> </button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="mDO-P1-1UC"> <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="mDO-P1-1UC">
<action selector="setRRI30Action:" destination="-1" eventType="touchUpInside" id="1CD-aw-Ckq"/> <action selector="setRRI30Action:" destination="-1" eventType="touchUpInside" id="1CD-aw-Ckq"/>
</connections> </connections>
</button> </button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fw7-Bx-zco">
<rect key="frame" x="149" y="267" width="135" height="35"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="filled" title="步数/睡眠数据"/>
<connections>
<action selector="sleepStepDataAction:" destination="-1" eventType="touchUpInside" id="wTa-ho-ptM"/>
</connections>
</button>
</subviews> </subviews>
<color key="backgroundColor" systemColor="systemGroupedBackgroundColor"/> <color key="backgroundColor" systemColor="systemGroupedBackgroundColor"/>
</view> </view>
</objects> </objects>
<resources> <resources>
<systemColor name="labelColor"> <systemColor name="labelColor">
<color red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor> </systemColor>
<systemColor name="opaqueSeparatorColor"> <systemColor name="opaqueSeparatorColor">
<color red="0.77647058823529413" green="0.77647058823529413" blue="0.78431372549019607" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.77647058820000003" green="0.77647058820000003" blue="0.7843137255" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor> </systemColor>
<systemColor name="systemBackgroundColor"> <systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor> </systemColor>
<systemColor name="systemGroupedBackgroundColor"> <systemColor name="systemGroupedBackgroundColor">
<color red="0.94901960784313721" green="0.94901960784313721" blue="0.96862745098039216" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.94901960780000005" green="0.94901960780000005" blue="0.96862745100000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor> </systemColor>
</resources> </resources>
</document> </document>

Loading…
Cancel
Save