Ver código fonte

增加八电极体脂秤和广播秤的支持

tags/v1.4.5_20211215
iot_user 4 anos atrás
pai
commit
07c8d1a764
28 arquivos alterados com 1851 adições e 30 exclusões
  1. 38
    4
      AILinkBleSDKDemo.xcodeproj/project.pbxproj
  2. BIN
      AILinkBleSDKDemo.xcodeproj/project.xcworkspace/xcuserdata/iot_user.xcuserdatad/UserInterfaceState.xcuserstate
  3. BIN
      AILinkBleSDKDemo/AILinkBleSDK.framework/AILinkBleSDK
  4. 51
    5
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELBluetoothManager.h
  5. 421
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELBodyIndexAlgorithmModel.h
  6. 38
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELBroadcastScaleBleHeader.h
  7. 39
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELBroadcastScaleBleManager.h
  8. 47
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELBroadcastScaleDataModel.h
  9. 54
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELEightScaleBleDataModel.h
  10. 87
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELEightScaleBleManager.h
  11. 101
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELEightScaleSDKHeader.h
  12. 36
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELHeightAlgorithmusModel.h
  13. 5
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELPeripheralModel.h
  14. 44
    10
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELSDKHeader.h
  15. 25
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELTempAlgorithmusModel.h
  16. 52
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELWeightAlgorithmusModel.h
  17. BIN
      AILinkBleSDKDemo/AILinkBleSDK.framework/Info.plist
  18. BIN
      AILinkBleSDKDemo/AILinkBleSDK.framework/_CodeSignature/CodeDirectory
  19. BIN
      AILinkBleSDKDemo/AILinkBleSDK.framework/_CodeSignature/CodeRequirements-1
  20. 160
    10
      AILinkBleSDKDemo/AILinkBleSDK.framework/_CodeSignature/CodeResources
  21. BIN
      AILinkBleSDKDemo/AILinkBleSDK.framework/_CodeSignature/CodeSignature
  22. 11
    1
      AILinkBleSDKDemo/ViewController.m
  23. 18
    0
      AILinkBleSDKDemo/八电极体脂秤/EightScaleConnectionViewController.h
  24. 397
    0
      AILinkBleSDKDemo/八电极体脂秤/EightScaleConnectionViewController.m
  25. 17
    0
      AILinkBleSDKDemo/八电极体脂秤/EightScaleScanViewController.h
  26. 89
    0
      AILinkBleSDKDemo/八电极体脂秤/EightScaleScanViewController.m
  27. 17
    0
      AILinkBleSDKDemo/广播体脂秤/BroadcastScaleViewController.h
  28. 104
    0
      AILinkBleSDKDemo/广播体脂秤/BroadcastScaleViewController.m

+ 38
- 4
AILinkBleSDKDemo.xcodeproj/project.pbxproj Ver arquivo

