objects = { | objects = { | ||||
/* Begin PBXBuildFile section */ | /* Begin PBXBuildFile section */ | ||||
954BEA8626086DC2003EE149 /* ELEightScaleAlgorithmTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 954BEA8426086DC2003EE149 /* ELEightScaleAlgorithmTool.m */; }; | |||||
954BEA8B26086E1E003EE149 /* ELEightScaleRecordModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 954BEA8A26086E1E003EE149 /* ELEightScaleRecordModel.m */; }; | |||||
954BEA9126086E4F003EE149 /* libHTBodyfat_SDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 954BEA9026086E4F003EE149 /* libHTBodyfat_SDK.a */; }; | |||||
E622E260243F1CA5003C319D /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E622E25F243F1CA5003C319D /* AppDelegate.m */; }; | E622E260243F1CA5003C319D /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E622E25F243F1CA5003C319D /* AppDelegate.m */; }; | ||||
E622E263243F1CA5003C319D /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E622E262243F1CA5003C319D /* SceneDelegate.m */; }; | E622E263243F1CA5003C319D /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E622E262243F1CA5003C319D /* SceneDelegate.m */; }; | ||||
E622E26B243F1CA6003C319D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E622E26A243F1CA6003C319D /* Assets.xcassets */; }; | E622E26B243F1CA6003C319D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E622E26A243F1CA6003C319D /* Assets.xcassets */; }; | ||||
/* End PBXContainerItemProxy section */ | /* End PBXContainerItemProxy section */ | ||||
/* Begin PBXFileReference section */ | /* Begin PBXFileReference section */ | ||||
954BEA8426086DC2003EE149 /* ELEightScaleAlgorithmTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ELEightScaleAlgorithmTool.m; sourceTree = "<group>"; }; | |||||
954BEA8526086DC2003EE149 /* ELEightScaleAlgorithmTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ELEightScaleAlgorithmTool.h; sourceTree = "<group>"; }; | |||||
954BEA8926086E1E003EE149 /* ELEightScaleRecordModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ELEightScaleRecordModel.h; sourceTree = "<group>"; }; | |||||
954BEA8A26086E1E003EE149 /* ELEightScaleRecordModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ELEightScaleRecordModel.m; sourceTree = "<group>"; }; | |||||
954BEA8F26086E4F003EE149 /* HTBodyfat_SDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTBodyfat_SDK.h; sourceTree = "<group>"; }; | |||||
954BEA9026086E4F003EE149 /* libHTBodyfat_SDK.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libHTBodyfat_SDK.a; sourceTree = "<group>"; }; | |||||
E622E25B243F1CA5003C319D /* AILinkBleSDKDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AILinkBleSDKDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; | E622E25B243F1CA5003C319D /* AILinkBleSDKDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AILinkBleSDKDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; | ||||
E622E25E243F1CA5003C319D /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; | E622E25E243F1CA5003C319D /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; | ||||
E622E25F243F1CA5003C319D /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; | E622E25F243F1CA5003C319D /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; | ||||
isa = PBXFrameworksBuildPhase; | isa = PBXFrameworksBuildPhase; | ||||
buildActionMask = 2147483647; | buildActionMask = 2147483647; | ||||
files = ( | files = ( | ||||
954BEA9126086E4F003EE149 /* libHTBodyfat_SDK.a in Frameworks */, | |||||
E633F4DD255BBA8700EE5A95 /* AILinkBleSDK.framework in Frameworks */, | E633F4DD255BBA8700EE5A95 /* AILinkBleSDK.framework in Frameworks */, | ||||
); | ); | ||||
runOnlyForDeploymentPostprocessing = 0; | runOnlyForDeploymentPostprocessing = 0; | ||||
/* End PBXFrameworksBuildPhase section */ | /* End PBXFrameworksBuildPhase section */ | ||||
/* Begin PBXGroup section */ | /* Begin PBXGroup section */ | ||||
954BEA8E26086E4F003EE149 /* HTBodyfat_SDK */ = { | |||||
isa = PBXGroup; | |||||
children = ( | |||||
954BEA8F26086E4F003EE149 /* HTBodyfat_SDK.h */, | |||||
954BEA9026086E4F003EE149 /* libHTBodyfat_SDK.a */, | |||||
); | |||||
path = HTBodyfat_SDK; | |||||
sourceTree = "<group>"; | |||||
}; | |||||
E622E252243F1CA5003C319D = { | E622E252243F1CA5003C319D = { | ||||
isa = PBXGroup; | isa = PBXGroup; | ||||
children = ( | children = ( | ||||
E680BF202510576D005AD827 /* 八电极体脂秤 */ = { | E680BF202510576D005AD827 /* 八电极体脂秤 */ = { | ||||
isa = PBXGroup; | isa = PBXGroup; | ||||
children = ( | children = ( | ||||
E680BF212510576D005AD827 /* EightScaleScanViewController.m */, | |||||
954BEA8E26086E4F003EE149 /* HTBodyfat_SDK */, | |||||
E680BF242510576D005AD827 /* EightScaleConnectionViewController.h */, | |||||
E680BF222510576D005AD827 /* EightScaleConnectionViewController.m */, | E680BF222510576D005AD827 /* EightScaleConnectionViewController.m */, | ||||
E680BF232510576D005AD827 /* EightScaleScanViewController.h */, | E680BF232510576D005AD827 /* EightScaleScanViewController.h */, | ||||
E680BF242510576D005AD827 /* EightScaleConnectionViewController.h */, | |||||
E680BF212510576D005AD827 /* EightScaleScanViewController.m */, | |||||
954BEA8926086E1E003EE149 /* ELEightScaleRecordModel.h */, | |||||
954BEA8A26086E1E003EE149 /* ELEightScaleRecordModel.m */, | |||||
954BEA8526086DC2003EE149 /* ELEightScaleAlgorithmTool.h */, | |||||
954BEA8426086DC2003EE149 /* ELEightScaleAlgorithmTool.m */, | |||||
); | ); | ||||
path = "八电极体脂秤"; | path = "八电极体脂秤"; | ||||
sourceTree = "<group>"; | sourceTree = "<group>"; | ||||
E6FEA2112522E3D0001343A0 /* 蓝牙WiFi牙刷 */ = { | E6FEA2112522E3D0001343A0 /* 蓝牙WiFi牙刷 */ = { | ||||
isa = PBXGroup; | isa = PBXGroup; | ||||
children = ( | children = ( | ||||
E6FEA2122522E3D0001343A0 /* UIButton+WZAdd.h */, | |||||
E6FEA2132522E3D0001343A0 /* ELInputAlertView.m */, | |||||
E6FEA2142522E3D0001343A0 /* ToothbrushScanViewController.m */, | |||||
E6FEA2152522E3D0001343A0 /* UILabel+WZAdd.m */, | |||||
E6FEA2162522E3D0001343A0 /* ToothbrushConnectionViewController.h */, | |||||
E6FEA2172522E3D0001343A0 /* UIView+Category.m */, | |||||
E6FEA2182522E3D0001343A0 /* ELSelectView.h */, | |||||
E6FEA2192522E3D0001343A0 /* CABasicAnimation+ELAnimation.h */, | E6FEA2192522E3D0001343A0 /* CABasicAnimation+ELAnimation.h */, | ||||
E6FEA21A2522E3D0001343A0 /* UIButton+WZAdd.m */, | |||||
E6FEA21B2522E3D0001343A0 /* UILabel+WZAdd.h */, | |||||
E6FEA21C2522E3D0001343A0 /* ToothbrushScanViewController.h */, | |||||
E6FEA21D2522E3D0001343A0 /* ELInputAlertView.h */, | E6FEA21D2522E3D0001343A0 /* ELInputAlertView.h */, | ||||
E6FEA2182522E3D0001343A0 /* ELSelectView.h */, | |||||
E6FEA2162522E3D0001343A0 /* ToothbrushConnectionViewController.h */, | |||||
E6FEA21C2522E3D0001343A0 /* ToothbrushScanViewController.h */, | |||||
E6FEA2122522E3D0001343A0 /* UIButton+WZAdd.h */, | |||||
E6FEA21B2522E3D0001343A0 /* UILabel+WZAdd.h */, | |||||
E6FEA21E2522E3D0001343A0 /* UIView+Category.h */, | E6FEA21E2522E3D0001343A0 /* UIView+Category.h */, | ||||
E6FEA21F2522E3D0001343A0 /* ToothbrushConnectionViewController.m */, | |||||
E6FEA2202522E3D0001343A0 /* CABasicAnimation+ELAnimation.m */, | E6FEA2202522E3D0001343A0 /* CABasicAnimation+ELAnimation.m */, | ||||
E6FEA2132522E3D0001343A0 /* ELInputAlertView.m */, | |||||
E6FEA2212522E3D0001343A0 /* ELSelectView.m */, | E6FEA2212522E3D0001343A0 /* ELSelectView.m */, | ||||
E6FEA21F2522E3D0001343A0 /* ToothbrushConnectionViewController.m */, | |||||
E6FEA2142522E3D0001343A0 /* ToothbrushScanViewController.m */, | |||||
E6FEA21A2522E3D0001343A0 /* UIButton+WZAdd.m */, | |||||
E6FEA2152522E3D0001343A0 /* UILabel+WZAdd.m */, | |||||
E6FEA2172522E3D0001343A0 /* UIView+Category.m */, | |||||
); | ); | ||||
path = "蓝牙WiFi牙刷"; | path = "蓝牙WiFi牙刷"; | ||||
sourceTree = "<group>"; | sourceTree = "<group>"; | ||||
E6FEA2252522E3D0001343A0 /* UIView+Category.m in Sources */, | E6FEA2252522E3D0001343A0 /* UIView+Category.m in Sources */, | ||||
E622E2ED243F1D4A003C319D /* MASViewAttribute.m in Sources */, | E622E2ED243F1D4A003C319D /* MASViewAttribute.m in Sources */, | ||||
E622E2E1243F1D4A003C319D /* InheritConnectViewController.m in Sources */, | E622E2E1243F1D4A003C319D /* InheritConnectViewController.m in Sources */, | ||||
954BEA8626086DC2003EE149 /* ELEightScaleAlgorithmTool.m in Sources */, | |||||
E622E2F4243F1D4A003C319D /* ForeheadConnectViewController.m in Sources */, | E622E2F4243F1D4A003C319D /* ForeheadConnectViewController.m in Sources */, | ||||
E6FEA2272522E3D0001343A0 /* ToothbrushConnectionViewController.m in Sources */, | E6FEA2272522E3D0001343A0 /* ToothbrushConnectionViewController.m in Sources */, | ||||
E622E2EC243F1D4A003C319D /* MASViewConstraint.m in Sources */, | E622E2EC243F1D4A003C319D /* MASViewConstraint.m in Sources */, | ||||
E622E260243F1CA5003C319D /* AppDelegate.m in Sources */, | E622E260243F1CA5003C319D /* AppDelegate.m in Sources */, | ||||
E622E2E5243F1D4A003C319D /* ViewController+MASAdditions.m in Sources */, | E622E2E5243F1D4A003C319D /* ViewController+MASAdditions.m in Sources */, | ||||
E622E2F0243F1D4A003C319D /* BloodScanViewController.m in Sources */, | E622E2F0243F1D4A003C319D /* BloodScanViewController.m in Sources */, | ||||
954BEA8B26086E1E003EE149 /* ELEightScaleRecordModel.m in Sources */, | |||||
E622E2E2243F1D4A003C319D /* InheritScanViewController.m in Sources */, | E622E2E2243F1D4A003C319D /* InheritScanViewController.m in Sources */, | ||||
E622E271243F1CA6003C319D /* main.m in Sources */, | E622E271243F1CA6003C319D /* main.m in Sources */, | ||||
E622E263243F1CA5003C319D /* SceneDelegate.m in Sources */, | E622E263243F1CA5003C319D /* SceneDelegate.m in Sources */, | ||||
"$(inherited)", | "$(inherited)", | ||||
"$(PROJECT_DIR)/AILinkBleSDKDemo", | "$(PROJECT_DIR)/AILinkBleSDKDemo", | ||||
); | ); | ||||
HEADER_SEARCH_PATHS = ""; | |||||
INFOPLIST_FILE = AILinkBleSDKDemo/Info.plist; | INFOPLIST_FILE = AILinkBleSDKDemo/Info.plist; | ||||
LD_RUNPATH_SEARCH_PATHS = ( | LD_RUNPATH_SEARCH_PATHS = ( | ||||
"$(inherited)", | "$(inherited)", | ||||
"@executable_path/Frameworks", | "@executable_path/Frameworks", | ||||
); | ); | ||||
LIBRARY_SEARCH_PATHS = ( | |||||
"$(inherited)", | |||||
"$(PROJECT_DIR)/AILinkBleSDKDemo/八电极体脂秤/HTBodyfat_SDK", | |||||
); | |||||
MARKETING_VERSION = 1.1.1; | MARKETING_VERSION = 1.1.1; | ||||
PRODUCT_BUNDLE_IDENTIFIER = com.pingwang.AILinkBleSDKDemo; | PRODUCT_BUNDLE_IDENTIFIER = com.pingwang.AILinkBleSDKDemo; | ||||
PRODUCT_NAME = "$(TARGET_NAME)"; | PRODUCT_NAME = "$(TARGET_NAME)"; | ||||
"$(inherited)", | "$(inherited)", | ||||
"$(PROJECT_DIR)/AILinkBleSDKDemo", | "$(PROJECT_DIR)/AILinkBleSDKDemo", | ||||
); | ); | ||||
HEADER_SEARCH_PATHS = ""; | |||||
INFOPLIST_FILE = AILinkBleSDKDemo/Info.plist; | INFOPLIST_FILE = AILinkBleSDKDemo/Info.plist; | ||||
LD_RUNPATH_SEARCH_PATHS = ( | LD_RUNPATH_SEARCH_PATHS = ( | ||||
"$(inherited)", | "$(inherited)", | ||||
"@executable_path/Frameworks", | "@executable_path/Frameworks", | ||||
); | ); | ||||
LIBRARY_SEARCH_PATHS = ( | |||||
"$(inherited)", | |||||
"$(PROJECT_DIR)/AILinkBleSDKDemo/八电极体脂秤/HTBodyfat_SDK", | |||||
); | |||||
MARKETING_VERSION = 1.1.1; | MARKETING_VERSION = 1.1.1; | ||||
PRODUCT_BUNDLE_IDENTIFIER = com.pingwang.AILinkBleSDKDemo; | PRODUCT_BUNDLE_IDENTIFIER = com.pingwang.AILinkBleSDKDemo; | ||||
PRODUCT_NAME = "$(TARGET_NAME)"; | PRODUCT_NAME = "$(TARGET_NAME)"; |
// | |||||
// ELEightScaleAlgorithmTool.h | |||||
// Elink | |||||
// | |||||
// Created by iot_user on 2020/6/18. | |||||
// Copyright © 2020 iot_iMac. All rights reserved. | |||||
// | |||||
#import <Foundation/Foundation.h> | |||||
@class ELEightScaleRecordModel; | |||||
@class ELEightScaleBleDataModel; | |||||
NS_ASSUME_NONNULL_BEGIN | |||||
@interface ELEightScaleAlgorithmTool : NSObject | |||||
/// 根据秤测量的阻抗数据调用算法解析出其他体脂数据 | |||||
/// @param dataModel 八电极秤测量的数据 | |||||
/// @param sex 女性传0,男性传1 | |||||
/// @param height 身高,单位cm | |||||
/// @param age 年龄 | |||||
+(ELEightScaleRecordModel *)getRecordModelWithBleDataModel:(ELEightScaleBleDataModel *)dataModel withUserSex:(NSInteger)sex height:(NSInteger)height age:(NSInteger)age; | |||||
@end | |||||
NS_ASSUME_NONNULL_END |
// | |||||
// ELEightScaleAlgorithmTool.m | |||||
// Elink | |||||
// | |||||
// Created by iot_user on 2020/6/18. | |||||
// Copyright © 2020 iot_iMac. All rights reserved. | |||||
// | |||||
#import "ELEightScaleAlgorithmTool.h" | |||||
#import "ELEightScaleRecordModel.h" | |||||
#import <AILinkBleSDK/ELEightScaleBleDataModel.h> | |||||
#import <AILinkBleSDK/ELEightScaleSDKHeader.h> | |||||
#import "HTBodyfat_SDK.h" | |||||
#import <AILinkBleSDK/ELHeightAlgorithmusModel.h> | |||||
#import <AILinkBleSDK/ELWeightAlgorithmusModel.h> | |||||
#import <AILinkBleSDK/ELBodyIndexAlgorithmModel.h> | |||||
@implementation ELEightScaleAlgorithmTool | |||||
/// 根据秤测量的阻抗数据调用算法解析出其他体脂数据 | |||||
/// @param dataModel 八电极秤测量的数据 | |||||
/// @param sex 女性传0,男性传1 | |||||
/// @param height 身高,单位cm | |||||
/// @param age 年龄 | |||||
+(ELEightScaleRecordModel *)getRecordModelWithBleDataModel:(ELEightScaleBleDataModel *)dataModel withUserSex:(NSInteger)sex height:(NSInteger)height age:(NSInteger)age { | |||||
CGFloat kgWeight = [ELWeightAlgorithmusModel getKgWithWeightShowStr:dataModel.weight weightUnit:dataModel.weightUnit weightPoint:dataModel.weightPoint].floatValue; | |||||
HTBodyBasicInfo *bodyBasicInfo = [[HTBodyBasicInfo alloc] initWithSex:sex height:height weight:kgWeight age:age]; | |||||
bodyBasicInfo.htZAllBodyImpedance = dataModel.RWholeBodyAdc; | |||||
bodyBasicInfo.htZLeftLegImpedance = dataModel.leftFootAdc; | |||||
bodyBasicInfo.htZRightLegImpedance = dataModel.rightFootAdc; | |||||
bodyBasicInfo.htZLeftArmImpedance = dataModel.leftHandAdc; | |||||
bodyBasicInfo.htZRightArmImpedance = dataModel.rightHandAdc; | |||||
bodyBasicInfo.htTwoArmsImpedance = dataModel.handsAdc; | |||||
bodyBasicInfo.htTwoLegsImpedance = dataModel.feetAdc; | |||||
//计算体脂参数 | |||||
HTBodyResultAllBody *bodyResultTwoLegs = [[HTBodyResultAllBody alloc] init]; | |||||
HTBodyfatErrorType errorType = [bodyResultTwoLegs getBodyfatWithBasicInfo:bodyBasicInfo]; | |||||
NSLog(@"HTBodyfatErrorType = %lu",errorType); | |||||
if(errorType != HTBodyfatErrorTypeNone){ | |||||
NSMutableString *errorStr = [[NSMutableString alloc]initWithString:@""]; | |||||
if((errorType & HTBodyfatErrorTypeAge) == HTBodyfatErrorTypeAge){ | |||||
[errorStr appendString:@"年龄 "]; | |||||
} | |||||
if((errorType & HTBodyfatErrorTypeWeight) == HTBodyfatErrorTypeWeight){ | |||||
[errorStr appendString:@"体重 "]; | |||||
} | |||||
if((errorType & HTBodyfatErrorTypeHeight) == HTBodyfatErrorTypeHeight){ | |||||
[errorStr appendString:@"身高 "]; | |||||
} | |||||
if((errorType & HTBodyfatErrorTypeSex) == HTBodyfatErrorTypeSex){ | |||||
[errorStr appendString:@"性别 "]; | |||||
} | |||||
if((errorType & HTBodyfatErrorTypeImpedance) == HTBodyfatErrorTypeImpedance){ | |||||
[errorStr appendString:@"阻抗 "]; | |||||
} | |||||
if((errorType & HTBodyfatErrorTypeImpedanceLeftLeg) == HTBodyfatErrorTypeImpedanceLeftLeg){ | |||||
[errorStr appendString:@"左脚阻抗 "]; | |||||
} | |||||
if((errorType & HTBodyfatErrorTypeImpedanceRightLeg) == HTBodyfatErrorTypeImpedanceRightLeg){ | |||||
[errorStr appendString:@"右脚阻抗 "]; | |||||
} | |||||
if((errorType & HTBodyfatErrorTypeImpedanceLeftArm) == HTBodyfatErrorTypeImpedanceLeftArm){ | |||||
[errorStr appendString:@"左手阻抗 "]; | |||||
} | |||||
if((errorType & HTBodyfatErrorTypeImpedanceRightArm) == HTBodyfatErrorTypeImpedanceRightArm){ | |||||
[errorStr appendString:@"右手阻抗 "]; | |||||
} | |||||
[errorStr appendString:@"参数有误!"]; | |||||
NSLog(@"errorType = %@",errorStr); | |||||
} | |||||
ELEightScaleRecordModel *recordModel = [[ELEightScaleRecordModel alloc] init]; | |||||
recordModel.bmi = [NSString stringWithFormat:@"%.1f",bodyResultTwoLegs.htBMI]; | |||||
recordModel.bfr = [NSString stringWithFormat:@"%.1f",bodyResultTwoLegs.htBodyfatPercentage]; | |||||
recordModel.sfr = [NSString stringWithFormat:@"%.1f",bodyResultTwoLegs.htBodyfatSubcut]; | |||||
recordModel.uvi = [NSString stringWithFormat:@"%ld",bodyResultTwoLegs.htVFAL]; | |||||
recordModel.rom = [NSString stringWithFormat:@"%.1f",bodyResultTwoLegs.htMusclePercentage]; | |||||
recordModel.bmr = [NSString stringWithFormat:@"%ld",bodyResultTwoLegs.htBMR]; | |||||
recordModel.vwc = [NSString stringWithFormat:@"%.1f",bodyResultTwoLegs.htWaterPercentage]; | |||||
recordModel.bodyAge = [NSString stringWithFormat:@"%ld",bodyResultTwoLegs.htBodyAge]; | |||||
recordModel.pp = [NSString stringWithFormat:@"%.1f",bodyResultTwoLegs.htProteinPercentage]; | |||||
recordModel.adc = [NSString stringWithFormat:@"%d",dataModel.trunkAdc];//记录躯干adc | |||||
recordModel.heartRate = dataModel.heartRate>0?[NSString stringWithFormat:@"%d",dataModel.heartRate]:@""; | |||||
recordModel.createTime = dataModel.createTime; | |||||
recordModel.deviceAlgorithm = [NSString stringWithFormat:@"%d",dataModel.algorithmID]; | |||||
//骨量 | |||||
if (bodyResultTwoLegs.htBoneKg>0) { | |||||
NSUInteger boneMass = roundf(bodyResultTwoLegs.htBoneKg*pow(10, dataModel.weightPoint)); | |||||
recordModel.bm = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:boneMass bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint]; | |||||
}else{ | |||||
recordModel.bm = @""; | |||||
} | |||||
//标准体重 | |||||
if (bodyResultTwoLegs.htIdealWeightKg >0) { | |||||
//说明有值 | |||||
NSUInteger standard = roundf(bodyResultTwoLegs.htIdealWeightKg*pow(10, dataModel.weightPoint)); | |||||
recordModel.standardWeight = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:standard bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint]; | |||||
//体重控制量 | |||||
CGFloat weightControl = kgWeight - bodyResultTwoLegs.htIdealWeightKg; | |||||
NSUInteger weightContrlABS = roundf(fabs(weightControl*pow(10, dataModel.weightPoint))); | |||||
NSString *weightContrlStr = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:weightContrlABS bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint]; | |||||
if (weightControl<0) { | |||||
recordModel.weightControl = [NSString stringWithFormat:@"-%@",weightContrlStr]; | |||||
}else{ | |||||
recordModel.weightControl = weightContrlStr; | |||||
} | |||||
recordModel.fatLevel = [NSString stringWithFormat:@"%lu",(unsigned long)[ELBodyIndexAlgorithmModel getfatLevelWithweight:kgWeight andSatndardWeight:bodyResultTwoLegs.htIdealWeightKg]]; | |||||
}else{ | |||||
recordModel.standardWeight = @""; | |||||
recordModel.weightControl = @""; | |||||
recordModel.fatLevel = @""; | |||||
} | |||||
//脂肪量 | |||||
if (bodyResultTwoLegs.htBodyfatKg>0) { | |||||
NSUInteger fatMass = roundf(bodyResultTwoLegs.htBodyfatKg*pow(10, dataModel.weightPoint)); | |||||
recordModel.fatMass = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:fatMass bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint]; | |||||
}else{ | |||||
recordModel.fatMass = @""; | |||||
} | |||||
//去脂体重 | |||||
if (bodyResultTwoLegs.htBodyfatFreeMass>0) { | |||||
NSUInteger withoutFatW = roundf(bodyResultTwoLegs.htBodyfatFreeMass*pow(10, dataModel.weightPoint)); | |||||
recordModel.weightWithoutFat = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:withoutFatW bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint]; | |||||
}else{ | |||||
recordModel.weightWithoutFat = @""; | |||||
} | |||||
//肌肉量 | |||||
if (bodyResultTwoLegs.htMuscleKg>0) { | |||||
NSInteger musleMass = round(bodyResultTwoLegs.htMuscleKg*pow(10, dataModel.weightPoint)); | |||||
recordModel.musleMass = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:musleMass bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint]; | |||||
}else{ | |||||
recordModel.musleMass = @""; | |||||
} | |||||
//蛋白量 | |||||
if (bodyResultTwoLegs.htProteinPercentage>0) { | |||||
NSUInteger proteinMassInt = roundf((bodyResultTwoLegs.htProteinPercentage/100.0)*kgWeight* pow(10, dataModel.weightPoint)); | |||||
recordModel.proteinMass = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:proteinMassInt bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint]; | |||||
}else{ | |||||
recordModel.proteinMass = @""; | |||||
} | |||||
//体脂-右手 | |||||
if (bodyResultTwoLegs.htBodyfatKgRightArm >0) { | |||||
NSUInteger rightHand = roundf(bodyResultTwoLegs.htBodyfatKgRightArm*pow(10, dataModel.weightPoint)); | |||||
recordModel.fatMassRightTop = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:rightHand bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint]; | |||||
}else{ | |||||
recordModel.fatMassRightTop = @""; | |||||
} | |||||
//体脂-右脚 | |||||
if (bodyResultTwoLegs.htBodyfatKgRightLeg >0) { | |||||
NSUInteger rightFoot = roundf(bodyResultTwoLegs.htBodyfatKgRightLeg*pow(10, dataModel.weightPoint)); | |||||
recordModel.fatMassRightBottom = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:rightFoot bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint]; | |||||
}else{ | |||||
recordModel.fatMassRightBottom = @""; | |||||
} | |||||
//体脂-左手 | |||||
if (bodyResultTwoLegs.htBodyfatKgLeftArm >0) { | |||||
NSUInteger leftHand = roundf(bodyResultTwoLegs.htBodyfatKgLeftArm*pow(10, dataModel.weightPoint)); | |||||
recordModel.fatMassLeftTop = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:leftHand bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint]; | |||||
}else{ | |||||
recordModel.fatMassLeftTop = @""; | |||||
} | |||||
//体脂-左脚 | |||||
if (bodyResultTwoLegs.htBodyfatKgLeftLeg >0) { | |||||
NSUInteger leftFoot = roundf(bodyResultTwoLegs.htBodyfatKgLeftLeg*pow(10, dataModel.weightPoint)); | |||||
recordModel.fatMassLeftBottom = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:leftFoot bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint]; | |||||
}else{ | |||||
recordModel.fatMassLeftBottom = @""; | |||||
} | |||||
//体脂-躯干 | |||||
if (bodyResultTwoLegs.htBodyfatKgTrunk >0) { | |||||
NSUInteger fatMassBody = roundf(bodyResultTwoLegs.htBodyfatKgTrunk*pow(10, dataModel.weightPoint)); | |||||
recordModel.fatMassBody = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:fatMassBody bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint]; | |||||
}else{ | |||||
recordModel.fatMassBody = @""; | |||||
} | |||||
//肌肉-右手 | |||||
if (bodyResultTwoLegs.htMuscleKgRightArm >0) { | |||||
NSUInteger rightHand = roundf(bodyResultTwoLegs.htMuscleKgRightArm*pow(10, dataModel.weightPoint)); | |||||
recordModel.musleMassRightTop = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:rightHand bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint]; | |||||
}else{ | |||||
recordModel.musleMassRightTop = @""; | |||||
} | |||||
//肌肉-右脚 | |||||
if (bodyResultTwoLegs.htMuscleKgRightLeg >0) { | |||||
NSUInteger rightFoot = roundf(bodyResultTwoLegs.htMuscleKgRightLeg*pow(10, dataModel.weightPoint)); | |||||
recordModel.musleMassRightBottom = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:rightFoot bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint]; | |||||
}else{ | |||||
recordModel.musleMassRightBottom = @""; | |||||
} | |||||
//肌肉-左手 | |||||
if (bodyResultTwoLegs.htMuscleKgLeftArm >0) { | |||||
NSUInteger leftHand = roundf(bodyResultTwoLegs.htMuscleKgLeftArm*pow(10, dataModel.weightPoint)); | |||||
recordModel.musleMassLeftTop = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:leftHand bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint]; | |||||
}else{ | |||||
recordModel.musleMassLeftTop = @""; | |||||
} | |||||
//肌肉-左脚 | |||||
if (bodyResultTwoLegs.htMuscleKgeLeftLeg >0) { | |||||
NSUInteger leftFoot = roundf(bodyResultTwoLegs.htMuscleKgeLeftLeg*pow(10, dataModel.weightPoint)); | |||||
recordModel.musleMassLeftBottom = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:leftFoot bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint]; | |||||
}else{ | |||||
recordModel.musleMassLeftBottom = @""; | |||||
} | |||||
//肌肉-躯干 | |||||
if (bodyResultTwoLegs.htMuscleKgTrunk >0) { | |||||
NSUInteger muscleMassBody = roundf(bodyResultTwoLegs.htMuscleKgTrunk*pow(10, dataModel.weightPoint)); | |||||
recordModel.musleMassBody = [ELWeightAlgorithmusModel getWeightShowStrWithTargetUnit:dataModel.weightUnit bleWeightInt:muscleMassBody bleWeightUnit:(ELDeviceWeightUnit_KG) bleWeightPoint:dataModel.weightPoint]; | |||||
}else{ | |||||
recordModel.musleMassBody = @""; | |||||
} | |||||
//四肢肌肉指数 = 四肢肌肉量(kg)/身高的平方(m) | |||||
CGFloat heightM = (height/100.0); | |||||
CGFloat index = (bodyResultTwoLegs.htMuscleKgLeftArm+bodyResultTwoLegs.htMuscleKgeLeftLeg+bodyResultTwoLegs.htMuscleKgRightArm+bodyResultTwoLegs.htMuscleKgRightLeg)/(heightM*heightM); | |||||
recordModel.musleMassLimbs = [NSString stringWithFormat:@"%.1f",index]; | |||||
return recordModel; | |||||
} | |||||
@end |
// | |||||
// ELEightScaleRecordModel.h | |||||
// Elink | |||||
// | |||||
// Created by iot_user on 2020/6/9. | |||||
// Copyright © 2020 iot_iMac. All rights reserved. | |||||
// | |||||
#import <Foundation/Foundation.h> | |||||
NS_ASSUME_NONNULL_BEGIN | |||||
@interface ELEightScaleRecordModel : NSObject | |||||
///bmi | |||||
@property (nonatomic, copy) NSString *bmi; | |||||
///体脂率 | |||||
@property (nonatomic, copy) NSString *bfr; | |||||
///皮下脂肪率 | |||||
@property (nonatomic, copy) NSString *sfr; | |||||
///内脏脂肪指数 | |||||
@property (nonatomic, copy) NSString *uvi; | |||||
///肌肉率 | |||||
@property (nonatomic, copy) NSString *rom; | |||||
///基础代谢率 | |||||
@property (nonatomic, copy) NSString *bmr; | |||||
///骨骼质量 //特别注意:所有重量单位只有骨量在服务器上永远存储kg,其他重量属性都存储的是转换后的显示值;并且无论秤返回的weight数值是何种单位,但秤返回或Algorithm算法算出的骨量都是kg单位 | |||||
@property (nonatomic, copy) NSString *bm; | |||||
///水含量 | |||||
@property (nonatomic, copy) NSString *vwc; | |||||
///身体年龄 | |||||
@property (nonatomic, assign) NSString *bodyAge; | |||||
///蛋白率 | |||||
@property (nonatomic, copy) NSString *pp; | |||||
///躯干阻抗 | |||||
@property (nonatomic, copy) NSString *adc; | |||||
///心率 | |||||
@property (nonatomic, copy) NSString *heartRate; | |||||
///创建时间 | |||||
@property (nonatomic, assign) long long createTime; | |||||
///秤的算法id | |||||
@property (nonatomic, copy) NSString *deviceAlgorithm; | |||||
/// | |||||
@property (nonatomic, copy) NSString *standardWeight; | |||||
/// | |||||
@property (nonatomic, copy) NSString *weightControl; | |||||
/// | |||||
@property (nonatomic, copy) NSString *fatMass; | |||||
/// | |||||
@property (nonatomic, copy) NSString *weightWithoutFat; | |||||
/// | |||||
@property (nonatomic, copy) NSString *musleMass; | |||||
/// | |||||
@property (nonatomic, copy) NSString *proteinMass; | |||||
///肥胖等级 | |||||
@property (nonatomic, copy) NSString *fatLevel; | |||||
//体脂-右上 | |||||
@property (nonatomic, copy) NSString *fatMassRightTop; | |||||
//体脂-右下 | |||||
@property (nonatomic, copy) NSString *fatMassRightBottom; | |||||
//体脂-左上 | |||||
@property (nonatomic, copy) NSString *fatMassLeftTop; | |||||
//体脂-左下 | |||||
@property (nonatomic, copy) NSString *fatMassLeftBottom; | |||||
//体脂-躯干 | |||||
@property (nonatomic, copy) NSString *fatMassBody; | |||||
//肌肉-右上 | |||||
@property (nonatomic, copy) NSString *musleMassRightTop; | |||||
//肌肉-右下 | |||||
@property (nonatomic, copy) NSString *musleMassRightBottom; | |||||
//肌肉-左上 | |||||
@property (nonatomic, copy) NSString *musleMassLeftTop; | |||||
//肌肉-左下 | |||||
@property (nonatomic, copy) NSString *musleMassLeftBottom; | |||||
//肌肉-躯干 | |||||
@property (nonatomic, copy) NSString *musleMassBody; | |||||
//四肢肌肉指数 | |||||
@property (nonatomic, copy) NSString *musleMassLimbs; | |||||
@end | |||||
NS_ASSUME_NONNULL_END |
// | |||||
// ELEightScaleRecordModel.m | |||||
// Elink | |||||
// | |||||
// Created by iot_user on 2020/6/9. | |||||
// Copyright © 2020 iot_iMac. All rights reserved. | |||||
// | |||||
#import "ELEightScaleRecordModel.h" | |||||
#import <objc/runtime.h> | |||||
@implementation ELEightScaleRecordModel | |||||
- (NSString *)description{ | |||||
NSString * desc = @"\n"; | |||||
//获取obj的属性数目 | |||||
unsigned int outCount; | |||||
objc_property_t *properties = class_copyPropertyList([self class], &outCount); | |||||
for (int i = 0; i < outCount; i ++) { | |||||
//获取property的C字符串 | |||||
objc_property_t property = properties[i]; | |||||
const char * propName = property_getName(property); | |||||
if (propName) { | |||||
//获取NSString类型的property名字 | |||||
NSString *prop = [NSString stringWithCString:propName encoding:NSUTF8StringEncoding]; | |||||
//获取property对应的值 | |||||
id obj = [self valueForKey:prop]; | |||||
//将属性名和属性值拼接起来 | |||||
desc = [desc stringByAppendingFormat:@"%@ : %@;\n",prop,obj]; | |||||
} | |||||
} | |||||
free(properties); | |||||
return desc; | |||||
} | |||||
@end |
#import <AILinkBleSDK/ELEightScaleBleManager.h> | #import <AILinkBleSDK/ELEightScaleBleManager.h> | ||||
#import <AILinkBleSDK/ELEightScaleBleDataModel.h> | #import <AILinkBleSDK/ELEightScaleBleDataModel.h> | ||||
#import <AILinkBleSDK/ELEightScaleSDKHeader.h> | #import <AILinkBleSDK/ELEightScaleSDKHeader.h> | ||||
#import "ELEightScaleAlgorithmTool.h" | |||||
@interface EightScaleConnectionViewController ()<ELBluetoothManagerDelegate,EightScaleBleDeletegate> | @interface EightScaleConnectionViewController ()<ELBluetoothManagerDelegate,EightScaleBleDeletegate> | ||||
@property (nonatomic, strong) UITextView *textView; | @property (nonatomic, strong) UITextView *textView; | ||||
make.width.mas_equalTo(100); | make.width.mas_equalTo(100); | ||||
make.height.mas_equalTo(40); | make.height.mas_equalTo(40); | ||||
}]; | }]; | ||||
// | |||||
// | |||||
// UIButton *button6 = [UIButton buttonWithType:(UIButtonTypeCustom)]; | |||||
// [button6 setTitle:@"" forState:(UIControlStateNormal)]; | |||||
// button6.tag = 6; | |||||
// button6.titleLabel.adjustsFontSizeToFitWidth = YES; | |||||
// button6.titleLabel.numberOfLines = 2; | |||||
// button6.backgroundColor = [UIColor blackColor]; | |||||
// [button6 addTarget:self action:@selector(buttonAction:) forControlEvents:(UIControlEventTouchUpInside)]; | |||||
// [self.view addSubview:button6]; | |||||
// [button6 mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
// make.left.equalTo(button5.mas_right).mas_offset(10); | |||||
// make.top.equalTo(button1.mas_bottom).mas_offset(10); | |||||
// make.width.mas_equalTo(100); | |||||
// make.height.mas_equalTo(40); | |||||
// }]; | |||||
// // | |||||
// UIButton *button7 = [UIButton buttonWithType:(UIButtonTypeCustom)]; | |||||
// [button7 setTitle:@"" forState:(UIControlStateNormal)]; | |||||
// button7.tag = 7; | |||||
// button7.titleLabel.adjustsFontSizeToFitWidth = YES; | |||||
// button7.titleLabel.numberOfLines = 2; | |||||
// button7.backgroundColor = [UIColor blackColor]; | |||||
// [button7 addTarget:self action:@selector(buttonAction:) forControlEvents:(UIControlEventTouchUpInside)]; | |||||
// [self.view addSubview:button7]; | |||||
// [button7 mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
// make.left.mas_equalTo(10); | |||||
// make.top.equalTo(button4.mas_bottom).mas_offset(10); | |||||
// make.width.mas_equalTo(100); | |||||
// make.height.mas_equalTo(40); | |||||
// }]; | |||||
// | |||||
// UIButton *button8 = [UIButton buttonWithType:(UIButtonTypeCustom)]; | |||||
// [button8 setTitle:@"" forState:(UIControlStateNormal)]; | |||||
// button8.tag = 8; | |||||
// button8.titleLabel.adjustsFontSizeToFitWidth = YES; | |||||
// button8.titleLabel.numberOfLines = 2; | |||||
// button8.backgroundColor = [UIColor blackColor]; | |||||
// [button8 addTarget:self action:@selector(buttonAction:) forControlEvents:(UIControlEventTouchUpInside)]; | |||||
// [self.view addSubview:button8]; | |||||
// [button8 mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
// make.left.equalTo(button7.mas_right).mas_offset(10); | |||||
// make.top.equalTo(button4.mas_bottom).mas_offset(10); | |||||
// make.width.mas_equalTo(100); | |||||
// make.height.mas_equalTo(40); | |||||
// }]; | |||||
// | |||||
// UIButton *button9 = [UIButton buttonWithType:(UIButtonTypeCustom)]; | |||||
// [button9 setTitle:@"" forState:(UIControlStateNormal)]; | |||||
// button9.tag = 9; | |||||
// button9.titleLabel.adjustsFontSizeToFitWidth = YES; | |||||
// button9.titleLabel.numberOfLines = 2; | |||||
// button9.backgroundColor = [UIColor blackColor]; | |||||
// [button9 addTarget:self action:@selector(buttonAction:) forControlEvents:(UIControlEventTouchUpInside)]; | |||||
// [self.view addSubview:button9]; | |||||
// [button9 mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
// make.left.equalTo(button8.mas_right).mas_offset(10); | |||||
// make.top.equalTo(button4.mas_bottom).mas_offset(10); | |||||
// make.width.mas_equalTo(100); | |||||
// make.height.mas_equalTo(40); | |||||
// }]; | |||||
// | |||||
self.textView = [[UITextView alloc] init]; | self.textView = [[UITextView alloc] init]; | ||||
self.textView.backgroundColor = [UIColor blackColor]; | self.textView.backgroundColor = [UIColor blackColor]; | ||||
self.textView.text = @"Log"; | self.textView.text = @"Log"; | ||||
[self addLog:@"Measurn Complete"]; | [self addLog:@"Measurn Complete"]; | ||||
} | } | ||||
#pragma mark ============ get all body fat data ============== | |||||
-(void)eightScaleBleReceiveTestData:(ELEightScaleBleDataModel *)dataModel{ | -(void)eightScaleBleReceiveTestData:(ELEightScaleBleDataModel *)dataModel{ | ||||
[self addLog:[NSString stringWithFormat:@"weight = %@%@",dataModel.weight,AiLinkBleWeightUnitDic[@(dataModel.weightUnit)]]]; | [self addLog:[NSString stringWithFormat:@"weight = %@%@",dataModel.weight,AiLinkBleWeightUnitDic[@(dataModel.weightUnit)]]]; | ||||
//Please input the correct height, age, gender of your app user | |||||
ELEightScaleRecordModel *bodyInfo = [ELEightScaleAlgorithmTool getRecordModelWithBleDataModel:dataModel withUserSex:1 height:175 age:25]; | |||||
[self addLog:[NSString stringWithFormat:@"---bodyInfo:%@",bodyInfo]]; | |||||
} | } | ||||
-(void)eightScaleBleReceiveErrorCode:(int)errorCode{ | -(void)eightScaleBleReceiveErrorCode:(int)errorCode{ |
// | |||||
// HTBodyfat_SDK.h | |||||
// | |||||
// Created by Holtek on 17/12/21. | |||||
// Copyright © 2017年 Holtek. All rights reserved. | |||||
// | |||||
// Version: 3.06, SDK for armV7、arm64、x86_x64, OS ≥ iOS 8.0 | |||||
// | |||||
#import <UIKit/UIKit.h> | |||||
@class HTBodyInfo; | |||||
@class HTBodyResult; | |||||
@class HTBodyResultAllBody; | |||||
@class HTBodyResultTwoLegs; | |||||
@class HTBodyResultTwoArms; | |||||
@class HTBodyResultArmsLegs; | |||||
///性别类型 | |||||
typedef NS_ENUM(NSInteger, HTSexType){ | |||||
HTSexTypeFemale, //!< 女性 | |||||
HTSexTypeMale //!< 男性 | |||||
}; | |||||
///错误类型(针对输入的参数) | |||||
typedef NS_ENUM(NSInteger, HTBodyfatErrorType){ | |||||
HTBodyfatErrorTypeNone, //!< 无错误(可读取所有参数) | |||||
HTBodyfatErrorTypeAge = 0x01, //!< 年龄参数有误,需在 6 ~ 99岁(不计算除BMI/idealWeightKg以外参数) | |||||
HTBodyfatErrorTypeWeight = 0x02, //!< 体重参数有误,需在 10 ~ 200kg(有误不计算所有参数) | |||||
HTBodyfatErrorTypeHeight = 0x04, //!< 身高参数有误,需在 90 ~ 220cm(不计算所有参数) | |||||
HTBodyfatErrorTypeSex = 0x08, //!< 性别参数有误,需为0或1 | |||||
HTBodyfatErrorTypeImpedance = 0x10, //!< 阻抗系数有误,阻抗有误时, 不计算除BMI/idealWeightKg以外参数(写0) | |||||
HTBodyfatErrorTypeImpedanceLeftLeg = 0x20, //!< 左脚阻抗系数有误, | |||||
HTBodyfatErrorTypeImpedanceRightLeg = 0x40, //!< 右脚阻抗系数有误, | |||||
HTBodyfatErrorTypeImpedanceLeftArm = 0x80, //!< 左手阻抗系数有误, | |||||
HTBodyfatErrorTypeImpedanceRightArm = 0x100, //!< 右手阻抗系数有误, | |||||
}; | |||||
///身体类型 | |||||
typedef NS_ENUM(NSInteger, HTBodyType){ | |||||
HTBodyTypeThin, //!< 偏瘦型 | |||||
HTBodyTypeLThinMuscle, //!< 偏瘦肌肉型 | |||||
HTBodyTypeMuscular, //!< 肌肉发达型 | |||||
HTBodyTypeLackofexercise, //!< 缺乏运动型 | |||||
HTBodyTypeStandard, //!< 标准型 | |||||
HTBodyTypeStandardMuscle, //!< 标准肌肉型 | |||||
HTBodyTypeObesFat, //!< 浮肿肥胖型 | |||||
HTBodyTypeLFatMuscle, //!< 偏胖肌肉型 | |||||
HTBodyTypeMuscleFat, //!< 肌肉型偏胖 | |||||
}; | |||||
///测量类型 | |||||
typedef NS_ENUM(NSInteger, HTBodyMeasureType){ | |||||
HTBodyMeasureTypeTwoLegs, //!< 双脚 | |||||
HTBodyMeasureTypeAllBody, //!< 全身 | |||||
HTBodyMeasureTypeTwoArms, //!< 双手 | |||||
HTBodyMeasureTypeArmsLegs, //!< 双手双脚 | |||||
HTBodyMeasureTypeThighArms, //!< 大腿到手 | |||||
HTBodyMeasureTypeThigh //!< 大腿 | |||||
}; | |||||
#pragma mark - HTBodyBasicInfo | |||||
// 计算体脂参数所需数据model | |||||
@interface HTBodyBasicInfo : NSObject | |||||
//测量者基本信息 | |||||
@property (nonatomic,assign) HTSexType htSex; //!< 性别 | |||||
@property (nonatomic,assign) NSInteger htHeightCm; //!< 身高(cm),需在 90 ~ 220cm | |||||
@property (nonatomic,assign) CGFloat htWeightKg; //!< 体重(kg),需在 10 ~ 200kg | |||||
@property (nonatomic,assign) NSInteger htAge; //!< 年龄(岁),需在6 ~ 99岁 | |||||
//测量双脚时需赋值 | |||||
@property (nonatomic,assign) NSInteger htTwoLegsImpedance; //!< 双脚阻抗系数 | |||||
//测量双手时需赋值 | |||||
@property (nonatomic,assign) NSInteger htTwoArmsImpedance; //!< 双手阻抗系数 | |||||
//测量全身时需赋值 | |||||
@property (nonatomic,assign) CGFloat htZAllBodyImpedance; //!< 全身阻抗系数 | |||||
@property (nonatomic,assign) CGFloat htZLeftLegImpedance; //!< 左脚阻抗系数 | |||||
@property (nonatomic,assign) CGFloat htZRightLegImpedance; //!< 右脚阻抗系数 | |||||
@property (nonatomic,assign) CGFloat htZLeftArmImpedance; //!< 左手阻抗系数 | |||||
@property (nonatomic,assign) CGFloat htZRightArmImpedance; //!< 右手阻抗系数 | |||||
/** | |||||
* 初始化人体数据 | |||||
* | |||||
* @param sex 性别 | |||||
* @param height 身高,单位cm | |||||
* @param weight 体重,单位kg | |||||
* @param age 年龄 | |||||
* | |||||
* @return 人体数据model | |||||
*/ | |||||
- (id)initWithSex:(HTSexType)sex height:(NSInteger)height weight:(CGFloat)weight age:(NSInteger)age; | |||||
@end | |||||
#pragma mark - HTBodyResult | |||||
/** | |||||
* 体脂测量结果的基类 | |||||
* 所有标准的字典使用说明如下: | |||||
* 1.以BMI为例 | |||||
* 小于"瘦-普通"为瘦,小于“普通-偏胖”为普通,小于"偏胖-肥胖"为偏胖,其它肥胖 | |||||
* 2.以体脂率为例 | |||||
* 小于"偏瘦-标准" 为偏瘦 | |||||
* 小于“标准-警惕” 为标准 | |||||
* 小于"警惕-偏胖" 为警惕 | |||||
* 小于"偏胖-肥胖" 为偏胖 | |||||
* 其它 肥胖 | |||||
*/ | |||||
@interface HTBodyResult : NSObject | |||||
@property (nonatomic,assign) HTBodyfatErrorType htErrorType; //!< 错误类型,数据/计算是否有误 | |||||
@property (nonatomic,assign) CGFloat htProteinPercentage; //!< 蛋白质,分辨率0.1, 范围2.0% ~ 30.0% | |||||
@property (nonatomic,copy) NSDictionary* htProteinRatingList; //!< 蛋白健康标准字典,"不足-标准"“标准-优秀” | |||||
@property (nonatomic,assign) CGFloat htBMI; //!< Body Mass Index 人体质量指数, 分辨率0.1, 范围10.0 ~ 90.0 | |||||
@property (nonatomic,copy) NSDictionary* htBMIRatingList; //!< BMI健康标准字典,"瘦-普通"“普通-偏胖”“偏胖-肥胖” | |||||
@property (nonatomic,assign) NSInteger htBMR; //!< Basal Metabolic Rate基础代谢, 分辨率1, 范围500 ~ 10000 | |||||
@property (nonatomic,copy) NSDictionary* htBMRRatingList; //!< 基础代谢健康标准字典:"偏低-达标" | |||||
@property (nonatomic,assign) NSInteger htVFAL; //!< Visceral fat area leverl内脏脂肪, 分辨率1, 范围1 ~ 60 | |||||
@property (nonatomic,copy) NSDictionary* htVFALRatingList; //!< 内脏脂肪等级标准字典,"标准-警惕""警惕-危险" | |||||
@property (nonatomic,assign) CGFloat htBoneKg; //!< 骨量(kg), 分辨率0.1, 范围0.5 ~ 8.0 | |||||
@property (nonatomic,copy) NSDictionary* htBoneRatingList; //!< 骨量等级标准字典,"不足-标准"“标准-优秀” | |||||
@property (nonatomic,assign) CGFloat htBodyfatSubcut; //!< 皮下脂肪率(%), 分辨率0.1, 范围0.1 ~ 60.0 | |||||
@property (nonatomic,assign) CGFloat htBodyfatSubcutKg; //!< 皮下脂肪量(kg) | |||||
@property (nonatomic,copy) NSDictionary* htBodyfatSubcutList; //!< 皮下脂肪等级标准 | |||||
@property (nonatomic,assign) CGFloat htBodyfatFreeMass; //!< 去脂体重(kg) | |||||
/** | |||||
* 运动消耗量:kcal/30分钟, 字典key值如下,value为NSNumber类型 | |||||
* 步行:walking, 慢跑:jogging, 自行车:bicycle, 游泳:swim, 爬山:mountain_climbing, | |||||
* 有氧操:aerobic, 乒乓球:tabletennis, 网球:tennis, 足球:football, 击剑:oriental_fencing, | |||||
* 门球:gateball, 羽毛球:badminton, 壁球:racketball, 跆拳道:tae_kwon_do, 弹力球:squash, | |||||
* 篮球:basketball, 跳绳:ropejumping, 高尔夫:golf | |||||
*/ | |||||
@property (nonatomic,copy) NSDictionary* htExercisePlannerList; //!< 运动计划,运动消耗量表 | |||||
@property (nonatomic,assign) CGFloat htBodyfatKg; //!< 脂肪量(kg) | |||||
@property (nonatomic,assign) CGFloat htBodyfatPercentage; //!< 脂肪率(%), 分辨率0.1, 范围5.0% ~ 75.0% | |||||
@property (nonatomic,copy) NSDictionary* htBodyfatRatingList; //!< 脂肪率健康标准字典"偏瘦-标准"“标准-警惕”“警惕-偏胖”“偏胖-肥胖” | |||||
@property (nonatomic,assign) CGFloat htWaterPercentage; //!< 水分率(%), 分辨率0.1, 范围35.0% ~ 75.0% | |||||
@property (nonatomic,copy) NSDictionary* htWaterRatingList; //!< 水分率健康标准 "不足-标准"“标准-优秀” | |||||
@property (nonatomic,assign) CGFloat htMuscleKg; //!< 肌肉量(kg), 分辨率0.1, 范围10.0 ~ 120.0 | |||||
@property (nonatomic,assign) CGFloat htMusclePercentage; //!< 肌肉率(%),分辨率0.1,范围5%~90% | |||||
@property (nonatomic,copy) NSDictionary* htMuscleRatingList; //!< 肌肉量健康标准 "不足-标准"“标准-优秀” | |||||
@property (nonatomic,assign) NSInteger htBodyAge; //!< 身体年龄,6~99岁 | |||||
@property (nonatomic,assign) CGFloat htIdealWeightKg; //!< 理想体重(kg) | |||||
@property (nonatomic,assign) HTBodyType htBodyType; //!< 身体类型 | |||||
@property (nonatomic,assign) NSInteger htBodyScore; //!< 身体得分,50 ~ 100分 | |||||
/** | |||||
* 根据测量类型获取体脂参数,调用之前需先给相应测量类型的阻抗系数赋值 | |||||
* | |||||
* @param basicInfo 人体参数基本信息 | |||||
* | |||||
* @return 体脂计算结果,判断是否有错误 | |||||
*/ | |||||
- (HTBodyfatErrorType )getBodyfatWithBasicInfo:(HTBodyBasicInfo *)basicInfo; | |||||
@end | |||||
#pragma mark - HTBodyResultTwoLegs | |||||
/** | |||||
* 双脚的测量结果类 | |||||
*/ | |||||
@interface HTBodyResultTwoLegs : HTBodyResult | |||||
@property (nonatomic,assign) CGFloat htZTwoLegs; //!< 脚对脚阻抗值(Ω), 范围200.0 ~ 1200.0 | |||||
@end | |||||
#pragma mark - HTBodyResultAllBody | |||||
/** | |||||
* 全身的测量结果类 | |||||
*/ | |||||
@interface HTBodyResultAllBody : HTBodyResult | |||||
@property (nonatomic,assign) CGFloat htZAllBody; //!< 全身阻抗值(Ω), 范围75.0 ~ 1500.0 | |||||
@property (nonatomic,assign) CGFloat htZLeftLeg; //!< 左脚阻抗值(Ω), 范围75.0 ~ 1500.0 | |||||
@property (nonatomic,assign) CGFloat htZRightLeg; //!< 右脚阻抗值(Ω), 范围75.0 ~ 1500.0 | |||||
@property (nonatomic,assign) CGFloat htZLeftArm; //!< 左手阻抗值(Ω), 范围75.0 ~ 1500.0 | |||||
@property (nonatomic,assign) CGFloat htZRightArm; //!< 右手阻抗值(Ω), 范围75.0 ~ 1500.0 | |||||
@property (nonatomic,assign) CGFloat htMusclePercentageTrunk; //!< 躯干肌肉率(%), 分辨率0.1, 范围5.0% ~ 90.0% | |||||
@property (nonatomic,assign) CGFloat htMusclePercentageLeftLeg; //!< 左脚肌肉率(%), 分辨率0.1, 范围5.0% ~ 90.0% | |||||
@property (nonatomic,assign) CGFloat htMusclePercentageRightLeg; //!< 右脚肌肉率(%), 分辨率0.1, 范围5.0% ~ 90.0% | |||||
@property (nonatomic,assign) CGFloat htMusclePercentageLeftArm; //!< 左手肌肉率(%), 分辨率0.1, 范围5.0% ~ 90.0% | |||||
@property (nonatomic,assign) CGFloat htMusclePercentageRightArm; //!< 右手肌肉率(%), 分辨率0.1, 范围5.0% ~ 90.0% | |||||
@property (nonatomic,assign) CGFloat htBodyfatPercentageTrunk; //!< 躯干脂肪率(%), 分辨率0.1, 范围5.0% ~ 75.0% | |||||
@property (nonatomic,assign) CGFloat htBodyfatPercentageLeftLeg; //!< 左脚脂肪率(%), 分辨率0.1, 范围5.0% ~ 75.0% | |||||
@property (nonatomic,assign) CGFloat htBodyfatPercentageRightLeg; //!< 右脚脂肪率(%), 分辨率0.1, 范围5.0% ~ 75.0% | |||||
@property (nonatomic,assign) CGFloat htBodyfatPercentageLeftArm; //!< 左手脂肪率(%), 分辨率0.1, 范围5.0% ~ 75.0% | |||||
@property (nonatomic,assign) CGFloat htBodyfatPercentageRightArm; //!< 右手脂肪率(%), 分辨率0.1, 范围5.0% ~ 75.0% | |||||
@property (nonatomic,assign) CGFloat htMuscleKgTrunk; //!< 躯干肌肉量(kg), 分辨率0.1, 范围0.0 ~ 200kg | |||||
@property (nonatomic,assign) CGFloat htMuscleKgeLeftLeg; //!< 左脚肌肉量(kg), 分辨率0.1, 范围0.0 ~ 200kg | |||||
@property (nonatomic,assign) CGFloat htMuscleKgRightLeg; //!< 右脚肌肉量(kg), 分辨率0.1, 范围0.0 ~ 200kg | |||||
@property (nonatomic,assign) CGFloat htMuscleKgLeftArm; //!< 左手肌肉量(kg), 分辨率0.1, 范围0.0 ~ 200kg | |||||
@property (nonatomic,assign) CGFloat htMuscleKgRightArm; //!< 右手肌肉量(kg), 分辨率0.1, 范围0.0 ~ 200kg | |||||
@property (nonatomic,assign) CGFloat htBodyfatKgTrunk; //!< 躯干脂肪量(kg), 分辨率0.1, 范围0.0 ~ 200kg | |||||
@property (nonatomic,assign) CGFloat htBodyfatKgLeftLeg; //!< 左脚脂肪量(kg), 分辨率0.1, 范围0.0 ~ 200kg | |||||
@property (nonatomic,assign) CGFloat htBodyfatKgRightLeg; //!< 右脚脂肪量(kg), 分辨率0.1, 范围0.0 ~ 200kg | |||||
@property (nonatomic,assign) CGFloat htBodyfatKgLeftArm; //!< 左手脂肪量(kg), 分辨率0.1, 范围0.0 ~ 200kg | |||||
@property (nonatomic,assign) CGFloat htBodyfatKgRightArm; //!< 右手脂肪量(kg), 分辨率0.1, 范围0.0 ~ 200kg | |||||
@end | |||||
#pragma mark - HTBodyResultTwoArms | |||||
/** | |||||
* 双手的测量结果类 | |||||
*/ | |||||
@interface HTBodyResultTwoArms : HTBodyResult | |||||
@property (nonatomic,assign) CGFloat htZTwoArms; //!< 手对手阻抗值(Ω), 范围200.0 ~ 1200.0 | |||||
@end | |||||
#pragma mark - HTBodyResultArmsLegs | |||||
/** | |||||
* 双手双脚的测量结果类,预留 | |||||
*/ | |||||
@interface HTBodyResultArmsLegs : HTBodyResult | |||||
@end | |||||