Procházet zdrojové kódy

修改:发布 1.5.6 增加 四电极算法

tags/v1.5.11
larryzhang před 2 roky
rodič
revize
4a9ea4f4ca
30 změnil soubory, kde provedl 1618 přidání a 333 odebrání
  1. 4
    4
      AILinkBleSDKDemo.xcodeproj/project.pbxproj
  2. 134
    286
      AILinkBleSDKDemo/11_BodyFatScale/BodyFatScaleConnectViewController.m
  3. 40
    17
      AILinkBleSDKDemo/12_BroadcastScale/BroadcastScaleViewController.m
  4. 2
    0
      AILinkBleSDKDemo/13_EightScale/ELEightScaleAlgorithmTool.h
  5. 75
    4
      AILinkBleSDKDemo/13_EightScale/ELEightScaleAlgorithmTool.m
  6. binární
      AILinkBleSDKDemo/AILinkBleSDK.framework/AILinkBleSDK
  7. 33
    16
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/AILinkBleSDK-umbrella.h
  8. 68
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/AlgorithmSDK.h
  9. 93
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/BfsCalculateSDK.h
  10. 131
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELAILinkBleManager+AirDetector.h
  11. 31
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELAILinkBleManager+MeatProbe.h
  12. 195
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELAILinkBleManager.h
  13. 126
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELAirDetectorBleFunctionModel.h
  14. 63
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELAirDetectorBleHeader.h
  15. 32
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELAirDetectorBleParser.h
  16. 113
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELAirDetectorBleSettingModel.h
  17. 117
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELAirDetectorBleStatusModel.h
  18. 2
    1
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELBleDisposeDataTool.h
  19. 1
    1
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELBluetoothManager.h
  20. 46
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELMeatProbeBleModel.h
  21. 46
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELMeatProbeBleTool.h
  22. 33
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELSDKHeader.h
  23. 10
    3
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELTLVModel.h
  24. 62
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELVictorLuxMeterBleModel.h
  25. 36
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELVictorLuxMeterBleTool.h
  26. 37
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/NELBleManagerHeader.h
  27. 55
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/NELMacAddressModel.h
  28. 32
    0
      AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/NSData+AILinkBle.h
  29. binární
      AILinkBleSDKDemo/AILinkBleSDK.framework/Info.plist
  30. 1
    1
      AILinkBleSDKDemo/Info.plist

+ 4
- 4
AILinkBleSDKDemo.xcodeproj/project.pbxproj Zobrazit soubor

@@ -1024,7 +1024,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 20221118;
CURRENT_PROJECT_VERSION = 20221221;
DEVELOPMENT_TEAM = YEU77XR292;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -1044,7 +1044,7 @@
"$(PROJECT_DIR)/AILinkBleSDKDemo/13_EightScale/HTBodyfat_SDK",
"$(PROJECT_DIR)/AILinkBleSDKDemo/13_EightScale/BhBodyComposition120",
);
MARKETING_VERSION = 1.5.1;
MARKETING_VERSION = 1.5.6;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = com.pingwang.AILinkBleSDKDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1057,7 +1057,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 20221118;
CURRENT_PROJECT_VERSION = 20221221;
DEVELOPMENT_TEAM = YEU77XR292;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -1077,7 +1077,7 @@
"$(PROJECT_DIR)/AILinkBleSDKDemo/13_EightScale/HTBodyfat_SDK",
"$(PROJECT_DIR)/AILinkBleSDKDemo/13_EightScale/BhBodyComposition120",
);
MARKETING_VERSION = 1.5.1;
MARKETING_VERSION = 1.5.6;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = com.pingwang.AILinkBleSDKDemo;
PRODUCT_NAME = "$(TARGET_NAME)";

+ 134
- 286
AILinkBleSDKDemo/11_BodyFatScale/BodyFatScaleConnectViewController.m Zobrazit soubor

@@ -11,15 +11,15 @@
#import <AILinkBleSDK/ELBodyFatScaleBleManager.h>
#import <AILinkBleSDK/ELBodyFatScaleBleUserModel.h>
#import <AILinkBleSDK/ELBodyFatScaleBleWeightModel.h>
//#import "WiFiSetupViewController.h"
#import <AILinkBleSDK/ELBluetoothManager+Settings.h>
#import <AILinkBleSDK/ELBleWifiDetailModel.h>
#import <AILinkBleSDK/ELBluetoothManager+BleWifi.h>

@interface BodyFatScaleConnectViewController ()<ELBluetoothManagerDelegate,ELBodyFatScaleBleDelegate,ElBleWifiDelegate>
@property (nonatomic, strong) UITextView *textView;
#import <AILinkBleSDK/AlgorithmSDK.h>
#import <AILinkBleSDK/ELUnitConvertTool.h>

@property (nonatomic, copy) NSArray<NSNumber *> *units;
@interface BodyFatScaleConnectViewController () <ELBluetoothManagerDelegate, ELBodyFatScaleBleDelegate>
@property(nonatomic, strong) UITextView *textView;

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


@end
@@ -29,22 +29,24 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
[ELBodyFatScaleBleManager shareManager].bodyFatScaleDelegate = self;
[ELBodyFatScaleBleManager shareManager].delegate =self;
[ELBodyFatScaleBleManager shareManager].delegate = self;
[[ELBodyFatScaleBleManager shareManager] connectPeripheral:self.p];
[ELBodyFatScaleBleManager shareManager].bleWifiDelegate = self;