@@ -49,7 +49,10 @@
E622E2FF243F1D4A003C319D /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E622E2D8243F1D4A003C319D /* ViewController.m */; };
E622E300243F1D4A003C319D /* ThermometerScanViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E622E2DA243F1D4A003C319D /* ThermometerScanViewController.m */; };
E622E301243F1D4A003C319D /* ThermometerConnectViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E622E2DD243F1D4A003C319D /* ThermometerConnectViewController.m */; };
E62381B5244E9B1200B976C4 /* AILinkBleSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E62381B4244E9B1200B976C4 /* AILinkBleSDK.framework */; };
E680BF1C2510572A005AD827 /* AILinkBleSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E680BF1B25105729005AD827 /* AILinkBleSDK.framework */; };
E680BF252510576D005AD827 /* BroadcastScaleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E680BF1E2510576D005AD827 /* BroadcastScaleViewController.m */; };
E680BF262510576D005AD827 /* EightScaleScanViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E680BF212510576D005AD827 /* EightScaleScanViewController.m */; };
E680BF272510576D005AD827 /* EightScaleConnectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E680BF222510576D005AD827 /* EightScaleConnectionViewController.m */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
@@ -149,7 +152,13 @@
E622E2DB243F1D4A003C319D /* ThermometerConnectViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThermometerConnectViewController.h; sourceTree = "<group>"; };
E622E2DC243F1D4A003C319D /* ThermometerScanViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThermometerScanViewController.h; sourceTree = "<group>"; };
E622E2DD243F1D4A003C319D /* ThermometerConnectViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ThermometerConnectViewController.m; sourceTree = "<group>"; };
E62381B4244E9B1200B976C4 /* AILinkBleSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = AILinkBleSDK.framework; sourceTree = "<group>"; };
E680BF1B25105729005AD827 /* AILinkBleSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = AILinkBleSDK.framework; sourceTree = "<group>"; };
E680BF1E2510576D005AD827 /* BroadcastScaleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BroadcastScaleViewController.m; sourceTree = "<group>"; };
E680BF1F2510576D005AD827 /* BroadcastScaleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BroadcastScaleViewController.h; sourceTree = "<group>"; };
E680BF212510576D005AD827 /* EightScaleScanViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EightScaleScanViewController.m; sourceTree = "<group>"; };
E680BF222510576D005AD827 /* EightScaleConnectionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EightScaleConnectionViewController.m; sourceTree = "<group>"; };
E680BF232510576D005AD827 /* EightScaleScanViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EightScaleScanViewController.h; sourceTree = "<group>"; };
E680BF242510576D005AD827 /* EightScaleConnectionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EightScaleConnectionViewController.h; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
@@ -157,7 +166,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
E62381B5244E9B1200B976C4 /* AILinkBleSDK.framework in Frameworks */,
E680BF1C2510572A005AD827 /* AILinkBleSDK.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -192,7 +201,7 @@
E622E25D243F1CA5003C319D /* AILinkBleSDKDemo */ = {
isa = PBXGroup;
children = (
E62381B4244E9B1200B976C4 /* AILinkBleSDK.framework */,
E680BF1B25105729005AD827 /* AILinkBleSDK.framework */,
E622E2B7243F1D4A003C319D /* AiLinkSuper */,
E622E2CC243F1D4A003C319D /* BabyScale */,
E622E2B1243F1D4A003C319D /* BloodPressure */,
@@ -204,6 +213,8 @@
E622E2C7243F1D4A003C319D /* RemoteControl */,
E622E2D9243F1D4A003C319D /* Thermometer */,
E622E2C2243F1D4A003C319D /* WheelMonitor */,
E680BF202510576D005AD827 /* 八电极体脂秤 */,
E680BF1D2510576D005AD827 /* 广播体脂秤 */,
E622E25E243F1CA5003C319D /* AppDelegate.h */,
E622E25F243F1CA5003C319D /* AppDelegate.m */,
E622E261243F1CA5003C319D /* SceneDelegate.h */,
@@ -384,6 +395,26 @@
path = Thermometer;
sourceTree = "<group>";
};
E680BF1D2510576D005AD827 /* 广播体脂秤 */ = {
isa = PBXGroup;
children = (
E680BF1E2510576D005AD827 /* BroadcastScaleViewController.m */,
E680BF1F2510576D005AD827 /* BroadcastScaleViewController.h */,
);
path = "广播体脂秤";
sourceTree = "<group>";
};
E680BF202510576D005AD827 /* 八电极体脂秤 */ = {
isa = PBXGroup;
children = (
E680BF212510576D005AD827 /* EightScaleScanViewController.m */,
E680BF222510576D005AD827 /* EightScaleConnectionViewController.m */,
E680BF232510576D005AD827 /* EightScaleScanViewController.h */,
E680BF242510576D005AD827 /* EightScaleConnectionViewController.h */,
);
path = "八电极体脂秤";
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
@@ -486,6 +517,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E680BF262510576D005AD827 /* EightScaleScanViewController.m in Sources */,
E622E2FF243F1D4A003C319D /* ViewController.m in Sources */,
E622E2EF243F1D4A003C319D /* BloodConnectViewController.m in Sources */,
E622E2F6243F1D4A003C319D /* WheelMonitorConnectViewController.m in Sources */,
@@ -498,12 +530,14 @@
E622E2DF243F1D4A003C319D /* HeightGuageConnectViewController.m in Sources */,
E622E2DE243F1D4A003C319D /* HeightGuageScanViewController.m in Sources */,
E622E2FC243F1D4A003C319D /* BodyFatScaleScanViewController.m in Sources */,
E680BF272510576D005AD827 /* EightScaleConnectionViewController.m in Sources */,
E622E2E4243F1D4A003C319D /* NSLayoutConstraint+MASDebugAdditions.m in Sources */,
E622E2ED243F1D4A003C319D /* MASViewAttribute.m in Sources */,
E622E2E1243F1D4A003C319D /* InheritConnectViewController.m in Sources */,
E622E2F4243F1D4A003C319D /* ForeheadConnectViewController.m in Sources */,
E622E2EC243F1D4A003C319D /* MASViewConstraint.m in Sources */,
E622E2E0243F1D4A003C319D /* SubBleManager.m in Sources */,
E680BF252510576D005AD827 /* BroadcastScaleViewController.m in Sources */,
E622E2E7243F1D4A003C319D /* MASConstraintMaker.m in Sources */,
E622E2E8243F1D4A003C319D /* MASLayoutConstraint.m in Sources */,
E622E300243F1D4A003C319D /* ThermometerScanViewController.m in Sources */,

BIN
AILinkBleSDKDemo.xcodeproj/project.xcworkspace/xcuserdata/iot_user.xcuserdatad/UserInterfaceState.xcuserstate Ver arquivo


BIN
AILinkBleSDKDemo/AILinkBleSDK.framework/AILinkBleSDK Ver arquivo


+ 51
- 5
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELBluetoothManager.h Ver arquivo

@@ -13,6 +13,24 @@
#import "ELBleWifiDetailModel.h"


//MARK: Broadcast Equipment Protocol(广播设备协议)

@protocol ELBleBroadcastDelegate <NSObject>

@optional

/// Callback broadcast device data(回调广播设备数据)
/// @param cid cid
/// @param vid vid
/// @param pid pid
/// @param mac mac地址
/// @param data Custom data(自定义数据)
-(void)bleBroadcastWithCid:(int)cid vid:(int)vid pid:(int)pid mac:(NSString *_Nonnull)mac data:(NSData *_Nonnull)data;


@end


//MARK:Bluetooth Wifi protocol(蓝牙Wifi协议)
@protocol ElBleWifiDelegate <NSObject>

@@ -76,9 +94,9 @@ Callback WIFI password(回调WIFI密码)
-(void)bleWifiReceiceResponseType:(ELInetSetCmdType)type result:(ELSetBluetoothResponseType)result;

/**
获取会话码
获取会话码(deviceId)

@param code 会话码(为0时表示不存在)
@param code (deviceId) deviceId(0 means no:为0时表示不存在)
*/
-(void)bleWifiReceiveWifiSNCode:(int)code;

@@ -94,13 +112,16 @@ Callback WIFI password(回调WIFI密码)
-(void)bluetoothManagerScanedPeripherals:(NSArray<ELPeripheralModel *> *_Nonnull)peripherals;
//Special devices that can be bound in the callback, such as door locks(回调中扫描到的可以绑定的特殊设备,如门锁)
-(void)bluetoothManagerScanedCanBindSpecialPeripherals:(NSArray<ELPeripheralModel *> *_Nonnull)peripherals;
//Call back the scanned broadcast device(回调扫描到的广播设备)
-(void)bluetoothManagerScanedBroadcastPeripherals:(NSArray<ELPeripheralModel *> *_Nonnull)peripherals;

//Callback decrypted transparent data (A7 decrypted payload data)(回调解密后的数据(A7解密后payload数据))
-(void)bluetoothManagerReceiveData:(NSData *_Nonnull)data deviceType:(ELSupportDeviceType)type;

/**
回调透传数据
Callback transparent transmission data(回调透传数据)

@param data 透传数据(此数据不能以A6或A7开头)
@param data Transparent data transmission (this data cannot start with A6 or A7)(透传数据(此数据不能以A6或A7开头))
*/
-(void)bluetoothManagerReceivePassData:(NSData *_Nullable)data;

@@ -256,6 +277,10 @@ Callback WIFI password(回调WIFI密码)
BloodPressure:(NSArray<NSNumber *> *_Nullable)bloodPressureArray
Pressure:(NSArray<NSNumber *> *_Nullable)pressureArray;

/// Blood glucose units supported by callback supported devices(回调支持的设备支持的血糖单位)
/// @param bloodSugarUnitArray Blood glucose unit array(血糖单位数组)
-(void)bluetoothManagerReceiveSupportBloodSugarUnitArray:(NSArray<NSNumber *>* _Nullable)bloodSugarUnitArray;


/**
Set the result of the decoding key(设置解码密钥的结果)
@@ -264,6 +289,10 @@ Callback WIFI password(回调WIFI密码)
*/
-(void)bluetoothManagerReceiveSetKeyResult:(BOOL)result;

/// Device authorization result(设备授权结果)
/// @param result 结果
-(void)bluetoothManagerReceiveDeviceAuthorizeResult:(ELBluetoothDeviceAuthorizeResult)result;


@end

@@ -287,6 +316,9 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, weak) id<ELBluetoothManagerDelegate> delegate;
//Bluetooth wifi proxy(蓝牙wifi代理)
@property (nonatomic, weak) id<ElBleWifiDelegate> bleWifiDelegate;
//Bluetooth Broadcast Device Protocol(蓝牙广播设备协议)
@property (nonatomic, weak) id<ELBleBroadcastDelegate> broadDelegate;


//设置appkey和secret
+(void)setAppKey:(NSString *)key appSecret:(NSString *)secret;
@@ -324,7 +356,7 @@ NS_ASSUME_NONNULL_BEGIN

/**
General method of sending data (support data transparent transmission)(发送数据通用方法(支持数据透传))
@param data 数据
*/
-(void)sendData:(NSData *)data;
@@ -354,6 +386,8 @@ Callback decrypted A7 transparent data (payload part), type device type( 回调
Callback to scan special devices that can be bound, such as door locks(回调扫描到的可以绑定的特殊设备,如门锁)
*/
-(void)bluetoothScanCanBindSpecialPeripherals:(NSArray *)peripherals;
//Call back the scanned broadcast device(回调扫描到的广播设备)
-(void)bluetoothScanBroadcastPeripherals:(NSArray *)peripherals;

/**
Callback device basic information(回调设备基本信息)
@@ -366,6 +400,15 @@ Callback decrypted A7 transparent data (payload part), type device type( 回调
/// @param data Transparent data(透传数据)
-(void)bluetoothReceivePassData:(NSData *)data;

//Broadcast equipment dedicated(广播设备专用)
/// Broadcast device data
/// @param cid cid
/// @param vid vid
/// @param pid pid
/// @param mac mac
/// @param data custom data(自定义数据)
-(void)bluetoothReceiveBroadcastDataWithCid:(int)cid vid:(int)vid pid:(int)pid mac:(NSString *_Nonnull)mac data:(NSData *_Nonnull)data;

#pragma mark ============ Please rewrite the following methods in the subclass(子类重写方法) END==============


@@ -551,6 +594,9 @@ Callback decrypted A7 transparent data (payload part), type device type( 回调
*/
- (void)setKeyWithData:(NSData *)data;

/// Request device authorization(请求设备授权)
/// @param interval 时间截
-(void)requestDeviceAuthorization:(NSInteger)interval;


#pragma mark ============ Bluetooth WIFI calling method(蓝牙WIFI调用方法) ==============

+ 421
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELBodyIndexAlgorithmModel.h Ver arquivo

@@ -0,0 +1,421 @@
//
// ELBodyIndexAlgorithmModel.h
// Elink
//
// Created by iot_user on 2020/6/8.
// Copyright © 2020 iot_iMac. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ELSDKHeader.h"

typedef NS_ENUM(NSInteger, PHSex) {
PHSex_FEMALE = 0, //女
PHSex_MALE = 1,//男
};


//四肢肌肉指数
typedef NS_ENUM(NSUInteger, AILinkLimbMuscleIndexType) {
AILinkLimbMuscleIndexTypeUnknown = 0,//未知
AILinkLimbMuscleIndexTypeInsufficient = 1,//不足
AILinkLimbMuscleIndexTypeStandard = 2,//标准
AILinkLimbMuscleIndexTypeExcellent = 3,//优
};


//肥胖等级 标准判断
typedef NS_ENUM(NSUInteger, AILinkFatLevelType) {
AILinkFatLevelTypeUnknown = 0,//未知
AILinkFatLevelTypeStandard = 1,//标准
AILinkFatLevelTypeThin = 2,//偏瘦
AILinkFatLevelTypeBiased = 3,//偏重
AILinkFatLevelTypeUnderWeight = 4,//体重不足
AILinkFatLevelTypeOverWeight = 5, //超重
};


//蛋白量判断标准
typedef NS_ENUM(NSUInteger, AILinkProteinMassType) {
AILinkProteinMassTypeUnknown = 0,//未知
AILinkProteinMassTypeInsufficient = 1,//不足
AILinkProteinMassTypeStandard = 2,//标准
AILinkProteinMassTypeExcellent = 3,//优
};
//肌肉量判断标准
typedef NS_ENUM(NSUInteger, AILinkMuscleMassType) {
AILinkMuscleMassTypeUnknown = 0,//未知
AILinkMuscleMassTypeInsufficient = 1,//不足
AILinkMuscleMassTypeStandard = 2,//标准
AILinkMuscleMassTypeExcellent = 3,//优
};

//脂肪量判断标准
typedef NS_ENUM(NSInteger, AILinkFatMassType) {
AILinkFatMassTypeUnknown = 0,
AILinkFatMassTypeLow = 1, //偏低
AILinkFatMassTypeStandard = 2 , //标准
AILinkFatMassTypeLittleHigh = 3 , //偏高
AILinkFatMassTypeHigh = 4 , //高
};

//身体年龄判断标准
typedef NS_ENUM(NSUInteger, AILinkPhysicalAgeType) {
AILinkPhysicalAgeTypeUnknown = 0,//未知
AILinkPhysicalAgeTypeExcellent = 1,//优
AILinkPhysicalAgeTypeStandard = 2,//标准
AILinkPhysicalAgeTypeTooLarge = 3,//偏大
};

//蛋白率判断标准
typedef NS_ENUM(NSUInteger, AILinkProteinRateType) {
AILinkProteinRateTypeUnknown = 0,//未知
AILinkProteinRateTypeInsufficient = 1,//不足
AILinkProteinRateTypeStandard = 2,//标准
AILinkProteinRateTypeExcellent = 3,//优
};

//皮下脂肪判断标准
typedef NS_ENUM(NSUInteger, AILinkSubcutaneousFatType) {
AILinkSubcutaneousFatTypeUnknown = 0,//未知
AILinkSubcutaneousFatTypeInsufficient = 1,//不足
AILinkSubcutaneousFatTypeStandard = 2,//标准
AILinkSubcutaneousFatTypeHigh = 3,//偏高
};

//内脏脂肪判断标准
typedef NS_ENUM(NSUInteger, AILinkVisceralFatType) {
AILinkVisceralFatTypeUnknown = 0,//未知
AILinkVisceralFatTypeStandard = 1,//标准
AILinkVisceralFatTypeWarning = 2,//警惕
AILinkVisceralFatTypeDanger = 3,//危险
};

//基础代谢率判断标准
typedef NS_ENUM(NSUInteger, AILinkBMRType) {
AILinkBMRTypeUnknown = 0,//未知
AILinkBMRTypeLow = 1,//偏低
AILinkBMRTypeExcellent = 2,//优
};


//骨量判断标准
typedef NS_ENUM(NSUInteger, AILinkBoneMassType) {
AILinkBoneMassTypeUnknown = 0,//未知
AILinkBoneMassTypeInsufficient = 1,//不足
AILinkBoneMassTypeStandard = 2,//标准
AILinkBoneMassTypeExcellent = 3,//优
};
//水分判断标准
typedef NS_ENUM(NSUInteger, AILinkMoistureType) {
AILinkMoistureTypeUnknown = 0,//未知
AILinkMoistureTypeInsufficient = 1,//不足
AILinkMoistureTypeStandard = 2,//标准
AILinkMoistureTypeExcellent = 3,//优
};


//肌肉率判断标准
typedef NS_ENUM(NSUInteger, AILinkMuscleRateType) {
AILinkMuscleRateTypeUnknown = 0,//未知
AILinkMuscleRateTypeInsufficient = 1,//不足
AILinkMuscleRateTypeStandard = 2,//标准
AILinkMuscleRateTypeExcellent = 3,//优
};


//体脂率BFR判断标准
typedef NS_ENUM(NSInteger, AILinkBFRType) {
AILinkBFRTypeUnknown = 0,
AILinkBFRTypeLow = 1, //偏低
AILinkBFRTypeStandard = 2 , //标准
AILinkBFRTypeLittleHigh = 3 , //偏高
AILinkBFRTypeHigh = 4 , //高
};

//BMI判断标准
typedef NS_ENUM(NSUInteger, AILinkBMIType) {
AILinkBMITypeUnknown = 0,//未知
AILinkBMITypeThin = 1,//偏瘦
AILinkBMITypeStandard = 2,//标准
AILinkBMITypeFatty = 3,//偏胖
AILinkBMITypeObesity = 4 //肥胖
};

//体重判断标准
typedef NS_ENUM(NSUInteger, AILinkWeightType) {
AILinkWeightTypeUnknown = 0, //未知
AILinkWeightTypeThin = 1,//偏瘦
AILinkWeightTypeStandard = 2,//标准
AILinkWeightTypeFatty = 3,//偏胖
AILinkWeightTypeObesity = 4 //肥胖
};


NS_ASSUME_NONNULL_BEGIN

@interface ELBodyIndexAlgorithmModel : NSObject
#pragma mark ============ 标准判断临界值数组 ==============

/// 四肢肌肉指数 标准判断
/// @param sex 性别
/// @param cmHeight 身高(cm)
+(NSArray<NSString *> *)getLimbMuscleIndexScopeWithSex:(PHSex)sex cmHeight:(float)cmHeight;

/// 蛋白量 标准判断
/// @param weight 体重(KG)
/// @param sex 性别
/// @param weightUnit 体重单位
+ (NSArray<NSString *> *)getProteinScope:(NSString *)weight sex:(PHSex)sex weightUnit:(ELDeviceWeightUnit)weightUnit;

/// 肌肉量 标准判断2个临界值
/// @param weight 体重(kg)
/// @param sex 性别
/// @param weightUnit 体重单位
+ (NSArray<NSString *> *)getMuscleMassScope:(NSString *)weight Sex:(PHSex)sex weightUnit:(ELDeviceWeightUnit)weightUnit;

/// 脂肪量 标准判断3个临界值
/// @param weight 体重(kg)
/// @param sex 性别
/// @param age 年龄
/// @param weightUnit 体重单位
+ (NSArray<NSString *> *)getFatScope:(NSString *)weight sex:(PHSex)sex age:(float)age weightUnit:(ELDeviceWeightUnit)weightUnit;
/// 身体年龄 标准判断2个临界值
/// @param age 年龄
+ (NSArray<NSString *> *)getPhysicalAgeScopeAge:(int)age;

/// 蛋白率 标准判断
/// @param sex 性别
+ (NSArray<NSString *> *)getProteinRateScopeSex:(PHSex)sex;

/// 皮下脂肪 标准判断2个临界值
/// @param sex 性别
+ (NSArray<NSString *> *)getSubcutaneousFatScopeSex:(PHSex)sex;

/// 内脏脂肪 标准判断2个临界值
+ (NSArray<NSString *> *)getVisceralfatScope;

/// 基础代谢率 标准判断1个临界值
/// @param BMR 基础代谢率
/// @param age 年龄
/// @param weight 体重(kg)
/// @param sex 性别
+ (NSArray<NSString *> *)getBMRScope:(float)BMR age:(float)age weight:(float)weight sex:(PHSex)sex;
/// 骨量 标准判断2个临界值
/// @param sex 性别
/// @param weight 体重(kg)
/// @param weightUnit 体重单位
+ (NSArray<NSString *> *)getBonemassScopeSex:(PHSex)sex weight:(float)weight weightUnit:(ELDeviceWeightUnit)weightUnit;

/// 水分 标准判断2个临界值
/// @param sex 性别
+ (NSArray<NSString *> *)getMoistureScopeSex:(PHSex)sex;
/// 肌肉率 标准判断2个临界值
/// @param sex 性别
+ (NSArray<NSString *> *)getMuscleScopeSex:(PHSex)sex;
/// 体脂率 标准判断三个临界值
/// @param sex 性别
/// @param age 年龄
+ (NSArray<NSString *> *)getFatRateScopeSex:(PHSex)sex age:(float)age;
/// BMI 标准判断的三个临界值
/// @param sex 性别
/// @param age 年龄
+ (NSArray<NSString *> *)getBMIWithSex:(PHSex)sex age:(float)age;

/// 体重标准判断的三个临界值
/// @param height 身高(cm)
/// @param weightUnit 体重单位
+ (NSArray<NSString *> *)getWeightScopeHeight:(NSString *)height weightUnit:(ELDeviceWeightUnit)weightUnit;

#pragma mark ============ 判断标准数组 ==============
//四肢肌肉指数标准词条
+(NSArray<NSNumber *> *)getLimbMuscleIndexStandardArray;
///1 体重 判断标准词条Array<AILinkWeightType>
+ (NSArray<NSNumber *> *)getWeightStandardArray;
///2 BMI 判断标准词条Array<AILinkBMIType>
+ (NSArray<NSNumber *> *)getBMIStandardArray;
///3 体脂率 判断标准词条Array<AILinkBFRType>
+ (NSArray<NSNumber *> *)getFatRateStandardArray;
///4 肌肉率 判断标准词条Array<AILinkMuscleRateType>
+ (NSArray<NSNumber *> *)getMuscleStandardArray;
///5 水分 判断标准词条Array<AILinkMoistureType>
+ (NSArray<NSNumber *> *)getMoistureStandardArray;
///6 骨量 判断标准词条Array<AILinkBoneMassType>
+ (NSArray<NSNumber *> *)getBonemassStandardArray;
///7 基础代谢率 判断标准词条Array<AILinkBMRType>
+ (NSArray<NSNumber *> *)getBMRStandardArray;
///8 内脏脂肪 判断标准词条Array<AILinkVisceralFatType>
+ (NSArray<NSNumber *> *)getVisceralfatStandardArray;
///9 皮下脂肪 判断标准词条Array<AILinkSubcutaneousFatType>
+ (NSArray<NSNumber *> *)getSubcutaneousFatStandardArray;
///10 蛋白率 判断标准词条Array<AILinkProteinRateType>
+ (NSArray<NSNumber *> *)getProteinRateStandardArray;
///11 身体年龄 判断标准词条Array<AILinkPhysicalAgeType>
+ (NSArray<NSNumber *> *)getPhysicalAgeStandardArray;
///14 脂肪量 判断标准词条Array<AILinkFatMassType>(与体脂率是一样的)
+ (NSArray<NSNumber *> *)getFatmassStandardArray;
///16 肌肉量 判断标准词条Array<AILinkMuscleMassType>(与肌肉率是一样的)
+ (NSArray<NSNumber *> *)getMuscleMassStandardArray;
///17 蛋白量 判断标准词条Array<AILinkProteinMassType>(与蛋白率是一样的)
+ (NSArray<NSNumber *> *)getProteinStandardArray;
///18 肥胖等级 判断标准词条Array<AILinkFatLevelType>
+ (NSArray<NSNumber *> *)getFatlevelStandardArray;

#pragma mark ============ 标准判断 ==============

/// 获取四肢肌肉指数等级
/// @param index 四肢肌肉指数
/// @param sex 性别
+(AILinkLimbMuscleIndexType)getLimbDisplay:(float)index sex:(PHSex)sex cmHeight:(float)cmHeight;

/**
* 18 肥胖等级 标准判断
*
* @param fatlevel 传入0~4
*
* @return 标准、偏瘦、偏重、体重不足、超重、@""
*/
+ (AILinkFatLevelType)getFatlevelDisplay:(NSInteger)fatlevel;

///17 蛋白量 标准判断(与蛋白率是一样的)
/// @param proteinMass 蛋白量(kg)
/// @param sex 性别
/// @param kgWeight 体重(kg)
+ (AILinkProteinMassType)getProteinDisplay:(float)proteinMass sex:(PHSex)sex kgWeight:(float)kgWeight;

///16 肌肉量 标准判断(与肌肉率是一样的)
/// @param muscle 肌肉量(KG)
/// @param sex 性别
/// @param kgWeight 体重(KG)
+ (AILinkMuscleMassType)getMuscleMassDisplay:(float)muscle sex:(PHSex)sex kgWeight:(float)kgWeight;

///14 脂肪量 标准判断(与体脂率是一样的)
/// @param fatMass 脂肪量(KG)
/// @param sex 性别
/// @param age 年龄
/// @param kgWeight 体重(KG)
+ (AILinkFatMassType)getFatDisplay:(float)fatMass sex:(PHSex)sex age:(float)age kgWeight:(float)kgWeight;

/**
* 身体年龄 标准判断
*
* @param physicalAge 身体年龄
* @param age 年龄
*
* @return 偏大、标准、偏小、Null
*/
+ (AILinkPhysicalAgeType)getPhysicalAgeDisplay:(int)physicalAge age:(int)age;

/**
* 蛋白率 标准判断
*
* @param proteinRate 蛋白率
* @param sex 性别
*
* @return 偏低、标准、偏高、Null
*/
+ (AILinkProteinRateType)getProteinRateDisplay:(float)proteinRate sex:(PHSex)sex;

/**
* 皮下脂肪 标准判断
*
* @param proteinRate 皮下脂肪
* @param sex 性别
*
* @return --.--
*/
+ (AILinkSubcutaneousFatType)getSubcutaneousFatDisplay:(float)proteinRate sex:(PHSex)sex;

/**
* 内脏脂肪 标准判断
*
* @param visceralfat 内脏脂肪
*
* @return 标准、偏高、高、Null
*/
+ (AILinkVisceralFatType)getVisceralfatDisplay:(float)visceralfat;

/**
* 基础代谢率 标准判断
*
* @param BMR 基础代谢率
* @param age 年龄
* @param weight 体重
* @param sex 性别
*
* @return 标准、未达标
*/
+ (AILinkBMRType)getBMRDisplay:(float)BMR age:(float)age weight:(float)weight sex:(PHSex)sex;

/**
* 骨量 标准判断
*
* @param bonemass 骨量
* @param sex 性别
* @param weight 体重
*
* @return 偏低、标准、偏高、Null
*/
+ (AILinkBoneMassType)getBonemassDisplay:(float)bonemass sex:(PHSex)sex weight:(float)weight;

/**
* 水分标准
*
* @param moisture 水分
* @param sex 性别
*
* @return 偏低、标准、偏高、Null
*/
+ (AILinkMoistureType)getMoistureDisplay:(float)moisture sex:(PHSex)sex;

/**
* 肌肉率 标准判断
*
* @param muscle 肌肉量(kg)
* @param sex 性别
* @return 偏低、标准、偏高、Null
*
*/
+ (AILinkMuscleRateType)getMuscleDisplay:(float)muscle sex:(PHSex)sex;

/**
* 体脂率 标准判断
* @param fatRate 体脂率
* @param sex 性别
* @param age 年龄
* @return 偏低、标准、偏高、高、Null
*/
+ (AILinkBFRType)getFatRateDisplay:(float)fatRate sex:(PHSex)sex age:(float)age;

/**
* BMI 标准判断
*
* @param BMI BMI
*
* @return 偏瘦、标准、偏胖、肥胖、--.--
*/
+ (AILinkBMIType)getBMIDisplay:(float)BMI sex:(PHSex)sex age:(float)age;
/**
* 体重 标准判断
*
* @param height 身高
* @param weight 体重
*
* @return 偏瘦、标准、偏胖、肥胖、Null
*/
+ (AILinkWeightType)getWeightDisplay:(NSString *)height weight:(NSString *)weight;


/// 获取标准体重(单位:kg)
/// @param sex 性别
/// @param height 身高(CM)
+ (double) getStandardWeight:(NSInteger)sex andheight:(NSInteger)height;


/// 获取肥胖等级
/// @param weight 体重(KG)
/// @param standardWeight 标准体重(KG)
+ (AILinkFatLevelType)getfatLevelWithweight:(double)weight andSatndardWeight:(double)standardWeight;
@end

NS_ASSUME_NONNULL_END

+ 38
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELBroadcastScaleBleHeader.h Ver arquivo

@@ -0,0 +1,38 @@
//
// ELBroadcastScaleBleHeader.h
// Elink
//
// Created by iot_user on 2020/8/21.
// Copyright © 2020 iot_iMac. All rights reserved.
//

#ifndef ELBroadcastScaleBleHeader_h
#define ELBroadcastScaleBleHeader_h

#import "ELSDKHeader.h"


typedef NS_ENUM(NSUInteger, BroadcastScaleTestStatus) {
//Weighing(正在测量体重)
BroadcastScaleTestStatusWeightTesting = 0,
//Impedance is being measured (the impedance value is 0 at this time)(正在测量阻抗(此时阻抗数值为 0))
BroadcastScaleTestStatusADCTesting,
//Impedance measurement succeeded(阻抗测量成功)
BroadcastScaleTestStatusADCTestSuccess,
//Impedance measurement failed (the impedance value is 0xFFFF at this time)(阻抗测量失败(此时阻抗数值为 0xFFFF))
BroadcastScaleTestStatusADCTestFailed,
//End of test(测试结束)
BroadcastScaleTestStatusTestEnd = 0xFF,
};

typedef NS_ENUM(NSUInteger, BroadcastScaleWeightType) {
//Real-time weight(实时重量)
BroadcastScaleWeightTypeRealTime = 0,
//Stable weight(稳定重量)
BroadcastScaleWeightTypeStable,
};



#endif /* ELBroadcastScaleBleHeader_h */

+ 39
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELBroadcastScaleBleManager.h Ver arquivo

@@ -0,0 +1,39 @@
//
// ELBroadcastScaleBleManager.h
// Elink
//
// Created by iot_user on 2020/8/21.
// Copyright © 2020 iot_iMac. All rights reserved.
//

#import "ELBluetoothManager.h"
#import "ELBroadcastScaleDataModel.h"

@protocol BroadcastScaleBleDelegate <NSObject>

@optional

//Bluetooth connection status(蓝牙连接状态)
-(void)broadcastScaleBleUpdateState:(ELBluetoothState)state;

//
-(void)broadcastScaleBleDataModel:(ELBroadcastScaleDataModel *_Nonnull)model;

@end



NS_ASSUME_NONNULL_BEGIN

@interface ELBroadcastScaleBleManager : ELBluetoothManager

@property (nonatomic, weak) id<BroadcastScaleBleDelegate> broadcastScaleBleDelegate;


+(instancetype)shareManager;



@end

NS_ASSUME_NONNULL_END

+ 47
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELBroadcastScaleDataModel.h Ver arquivo

@@ -0,0 +1,47 @@
//
// ELBroadcastScaleDataModel.h
// Elink
//
// Created by iot_user on 2020/8/21.
// Copyright © 2020 iot_iMac. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ELBroadcastScaleBleHeader.h"

NS_ASSUME_NONNULL_BEGIN

@interface ELBroadcastScaleDataModel : NSObject

@property (nonatomic, assign) int cid;
@property (nonatomic, assign) int vid;
@property (nonatomic, assign) int pid;
@property (nonatomic, copy) NSString *mac;
//Data serial number(数据流水号)
@property (nonatomic, assign) int serialNumber;
//Measurement status(测量状态)
@property (nonatomic, assign) BroadcastScaleTestStatus testStatus;
//Measurement status(温度单位)
@property (nonatomic, assign) ELDeviceTemperatureUnit tempUnit;
//Weight unit(体重单位)
@property (nonatomic, assign) ELDeviceWeightUnit weightUnit;
//Weight decimal point(体重小数点)
@property (nonatomic, assign) int weightPoint;
//Weight type(体重类型)
@property (nonatomic, assign) BroadcastScaleWeightType weightType;
//weight(体重)
@property (nonatomic, copy) NSString *weight;
//impedance(阻抗)
@property (nonatomic, assign) int adc;
//Algorithm bit(算法位)
@property (nonatomic, assign) int algorithmId;
//temperature(温度)
@property (nonatomic, copy) NSString *temperature;
//time(时间)
@property (nonatomic, assign) long long createTime;



@end

NS_ASSUME_NONNULL_END

+ 54
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELEightScaleBleDataModel.h Ver arquivo

@@ -0,0 +1,54 @@
//
// ELEightScaleDataModel.h
// Elink
//
// Created by iot_user on 2020/6/4.
// Copyright © 2020 iot_iMac. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ELEightScaleSDKHeader.h"

NS_ASSUME_NONNULL_BEGIN


@interface ELEightScaleBleDataModel : NSObject
//Weight display data(体重显示数据)
@property (nonatomic, copy) NSString *weight;
//Weight decimal point(体重小数点)
@property (nonatomic, assign) NSInteger weightPoint;
//Weight unit(体重单位)
@property (nonatomic, assign) ELDeviceWeightUnit weightUnit;
//Impedance type(阻抗类型)
@property (nonatomic, assign) EightScaleAdcType adcType;
//Impedance value(阻抗值)
@property (nonatomic, assign)unsigned int feetAdc;//Two-foot impedance(双脚阻抗)
@property (nonatomic, assign)unsigned int handsAdc;//Hands resistance(双手阻抗)
@property (nonatomic, assign)unsigned int leftHandAdc;//Left hand impedance(左手阻抗)
@property (nonatomic, assign)unsigned int rightHandAdc;//Right hand impedance(右手阻抗)
@property (nonatomic, assign)unsigned int leftFootAdc;//Left foot impedance(左脚阻抗)
@property (nonatomic, assign)unsigned int rightFootAdc;//Right foot impedance(右脚阻抗)
@property (nonatomic, assign)unsigned int LWholeBodyAdc;//Right foot impedance(左全身阻抗)
@property (nonatomic, assign)unsigned int RWholeBodyAdc;//Right whole body impedance(右全身阻抗)
@property (nonatomic, assign)unsigned int RHand_LFootAdc;//Impedance of right hand and left foot(右手左脚阻抗)
@property (nonatomic, assign)unsigned int LHand_RFootAdc;//Impedance of left hand and right foot(左手右脚阻抗)
@property (nonatomic, assign)unsigned int trunkAdc;//Torso impedance(躯干阻抗)

//Algorithm Id(算法Id)
@property (nonatomic, assign) int algorithmID;
//Heart rate(心率)
@property (nonatomic, assign) int heartRate;

//Temperature display value(温度显示值)
@property (nonatomic, copy) NSString *temp;
//Temperature decimal point(温度小数点)
@property (nonatomic, assign) int tempPoint;
//Temperature unit(温度单位)
@property (nonatomic, assign) ELDeviceTemperatureUnit tempUnit;
//time(时间)
@property (nonatomic, assign) long long createTime;


@end

NS_ASSUME_NONNULL_END

+ 87
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELEightScaleBleManager.h Ver arquivo

@@ -0,0 +1,87 @@
//
// ELEightScaleBleManager.h
// Elink
//
// Created by iot_user on 2020/6/1.
// Copyright © 2020 iot_iMac. All rights reserved.
//

#import "ELBluetoothManager.h"
#import "ELEightScaleSDKHeader.h"
#import "ELEightScaleBleDataModel.h"

NS_ASSUME_NONNULL_BEGIN

@protocol EightScaleBleDeletegate <NSObject>

@optional

/// Bluetooth connection status(蓝牙连接状态)
/// @param state connection status(连接状态)
-(void)eightScaleBleReceiveState:(ELBluetoothState)state;

/// Nearby eight-electrode equipment(附近的八电极设备)
/// @param devices Eight electrode equipment list(八电极设备列表)
-(void)eightScaleBlReceiveDevices:(NSArray<ELPeripheralModel *> *)devices;

/// Return weighed weight data(返回称量的体重数据)
/// @param weightStruct Weight data structure(体重数据结构体)
-(void)eightScaleBleReceiveWeightData:(EightScaleWeightStruct)weightStruct;


/// Return impedance data(返回阻抗数据)
/// @param adcStruct Impedance data structure(阻抗数据结构体)
-(void)eightScaleBleReceiveAdcData:(EightScaleAdcStruct)adcStruct;

/// Return heart rate data(返回心率数据)
/// @param testStep Heart rate measurement process(心率测量过程)
/// @param heartRate Heart rate data(心率数据)
-(void)eightScaleBleReceiveHeartRateTestStep:(EightScaleHeartRateTestStep)testStep heartRate:(int)heartRate;

/// Return temperature data(返回温度数据)
/// @param tempStruct Temperature data structure(温度数据结构体)
-(void)eightScaleBleReceiveTempData:(EightScaleTempStruct)tempStruct;

///Measurement completed(测量完成)
-(void)eightScaleBleReceiveTestComplete;

/// Recall measurement data(回调测量数据)
/// @param dataModel Measurement data(测量数据)
-(void)eightScaleBleReceiveTestData:(ELEightScaleBleDataModel *)dataModel;

/// Error code sent on the device(设备上发错误码)
/// @param errorCode Error code (1: overweight)(错误码(1:超重))
-(void)eightScaleBleReceiveErrorCode:(int)errorCode;

/// Switch temperature unit result(切换温度单位结果)
/// @param result 结果
-(void)eightScaleBleReceiveSwitchTempUnitResult:(EightScaleSwitchUnitResult)result;
/// Switch weight unit result(切换体重单位结果)
/// @param result 结果
-(void)eightScaleBleReceiveSwitchWeightUnitResult:(EightScaleSwitchUnitResult)result;
@end

@interface ELEightScaleBleManager : ELBluetoothManager
//Current measurement status(当前测量状态)
@property (nonatomic, assign) EightScaleTestStatus testStatus;


@property (nonatomic, weak) id<EightScaleBleDeletegate> eightScaleDelegate;



+(instancetype)shareManager;


#pragma mark ============ 发送数据指令给蓝牙 ==============

/// Switch weight unit(切换体重单位)
/// @param unit Weight unit(体重单位)
-(void)eightScaleSwitchWeightUnit:(ELDeviceWeightUnit)unit;

/// Switch temperature unit(切换温度单位)
/// @param unit Temperature unit(温度单位)
-(void)eightScaleSwitchTempUnit:(ELDeviceTemperatureUnit)unit;
@end

NS_ASSUME_NONNULL_END

+ 101
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELEightScaleSDKHeader.h Ver arquivo

@@ -0,0 +1,101 @@
//
// ELEightScaleSDKHeader.h
// Elink
//
// Created by iot_user on 2020/6/3.
// Copyright © 2020 iot_iMac. All rights reserved.
//

#ifndef ELEightScaleSDKHeader_h
#define ELEightScaleSDKHeader_h
#import "ELSDKHeader.h"


typedef NS_ENUM(NSUInteger, EightScaleWeightType) {
EightScaleWeightTypeAuto = 0x01,//Real-time weight(实时体重)
EightScaleWeightTypeStable = 0x02,//Stabilize weight(稳定体重)
};

//Weight data(体重数据)
typedef struct EightScaleWeightStruct{
//Weight type(体重类型)
EightScaleWeightType weightType;
//Original weight(体重原始值)
int weight;
//Weight decimal point(体重小数点)
int point;
//unit(单位)
ELDeviceWeightUnit unit;
} EightScaleWeightStruct;

//Impedance measurement process(阻抗测量过程)
typedef NS_ENUM(NSUInteger, EightScaleAdcTestStep) {
EightScaleAdcTestStepTesting = 0x01,//Measuring impedance(测阻抗中)
EightScaleAdcTestStepFailure = 0x02,//Impedance measurement failed(测阻抗失败)
//The impedance measurement is successful, bring the impedance data, and use the APP algorithm (APP will calculate according to the algorithm identification of byte7)
//测阻抗成功,带上阻抗数据,并使用APP算法(APP 会根据byte7的算法标识进行计算)
EightScaleAdcTestStepSuccess = 0x03,
EightScaleAdcTestStepTestEnd = 0x04,//End of impedance measurement.(测阻抗结束。)
};
// 阻抗类型
typedef NS_ENUM(NSUInteger, EightScaleAdcType) {
EightScaleAdcTypeFeet = 0x00,//Two-foot impedance(双脚阻抗)
EightScaleAdcTypeHands = 0x01,//Hands resistance(双手阻抗)
EightScaleAdcTypeLeftHand = 0x02,//Left hand impedance(左手阻抗)
EightScaleAdcTypeRightHand = 0x03,//Right hand impedance(右手阻抗)
EightScaleAdcTypeLeftFoot = 0x04,//Left foot impedance(左脚阻抗)
EightScaleAdcTypeRightFoot = 0x05,//Right foot impedance(右脚阻抗)
EightScaleAdcTypeLWholeBody = 0x06,//Left whole body impedance(左全身阻抗)
EightScaleAdcTypeRWholeBody = 0x07,//Right whole body impedance(右全身阻抗)
EightScaleAdcTypeRHand_LFoot = 0x08,//Impedance of right hand and left foot(右手左脚阻抗)
EightScaleAdcTypeLHand_RFoot = 0x09,//Impedance of left hand and right foot(左手右脚阻抗)
EightScaleAdcTypeTrunk = 0x0A,//Torso impedance(躯干阻抗)
};
//Impedance data(阻抗数据)
typedef struct EightScaleAdcStruct{
//Impedance measurement stage(阻抗测量阶段)
EightScaleAdcTestStep adcTestStep;
//Impedance type(阻抗类型)
EightScaleAdcType adcType;
//Impedance value(阻抗值)
unsigned int adc;
//Algorithm Id(算法Id)
int algorithmID;
}EightScaleAdcStruct;

//Heart rate measurement process(心率测量过程)
typedef NS_ENUM(NSUInteger, EightScaleHeartRateTestStep) {
EightScaleHeartRateTestStepTesting = 0x01,//Heart rate measurement(心率测量中)
EightScaleHeartRateTestStepSuccess = 0x02,//Successful heart rate measurement, bring heart rate data(测心率成功,带上心率数据)
EightScaleHeartRateTestStepFailure = 0x03,//Failed to measure heart rate(测心率失败)
};

//Temperature data(温度数据)
typedef struct EightScaleTempStruct{
//Positive and negative temperature(正负温度)
BOOL negative;
//temperature(温度)
int temp;
//Decimal point(小数点)
int point;
//unit(单位)
ELDeviceTemperatureUnit unit;
}EightScaleTempStruct;


typedef NS_ENUM(NSUInteger, EightScaleSwitchUnitResult) {
EightScaleSwitchUnitResultSuccess =0,//Successful operation(操作成功)
EightScaleSwitchUnitResultFailure =1,//operation failed(操作失败)
EightScaleSwitchUnitResultOperation =2,//In operation(正在操作中)
};

//Measurement status(测量状态)
typedef NS_ENUM(NSUInteger, EightScaleTestStatus) {
EightScaleTestStatusIdle = 0,//Idle(闲置)
EightScaleTestStatusTesting = 1,//Testing(测量中)
EightScaleTestStatusComplete = 2,//Complete(测量完成)
EightScaleTestStatusError = 3,//Error(测量出错)
};

#endif /* ELEightScaleSDKHeader_h */

+ 36
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELHeightAlgorithmusModel.h Ver arquivo

@@ -0,0 +1,36 @@
//
// ELHeightAlgorithmusModel.h
// Elink
//
// Created by iot_user on 2020/6/9.
// Copyright © 2020 iot_iMac. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ELSDKHeader.h"
NS_ASSUME_NONNULL_BEGIN

//inch转cm的系数
extern double const ELHeight_INCH_CM_CONST;
//feet转inch的系数
extern double const ELHeight_FEET_INCH_CONST;
extern NSString *const ELHeightFeetSymbol;
extern NSString *const ELHeightInchSymbol;

@interface ELHeightAlgorithmusModel : NSObject

/// 获取身高显示值
/// @param targetUnit 要显示的单位
/// @param origHeightShow 原来的显示数据
/// @param origHeightUnit 原来数据的单位
/// @param origHeightPoint 原来的数据小数点
+ (NSString *)getHeightShowStrWithTargetUnit:(ELDeviceHeightUnit)targetUnit origHeightShow:(NSString *)origHeightShow origHeightUnit:(ELDeviceHeightUnit)origHeightUnit origHeightPoint:(NSUInteger)origHeightPoint;

/// 获取身高(CM)
/// @param heightShow 原有数据
/// @param unit 原有数据单位
/// @param point 小数点
+ (NSString *)getCmWithHeightShowStr:(NSString *)heightShow heightUnit:(ELDeviceHeightUnit)unit heightPoint:(NSUInteger)point;
@end

NS_ASSUME_NONNULL_END

+ 5
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELPeripheralModel.h Ver arquivo

@@ -62,6 +62,11 @@ NS_ASSUME_NONNULL_BEGIN
/** Device version numbe(设备版本号) */
@property (nonatomic, copy) NSString *version;

/**
* 华盛达手表要用这个属性: 是否已经跟系统配对
*/
@property(nonatomic, assign) BOOL paired;

/**
Screening equipment(筛选设备)


+ 44
- 10
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELSDKHeader.h Ver arquivo

@@ -43,7 +43,7 @@ typedef NS_ENUM(NSUInteger, ELInetGetCmdType) {
ELInetGetCmdTypeGetSendKeyState = 0x31, //-APP reads the result of sending the decoding key(APP读取下发解码秘钥的结果)
ELInetGetCmdTypeGetSmartLockA6Data = 0x34, //-Door lock 0x34 represents the A6 protocol (see the second level command for details)(门锁0x34代表A6协议(具体见二级指令))
ELInetGetCmdTypeGetBasicInfoData = 0x36, //Obtain basic device information data(获取设备基本信息数据)
#pragma mark ============ 蓝牙Wifi ==============
#pragma mark ============ Begin 蓝牙Wifi ==============
ELInetGetCmdTypeBleWifiGetNearbyWifi = 0x80, //Get nearby Wifi(获取附近Wifi)
ELInetGetCmdTypeBleWifiReceiveWifiName = 0x81, //Reply to wifi name(回复wifi名字)
ELInetGetCmdTypeBleWifiReceiveWifiMac = 0x82, //Reply to wifi mac(回复wifi mac)
@@ -53,7 +53,10 @@ typedef NS_ENUM(NSUInteger, ELInetGetCmdType) {
ELInetGetCmdTypeBleWifiGetDTIMInterval = 0x8A, //Get DTIM interval(获取DTIM间隔)
ELInetGetCmdTypeBleWifiGetURL = 0x8C, //Get visited sites(获取访问的网站)
ELInetGetCmdTypeBleWifiGetPort = 0x8E, //Get access port number(获取访问的端口号)
ELInetGetCmdTypeBleWifiGetSNNumber = 0x93, //Get SN number (session code)(获取SN号(会话码))
ELInetGetCmdTypeBleWifiGetSNNumber = 0x93, //Get SN number (session code:deviceId)(获取SN号(会话码:设备ID))
#pragma mark ============End 蓝牙Wifi ==============
ELInetGetCmdTypeRequestAuthorize = 0x7F, //Request device authorization (请求设备授权)
ELInetGetCmdTypeToothbrushA6Data = 0xC0, //A6 data for toothbrush(牙刷专用A6数据,详情请见协议的2级指令)(See the second order for details)
};
//Instruction type set by Inet(Inet设置的指令类型)
typedef NS_ENUM(NSUInteger, ELInetSetCmdType) {
@@ -86,7 +89,8 @@ typedef NS_ENUM(NSUInteger, ELInetSetCmdType) {
ELInetSetCmdTypeBleWifiSetWifiURL = 0x8B, //设置访问的URL
ELInetSetCmdTypeBleWifiSetWifiPort = 0x8D, //设置端口号
};
//Response to Bluetooth after device(给蓝牙进行设备后的响应)

//Response to Bluetooth after device(给蓝牙进行设置后的响应)
typedef NS_ENUM(NSUInteger, ELSetBluetoothResponseType) {
ELSetBluetoothResponseTypeSuccess =0 , //success(成功)
ELSetBluetoothResponseTypeFailure =1 , //failure(失败)
@@ -107,8 +111,15 @@ typedef NS_ENUM(NSUInteger, ELSupportDeviceType) {
ELSupportDeviceTypeBodyFatScale = 0x000E , //Body fat scale(体脂秤)
ELSupportDeviceTypeSmatLockRemote = 0x0010 , //Smart door lock remote control(智能门锁遥控器)
ELSupportDeviceTypeBLE_WIFIScale = 0x0011 , //Ble and wifi Scale(蓝牙Wifi体脂秤)
ELSupportDeviceTypeAnemometer = 0x0014 , //anemometer(风速计)
ELSupportDeviceTypeBLE_WIFIToothbrush = 0x0012, //Bluetooth and wifi toothbrush(蓝牙wifi牙刷)
ELSupportDeviceTypeBLE_EightScale = 0x0013 , //Eight electrode scale(八电极蓝牙秤)
ELSupportDeviceTypeAnemometer = 0x0014 , //anemometer(风速计),0x0015
ELSupportDeviceTypeClampMeter = 0x0015 , //clamp meter(钳表)
ELSupportDeviceTypeWatch = 0x001D , //华盛达手表
ELSupportDeviceTypeBloodSugar = 0x001C , //blood sugar(血糖仪)
ELSupportDeviceTypeBroadcastScale = 65536 , //Broadcast body fat scale(广播体脂秤)
};
//Communication mode(通信模式)
@@ -150,7 +161,6 @@ struct ELUUIDStruct {
char *serviceUUID; //Service UUID(服务UUID)
char *writeUUID; //For APP to send data to MCU (write)(用于 APP 下发数据到 MCU(write))
char *notifyUUID; //Used for MCU data transfer to APP (notify)(用于 MCU 数据传输到 APP (notify))
};

struct ELAutoSleepTimeStruct {
@@ -186,13 +196,15 @@ typedef NS_ENUM(NSInteger, ELDeviceUnitType) {
/** Weight(重量) */
ELDeviceUnitType_Weight = 1 ,
/** length(长度) */
ELDeviceUnitType_Height ,
ELDeviceUnitType_Height = 2 ,
/** temperature(温度) */
ELDeviceUnitType_Temperature ,
ELDeviceUnitType_Temperature = 3 ,
/** Pressure(血压) */
ELDeviceUnitType_BloodPressure ,
ELDeviceUnitType_BloodPressure = 4 ,
/** Tire pressure(轮胎胎压压力) */
ELDeviceUnitType_Pressure ,
ELDeviceUnitType_Pressure = 5 ,
/**Blood sugar(血糖单位)*/
ELDeviceUnitType_BloodSugar = 6 ,
};

#define AiLinkBleWeightUnit_KG_Str @"kg"
@@ -240,7 +252,8 @@ typedef NS_ENUM(NSInteger, ELDeviceHeightUnit) {
ELDeviceHeightUnit_Inch = 0x01 ,
/** feet:inch */
ELDeviceHeightUnit_FT_IN = 0x02 ,
//
ELDeviceHeightUnit_M = 0x03 ,
/** Unsupported unit */
ELDeviceHeightUnit_Fail = 0xFF ,
};
@@ -297,6 +310,19 @@ typedef NS_ENUM(NSInteger, ELDevicePressureUnit) {
ELDevicePressureUnit_Fail ,
};

#define AiLinkBleBloodSugarUnit_mmolStr @"mmol/L"
#define AiLinkBleBloodSugarUnit_mgStr @"mg/dL"

#define AiLinkBleBloodSugarUnitDic @{@(ELDeviceBloodSugarUnit_mmol_L):AiLinkBleBloodSugarUnit_mmolStr,@(ELDeviceBloodSugarUnit_mg_dL):AiLinkBleBloodSugarUnit_mgStr,}

typedef NS_ENUM(NSUInteger, ELDeviceBloodSugarUnit) {
ELDeviceBloodSugarUnit_mmol_L = 0x01,//mmol/L 毫摩尔/升
ELDeviceBloodSugarUnit_mg_dL = 0x02,//mg/dL 毫克/分升
ELDeviceBloodSugarUnit_Fail ,
};



#pragma mark ============ 枚举 ==============
typedef NS_ENUM(NSUInteger, ELBluetoothState) {
ELBluetoothStateUnavailable, //Bluetooth is not available(蓝牙不可用)
@@ -317,5 +343,13 @@ typedef NS_ENUM(NSUInteger, ELBluetoothUserSex) {
ELBluetoothUserSex_Woman = 0x00,//female(女)
ELBluetoothUserSex_Man = 0x01,//male(男)
};
//设备授权结果
typedef NS_ENUM(NSUInteger, ELBluetoothDeviceAuthorizeResult) {
ELBluetoothDeviceAuthorizeResultNoAuth =0,//No(没有)
ELBluetoothDeviceAuthorizeResultAuthorized ,//Authorized(已经授权)
ELBluetoothDeviceAuthorizeResultNoNeed ,//No authorization required(不需要授权)
ELBluetoothDeviceAuthorizeResultSuccess ,//Authorization succeeded(授权成功)
};


#endif /* ELSDKHeader_h */

+ 25
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELTempAlgorithmusModel.h Ver arquivo

@@ -0,0 +1,25 @@
//
// ELTempAlgorithmusModel.h
// Elink
//
// Created by iot_user on 2020/6/4.
// Copyright © 2020 iot_iMac. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ELSDKHeader.h"

NS_ASSUME_NONNULL_BEGIN

@interface ELTempAlgorithmusModel : NSObject


/// 获取温度显示值
/// @param temp 蓝牙发送的温度数值
/// @param tempPoint 温度小数点
/// @param tempUnit 温度单位
+(NSString *)getTempStringWithTemp:(int)temp tempPoint:(int)tempPoint tempUnit:(ELDeviceTemperatureUnit)tempUnit;

@end

NS_ASSUME_NONNULL_END

+ 52
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELWeightAlgorithmusModel.h Ver arquivo

@@ -0,0 +1,52 @@
//
// ELWeightAlgorithmusModel.h
// Elink
//
// Created by iot_user on 2020/6/4.
// Copyright © 2020 iot_iMac. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ELSDKHeader.h"

NS_ASSUME_NONNULL_BEGIN
//体重单位st:lb分隔符 @":"
extern NSString *const WeightUnitST_LBDelimiter;
//kg转lb的系数=2.2046226f
extern double const ELWeightKG_LB_CONST;
//st转lb的系数=14.0f
extern double const ELWeightST_LB_CONST;

@interface ELWeightAlgorithmusModel : NSObject

/// 体重数据转换成体重显示值的方法
/// @param weight 蓝牙发送的体重数据
/// @param weightPoint 体重小数点
/// @param weightUnit 体重单位
+(NSString *)getWeightStringWithWeight:(int)weight weightPoint:(int)weightPoint weightUnit:(ELDeviceWeightUnit)weightUnit;

/**
Convert the integer returned by Bluetooth to the character string required for interface display, the display unit is the current user unit
  @param weightInt AILink protocol integer returned by Bluetooth
  @param unit kg / lb / st: lb / jin
  @param point 1,2
  @return The weight displayed on the interface, such as 5: 6.5 st: lb
将蓝牙返回的整数,转换为界面显示所需要的字符串,显示单位为当前用户单位
// weightInt AILink协议蓝牙返回的整数
// unit kg/lb/st:lb/jin
// point 1,2
// 界面显示的体重,如 5:6.5 st:lb
*/
+ (NSString *)getWeightShowStrWithTargetUnit:(ELDeviceWeightUnit)targetUnit bleWeightInt:(NSUInteger)weightInt bleWeightUnit:(ELDeviceWeightUnit)unit bleWeightPoint:(NSUInteger)point;

/**
将服务器返回的5:6.5、56.2等数据转换为kg,用来画图或者换算
@param weightShow 从数据库中直接读出来的,或者AILink协议蓝牙返给界面的数据 68.56(kg) 120.6(lb)
@param unit kg/lb/st:lb/jin
@param point 1,2
@return 转换为kg的值(用于绘图或换算的kg数,一律四舍五入保留2位小数)
*/
+ (NSString *)getKgWithWeightShowStr:(NSString *)weightShow weightUnit:(ELDeviceWeightUnit)unit weightPoint:(NSUInteger)point;
@end

NS_ASSUME_NONNULL_END

BIN
AILinkBleSDKDemo/AILinkBleSDK.framework/Info.plist Ver arquivo


BIN
AILinkBleSDKDemo/AILinkBleSDK.framework/_CodeSignature/CodeDirectory Ver arquivo


BIN
AILinkBleSDKDemo/AILinkBleSDK.framework/_CodeSignature/CodeRequirements-1 Ver arquivo


+ 160
- 10
AILinkBleSDKDemo/AILinkBleSDK.framework/_CodeSignature/CodeResources Ver arquivo

@@ -46,7 +46,7 @@
</data>
<key>Headers/ELBluetoothManager.h</key>
<data>
1DzzZZ/wIue+STTYSBnzYR/JDQc=
OKd3bjWNKh/sFutes+/VnWz96Vw=
</data>
<key>Headers/ELBodyFatScaleBleHeader.h</key>
<data>
@@ -68,6 +68,34 @@
<data>
wzOhRUInZ0tuoj3LHMmJV1XejoY=
</data>
<key>Headers/ELBodyIndexAlgorithmModel.h</key>
<data>
cIH1JvCssYA5SSXadJ9PfOEMi74=
</data>
<key>Headers/ELBroadcastScaleBleHeader.h</key>
<data>
lnZNB95PJv2/dgQSBRKJ2qQnL/I=
</data>
<key>Headers/ELBroadcastScaleBleManager.h</key>
<data>
7IXVzGFMuHW8BWt4pQk8U1dFDc0=
</data>
<key>Headers/ELBroadcastScaleDataModel.h</key>
<data>
m08U9zzeJ/R1po37UkVGfdXAIKM=
</data>
<key>Headers/ELEightScaleBleDataModel.h</key>
<data>
33vwJKg2lzoOMBEngjVMs08DQM8=
</data>
<key>Headers/ELEightScaleBleManager.h</key>
<data>
JfrnelCfw2l0qCAyf8LNDMPfVLo=
</data>
<key>Headers/ELEightScaleSDKHeader.h</key>
<data>
bLSE4xb5MOyhdguHJ4PFLPRr6GQ=
</data>
<key>Headers/ELForeHeadBleManager.h</key>
<data>
PGM6FQ7DALcjdFVRIe5TI/8HAjM=
@@ -80,6 +108,10 @@
<data>
3LS8MObWrVCjLnaKWwoUKBaqc34=
</data>
<key>Headers/ELHeightAlgorithmusModel.h</key>
<data>
z9j6AGnGDhwUV/DrRaUQRXC5hVI=
</data>
<key>Headers/ELHeightGaugeBleDataModel.h</key>
<data>
B+jv5YT79HhyGg7UL0jGn0SAvdg=
@@ -94,7 +126,7 @@
</data>
<key>Headers/ELPeripheralModel.h</key>
<data>
ibVmqneQ5mPsyjCTT8qkT1PXy9w=
2BPYSJlX2e5+zoPjDDF0b+rGgEc=
</data>
<key>Headers/ELRemoteControlBleHeader.h</key>
<data>
@@ -110,7 +142,11 @@
</data>
<key>Headers/ELSDKHeader.h</key>
<data>
s8ZEGr/PpbFlKrQ5+kqm6spNKn0=
GKs3bfL6dryCrnD+GMedQhIEAU4=
</data>
<key>Headers/ELTempAlgorithmusModel.h</key>
<data>
AlQKcIM/xntXasbbagOjq7wgjdU=
</data>
<key>Headers/ELThermometerBleManager.h</key>
<data>
@@ -128,6 +164,10 @@
<data>
KUvTJzAj6UgO0TVIag6jroPEZ9g=
</data>
<key>Headers/ELWeightAlgorithmusModel.h</key>
<data>
1glTQ2dPXRk5jFmzjxkkC5aRjgA=
</data>
<key>Headers/ELWheelMonitorBleHeader.h</key>
<data>
IKCvB9SN0bht+QzbqywX+LIO45A=
@@ -142,7 +182,7 @@
</data>
<key>Info.plist</key>
<data>
7GRWEyAnXxjLbVEdHfMEXqK3VO0=
UMqEsWdtMOlMnusqzTciLhNvrrg=
</data>
</dict>
<key>files2</key>
@@ -261,11 +301,11 @@
<dict>
<key>hash</key>
<data>
1DzzZZ/wIue+STTYSBnzYR/JDQc=
OKd3bjWNKh/sFutes+/VnWz96Vw=
</data>
<key>hash2</key>
<data>
kNafst/7uHWzJYb4+bnHf1+LulVxqmDY4DZLvvBDSz0=
x8MeFX59REfQRNAyQC/13C+sAIxFfiEbHM5QSmqs1Ts=
</data>
</dict>
<key>Headers/ELBodyFatScaleBleHeader.h</key>
@@ -323,6 +363,83 @@
ZP6cxgBFbWaQx/NIDxVVSWHwIu4JcVyIgQFhDh/6WO0=
</data>
</dict>
<key>Headers/ELBodyIndexAlgorithmModel.h</key>
<dict>
<key>hash</key>
<data>
cIH1JvCssYA5SSXadJ9PfOEMi74=
</data>
<key>hash2</key>
<data>
WCssEd8zrV3tqom/9Ry2O3JXAoniGheZ4QTDXB9ex0U=
</data>
</dict>
<key>Headers/ELBroadcastScaleBleHeader.h</key>
<dict>
<key>hash</key>
<data>
lnZNB95PJv2/dgQSBRKJ2qQnL/I=
</data>
<key>hash2</key>
<data>
aUadkWt+Q05BnNEFjBZprb1/2IYNiXrQRZR1EAqe7po=
</data>
</dict>
<key>Headers/ELBroadcastScaleBleManager.h</key>
<dict>
<key>hash</key>
<data>
7IXVzGFMuHW8BWt4pQk8U1dFDc0=
</data>
<key>hash2</key>
<data>
SZTBVSml7mkdSCHYuHInf7ooDzXG+p2lBQ02FYVrjUA=
</data>
</dict>
<key>Headers/ELBroadcastScaleDataModel.h</key>
<dict>
<key>hash</key>
<data>
m08U9zzeJ/R1po37UkVGfdXAIKM=
</data>
<key>hash2</key>
<data>
f7g8n1Q8QY/08q7dRhwaEBuX+naKaznHJXJ9Q7kqqfQ=
</data>
</dict>
<key>Headers/ELEightScaleBleDataModel.h</key>
<dict>
<key>hash</key>
<data>
33vwJKg2lzoOMBEngjVMs08DQM8=
</data>
<key>hash2</key>
<data>
X3lkX6dr770QlxK76ZLW5CpL5Wmd2qusT34lRR+3q6w=
</data>
</dict>
<key>Headers/ELEightScaleBleManager.h</key>
<dict>
<key>hash</key>
<data>
JfrnelCfw2l0qCAyf8LNDMPfVLo=
</data>
<key>hash2</key>
<data>
vA9r9lnuxFWzQwu2FJJ0DUOWgdh9C8MVT7usXFMT6Mw=
</data>
</dict>
<key>Headers/ELEightScaleSDKHeader.h</key>
<dict>
<key>hash</key>
<data>
bLSE4xb5MOyhdguHJ4PFLPRr6GQ=
</data>
<key>hash2</key>
<data>
Cc0yFnPv05wNaSo1qYPA7IWDYVD8sMiIWdMog3EB6qc=
</data>
</dict>
<key>Headers/ELForeHeadBleManager.h</key>
<dict>
<key>hash</key>
@@ -356,6 +473,17 @@
S4+2M5mPrWRGaOZPU2ZBnh0I3EC8Xsw160okYl9SdKU=
</data>
</dict>
<key>Headers/ELHeightAlgorithmusModel.h</key>
<dict>
<key>hash</key>
<data>
z9j6AGnGDhwUV/DrRaUQRXC5hVI=
</data>
<key>hash2</key>
<data>
KLZUrBxMf60Su2C5SLNw+4/OvoBTfBJifIrdN3KHn70=
</data>
</dict>
<key>Headers/ELHeightGaugeBleDataModel.h</key>
<dict>
<key>hash</key>
@@ -393,11 +521,11 @@
<dict>
<key>hash</key>
<data>
ibVmqneQ5mPsyjCTT8qkT1PXy9w=
2BPYSJlX2e5+zoPjDDF0b+rGgEc=
</data>
<key>hash2</key>
<data>
1kPE7LNXG51xcfDIuG0pi0iM5tWGqj3rUPDJhLoyaBg=
zVdvk9EguhJ4yIkagDVl0cB3uFLBEowO4ly8JecN8ks=
</data>
</dict>
<key>Headers/ELRemoteControlBleHeader.h</key>
@@ -437,11 +565,22 @@
<dict>
<key>hash</key>
<data>
s8ZEGr/PpbFlKrQ5+kqm6spNKn0=
GKs3bfL6dryCrnD+GMedQhIEAU4=
</data>
<key>hash2</key>
<data>
2Eglzg3bcQpTOyihsn8ZijRJly03efDUHObUsNcZPH0=
r1aQIPZs0NMAPNezCmkWE4KzH9wD+DmKAafzpwOqjrg=
</data>
</dict>
<key>Headers/ELTempAlgorithmusModel.h</key>
<dict>
<key>hash</key>
<data>
AlQKcIM/xntXasbbagOjq7wgjdU=
</data>
<key>hash2</key>
<data>
OmZ9PlkJpK5EzPuYVP0XFvj2ntXgFt03ueS/bWj/heQ=
</data>
</dict>
<key>Headers/ELThermometerBleManager.h</key>
@@ -488,6 +627,17 @@
m9kGIMT+Hyb5vxlcF8hsbi4cmg8IWW0u1d690GOSIqA=
</data>
</dict>
<key>Headers/ELWeightAlgorithmusModel.h</key>
<dict>
<key>hash</key>
<data>
1glTQ2dPXRk5jFmzjxkkC5aRjgA=
</data>
<key>hash2</key>
<data>
sc6jQFBwXrInQMS6X/flXOZ8S7ZiBj330wzCGMpCm58=
</data>
</dict>
<key>Headers/ELWheelMonitorBleHeader.h</key>
<dict>
<key>hash</key>

BIN
AILinkBleSDKDemo/AILinkBleSDK.framework/_CodeSignature/CodeSignature Ver arquivo


+ 11
- 1
AILinkBleSDKDemo/ViewController.m Ver arquivo

@@ -18,6 +18,8 @@
#import "ThermometerScanViewController.h"
#import "WheelMonitorScanViewController.h"
#import "BodyFatScaleScanViewController.h"
#import "BroadcastScaleViewController.h"
#import "EightScaleScanViewController.h"

@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>

@@ -31,7 +33,7 @@

- (void)viewDidLoad {
[super viewDidLoad];
self.datas = @[@"自己写协议走透传",@"有AILink协议自己解析数据",@"集成婴儿秤",@"集成血压计",@"集成身高仪",@"集成遥控器",@"集成额温枪",@"集成温度计",@"集成胎压监测",@"集成体脂秤"];
self.datas = @[@"自己写协议走透传",@"有AILink协议自己解析数据",@"集成婴儿秤",@"集成血压计",@"集成身高仪",@"集成遥控器",@"集成额温枪",@"集成温度计",@"集成胎压监测",@"集成体脂秤",@"集成广播秤",@"八电极体脂秤"];
[self.view addSubview:self.tableView];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.right.bottom.mas_equalTo(0);
@@ -94,6 +96,14 @@
BodyFatScaleScanViewController *vc = [[BodyFatScaleScanViewController alloc] init];
vc.title = self.datas[indexPath.row];
[self.navigationController pushViewController:vc animated:YES];
}else if(indexPath.row == 10){
BroadcastScaleViewController *vc = [[BroadcastScaleViewController alloc] init];
vc.title = self.datas[indexPath.row];
[self.navigationController pushViewController:vc animated:YES];
}else if (indexPath.row == 11){
EightScaleScanViewController *vc = [[EightScaleScanViewController alloc] init];
vc.title = self.datas[indexPath.row];
[self.navigationController pushViewController:vc animated:YES];
}

}

+ 18
- 0
AILinkBleSDKDemo/八电极体脂秤/EightScaleConnectionViewController.h Ver arquivo

@@ -0,0 +1,18 @@
//
// EightScaleConnectionViewController.h
// AILinkBleSDKSourceCode
//
// Created by iot_user on 2020/9/12.
// Copyright © 2020 IOT. All rights reserved.
//

#import <UIKit/UIKit.h>
@class ELPeripheralModel;

NS_ASSUME_NONNULL_BEGIN

@interface EightScaleConnectionViewController : UIViewController
@property (nonatomic, strong) ELPeripheralModel *p;
@end

NS_ASSUME_NONNULL_END

+ 397
- 0
AILinkBleSDKDemo/八电极体脂秤/EightScaleConnectionViewController.m Ver arquivo

@@ -0,0 +1,397 @@
//
// EightScaleConnectionViewController.m
// AILinkBleSDKSourceCode
//
// Created by iot_user on 2020/9/12.
// Copyright © 2020 IOT. All rights reserved.
//

#import "EightScaleConnectionViewController.h"
#import "Masonry.h"
#import <AILinkBleSDK/ELEightScaleBleManager.h>
#import <AILinkBleSDK/ELEightScaleBleDataModel.h>
#import <AILinkBleSDK/ELEightScaleSDKHeader.h>

@interface EightScaleConnectionViewController ()<ELBluetoothManagerDelegate,EightScaleBleDeletegate>
@property (nonatomic, strong) UITextView *textView;

@property (nonatomic, copy) NSArray<NSNumber *> *units;

@end

@implementation EightScaleConnectionViewController

- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
[ELEightScaleBleManager shareManager].eightScaleDelegate = self;
[ELEightScaleBleManager shareManager].delegate =self;
[[ELEightScaleBleManager shareManager] connectPeripheral:self.p];
[self setupUIView];
}
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[[ELEightScaleBleManager shareManager] disconnectPeripheral];
}
-(void)addLog:(NSString *)log{
self.textView.text = [NSString stringWithFormat:@"%@\n%@",log,self.textView.text];
}
-(void)buttonAction:(UIButton *)sender{
if ([ELEightScaleBleManager shareManager].state != ELBluetoothStateDidValidationPass) {
[self addLog:@"Disconnected"];
return;
}
[self addLog:sender.titleLabel.text];
NSInteger tag = sender.tag;
if (tag == 1) {
//getBluetoothInfoWithELInetGetCmdType是获取设备信息的方法
[[ELEightScaleBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:(ELInetGetCmdTypeGetBMVersion)];
}else if (tag == 2){
[[ELEightScaleBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:(ELInetGetCmdTypeGetC_V_P_ID)];
}else if (tag == 3){
[[ELEightScaleBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:(ELInetGetCmdTypeGetName)];
}else if (tag == 4){
[[ELEightScaleBleManager shareManager] setBluetoothName:@"AILink"];
}else if (tag == 5){
if (self.units.count==0) {
[self addLog:@"No units obtained"];
return;
}
// [[ELEightScaleBleManager shareManager] changeBodyFatScaleUnit:(ELDeviceWeightUnit_KG)];
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Change Unit" message:@"" preferredStyle:(UIAlertControllerStyleAlert)];
for (int i=0; i<self.units.count; i++) {
UIAlertAction *action = [UIAlertAction actionWithTitle:AiLinkBleWeightUnitDic[self.units[i]] style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
[[ELEightScaleBleManager shareManager] eightScaleSwitchWeightUnit:self.units[i].integerValue];
}];
[alert addAction:action];
}
[self presentViewController:alert animated:YES completion:nil];
}else if (tag == 6){
}else if (tag == 7){
}else if (tag == 8){
}else if (tag == 9){
}
}
-(void)setupUIView{
UIButton *button1 = [UIButton buttonWithType:(UIButtonTypeCustom)];
[button1 setTitle:@"Get BM Version" forState:(UIControlStateNormal)];
button1.tag = 1;
button1.titleLabel.adjustsFontSizeToFitWidth = YES;
button1.titleLabel.numberOfLines = 2;
button1.backgroundColor = [UIColor blackColor];
[button1 addTarget:self action:@selector(buttonAction:) forControlEvents:(UIControlEventTouchUpInside)];
[self.view addSubview:button1];
[button1 mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(10);
make.top.mas_equalTo(80);
make.width.mas_equalTo(100);
make.height.mas_equalTo(40);
}];
UIButton *button2 = [UIButton buttonWithType:(UIButtonTypeCustom)];
[button2 setTitle:@"Get C V P ID" forState:(UIControlStateNormal)];
button2.tag = 2;
button2.titleLabel.adjustsFontSizeToFitWidth = YES;
button2.titleLabel.numberOfLines = 2;
button2.backgroundColor = [UIColor blackColor];
[button2 addTarget:self action:@selector(buttonAction:) forControlEvents:(UIControlEventTouchUpInside)];
[self.view addSubview:button2];
[button2 mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(button1.mas_right).mas_offset(10);
make.top.mas_equalTo(80);
make.width.mas_equalTo(100);
make.height.mas_equalTo(40);
}];
UIButton *button3 = [UIButton buttonWithType:(UIButtonTypeCustom)];
[button3 setTitle:@"Get Name" forState:(UIControlStateNormal)];
button3.tag = 3;
button3.titleLabel.adjustsFontSizeToFitWidth = YES;
button3.titleLabel.numberOfLines = 2;
button3.backgroundColor = [UIColor blackColor];
[button3 addTarget:self action:@selector(buttonAction:) forControlEvents:(UIControlEventTouchUpInside)];
[self.view addSubview:button3];
[button3 mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(button2.mas_right).mas_offset(10);
make.top.mas_equalTo(80);
make.width.mas_equalTo(100);
make.height.mas_equalTo(40);
}];
//
UIButton *button4 = [UIButton buttonWithType:(UIButtonTypeCustom)];
[button4 setTitle:@"Set Name" forState:(UIControlStateNormal)];
button4.tag = 4;
button4.titleLabel.adjustsFontSizeToFitWidth = YES;
button4.titleLabel.numberOfLines = 2;
button4.backgroundColor = [UIColor blackColor];
[button4 addTarget:self action:@selector(buttonAction:) forControlEvents:(UIControlEventTouchUpInside)];
[self.view addSubview:button4];
[button4 mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(10);
make.top.equalTo(button1.mas_bottom).mas_offset(10);
make.width.mas_equalTo(100);
make.height.mas_equalTo(40);
}];
//
UIButton *button5 = [UIButton buttonWithType:(UIButtonTypeCustom)];
[button5 setTitle:@"Change unit" forState:(UIControlStateNormal)];
button5.tag = 5;
button5.titleLabel.adjustsFontSizeToFitWidth = YES;
button5.titleLabel.numberOfLines = 2;
button5.backgroundColor = [UIColor blackColor];
[button5 addTarget:self action:@selector(buttonAction:) forControlEvents:(UIControlEventTouchUpInside)];
[self.view addSubview:button5];
[button5 mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(button4.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 *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.backgroundColor = [UIColor blackColor];
self.textView.text = @"Log";
self.textView.textColor = [UIColor redColor];
[self.view addSubview:self.textView];
[self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(10);
make.right.bottom.mas_equalTo(-10);
make.height.mas_equalTo(200);
}];
}

