| #ifdef __OBJC__ | |||||
| #import <UIKit/UIKit.h> | |||||
| #else | |||||
| #ifndef FOUNDATION_EXPORT | |||||
| #if defined(__cplusplus) | |||||
| #define FOUNDATION_EXPORT extern "C" | |||||
| #else | |||||
| #define FOUNDATION_EXPORT extern | |||||
| #endif | |||||
| #endif | |||||
| #endif | |||||
| #import "ELAILinkBleManager+WIFI.h" | |||||
| #import "ELAILinkBleManager.h" | |||||
| #import "ELAILinkBleManagerProtocol.h" | |||||
| #import "ELAILinkPeripheral.h" | |||||
| #import "ELTLVModel.h" | |||||
| #import "NELBleManagerHeader.h" | |||||
| #import "NELMacAddressModel.h" | |||||
| #import "NSData+AILinkBle.h" | |||||
| #import "AILinkBleSDK_Version.h" | |||||
| #import "ELAILinkEncryptTool.h" | |||||
| #import "ELAILinkLicenseTool.h" | |||||
| #import "ELBleDisposeDataTool.h" | |||||
| #import "ELBleWifiDetailModel.h" | |||||
| #import "ELExSupportDeviceType.h" | |||||
| #import "ELSDKHeader.h" | |||||
| #import "AICareComponentRingBleSDK_Version.h" | |||||
| #import "BM40BleProtocol.h" | |||||
| #import "DialogOTATool.h" | |||||
| #import "ELAILinkBleManager+SmartRing.h" | |||||
| #import "ELSmartRingBleHeader.h" | |||||
| #import "ELSmartRingBleParser.h" | |||||
| #import "ELSmartRingManager.h" | |||||
| FOUNDATION_EXPORT double AICareComponentRingBleSDKVersionNumber; | |||||
| FOUNDATION_EXPORT const unsigned char AICareComponentRingBleSDKVersionString[]; | |||||
| // | |||||
| // ELAILinkEncryptTool.h | |||||
| // AILinkBleSDK | |||||
| // | |||||
| // Created by LarryZhang on 2022/11/25. | |||||
| // | |||||
| #import <Foundation/Foundation.h> | |||||
| NS_ASSUME_NONNULL_BEGIN | |||||
| /// 普通加密握手数据 | |||||
| void AILinkEncrypt(uint8_t *p); | |||||
| /// License 加密握手数据 | |||||
| void AILinkEncryptWithCidVidPid(uint8_t *p, uint16_t cid, uint16_t vid, uint16_t pid); | |||||
| /// License Key | |||||
| void AILinkGenKeyWithCidVidPid(uint32_t *key, uint32_t cid, uint16_t vid, uint16_t pid); | |||||
| /// 自定义握手key功能方法 ***早期,即将废弃方法*** | |||||
| BOOL checkCidVidPid(uint16_t cid, uint16_t vid, uint16_t pid, NSString *secret) DEPRECATED_MSG_ATTRIBUTE("即将废弃方法"); | |||||
| @interface ELAILinkEncryptTool : NSObject | |||||
| @end | |||||
| NS_ASSUME_NONNULL_END |
| // | |||||
| // ELAILinkLicenseTool.h | |||||
| // AILinkBleSDK | |||||
| // | |||||
| // Created by LarryZhang on 2023/6/6. | |||||
| // | |||||
| #import <Foundation/Foundation.h> | |||||
| NS_ASSUME_NONNULL_BEGIN | |||||
| /// license 授权方式,独立握手 key, A7 不加密 | |||||
| BOOL checkLicense(uint32_t cid, uint16_t vid, uint16_t pid); | |||||
| @interface ELAILinkLicenseTool : NSObject | |||||
| + (void)setLicenseData:(NSArray <NSData *>*)licenseDataArray; | |||||
| @end | |||||
| NS_ASSUME_NONNULL_END |
| // | |||||
| // ELBleDisposeDataTool.h | |||||
| // Elink | |||||
| // | |||||
| // Created by iot_user on 2019/4/23. | |||||
| // Copyright © 2019 iot_iMac. All rights reserved. | |||||
| // | |||||
| #import <Foundation/Foundation.h> | |||||
| #import "ELSDKHeader.h" | |||||
| NS_ASSUME_NONNULL_BEGIN | |||||
| @interface ELBleDisposeDataTool : NSObject | |||||
| #pragma mark 校验和 | |||||
| +(BOOL)checksum:(NSData *)data; | |||||
| #pragma mark 广播设备校验和 | |||||
| +(BOOL)broadcastChecksum:(NSData *)data; | |||||
| #pragma mark ============ 解析A6数据 ============== | |||||
| /** | |||||
| 解析电池数据 | |||||
| @param data 原始数据 | |||||
| @return 电池充电状态和电量的结构体 | |||||
| */ | |||||
| +(struct ELBatteryStruct)analysisBattery:(NSData *)data; | |||||
| /** | |||||
| 解析CID、VID、PID | |||||
| @param data 原始数据 | |||||
| @return CID,VID,PID的结构体 | |||||
| */ | |||||
| +(struct ELDIDStruct)analysisDid:(NSData *)data; | |||||
| /** | |||||
| 解析模块时间 | |||||
| @param data 原始数据 | |||||
| @return yyyy-MM-dd HH:mm:ss | |||||
| */ | |||||
| +(NSString *)analysisBluetoothDate:(NSData *)data; | |||||
| /** | |||||
| 解析MCU软硬件版本号 | |||||
| @param data 原始数据 | |||||
| @return MCU软硬件版本号 | |||||
| */ | |||||
| +(NSString *)analysisMCUVersion:(NSData *)data; | |||||
| /** | |||||
| 解析BM模块软硬件版本号 | |||||
| @param data 原始数据 | |||||
| @return BM模块软硬件版本号 | |||||
| */ | |||||
| + (NSString *)analysisBMVersion:(NSData *)data; | |||||
| + (NSString *)analysisBMVersionPro:(NSData *)data; | |||||
| /** | |||||
| 解析MAC地址 | |||||
| @param data 原始数据 | |||||
| @return MAC地址 | |||||
| */ | |||||
| +(NSString *)analysisBluetoothMACAddrress:(NSData *)data; | |||||
| /** | |||||
| 解析模块状态 | |||||
| @param data 原始数据 | |||||
| @return 结构体 | |||||
| */ | |||||
| +(struct ELMCUStateStruct)analysisBluetoothConnectState:(NSData *)data; | |||||
| //重构 | |||||
| + (ELWMStateStruct)analysisWMState:(NSData *)data; | |||||
| /** | |||||
| 解析模块通信模式 | |||||
| @param data 原始数据 | |||||
| @return 模式 | |||||
| */ | |||||
| +(ELCommunicationModeType)analysisBluetoothCommunicationMode:(NSData *)data; | |||||
| /** | |||||
| 解析自动睡眠时间 | |||||
| @param data 原始数据 | |||||
| @return 结构体 | |||||
| */ | |||||
| +(struct ELAutoSleepTimeStruct)analysisBluetoothAutoSleepTime:(NSData *)data; | |||||
| /** | |||||
| 解析主从模式数据 | |||||
| @param data 原始数据 | |||||
| @return 模式 | |||||
| 0:从机模式 1:主机模式 | |||||
| */ | |||||
| +(int)analysisBluetoothMCUMode:(NSData *)data; | |||||
| /** | |||||
| 解析UUID | |||||
| @param data 原始数据 | |||||
| @return UUID 的结构体 | |||||
| */ | |||||
| +(struct ELUUIDStruct)analysisBluetoothUUID:(NSData *)data; | |||||
| /** | |||||
| 解析大小端序 | |||||
| @param data 原始数据 | |||||
| @return 大小端序 | |||||
| */ | |||||
| +(int)analysisBluetoothMACAddressType:(NSData *)data; | |||||
| /** | |||||
| 解析串口波特率 | |||||
| @param data 原始数据 | |||||
| @return 波特率 | |||||
| 0:9600 | |||||
| 1:19200 | |||||
| 2:38400 | |||||
| 3:57600 | |||||
| 4:115200 | |||||
| 5:921600 | |||||
| */ | |||||
| +(int)analysisBluetoothSerialPostBaudRate:(NSData *)data; | |||||
| /** | |||||
| 解析发射功率 | |||||
| @param data 原始数据 | |||||
| @return 发射功率:1~10 | |||||
| */ | |||||
| +(int)analysisBluetoothTransmittingPower:(NSData *)data; | |||||
| /** | |||||
| 解析蓝牙连接间隔 | |||||
| @param data 原始数据 | |||||
| @return 连接间隔时间的结构体 | |||||
| */ | |||||
| +(struct ELConnectIntervalStruct)analysisBluetoothConnectInterval:(NSData *)data; | |||||
| /** | |||||
| 解析蓝牙广播间隔时间 | |||||
| @param data 蓝牙发送的原始数据 | |||||
| @return 广播间隔 | |||||
| */ | |||||
| +(int)analysisBluetoothBroadcastInterval:(NSData *)data; | |||||
| /** | |||||
| 解析蓝牙名称 | |||||
| @param data 蓝牙发送的原始数据 | |||||
| @return 蓝牙名称 | |||||
| */ | |||||
| +(NSString *)analysisBluetoothName:(NSData *)data; | |||||
| /** | |||||
| 解析设备支持的体重数组 | |||||
| @param data 蓝牙发送的原始数据 | |||||
| @return 体重单位数组,内容为ELDeviceWeightUnit枚举 | |||||
| */ | |||||
| + (NSArray<NSNumber *> *)analysisBluetoothSupportWeightUnitArray:(NSData *)data; | |||||
| /** | |||||
| 解析设备支持的身高数组 | |||||
| @param data 蓝牙发送的原始数据 | |||||
| @return 身高单位数组,内容为ELDeviceHeightUnit枚举 | |||||
| */ | |||||
| + (NSArray<NSNumber *> *)analysisBluetoothSupportHeightUnitArray:(NSData *)data; | |||||
| /** | |||||
| 解析设备支持的温度数组 | |||||
| @param data 蓝牙发送的原始数据 | |||||
| @return 温度单位数组,内容为ELDeviceTemperatureUnit枚举 | |||||
| */ | |||||
| + (NSArray<NSNumber *> *)analysisBluetoothSupportTemperatureUnitArray:(NSData *)data; | |||||
| /** | |||||
| 解析设备支持的血压数组 | |||||
| */ | |||||
| + (NSArray<NSNumber *> *)analysisBluetoothSupportBloodPressureUnitArray:(NSData *)data; | |||||
| /** | |||||
| 解析设备支持的血压数组 | |||||
| @param data 蓝牙发送的原始数据 | |||||
| @return 血压单位数组,内容为ELDeviceTemperatureUnit枚举 | |||||
| */ | |||||
| + (NSArray<NSNumber *> *)analysisBluetoothSupportPressureUnitArray:(NSData *)data; | |||||
| /// 解析设备支持的血糖仪单位 | |||||
| /// @param data 蓝牙发送的原始数据 | |||||
| + (NSArray<NSNumber *> *)analysisBluetoothSupportBloodSugarUnitArray:(NSData *)data; | |||||
| /// 解析设备支持的体积单位 | |||||
| /// @param data 蓝牙发送的原始数据 | |||||
| + (NSArray<NSNumber *> *)analysisBluetoothSupportVolumUnitArray:(NSData *)data; | |||||
| /// 解析设备支持的营养秤单位 | |||||
| /// @param data 蓝牙发送的原始数据 | |||||
| + (NSArray<NSNumber *> *)analysisBluetoothSupportNutritionUnitArray:(NSData *)data; | |||||
| /** | |||||
| 解析蓝牙接收密钥的结果 | |||||
| @param data 原数据 | |||||
| @return YES:成功,NO失败 | |||||
| */ | |||||
| +(BOOL)analysisBluetoothReceiveKeyState:(NSData *)data; | |||||
| /** | |||||
| 解析设备基本信息 | |||||
| @param data 原数据 | |||||
| @return 设备基本信息 | |||||
| */ | |||||
| +(NSData *)analysisBluetoothReceiveBasicInfoData:(NSData *)data; | |||||
| @end | |||||
| NS_ASSUME_NONNULL_END |
| // | |||||
| // ELBleWifiDetailModel.h | |||||
| // Elink | |||||
| // | |||||
| // Created by iot_user on 2019/12/30. | |||||
| // Copyright © 2019 iot_iMac. All rights reserved. | |||||
| // | |||||
| #import <Foundation/Foundation.h> | |||||
| typedef NS_ENUM(NSUInteger, ELBleWifiSecureType) { | |||||
| ELBleWifiSecureTypeOpen = 0, | |||||
| ELBleWifiSecureTypeWEP = 1, | |||||
| ELBleWifiSecureTypeWPA_PSK = 2, | |||||
| ELBleWifiSecureTypeWPA2_PSK = 3, | |||||
| ELBleWifiSecureTypeWPA_WPA_2_PSK = 4, | |||||
| ELBleWifiSecureTypeWPA2_ENTERPRISE = 5, | |||||
| }; | |||||
| typedef NS_ENUM(NSUInteger, ELBleWifiUseState) { | |||||
| ELBleWifiUseStateUnknown = 0, //Strange wifi(陌生wifi) | |||||
| ELBleWifiUseStateSaved = 1, //Wifi with saved password(保存过的密码的wifi) | |||||
| ELBleWifiUseStateConnected = 2, //Currently connected wifi(目前连接着的wifi) | |||||
| }; | |||||
| NS_ASSUME_NONNULL_BEGIN | |||||
| @interface ELBleWifiDetailModel : NSObject<NSCopying> | |||||
| //wifi number(wifi编号) | |||||
| @property (nonatomic, assign) int wifiNumber; | |||||
| //wifi name(wifi 名字) | |||||
| @property (nonatomic, copy) NSString *wifiName; | |||||
| //wifi MAC address (little endian)(wifi MAC地址(小端序)) | |||||
| @property (nonatomic, copy) NSData *macData; | |||||
| //Signal strength(信号强度) | |||||
| @property (nonatomic, assign) int wifiRssi; | |||||
| //Security type(安全类型) | |||||
| @property (nonatomic, assign) ELBleWifiSecureType secureType; | |||||
| //wifi status(wifi状态) | |||||
| @property (nonatomic, assign) ELBleWifiUseState wifiState; | |||||
| @end | |||||
| NS_ASSUME_NONNULL_END |
| // | |||||
| // ELTLVModel.h | |||||
| // AILinkBleSDK | |||||
| // | |||||
| // Created by LarryZhang on 2022/9/6. | |||||
| // Copyright © 2022 IOT. All rights reserved. | |||||
| // | |||||
| #import <Foundation/Foundation.h> | |||||
| NS_ASSUME_NONNULL_BEGIN | |||||
| //***** type 1 Byte lengh 1 Byte | |||||
| @interface ELTLVModel : NSObject | |||||
| @property(nonatomic, assign) UInt8 type; //T | |||||
| @property(nonatomic, assign, readonly) UInt8 length; //L | |||||
| @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; | |||||
| @end | |||||
| @interface ELTLVModel (Tool) | |||||
| + (NSArray<ELTLVModel *> *)objectArrayWithData:(NSData * _Nonnull)payloadData; | |||||
| @end | |||||
| NS_ASSUME_NONNULL_END |
| // | |||||
| // 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 |
| // | |||||
| // 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; //简化版 | |||||
| //转换 HexString | |||||
| - (NSString *)elHexString; | |||||
| + (NSData *)elDataWithHexString:(NSString *)hexStr; | |||||
| @end | |||||
| NS_ASSUME_NONNULL_END |