@@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN | |||
@property (nonatomic, assign) int heartRate; //Heart rate(心率) | |||
@property (nonatomic, assign) ELDeviceBloodPressureUnit unit;//单位 | |||
@property (nonatomic, assign) int point; //小数点 | |||
@property (nonatomic, assign) NSInteger createTime;//时间 | |||
@property (nonatomic, assign) long long createTime;//时间 | |||
@end | |||
@@ -0,0 +1,40 @@ | |||
// | |||
// ELBloodSugarBleHeader.h | |||
// Elink | |||
// | |||
// Created by iot_user on 2020/7/7. | |||
// Copyright © 2020 iot_iMac. All rights reserved. | |||
// | |||
#ifndef ELBloodSugarBleHeader_h | |||
#define ELBloodSugarBleHeader_h | |||
#import <AILinkBleSDK/ELSDKHeader.h> | |||
//设备状态 | |||
typedef NS_ENUM(NSUInteger, BloodSugarDeviceStatus) { | |||
BloodSugarDeviceStatusNoStatus = 0x00, //无状态 | |||
BloodSugarDeviceStatusTestWaiting = 0x01, //设备等待插入试纸 | |||
BloodSugarDeviceStatusSamplingWaiting = 0x02, //设备已插入试纸,等待获取血样 | |||
BloodSugarDeviceStatusAnalysising = 0x03, //血样已获取,分析血样中... | |||
BloodSugarDeviceStatusTestComplete = 0x04, //上发数据完成,测量完成 | |||
}; | |||
typedef struct BloodSugarDataStruct{ | |||
int value; //数值 | |||
ELDeviceBloodSugarUnit unit; //单位 | |||
int point; | |||
}BloodSugarDataStruct; //小数点 | |||
typedef NS_ENUM(NSUInteger, BloodSugarErrorCode) { | |||
BloodSugarErrorCodeLowBattery = 0x01 ,//电池没电 | |||
BloodSugarErrorCodeUsedTestPaper = 0x02 ,//已使用过的试纸 | |||
BloodSugarErrorCodeTempHigh = 0x03 ,//环境温度超出使用范围 | |||
BloodSugarErrorCodeCancelTest = 0x04 ,//试纸施加血样后测试未完成,被退出试纸 | |||
BloodSugarErrorCodePassError = 0x05 ,//机器自检未通过 | |||
BloodSugarErrorCodeLow = 0x06 ,//测量结果过低,超出测量范围 | |||
BloodSugarErrorCodeHigh = 0x07 ,//测量结果过高,超出测量范围, | |||
}; | |||
#endif /* ELBloodSugarBleHeader_h */ |
@@ -0,0 +1,64 @@ | |||
// | |||
// ELBloodSugarBleManager.h | |||
// Elink | |||
// | |||
// Created by iot_user on 2020/7/7. | |||
// Copyright © 2020 iot_iMac. All rights reserved. | |||
// | |||
#import <AILinkBleSDK/ELBluetoothManager.h> | |||
#import "ELBloodSugarBleHeader.h" | |||
NS_ASSUME_NONNULL_BEGIN | |||
@protocol BloodSugarBleDelegate <NSObject> | |||
@optional | |||
/// 蓝牙连接状态 | |||
/// @param state 连接状态 | |||
-(void)bloodSugarBleReceiveState:(ELBluetoothState)state; | |||
/// 附近的八电极设备 | |||
/// @param devices 八电极设备列表 | |||
-(void)bloodSugarBleReceiveDevices:(NSArray<ELPeripheralModel *> *)devices; | |||
/// 回调设备状态 | |||
/// @param status 状态 | |||
-(void)bloodSugarBleReceiveDeviceStatus:(BloodSugarDeviceStatus)status; | |||
/// 回调测量结果数据 | |||
/// @param data 数据 | |||
-(void)bloodSugarBleReceiveTestData:(BloodSugarDataStruct)data; | |||
/// 回调设置单位的结果 | |||
/// @param result 结果 | |||
-(void)bloodSugarBleReceiveSwitchUnitResult:(ELSetBluetoothResponseType)result; | |||
/// 上报错误码 | |||
/// @param errorCode 错误码 | |||
-(void)bloodSugarBleReceiveErrorCode:(BloodSugarErrorCode)errorCode; | |||
///返回原始数据 | |||
- (void)bloodSugarBleBackManufactureData:(NSData *)data; | |||
@end | |||
@interface ELBloodSugarBleManager : ELBluetoothManager | |||
@property (nonatomic, weak) id<BloodSugarBleDelegate> bloodSugarDelegate; | |||
+(instancetype)shareManager; | |||
//查询设备状态 | |||
-(void)bloodSugarQueryDeviceStatus; | |||
//切换单位 | |||
-(void)bloodSugarSwitchUnit:(ELDeviceBloodSugarUnit)unit; | |||
@end | |||
NS_ASSUME_NONNULL_END |
@@ -125,6 +125,8 @@ Callback WIFI password(回调WIFI密码) | |||
*/ | |||
-(void)bluetoothManagerReceivePassData:(NSData *_Nullable)data; | |||
/** 回调已经连接到系统的设备 */ | |||
//- (void)bluetoothManagerLinkedSysPeripheral:(NSArray *_Nonnull)peripherals; | |||
#pragma mark ============ A6 Set or query the callback of the instruction execution result(设置或查询指令执行结果的回调) ============== | |||
/** | |||
@@ -320,6 +322,9 @@ NS_ASSUME_NONNULL_BEGIN | |||
@property (nonatomic, weak) id<ELBleBroadcastDelegate> broadDelegate; | |||
/** 需要搜索与系统绑定的蓝牙设备 */ | |||
@property (nonatomic, assign) BOOL needScanBindSysDevice; | |||
//设置appkey和secret | |||
+(void)setAppKey:(NSString *)key appSecret:(NSString *)secret; | |||
@@ -334,6 +339,8 @@ NS_ASSUME_NONNULL_BEGIN | |||
//Start scanning(开始扫描) | |||
-(void)startScan; | |||
//Start scanning all (开始扫描附近所有设备) | |||
- (void)startScanAll; | |||
//Stop scanning(停止扫描) | |||
-(void)stopScan; | |||
//Connecting device(连接设备) | |||
@@ -400,6 +407,9 @@ Callback decrypted A7 transparent data (payload part), type device type( 回调 | |||
/// @param data Transparent data(透传数据) | |||
-(void)bluetoothReceivePassData:(NSData *)data; | |||
/** 滑板车专用,返回设备消息推送内容 */ | |||
- (void)bluetoothManagerScooterMessageWithUUID:(NSString *)uuid data:(NSData *)data; | |||
//Broadcast equipment dedicated(广播设备专用) | |||
/// Broadcast device data | |||
/// @param cid cid | |||
@@ -546,6 +556,9 @@ Callback decrypted A7 transparent data (payload part), type device type( 回调 | |||
*/ | |||
-(void)setMCUNowDateWithEnable:(BOOL)enable; | |||
//同步系统时间到mcu | |||
-(void)syncMCUNowDate; | |||
/** | |||
Setting CID, VID, PID(设置CID、VID、PID) | |||
@@ -74,10 +74,8 @@ typedef NS_ENUM(NSInteger , ELBodyFatScaleBleDataType) { | |||
ELBodyFatScaleBleDataType_AppSendUnit = 0x81 , | |||
/** MCU发送体脂数据给App,发送完毕(一次完整测量结束) */ | |||
ELBodyFatScaleBleDataType_MCUBackSendUnitResult = 0x82 , | |||
/** 数据传输结束指令 */ | |||
ELBodyFatScaleBleDataType_ReceivedDataResult = 0xFE , | |||
/** 设备上发错误码 */ | |||
ELBodyFatScaleBleDataType_MCUBackErrorCode = 0xFF , | |||
}; |
@@ -104,7 +104,6 @@ MCU requests user information( MCU 请求用户信息) | |||
@param bodyModel 体脂数据 | |||
*/ | |||
-(void)bodyFatScaleManagerCallBackBleUserHistoryDataModel:(ELBodyFatScaleBleUserModel *)user bodyDataModel:(ELBodyFatScaleBleWeightModel *)bodyModel; | |||
@end | |||
@@ -118,9 +117,7 @@ MCU requests user information( MCU 请求用户信息) | |||
#pragma mark ============ 下发A7指令 ============== | |||
- (void)changeBodyFatScaleUnit:(ELDeviceWeightUnit)unit; | |||
- (void)sendCurrentUserToBle:(ELBodyFatScaleBleUserModel *)usr; | |||
-(void)sendReceivedDataResult:(BOOL)result; |
@@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN | |||
*/ | |||
@interface ELBodyFatScaleBleUserModel : NSObject | |||
@property (nonatomic, assign) NSUInteger createTime; | |||
@property (nonatomic, assign) long long createTime; | |||
@property (nonatomic, assign) NSUInteger usrID; | |||
@property (nonatomic, assign) BodyFatScaleRole role; //角色 | |||
@property (nonatomic, assign) ELBluetoothUserSex sex; //性别 |
@@ -37,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN | |||
///Protein rate, need / 10(蛋白率,需要/10) | |||
@property (nonatomic, assign) NSUInteger pp; | |||
///Creation time with an accuracy of 1(创建时间,精度为1) | |||
@property (nonatomic, assign) NSUInteger createTime; | |||
@property (nonatomic, assign) long long createTime; | |||
///Impedance, accuracy is 1(阻抗,精度为1) | |||
@property (nonatomic, assign) NSUInteger adc; | |||
///Heart rate with an accuracy of 1(心率,精度为1) |
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN | |||
@property (nonatomic, assign) NSString * temperature;//温度 | |||
@property (nonatomic, assign) ELDeviceTemperatureUnit unit;//单位 | |||
@property (nonatomic, assign) NSInteger point;//小数点 | |||
@property (nonatomic, assign) NSInteger createTime;//时间 | |||
@property (nonatomic, assign) long long createTime;//时间 | |||
@end |
@@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN | |||
@property (nonatomic, assign) NSUInteger heightPoint; //decimal | |||
@property (nonatomic, assign) ELDeviceHeightUnit heightUnit;//单位 | |||
@property (nonatomic, assign) NSInteger createTime;//时间 | |||
@property (nonatomic, assign) long long createTime;//时间 | |||
@end |
@@ -46,6 +46,7 @@ typedef NS_ENUM(NSUInteger, HeightGaugeBleDataType) { | |||
call back fail code | |||
*/ | |||
-(void)heightGaugeBleManagerReceiveFailCode:(ELHeightGaugeFailCode)code; | |||
@end | |||
@@ -0,0 +1,87 @@ | |||
// | |||
// ELOximeterBleManager.h | |||
// Elink | |||
// | |||
// Created by cliCk on 2020/11/16. | |||
// Copyright © 2020 iot_iMac. All rights reserved. | |||
// | |||
#import <AILinkBleSDK/ELBluetoothManager.h> | |||
#import "ELOximeterBleModel.h" | |||
#import "ELOximeterDeviceModel.h" | |||
NS_ASSUME_NONNULL_BEGIN | |||
/** 血氧仪获取app设备状态类型定义 */ | |||
typedef NS_ENUM(NSInteger, OximeterBleDataType) { | |||
/** app获取设备状态 */ | |||
OximeterBleDataType_AppGetDeviceState = 0x01 , | |||
/** muc上报设置信息 */ | |||
OximeterBleDataType_McuUploadSetupState = 0x03 , | |||
/** APP设置报警值 */ | |||
OximeterBleDataType_AppSetupAlarm = 0x04 , | |||
/** muc回复报警值设置结果 */ | |||
OximeterBleDataType_McuReplyAlarmResult = 0x05 , | |||
/** 设备上报错误码 */ | |||
OximeterBleDataType_DeviceUploadErrorCode = 0xFF , | |||
}; | |||
/** 血氧仪测量标识符 */ | |||
typedef NS_ENUM(NSInteger, OximeterTestMarkType) { | |||
/** 开始测量 */ | |||
OximeterTestMarkType_StartTest = 0x00 , | |||
/** 测量中 */ | |||
OximeterTestMarkType_Testing , | |||
/** 结束测量 */ | |||
OximeterTestMarkType_EndTest = 0xFF , | |||
}; | |||
/** 血氧仪设备上报错误码 */ | |||
typedef NS_ENUM(NSInteger, OximeterErrorCodeType) { | |||
/** 血氧饱和率不稳定 */ | |||
OximeterErrorCodeType_UnstableBloodOxygenSaturationRate = 0 , | |||
/** 脉率不稳定 */ | |||
OximeterErrorCodeType_UnstablePulseRate , | |||
/** 测量出错 */ | |||
OximeterErrorCodeType_TestWrong , | |||
/** 设备低电 */ | |||
OximeterErrorCodeType_DeviceLowPower , | |||
}; | |||
@protocol ELOximeterBleDelegate <NSObject> | |||
/** 回调蓝牙状态 */ | |||
- (void)oximeterManagerBleState:(ELBluetoothState)state; | |||
/** 回调搜索到的血氧仪设备 */ | |||
- (void)oximeterManagerScanDevices:(NSArray<ELOximeterDeviceModel *> *)devices; | |||
/** mcu上报设置信息 */ | |||
- (void)oximeterManagerSetupState:(ELOximeterBleModel *)bleModel markType:(enum OximeterTestMarkType)markType; | |||
/** mcu回复报警设置结果 */ | |||
- (void)oximeterManagerReplyAlarmSetupState:(BOOL)setupState; | |||
/** 设备上报错误码 */ | |||
- (void)oximeterManagerUploadErrorCode:(enum OximeterErrorCodeType)codeType; | |||
///返回原始数据 | |||
- (void)oximeterManagerBleBackManufactureData:(NSData *)data; | |||
@end | |||
@interface ELOximeterBleManager : ELBluetoothManager | |||
@property (nonatomic, weak) id<ELOximeterBleDelegate> oximeterBleDelegate; | |||
+ (ELOximeterBleManager *)shareManager; | |||
/** APP 获取设备状态 */ | |||
- (void)sendToBleWithGetDeviceStaus; | |||
/** APP设置报警值 (设置负数则表示该值无效) */ | |||
- (void)sendToBleSetupAlarmNumberWithSpO2Upper:(NSInteger)Spo2Upper spo2Lower:(NSInteger)Spo2Lower prUpper:(NSInteger)PRUpper prLower:(NSInteger)PRLower piUpper:(NSInteger)PIUpper piLower:(NSInteger)PILower; | |||
@end | |||
NS_ASSUME_NONNULL_END |
@@ -0,0 +1,40 @@ | |||
// | |||
// ELOximeterBleModel.h | |||
// Elink | |||
// | |||
// Created by cliCk on 2020/11/16. | |||
// Copyright © 2020 iot_iMac. All rights reserved. | |||
// | |||
#import <Foundation/Foundation.h> | |||
#define ELOximeter_Max_Pleth 1000.0f | |||
#define ELOximeter_Min_Pleth 0.0f | |||
NS_ASSUME_NONNULL_BEGIN | |||
@interface ELOximeterBleModel : NSObject | |||
/** 血氧(%)0-100 %,若该值无效则为负数 */ | |||
@property (nonatomic, assign) NSInteger SpO2; | |||
/** 脉率(bpm)0-250 */ | |||
@property (nonatomic, assign) NSInteger pulseRate; | |||
/** PI (血流灌注指数, 无单位 , 1 位小数) 0-254(对应 0.0-25.4)*/ | |||
@property (nonatomic, assign) NSInteger pi; | |||
/** 电量(%)(power ,单位%) 0-100 */ | |||
@property (nonatomic, assign) NSInteger power; | |||
/** 呼吸频率 Respiratory Rate(RR/min ,大端序,一位小数点)0.0-100.0 若该值无效,则为 0xFFFF*/ | |||
@property (nonatomic, assign) NSInteger rrValue; | |||
/**脉率曲线值( Plethysmogram 体积描记图,大端序) 0-0xFFFE 若该值无效,则为 0xFFFF*/ | |||
@property (nonatomic, assign) NSInteger pleth; | |||
/**脉率曲线波谷(棒图,大端序,暂时废弃不用) 0-0xFFFF 若该值无效,则为 0xFFFF*/ | |||
@property (nonatomic, assign) NSInteger pleth2; | |||
/**佩戴状态 0:未佩戴 1:已佩戴*/ | |||
@property (nonatomic, assign) NSInteger wearState; | |||
@end | |||
NS_ASSUME_NONNULL_END |
@@ -0,0 +1,17 @@ | |||
// | |||
// ELOximeterDeviceModel.h | |||
// Elink | |||
// | |||
// Created by cliCk on 2020/11/16. | |||
// Copyright © 2020 iot_iMac. All rights reserved. | |||
// | |||
#import <AILinkBleSDK/ELPeripheralModel.h> | |||
NS_ASSUME_NONNULL_BEGIN | |||
@interface ELOximeterDeviceModel : ELPeripheralModel | |||
@end | |||
NS_ASSUME_NONNULL_END |
@@ -67,6 +67,9 @@ NS_ASSUME_NONNULL_BEGIN | |||
*/ | |||
@property(nonatomic, assign) BOOL paired; | |||
/** 广播秤的广播数据 */ | |||
@property (nonatomic, strong) NSData *manufactureData; | |||
/** | |||
Screening equipment(筛选设备) | |||
@@ -81,6 +81,7 @@ typedef NS_ENUM(NSUInteger, ELInetSetCmdType) { | |||
ELInetSetCmdTypeSetHandshake = 0x23, //Encrypted handshake data returned by Bluetooth(蓝牙返回的加密的握手数据) | |||
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协议(具体见二级指令)) | |||
ELInetSetCmdTypeSyncMCUNowDate = 0x37, //Sync the current time of the system(设置系统当前时间) | |||
#pragma mark ============ 蓝牙Wifi ============== | |||
ELInetSetCmdTypeBleWifiSetWifiMac = 0x84, //设置WIFI Mac地址 | |||
ELInetSetCmdTypeBleWifiSetWifiPwd = 0x86, //设置WIFI 密码 | |||
@@ -115,10 +116,17 @@ typedef NS_ENUM(NSUInteger, ELSupportDeviceType) { | |||
ELSupportDeviceTypeBLE_EightScale = 0x0013 , //Eight electrode scale(八电极蓝牙秤) | |||
ELSupportDeviceTypeAnemometer = 0x0014 , //anemometer(风速计),0x0015 | |||
ELSupportDeviceTypeClampMeter = 0x0015 , //clamp meter(钳表) | |||
ELSupportDeviceTypeOximeter = 0x0021 , //Oximeter (血氧仪) | |||
ELSupportDeviceTypeWatch = 0x001D , //华盛达手表 | |||
ELSupportDeviceTypeBloodSugar = 0x001C , //blood sugar(血糖仪) | |||
ELSupportDeviceTypeBroadcastScale = 65536 , //Broadcast body fat scale(广播体脂秤) | |||
ELSupportDeviceTypeInfThermt = 0x0020 , //Infrared Thermometer(红外测温仪) | |||
ELSupportDeviceTypeFaceMask = 0x0022 , //face mask(智能口罩) | |||
ELSupportDeviceTypeElectricScooter= 0x0025 , //滑板车 | |||
ELSupportDeviceTypeBroadcastScale = (0xffff +0x01) , //655536 Broadcast body fat scale(AILink广播体脂秤) | |||
ELSupportDeviceTypeBroadcastScale_Lingyang = (0xffff +0x16) , //65557 凌阳广播体脂秤 | |||
}; | |||
@@ -258,6 +266,30 @@ typedef NS_ENUM(NSInteger, ELDeviceHeightUnit) { | |||
ELDeviceHeightUnit_Fail = 0xFF , | |||
}; | |||
#define AiLinkBleSpeedUnit_M_S @"m/s" | |||
#define AiLinkBleSpeedUnit_KM_H @"km/h" | |||
#define AiLinkBleSpeedUnit_FT_Min @"ft/min" | |||
#define AiLinkBleSpeedUnit_Knots @"knots" | |||
#define AiLinkBleSpeedUnit_MPH @"MPH" | |||
#define AiLinkBleSpeedUnitDic @{@(ELDeviceSpeedUnit_M_S):AiLinkBleSpeedUnit_M_S,@(ELDeviceSpeedUnit_KM_H):AiLinkBleSpeedUnit_KM_H,@(ELDeviceSpeedUnit_FT_Min):AiLinkBleSpeedUnit_FT_Min,@(ELDeviceSpeedUnit_Knots):AiLinkBleSpeedUnit_Knots,@(ELDeviceSpeedUnit_MPH):AiLinkBleSpeedUnit_MPH} | |||
/** AiLink速度单位 */ | |||
typedef NS_ENUM(NSInteger, ELDeviceSpeedUnit) { | |||
/** m/s */ | |||
ELDeviceSpeedUnit_M_S = 0x00 , | |||
/** km/h */ | |||
ELDeviceSpeedUnit_KM_H = 0x01 , | |||
/** ft/min */ | |||
ELDeviceSpeedUnit_FT_Min = 0x02 , | |||
/** knots(节,海里/小时,1节=1海里/小时=1.852公里/小时) */ | |||
ELDeviceSpeedUnit_Knots = 0x03 , | |||
/** MPH(1 迈= 1.609344 千米/小时) */ | |||
ELDeviceSpeedUnit_MPH = 0x04 , | |||
/** Unsupported unit */ | |||
ELDeviceSpeedUnit_Fail = 0xFF , | |||
}; | |||
#define AiLinkBleTempUnit_CStr @"℃" | |||
#define AiLinkBleTempUnit_FStr @"℉" | |||
@@ -322,7 +354,6 @@ typedef NS_ENUM(NSUInteger, ELDeviceBloodSugarUnit) { | |||
}; | |||
#pragma mark ============ 枚举 ============== | |||
typedef NS_ENUM(NSUInteger, ELBluetoothState) { | |||
ELBluetoothStateUnavailable, //Bluetooth is not available(蓝牙不可用) |
@@ -15,7 +15,8 @@ NS_ASSUME_NONNULL_BEGIN | |||
@property (nonatomic,assign) ELDeviceTemperatureUnit unit;//单位 | |||
@property (nonatomic,assign) NSUInteger temperature;//温度 | |||
@property (nonatomic,assign) BOOL dataType;//Stability flag: 0 real-time data, 1 stable data(稳定标志:0 实时数据,1 稳定数据) | |||
///Stability flag: 0 real-time data, 1 stable data(稳定标志:0 实时数据,1 稳定数据) | |||
@property (nonatomic,assign) BOOL dataType; | |||
@property (nonatomic,copy) NSString *unitStr; | |||
@property (nonatomic,assign) NSInteger tempPoint; //小数点偏移位置 | |||
@@ -7,17 +7,19 @@ | |||
// | |||
#import <Foundation/Foundation.h> | |||
#import "ELWeightAlgorithmusModel.h" | |||
#import "ELHeightAlgorithmusModel.h" | |||
#import "ELSDKHeader.h" | |||
#define StLbSymbol @":" | |||
#define FeetSymbol @"′" | |||
#define InchSymbol @"″" | |||
#define StLbSymbol WeightUnitST_LBDelimiter | |||
#define FeetSymbol ELHeightFeetSymbol | |||
#define InchSymbol ELHeightInchSymbol | |||
#define KG_LB_CONST 2.2046226f | |||
#define ST_LB_CONST 14.0f | |||
#define KG_LB_CONST ELWeightKG_LB_CONST | |||
#define ST_LB_CONST ELWeightST_LB_CONST | |||
#define INCH_CM_CONST 2.54f | |||
#define FEET_INCH_CONST 12.0f | |||
#define INCH_CM_CONST ELHeight_INCH_CM_CONST | |||
#define FEET_INCH_CONST ELHeight_FEET_INCH_CONST | |||
@interface ELUnitConvertTool : NSObject |
@@ -27,7 +27,7 @@ NS_ASSUME_NONNULL_BEGIN | |||
@property (nonatomic, assign) WheelMonitorDeviceState state;//状态 | |||
@property (nonatomic, assign) NSInteger createTime; | |||
@property (nonatomic, assign) long long createTime; | |||
/** |
@@ -34,7 +34,7 @@ | |||
</data> | |||
<key>Headers/ELBloodBleDataModel.h</key> | |||
<data> | |||
DpRqeBN9ZsF9qYH3I3sP2RuP2WQ= | |||
eFs51BF/ppCE5WcQ8HHDX+Cou+M= | |||
</data> | |||
<key>Headers/ELBloodBleManager.h</key> | |||
<data> | |||
@@ -44,25 +44,33 @@ | |||
<data> | |||
N2ScrY3zUXS4vLeY/b3xtcPA5J8= | |||
</data> | |||
<key>Headers/ELBloodSugarBleHeader.h</key> | |||
<data> | |||
sSSl1XdvJ7StT2NBA3UwRBA7n2s= | |||
</data> | |||
<key>Headers/ELBloodSugarBleManager.h</key> | |||
<data> | |||
/JDO/VrHWGMvmkaxB8nxfWrXLTI= | |||
</data> | |||
<key>Headers/ELBluetoothManager.h</key> | |||
<data> | |||
OKd3bjWNKh/sFutes+/VnWz96Vw= | |||
FfkgpftyVeFmj4RLFFezPcUCZBg= | |||
</data> | |||
<key>Headers/ELBodyFatScaleBleHeader.h</key> | |||
<data> | |||
d9CouBwRoqMKUrT+iiS0UztzPo4= | |||
K10MLRjyNYPq98CurWPiRMoM0BI= | |||
</data> | |||
<key>Headers/ELBodyFatScaleBleManager.h</key> | |||
<data> | |||
aOe/Psooxp0TUxRdLYUmY7I7VrA= | |||
J2a+FTe8dPtuKxb324Ut7ciHpgk= | |||
</data> | |||
<key>Headers/ELBodyFatScaleBleUserModel.h</key> | |||
<data> | |||
MBQ6uNFIQp9eH5QYseXEn9u8XSs= | |||
pXrH0MkTmqzJCV2VEIbJ0j6NWy8= | |||
</data> | |||
<key>Headers/ELBodyFatScaleBleWeightModel.h</key> | |||
<data> | |||
ACYbuCI3GXFXuNHirYhKf1nx9Jk= | |||
VAGOOV9Fd2X3m1leujKzrXeX8P0= | |||
</data> | |||
<key>Headers/ELBodyFatScaleDeviceModel.h</key> | |||
<data> | |||
@@ -102,7 +110,7 @@ | |||
</data> | |||
<key>Headers/ELForeheadBleDataModel.h</key> | |||
<data> | |||
5pOOuuEZPUiCO8mC+8RieX0ZktE= | |||
vJf8Kumcj7+fwHBz3oVMfiyPhe4= | |||
</data> | |||
<key>Headers/ELForeheadHeader.h</key> | |||
<data> | |||
@@ -114,19 +122,31 @@ | |||
</data> | |||
<key>Headers/ELHeightGaugeBleDataModel.h</key> | |||
<data> | |||
B+jv5YT79HhyGg7UL0jGn0SAvdg= | |||
KPPqCtkvCTd6G9/Zw6zajhOH+m4= | |||
</data> | |||
<key>Headers/ELHeightGaugeBleManager.h</key> | |||
<data> | |||
fI+CN9ThacjPbLrkT67I1KEp7do= | |||
wdzddZ39Cit+0xT8McKuVmL9Im0= | |||
</data> | |||
<key>Headers/ELHeightGaugeHeader.h</key> | |||
<data> | |||
ame1lW5x3LyjrTa2tD/aBjA8Cfw= | |||
</data> | |||
<key>Headers/ELOximeterBleManager.h</key> | |||
<data> | |||
T1p75yjnCsmP4b1CtOMSWKKCRY8= | |||
</data> | |||
<key>Headers/ELOximeterBleModel.h</key> | |||
<data> | |||
nU8MGOLvjE3KLxVYd4OLx5ufD5g= | |||
</data> | |||
<key>Headers/ELOximeterDeviceModel.h</key> | |||
<data> | |||
rkMgDu0gbnQiKOb+V93KIzvn3lI= | |||
</data> | |||
<key>Headers/ELPeripheralModel.h</key> | |||
<data> | |||
2BPYSJlX2e5+zoPjDDF0b+rGgEc= | |||
mBy0FHI/hyo/SrglrOG3sO6rAGE= | |||
</data> | |||
<key>Headers/ELRemoteControlBleHeader.h</key> | |||
<data> | |||
@@ -142,7 +162,7 @@ | |||
</data> | |||
<key>Headers/ELSDKHeader.h</key> | |||
<data> | |||
GKs3bfL6dryCrnD+GMedQhIEAU4= | |||
qG//usgqXXqSonMmz5XWHUiq7oQ= | |||
</data> | |||
<key>Headers/ELTempAlgorithmusModel.h</key> | |||
<data> | |||
@@ -154,7 +174,7 @@ | |||
</data> | |||
<key>Headers/ELThermometerBleModel.h</key> | |||
<data> | |||
gfcdH3dOdDIjBaU0lbhAsuqSDQU= | |||
WF60Fo1A0P/luh3JNoHFUy9Rsyw= | |||
</data> | |||
<key>Headers/ELThermometerDeviceModel.h</key> | |||
<data> | |||
@@ -170,7 +190,7 @@ | |||
</data> | |||
<key>Headers/ELUnitConvertTool.h</key> | |||
<data> | |||
KUvTJzAj6UgO0TVIag6jroPEZ9g= | |||
cnvOnUbUQ4f/0gTSgIOjlBXUN6Y= | |||
</data> | |||
<key>Headers/ELWeightAlgorithmusModel.h</key> | |||
<data> | |||
@@ -186,11 +206,11 @@ | |||
</data> | |||
<key>Headers/ELWheelMonitorBleModel.h</key> | |||
<data> | |||
33QcqrJFFbKEYqLTPl0GvIq3/4c= | |||
4icY11fLvCNl3xkTUUVJ52Mvc3E= | |||
</data> | |||
<key>Info.plist</key> | |||
<data> | |||
UMqEsWdtMOlMnusqzTciLhNvrrg= | |||
RLIicikwX4wLnY8yDfRTzcPecII= | |||
</data> | |||
</dict> | |||
<key>files2</key> | |||
@@ -276,11 +296,11 @@ | |||
<dict> | |||
<key>hash</key> | |||
<data> | |||
DpRqeBN9ZsF9qYH3I3sP2RuP2WQ= | |||
eFs51BF/ppCE5WcQ8HHDX+Cou+M= | |||
</data> | |||
<key>hash2</key> | |||
<data> | |||
MQxwbR+wSqYSadxV6Wy7ODXlaFYZDwSs8J15eSLT3BI= | |||
yNfYPqbI+KW+wfhT17OQ9muTO6XvNaiHyGH8Mw1yHv4= | |||
</data> | |||
</dict> | |||
<key>Headers/ELBloodBleManager.h</key> | |||
@@ -305,59 +325,81 @@ | |||
DJIEwcPb2L+C8PWkXoK8ChDmrREy1z4j+KIPlU/Pxv8= | |||
</data> | |||
</dict> | |||
<key>Headers/ELBloodSugarBleHeader.h</key> | |||
<dict> | |||
<key>hash</key> | |||
<data> | |||
sSSl1XdvJ7StT2NBA3UwRBA7n2s= | |||
</data> | |||
<key>hash2</key> | |||
<data> | |||
i2pc7K838/njJA50EWsu8/Pkw23P1RyBp7Oqlui5XJg= | |||
</data> | |||
</dict> | |||
<key>Headers/ELBloodSugarBleManager.h</key> | |||
<dict> | |||
<key>hash</key> | |||
<data> | |||
/JDO/VrHWGMvmkaxB8nxfWrXLTI= | |||
</data> | |||
<key>hash2</key> | |||
<data> | |||
3FVhuleEqCZXSdsFd5XIyo+fvq6CXLsC8g9GspAyqm0= | |||
</data> | |||
</dict> | |||
<key>Headers/ELBluetoothManager.h</key> | |||
<dict> | |||
<key>hash</key> | |||
<data> | |||
OKd3bjWNKh/sFutes+/VnWz96Vw= | |||
FfkgpftyVeFmj4RLFFezPcUCZBg= | |||
</data> | |||
<key>hash2</key> | |||
<data> | |||
x8MeFX59REfQRNAyQC/13C+sAIxFfiEbHM5QSmqs1Ts= | |||
IifOuhf8BH3YyoDF6L9+9AO/47rw2eArZ1qUHEHXkjw= | |||
</data> | |||
</dict> | |||
<key>Headers/ELBodyFatScaleBleHeader.h</key> | |||
<dict> | |||
<key>hash</key> | |||
<data> | |||
d9CouBwRoqMKUrT+iiS0UztzPo4= | |||
K10MLRjyNYPq98CurWPiRMoM0BI= | |||
</data> | |||
<key>hash2</key> | |||
<data> | |||
pKjb8UqI7IWcu3tjnBMSvE5QrbjyydIEe/CiN7dzs+g= | |||
NA+FRVsNPBLWRjAhMxRcDX2YCcywzySkkl0cx4Unydk= | |||
</data> | |||
</dict> | |||
<key>Headers/ELBodyFatScaleBleManager.h</key> | |||
<dict> | |||
<key>hash</key> | |||
<data> | |||
aOe/Psooxp0TUxRdLYUmY7I7VrA= | |||
J2a+FTe8dPtuKxb324Ut7ciHpgk= | |||
</data> | |||
<key>hash2</key> | |||
<data> | |||
yP0Y2J8Opesx6PnzjJRowY6jVqShxqay2AO3JlakpkY= | |||
Pvn5qz/TE6j/lEvuZdPfjbXNnbPWHnophYlLEsKkr0I= | |||
</data> | |||
</dict> | |||
<key>Headers/ELBodyFatScaleBleUserModel.h</key> | |||
<dict> | |||
<key>hash</key> | |||
<data> | |||
MBQ6uNFIQp9eH5QYseXEn9u8XSs= | |||
pXrH0MkTmqzJCV2VEIbJ0j6NWy8= | |||
</data> | |||
<key>hash2</key> | |||
<data> | |||
EhqjKgLFWoipLPU+hDqAOmsB8L3eapoVCS+dq4P+f8g= | |||
jLDK10ZJ8OC0hKShlSFlthn+N4nlGyEX9b/1U66ZLd4= | |||
</data> | |||
</dict> | |||
<key>Headers/ELBodyFatScaleBleWeightModel.h</key> | |||
<dict> | |||
<key>hash</key> | |||
<data> | |||
ACYbuCI3GXFXuNHirYhKf1nx9Jk= | |||
VAGOOV9Fd2X3m1leujKzrXeX8P0= | |||
</data> | |||
<key>hash2</key> | |||
<data> | |||
MJq+xb+X8LJ7f1ynJoK0wMQHkQ845EDay2JyAHuMN/E= | |||
MrCz1mNPm+FW4lCPh6W9Q9MgC5OTGiuBiHfaxdyJ48U= | |||
</data> | |||
</dict> | |||
<key>Headers/ELBodyFatScaleDeviceModel.h</key> | |||
@@ -463,11 +505,11 @@ | |||
<dict> | |||
<key>hash</key> | |||
<data> | |||
5pOOuuEZPUiCO8mC+8RieX0ZktE= | |||
vJf8Kumcj7+fwHBz3oVMfiyPhe4= | |||
</data> | |||
<key>hash2</key> | |||
<data> | |||
OT0VXqsUYZUY7X+MRujUaoJEDRFRUoaeIOwn2ZeVlpU= | |||
SNvY1vLwoZVMANNWuef7yeSLTUMnCZRzkynyqwIPBv0= | |||
</data> | |||
</dict> | |||
<key>Headers/ELForeheadHeader.h</key> | |||
@@ -496,22 +538,22 @@ | |||
<dict> | |||
<key>hash</key> | |||
<data> | |||
B+jv5YT79HhyGg7UL0jGn0SAvdg= | |||
KPPqCtkvCTd6G9/Zw6zajhOH+m4= | |||
</data> | |||
<key>hash2</key> | |||
<data> | |||
LTE74gs3V3TrNvclF3YfurebOuZ/6SGGdbunw0bZKxk= | |||
TUFTZGXqGi5yzOeJzRpDu7vMoAqfsVd9EFz4SFW71Xs= | |||
</data> | |||
</dict> | |||
<key>Headers/ELHeightGaugeBleManager.h</key> | |||
<dict> | |||
<key>hash</key> | |||
<data> | |||
fI+CN9ThacjPbLrkT67I1KEp7do= | |||
wdzddZ39Cit+0xT8McKuVmL9Im0= | |||
</data> | |||
<key>hash2</key> | |||
<data> | |||
DC+5AXDTzQwo3qk4gZsG2XUZGcnJEbh5+uGEqYMEFk8= | |||
gdE2eyETLgvL7aZCeFgu3mtsmZX2kTu66DlpPN0cNMw= | |||
</data> | |||
</dict> | |||
<key>Headers/ELHeightGaugeHeader.h</key> | |||
@@ -525,15 +567,48 @@ | |||
cGlFpjbfDm88HxwGHZsIk5PD17XWUnkyEUNeaM8BALk= | |||
</data> | |||
</dict> | |||
<key>Headers/ELOximeterBleManager.h</key> | |||
<dict> | |||
<key>hash</key> | |||
<data> | |||
T1p75yjnCsmP4b1CtOMSWKKCRY8= | |||
</data> | |||
<key>hash2</key> | |||
<data> | |||
BSVKr+dlDK1bjTeYuFGTRFhR2WGhSl4bRYBfKw6pnKE= | |||
</data> | |||
</dict> | |||
<key>Headers/ELOximeterBleModel.h</key> | |||
<dict> | |||
<key>hash</key> | |||
<data> | |||
nU8MGOLvjE3KLxVYd4OLx5ufD5g= | |||
</data> | |||
<key>hash2</key> | |||
<data> | |||
NSN3dB7IXdkK8VOoPFVmHsm5nazAzRnbCoxUDVvwGGk= | |||
</data> | |||
</dict> | |||
<key>Headers/ELOximeterDeviceModel.h</key> | |||
<dict> | |||
<key>hash</key> | |||
<data> | |||
rkMgDu0gbnQiKOb+V93KIzvn3lI= | |||
</data> | |||
<key>hash2</key> | |||
<data> | |||
zuuTj+npaoe7wUHAqB68UEWtl1UmT2nLlu8oOksIqWw= | |||
</data> | |||
</dict> | |||
<key>Headers/ELPeripheralModel.h</key> | |||
<dict> | |||
<key>hash</key> | |||
<data> | |||
2BPYSJlX2e5+zoPjDDF0b+rGgEc= | |||
mBy0FHI/hyo/SrglrOG3sO6rAGE= | |||
</data> | |||
<key>hash2</key> | |||
<data> | |||
zVdvk9EguhJ4yIkagDVl0cB3uFLBEowO4ly8JecN8ks= | |||
AkdtV2tT7Agyv2ik6kSKz8kKJi042apMwxEVcXPyKkI= | |||
</data> | |||
</dict> | |||
<key>Headers/ELRemoteControlBleHeader.h</key> | |||
@@ -573,11 +648,11 @@ | |||
<dict> | |||
<key>hash</key> | |||
<data> | |||
GKs3bfL6dryCrnD+GMedQhIEAU4= | |||
qG//usgqXXqSonMmz5XWHUiq7oQ= | |||
</data> | |||
<key>hash2</key> | |||
<data> | |||
r1aQIPZs0NMAPNezCmkWE4KzH9wD+DmKAafzpwOqjrg= | |||
WUXTSBI1wntrAmPRzaqcAYLRQH4QswBL/nYgOHOB05A= | |||
</data> | |||
</dict> | |||
<key>Headers/ELTempAlgorithmusModel.h</key> | |||
@@ -606,11 +681,11 @@ | |||
<dict> | |||
<key>hash</key> | |||
<data> | |||
gfcdH3dOdDIjBaU0lbhAsuqSDQU= | |||
WF60Fo1A0P/luh3JNoHFUy9Rsyw= | |||
</data> | |||
<key>hash2</key> | |||
<data> | |||
ay1fe+kwQGlcxg6zWWv0Z9h+hZdIiWcqkXaWmfHUfKQ= | |||
3ZijZcITdb4zEUbac9UkE3siVGW3EUbEBTxIEQsHq64= | |||
</data> | |||
</dict> | |||
<key>Headers/ELThermometerDeviceModel.h</key> | |||
@@ -650,11 +725,11 @@ | |||
<dict> | |||
<key>hash</key> | |||
<data> | |||
KUvTJzAj6UgO0TVIag6jroPEZ9g= | |||
cnvOnUbUQ4f/0gTSgIOjlBXUN6Y= | |||
</data> | |||
<key>hash2</key> | |||
<data> | |||
m9kGIMT+Hyb5vxlcF8hsbi4cmg8IWW0u1d690GOSIqA= | |||
HrGjVy8jQew0b8H6b/KDvB7a6iEw/HPpK8PO46yEokU= | |||
</data> | |||
</dict> | |||
<key>Headers/ELWeightAlgorithmusModel.h</key> | |||
@@ -694,11 +769,11 @@ | |||
<dict> | |||
<key>hash</key> | |||
<data> | |||
33QcqrJFFbKEYqLTPl0GvIq3/4c= | |||
4icY11fLvCNl3xkTUUVJ52Mvc3E= | |||
</data> | |||
<key>hash2</key> | |||
<data> | |||
3x0+7c3+zhAdZCb2nagaiXYx5O2P124ki7PJrSqjxUI= | |||
Bn3FIqM7yQPVawU2zfEXrpeb1z/rM0sbHlhNRW8KyRg= | |||
</data> | |||
</dict> | |||
</dict> |
@@ -85,7 +85,5 @@ | |||
} | |||
return _tableView; | |||
} | |||
-(void)dealloc{ | |||
[[ELBabyScaleBleManager shareManager] stopScan]; | |||
} | |||
@end |
@@ -0,0 +1,20 @@ | |||
// | |||
// BloodSugarConnectionViewController.h | |||
// AILinkBleSDKSourceCode | |||
// | |||
// Created by cliCk on 2021/1/28. | |||
// Copyright © 2021 IOT. All rights reserved. | |||
// | |||
#import <UIKit/UIKit.h> | |||
@class ELPeripheralModel; | |||
NS_ASSUME_NONNULL_BEGIN | |||
@interface BloodSugarConnectionViewController : UIViewController | |||
@property (nonatomic, strong) ELPeripheralModel *p; | |||
@end | |||
NS_ASSUME_NONNULL_END |
@@ -0,0 +1,205 @@ | |||
// | |||
// BloodSugarConnectionViewController.m | |||
// AILinkBleSDKSourceCode | |||
// | |||
// Created by cliCk on 2021/1/28. | |||
// Copyright © 2021 IOT. All rights reserved. | |||
// | |||
#import "BloodSugarConnectionViewController.h" | |||
#import "Masonry.h" | |||
#import <AILinkBleSDK/ELBloodSugarBleHeader.h> | |||
#import <AILinkBleSDK/ELBloodSugarBleManager.h> | |||
@interface BloodSugarConnectionViewController () <BloodSugarBleDelegate, ELBluetoothManagerDelegate> | |||
@property (nonatomic, strong) UITextView *textView; | |||
@property (nonatomic, copy) NSArray<NSNumber *> *units; | |||
@property (nonatomic, strong) UIButton *connectButton; | |||
@end | |||
@implementation BloodSugarConnectionViewController | |||
- (void)viewDidLoad { | |||
[super viewDidLoad]; | |||
// Do any additional setup after loading the view. | |||
self.view.backgroundColor = [UIColor whiteColor]; | |||
[ELBloodSugarBleManager shareManager].bloodSugarDelegate = self; | |||
[ELBloodSugarBleManager shareManager].delegate = self; | |||
[[ELBloodSugarBleManager shareManager] connectPeripheral:self.p]; | |||
[self setupUIView]; | |||
} | |||
- (void)viewWillDisappear:(BOOL)animated { | |||
[[ELBloodSugarBleManager shareManager] disconnectPeripheral]; | |||
} | |||
-(void)addLog:(NSString *)log{ | |||
self.textView.text = [NSString stringWithFormat:@"%@\n\n%@",log,self.textView.text]; | |||
} | |||
- (void)connectDevice { | |||
[[ELBloodSugarBleManager shareManager] startScan]; | |||
} | |||
- (void)setupUIView { | |||
self.connectButton = [[UIButton alloc] initWithFrame:CGRectMake((self.view.frame.size.width-100)/2, 88, 100, 40)]; | |||
[self.connectButton setTitle:@"点击重连" forState:UIControlStateNormal]; | |||
[self.connectButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; | |||
[self.view addSubview:self.connectButton]; | |||
[self.connectButton addTarget:self action:@selector(connectDevice) forControlEvents:UIControlEventTouchUpInside]; | |||
self.connectButton.hidden = YES; | |||
self.textView = [[UITextView alloc] init]; | |||
self.textView.backgroundColor = [UIColor blackColor]; | |||
self.textView.text = @"Log"; | |||
self.textView.textColor = [UIColor redColor]; | |||
[self.view addSubview:self.textView]; | |||
[self.textView mas_makeConstraints:^(MASConstraintMaker *make) { | |||
make.left.mas_equalTo(10); | |||
make.right.mas_equalTo(-10); | |||
make.bottom.offset(-44); | |||
// make.height.mas_equalTo(350); | |||
make.top.offset(150); | |||
}]; | |||
} | |||
#pragma mark - ble Delegate | |||
- (void)bloodSugarBleReceiveState:(ELBluetoothState)state { | |||
switch (state) { | |||
case ELBluetoothStateUnavailable: | |||
{ | |||
self.title = @"Please open the bluetooth"; | |||
} | |||
break; | |||
case ELBluetoothStateAvailable: | |||
{ | |||
self.title = @"Bluetooth is open"; | |||
} | |||
break; | |||
case ELBluetoothStateScaning: | |||
{ | |||
self.title = @"Scaning"; | |||
} | |||
break; | |||
case ELBluetoothStateConnectFail: | |||
{ | |||
self.title = @"Connect fail"; | |||
} | |||
break; | |||
case ELBluetoothStateDidDisconnect: | |||
{ | |||
self.title = @"Disconnected"; | |||
self.connectButton.hidden = NO; | |||
} | |||
break; | |||
case ELBluetoothStateDidValidationPass: | |||
{ | |||
self.connectButton.hidden = YES; | |||
self.title = @"Connected"; | |||
//连接成功,获取单位 | |||
[[ELBloodSugarBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:ELInetGetCmdTypeReadDeviceSupportUnit]; | |||
//获取版本号 | |||
[[ELBloodSugarBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:ELInetGetCmdTypeGetBMVersion]; | |||
//同步时间到设备 | |||
[[ELBloodSugarBleManager shareManager] syncMCUNowDate]; | |||
//查询设备状态 | |||
[[ELBloodSugarBleManager shareManager] bloodSugarQueryDeviceStatus]; | |||
} | |||
break; | |||
case ELBluetoothStateFailedValidation: | |||
{ | |||
self.title = @"Illegal equipment"; | |||
} | |||
break; | |||
case ELBluetoothStateWillConnect: | |||
self.title = @"Connecting"; | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
- (void)bloodSugarBleReceiveDevices:(NSArray<ELPeripheralModel *> *)devices { | |||
for (ELPeripheralModel *model in devices) { | |||
if ([model.macAddress isEqualToString:self.p.macAddress]) { | |||
[[ELBloodSugarBleManager shareManager] connectPeripheral:model]; | |||
} | |||
} | |||
} | |||
-(void)bloodSugarBleReceiveDeviceStatus:(BloodSugarDeviceStatus)status{ | |||
if (status == BloodSugarDeviceStatusNoStatus) { | |||
// self.measureView.status = BloodSugarMeasureViewStatusDefault; | |||
} else if (status == BloodSugarDeviceStatusTestWaiting) { | |||
[self addLog:@"请插入试纸"]; | |||
} else if (status == BloodSugarDeviceStatusSamplingWaiting){ | |||
[self addLog:@"获取血样中..."]; | |||
} else if (status == BloodSugarDeviceStatusAnalysising){ | |||
[self addLog:@"血样分析中..."]; | |||
} else if (status == BloodSugarDeviceStatusTestComplete){ | |||
[self addLog:@"测量完成"]; | |||
} | |||
} | |||
- (void)bloodSugarBleReceiveTestData:(BloodSugarDataStruct)data { | |||
NSString *unit = [NSString string]; | |||
if (data.unit == ELDeviceBloodSugarUnit_mmol_L) { | |||
unit = @"mmol/L"; | |||
}else { | |||
unit = @"mg/dl"; | |||
} | |||
[self addLog:[NSString stringWithFormat:@"测量结果 数值 : %d, 单位 : %@ point : %d",data.value,unit,data.point]]; | |||
} | |||
- (void)bloodSugarBleReceiveErrorCode:(BloodSugarErrorCode)errorCode { | |||
NSString *errorMsg = @"测量失败"; | |||
switch (errorCode) { | |||
case BloodSugarErrorCodeLowBattery: | |||
{ | |||
errorMsg = @"电量不足"; | |||
} | |||
break; | |||
case BloodSugarErrorCodeUsedTestPaper: { | |||
errorMsg = @"使用了已使用过的试纸"; | |||
break; | |||
} | |||
case BloodSugarErrorCodeTempHigh: { | |||
errorMsg = @"环境温度超出使用范围"; | |||
break; | |||
} | |||
case BloodSugarErrorCodeCancelTest: { | |||
errorMsg = @"试纸施加血样后测试未完成,被退出试纸"; | |||
break; | |||
} | |||
case BloodSugarErrorCodePassError: { | |||
errorMsg = @"机器自检未通过"; | |||
break; | |||
} | |||
case BloodSugarErrorCodeLow: { | |||
errorMsg = @"测量结果过低,超出测量范围"; | |||
break; | |||
} | |||
case BloodSugarErrorCodeHigh: { | |||
errorMsg = @"测量结果过高,超出测量范围"; | |||
break; | |||
} | |||
} | |||
[self addLog:[NSString stringWithFormat:@"测量结果 :%@",errorMsg]]; | |||
} | |||
- (void)bloodSugarBleBackManufactureData:(NSData *)data { | |||
[self addLog:[NSString stringWithFormat:@"收到的原始数据 : %@",data]]; | |||
} | |||
@end |
@@ -0,0 +1,17 @@ | |||
// | |||
// BloodSugarScanViewController.h | |||
// AILinkBleSDKSourceCode | |||
// | |||
// Created by cliCk on 2021/1/28. | |||
// Copyright © 2021 IOT. All rights reserved. | |||
// | |||
#import <UIKit/UIKit.h> | |||
NS_ASSUME_NONNULL_BEGIN | |||
@interface BloodSugarScanViewController : UIViewController | |||
@end | |||
NS_ASSUME_NONNULL_END |
@@ -0,0 +1,89 @@ | |||
// | |||
// BloodSugarScanViewController.m | |||
// AILinkBleSDKSourceCode | |||
// | |||
// Created by cliCk on 2021/1/28. | |||
// Copyright © 2021 IOT. All rights reserved. | |||
// | |||
#import "BloodSugarScanViewController.h" | |||
#import <AILinkBleSDK/ELBloodSugarBleManager.h> | |||
#import "Masonry.h" | |||
#import "BloodSugarConnectionViewController.h" | |||
@interface BloodSugarScanViewController () <UITableViewDelegate,UITableViewDataSource,BloodSugarBleDelegate> | |||
@property (nonatomic, strong) UITableView *tableView; | |||
@property (nonatomic, strong) NSArray<ELPeripheralModel *> *devices; | |||
@end | |||
@implementation BloodSugarScanViewController | |||
- (void)viewDidLoad { | |||
[super viewDidLoad]; | |||
// Do any additional setup after loading the view. | |||
[self.view addSubview:self.tableView]; | |||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { | |||
make.top.left.right.bottom.mas_equalTo(0); | |||
}]; | |||
} | |||
- (void)viewWillAppear:(BOOL)animated { | |||
[[ELBloodSugarBleManager shareManager] startScan]; | |||
[ELBloodSugarBleManager shareManager].bloodSugarDelegate = self; | |||
} | |||
- (void)viewWillDisappear:(BOOL)animated { | |||
[[ELBloodSugarBleManager shareManager] stopScan]; | |||
} | |||
#pragma mark - BloodSugarBleDelegate | |||
- (void)bloodSugarBleReceiveState:(ELBluetoothState)state { | |||
NSLog(@"bluetoothManagerUpdateBleState = %ld",state); | |||
} | |||
- (void)bloodSugarBleReceiveDevices:(NSArray<ELPeripheralModel *> *)devices { | |||
self.devices = devices; | |||
[self.tableView reloadData]; | |||
} | |||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ | |||
return self.devices.count; | |||
} | |||
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ | |||
return 60; | |||
} | |||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ | |||
static NSString *cellId = @"cellid"; | |||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId]; | |||
if (!cell) { | |||
cell = [[UITableViewCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId]; | |||
} | |||
ELPeripheralModel *p = self.devices[indexPath.row]; | |||
cell.textLabel.text = [NSString stringWithFormat:@"Name:%@---Mac:%@\nCID:%ld---VID:%ld---PID:%ld",p.deviceName,p.macAddress,p.deviceType,p.vendorID,p.productID]; | |||
cell.textLabel.numberOfLines = 2; | |||
cell.textLabel.textColor = [UIColor blackColor]; | |||
return cell; | |||
} | |||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ | |||
ELPeripheralModel *p = self.devices[indexPath.row]; | |||
BloodSugarConnectionViewController *vc = [[BloodSugarConnectionViewController alloc] init]; | |||
vc.p = p; | |||
[self.navigationController pushViewController:vc animated:YES]; | |||
} | |||
-(UITableView *)tableView{ | |||
if (_tableView == nil) { | |||
_tableView = [[UITableView alloc] init]; | |||
_tableView.delegate = self; | |||
_tableView.dataSource = self; | |||
} | |||
return _tableView; | |||
} | |||
@end |
@@ -11,7 +11,7 @@ | |||
#import <AILinkBleSDK/ELBodyFatScaleBleManager.h> | |||
#import <AILinkBleSDK/ELBodyFatScaleBleUserModel.h> | |||
#import <AILinkBleSDK/ELBodyFatScaleBleWeightModel.h> | |||
#import "WiFiSetupViewController.h" | |||
//#import "WiFiSetupViewController.h" | |||
@interface BodyFatScaleConnectViewController ()<ELBluetoothManagerDelegate,ELBodyFatScaleBleDelegate,ElBleWifiDelegate> | |||
@property (nonatomic, strong) UITextView *textView; |
@@ -1,32 +0,0 @@ | |||
// | |||
// WiFiSetupViewController.m | |||
// AILinkBleSDKSourceCode | |||
// | |||
// Created by iot_user on 2020/4/8. | |||
// Copyright © 2020 IOT. All rights reserved. | |||
// | |||
#import "WiFiSetupViewController.h" | |||
@interface WiFiSetupViewController () | |||
@end | |||
@implementation WiFiSetupViewController | |||
- (void)viewDidLoad { | |||
[super viewDidLoad]; | |||
// Do any additional setup after loading the view. | |||
} | |||
/* | |||
#pragma mark - Navigation | |||
// In a storyboard-based application, you will often want to do a little preparation before navigation | |||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | |||
// Get the new view controller using [segue destinationViewController]. | |||
// Pass the selected object to the new view controller. | |||
} | |||
*/ | |||
@end |
@@ -77,6 +77,7 @@ Callback decrypted A7 transparent data (payload part), type device type( 回调 | |||
-(void)bluetoothReceiveBasicInfoPayloadData:(NSData *)data{ | |||
//特殊数据:门锁和胎压监测会用到,需根据具体协议解析 | |||
} | |||
///Callback transparent transmission data(回调透传数据) | |||
/// @param data Transparent data(透传数据) | |||
-(void)bluetoothReceivePassData:(NSData *)data{ |
@@ -21,6 +21,7 @@ | |||
#import "BroadcastScaleViewController.h" | |||
#import "EightScaleScanViewController.h" | |||
#import "ToothbrushScanViewController.h" | |||
#import "ELBfsWifiScanVC.h" | |||
@interface ViewController ()<UITableViewDelegate,UITableViewDataSource> | |||
@@ -47,7 +48,8 @@ | |||
@"Bluetooth BodyfatScale(体脂秤)", | |||
@"Bluetooth BroadcastScale(广播秤)", | |||
@"Eight-electrode scale(八电极体脂秤)", | |||
@"wifi-ble toothbrush(蓝牙WiFi牙刷)" | |||
@"wifi-ble toothbrush(WiFi-ble牙刷)", | |||
@"wifi-ble bodyfatScale(WiFi-ble体脂秤)", | |||
]; | |||
self.vcsArray = @[ | |||
@@ -62,7 +64,8 @@ | |||
[[BodyFatScaleScanViewController alloc] init], | |||
[[BroadcastScaleViewController alloc] init], | |||
[[EightScaleScanViewController alloc] init], | |||
[[ToothbrushScanViewController alloc] init] | |||
[[ToothbrushScanViewController alloc] init], | |||
[[ELBfsWifiScanVC alloc] init], | |||
]; | |||
[self.view addSubview:self.tableView]; |
@@ -0,0 +1,20 @@ | |||
// | |||
// OximeterConnectionViewController.h | |||
// AILinkBleSDKSourceCode | |||
// | |||
// Created by cliCk on 2021/1/28. | |||
// Copyright © 2021 IOT. All rights reserved. | |||
// | |||
#import <UIKit/UIKit.h> | |||
@class ELPeripheralModel; | |||
NS_ASSUME_NONNULL_BEGIN | |||
@interface OximeterConnectionViewController : UIViewController | |||
@property (nonatomic, strong) ELPeripheralModel *p; | |||
@end | |||
NS_ASSUME_NONNULL_END |
@@ -0,0 +1,118 @@ | |||
// | |||
// OximeterConnectionViewController.m | |||
// AILinkBleSDKSourceCode | |||
// | |||
// Created by cliCk on 2021/1/28. | |||
// Copyright © 2021 IOT. All rights reserved. | |||
// | |||
#import "OximeterConnectionViewController.h" | |||
#import "Masonry.h" | |||
#import <AILinkBleSDK/ELOximeterBleManager.h> | |||
#import <AILinkBleSDK/ELOximeterDeviceModel.h> | |||
#import <AILinkBleSDK/ELOximeterBleModel.h> | |||
@interface OximeterConnectionViewController () <ELOximeterBleDelegate, ELBluetoothManagerDelegate> | |||
@property (nonatomic, strong) UITextView *textView; | |||
@property (nonatomic, copy) NSArray<NSNumber *> *units; | |||
@end | |||
@implementation OximeterConnectionViewController | |||
- (void)viewDidLoad { | |||
[super viewDidLoad]; | |||
// Do any additional setup after loading the view. | |||
self.view.backgroundColor = [UIColor whiteColor]; | |||
[ELOximeterBleManager shareManager].oximeterBleDelegate = self; | |||
[ELOximeterBleManager shareManager].delegate = self; | |||
[[ELOximeterBleManager shareManager] connectPeripheral:self.p]; | |||
[self setupUIView]; | |||
} | |||
- (void)viewWillDisappear:(BOOL)animated { | |||
[[ELOximeterBleManager shareManager] disconnectPeripheral]; | |||
} | |||
-(void)addLog:(NSString *)log{ | |||
self.textView.text = [NSString stringWithFormat:@"%@\n\n%@",log,self.textView.text]; | |||
} | |||
- (void)setupUIView { | |||
self.textView = [[UITextView alloc] init]; | |||
self.textView.backgroundColor = [UIColor blackColor]; | |||
self.textView.text = @"Log"; | |||
self.textView.textColor = [UIColor redColor]; | |||
[self.view addSubview:self.textView]; | |||
[self.textView mas_makeConstraints:^(MASConstraintMaker *make) { | |||
make.left.mas_equalTo(10); | |||
make.right.mas_equalTo(-10); | |||
make.bottom.offset(-44); | |||
make.top.offset(150); | |||
}]; | |||
} | |||
#pragma mark - ble Delegate | |||
- (void)oximeterManagerBleState:(ELBluetoothState)state { | |||
switch (state) { | |||
case ELBluetoothStateUnavailable: | |||
{ | |||
self.title = @"Please open the bluetooth"; | |||
} | |||
break; | |||
case ELBluetoothStateAvailable: | |||
{ | |||
self.title = @"Bluetooth is open"; | |||
} | |||
break; | |||
case ELBluetoothStateScaning: | |||
{ | |||
self.title = @"Scaning"; | |||
} | |||
break; | |||
case ELBluetoothStateConnectFail: | |||
{ | |||
self.title = @"Connect fail"; | |||
} | |||
break; | |||
case ELBluetoothStateDidDisconnect: | |||
{ | |||
self.title = @"Disconnected"; | |||
} | |||
break; | |||
case ELBluetoothStateDidValidationPass: | |||
{ | |||
self.title = @"Connected"; | |||
//获取设备设置信息 | |||
[[ELOximeterBleManager shareManager] sendToBleWithGetDeviceStaus]; | |||
} | |||
break; | |||
case ELBluetoothStateFailedValidation: | |||
{ | |||
self.title = @"Illegal equipment"; | |||
} | |||
break; | |||
case ELBluetoothStateWillConnect: | |||
self.title = @"Connecting"; | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
- (void)oximeterManagerSetupState:(ELOximeterBleModel *)bleModel markType:(enum OximeterTestMarkType)markType { | |||
NSString *logString = [NSString stringWithFormat:@"SpO2 : %zd \n bpm : %zd \n PI : %.1f \n power : %zd",bleModel.SpO2,bleModel.pulseRate,bleModel.pi/10.f,bleModel.power]; | |||
[self addLog:logString]; | |||
} | |||
- (void)oximeterManagerBleBackManufactureData:(NSData *)data { | |||
[self addLog:[NSString stringWithFormat:@"收到的原始数据 : %@",data]]; | |||
} | |||
@end |
@@ -0,0 +1,17 @@ | |||
// | |||
// OximeterScanViewController.h | |||
// AILinkBleSDKSourceCode | |||
// | |||
// Created by cliCk on 2021/1/28. | |||
// Copyright © 2021 IOT. All rights reserved. | |||
// | |||
#import <UIKit/UIKit.h> | |||
NS_ASSUME_NONNULL_BEGIN | |||
@interface OximeterScanViewController : UIViewController | |||
@end | |||
NS_ASSUME_NONNULL_END |
@@ -0,0 +1,89 @@ | |||
// | |||
// OximeterScanViewController.m | |||
// AILinkBleSDKSourceCode | |||
// | |||
// Created by cliCk on 2021/1/28. | |||
// Copyright © 2021 IOT. All rights reserved. | |||
// | |||
#import "OximeterScanViewController.h" | |||
#import <AILinkBleSDK/ELOximeterBleManager.h> | |||
#import "Masonry.h" | |||
#import "OximeterConnectionViewController.h" | |||
@interface OximeterScanViewController () <UITableViewDelegate,UITableViewDataSource,ELOximeterBleDelegate> | |||
@property (nonatomic, strong) UITableView *tableView; | |||
@property (nonatomic, strong) NSArray<ELPeripheralModel *> *devices; | |||
@end | |||
@implementation OximeterScanViewController | |||
- (void)viewDidLoad { | |||
[super viewDidLoad]; | |||
// Do any additional setup after loading the view. | |||
[self.view addSubview:self.tableView]; | |||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { | |||
make.top.left.right.bottom.mas_equalTo(0); | |||
}]; | |||
} | |||
- (void)viewWillAppear:(BOOL)animated { | |||
[[ELOximeterBleManager shareManager] startScan]; | |||
[ELOximeterBleManager shareManager].oximeterBleDelegate = self; | |||
} | |||
- (void)viewWillDisappear:(BOOL)animated { | |||
[[ELOximeterBleManager shareManager] stopScan]; | |||
} | |||
#pragma mark - ELOximeterBleDelegate | |||
- (void)oximeterManagerBleState:(ELBluetoothState)state { | |||
NSLog(@"bluetoothManagerUpdateBleState = %ld",state); | |||
} | |||
- (void)oximeterManagerScanDevices:(NSArray<ELOximeterDeviceModel *> *)devices { | |||
self.devices = devices; | |||
[self.tableView reloadData]; | |||
} | |||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ | |||
return self.devices.count; | |||
} | |||
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ | |||
return 60; | |||
} | |||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ | |||
static NSString *cellId = @"cellid"; | |||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId]; | |||
if (!cell) { | |||
cell = [[UITableViewCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId]; | |||
} | |||
ELPeripheralModel *p = self.devices[indexPath.row]; | |||
cell.textLabel.text = [NSString stringWithFormat:@"Name:%@---Mac:%@\nCID:%ld---VID:%ld---PID:%ld",p.deviceName,p.macAddress,p.deviceType,p.vendorID,p.productID]; | |||
cell.textLabel.numberOfLines = 2; | |||
cell.textLabel.textColor = [UIColor blackColor]; | |||
return cell; | |||
} | |||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ | |||
ELPeripheralModel *p = self.devices[indexPath.row]; | |||
OximeterConnectionViewController *vc = [[OximeterConnectionViewController alloc] init]; | |||
vc.p = p; | |||
[self.navigationController pushViewController:vc animated:YES]; | |||
} | |||
-(UITableView *)tableView{ | |||
if (_tableView == nil) { | |||
_tableView = [[UITableView alloc] init]; | |||
_tableView.delegate = self; | |||
_tableView.dataSource = self; | |||
} | |||
return _tableView; | |||
} | |||
@end |