-(void)bluetoothManagerReceiceResponseType:(ELInetSetCmdType)type result:(ELSetBluetoothResponseType)result{
if (type == ELInetSetCmdTypeSetName) {
if (result == ELSetBluetoothResponseTypeSuccess) {
[self addLog:@"Set name Success "];
}else if (result == ELSetBluetoothResponseTypeFailure){
[self addLog:@"Set name failure "];
}else if (result == ELSetBluetoothResponseTypeNoSupport){
[self addLog:@"Set name unsupport "];
}
}
}
-(void)bluetoothManagerReceiceName:(NSString *)name{
[self addLog:name];
}
-(void)bluetoothManagerReceiveDID:(struct ELDIDStruct)did{
[self addLog:[NSString stringWithFormat:@"CID = %d,VID = %d,PID = %d",did.deviceType,did.vendorID,did.productID]];
}

-(void)bluetoothManagerReceiveBMVersion:(NSString *)bmVersion{
[self addLog:bmVersion];
}

-(void)bluetoothManagerBackDeviceSupportUnitWithWeight:(NSArray<NSNumber *> *)weightArray Height:(NSArray<NSNumber *> *)heightArray Temperature:(NSArray<NSNumber *> *)temperatureArray BloodPressure:(NSArray<NSNumber *> *)bloodPressureArray Pressure:(NSArray<NSNumber *> *)pressureArray{
//这里只要体重数据
self.units = weightArray;
}

