buildSettings = { | buildSettings = { | ||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||||
CODE_SIGN_STYLE = Automatic; | CODE_SIGN_STYLE = Automatic; | ||||
CURRENT_PROJECT_VERSION = 20231007; | |||||
CURRENT_PROJECT_VERSION = 20240323; | |||||
DEVELOPMENT_TEAM = YEU77XR292; | DEVELOPMENT_TEAM = YEU77XR292; | ||||
FRAMEWORK_SEARCH_PATHS = ( | FRAMEWORK_SEARCH_PATHS = ( | ||||
"$(inherited)", | "$(inherited)", | ||||
"$(PROJECT_DIR)/AILinkBleSDKDemo/DeviceDemo/13_EightScale/HTBodyfat_SDK", | "$(PROJECT_DIR)/AILinkBleSDKDemo/DeviceDemo/13_EightScale/HTBodyfat_SDK", | ||||
"$(PROJECT_DIR)/AILinkBleSDKDemo/DeviceDemo/13_EightScale/BhBodyComposition120", | "$(PROJECT_DIR)/AILinkBleSDKDemo/DeviceDemo/13_EightScale/BhBodyComposition120", | ||||
); | ); | ||||
MARKETING_VERSION = 1.7.0; | |||||
MARKETING_VERSION = 1.8.0; | |||||
OTHER_LDFLAGS = "-ObjC"; | OTHER_LDFLAGS = "-ObjC"; | ||||
PRODUCT_BUNDLE_IDENTIFIER = com.ellinkthings.ailinksdk.app; | PRODUCT_BUNDLE_IDENTIFIER = com.ellinkthings.ailinksdk.app; | ||||
PRODUCT_NAME = "$(TARGET_NAME)"; | PRODUCT_NAME = "$(TARGET_NAME)"; | ||||
buildSettings = { | buildSettings = { | ||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||||
CODE_SIGN_STYLE = Automatic; | CODE_SIGN_STYLE = Automatic; | ||||
CURRENT_PROJECT_VERSION = 20231007; | |||||
CURRENT_PROJECT_VERSION = 20240323; | |||||
DEVELOPMENT_TEAM = YEU77XR292; | DEVELOPMENT_TEAM = YEU77XR292; | ||||
FRAMEWORK_SEARCH_PATHS = ( | FRAMEWORK_SEARCH_PATHS = ( | ||||
"$(inherited)", | "$(inherited)", | ||||
"$(PROJECT_DIR)/AILinkBleSDKDemo/DeviceDemo/13_EightScale/HTBodyfat_SDK", | "$(PROJECT_DIR)/AILinkBleSDKDemo/DeviceDemo/13_EightScale/HTBodyfat_SDK", | ||||
"$(PROJECT_DIR)/AILinkBleSDKDemo/DeviceDemo/13_EightScale/BhBodyComposition120", | "$(PROJECT_DIR)/AILinkBleSDKDemo/DeviceDemo/13_EightScale/BhBodyComposition120", | ||||
); | ); | ||||
MARKETING_VERSION = 1.7.0; | |||||
MARKETING_VERSION = 1.8.0; | |||||
OTHER_LDFLAGS = "-ObjC"; | OTHER_LDFLAGS = "-ObjC"; | ||||
PRODUCT_BUNDLE_IDENTIFIER = com.ellinkthings.ailinksdk.app; | PRODUCT_BUNDLE_IDENTIFIER = com.ellinkthings.ailinksdk.app; | ||||
PRODUCT_NAME = "$(TARGET_NAME)"; | PRODUCT_NAME = "$(TARGET_NAME)"; |
#import "NSData+AILinkBle.h" | #import "NSData+AILinkBle.h" | ||||
#import "ELAILinkBleManager+MeatProbe.h" | #import "ELAILinkBleManager+MeatProbe.h" | ||||
#import "ELMeatProbeBleTool.h" | #import "ELMeatProbeBleTool.h" | ||||
#import "ELAILinkBleManager+NoiseMeter.h" | |||||
#import "ELNoiseMeterBleFunctionModel.h" | |||||
#import "ELNoiseMeterBleHeader.h" | |||||
#import "ELNoiseMeterBleParser.h" | |||||
#import "ELNoiseMeterBleSettingModel.h" | |||||
#import "ELNoiseMeterBleStatusModel.h" | |||||
#import "ELVictorLuxMeterBleModel.h" | #import "ELVictorLuxMeterBleModel.h" | ||||
#import "ELVictorLuxMeterBleTool.h" | #import "ELVictorLuxMeterBleTool.h" | ||||
#import "ELAIFitScaleBleDataModel.h" | #import "ELAIFitScaleBleDataModel.h" |
#define AILinkBleSDK_Version_h | #define AILinkBleSDK_Version_h | ||||
//版本号 SDK Version | //版本号 SDK Version | ||||
#define AiLinkBleSDKVersion @"1.7.0" // 20231007 增加 WIFI_BLE 血压计 支持 | |||||
#define AiLinkBleSDKVersion @"1.8.0" // 20240323 | |||||
#endif /* AILinkBleSDK_Version_h */ | #endif /* AILinkBleSDK_Version_h */ |
// | |||||
// ELAILinkBleManager+NoiseMeter.h | |||||
// AILinkBleSDK | |||||
// | |||||
// Created by LarryZhang on 2022/12/21. | |||||
// | |||||
#import <AILinkBleSDK/ELAILinkBleManager.h> | |||||
@class ELTLVModel; | |||||
NS_ASSUME_NONNULL_BEGIN | |||||
@interface ELAILinkBleManager (NoiseMeter) | |||||
//APP获取设备功能列表 //0x01 CMD:APP获取设备功能列表 | |||||
- (void)noiseMeterRequestDeviceFunctions; | |||||
//APP获取设备状态 //0x03 CMD:APP获取设备状态 | |||||
- (void)noiseMeterRequestDeviceStatus; | |||||
//APP设置/获取参数 //0x05 CMD:APP设置/获取参数 | |||||
- (void)noiseMeterRequestDeviceSettings; | |||||
- (void)noiseMeterSendDeviceSettings:(NSArray<ELTLVModel *> *)tlvs; | |||||
@end | |||||
@interface ELAILinkBleManager (NoiseMeterTLV) | |||||
//0x01:频率计权A/C | |||||
+ (ELTLVModel *)tlvFrequencyWeightingA; | |||||
+ (ELTLVModel *)tlvFrequencyWeightingC; | |||||
//0x03:测量等级及范围 | |||||
+ (ELTLVModel *)tlvMeasurementLevelSwitchUp; | |||||
+ (ELTLVModel *)tlvMeasurementLevelSwitchDown; | |||||
//0x04:Max/Min模式 | |||||
+ (ELTLVModel *)tlvMaxMinModelNormal; | |||||
+ (ELTLVModel *)tlvMaxMinModelMin; | |||||
+ (ELTLVModel *)tlvMaxMinModelMax; | |||||
//0x05:时间加权(Fast/Slow) | |||||
+ (ELTLVModel *)tlvTimeWeightedFast; | |||||
+ (ELTLVModel *)tlvTimeWeightedSlow; | |||||
//0x06:数值保持(hold) | |||||
+ (ELTLVModel *)tlvValueHoldNormal; | |||||
+ (ELTLVModel *)tlvValueHoldWithValue:(UInt16)value; | |||||
//0x07:报警 | |||||
+ (ELTLVModel *)tlvAlarmOff; | |||||
+ (ELTLVModel *)tlvAlarmStop; //关闭当前报警(关闭当前报警,指当前触发了报警,之后可手动关闭当次报警,但是并不会关闭报警功能.) | |||||
+ (ELTLVModel *)tlvAlarmOn:(NSInteger)alarmValue; | |||||
//0x08:背光 | |||||
+ (ELTLVModel *)tlvBacklightOn; | |||||
+ (ELTLVModel *)tlvBacklightOff; | |||||
//0x0A:历史 | |||||
+ (ELTLVModel *)tlvRequestHistoryWithTimestamp:(UInt32)timestamp; | |||||
+ (ELTLVModel *)tlvReleaseHistory; | |||||
//0x0C:设备绑定 | |||||
+ (ELTLVModel *)tlvDeviceBindingRequest; | |||||
+ (ELTLVModel *)tlvDeviceBindingCancel; | |||||
@end | |||||
NS_ASSUME_NONNULL_END |
@property (nonatomic, strong) NSArray<NSNumber *> *bloodSugarUnitArray; | @property (nonatomic, strong) NSArray<NSNumber *> *bloodSugarUnitArray; | ||||
@property (nonatomic, strong) NSArray<NSNumber *> *volumeUnitArray; | @property (nonatomic, strong) NSArray<NSNumber *> *volumeUnitArray; | ||||
//SDK 自动重连超时 0~5秒,仅指定设备可使用此功能,其他设备可能会引起逻辑问题 | |||||
@property (nonatomic, assign) NSInteger reconnectionTimeout; | |||||
@end | @end | ||||
#pragma mark - scan | #pragma mark - scan | ||||
@interface ELAILinkBleManager (scan) | @interface ELAILinkBleManager (scan) | ||||
- (void)scanAll; | - (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; | |||||
- (void)scanFilterWithCidArray:(NSArray<NSNumber *> *)cidArray; | |||||
- (void)scanFilterWithMacArray:(NSArray<NSString *> *)macArray; | |||||
- (void)scanFilterWithCidArray:(NSArray<NSNumber *> *)cidArray macArray:(NSArray<NSString *> *)macArray; | |||||
- (void)scanAllowDuplicatesFilterWithCidArray:(NSArray<NSNumber *> *)cidArray macArray:(NSArray *)macArray; | |||||
// 获取当前连接到系统的 peripheral 设备的列表(如被其它程序连接着) | // 获取当前连接到系统的 peripheral 设备的列表(如被其它程序连接着) | ||||
- (NSArray<CBPeripheral *> *)retrieveConnectedPeripherals; | - (NSArray<CBPeripheral *> *)retrieveConnectedPeripherals; | ||||
- (ELAILinkPeripheral * _Nullable)currentAILinkPeripheral; | - (ELAILinkPeripheral * _Nullable)currentAILinkPeripheral; | ||||
- (void)readRSSI; | |||||
@end | @end | ||||
#pragma mark - send | #pragma mark - send | ||||
///查询mqtt链接状态 CMD=0xC5 | ///查询mqtt链接状态 CMD=0xC5 | ||||
- (void)checkMqttState; | - (void)checkMqttState; | ||||
#pragma mark - 发现服务 | |||||
- (void)discoverServiceWithUUIDString:(NSString *)UUIDString; | |||||
#pragma mark - 设置已发现特征notifyValue | |||||
- (void)setCharacteristicsNotifyValue:(BOOL)enabled; | |||||
@end | @end | ||||
NS_ASSUME_NONNULL_END | NS_ASSUME_NONNULL_END |
//Callback decrypted transparent data (A7 decrypted payload data)(回调解密后的数据(A7解密后payload数据)) | //Callback decrypted transparent data (A7 decrypted payload data)(回调解密后的数据(A7解密后payload数据)) | ||||
-(void)bluetoothManagerReceiveData:(NSData *_Nonnull)data deviceType:(ELSupportDeviceType)type; | -(void)bluetoothManagerReceiveData:(NSData *_Nonnull)data deviceType:(ELSupportDeviceType)type; | ||||
- (void)peripheralDidReadRSSI:(nonnull NSNumber *)RSSI; | |||||
/** | /** | ||||
Callback transparent transmission data(回调透传数据) | Callback transparent transmission data(回调透传数据) | ||||
/** 需要搜索与系统绑定的蓝牙设备 */ | /** 需要搜索与系统绑定的蓝牙设备 */ | ||||
@property (nonatomic, assign) BOOL needScanBindSysDevice; | @property (nonatomic, assign) BOOL needScanBindSysDevice; | ||||
//SDK 自动重连超时 0~5秒,仅指定设备可使用此功能,其他设备可能会引起逻辑问题 | |||||
@property (nonatomic, assign) NSInteger reconnectionTimeout; | |||||
//设置支持设备列表 - 扫描过滤 | //设置支持设备列表 - 扫描过滤 | ||||
- (void)setSupportDeviceCids:(NSArray<NSNumber *> *)cids; | - (void)setSupportDeviceCids:(NSArray<NSNumber *> *)cids; | ||||
//Disconnect device(断开设备) | //Disconnect device(断开设备) | ||||
-(void)disconnectPeripheral; | -(void)disconnectPeripheral; | ||||
- (void)readRSSI; | |||||
/** | /** | ||||
Get Bluetooth information(获取蓝牙信息) | Get Bluetooth information(获取蓝牙信息) | ||||
AILinkBMRTypeUnknown = 0,//未知 | AILinkBMRTypeUnknown = 0,//未知 | ||||
AILinkBMRTypeLow = 1,//偏低 | AILinkBMRTypeLow = 1,//偏低 | ||||
AILinkBMRTypeExcellent = 2,//优 | AILinkBMRTypeExcellent = 2,//优 | ||||
AILinkBMRTypeStandard = 3,//标准 | |||||
}; | }; | ||||
ELSupportDeviceTypeBodyScale = 0x0056, //Body scale(no body fat) 体重秤(无体脂) | ELSupportDeviceTypeBodyScale = 0x0056, //Body scale(no body fat) 体重秤(无体脂) | ||||
ELSupportDeviceTypeSmartRing = 0x005D, //0x5D 智能戒指 | |||||
ELSupportDeviceTypeAIFitScale = 0x005E, //好身材体脂秤(蓝牙连接) | ELSupportDeviceTypeAIFitScale = 0x005E, //好身材体脂秤(蓝牙连接) | ||||
ELSupportDeviceTypeBroadcastScale = (0xffff +0x01) , //655536 Broadcast body fat scale(AILink广播体脂秤) | ELSupportDeviceTypeBroadcastScale = (0xffff +0x01) , //655536 Broadcast body fat scale(AILink广播体脂秤) |
// | |||||
// ELNoiseMeterBleFunctionModel.h | |||||
// AILinkBleSDK | |||||
// | |||||
// Created by LarryZhang on 2022/12/21. | |||||
// | |||||
#import <Foundation/Foundation.h> | |||||
NS_ASSUME_NONNULL_BEGIN | |||||
@interface ELNoiseMeterBleFunctionModel : NSObject | |||||
//0x80:协议版本 1 | |||||
@property (nonatomic, assign) NSInteger version; | |||||
//0x01:频率计权A/C 1 | |||||
@property (nonatomic, assign) BOOL supportFrequencyWeightingA; | |||||
@property (nonatomic, assign) BOOL supportFrequencyWeightingC; | |||||
//0x02:测量总范围 5 | |||||
@property (nonatomic, assign) NSInteger measuringRangeScale; | |||||
@property (nonatomic, assign) NSInteger measuringRangeMin; | |||||
@property (nonatomic, assign) NSInteger measuringRangeMax; | |||||
//0x03:测量等级切换 1 | |||||
@property (nonatomic, assign) BOOL supportMeasurementLevelSwitch; | |||||
//0x04:Max/Min模式 1 | |||||
@property (nonatomic, assign) BOOL supportMaxMinMode; | |||||
//0x05:时间加权(Fast/Slow) 1 | |||||
@property (nonatomic, assign) BOOL supportTimeWeightedFast; | |||||
@property (nonatomic, assign) BOOL supportTimeWeightedSlow; | |||||
//0x06:数值保持(hold) 1 | |||||
@property (nonatomic, assign) BOOL supportValueHold; | |||||
//0x07:报警功能 5 | |||||
@property (nonatomic, assign) BOOL supportAlarm; | |||||
@property (nonatomic, assign) NSInteger alarmMin; | |||||
@property (nonatomic, assign) NSInteger alarmMax; | |||||
//0x08:背光 1 | |||||
@property (nonatomic, assign) BOOL supportBacklight; | |||||
//0x09:噪音值 1 | |||||
@property (nonatomic, assign) NSInteger noiseValueScale; | |||||
//0x0A:历史 1 | |||||
@property (nonatomic, assign) BOOL supportHistory; | |||||
//0x0B:供电 1 | |||||
@property (nonatomic, assign) NSInteger powerSupplyType; | |||||
@end | |||||
NS_ASSUME_NONNULL_END |
// | |||||
// ELNoiseMeterBleHeader.h | |||||
// Pods | |||||
// | |||||
// Created by LarryZhang on 2022/12/21. | |||||
// | |||||
#ifndef ELNoiseMeterBleHeader_h | |||||
#define ELNoiseMeterBleHeader_h | |||||
typedef NS_ENUM(NSUInteger, ELNoiseMeterBleCMD) { | |||||
ELNoiseMeterBleCMD01 = 0x01, //CMD:APP获取设备功能列表 | |||||
ELNoiseMeterBleCMD02 = 0x02, //CMD:MCU主控回应设备功能列表 | |||||
ELNoiseMeterBleCMD03 = 0x03, //CMD:APP获取设备状态 | |||||
ELNoiseMeterBleCMD04 = 0x04, //CMD:MCU主控回应设备状态 | |||||
ELNoiseMeterBleCMD05 = 0x05, //CMD:APP设置/获取参数 | |||||
ELNoiseMeterBleCMD06 = 0x06, //CMD:MCU返回设置参数 | |||||
ELNoiseMeterBleCMDF1 = 0xF1, //CMD:上发保存数据 | |||||
}; | |||||
typedef NS_ENUM(NSUInteger, ELNoiseMeterTLVType) { | |||||
ELNoiseMeterTLVTypeFrequencyWeightingAC = 0x01, //0x01:频率计权A/C | |||||
ELNoiseMeterTLVTypeTotalMeasuringRange = 0x02, //0x02:测量总范围 | |||||
ELNoiseMeterTLVTypeMeasurementLevelSwitch = 0x03, //0x03:测量等级切换 | |||||
ELNoiseMeterTLVTypeMaxMinMode = 0x04, //0x04:Max/Min模式 | |||||
ELNoiseMeterTLVTypeTimeWeightedFastSlow = 0x05, //0x05:时间加权(Fast/Slow) | |||||
ELNoiseMeterTLVTypeValueHold = 0x06, //0x06:数值保持(hold) | |||||
ELNoiseMeterTLVTypeAlarm = 0x07, //0x07:报警 | |||||
ELNoiseMeterTLVTypeBacklight = 0x08, //0x08:背光 | |||||
ELNoiseMeterTLVTypeNoiseValue = 0x09, //0x09:噪音值 | |||||
ELNoiseMeterTLVTypeHistory = 0x0A, //0x0A:历史 | |||||
ELNoiseMeterTLVTypePowerSupply = 0x0B, //0x0B:供电 | |||||
ELNoiseMeterTLVTypeDeviceBinding = 0x0C, //0x0C:设备绑定 | |||||
ELNoiseMeterTLVTypeVersion = 0x80, //0x80:协议版本 | |||||
}; | |||||
#endif /* ELNoiseMeterBleHeader_h */ |
// | |||||
// ELNoiseMeterBleParser.h | |||||
// AILinkBleSDK | |||||
// | |||||
// Created by LarryZhang on 2022/12/21. | |||||
// | |||||
#import <Foundation/Foundation.h> | |||||
#import "ELNoiseMeterBleHeader.h" | |||||
NS_ASSUME_NONNULL_BEGIN | |||||
@class ELNoiseMeterBleFunctionModel; | |||||
@class ELNoiseMeterBleStatusModel; | |||||
@class ELNoiseMeterBleSettingModel; | |||||
@protocol ELNoiseMeterBleParserDelegate; | |||||
@interface ELNoiseMeterBleParser : NSObject | |||||
@property (nonatomic, weak) id<ELNoiseMeterBleParserDelegate> delegate; | |||||
/// 设备返回支持功能列表Model | |||||
@property (nonatomic, strong) ELNoiseMeterBleFunctionModel *functionModel; | |||||
/// 设备返回状态Model | |||||
@property (nonatomic, strong) ELNoiseMeterBleStatusModel *statusModel; | |||||
/// 获取参数Model | |||||
@property (nonatomic, strong) ELNoiseMeterBleSettingModel *settingModel; | |||||
- (void)parseData:(NSData *)payload; | |||||
@end | |||||
@protocol ELNoiseMeterBleParserDelegate <NSObject> | |||||
/// MCU主控回应设备功能列表 | |||||
- (void)noiseMeterBleParser:(ELNoiseMeterBleParser *)bleParser returnFunctionWithTlvType:(ELNoiseMeterTLVType)tlvType; | |||||
/// MCU主控回应设备状态 | |||||
- (void)noiseMeterBleParser:(ELNoiseMeterBleParser *)bleParser returnStatusWithTlvType:(ELNoiseMeterTLVType)tlvType; | |||||
/// MCU主控回应设备参数 | |||||
- (void)noiseMeterBleParser:(ELNoiseMeterBleParser *)bleParser returnSettingWithTlvType:(ELNoiseMeterTLVType)tlvType; | |||||
@end | |||||
NS_ASSUME_NONNULL_END |
// | |||||
// ELNoiseMeterBleSettingModel.h | |||||
// AILinkBleSDK | |||||
// | |||||
// Created by LarryZhang on 2022/12/21. | |||||
// | |||||
#import <Foundation/Foundation.h> | |||||
NS_ASSUME_NONNULL_BEGIN | |||||
@interface ELNoiseMeterBleSettingModel : NSObject | |||||
//0x01:频率计权A/C 1 | |||||
@property (nonatomic, assign) NSInteger frequencyWeightingACValue; | |||||
//0x03:测量等级及范围 6 | |||||
@property (nonatomic, assign) NSInteger measurementLevelStatus; | |||||
@property (nonatomic, assign) NSInteger measurementLevelValue; | |||||
@property (nonatomic, assign) NSInteger measurementLevelMin; | |||||
@property (nonatomic, assign) NSInteger measurementLevelMax; | |||||
//0x04:Max/Min模式 1 | |||||
@property (nonatomic, assign) NSInteger maxMinMode; | |||||
//0x05:时间加权(Fast/Slow) 1 | |||||
@property (nonatomic, assign) NSInteger timeWeightedFastSlowMode; | |||||
//0x06:数值保持(hold) 3 | |||||
@property (nonatomic, assign) NSInteger valueHoldMode; | |||||
@property (nonatomic, assign) NSInteger valueHoldValue; | |||||
//0x07:报警 3 | |||||
@property (nonatomic, assign) BOOL alarmOn; | |||||
@property (nonatomic, assign) BOOL alarmStop; | |||||
@property (nonatomic, assign) NSInteger alarmValue; | |||||
//0x08:背光 1 | |||||
@property (nonatomic, assign) BOOL backlightOn; | |||||
//0x0A:历史 | |||||
@property (nonatomic, assign) NSInteger historyStatus; | |||||
@property (nonatomic, strong) NSData *historyData; | |||||
//0x0C:设备绑定 1 | |||||
@property (nonatomic, assign) NSInteger deviceBindingStatus; | |||||
@end | |||||
NS_ASSUME_NONNULL_END |
// | |||||
// ELNoiseMeterBleStatusModel.h | |||||
// AILinkBleSDK | |||||
// | |||||
// Created by LarryZhang on 2022/12/21. | |||||
// | |||||
#import <Foundation/Foundation.h> | |||||
NS_ASSUME_NONNULL_BEGIN | |||||
@interface ELNoiseMeterBleStatusModel : NSObject | |||||
//0x01:频率计权A/C 1 | |||||
@property (nonatomic, assign) NSInteger frequencyWeightingACValue; | |||||
//0x03:测量等级及范围 5 | |||||
@property (nonatomic, assign) NSInteger measurementLevelValue; | |||||
@property (nonatomic, assign) NSInteger measurementLevelMin; | |||||
@property (nonatomic, assign) NSInteger measurementLevelMax; | |||||
//0x04:Max/Min模式 1 | |||||
@property (nonatomic, assign) NSInteger maxMinMode; | |||||
//0x05:时间加权(Fast/Slow) 1 | |||||
@property (nonatomic, assign) NSInteger timeWeightedFastSlowMode; | |||||
//0x06:数值保持(hold) 3 | |||||
@property (nonatomic, assign) NSInteger valueHoldMode; | |||||
@property (nonatomic, assign) NSInteger valueHoldValue; | |||||
//0x07:报警 2 | |||||
@property (nonatomic, assign) BOOL alarmOn; | |||||
@property (nonatomic, assign) BOOL alarmValue; | |||||
//0x08:背光 1 | |||||
@property (nonatomic, assign) BOOL backlightOn; | |||||
//0x09:噪音值 3 | |||||
@property (nonatomic, assign) NSInteger noiseValueStatus; | |||||
@property (nonatomic, assign) NSInteger noiseValue; | |||||
//0x0B:供电 2 | |||||
@property (nonatomic, assign) BOOL powerSupplyCharging; | |||||
@property (nonatomic, assign) BOOL powerSupplyLow; | |||||
@property (nonatomic, assign) NSInteger powerPercent; | |||||
@end | |||||
NS_ASSUME_NONNULL_END |
{ | |||||
"images" : [ | |||||
{ | |||||
"idiom" : "universal", | |||||
"scale" : "1x" | |||||
}, | |||||
{ | |||||
"filename" : "ailink_cid85_type_ic@2x.png", | |||||
"idiom" : "universal", | |||||
"scale" : "2x" | |||||
}, | |||||
{ | |||||
"filename" : "ailink_cid85_type_ic@3x.png", | |||||
"idiom" : "universal", | |||||
"scale" : "3x" | |||||
} | |||||
], | |||||
"info" : { | |||||
"author" : "xcode", | |||||
"version" : 1 | |||||
} | |||||
} |
{ | |||||
"images" : [ | |||||
{ | |||||
"idiom" : "universal", | |||||
"scale" : "1x" | |||||
}, | |||||
{ | |||||
"filename" : "foodtem_icon_100@2x.png", | |||||
"idiom" : "universal", | |||||
"scale" : "2x" | |||||
}, | |||||
{ | |||||
"filename" : "foodtem_icon_100@3x.png", | |||||
"idiom" : "universal", | |||||
"scale" : "3x" | |||||
} | |||||
], | |||||
"info" : { | |||||
"author" : "xcode", | |||||
"version" : 1 | |||||
} | |||||
} |
- (void)broadcastHeightGaugeDeviceDataModel:(ELBroadcastHeightGaugeBleDataModel *)model { | - (void)broadcastHeightGaugeDeviceDataModel:(ELBroadcastHeightGaugeBleDataModel *)model { | ||||
static NSInteger serialNumber = 0; | static NSInteger serialNumber = 0; | ||||
if (serialNumber == model.serialNumber) { | |||||
return; | |||||
if (model.testState == BroadcastHeightGuage_TestState_Stable && | |||||
serialNumber != model.serialNumber) { | |||||
NSString *log = [NSString stringWithFormat:@"MAC:%@ \nCID:0x%04X(%d) VID:0x%04X(%d) PID:0x%04X(%d)\n Height: %@ weightPoint: %@ heightUnit: %@", model.mac, model.cid - 0xFFFF, model.cid - 0xFFFF, model.vid, model.vid, model.pid, model.pid, @(model.height), @(model.heightPoint), AiLinkBleHeightUnitDic[@(model.heightUnit)]]; | |||||
[self addLog:log]; | |||||
serialNumber = model.serialNumber; | |||||
} else if (model.testState == BroadcastHeightGuage_TestState_Failed && serialNumber != model.serialNumber) { | |||||
NSString *log = @"测量出错啦"; | |||||
[self addLog:log]; | |||||
serialNumber = model.serialNumber; | |||||
} else { | |||||
} | } | ||||
serialNumber = model.serialNumber; | |||||
switch (model.testState) { | switch (model.testState) { | ||||
case BroadcastHeightGuage_TestState_Measuring: { | case BroadcastHeightGuage_TestState_Measuring: { | ||||
break; | break; | ||||
} | } | ||||
case BroadcastHeightGuage_TestState_Stable: { | case BroadcastHeightGuage_TestState_Stable: { | ||||
self.bleStatusLabel.text = @"Stabl"; | |||||
self.bleStatusLabel.text = @"Stable"; | |||||
break; | break; | ||||
} | } | ||||
case BroadcastHeightGuage_TestState_Failed: { | case BroadcastHeightGuage_TestState_Failed: { | ||||
} | } | ||||
} | } | ||||
NSString *log = [NSString stringWithFormat:@"MAC:%@ cid = %d--vid=%d--pid=%d\n Height = %@%@", model.mac, model.cid - 0xFFFF, model.vid, model.pid, @(model.height), AiLinkBleHeightUnitDic[@(model.heightUnit)]]; | |||||
[self addLog:log]; | |||||
} | } | ||||
[super viewDidLoad]; | [super viewDidLoad]; | ||||
self.view.backgroundColor = [UIColor whiteColor]; | self.view.backgroundColor = [UIColor whiteColor]; | ||||
[ELBroadcastScaleBleManager shareManager].broadcastScaleBleDelegate = self; | [ELBroadcastScaleBleManager shareManager].broadcastScaleBleDelegate = self; | ||||
[[ELBroadcastScaleBleManager shareManager] startScan]; | |||||
[[ELBroadcastScaleBleManager shareManager] startScanAll]; | |||||
[self setupUI]; | [self setupUI]; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
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 - 0xFFFF, model.vid, model.pid, model.weight, AiLinkBleWeightUnitDic[@(model.weightUnit)], model.adc]; | |||||
[self addLog:testData]; | [self addLog:testData]; | ||||
} | } | ||||
#import <AILinkBleSDK/ELBleWifiDetailModel.h> | #import <AILinkBleSDK/ELBleWifiDetailModel.h> | ||||
#import <AILinkBleSDK/ELBluetoothManager+BleWifi.h> | #import <AILinkBleSDK/ELBluetoothManager+BleWifi.h> | ||||
#import <AILinkBleSDK/OEMAlgorithmSDK.h> | |||||
#import <AILinkBleSDK/ELUnitConvertTool.h> | |||||
@interface ELBfsWifiConnectVC ()<ELBluetoothManagerDelegate,ELBodyFatScaleBleDelegate,ElBleWifiDelegate,UITextFieldDelegate,UITableViewDelegate,UITableViewDataSource> | @interface ELBfsWifiConnectVC ()<ELBluetoothManagerDelegate,ELBodyFatScaleBleDelegate,ElBleWifiDelegate,UITextFieldDelegate,UITableViewDelegate,UITableViewDataSource> | ||||
@property (nonatomic, strong) UITableView *tableView; | @property (nonatomic, strong) UITableView *tableView; | ||||
[[ELBodyFatScaleBleManager shareManager] sendCurrentUserToBle:[self getOneUser]]; | [[ELBodyFatScaleBleManager shareManager] sendCurrentUserToBle:[self getOneUser]]; | ||||
//下发用户列表 | //下发用户列表 | ||||
[[ELBodyFatScaleBleManager shareManager] sendOfflineUserListToBle:[self get8Users]]; | [[ELBodyFatScaleBleManager shareManager] sendOfflineUserListToBle:[self get8Users]]; | ||||
// | |||||
ELBodyFatScaleBleUserModel *user = [self getOneUser]; | |||||
NSString *weightKg = [ELUnitConvertTool getWeightShowStrWithTargetUnit:ELDeviceWeightUnit_KG bleWeightInt:weightModel.weight bleWeightUnit:weightModel.weightUnit bleWeightPoint:weightModel.weightPoint]; | |||||
OEMAlgorithmModel *algorithmModel = [OEMAlgorithmSDK getBodyfatWithWeight:weightKg.floatValue adc:(int) weightModel.adc sex:(OEMAlgUserSex)user.sex age:(int) user.age height:(int) user.height]; | |||||
NSLog(@"algorithmModel:%@", algorithmModel); | |||||
} | } | ||||
break; | break; | ||||
default: | default: |
cell = [[UITableViewCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId]; | cell = [[UITableViewCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId]; | ||||
} | } | ||||
ELPeripheralModel *p = self.devices[indexPath.row]; | 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.text = [NSString stringWithFormat:@"Name:%@ Mac:%@\nCID:0x%04lX VID:0x%04lX PID:0x%04lX rssi:%ld", p.deviceName, p.macAddress, (long)p.deviceType, (long)p.vendorID, (long)p.productID, p.rssi]; | |||||
cell.textLabel.numberOfLines = 2; | cell.textLabel.numberOfLines = 2; | ||||
cell.textLabel.textColor = [UIColor blackColor]; | cell.textLabel.textColor = [UIColor blackColor]; | ||||
} | } | ||||
serialNumber = model.serialNumber; | serialNumber = model.serialNumber; | ||||
NSString *testData = [NSString stringWithFormat:@"MAC:%@ cid:%d vid:%d pid:%d weight:%@ weightPoint:%@ weightUnit:%@ sn:%d", | |||||
model.mac, model.cid - 65535, model.vid, model.pid, @(model.weight), @(model.weightPoint), @(model.weightUnit), model.serialNumber]; | |||||
NSString *testData = [NSString stringWithFormat:@"MAC:%@ cid:%d vid:%d pid:%d testStatus:%@ negative:%@ weight:%@ weightPoint:%@ weightUnit:%@ sn:%d", model.mac, model.cid - 65535, model.vid, model.pid, @(model.testStatus), @(model.negative), @(model.weight), @(model.weightPoint), @(model.weightUnit), model.serialNumber]; | |||||
[self addLog:testData]; | [self addLog:testData]; | ||||
} | } | ||||
//同步时间到设备 | //同步时间到设备 | ||||
[[ELNutritionScaleBleManager shareManager] syncMCUNowDate]; | [[ELNutritionScaleBleManager shareManager] syncMCUNowDate]; | ||||
// read RSSI | |||||
[self readRSSI]; | |||||
} | } | ||||
break; | break; | ||||
[self addLog:[NSString stringWithFormat:@"低电: %d", status]]; | [self addLog:[NSString stringWithFormat:@"低电: %d", status]]; | ||||
} | } | ||||
- (void)peripheralDidReadRSSI:(nonnull NSNumber *)RSSI { | |||||
NSLog(@"%s peripheralDidReadRSSI: %@", __FUNCTION__, RSSI); | |||||
// main thread | |||||
dispatch_async(dispatch_get_main_queue(), ^{ | |||||
[self addLog:[NSString stringWithFormat:@"peripheralDidReadRSSI: %@", RSSI]]; | |||||
}); | |||||
[self readRSSI]; | |||||
} | |||||
- (void)readRSSI { | |||||
// delay | |||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |||||
// Read RSSI | |||||
[[ELNutritionScaleBleManager shareManager] readRSSI]; | |||||
}); | |||||
} | |||||
@end | @end |
self.title = @"Connected"; | self.title = @"Connected"; | ||||
//连接成功,获取单位 | //连接成功,获取单位 | ||||
[[ELAiFreshNutritionScaleBleManager shareManager] sendRequestUnitSupported]; | [[ELAiFreshNutritionScaleBleManager shareManager] sendRequestUnitSupported]; | ||||
// read RSSI | |||||
[self readRSSI]; | |||||
} | } | ||||
break; | break; | ||||
case ELBluetoothStateFailedValidation: { | case ELBluetoothStateFailedValidation: { | ||||
//切换单位 | //切换单位 | ||||
- (void)uintDidChange:(AiFreshNutritionScaleWeightUnit)unit { | - (void)uintDidChange:(AiFreshNutritionScaleWeightUnit)unit { | ||||
[self addLog:[NSString stringWithFormat:@"切换单位: %d", unit]]; | |||||
[self addLog:[NSString stringWithFormat:@"切换单位: %ld", (long)unit]]; | |||||
} | } | ||||
//ble version | //ble version | ||||
NSLog(@"%s version:%@", __FUNCTION__, version); | NSLog(@"%s version:%@", __FUNCTION__, version); | ||||
} | } | ||||
- (void)peripheralDidReadRSSI:(nonnull NSNumber *)RSSI { | |||||
NSLog(@"%s peripheralDidReadRSSI: %@", __FUNCTION__, RSSI); | |||||
// main thread | |||||
dispatch_async(dispatch_get_main_queue(), ^{ | |||||
[self addLog:[NSString stringWithFormat:@"peripheralDidReadRSSI: %@", RSSI]]; | |||||
}); | |||||
[self readRSSI]; | |||||
} | |||||
- (void)readRSSI { | |||||
// delay | |||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |||||
// Read RSSI | |||||
[[ELAiFreshNutritionScaleBleManager shareManager] readRSSI]; | |||||
}); | |||||
} | |||||
@end | @end |
cell = [[UITableViewCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId]; | cell = [[UITableViewCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId]; | ||||
} | } | ||||
ELPeripheralModel *p = self.devices[indexPath.row]; | 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.text = [NSString stringWithFormat:@"Name:%@ Mac:%@ rssi:%ld \nCID:0x%04lX(%ld) VID:0x%04lX(%ld) PID:0x%04lX(%ld)", p.deviceName, p.macAddress, p.rssi, (unsigned long)p.cid, p.cid, (long)p.vid, p.vid, (long)p.pid, p.pid]; | |||||
cell.textLabel.numberOfLines = 2; | cell.textLabel.numberOfLines = 2; | ||||
cell.textLabel.textColor = [UIColor blackColor]; | cell.textLabel.textColor = [UIColor blackColor]; | ||||
self.bleStatusLabel.text = @"连接成功"; | self.bleStatusLabel.text = @"连接成功"; | ||||
[self requestDeviceData]; | [self requestDeviceData]; | ||||
// read RSSI | |||||
// [self readRSSI]; | |||||
break; | break; | ||||
case NELBleManagerConnectStateCentralScanning: | case NELBleManagerConnectStateCentralScanning: | ||||
self.bleStatusLabel.text = @"正在扫描..."; | self.bleStatusLabel.text = @"正在扫描..."; | ||||
NSLog(@""); | NSLog(@""); | ||||
} | } | ||||
- (void)peripheralDidReadRSSI:(nonnull NSNumber *)RSSI { | |||||
NSLog(@"%s peripheralDidReadRSSI: %@", __FUNCTION__, RSSI); | |||||
// main thread | |||||
dispatch_async(dispatch_get_main_queue(), ^{ | |||||
[self addLog:[NSString stringWithFormat:@"peripheralDidReadRSSI: %@", RSSI]]; | |||||
}); | |||||
[self readRSSI]; | |||||
} | |||||
- (void)readRSSI { | |||||
// delay | |||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |||||
// Read RSSI | |||||
[self.bleManager readRSSI]; | |||||
}); | |||||
} | |||||
#pragma mark - addLog | #pragma mark - addLog | ||||
- (void)addLog:(NSString *)log { | - (void)addLog:(NSString *)log { |
#import "Masonry.h" | #import "Masonry.h" | ||||
#import "SubBleManager.h" | #import "SubBleManager.h" | ||||
#import <AILinkBleSDK/ELBluetoothManager+Settings.h> | #import <AILinkBleSDK/ELBluetoothManager+Settings.h> | ||||
#import <AILinkBleSDK/NSData+AILinkBle.h> | |||||
@interface InheritConnectViewController ()<SubBleManagerDelegate,ELBluetoothManagerDelegate> | @interface InheritConnectViewController ()<SubBleManagerDelegate,ELBluetoothManagerDelegate> | ||||
@property (nonatomic, strong) UITextView *textView; | @property (nonatomic, strong) UITextView *textView; | ||||
[super viewDidLoad]; | [super viewDidLoad]; | ||||
self.view.backgroundColor = [UIColor whiteColor]; | self.view.backgroundColor = [UIColor whiteColor]; | ||||
[SubBleManager shareManager].reconnectionTimeout = 3; | |||||
[SubBleManager shareManager].subDelegate = self; | [SubBleManager shareManager].subDelegate = self; | ||||
[SubBleManager shareManager].delegate =self; | [SubBleManager shareManager].delegate =self; | ||||
[[SubBleManager shareManager] connectPeripheral:self.p]; | [[SubBleManager shareManager] connectPeripheral:self.p]; | ||||
-(void)bluetoothManagerReceiveBMVersion:(NSString *)bmVersion{ | -(void)bluetoothManagerReceiveBMVersion:(NSString *)bmVersion{ | ||||
[self addLog:bmVersion]; | [self addLog:bmVersion]; | ||||
} | } | ||||
- (void)bluetoothManagerReceivePassData:(NSData *)data { | |||||
[self addLog:data.elHexString]; | |||||
} | |||||
- (void)bluetoothManagerReceiveData:(NSData *)data deviceType:(ELSupportDeviceType)type { | |||||
[self addLog:data.elHexString]; | |||||
} | |||||
//MARK:获取设备支持的单位 | //MARK:获取设备支持的单位 | ||||
-(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{ | ||||
//需要什么单位根据设备而定 | //需要什么单位根据设备而定 |
cell = [[UITableViewCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId]; | cell = [[UITableViewCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId]; | ||||
} | } | ||||
ELPeripheralModel *p = self.devices[indexPath.row]; | 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.text = [NSString stringWithFormat:@"Name:%@ Mac:%@\nCID:0x%04lX VID:0x%04lX PID:%ld", p.deviceName, p.macAddress, (unsigned long)p.deviceType, p.vendorID, p.productID]; | |||||
cell.textLabel.numberOfLines = 0; | |||||
cell.textLabel.textColor = [UIColor blackColor]; | cell.textLabel.textColor = [UIColor blackColor]; | ||||
return cell; | return cell; |
} | } | ||||
-(void)bluetoothScanPeripherals:(NSArray *)peripherals{ | |||||
- (void)bluetoothScanPeripherals:(NSArray *)peripherals { | |||||
NSArray *device = peripherals; | |||||
//筛选单种设备 | //筛选单种设备 | ||||
//这里以体脂秤为例 | //这里以体脂秤为例 | ||||
NSArray *device = [ELPeripheralModel getDevicesWithPeripherals:peripherals supportDeviceType:(ELSupportDeviceTypeBodyFatScale)]; | |||||
// NSArray *device = [ELPeripheralModel getDevicesWithPeripherals:peripherals supportDeviceType:(ELSupportDeviceTypeHPLuxMeter)]; | |||||
// NSArray *device = [ELPeripheralModel getDevicesWithPeripherals:peripherals supportDeviceType:(ELSupportDeviceTypeBodyFatScale)]; | |||||
// NSArray *device = [ELPeripheralModel getDevicesWithPeripherals:peripherals supportDeviceTypes:@[@(ELSupportDeviceTypeBodyFatScale),@(ELSupportDeviceTypeBLE_WIFIScale)]]; | // NSArray *device = [ELPeripheralModel getDevicesWithPeripherals:peripherals supportDeviceTypes:@[@(ELSupportDeviceTypeBodyFatScale),@(ELSupportDeviceTypeBLE_WIFIScale)]]; | ||||
if ([self.subDelegate respondsToSelector:@selector(subBluetoothScanPeripherals:)]) { | if ([self.subDelegate respondsToSelector:@selector(subBluetoothScanPeripherals:)]) { | ||||
[self.subDelegate subBluetoothScanPeripherals:device]; | [self.subDelegate subBluetoothScanPeripherals:device]; | ||||
//根据体脂秤协议解析playload部分 | //根据体脂秤协议解析playload部分 | ||||
} | } | ||||
NSLog(@"bluetoothReceiveData() type:%ld playload:%@", type, playload); | |||||
} | } | ||||
/** | /** |
| 1.5.15 | 20230427 | larry | 修改 增加 蓝牙牙刷防飞溅 | | | 1.5.15 | 20230427 | larry | 修改 增加 蓝牙牙刷防飞溅 | | ||||
| 1.6.1 | 20230626 | larry | 修改 增加 广播身高仪 食物探针 食物探针盒子 支持 | | | 1.6.1 | 20230626 | larry | 修改 增加 广播身高仪 食物探针 食物探针盒子 支持 | | ||||
| 1.7.0 | 20231007 | larry | 修改 增加 WIFI_BLE 血压计 支持 | | | 1.7.0 | 20231007 | larry | 修改 增加 WIFI_BLE 血压计 支持 | | ||||
| 1.8.0 | 20240313 | larry | 修改 增加 readRSSI 接口 | | |||||