[self setupUIView];
}
-(void)viewWillDisappear:(BOOL)animated{

- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[[ELBodyFatScaleBleManager shareManager] disconnectPeripheral];
}
-(void)addLog:(NSString *)log{
self.textView.text = [NSString stringWithFormat:@"%@\n%@",log,self.textView.text];

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

- (void)buttonAction:(UIButton *)sender {
if ([ELBodyFatScaleBleManager shareManager].state != ELBluetoothStateDidValidationPass) {
[self addLog:@"Disconnected"];
return;
@@ -54,41 +56,42 @@
if (tag == 1) {
//getBluetoothInfoWithELInetGetCmdType是获取设备信息的方法
[[ELBodyFatScaleBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:(ELInetGetCmdTypeGetBMVersion)];
}else if (tag == 2){
} else if (tag == 2) {
[[ELBodyFatScaleBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:(ELInetGetCmdTypeGetC_V_P_ID)];
}else if (tag == 3){
} else if (tag == 3) {
[[ELBodyFatScaleBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:(ELInetGetCmdTypeGetName)];
}else if (tag == 4){
} else if (tag == 4) {
[[ELBodyFatScaleBleManager shareManager] setBluetoothName:@"AILink"];
}else if (tag == 5){
if (self.units.count==0) {
} else if (tag == 5) {
if (self.units.count == 0) {
[self addLog:@"No units obtained"];
return;
}
// [[ELBodyFatScaleBleManager 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) {
for (int i = 0; i < self.units.count; i++) {
UIAlertAction *action = [UIAlertAction actionWithTitle:AiLinkBleWeightUnitDic[self.units[i]] style:(UIAlertActionStyleDefault) handler:^(UIAlertAction *_Nonnull action) {
[[ELBodyFatScaleBleManager shareManager] changeBodyFatScaleUnit: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){
} else if (tag == 6) {
} else if (tag == 7) {
} else if (tag == 8) {
} else if (tag == 9) {
}
}
-(void)setupUIView{

- (void)setupUIView {
UIButton *button1 = [UIButton buttonWithType:(UIButtonTypeCustom)];
[button1 setTitle:@"Get BM Version" forState:(UIControlStateNormal)];
button1.tag = 1;
@@ -103,7 +106,7 @@
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;
@@ -118,7 +121,7 @@
make.width.mas_equalTo(100);
make.height.mas_equalTo(40);
}];
UIButton *button3 = [UIButton buttonWithType:(UIButtonTypeCustom)];
[button3 setTitle:@"Get Name" forState:(UIControlStateNormal)];
button3.tag = 3;
@@ -163,67 +166,6 @@
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];
@@ -237,79 +179,38 @@
}];
}

-(void)bluetoothManagerReceiceResponseType:(ELInetSetCmdType)type result:(ELSetBluetoothResponseType)result{
- (void)bluetoothManagerReceiceResponseType:(ELInetSetCmdType)type result:(ELSetBluetoothResponseType)result {
if (type == ELInetSetCmdTypeSetName) {
if (result == ELSetBluetoothResponseTypeSuccess) {
[self addLog:@"Set name Success "];
}else if (result == ELSetBluetoothResponseTypeFailure){
} else if (result == ELSetBluetoothResponseTypeFailure) {
[self addLog:@"Set name failure "];
}else if (result == ELSetBluetoothResponseTypeNoSupport){
} else if (result == ELSetBluetoothResponseTypeNoSupport) {
[self addLog:@"Set name unsupport "];
}
}
}
-(void)bluetoothManagerReceiceName:(NSString *)name{

- (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)bluetoothManagerReceiveDID:(struct ELDIDStruct)did {
[self addLog:[NSString stringWithFormat:@"CID = %d,VID = %d,PID = %d", did.deviceType, did.vendorID, did.productID]];
}

-(void)bluetoothManagerReceiveBMVersion:(NSString *)bmVersion{
- (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{
- (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)bluetoothManagerReceiveMCUConnectedState:(struct ELMCUStateStruct)stateStrct{
BleWiFiConnectState wifiState = stateStrct.wifiState;

if (self.p.deviceType == ELSupportDeviceTypeBLE_WIFIScale) {
//蓝牙WiFi体脂秤
//请求会话码
[[ELBodyFatScaleBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:ELInetGetCmdTypeBleWifiGetSNNumber];
//MARK:1.WiFi配置提示用户配网
//TODO:注意:wifi配置过程必须保持蓝牙与设备的连接
if (wifiState == BleWiFiConnectStateNoWiFi) {
//1.如果没有配网,则提示用户去配网
//MARK:2.WiFi配置先获取wifi列表
//
[[ELBodyFatScaleBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:ELInetGetCmdTypeBleWifiGetNearbyWifi];
//
// UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Change Unit" message:@"" preferredStyle:(UIAlertControllerStyleAlert)];
// UIAlertAction *action = [UIAlertAction actionWithTitle:@"去配网" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
// if ([ELBodyFatScaleBleManager shareManager].state == ELBluetoothStateDidValidationPass) {
// WiFiSetupViewController *vc = [[WiFiSetupViewController alloc] init];
// [self.navigationController pushViewController:vc animated:YES];
// }else{
// [self addLog:@"Disconnected"];
// }
//
// }];
// UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"取消" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
//
// }];
// [alert addAction:action];
// [alert addAction:action2];
// [self presentViewController:alert animated:YES completion:nil];
}
}
///MARK:9.wifi配置结果
//wifi相关的其他指令和数据接收,请查看ELBluetoothManager.h文件
if (stateStrct.wifiState == BleWiFiConnectStateSuccess) {
//成功
//MARK:10.获取wifi设备的SN号,即设备id
[[ELBodyFatScaleBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:(ELInetGetCmdTypeBleWifiGetSNNumber)];
}else{
//失败
}
- (void)bluetoothManagerReceiveMCUConnectedState:(struct ELMCUStateStruct)stateStrct {

}

@@ -318,20 +219,17 @@
@param result 结果
*/
- (void)bodyFatScaleManagerCallBackSetUnitResult:(ELSetBluetoothResponseType)result{
- (void)bodyFatScaleManagerCallBackSetUnitResult:(ELSetBluetoothResponseType)result {
switch (result) {
case ELSetBluetoothResponseTypeSuccess:
{
case ELSetBluetoothResponseTypeSuccess: {
[self addLog:@"Change Unit Success"];
}
break;
case ELSetBluetoothResponseTypeFailure:
{
case ELSetBluetoothResponseTypeFailure: {
[self addLog:@"Change Unit Failure"];
}
break;
case ELSetBluetoothResponseTypeNoSupport:
{
case ELSetBluetoothResponseTypeNoSupport: {
[self addLog:@"Unsupport Change Unit"];
}
break;
@@ -339,53 +237,20 @@
break;
}
}
//MARK:回调Wifi列表
-(void)bleWifiReceiveWifiDetailModel:(ELBleWifiDetailModel *)model{
// MARK:3.WiFi配置得到Wifi列表
//用一个tableview显示喽
[self addLog:[NSString stringWithFormat:@"wifi类型---%lu 名称---%@",(unsigned long)model.wifiState,model.wifiName]];
}
-(void)bleWifiReceiveScanedWifiCount:(int)count {
//MARK:扫描Wifi结束
//MARK:4.WiFi配置得到一个附近wifi的列表,点击选择一个wifi,进行配置
//MARK:5.输入wifi密码
//写个“textfield”输入密码
//MARK:6.先发送配置wifi的mac地址的指令
// [[ELBodyFatScaleBleManager shareManager] bleWifiSetConnectWifiMac:[NSData data]];
}
-(void)bleWifiReceiceResponseType:(ELInetSetCmdType)type result:(ELSetBluetoothResponseType)result{
[self addLog:[NSString stringWithFormat:@"bleWifiReceiceResponseType==%lu----%lu",type,result]];
if (result == ELSetBluetoothResponseTypeSuccess) {
//设置WiFi结果
if (type == ELInetSetCmdTypeBleWifiSetWifiMac) {
//MARK:7.再发送配置wifi的密码的指令
[[ELBodyFatScaleBleManager shareManager] bleWifiSetWifiPwd:@"WiFi密码"];
}else if (type == ELInetSetCmdTypeBleWifiSetWifiPwd){
//MARK:8.然后发起连接Wifi
[[ELBodyFatScaleBleManager shareManager] bleWifiSetupWifiConnect:YES];
}else if (type == ELInetSetCmdTypeBleWifiSetConnectWifi){
//获取连接状态
}
}
else{
//TODO:Wifi配置过程中失败的情况自行处理
}
}


/**
MCU requests user information( MCU 请求用户信息)
@param status 请求状态
*/
- (void)bodyFatScaleManagerMCURequestAppUserInfoType:(BodyFatScaleMCURequestUserInfoStatus)status{
- (void)bodyFatScaleManagerMCURequestAppUserInfoType:(BodyFatScaleMCURequestUserInfoStatus)status {
if (status == BodyFatScaleMCURequestUserInfoStatus_Get) {
//下发当前用户给秤
[[ELBodyFatScaleBleManager shareManager] sendCurrentUserToBle:[self getOneUser]];
}else if (status == BodyFatScaleMCURequestUserInfoStatus_Success){
} else if (status == BodyFatScaleMCURequestUserInfoStatus_Success) {
[self addLog:@"MCU requests user information success"];
}else if (BodyFatScaleMCURequestUserInfoStatus_Fail){
} else if (BodyFatScaleMCURequestUserInfoStatus_Fail) {
[self addLog:@"MCU requests user information failure"];
}

@@ -395,27 +260,27 @@
/**
Return weight and body fat model(返回重量及体脂model)
*/
-(void)bodyFatScaleManagerCallBackWeight:(ELBodyFatScaleBleWeightModel *)weightModel state:(BodyFatScaleMeasureStatus)status{
- (void)bodyFatScaleManagerCallBackWeight:(ELBodyFatScaleBleWeightModel *)weightModel state:(BodyFatScaleMeasureStatus)status {
switch (status) {
case BodyFatScaleMeasureStatus_Unstable:
{
[self addLog:[NSString stringWithFormat:@"Unstable data weight = %ld unit = %@ point = %ld adc = %ld",weightModel.weight,AiLinkBleWeightUnitDic[@(weightModel.weightUnit)],weightModel.weightPoint,weightModel.adc]];
case BodyFatScaleMeasureStatus_Unstable: {
[self addLog:[NSString stringWithFormat:@"Unstable data weight = %ld unit = %@ point = %ld adc = %ld", weightModel.weight, AiLinkBleWeightUnitDic[@(weightModel.weightUnit)], weightModel.weightPoint, weightModel.adc]];
}
break;
case BodyFatScaleMeasureStatus_Stable:
{
[self addLog:[NSString stringWithFormat:@"Stable data weight = %ld unit = %@ point = %ld adc = %ld",weightModel.weight,AiLinkBleWeightUnitDic[@(weightModel.weightUnit)],weightModel.weightPoint,weightModel.adc]];
case BodyFatScaleMeasureStatus_Stable: {
[self addLog:[NSString stringWithFormat:@"Stable data weight = %ld unit = %@ point = %ld adc = %ld", weightModel.weight, AiLinkBleWeightUnitDic[@(weightModel.weightUnit)], weightModel.weightPoint, weightModel.adc]];
}
break;
case BodyFatScaleMeasureStatus_Failed:
{
case BodyFatScaleMeasureStatus_Failed: {
[self addLog:@"Test failure"];
}
break;
case BodyFatScaleMeasureStatus_Complete:
{
[self addLog:[NSString stringWithFormat:@"Tested weight = %ld unit = %@ point = %ld adc = %ld",weightModel.weight,AiLinkBleWeightUnitDic[@(weightModel.weightUnit)],weightModel.weightPoint,weightModel.adc]];
case BodyFatScaleMeasureStatus_Complete: {
[self addLog:[NSString stringWithFormat:@"Tested weight = %ld unit = %@ point = %ld adc = %ld", weightModel.weight, AiLinkBleWeightUnitDic[@(weightModel.weightUnit)], weightModel.weightPoint, weightModel.adc]];
NSLog(@"weightModel:%@", weightModel);

//App算法
[self algorithmWithBleModel:weightModel user:self.getOneUser];

//更新用户信息给秤
[[ELBodyFatScaleBleManager shareManager] sendCurrentUserToBle:[self getOneUser]];
//下发用户列表
@@ -427,14 +292,22 @@
}
}

- (void)algorithmWithBleModel:(ELBodyFatScaleBleWeightModel *)weightModel user:(ELBodyFatScaleBleUserModel *)user {

NSString *weightKg = [ELUnitConvertTool getWeightShowStrWithTargetUnit:ELDeviceWeightUnit_KG bleWeightInt:weightModel.weight bleWeightUnit:weightModel.weightUnit bleWeightPoint:weightModel.weightPoint];

AlgorithmModel *algorithmModel = [AlgorithmSDK getBodyfatWithWeight:weightKg.floatValue adc:(int) weightModel.adc sex:user.sex age:(int) user.age height:(int) user.height];
NSLog(@"algorithmModel:%@", algorithmModel);
}


/**
Return temperature (unit: ° C)(返回温度(单位:°C))
@param temp 温度(单位:°C)
*/
-(void)bodyFatScaleManagerCallBackTemp:(NSString *)temp{
[self addLog:[NSString stringWithFormat:@"temperature is %@",temp]];
- (void)bodyFatScaleManagerCallBackTemp:(NSString *)temp {
[self addLog:[NSString stringWithFormat:@"temperature is %@", temp]];
}

/**
@@ -443,26 +316,22 @@
@param status 阻抗测量状态
@param adc 阻抗
*/
-(void)bodyFatScaleManagerCallBackAdcMeasureStatus:(BodyFatScaleAdcMeasureStatus)status adcValue:(NSInteger)adc{
- (void)bodyFatScaleManagerCallBackAdcMeasureStatus:(BodyFatScaleAdcMeasureStatus)status adcValue:(NSInteger)adc {
switch (status) {
case BodyFatScaleAdcMeasureStatus_Testing:
{
case BodyFatScaleAdcMeasureStatus_Testing: {
[self addLog:@"adc testing"];
}
break;
case BodyFatScaleAdcMeasureStatus_Success:
{
[self addLog:[NSString stringWithFormat:@"adc is %ld",adc]];
case BodyFatScaleAdcMeasureStatus_Success: {
[self addLog:[NSString stringWithFormat:@"adc is %ld", adc]];
}
break;
case BodyFatScaleAdcMeasureStatus_Fail:
{
case BodyFatScaleAdcMeasureStatus_Fail: {
[self addLog:@"adc test failure"];
}
break;
case BodyFatScaleAdcMeasureStatus_SuccessCustom:
{
[self addLog:[NSString stringWithFormat:@"adc is %ld and user app algum",adc]];
case BodyFatScaleAdcMeasureStatus_SuccessCustom: {
[self addLog:[NSString stringWithFormat:@"adc is %ld and user app algum", adc]];
}
break;
default:
@@ -476,20 +345,17 @@
@param status 心率测量状态
@param heartRate 心率
*/
-(void)bodyFatScaleManagerCallBackHeartRateMeasureStatus:(BodyFatScaleHeartRateMeasureStatus)status heartRateValue:(NSInteger)heartRate{
- (void)bodyFatScaleManagerCallBackHeartRateMeasureStatus:(BodyFatScaleHeartRateMeasureStatus)status heartRateValue:(NSInteger)heartRate {
switch (status) {
case BodyFatScaleHeartRateMeasureStatus_Testing:
{
case BodyFatScaleHeartRateMeasureStatus_Testing: {
[self addLog:@"Heart Rate Testing"];
}
break;
case BodyFatScaleHeartRateMeasureStatus_Success:
{
[self addLog:[NSString stringWithFormat:@"Heart Rate is %ld",heartRate]];
case BodyFatScaleHeartRateMeasureStatus_Success: {
[self addLog:[NSString stringWithFormat:@"Heart Rate is %ld", heartRate]];
}
break;
case BodyFatScaleHeartRateMeasureStatus_Fail:
{
case BodyFatScaleHeartRateMeasureStatus_Fail: {
[self addLog:@"Heart Rate Test failure"];
}
break;
@@ -504,8 +370,8 @@
@param code 错误码
1:超重
*/
-(void)bodyFatScaleManagerCallBackErrorCode:(NSInteger)code{
[self addLog:[NSString stringWithFormat:@"error code = %ld",code]];
- (void)bodyFatScaleManagerCallBackErrorCode:(NSInteger)code {
[self addLog:[NSString stringWithFormat:@"error code = %ld", code]];
}
//MARK:回调A6指令数据

@@ -514,25 +380,21 @@
@param status 状态
*/
-(void)bodyFatScaleManagerCallBackUpdateRecordStatus:(BodyFatScaleUpdateRecordStatus)status{
- (void)bodyFatScaleManagerCallBackUpdateRecordStatus:(BodyFatScaleUpdateRecordStatus)status {
switch (status) {
case BodyFatScaleUpdateRecordStatus_AllSuccess:
{
case BodyFatScaleUpdateRecordStatus_AllSuccess: {
[self addLog:@"Update All Users Success"];
}
break;
case BodyFatScaleUpdateRecordStatus_OneSuccess:
{
case BodyFatScaleUpdateRecordStatus_OneSuccess: {
[self addLog:@"Update A User Success"];
}
break;
case BodyFatScaleUpdateRecordStatus_OneFail:
{
case BodyFatScaleUpdateRecordStatus_OneFail: {
[self addLog:@"Update A User Failure"];
}
break;
case BodyFatScaleUpdateRecordStatus_AllFail:
{
case BodyFatScaleUpdateRecordStatus_AllFail: {
[self addLog:@"Update All Users Failure"];
}
break;
@@ -546,15 +408,15 @@
@param status 状态
*/
-(void)bodyFatScaleManagerCallBackSendHistoryDataStatus:(BodyFatScaleSendHistoryDataStatus)status{
- (void)bodyFatScaleManagerCallBackSendHistoryDataStatus:(BodyFatScaleSendHistoryDataStatus)status {
if (status == BodyFatScaleSendHistoryDataStatus_No) {
[self addLog:@"No offline datas"];
}else if (status == BodyFatScaleSendHistoryDataStatus_Begin){
} else if (status == BodyFatScaleSendHistoryDataStatus_Begin) {
[self addLog:@"Begin receive offline datas"];
}else if (status == BodyFatScaleSendHistoryDataStatus_End){
} else if (status == BodyFatScaleSendHistoryDataStatus_End) {
[self addLog:@"End receive offline datas"];
}
}

/**
@@ -562,9 +424,9 @@
@param user 用户信息
*/
-(void)bodyFatScaleManagerCallBackBleUserHistoryDataCustomADCModel:(ELBodyFatScaleBleUserModel *)user bodyDataModel:(ELBodyFatScaleBleWeightModel *)bodyModel{
- (void)bodyFatScaleManagerCallBackBleUserHistoryDataCustomADCModel:(ELBodyFatScaleBleUserModel *)user bodyDataModel:(ELBodyFatScaleBleWeightModel *)bodyModel {
//这里的身体指标等数据由app自定义算法计算得到,请区分bodyModel.algNum来调用算法
[self addLog:[NSString stringWithFormat:@"App algorithm-offline history data:userId = %ld weight = %ld unit =%@ point = %ld",user.usrID,bodyModel.weight,AiLinkBleWeightUnitDic[@(bodyModel.weightUnit)],bodyModel.weightPoint]];
[self addLog:[NSString stringWithFormat:@"App algorithm-offline history data:userId = %ld weight = %ld unit =%@ point = %ld", user.usrID, bodyModel.weight, AiLinkBleWeightUnitDic[@(bodyModel.weightUnit)], bodyModel.weightPoint]];
}

/**
@@ -573,44 +435,34 @@
@param user 用户信息
@param bodyModel 体脂数据
*/
-(void)bodyFatScaleManagerCallBackBleUserHistoryDataModel:(ELBodyFatScaleBleUserModel *)user bodyDataModel:(ELBodyFatScaleBleWeightModel *)bodyModel{
- (void)bodyFatScaleManagerCallBackBleUserHistoryDataModel:(ELBodyFatScaleBleUserModel *)user bodyDataModel:(ELBodyFatScaleBleWeightModel *)bodyModel {
//这里的身体指标数据由秤计算得到
[self addLog:[NSString stringWithFormat:@"MCU algorithm-offline history data:userId = %ld weight = %ld unit =%@ point = %ld",user.usrID,bodyModel.weight,AiLinkBleWeightUnitDic[@(bodyModel.weightUnit)],bodyModel.weightPoint]];
[self addLog:[NSString stringWithFormat:@"MCU algorithm-offline history data:userId = %ld weight = %ld unit =%@ point = %ld", user.usrID, bodyModel.weight, AiLinkBleWeightUnitDic[@(bodyModel.weightUnit)], bodyModel.weightPoint]];
}

-(void)bleWifiReceiveWifiSNCode:(int)code{
//MARK:11.根据wifi设备的设备id从服务器获取离线数据(找自己后台要接口)
}

-(void)bodyFatScaleManagerUpdateState:(ELBluetoothState)state{
- (void)bodyFatScaleManagerUpdateState:(ELBluetoothState)state {
switch (state) {
case ELBluetoothStateUnavailable:
{
case ELBluetoothStateUnavailable: {
self.title = @"Please open the bluetooth";
}
break;
case ELBluetoothStateAvailable:
{
case ELBluetoothStateAvailable: {
self.title = @"Bluetooth is open";
}
break;
case ELBluetoothStateScaning:
{
case ELBluetoothStateScaning: {
self.title = @"Scaning";
}
break;
case ELBluetoothStateConnectFail:
{
case ELBluetoothStateConnectFail: {
self.title = @"Connect fail";
}
break;
case ELBluetoothStateDidDisconnect:
{
case ELBluetoothStateDidDisconnect: {
self.title = @"Disconnected";
}
break;
case ELBluetoothStateDidValidationPass:
{
case ELBluetoothStateDidValidationPass: {
self.title = @"Connected";
//获取设备支持的单位
[[ELBodyFatScaleBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:(ELInetGetCmdTypeReadDeviceSupportUnit)];
@@ -619,18 +471,12 @@
[[ELBodyFatScaleBleManager shareManager] changeBodyFatScaleUnit:unit];
//请求历史记录
[[ELBodyFatScaleBleManager shareManager] sendCmd_RequestHistory];
//下发用户列表
[[ELBodyFatScaleBleManager shareManager] sendOfflineUserListToBle:[self get8Users]];
if (self.p.deviceType == ELSupportDeviceTypeBLE_WIFIScale) {
//获取蓝牙连接状态
[[ELBodyFatScaleBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:(ELInetGetCmdTypeGetConnectState)];
}
}
break;
case ELBluetoothStateFailedValidation:
{
case ELBluetoothStateFailedValidation: {
self.title = @"Illegal equipment";
}
break;
@@ -641,25 +487,26 @@
break;
}
}
-(NSArray<ELBodyFatScaleBleUserModel *> *)get8Users{

- (NSArray<ELBodyFatScaleBleUserModel *> *)get8Users {
NSMutableArray *users = [[NSMutableArray alloc] init];
for (int i=0; i<8; i++) {
for (int i = 0; i < 8; i++) {
ELBodyFatScaleBleUserModel *user = [[ELBodyFatScaleBleUserModel alloc] init];
user.createTime = [[NSDate date] timeIntervalSince1970];
user.usrID = i;
user.role = i%4;
user.sex = i%2;
user.age = 26+i;
user.height = 170+i;
user.weight = 600+i;
user.adc = 560+i;
user.role = i % 4;
user.sex = i % 2;
user.age = 26 + i;
user.height = 170 + i;
user.weight = 600 + i;
user.adc = 560 + i;
[users addObject:user];
}

return users.copy;
}

-(ELBodyFatScaleBleUserModel *)getOneUser{
- (ELBodyFatScaleBleUserModel *)getOneUser {
ELBodyFatScaleBleUserModel *user = [[ELBodyFatScaleBleUserModel alloc] init];
user.createTime = [[NSDate date] timeIntervalSince1970];
user.usrID = 0;
@@ -671,9 +518,10 @@
user.adc = 560;
return user;
}
-(void)dealloc{

- (void)dealloc {


}

@end

+ 40
- 17
AILinkBleSDKDemo/12_BroadcastScale/BroadcastScaleViewController.m Zobrazit soubor

@@ -8,12 +8,17 @@

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

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

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

@property(nonatomic, strong) ELBroadcastScaleDataModel *dataModel;

@end

@@ -28,10 +33,9 @@
}


-(void)broadcastScaleBleDataModel:(ELBroadcastScaleDataModel *)model{
- (void)broadcastScaleBleDataModel:(ELBroadcastScaleDataModel *)model {
switch (model.testStatus) {
case BroadcastScaleTestStatusWeightTesting:
{
case BroadcastScaleTestStatusWeightTesting: {
self.statusLbl.text = @"Weight testing";
}
break;
@@ -49,28 +53,33 @@
}
case BroadcastScaleTestStatusTestEnd: {
self.statusLbl.text = @"Test end";
ELBodyFatScaleBleUserModel *user = self.getOneUser;
NSString *weightKg = [ELWeightAlgorithmusModel getKgWithWeightShowStr:model.weight weightUnit:model.weightUnit weightPoint:model.weightPoint];
AlgorithmModel *agModel = [AlgorithmSDK getBodyfatWithWeight:weightKg.floatValue adc:(int) model.adc sex:user.sex age:(int) user.age height:(int) user.height];
NSLog(@"agModel:%@", agModel);

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];
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{

- (void)broadcastScaleBleUpdateState:(ELBluetoothState)state {
if (state == ELBluetoothStateAvailable) {
self.statusLbl.text = @"Connecting";
}else if (state == ELBluetoothStateUnavailable){
} 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)addLog:(NSString *)log {
self.textView.text = [NSString stringWithFormat:@"%@\n%@", log, self.textView.text];
}

-(void)setupUI{
- (void)setupUI {
self.textView = [[UITextView alloc] init];
self.textView.backgroundColor = [UIColor blackColor];
self.textView.text = @"Log";
@@ -81,7 +90,7 @@
make.right.bottom.mas_equalTo(-10);
make.height.equalTo(self.view).multipliedBy(0.7);
}];
//
self.statusLbl = [[UILabel alloc] init];
self.statusLbl.text = @"Connecting";
@@ -96,9 +105,23 @@
make.bottom.equalTo(self.textView.mas_top).mas_offset(-20);
}];
}
-(void)dealloc{

- (void)dealloc {

[[ELBroadcastScaleBleManager shareManager] stopScan];
}

- (ELBodyFatScaleBleUserModel *)getOneUser {
ELBodyFatScaleBleUserModel *user = [[ELBodyFatScaleBleUserModel alloc] init];
user.createTime = [[NSDate date] timeIntervalSince1970];
user.usrID = 0;
user.role = BodyFatScaleRole_Ordinary;
user.sex = ELBluetoothUserSex_Woman;
user.age = 26;
user.height = 170;
user.weight = 600;
user.adc = 560;
return user;
}

@end

+ 2
- 0
AILinkBleSDKDemo/13_EightScale/ELEightScaleAlgorithmTool.h Zobrazit soubor

@@ -23,6 +23,8 @@ NS_ASSUME_NONNULL_BEGIN
/// @param age 年龄
+(ELEightScaleRecordModel *)getRecordModelWithBleDataModel:(ELEightScaleBleDataModel *)dataModel withUserSex:(NSInteger)sex height:(NSInteger)height age:(NSInteger)age;

//新算法
+(ELEightScaleRecordModel *)getNewRecordModelWithBleDataModel:(ELEightScaleBleDataModel *)dataModel withUserSex:(NSInteger)sex height:(NSInteger)height age:(NSInteger)age;

@end


+ 75
- 4
AILinkBleSDKDemo/13_EightScale/ELEightScaleAlgorithmTool.m Zobrazit soubor

@@ -18,12 +18,13 @@

@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 {
+ (ELEightScaleRecordModel *)getNewRecordModelWithBleDataModel:(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];
@@ -89,11 +90,81 @@
recordModel.deviceAlgorithm = [NSString stringWithFormat:@"%d",dataModel.algorithmID];
//新算法
if (dataModel.algorithmID == 0x20) { //MCU计算体脂率,算法ID就应该是0; 但是精衡秤MCU算法秤例外,有个0x20的算法ID
[self new_algorithmOfHTWithDataModel:dataModel sex:sex height:height kgWeight:kgWeight age:age updateRecordModel:recordModel];
return recordModel;
[self new_algorithmOfHTWithDataModel:dataModel sex:sex height:height kgWeight:kgWeight age:age updateRecordModel:recordModel];
return recordModel;
}


/// 根据秤测量的阻抗数据调用算法解析出其他体脂数据
/// @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));

binární
AILinkBleSDKDemo/AILinkBleSDK.framework/AILinkBleSDK Zobrazit soubor


+ 33
- 16
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/AILinkBleSDK-umbrella.h Zobrazit soubor

@@ -10,25 +10,25 @@
#endif
#endif

#import "ELAILinkBleManager.h"
#import "ELTLVModel.h"
#import "NELBleManagerHeader.h"
#import "NELMacAddressModel.h"
#import "NSData+AILinkBle.h"
#import "ELAILinkBleManager+AirDetector.h"
#import "ELAirDetectorBleFunctionModel.h"
#import "ELAirDetectorBleHeader.h"
#import "ELAirDetectorBleParser.h"
#import "ELAirDetectorBleSettingModel.h"
#import "ELAirDetectorBleStatusModel.h"
#import "ELAILinkBleManager+MeatProbe.h"
#import "ELMeatProbeBleModel.h"
#import "ELMeatProbeBleTool.h"
#import "ELVictorLuxMeterBleModel.h"
#import "ELVictorLuxMeterBleTool.h"
#import "ELAiFreshNutritionScaleBleHeader.h"
#import "ELAiFreshNutritionScaleBleManager.h"
#import "ELAiFreshNutritionScaleDataModel.h"
#import "ELBleDisposeDataTool.h"
#import "ELBlePublicTool.h"
#import "ELBleWifiDetailModel.h"
#import "ELBluetoothManager+BleWifi.h"
#import "ELBluetoothManager+BleWifi_Callback.h"
#import "ELBluetoothManager+Settings.h"
#import "ELBluetoothManager+Settings_Callback.h"
#import "ELBluetoothManager.h"
#import "ELBodyIndexAlgorithmModel.h"
#import "ELEncryptTool.h"
#import "ELHeightAlgorithmusModel.h"
#import "ELPeripheralModel.h"
#import "ELSDKHeader.h"
#import "ELTempAlgorithmusModel.h"
#import "ELTLVModel.h"
#import "ELWeightAlgorithmusModel.h"
#import "ELAutomaticThermometerBleManager.h"
#import "ELAutomaticThermometerDataModel.h"
#import "ELAutomaticThermometerFunction1Model.h"
@@ -48,6 +48,8 @@
#import "ELBloodBleSDKHeader.h"
#import "ELBloodSugarBleHeader.h"
#import "ELBloodSugarBleManager.h"
#import "AlgorithmSDK.h"
#import "BfsCalculateSDK.h"
#import "ELBodyFatScaleBleHeader.h"
#import "ELBodyFatScaleBleManager.h"
#import "ELBodyFatScaleBleUserModel.h"
@@ -72,6 +74,19 @@
#import "ELCoffeeScaleBleDataModel.h"
#import "ELCoffeeScaleBleHeader.h"
#import "ELCoffeeScaleBleManager.h"
#import "ELBlePublicTool.h"
#import "ELBleWifiDetailModel.h"
#import "ELBluetoothManager+BleWifi.h"
#import "ELBluetoothManager+BleWifi_Callback.h"
#import "ELBluetoothManager+Settings.h"
#import "ELBluetoothManager+Settings_Callback.h"
#import "ELBluetoothManager.h"
#import "ELBodyIndexAlgorithmModel.h"
#import "ELEncryptTool.h"
#import "ELHeightAlgorithmusModel.h"
#import "ELPeripheralModel.h"
#import "ELTempAlgorithmusModel.h"
#import "ELWeightAlgorithmusModel.h"
#import "ELEightScaleBleBfrDataModel.h"
#import "ELEightScaleBleDataModel.h"
#import "ELEightScaleBleManager.h"
@@ -119,6 +134,8 @@
#import "ELWheelMonitorBleHeader.h"
#import "ELWheelMonitorBleManager.h"
#import "ELWheelMonitorBleModel.h"
#import "ELBleDisposeDataTool.h"
#import "ELSDKHeader.h"

FOUNDATION_EXPORT double AILinkBleSDKVersionNumber;
FOUNDATION_EXPORT const unsigned char AILinkBleSDKVersionString[];

+ 68
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/AlgorithmSDK.h Zobrazit soubor

@@ -0,0 +1,68 @@
//
// Algorithm.h
// GreatBody
//
// Created by steven wu on 2019/6/25.
//

#import <Foundation/Foundation.h>

typedef NS_ENUM(NSInteger, AlgUserSex) {
AlgUserSex_Female = 0,//2,
AlgUserSex_Male = 1,
};


@interface AlgorithmModel : NSObject

///bmi
@property (nonatomic, copy) NSString *bmi;
///体脂率 bodyfatRate
@property (nonatomic, copy) NSString *bfr;
///皮下脂肪率 subcutaneousFat rate
@property (nonatomic, copy) NSString *sfr;
///内脏脂肪指数 visceralFat rate
@property (nonatomic, copy) NSString *uvi;
///肌肉率 muscle rate
@property (nonatomic, copy) NSString *rom;
///基础代谢率 BMR
@property (nonatomic, copy) NSString *bmr;
///骨骼质量 boneMass
@property (nonatomic, copy) NSString *bm;
///水含量vwc: moisture
@property (nonatomic, copy) NSString *vwc;
///身体年龄 physicalAge
@property (nonatomic, copy) NSString *physicalAge;
///蛋白率 proteinRate
@property (nonatomic, copy) NSString *pp;


/* For example
bmi : 23.7;
bfr : 22.2;
rom : 51;
vwc : 57;
bm : 2.8;
sfr : 19.9;
bmi : 1549;
pp : 16.6;
uvi : 7;
physicalAge : 26;
*/
@end


@interface AlgorithmSDK : NSObject

/**
* Inet AlgorithmSDK ElinkThings算法
* Incoming user information + adc, calculate 10 original body fat data (the connected scale is calculated by the scale end and transmitted to the app via Bluetooth, and the broadcast scale calls this SDK calculation) 传入用户信息+adc,计算出10项原始体脂数据(连接秤由秤端计算并蓝牙传给app,广播秤调用本SDK计算)
* eg:
* kgWeight: 50.6 age: 25 height: 175
*/
+ (AlgorithmModel *)getBodyfatWithWeight:(double)kgWeight adc:(int)adc sex:(AlgUserSex)sex age:(int)age height:(int)height;


@end



+ 93
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/BfsCalculateSDK.h Zobrazit soubor

@@ -0,0 +1,93 @@
//
// FRK_fatScalesSDK.h
// FRK_fatScalesSDK
//
// Created by zhang on 17/2/24.
// Copyright © 2017年 taolei. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef NS_ENUM(NSInteger, BfsUserSex) {
BfsUserSex_Female = 0,//2,
BfsUserSex_Male = 1,
};


@interface BfsCalculateItem : NSObject

/**
* 标准体重 standardWeight
*/
@property (nonatomic, assign) double standardWeight;
/**
* 体重控制量 weightControl
*/
@property (nonatomic, assign) double weightControl;
/**
* 脂肪量 fatMass
*/
@property (nonatomic, assign) double fatMass;
/**
* 去脂体重 weightWithoutFat
*/
@property (nonatomic, assign) double weightWithoutFat;
/**
* 肌肉量 muscleMass
*/
@property (nonatomic, assign) double muscleMass;
/**
* 蛋白量 proteinMass
*/
@property (nonatomic, assign) double proteinMass;
/**
* 肥胖等级 fatlevel
* 1.标准 standard
* 2.偏瘦 thin
* 3.偏重 over weight
* 4.体重不足 insufficient
* 5.超重 Severely overweight
*/
@property (nonatomic, assign) NSInteger fatlevel;


/** For example
(double) _standardWeight = 66.5
(double) _weightControl = 6.1999998092651367
(double) _fatMass = 16.100000381469727
(double) _weightWithoutFat = 56.599998474121094
(double) _muscleMass = 37.099998474121094
(double) _proteinMass = 12.100000381469727
(NSInteger) _fatlevel = 1
*/
@end



@interface BfsCalculateSDK : NSObject


/**
* According to the bfr / rom / pp in the basic parameters returned by the scale, calculate 7 additional items that the App needs to display 根据秤返回的基本参数中的bfr/rom/pp,计算出App需要额外显示的7个项目
*@param sex
* 性别: 男:1 女 2
* @param height
* 身高:1~270(CM)
* @param weight
* 体重:1~220(KG)
* @param bfr
* 体脂率 43.6
* @param rom
* 肌肉率 55.2
* @param pp
* 蛋白率 25.9
* @return BfsCalculateItem
*/
+ (BfsCalculateItem *)getBodyfatItemWithSex:(BfsUserSex)sex height:(NSInteger)height weight:(double)weight bfr:(NSString *)bfr rom:(NSString *)rom pp:(NSString *)pp;

/**
* 获取标准体重(单位:kg)
*/
+ (double) getStandardWeight:(NSInteger)sex andheight:(NSInteger)height;

@end

+ 131
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELAILinkBleManager+AirDetector.h Zobrazit soubor

@@ -0,0 +1,131 @@
//
// ELAILinkBleManager+AirDetector.h
// AILinkBleSDK
//
// Created by LarryZhang on 2022/12/12.
//

#import "ELAILinkBleManager.h"
#import "ELAirDetectorBleHeader.h"
#import "ELTLVModel.h"
#import "ELAirDetectorBleParser.h"

//typedef NS_ENUM(NSUInteger, ELAirDetectorTLVType);
//typedef NS_ENUM(NSUInteger, ELAirDetectorBleCMD);

NS_ASSUME_NONNULL_BEGIN

@interface ELAILinkBleManager (AirDetector)

//APP获取设备功能列表 //0x01 CMD:获取设备支持的功能列表
- (void)airDetectorRequestDeviceFunctions;

//APP获取设备状态 //0x03 CMD:获取设备状态
- (void)airDetectorRequestDeviceStatus;

//APP设置/获取参数 //0x05 CMD:设置/获取参数功能
- (void)airDetectorRequestDeviceSettings;
- (void)airDetectorSendDeviceSettings:(NSArray<ELTLVModel *> *)tlvs;

//APP与模块心跳 //0x07 CMD:定时心跳包
- (void)airDetectorSendHeartbeat;


@end

@interface ELAILinkBleManager (tlv)

//0x01:甲醛
+ (ELTLVModel *)tlvHCHOAlarmOn:(BOOL)on value:(NSInteger)value;

//0x02:温度 //参数: scale(标度) 表示小数点位数
+ (ELTLVModel *)tlvTemperatureMinValue:(NSInteger)minValue maxValue:(NSInteger)maxValue uint:(ELDeviceTemperatureUnit)unit scale:(NSInteger)scale;

//0x03:湿度
+ (ELTLVModel *)tlvHumidityMinValue:(NSInteger)minValue maxValue:(NSInteger)maxValue;

//0x04:PM2.5
+ (ELTLVModel *)tlvPM2_5AlarmOn:(BOOL)on value:(NSInteger)value;

//0x05:PM1.0
+ (ELTLVModel *)tlvPM1AlarmOn:(BOOL)on value:(NSInteger)value;

//0x06:PM10
+ (ELTLVModel *)tlvPM10AlarmOn:(BOOL)on value:(NSInteger)value;

//0x07:VOC
+ (ELTLVModel *)tlvVOCAlarmOn:(BOOL)on value:(NSInteger)value;

//0x08:CO2
+ (ELTLVModel *)tlvCO2AlarmOn:(BOOL)on value:(NSInteger)value;

//0x09:AQI
+ (ELTLVModel *)tlvAQIAlarmOn:(BOOL)on value:(NSInteger)value;

//0x0B:音量状态
+ (ELTLVModel *)tlvVolumeOn:(BOOL)on value:(NSInteger)value;

//0x0C:报警时长
+ (ELTLVModel *)tlvAlertDuration:(NSInteger)duration;

//0x0D:报警铃声
+ (ELTLVModel *)tlvAlertRing:(NSInteger)ringValue;

//0x0F:设备自检 ??
+ (ELTLVModel *)tlvSelf:(NSInteger)ringValue;

//0x10:TVOC
+ (ELTLVModel *)tlvTVOCAlarmOn:(BOOL)on value:(NSInteger)value;

//0x11:单位切换
+ (ELTLVModel *)tlvTemperatureUint:(ELDeviceTemperatureUnit)unit;

//0x13:设备绑定
+ (ELTLVModel *)tlvBindDeviceRequest;
+ (ELTLVModel *)tlvBindDeviceCancel;

//0x15:CO
+ (ELTLVModel *)tlvCOAlarmOn:(BOOL)on value:(NSInteger)value;

//0x16:闹钟设置
+ (ELTLVModel *)tlvSetupAlarms:(NSArray *)alarms;

//0x17:恢复出厂设置
+ (ELTLVModel *)tlvRestoreFactory;

//0x18:参数校准设置
+ (ELTLVModel *)tlvCalibrationUp:(ELAirDetectorTLVType)type;
+ (ELTLVModel *)tlvCalibrationDown:(ELAirDetectorTLVType)type;
+ (ELTLVModel *)tlvCalibrationReset:(ELAirDetectorTLVType)type;

//0x19:时间格式设置
+ (ELTLVModel *)tlvTimeFormat12H;
+ (ELTLVModel *)tlvTimeFormat24H;

//0x1A:设备亮度设置
+ (ELTLVModel *)tlvDeviceBrightnessOn:(BOOL)on value:(NSInteger)value;

//0x1B:按键音效设置
+ (ELTLVModel *)tlvKeySoundOn;
+ (ELTLVModel *)tlvKeySoundOff;

//0x1C:报警音效设置
+ (ELTLVModel *)tlvAlertSoundOn;
+ (ELTLVModel *)tlvAlertSoundOff;

//0x1D:图标显示设置
+ (ELTLVModel *)tlvIconDisplayOn;
+ (ELTLVModel *)tlvIconDisplayOff;

//0x1E:监控显示数据
+ (ELTLVModel *)tlvMonitoringDisplayDataOn;
+ (ELTLVModel *)tlvMonitoringDisplayDataOff;

//0x1F:数据显示模式设置
+ (ELTLVModel *)tlvDataDisplayMode:(NSInteger)mode;


@end

NS_ASSUME_NONNULL_END


+ 31
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELAILinkBleManager+MeatProbe.h Zobrazit soubor

@@ -0,0 +1,31 @@
//
// ELAILinkBleManager+MeatProbe.h
// AILinkBleSDK
//
// Created by LarryZhang on 2022/11/22.
//

#import "ELAILinkBleManager.h"

NS_ASSUME_NONNULL_BEGIN

@interface ELAILinkBleManager (MeatProbe)


//MeatProbe 设置设备信息 0x35
- (void)meatProbeSendCustomData:(NSData *_Nonnull)customData;

//MeatProbe 设置设备信息 0x35 请求
- (void)meatProbeRequestCustomData;

//切换温度单位 A7
- (void)meatProbeSwitchUint:(ELDeviceTemperatureUnit)unit;


//关闭自动关机指令 A7 **调试阶段使用
- (void)meatProbeCloseAutoOff;


@end

NS_ASSUME_NONNULL_END

+ 195
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELAILinkBleManager.h Zobrazit soubor

@@ -0,0 +1,195 @@
//
// ELAILinkBleManager.h
//
// Created by LarryZhang on 2022/8/13.
// Copyright © 2022 iot_iMac. All rights reserved.
//


#import <Foundation/Foundation.h>
#import <CoreBluetooth/CoreBluetooth.h>

#import "NELBleManagerHeader.h"
#import "ELSDKHeader.h"

NS_ASSUME_NONNULL_BEGIN

@class ELAILinkPeripheral;

@protocol ELAILinkBleManagerDelegate <NSObject>

@optional

//扫描
- (void)managerDidUpdateState:(CBCentralManager *)central;

- (void)managerScanState:(BOOL)scanning;

- (void)managerDidDiscoverPeripheral:(ELAILinkPeripheral *)peripheral;

- (void)managerDidDiscoverMorePeripheral:(NSDictionary<NSUUID *, ELAILinkPeripheral *> *)peripherals;

//连接
- (void)managerDidConnectPeripheral:(CBPeripheral *)peripheral;

- (void)managerDidFailToConnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error;

- (void)managerDidDisconnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error;

- (void)managerDidUpdateConnect:(NELBleManagerConnectState)state;

//服务 & 特征
- (void)peripheralDidDiscoverServices:(NSArray<CBService *> *)services;

- (void)peripheralDidDiscoverCharacteristicsForService:(NSArray<CBCharacteristic *> *)characteristics;

- (void)peripheralDidUpdateNotificationStateForCharacteristic:(CBCharacteristic *)characteristic;

- (void)peripheralDidUpdateValueForCharacteristic:(CBCharacteristic *)characteristic;

- (void)didWriteValueForCharacteristic:(CBCharacteristic *)characteristic;

- (void)peripheralDidReadRSSI:(nonnull NSNumber *)RSSI;


@optional

//A7数据 payload
- (void)aiLinkBleReceiveA7Data:(NSData *)payload;

//A6数据 packet
- (void)aiLinkBleReceiveA6Data:(NSData *)packet;


@end

@interface ELAILinkBleManager : NSObject

@property(nonatomic, assign, readonly, getter=isScanning) BOOL scanning;

@property(nonatomic, assign, readonly) CBCentralManager *central;

@property (nonatomic, weak) id<ELAILinkBleManagerDelegate> delegate DEPRECATED_MSG_ATTRIBUTE("use 'ailinkDelegate' only");

//不是必须使用单例
+ (instancetype)sharedManager;


@property (nonatomic, strong) CBPeripheral *peripheral;

@property (nonatomic, weak) id<ELAILinkBleManagerDelegate> ailinkDelegate;

//模块版本号
@property (nonatomic, copy) NSString *bmVersion;
@property (nonatomic, copy) NSString *bmVersionPro;
//电池状态
@property (nonatomic, assign) struct ELBatteryStruct battery;
//单位列表
@property (nonatomic, strong) NSArray<NSNumber *> *weightArray;
@property (nonatomic, strong) NSArray<NSNumber *> *heightArray;
@property (nonatomic, strong) NSArray<NSNumber *> *temperatureArray;
@property (nonatomic, strong) NSArray<NSNumber *> *bloodPressureArray;
@property (nonatomic, strong) NSArray<NSNumber *> *pressureArray;
@property (nonatomic, strong) NSArray<NSNumber *> *bloodSugarUnitArray;
@property (nonatomic, strong) NSArray<NSNumber *> *volumeUnitArray;

@end

@interface ELAILinkBleManager (scan)

- (void)scanAll;
- (void)scanFilterWithCidArray:(NSArray<NSNumber *> *_Nonnull)cidArray;
- (void)scanFilterWithMacArray:(NSArray<NSString *> *_Nonnull)macArray;
- (void)scanFilterWithCidArray:(NSArray<NSNumber *> *_Nonnull)cidArray macArray:(NSArray<NSString *> *_Nonnull)macArray;

// 获取当前连接到系统的 peripheral 设备的列表(如被其它程序连接着)
- (NSArray<CBPeripheral *> *)retrieveConnectedPeripherals;

//NELBleManager
- (void)stopScan;


@end

@interface ELAILinkBleManager (connect)

- (void)connectPeripheral:(CBPeripheral *)peripheral;

- (void)disconnectPeripheral;


- (void)connectAILinkPeripheral:(ELAILinkPeripheral * _Nonnull)ailinkPeripheral;

- (ELAILinkPeripheral * _Nullable)currentAILinkPeripheral;

@end



@interface ELAILinkBleManager (send)

- (void)sendA7Payload:(NSData *)payload;
- (void)sendA6Payload:(NSData *)payload;

//base method of 'sendA7Payload' & 'sendA6Payload'
- (void)sendCmd:(NSData *)cmdData;

////最大发送payload长度
//- (NSUInteger)maximumWritePayloadLength;
////OTA最大发送payload长度
//- (NSUInteger)maximumWriteOTAPayloadLength;

//发送队列发送周期
- (void)configWriteDataQueueInterval:(CGFloat)interval;

@end

@interface ELAILinkBleManager (A6Method)

/**
Sync the current time of phone to BLE(设置手机本地时间给蓝牙模块,只在蓝牙体脂秤等需要蓝牙模块保存历史记录时才调用)
@param enable
NO: In addition to the ability to turn off the time function, you can save part of the current (default)(除能,关闭时间功能,可省部分电流(默认))
YES:Enable, turn on the timer function timer(使能,开启计时功能定时器)
*/
- (void)syncBleNowDate:(BOOL)enable;

///仅WIFI秤调用,同步世界时间(0时区)到wifi-ble模块
- (void)syncBleGMTNowDate:(BOOL)enable;

///同步手机本地时间给mcu,每次连接成功后会自动调用
- (void)syncMCUNowDate;

@end




#pragma mark - ELAILinkPeripheral

@interface ELAILinkPeripheral : NSObject

@property (nonatomic, strong) CBPeripheral *peripheral;

@property (nonatomic, strong) NSDictionary *advertisementData;

@property (nonatomic, strong) NSNumber *RSSI;

@property (nonatomic, assign) NSTimeInterval timestamp;

@property (nonatomic, copy) NSString *macAddressString;
@property (nonatomic, strong) NSData *macData;

@property (nonatomic, assign) UInt16 cid;

@property (nonatomic, assign) UInt16 vid;

@property (nonatomic, assign) UInt16 pid;


@property (nonatomic, strong) NSUUID *identifier;

@end


NS_ASSUME_NONNULL_END

+ 126
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELAirDetectorBleFunctionModel.h Zobrazit soubor

@@ -0,0 +1,126 @@
//
// ELAirDetectorBleFunctionModel.h
// AILinkBleSDK
//
// Created by LarryZhang on 2022/12/13.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface ELAirDetectorBleFunctionModel : NSObject

//0x01:甲醛
@property (nonatomic, assign) NSInteger HCHOScale;
@property (nonatomic, assign) NSInteger HCHOMin;
@property (nonatomic, assign) NSInteger HCHOMax;

//0x02:温度
@property (nonatomic, assign) NSInteger temperatureScale;
@property (nonatomic, assign) NSInteger temperatureMin;
@property (nonatomic, assign) NSInteger temperatureMax;

//0x03:湿度
@property (nonatomic, assign) NSInteger humidityScale;
@property (nonatomic, assign) NSInteger humidityMin;
@property (nonatomic, assign) NSInteger humidityMax;

//0x04:PM2.5
@property (nonatomic, assign) NSInteger PM2_5Scale;
@property (nonatomic, assign) NSInteger PM2_5Min;
@property (nonatomic, assign) NSInteger PM2_5Max;

//0x05:PM1.0
@property (nonatomic, assign) NSInteger PM1Scale;
@property (nonatomic, assign) NSInteger PM1Min;
@property (nonatomic, assign) NSInteger PM1Max;

//0x06:PM10
@property (nonatomic, assign) NSInteger PM10Scale;
@property (nonatomic, assign) NSInteger PM10Min;
@property (nonatomic, assign) NSInteger PM10Max;

//0x07:VOC
@property (nonatomic, assign) NSInteger VOCScale;
@property (nonatomic, assign) NSInteger VOCMin;
@property (nonatomic, assign) NSInteger VOCMax;

//0x08:CO2
@property (nonatomic, assign) NSInteger CO2Scale;
@property (nonatomic, assign) NSInteger CO2Min;
@property (nonatomic, assign) NSInteger CO2Max;

//0x09:AQI
@property (nonatomic, assign) NSInteger AQIScale;
@property (nonatomic, assign) NSInteger AQIMin;
@property (nonatomic, assign) NSInteger AQIMax;

//0x0A:报警功能
@property (nonatomic, assign) BOOL alertSupport;

//0x0B:音量
@property (nonatomic, assign) NSInteger volumeMax;

//0x0C:报警时长
@property (nonatomic, assign) NSInteger alertDurationMax;

//0x0D:报警铃声
@property (nonatomic, assign) NSInteger alertRingCount;

//0x0E:设备故障
@property (nonatomic, assign) BOOL deviceErrorSupport;

//0x0F:设备自检
@property (nonatomic, assign) BOOL deviceSelfTestSupport;

//0x10:TVOC
@property (nonatomic, assign) NSInteger TVOCScale;
@property (nonatomic, assign) NSInteger TVOCMin;
@property (nonatomic, assign) NSInteger TVOCMax;

//0x15:CO(一氧化碳)
@property (nonatomic, assign) NSInteger COScale;
@property (nonatomic, assign) NSInteger COMin;
@property (nonatomic, assign) NSInteger COMax;

//0x16:闹钟功能声明
@property (nonatomic, assign) BOOL alarmAllSupport;
@property (nonatomic, assign) NSInteger alarmCount;
@property (nonatomic, assign) NSInteger alarmMode;

//0x17:恢复出厂设置声明
@property (nonatomic, assign) BOOL restoreFactorySupport;

//0x18:参数校准声明
@property (nonatomic, strong) NSArray<NSNumber *> *_Nullable calibrationSupportArray;

//0x19:时间格式声明
@property (nonatomic, assign) BOOL timeFormat12HSupport;
@property (nonatomic, assign) BOOL timeFormat24HSupport;

//0x1A:设备亮度声明
@property (nonatomic, assign) BOOL deviceBrightnessAuto;
@property (nonatomic, assign) BOOL deviceBrightnessManual;
@property (nonatomic, assign) BOOL deviceBrightnessGearMode;
@property (nonatomic, assign) BOOL deviceBrightnessGearMax;

//0x1B:按键音效声明
@property (nonatomic, assign) BOOL keySoundSupport;

//0x1C:报警音效声明
@property (nonatomic, assign) BOOL alertSoundSupport;

//0x1D:图标显示声明
@property (nonatomic, assign) BOOL iconDisplaySupport;

//0x1E:监控显示数据声明
@property (nonatomic, assign) BOOL monitoringDisplayDataSupport;

//0x1F:数据显示模式声明
@property (nonatomic, assign) NSInteger dataDisplayModeCount;


@end

NS_ASSUME_NONNULL_END

+ 63
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELAirDetectorBleHeader.h Zobrazit soubor

@@ -0,0 +1,63 @@
//
// ELAirDetectorBleHeader.h
// Pods
//
// Created by LarryZhang on 2022/12/13.
//

#ifndef ELAirDetectorBleHeader_h
#define ELAirDetectorBleHeader_h


typedef NS_ENUM(NSUInteger, ELAirDetectorBleCMD) {
ELAirDetectorBleCMD01 = 0x01, //CMD:获取设备支持的功能列表
ELAirDetectorBleCMD02 = 0x02, //CMD:设备返回功能
ELAirDetectorBleCMD03 = 0x03, //CMD:获取设备状态
ELAirDetectorBleCMD04 = 0x04, //CMD:设备返回状态
ELAirDetectorBleCMD05 = 0x05, //CMD:设置/获取参数功能
ELAirDetectorBleCMD06 = 0x06, //CMD:MCU返回参数功能
ELAirDetectorBleCMD07 = 0x07, //CMD:定时心跳包
ELAirDetectorBleCMD08 = 0x08, //CMD:模块返回心跳包
ELAirDetectorBleCMDF1 = 0xF1, //CMD:上发保存数据
};

typedef NS_ENUM(NSUInteger, ELAirDetectorTLVType) {
ELAirDetectorTLVTypeHCHO = 0x01, //甲醛
ELAirDetectorTLVTypeTemperature = 0x02, //温度
ELAirDetectorTLVTypeHumidity = 0x03, //湿度
ELAirDetectorTLVTypePM2_5 = 0x04, //PM2.5
ELAirDetectorTLVTypePM1 = 0x05, //PM1
ELAirDetectorTLVTypePM10 = 0x06, //PM10
ELAirDetectorTLVTypeVOC = 0x07,
ELAirDetectorTLVTypeCO2 = 0x08,
ELAirDetectorTLVTypeAQI = 0x09,
ELAirDetectorTLVTypeSettingAlert = 0x0A, //报警功能
ELAirDetectorTLVTypeSettingVolume = 0x0B, //音量
ELAirDetectorTLVTypeSettingAlertDuration = 0x0C, //报警时长
ELAirDetectorTLVTypeSettingAlertRing = 0x0D, //报警铃声
ELAirDetectorTLVTypeSettingDeviceError = 0x0E, //设备故障
ELAirDetectorTLVTypeSettingDeviceSelfTest = 0x0F, //设备自检
ELAirDetectorTLVTypeTVOC = 0x10, //TVOC
ELAirDetectorTLVTypeSwitchTemperatureUnit = 0x11, //单位切换
ELAirDetectorTLVTypeBatteryState = 0x12, //电池状态
ELAirDetectorTLVTypeBindDevice = 0x13, //设备绑定
ELAirDetectorTLVTypeHeartbeat = 0x14, //心跳包(用以模块和APP通信)

ELAirDetectorTLVTypeCO = 0x15, //CO(一氧化碳)
ELAirDetectorTLVTypeAlarm = 0x16, //闹钟功能
ELAirDetectorTLVTypeRestoreFactorySetting = 0x17, //恢复出厂设置
ELAirDetectorTLVTypeCalibrationParameter = 0x18, //参数校准
ELAirDetectorTLVTypeTimeFormat = 0x19, //时间格式
ELAirDetectorTLVTypeDeviceBrightness = 0x1A, //设备亮度
ELAirDetectorTLVTypeKeySound = 0x1B, //按键音效
ELAirDetectorTLVTypeAlertSound = 0x1C, //报警音效
ELAirDetectorTLVTypeIconDisplay = 0x1D, //图标显示
ELAirDetectorTLVTypeMonitoringDisplayData = 0x1E, //监控显示数据
ELAirDetectorTLVTypeDataDisplayMode = 0x1F, //数据显示模式
};

#endif /* ELAirDetectorBleHeader_h */

+ 32
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELAirDetectorBleParser.h Zobrazit soubor

@@ -0,0 +1,32 @@
//
// ELAirDetectorBleParser.h
// AILinkBleSDK
//
// Created by LarryZhang on 2022/12/12.
//

#import <Foundation/Foundation.h>
#import "ELSDKHeader.h"
#import "ELAirDetectorBleHeader.h"
#import "ELAirDetectorBleFunctionModel.h"
#import "ELAirDetectorBleStatusModel.h"
#import "ELAirDetectorBleSettingModel.h"

NS_ASSUME_NONNULL_BEGIN

typedef void(^didUpdateDataBlock)(ELAirDetectorBleCMD cmd, ELAirDetectorTLVType type);

@interface ELAirDetectorBleParser : NSObject

@property (nonatomic, strong) ELAirDetectorBleFunctionModel *functionModel;

@property (nonatomic, strong) ELAirDetectorBleStatusModel *statusModel;

@property (nonatomic, strong) ELAirDetectorBleSettingModel *settingModel;


- (void)parseData:(NSData *)payload callback:(didUpdateDataBlock)calllback;

@end

NS_ASSUME_NONNULL_END

+ 113
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELAirDetectorBleSettingModel.h Zobrazit soubor

@@ -0,0 +1,113 @@
//
// ELAirDetectorBleSettingModel.h
// AILinkBleSDK
//
// Created by LarryZhang on 2022/12/14.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface ELAirDetectorBleSettingModel : NSObject

//0x01:甲醛
@property (nonatomic, assign) BOOL HCHOAlertOn;
@property (nonatomic, assign) NSInteger HCHOAlertValue;

//0x02:温度
@property (nonatomic, assign) NSInteger temperatureScale;
@property (nonatomic, assign) NSInteger temperatureUint;
@property (nonatomic, assign) NSInteger temperatureAlertMinValue;
@property (nonatomic, assign) NSInteger temperatureAlertMaxValue;

//0x03:湿度
@property (nonatomic, assign) NSInteger humidityAlertMinValue;
@property (nonatomic, assign) NSInteger humidityAlertMaxValue;

//0x04:PM2.5
@property (nonatomic, assign) BOOL PM2_5AlertOn;
@property (nonatomic, assign) NSInteger PM2_5AlertValue;

//0x05:PM1.0
@property (nonatomic, assign) BOOL PM1AlertOn;
@property (nonatomic, assign) NSInteger PM1AlertValue;

//0x06:PM10
@property (nonatomic, assign) BOOL PM10AlertOn;
@property (nonatomic, assign) NSInteger PM10AlertValue;

//0x07:VOC
@property (nonatomic, assign) BOOL VOCAlertOn;
@property (nonatomic, assign) NSInteger VOCAlertValue;

//0x08:CO2
@property (nonatomic, assign) BOOL CO2AlertOn;
@property (nonatomic, assign) NSInteger CO2AlertValue;

//0x09:AQI
@property (nonatomic, assign) BOOL AQIAlertOn;
@property (nonatomic, assign) NSInteger AQIAlertValue;

//0x0B:音量状态
@property (nonatomic, assign) BOOL volumeAlertOn;
@property (nonatomic, assign) NSInteger volumeValue;

//0x0C:报警时长
@property (nonatomic, assign) NSInteger alertDurationValue;

//0x0D:报警铃声
@property (nonatomic, assign) NSInteger alertRingValue;

//0x0F:设备自检
@property (nonatomic, assign) BOOL deviceSelfTesting;

//0x10:TVOC
@property (nonatomic, assign) BOOL TVOCAlertOn;
@property (nonatomic, assign) NSInteger TVOCAlertValue;

//0x11:单位切换
@property (nonatomic, assign) NSInteger switchTemperatureUint;

//0x13:设备绑定
@property (nonatomic, assign) NSInteger bandState;

//0x15:CO
@property (nonatomic, assign) BOOL COAlertOn;
@property (nonatomic, assign) NSInteger COAlertValue;

//0x16:闹钟设置 //原始数据未解析
@property (nonatomic, strong) NSData *alarmSettingData;

//0x17:恢复出厂设置
@property (nonatomic, assign) NSInteger restoreFactoryState;

//0x18:参数校准设置 //原始数据未解析
@property (nonatomic, strong) NSData *calibrationSettingData;

//0x19:时间格式设置
@property (nonatomic, assign) NSInteger timeFormatValue;

//0x1A:设备亮度状态
@property (nonatomic, assign) BOOL deviceBrightnessOn;
@property (nonatomic, assign) NSInteger deviceBrightnessValue;

//按键音效设置
@property (nonatomic, assign) BOOL keySoundOn;

//0x1C:报警音效设置
@property (nonatomic, assign) BOOL alertSoundOn;

//0x1D:图标显示设置
@property (nonatomic, assign) BOOL iconDisplayOn;

//0x1E:监控显示数据
@property (nonatomic, assign) BOOL monitoringDisplayDataOn;

//0x1F:数据显示模式设置
@property (nonatomic, assign) NSInteger dataDisplayModeValue;


@end

NS_ASSUME_NONNULL_END

+ 117
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELAirDetectorBleStatusModel.h Zobrazit soubor

@@ -0,0 +1,117 @@
//
// ELAirDetectorBleStatusModel.h
// AILinkBleSDK
//
// Created by LarryZhang on 2022/12/13.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface ELAirDetectorBleStatusModel : NSObject

//0x01:甲醛
@property (nonatomic, assign) NSInteger HCHOValue;

//0x02:温度
@property (nonatomic, assign) NSInteger temperatureScale;
@property (nonatomic, assign) NSInteger temperatureValue;
@property (nonatomic, assign) NSInteger temperatureUint;

//0x03:湿度
@property (nonatomic, assign) NSInteger humidityValue;

//0x04:PM2.5
@property (nonatomic, assign) NSInteger PM2_5Value;

//0x05:PM1.0
@property (nonatomic, assign) NSInteger PM1Value;

//0x06:PM10
@property (nonatomic, assign) NSInteger PM10Value;

//0x07:VOC
@property (nonatomic, assign) NSInteger VOCValue;

//0x08:CO2
@property (nonatomic, assign) NSInteger CO2Value;

//0x09:AQI
@property (nonatomic, assign) NSInteger AQIValue;

//0x0A:报警状态
@property (nonatomic, assign) BOOL alertOn;
@property (nonatomic, assign) BOOL alertHCHOHigh;
@property (nonatomic, assign) BOOL alertTemperatureLow;
@property (nonatomic, assign) BOOL alertTemperatureHigh;
@property (nonatomic, assign) BOOL alertHumidityLow;
@property (nonatomic, assign) BOOL alertHumidityHigh;
@property (nonatomic, assign) BOOL alertPM2_5;
@property (nonatomic, assign) BOOL alertPM1;
@property (nonatomic, assign) BOOL alertPM10;
@property (nonatomic, assign) BOOL alertVOC;
@property (nonatomic, assign) BOOL alertCO2;
@property (nonatomic, assign) BOOL alertAQI;
@property (nonatomic, assign) BOOL alertTVOC;

//0x0B:音量状态
@property (nonatomic, assign) BOOL volumeOn;
@property (nonatomic, assign) NSInteger volumeValue;

//0x0C:报警时长
@property (nonatomic, assign) NSInteger alertDurationValue;

//0x0D:报警铃声
@property (nonatomic, assign) NSInteger alertRingValue;

//0x0E:设备故障
@property (nonatomic, assign) BOOL deviceError;

//0x0F:设备自检
@property (nonatomic, assign) BOOL deviceSelfTesting;

//0x10:TVOC
@property (nonatomic, assign) NSInteger TVOCValue;

//0x12:电池状态
@property (nonatomic, assign) NSInteger batteryState;
@property (nonatomic, assign) NSInteger batteryPercentValue;

//0x15:CO
@property (nonatomic, assign) NSInteger COValue;

//0x16:闹钟状态 //原始数据未解析
@property (nonatomic, strong) NSData *alarmStatusData;

//0x17:恢复出厂设置
@property (nonatomic, assign) NSInteger restoreFactoryState;

//0x18:参数校准状态 //原始数据未解析
@property (nonatomic, strong) NSData *calibrationStatusData;

//0x19:时间格式状态
@property (nonatomic, assign) NSInteger timeFormatValue;

//0x1A:设备亮度状态
@property (nonatomic, assign) BOOL deviceBrightnessOn;
@property (nonatomic, assign) NSInteger deviceBrightnessValue;

//0x1B:按键音效状态
@property (nonatomic, assign) BOOL keySoundOn;

//0x1C:报警音效状态
@property (nonatomic, assign) BOOL alertSoundOn;

//0x1D:图标显示状态
@property (nonatomic, assign) BOOL iconDisplayOn;

//0x1E:监控显示数据状态
@property (nonatomic, assign) BOOL monitoringDisplayDataOn;

//0x1F:数据显示模式
@property (nonatomic, assign) NSInteger dataDisplayModeValue;

@end

NS_ASSUME_NONNULL_END

+ 2
- 1
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELBleDisposeDataTool.h Zobrazit soubor

@@ -55,7 +55,8 @@ NS_ASSUME_NONNULL_BEGIN
@param data 原始数据
@return BM模块软硬件版本号
*/
+(NSString *)analysisBMVersion:(NSData *)data;
+ (NSString *)analysisBMVersion:(NSData *)data;
+ (NSString *)analysisBMVersionPro:(NSData *)data;

/**
解析MAC地址

+ 1
- 1
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELBluetoothManager.h Zobrazit soubor

@@ -15,7 +15,7 @@


//版本号 SDK Version
#define AiLinkBleSDKVersion @"1.5.1" //20221109 更新牙刷sdk 并增加得分算法
#define AiLinkBleSDKVersion @"1.5.6" //20221221 四电极体脂秤身体指标算法 AlgorithmSDK BfsCalculateSDK


NS_ASSUME_NONNULL_BEGIN

+ 46
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELMeatProbeBleModel.h Zobrazit soubor

@@ -0,0 +1,46 @@
//
// ELMeatProbeBleModel.h
// AILinkBleSDK
//
// Created by LarryZhang on 2022/11/22.
//

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

NS_ASSUME_NONNULL_BEGIN

///
@interface ELMeatProbeBleModel : NSObject

@property (nonatomic, assign, readonly) UInt8 ver; //数据版本 (当前版本 0x01) //数据总长度: modelSize()

@property (nonatomic, assign) UInt32 cookingId; //烧烤id (选择食物的时间戳)

@property (nonatomic, assign) UInt8 foodType; //食物类型
@property (nonatomic, assign) UInt8 foodRawness; //食物熟度
@property (nonatomic, assign) UInt16 targetRawTemperature; //食物目标温度 Bit15: 单位(0:℃ 。 1:℉) Bit14:正负(0:温度为正值。1:温度为负值) Bit13-Bit0:温度值。
@property (nonatomic, assign, readonly) NSInteger targetTemperature;
@property (nonatomic, assign, readonly) ELDeviceTemperatureUnit targetTemperatureUnit;

@property (nonatomic, assign) UInt16 ambientMinRawTemperature; //炉温目标下限 Bit15: 单位(0:℃ 。 1:℉) Bit14:正负(0:温度为正值。1:温度为负值) Bit13-Bit0:温度值。
@property (nonatomic, assign, readonly) NSInteger ambientMinTemperature;
@property (nonatomic, assign, readonly) ELDeviceTemperatureUnit ambientMinTemperatureUnit;
@property (nonatomic, assign) UInt16 ambientMaxRawTemperature; //炉温目标上限 Bit15: 单位(0:℃ 。 1:℉) Bit14:正负(0:温度为正值。1:温度为负值)Bit13-Bit0:温度值。
@property (nonatomic, assign, readonly) NSInteger ambientMaxTemperature;
@property (nonatomic, assign, readonly) ELDeviceTemperatureUnit ambientMaxTemperatureUnit;

@property (nonatomic, assign) UInt32 timerStart;//计时开始时间戳
@property (nonatomic, assign) UInt32 timerEnd;//计时结束时间戳

@property (nonatomic, assign) ELDeviceTemperatureUnit currentUnit; //当前温度单位


- (instancetype)initWithData:(NSData *)data;
+ (ELMeatProbeBleModel *)modelWithData:(NSData *)data;

- (NSData *)dataValue;

@end

NS_ASSUME_NONNULL_END

+ 46
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELMeatProbeBleTool.h Zobrazit soubor

@@ -0,0 +1,46 @@
//
// ELMeatProbeBleTool.h
// AILinkBleSDK
//
// Created by LarryZhang on 2022/11/22.
//

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

NS_ASSUME_NONNULL_BEGIN

typedef struct ELMeatProbeBleTemperatureStruct {
BOOL isValid;
//内部温度 实时温度
NSInteger internalTemperature;
ELDeviceTemperatureUnit internalTemperatureUnit;
NSInteger internalTemperature_C;
NSInteger internalTemperature_F;
//环境温度 外部温度
NSInteger ambientTemperature;
ELDeviceTemperatureUnit ambientTemperatureUnit;
NSInteger ambientTemperature_C;
NSInteger ambientTemperature_F;
//生成时间
double createTime;
} ELMeatProbeBleTemperatureStruct;

@interface ELMeatProbeBleTool : NSObject

+ (NSArray<NSNumber *> *)cids;

+ (ELMeatProbeBleTemperatureStruct)parseTemperature:(NSData *)payload;

//打包和拆包温度数据
+ (UInt16)packTemperature:(NSInteger)temperature uint:(ELDeviceTemperatureUnit)unit;
+ (NSInteger)getTemperature:(UInt16)packedTemperature;
+ (ELDeviceTemperatureUnit)getUInt:(UInt16)packedTemperature;

//温度换算
+ (float)convertF2C:(float)fahrenheit;
+ (float)convertC2F:(float)celsius;

@end

NS_ASSUME_NONNULL_END

+ 33
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELSDKHeader.h Zobrazit soubor

@@ -43,6 +43,8 @@ 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(获取设备基本信息数据)
ELInetGetCmdTypeSyncMCUNowDate = 0x38, //MCU request sync the current time of the system(MCU请求设置手机时间给MCU)
ELInetGetCmdTypeGetBMVersionPro = 0x46, //增强版-Read the BM module software and hardware version number(读取BM模块软硬件版本号)
#pragma mark ============ Begin 蓝牙Wifi ==============
ELInetGetCmdTypeBleWifiGetNearbyWifi = 0x80, //Get nearby Wifi(获取附近Wifi)
ELInetGetCmdTypeBleWifiReceiveWifiName = 0x81, //Reply to wifi name(回复wifi名字)
@@ -89,6 +91,7 @@ typedef NS_ENUM(NSUInteger, ELInetSetCmdType) {
ELInetSetCmdTypeSetMCUPowerState = 0x27, //上报电池状态
ELInetSetCmdTypeSetKey = 0x31, //APP sends the decoding key(APP下发解码秘钥)
ELInetSetCmdTypeSetSmartLockA6Data = 0x34, //Door lock 0x34 represents the A6 protocol (see the second level command for details)(门锁0x34代表A6协议(具体见二级指令))
ELInetSetCmdTypeSetBasicInfoData = 0x35, //Obtain basic device information data(获取设备基本信息数据)
ELInetSetCmdTypeSyncMCUNowDate = 0x37, //Sync the current time of the system(设置手机时间给MCU)
#pragma mark ============ 蓝牙Wifi ==============
ELInetSetCmdTypeBleWifiSetWifiMac = 0x84, //设置WIFI Mac地址
@@ -155,10 +158,40 @@ typedef NS_ENUM(NSUInteger, ELSupportDeviceType) {
ELSupportDeviceType_BraceletWatch = 0x003E, //Leap手环
ELSupportDeviceTypeMeatProbe = 0x003F, //食物探针
ELSupportDeviceTypeVictorClampMeter = 0x0040, //Victor钳表
ELSupportDeviceTypeVictorNoiseMeter = 0x0043, //胜利噪音计
ELSupportDeviceTypeVictorAnemometer = 0x0044, //胜利风速计
ELSupportDeviceTypeVictorLuxMeter = 0x0045, //胜利照度计
ELSupportDeviceTypeAirDetector = 0x0048, //环境气体检测仪
ELSupportDeviceTypeTPMS = 0x0049, //智能胎压
ELSupportDeviceType电动自行车 = 0x004A, //电动自行车
ELSupportDeviceType电动车 = 0x004C, //电动车
ELSupportDeviceType电动平衡车 = 0x004E, //电动平衡车
ELSupportDeviceTypeBLEWiFiNoiseMeter = 0x0050, //噪音计(WiFi+BLE)
ELSupportDeviceType智能仪表 = 0x0051, //CM01-C02智能仪表
ELSupportDeviceType双频八电极体脂秤 = 0x0052, //双频八电极体脂秤
// ELSupportDeviceType53 = 0x0053,
// ELSupportDeviceType54 = 0x0054,
// ELSupportDeviceType55 = 0x0055,
// ELSupportDeviceType56 = 0x0056,
// ELSupportDeviceType57 = 0x0057,
// ELSupportDeviceType58 = 0x0058,
// ELSupportDeviceType59 = 0x0059,
ELSupportDeviceTypeBroadcastScale = (0xffff +0x01) , //655536 Broadcast body fat scale(AILink广播体脂秤)
ELSupportDeviceTypeBroadcastHeightGauge = (0xffff + 0x03) , //65538 广播身高仪
ELSupportDeviceTypeBroadcastScale_Lingyang = (0xffff +0x16) , //65557 凌阳广播体脂秤

+ 10
- 3
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELTLVModel.h Zobrazit soubor

@@ -10,6 +10,8 @@

NS_ASSUME_NONNULL_BEGIN

//***** type 1 Byte lengh 1 Byte

@interface ELTLVModel : NSObject

@property(nonatomic, assign) UInt8 type; //T
@@ -18,16 +20,21 @@ NS_ASSUME_NONNULL_BEGIN

@property(nonatomic, strong) NSData *value; //V

//@property(nonatomic, strong) NSNumber *_Nullable cmd; //cmd属性 (独立属性,不包含在tlvData)

@property(nonatomic, strong, readonly) NSData *data;
@property(nonatomic, strong, readonly) NSData *tlvData; //same as data


- (instancetype)initWithType:(UInt8)type;

- (instancetype)initWithType:(UInt8)type value:(NSData *)value;

//type 1 Byte lengh 1 Byte
+ (NSArray<ELTLVModel *> *)objectArrayWithData:(NSData * _Nonnull)data;
@end

@property(nonatomic, strong, readonly) NSData *data;
@interface ELTLVModel (Tool)

+ (NSArray<ELTLVModel *> *)objectArrayWithData:(NSData * _Nonnull)payloadData;

@end


+ 62
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELVictorLuxMeterBleModel.h Zobrazit soubor

@@ -0,0 +1,62 @@
//
// ELVictorLuxMeterBleModel.h
// AILinkBleSDK
//
// Created by LarryZhang on 2022/11/14.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface ELVictorLuxMeterBleModel : NSObject

//照度数据(LED数码管显示值)
@property (nonatomic, assign, readonly) UInt16 led; //Byte[4]~Byte[5]

//Byte[6] 功能描述 (0>>不显示 1>>显示)
@property (nonatomic, assign, readonly) BOOL bTimeLcd;//Bit0 b_time_lcd 超时自动关机状态
@property (nonatomic, assign, readonly) BOOL bBluetoothLcd;//Bit2 b_bluetooth_lcd 蓝牙连接状态
@property (nonatomic, assign, readonly) BOOL bRelLcd;//Bit3 b_rel_lcd 相对值状态
@property (nonatomic, assign, readonly) BOOL bLuxLcd;//Bit4 b_lux_lcd 照度单位勒克斯状态
@property (nonatomic, assign, readonly) BOOL bFcLcd;//Bit5 b_fc_lcd 照度单位尺烛光状态
@property (nonatomic, assign, readonly) BOOL bHoldLcd;//Bit6 b_hold_lcd 数据保持状态


//Byte[7] 功能描述 (0>>不显示 1>>显示)
//X10/X100状态显示 Bit2Bit1=00>>不显示 Bit2Bit1=01>>X10显示 Bit2Bit1=11>>X100显示
@property (nonatomic, assign, readonly) UInt8 x10AndX100Lcd;
//20/200/2000/20000/200000状态显示
//Bit7Bit6Bit5Bit4Bit3=00000
//>>不显示
//Bit7Bit6Bit5Bit4Bit3=00010
//>>20显示
//Bit7Bit6Bit5Bit4Bit3=00110
//>>200显示
//Bit7Bit6Bit5Bit4Bit3=01110
//>>2000显示
//Bit7Bit6Bit5Bit4Bit3=11110
//>>20000显示
//Bit7Bit6Bit5Bit4Bit3=11111
//>>200000显示
@property (nonatomic, assign, readonly) UInt8 icon200000;

//Byte[8] 功能描述 (0>>不显示 1>>显示)
@property (nonatomic, assign, readonly) BOOL bAutoLcd;//Bit0 b_auto_lcd 自动挡状态
@property (nonatomic, assign, readonly) BOOL bMaxLcd;//Bit1 b_max_lcd 最大数据状态
@property (nonatomic, assign, readonly) BOOL bBatLcd;//Bit2 b_bat_lcd 电池低压状态
@property (nonatomic, assign, readonly) BOOL bMinLcd;//Bit3 b_min_lcd 最小数据状态
@property (nonatomic, assign, readonly) BOOL bHiLcd;//Bit4 超量程HI 超量程状态 超量程显示HI
@property (nonatomic, assign, readonly) BOOL bNegativeLcd;//Bit5 正负符号位 相对值状态显示时 0>>正符号不显示 1>>负符号显示
//Bit7Bit6=00>>不显示
//Bit7Bit6=01>>小数点保留 1 位
//Bit7Bit6=10>>小数点保留 2 位
@property (nonatomic, assign, readonly) UInt8 decimalStatus;//Bit6bit7 小数点状态 小数点状态显示



+ (instancetype)modelWithData:(NSData *)data;

@end

NS_ASSUME_NONNULL_END

+ 36
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/ELVictorLuxMeterBleTool.h Zobrazit soubor

@@ -0,0 +1,36 @@
//
// ELVictorLuxMeterBleTool.h
// AILinkBleSDK
//
// Created by LarryZhang on 2022/11/14.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface ELVictorLuxMeterBleTool : NSObject

///按键类型
typedef NS_ENUM(NSUInteger, VictorLuxMeterButtonType){
VictorLuxMeterButtonType_Null = 0, //Bit3Bit2Bit1Bit0=0000 >>无按键按下
VictorLuxMeterButtonType_MAX_MIN = 0b0001, //Bit3Bit2Bit1Bit0=0001 >>短按MAX/MIN键
VictorLuxMeterButtonType_HOLD_BL = 0b0010, //Bit3Bit2Bit1Bit0=0010 >>短按HOLD/BL键
VictorLuxMeterButtonType_SELECT = 0b0011, //Bit3Bit2Bit1Bit0=0011 >>短按SELECT键
VictorLuxMeterButtonType_POWER = 0b0100, //Bit3Bit2Bit1Bit0=0100 >>短按POWER键
VictorLuxMeterButtonType_RANG = 0b0101, //Bit3Bit2Bit1Bit0=0101 >>短按RANG键
VictorLuxMeterButtonType_REL = 0b0110, //Bit3Bit2Bit1Bit0=0110 >>短按REL键
VictorLuxMeterButtonType_LONG_POWER = 0b0111, //Bit3Bit2Bit1Bit0=0111 >>长按2S POWER键
VictorLuxMeterButtonType_LONG_MAXMIN = 0b1000, //Bit3Bit2Bit1Bit0=1000 >>长按2S MAX/MIN键
VictorLuxMeterButtonType_LONG_HOLD_BL = 0b1001, //Bit3Bit2Bit1Bit0=1001 >>长按2S HOLD/BL键
};

+ (NSArray<NSNumber *> *)cids;

+ (NSData *)payloadOfButton:(VictorLuxMeterButtonType)button;

@end

NS_ASSUME_NONNULL_END

+ 37
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/NELBleManagerHeader.h Zobrazit soubor

@@ -0,0 +1,37 @@
//
// NELBleManagerHeader.h
// Elink
//
// Created by LarryZhang on 2022/9/15.
// Copyright © 2022 iot_iMac. All rights reserved.
//

#ifndef NELBleManagerHeader_h
#define NELBleManagerHeader_h


typedef NS_ENUM(NSInteger, NELBleManagerConnectState) {
NELBleManagerConnectStateUnknown = 0x00,
NELBleManagerConnectStateDisconnected = 0x01,
NELBleManagerConnectStateFailed = 0x02,
NELBleManagerConnectStateConnecting = 0x03,
NELBleManagerConnectStateConnected = 0x04,
NELBleManagerConnectStateHandShaking = 0x05,
NELBleManagerConnectStatePassed = 0x06,
NELBleManagerConnectStateFailedValidation = 0x0F,
NELBleManagerConnectStateCentralScanning = 0x80,
NELBleManagerConnectStateCentralUnknown = 0xF0,
NELBleManagerConnectStateCentralResetting = 0xF1,
NELBleManagerConnectStateCentralUnsupported = 0xF2,
NELBleManagerConnectStateCentralUnauthorized = 0xF3,
NELBleManagerConnectStateCentralPowerOff = 0xF4,
NELBleManagerConnectStateCentralPowerOn = 0xF5,
};

#endif /* NELBleManagerHeader_h */

+ 55
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/NELMacAddressModel.h Zobrazit soubor

@@ -0,0 +1,55 @@
//
// NELMacAddressModel.h
// Elink
//
// Created by LarryZhang on 2022/8/15.
// Copyright © 2022 iot_iMac. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface NELMacAddressModel : NSObject


@property (nonatomic, copy, readonly) NSString *macAddressString;

// 例:{0xA1, 0xB2, 0xC3, 0xD4, 0xE5, 0xF6} ==> "A1:B2:C3:D4:E5:F6"
+ (instancetype)macWithBigEndianBytes:(Byte *)bytes;

// 例:{0xF6, 0xE5, 0xD4, 0xC3, 0xB2, 0xA1} ==> "A1:B2:C3:D4:E5:F6"
+ (instancetype)macWithLittleEndianBytes:(Byte *)bytes;

// 例:<A1B2C3D4 E5F6> ==> "A1:B2:C3:D4:E5:F6"
+ (instancetype)macWithBigEndianData:(NSData *)data;

// 例:<F6E5D4C3 B2A1> ==> "A1:B2:C3:D4:E5:F6"
+ (instancetype)macWithLittleEndianData:(NSData *)data;

// 只支持格式:"A1:B2:C3:D4:E5:F6"
+ (instancetype)macWithMacString:(NSString *)macString;

// 例:0xA1B2C3D4E5F6 ==> "A1:B2:C3:D4:E5:F6"
+ (instancetype)macWithUIntValue:(UInt64)value;

//// 例:0xF6E5D4C3B2A1 ==> "A1:B2:C3:D4:E5:F6"
//+ (instancetype)macWithBigEndianUIntValue:(UInt64)value;
//
//// 例:0xA1B2C3D4E5F6 ==> "A1:B2:C3:D4:E5:F6"
//+ (instancetype)macWithLittleEndianUIntValue:(UInt64)value;



//+ (BOOL)isEqual:(ZZMacAddressModel *)mac with:(ZZMacAddressModel *)otherMac;

- (BOOL)isEqualToMac:(NELMacAddressModel *)mac;


#ifdef DEBUG
+ (void)demo;
#endif

@end

NS_ASSUME_NONNULL_END

+ 32
- 0
AILinkBleSDKDemo/AILinkBleSDK.framework/Headers/NSData+AILinkBle.h Zobrazit soubor

@@ -0,0 +1,32 @@
//
// NSData+AILinkBle.h
// AILinkBleSDK
//
// Created by LarryZhang on 2022/11/24.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface NSData (AILinkBle)

- (UInt32)valueU32AtLoc:(NSUInteger)loc;
- (UInt32)u32:(NSUInteger)loc; //简化版

- (UInt16)valueU16AtLoc:(NSUInteger)loc;
- (UInt16)u16:(NSUInteger)loc; //简化版

- (UInt8)valueU8AtLoc:(NSUInteger)loc;
- (UInt8)u8:(NSUInteger)loc; //简化版

- (UInt32)valueU32LEAtLoc:(NSUInteger)loc;
- (UInt32)u32LE:(NSUInteger)loc; //简化版

- (UInt16)valueU16LEAtLoc:(NSUInteger)loc;
- (UInt16)u16LE:(NSUInteger)loc; //简化版


@end

NS_ASSUME_NONNULL_END

binární
AILinkBleSDKDemo/AILinkBleSDK.framework/Info.plist Zobrazit soubor


+ 1
- 1
AILinkBleSDKDemo/Info.plist Zobrazit soubor

@@ -21,7 +21,7 @@
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSBluetoothAlwaysUsageDescription</key>
<string></string>
<string>Bluetooth Always Usage Description</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>

Načítá se…
Zrušit
Uložit