-(void)eightScaleBleReceiveAdcData:(EightScaleAdcStruct)adcStruct{
[self addLog:[NSString stringWithFormat:@"Impedance type = %lu adc = %d",adcStruct.adcType,adcStruct.adc]];
}


-(void)eightScaleBleReceiveHeartRateTestStep:(EightScaleHeartRateTestStep)testStep heartRate:(int)heartRate{
[self addLog:[NSString stringWithFormat:@"HeartRate = %d",heartRate]];
}

/**
Callback to set unit result(回调设置单位结果)
@param result 结果
*/
- (void)eightScaleBleReceiveSwitchWeightUnitResult:(EightScaleSwitchUnitResult)result{
switch (result) {
case EightScaleSwitchUnitResultSuccess:
{
[self addLog:@"Change Unit Success"];
}
break;
case EightScaleSwitchUnitResultFailure:
{
[self addLog:@"Change Unit Failure"];
}
break;
case EightScaleSwitchUnitResultOperation:
{
[self addLog:@"Operationing"];
}
break;
default:
break;
}
}

/**
Return weight and body fat model(返回重量及体脂model)
*/
-(void)eightScaleBleReceiveWeightData:(EightScaleWeightStruct)weightStruct{
switch (weightStruct.weightType) {
case EightScaleWeightTypeAuto:
{
[self addLog:[NSString stringWithFormat:@"Unstable data weight = %d unit = %@ point = %d adc = %ld",weightStruct.weight,AiLinkBleWeightUnitDic[@(weightStruct.unit)],weightStruct.point,weightStruct.weightType]];
}
break;
case EightScaleWeightTypeStable:
{
[self addLog:[NSString stringWithFormat:@"Unstable data weight = %d unit = %@ point = %d adc = %ld",weightStruct.weight,AiLinkBleWeightUnitDic[@(weightStruct.unit)],weightStruct.point,weightStruct.weightType]];
}
break;
default:
break;
}
}

