Przeglądaj źródła

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

main
yc.chen 2 miesięcy temu
rodzic
commit
21e20edf99

+ 4
- 2
healthRingDemo.xcodeproj/project.pbxproj Wyświetl plik

@@ -34,7 +34,8 @@
4022F2E32BA2CD7900891BEF /* RingTestDemoVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 4022F2D12BA2CD7900891BEF /* RingTestDemoVC.m */; };
4022F2E42BA2CD7900891BEF /* RingTestDemoVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4022F2D22BA2CD7900891BEF /* RingTestDemoVC.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 */

/* Begin PBXContainerItemProxy section */
@@ -61,6 +62,7 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
418693CC2DA79EFF00A4D507 /* AICareComponentRingBleSDK.framework in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -116,7 +118,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
402947A02BA44E3400822888 /* AICareComponentRingBleSDK.framework in Frameworks */,
418693CB2DA79EFF00A4D507 /* AICareComponentRingBleSDK.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};

BIN
healthRingDemo.xcodeproj/project.xcworkspace/xcuserdata/elinkthings.xcuserdatad/UserInterfaceState.xcuserstate Wyświetl plik


+ 14
- 0
healthRingDemo.xcodeproj/xcuserdata/elinkthings.xcuserdatad/xcschemes/xcschememanagement.plist Wyświetl plik

@@ -0,0 +1,14 @@
<?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 Wyświetl plik


+ 1
- 1
healthRingDemo/AICareComponentRingBleSDK.framework/Headers/AICareComponentRingBleSDK_Version.h Wyświetl plik

@@ -8,6 +8,6 @@
#define AICareComponentRingBleSDK_Version

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

#endif /* AILinkBleSDK_Version_h */

+ 10
- 0
healthRingDemo/AICareComponentRingBleSDK.framework/Headers/ELAILinkBleManager+SmartRing.h Wyświetl plik

@@ -36,6 +36,16 @@ NS_ASSUME_NONNULL_BEGIN
/* 获取RRI */
- (NSData *)smartRingGetRRI;

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

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

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

@end

NS_ASSUME_NONNULL_END

+ 8
- 0
healthRingDemo/AICareComponentRingBleSDK.framework/Headers/ELSmartRingBleHeader.h Wyświetl plik

@@ -33,7 +33,14 @@ typedef NS_ENUM(UInt8, ELSmartRingCMD) {
ELSmartRingCMDSetRRI_Type010 = 0x0b,// /* APP 设置定时监测rri 数量 */
ELSmartRingCMDHaveRecord_Type011 = 0x0c,// /* 设备产生历史记录提示 */
ELSmartRingCMDSetSleepPeriod_Type12 = 0x10,// / /* 设置/获取睡眠步数周期 */
ELSmartRingCMDGetSleepReocrd_Type13 = 0x11,// 获取睡眠/步数历史记录

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


@@ -60,4 +67,5 @@ typedef NS_ENUM(UInt8, ELSmartRingDeviceStatus) {
ELSmartRingDeviceStatus_success = 0x02, //历史时间已就绪(此状态才可获取设备历史记录)
};

#endif /* ELSmartRingBleHeader_h */

+ 27
- 0
healthRingDemo/AICareComponentRingBleSDK.framework/Headers/ELSmartRingBleParser.h Wyświetl plik

@@ -58,10 +58,22 @@ NS_ASSUME_NONNULL_BEGIN
- (void)smartRingBleParser:(ELSmartRingBleParser *)bleParser
RRI:(NSInteger)RRI;


///* 设备产生数据提示*/(Type:11)
- (void)smartRingBleParser:(ELSmartRingBleParser *)bleParser
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

@interface ELSmartRingBleModel : NSObject
@@ -117,8 +129,23 @@ NS_ASSUME_NONNULL_BEGIN

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

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

@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

+ 13
- 1
healthRingDemo/AICareComponentRingBleSDK.framework/Headers/ELSmartRingManager.h Wyświetl plik

@@ -27,6 +27,9 @@ NS_ASSUME_NONNULL_BEGIN

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

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

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

@@ -55,7 +58,7 @@ NS_ASSUME_NONNULL_BEGIN
-(void)smartRingGetDeviceStatus;//获取设备状态,电量和佩戴状况

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

@@ -80,6 +83,10 @@ NS_ASSUME_NONNULL_BEGIN

- (void)disconnectPeripheral;

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


@end

@protocol ELSmartRingManagerDelegate <NSObject>
@@ -90,6 +97,8 @@ NS_ASSUME_NONNULL_BEGIN
//设备固件bmVersion
- (void)smartRingManager:(ELSmartRingManager *)smartRingManager getBmVersion:(NSString *)bmVersion;



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

@@ -140,6 +149,9 @@ NS_ASSUME_NONNULL_BEGIN
//OTA 失败或成功回调
- (void)smartRingOTAUpdateResult:(BOOL)isSuccess errorMsg:(NSString*)errorMsg;

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

@end



BIN
healthRingDemo/AICareComponentRingBleSDK.framework/Info.plist Wyświetl plik


+ 17
- 0
healthRingDemo/RingTestDemoVC/RingTestDemoVC.m Wyświetl plik

@@ -162,6 +162,11 @@
- (IBAction)shareLogAction:(id)sender {
}

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

#pragma mark - BleManagerDelegate

- (void)initBle {
@@ -348,6 +353,18 @@

}

//步数,睡眠数据
- (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

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

+ 18
- 8
healthRingDemo/RingTestDemoVC/RingTestDemoVC.xib Wyświetl plik

@@ -1,9 +1,9 @@
<?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"/>
<dependencies>
<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="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -27,7 +27,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<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"/>
<state key="normal" title="清空"/>
<connections>
@@ -35,7 +35,7 @@
</connections>
</button>
<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"/>
<state key="normal" title="分享"/>
<connections>
@@ -244,7 +244,7 @@
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="filled" title="McuVersion"/>
<connections>
<action selector="getMcuVersionAction:" destination="-1" eventType="touchUpInside" id="oVb-mw-Y4Z"/>
<action selector="getMcuVersionAction:" destination="-1" eventType="touchUpInside" id="TyZ-tx-zBR"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="mDO-P1-1UC">
@@ -277,6 +277,16 @@
<action selector="setRRI30Action:" destination="-1" eventType="touchUpInside" id="1CD-aw-Ckq"/>
</connections>
</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>
<color key="backgroundColor" systemColor="systemGroupedBackgroundColor"/>
</view>
@@ -307,16 +317,16 @@
</objects>
<resources>
<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 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 name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
<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>
</resources>
</document>

Ładowanie…
Anuluj
Zapisz