-(void)eightScaleBleReceiveTestComplete{
[self addLog:@"Measurn Complete"];
}

-(void)eightScaleBleReceiveTestData:(ELEightScaleBleDataModel *)dataModel{
[self addLog:[NSString stringWithFormat:@"weight = %@%@",dataModel.weight,AiLinkBleWeightUnitDic[@(dataModel.weightUnit)]]];
}

-(void)eightScaleBleReceiveErrorCode:(int)errorCode{
[self addLog:[NSString stringWithFormat:@"Error Code is %d",errorCode]];
}

-(void)eightScaleBleReceiveTempData:(EightScaleTempStruct)tempStruct{
[self addLog:[NSString stringWithFormat:@"temperature is %d ",tempStruct.temp]];
}


-(void)eightScaleBleReceiveState:(ELBluetoothState)state{
switch (state) {
case ELBluetoothStateUnavailable:
{
self.title = @"Please open the bluetooth";
}
break;
case ELBluetoothStateAvailable:
{
self.title = @"Bluetooth is open";
}
break;
case ELBluetoothStateScaning:
{
self.title = @"Scaning";
}
break;
case ELBluetoothStateConnectFail:
{
self.title = @"Connect fail";
}
break;
case ELBluetoothStateDidDisconnect:
{
self.title = @"Disconnected";
}
break;
case ELBluetoothStateDidValidationPass:
{
self.title = @"Connected";
//获取设备支持的单位
[[ELEightScaleBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:(ELInetGetCmdTypeReadDeviceSupportUnit)];
//将你自己设置的单位发给秤
ELDeviceWeightUnit unit = ELDeviceWeightUnit_KG;
[[ELEightScaleBleManager shareManager] eightScaleSwitchWeightUnit:unit];
if (self.p.deviceType == ELSupportDeviceTypeBLE_WIFIScale) {
//获取蓝牙连接状态
[[ELEightScaleBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:(ELInetGetCmdTypeGetConnectState)];
}
}
break;
case ELBluetoothStateFailedValidation:
{
self.title = @"Illegal equipment";
}
break;
case ELBluetoothStateWillConnect:
self.title = @"Connecting";
break;
default:
break;
}
}

-(void)dealloc{
}


@end

+ 17
- 0
AILinkBleSDKDemo/八电极体脂秤/EightScaleScanViewController.h Ver arquivo

@@ -0,0 +1,17 @@
//
// EightScaleScanViewController.h
// AILinkBleSDKSourceCode
//
// Created by iot_user on 2020/9/12.
// Copyright © 2020 IOT. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface EightScaleScanViewController : UIViewController

@end

NS_ASSUME_NONNULL_END

+ 89
- 0
AILinkBleSDKDemo/八电极体脂秤/EightScaleScanViewController.m Ver arquivo

@@ -0,0 +1,89 @@
//
// EightScaleScanViewController.m
// AILinkBleSDKSourceCode
//
// Created by iot_user on 2020/9/12.
// Copyright © 2020 IOT. All rights reserved.
//

#import "EightScaleScanViewController.h"
#import <AILinkBleSDK/ELEightScaleBleManager.h>
#import "Masonry.h"
#import "EightScaleConnectionViewController.h"

@interface EightScaleScanViewController ()<UITableViewDelegate,UITableViewDataSource,EightScaleBleDeletegate>
@property (nonatomic, strong) UITableView *tableView;

@property (nonatomic, strong) NSArray<ELPeripheralModel *> *devices;


@end

@implementation EightScaleScanViewController

- (void)viewDidLoad {
[super viewDidLoad];
// self.title = @"Devices";
[self.view addSubview:self.tableView];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.right.bottom.mas_equalTo(0);
}];
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[[ELEightScaleBleManager shareManager] startScan];
[ELEightScaleBleManager shareManager].eightScaleDelegate = self;
}
-(void)viewDidDisappear:(BOOL)animated{
[super viewDidDisappear:animated];
[[ELEightScaleBleManager shareManager] stopScan];
}
#pragma mark ============ ELBluetoothManagerDelegate ==============
-(void)eightScaleBleReceiveState:(ELBluetoothState)state{
NSLog(@"bluetoothManagerUpdateBleState = %ld",state);
}
-(void)eightScaleBlReceiveDevices:(NSArray<ELPeripheralModel *> *)devices{
self.devices = devices;
[self.tableView reloadData];
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.devices.count;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return 60;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *cellId = @"cellid";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId];
}
ELPeripheralModel *p = self.devices[indexPath.row];
cell.textLabel.text = [NSString stringWithFormat:@"Name:%@---Mac:%@\nCID:%ld---VID:%ld---PID:%ld",p.deviceName,p.macAddress,p.deviceType,p.vendorID,p.productID];
cell.textLabel.numberOfLines = 2;
cell.textLabel.textColor = [UIColor blackColor];
return cell;

}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
ELPeripheralModel *p = self.devices[indexPath.row];
EightScaleConnectionViewController *vc = [[EightScaleConnectionViewController alloc] init];
vc.p = p;
[self.navigationController pushViewController:vc animated:YES];
}
-(UITableView *)tableView{
if (_tableView == nil) {
_tableView = [[UITableView alloc] init];
_tableView.delegate = self;
_tableView.dataSource = self;
}
return _tableView;
}

@end

+ 17
- 0
AILinkBleSDKDemo/广播体脂秤/BroadcastScaleViewController.h Ver arquivo

@@ -0,0 +1,17 @@
//
// BroadcastScaleViewController.h
// AILinkBleSDKSourceCode
//
// Created by iot_user on 2020/9/12.
// Copyright © 2020 IOT. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface BroadcastScaleViewController : UIViewController

@end

NS_ASSUME_NONNULL_END

+ 104
- 0
AILinkBleSDKDemo/广播体脂秤/BroadcastScaleViewController.m Ver arquivo

@@ -0,0 +1,104 @@
//
// BroadcastScaleViewController.m
// AILinkBleSDKSourceCode
//
// Created by iot_user on 2020/9/12.
// Copyright © 2020 IOT. All rights reserved.
//

#import "BroadcastScaleViewController.h"
#import <AILinkBleSDK/ELBroadcastScaleBleManager.h>
#import "Masonry.h"

@interface BroadcastScaleViewController ()<BroadcastScaleBleDelegate>
@property (nonatomic, strong) UITextView *textView;
@property (nonatomic, strong) UILabel *statusLbl;


@end

@implementation BroadcastScaleViewController

- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
[ELBroadcastScaleBleManager shareManager].broadcastScaleBleDelegate = self;
[[ELBroadcastScaleBleManager shareManager] startScan];
[self setupUI];
}


-(void)broadcastScaleBleDataModel:(ELBroadcastScaleDataModel *)model{
switch (model.testStatus) {
case BroadcastScaleTestStatusWeightTesting:
{
self.statusLbl.text = @"Weight testing";
}
break;
case BroadcastScaleTestStatusADCTesting: {
self.statusLbl.text = @"Impedance testing";
break;
}
case BroadcastScaleTestStatusADCTestSuccess: {
self.statusLbl.text = @"Impedance test success";
break;
}
case BroadcastScaleTestStatusADCTestFailed: {
self.statusLbl.text = @"Impedance test failed";
break;
}
case BroadcastScaleTestStatusTestEnd: {
self.statusLbl.text = @"Test end";
break;
}
}
NSString *testData = [NSString stringWithFormat:@"MAC:%@\ncid = %d--vid=%d--pid=%d\nWeight = %@%@\nADC = %d",model.mac,model.cid-65535,model.vid,model.pid,model.weight,AiLinkBleWeightUnitDic[@(model.weightUnit)],model.adc];
[self addLog:testData];
}
-(void)broadcastScaleBleUpdateState:(ELBluetoothState)state{
if (state == ELBluetoothStateAvailable) {
self.statusLbl.text = @"Connecting";
}else if (state == ELBluetoothStateUnavailable){
self.statusLbl.text = @"Bluetooth is disconnected";
}

}

-(void)addLog:(NSString *)log{
self.textView.text = [NSString stringWithFormat:@"%@\n%@",log,self.textView.text];
}

-(void)setupUI{
self.textView = [[UITextView alloc] init];
self.textView.backgroundColor = [UIColor blackColor];
self.textView.text = @"Log";
self.textView.textColor = [UIColor redColor];
[self.view addSubview:self.textView];
[self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(10);
make.right.bottom.mas_equalTo(-10);
make.height.equalTo(self.view).multipliedBy(0.7);
}];
//
self.statusLbl = [[UILabel alloc] init];
self.statusLbl.text = @"Connecting";
self.statusLbl.adjustsFontSizeToFitWidth = YES;
self.statusLbl.font = [UIFont boldSystemFontOfSize:30];
self.statusLbl.textColor = [UIColor redColor];
self.statusLbl.textAlignment = NSTextAlignmentCenter;
[self.view addSubview:self.statusLbl];
[self.statusLbl mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(40);
make.left.right.equalTo(self.textView);
make.bottom.equalTo(self.textView.mas_top).mas_offset(-20);
}];
}
-(void)dealloc{
[[ELBroadcastScaleBleManager shareManager] stopScan];
}

@end

Carregando…
Cancelar
Salvar