26 changed files with 1213 additions and 2 deletions
@ -0,0 +1 @@ |
|||||
|
language = Objective-C |
@ -0,0 +1,52 @@ |
|||||
|
//
|
||||
|
// LeKeyFobService.h
|
||||
|
//
|
||||
|
//
|
||||
|
// Created by linktoplinktop on 2019/2/18.
|
||||
|
// Copyright © 2019 Linktop. All rights reserved.
|
||||
|
// Connected Bluetooth device operation
|
||||
|
|
||||
|
#import <Foundation/Foundation.h> |
||||
|
#import <CoreBluetooth/CoreBluetooth.h> |
||||
|
#import "SRDeviceInfo.h" |
||||
|
|
||||
|
|
||||
|
@interface SRBLeService : NSObject |
||||
|
|
||||
|
/* Querying Sensor */ |
||||
|
@property (readonly) CBPeripheral *peripheral; // Bluetooth Peripheral Object
|
||||
|
@property (strong, nonatomic)NSNumber *rssi; // rssi while scanning
|
||||
|
|
||||
|
@property (strong, nonatomic)NSString *advDataLocalName; // Bluetooth broadcast name
|
||||
|
@property (strong, nonatomic)NSString *macAddress; // Bluetooth mac address
|
||||
|
|
||||
|
@property(assign, nonatomic)DEV_COLOR deviceColor; // color
|
||||
|
@property(assign, nonatomic)int deviceSize; // size
|
||||
|
|
||||
|
@property(assign, nonatomic)MAIN_CHIP_TYPE mainChipType; // main chip
|
||||
|
@property(assign, nonatomic)NSUInteger deviceGeneration; // generation
|
||||
|
|
||||
|
@property(strong, nonatomic)NSNumber *needOemAuth; //need oem auth
|
||||
|
@property(strong, nonatomic)NSString *snString; |
||||
|
@property(strong, nonatomic)NSData *authSnData; |
||||
|
@property(strong, nonatomic)NSString * softWareVersion;// ring's firmware version
|
||||
|
|
||||
|
@property(assign, nonatomic)BOOL isBinded; // is binded
|
||||
|
@property(assign, nonatomic)NSInteger hrMeasureDurations; |
||||
|
@property(assign, nonatomic)BOOL isSupportSportMode; |
||||
|
@property(assign, nonatomic)BOOL isWaveDataOn; //Whether the real-time heart rate blood oxygen measurement waveform is reported
|
||||
|
//scanIsCharge:The data in the advertising packet tells the device whether it is charging.
|
||||
|
// scanBatteryLevel: The data in the broadcast packet informs the device of the power level
|
||||
|
@property(strong, nonatomic)NSNumber *scanIsCharge, *scanBatteryLevel; |
||||
|
|
||||
|
@property(strong, nonatomic)NSNumber *chargeType; // charging type
|
||||
|
@property(assign, nonatomic)BOOL isSupportEcg; |
||||
|
@property(assign, nonatomic)NSUInteger projectId; |
||||
|
|
||||
|
- (instancetype) initWithPeripheral:(CBPeripheral *)peripheral; |
||||
|
|
||||
|
/// create instance. Use when scanning externally
|
||||
|
/// - Parameter advertisementData: Bluetooth Broadcast Dictionary
|
||||
|
-(void)setAdvData:(NSDictionary *)advertisementData; |
||||
|
|
||||
|
@end |
@ -0,0 +1,47 @@ |
|||||
|
//
|
||||
|
// SRDeviceInfo.h
|
||||
|
// sr01sdkProject
|
||||
|
//
|
||||
|
// Created by Linktop on 2022/5/25.
|
||||
|
//
|
||||
|
|
||||
|
#import <Foundation/Foundation.h> |
||||
|
|
||||
|
NS_ASSUME_NONNULL_BEGIN |
||||
|
|
||||
|
typedef NS_ENUM(NSUInteger, DEV_COLOR) { |
||||
|
DEV_COLOR_DARK = 0, // color dark
|
||||
|
DEV_COLOR_SILVER = 1, // color silver
|
||||
|
DEV_COLOR_GOLD = 2, // color gold
|
||||
|
DEV_COLOR_ROSE_GOLD = 3, // rose gold
|
||||
|
DEV_COLOR_GOLD_MIX_SILVER = 4, //金/银混色(Gold and silver mixed)
|
||||
|
DEV_COLOR_PURPLE_MIX_SILVER = 5, //紫/银混色(Purple and silver mixed)
|
||||
|
DEV_COLOR_ROSEGOLD_MIX_SOLVER = 6, //玫瑰金/银混色(Rose gold and silver mixed)
|
||||
|
}; |
||||
|
|
||||
|
typedef NS_ENUM(NSInteger, MAIN_CHIP_TYPE) { |
||||
|
MAIN_CHIP_14531_00 = 0, |
||||
|
MAIN_CHIP_14531_01 = 1, |
||||
|
MAIN_CHIP_14592 = 2, // sr23
|
||||
|
|
||||
|
}; //ring's main chip type
|
||||
|
|
||||
|
typedef NS_ENUM(NSUInteger, CMD_EXECTE_ERROR_REASON) { |
||||
|
REASON_NONE = 0, |
||||
|
REASON_1, // 设备自动测量中
|
||||
|
REASON_2, // 设备在运动模式测量中
|
||||
|
REASON_3, // 设备app测量中
|
||||
|
REASON_4, // 参数错误
|
||||
|
}; |
||||
|
|
||||
|
@interface SRDeviceInfo : NSObject |
||||
|
@property(assign, nonatomic, readonly)DEV_COLOR color; // ring's color
|
||||
|
@property(assign, nonatomic, readonly)NSUInteger size; // ring's size
|
||||
|
|
||||
|
@property(strong, nonatomic, readonly)NSString *softWareVersion; // ring's Firmware version
|
||||
|
@property(strong, nonatomic, readonly)NSString *bleMacAddress; // ring's mac address
|
||||
|
|
||||
|
|
||||
|
@end |
||||
|
|
||||
|
NS_ASSUME_NONNULL_END |
@ -0,0 +1,22 @@ |
|||||
|
//
|
||||
|
// EcgParamObj.h
|
||||
|
// sr01sdkProject
|
||||
|
//
|
||||
|
// Created by Linktop on 2024/3/5.
|
||||
|
//
|
||||
|
|
||||
|
#import <Foundation/Foundation.h> |
||||
|
|
||||
|
NS_ASSUME_NONNULL_BEGIN |
||||
|
|
||||
|
@interface EcgParamObj : NSObject |
||||
|
|
||||
|
@property(assign, nonatomic)BOOL isRowWave; // 是否原始波形 YES=不过戒指算法的波形
|
||||
|
|
||||
|
+(EcgParamObj *)defaultParam; |
||||
|
|
||||
|
-(CGFloat)transWaveToVol:(CGFloat)wave; |
||||
|
|
||||
|
@end |
||||
|
|
||||
|
NS_ASSUME_NONNULL_END |
@ -0,0 +1,88 @@ |
|||||
|
//
|
||||
|
// SrEcgAlgorithmResults.h
|
||||
|
// sr01sdkProject
|
||||
|
//
|
||||
|
// Created by Linktop on 2024/3/5.
|
||||
|
//
|
||||
|
|
||||
|
#import <Foundation/Foundation.h> |
||||
|
|
||||
|
NS_ASSUME_NONNULL_BEGIN |
||||
|
|
||||
|
typedef NS_ENUM(NSUInteger, ECG_Arrhythmia) { |
||||
|
|
||||
|
//心律失常检查未完成,没有结果。The arrhythmia test is incomplete and has no results.
|
||||
|
Arrhythmia_NO_FINNISH = 0, |
||||
|
//心律失常检查完成,未发现异常事件。The arrhythmia test was completed and no abnormal events were found.
|
||||
|
Arrhythmia_NORMAL = 1, |
||||
|
// 心律失常检查完成,没有收集到足够好的心电图来做出任何决定.Arrhythmia workup was completed and no good enough ECG was collected to make any decisions.
|
||||
|
Arrhythmia_NOT_ENOUGH_DATA = 2, |
||||
|
//心律失常检查完成,检测到心动过缓。Arrhythmia test completed, bradycardia detected.
|
||||
|
Arrhythmia_Bradycardia = 3, |
||||
|
//心律失常检查完成,检测到心房颤动(AFib)。Arrhythmia workup was completed and atrial fibrillation (AFib) was detected.
|
||||
|
Arrhythmia_AFib = 4, |
||||
|
// 心动过速.Tachycardia
|
||||
|
Arrhythmia_Tachycardia = 5, |
||||
|
// 心律失常检查完成,有异常,但无法确认心动过缓、心房颤动、心动过速。The arrhythmia test was completed and there were abnormalities, but bradycardia, atrial fibrillation, and tachycardia could not be confirmed.
|
||||
|
Arrhythmia_Abnormal_unknowReason = 6, |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
typedef NS_ENUM(NSUInteger, ECG_Signal_Quality) { |
||||
|
ECG_SQ_NO_SIGNAL = 0, // The ECG signal is not present. That is, the user is not connected to the ECG device.
|
||||
|
|
||||
|
/*The user is connected to an ECG device, but the ECG signal quality is poor and the heartbeat cannot be determined. This may be due to excessive noise on the ECG signal. No ECG algorithm can operate at this level of signal quality.*/ |
||||
|
ECG_SQ_TOO_MUSH_NOISE_NO_HR = 1, |
||||
|
|
||||
|
/* This status indicates that the heartbeat can be determined in the ECG signal, but a large amount of noise is detected in the signal. In this kind of
|
||||
|
User authentication/identification is not possible at signal quality level.*/ |
||||
|
ECG_SQ_NOISE = 2, |
||||
|
|
||||
|
ECG_SQ_GOOD = 3, // The signal is very good
|
||||
|
}; |
||||
|
|
||||
|
typedef NS_ENUM(NSInteger, SrecgResProgressType) { |
||||
|
PRG_HEART_RATE = 1 << 0, // Heart rate(心率)
|
||||
|
PRG_HRV = 1 << 1, // HRV
|
||||
|
PRG_Arrhythmias = 1 << 2, // Arrhythmia test(心率失常检查)
|
||||
|
PRG_STRESS = 1 << 3, // Stress Index( 压力指数)
|
||||
|
PRG_Energy_Consumption = 1 << 4, //energy consumption( 能量消耗)
|
||||
|
}; |
||||
|
|
||||
|
/// ecg measurement results
|
||||
|
@interface SrEcgAlgorithmResults : NSObject |
||||
|
|
||||
|
@property(assign, nonatomic)int heartRate; // Heart rate 0-invalid, 1-heart rate lower than 40, 254-heart rate higher than 200
|
||||
|
@property(assign, nonatomic, readonly)ECG_Arrhythmia arrhythmia; // 心率检查结果.Heart rate check results
|
||||
|
@property(assign, nonatomic, readonly)ECG_Signal_Quality ecgSq; // 信号质量.Signal quality
|
||||
|
// 心电图信号振幅很低,请确保接触面清洁,然后重试。The ECG signal amplitude is very low, please make sure the contact surfaces are clean and try again.
|
||||
|
@property(assign, nonatomic, readonly)BOOL low_amplitude; |
||||
|
//心电图信号有明显的噪音,请确保设备没有握得太紧,然后重试。There is noticeable noise in the ECG signal, please make sure you are not holding the device too tightly and try again.
|
||||
|
@property(assign, nonatomic, readonly)BOOL significant_noise; |
||||
|
|
||||
|
//心电图信号似乎不稳定,请确保您保持静止,然后重试。The EKG signal seems unstable, make sure you remain still and try again.
|
||||
|
@property(assign, nonatomic, readonly)BOOL unstable_signal; |
||||
|
|
||||
|
//没有足够的数据,请确保遵循心电图记录指南,然后重试。Not enough data, please make sure to follow the ECG recording guidelines and try again.
|
||||
|
@property(assign, nonatomic, readonly)BOOL not_enough_data; |
||||
|
|
||||
|
@property(assign, nonatomic, readonly)uint16_t rmssd, sdnn; |
||||
|
|
||||
|
@property(assign, nonatomic, readonly)uint8_t stress; // 压力指数 0-100有效 0XFF表示无效.Pressure index 0-100 is valid, 0XFF means invalid
|
||||
|
|
||||
|
@property(assign, nonatomic, readonly)uint16_t bmr; // basal metabolic rate, Unit: Kcal/m(基础代谢率, 单位:卡每分钟)
|
||||
|
|
||||
|
@property(assign, nonatomic, readonly)uint16_t activeCal; // Active energy consumption, Unit: Kcal/m(有功能量消耗, 单位:卡每分钟)
|
||||
|
|
||||
|
@property(assign, nonatomic, readonly)BOOL present;// 如果用户连接到心电图设备上则为真,否则为假。True if the user is connected to an EKG device, false otherwise.
|
||||
|
|
||||
|
@property(assign, nonatomic, readonly)BOOL alive;// 如果检测到用户心跳则为真,否则为假。True if the user's heartbeat is detected, false otherwise.
|
||||
|
|
||||
|
@property(assign, nonatomic, readonly) int avgHeartrate;// heartrate in average
|
||||
|
|
||||
|
@property(assign, nonatomic, readonly) SrecgResProgressType progressType; |
||||
|
@property(assign, nonatomic, readonly) int progress; |
||||
|
|
||||
|
@end |
||||
|
|
||||
|
NS_ASSUME_NONNULL_END |
@ -0,0 +1,24 @@ |
|||||
|
//
|
||||
|
// SrEcgData.h
|
||||
|
// sr01sdkProject
|
||||
|
//
|
||||
|
// Created by Linktop on 2024/1/15.
|
||||
|
//
|
||||
|
|
||||
|
#import <Foundation/Foundation.h> |
||||
|
|
||||
|
NS_ASSUME_NONNULL_BEGIN |
||||
|
|
||||
|
typedef NS_ENUM(NSUInteger, SRECG_TYPE) { |
||||
|
SRECG_TYPE_ONLY_ECG, // 只有ecg数据.Only ecg data.
|
||||
|
SRECG_TYPE_ECG_PPG, // ecg 和 ppg混合. ecg and ppg mixed.
|
||||
|
}; |
||||
|
|
||||
|
@interface SrEcgData : NSObject |
||||
|
@property(assign, nonatomic)SRECG_TYPE type; |
||||
|
@property(strong, nonatomic)NSMutableArray<NSNumber *> *ecgArray;// 设备上报波形数据.Device reports waveform data
|
||||
|
@property(assign, nonatomic)BOOL isAlgorithData;// YES = Use device algorithm. NO = Raw waveform data.
|
||||
|
|
||||
|
@end |
||||
|
|
||||
|
NS_ASSUME_NONNULL_END |
@ -0,0 +1,397 @@ |
|||||
|
//
|
||||
|
// LTStethoscopeSDK.h
|
||||
|
// hc21SDK
|
||||
|
//
|
||||
|
// Created by lanzhongping on 2021/1/6.
|
||||
|
//
|
||||
|
|
||||
|
#import <Foundation/Foundation.h> |
||||
|
#import <CoreBluetooth/CoreBluetooth.h> |
||||
|
|
||||
|
#import "SRDeviceInfo.h" |
||||
|
#import "SDKConstant.h" |
||||
|
#import "SrEcgData.h" |
||||
|
#import "EcgParamObj.h" |
||||
|
#import "SrEcgAlgorithmResults.h" |
||||
|
|
||||
|
NS_ASSUME_NONNULL_BEGIN |
||||
|
|
||||
|
@class SRBLeService; |
||||
|
@class SRDeviceInfo; |
||||
|
|
||||
|
typedef enum { |
||||
|
// Value zero must not be used !! Notifications are sent when status changes.
|
||||
|
SROTAR_SRV_STARTED = 0x01, // Valid memory device has been configured by initiator. No sleep state while in this mode
|
||||
|
SROTAR_CMP_OK = 0x02, // SPOTA process completed successfully.
|
||||
|
SROTAR_SRV_EXIT = 0x03, // Forced exit of SROTAR service.
|
||||
|
SROTAR_CRC_ERR = 0x04, // Overall Patch Data CRC failed
|
||||
|
SROTAR_PATCH_LEN_ERR = 0x05, // Received patch Length not equal to PATCH_LEN characteristic value
|
||||
|
SROTAR_EXT_MEM_WRITE_ERR= 0x06, // External Mem Error (Writing to external device failed)
|
||||
|
SROTAR_INT_MEM_ERR = 0x07, // Internal Mem Error (not enough space for Patch)
|
||||
|
SROTAR_INVAL_MEM_TYPE = 0x08, // Invalid memory device
|
||||
|
SROTAR_APP_ERROR = 0x09, // Application error
|
||||
|
|
||||
|
// SUOTAR application specific error codes
|
||||
|
SROTAR_IMG_STARTED = 0x10, // SPOTA started for downloading image (SUOTA application)
|
||||
|
SROTAR_INVAL_IMG_BANK = 0x11, // Invalid image bank
|
||||
|
SROTAR_INVAL_IMG_HDR = 0x12, // Invalid image header
|
||||
|
SROTAR_INVAL_IMG_SIZE = 0x13, // Invalid image size
|
||||
|
SROTAR_INVAL_PRODUCT_HDR= 0x14, // Invalid product header
|
||||
|
SROTAR_SAME_IMG_ERR = 0x15, // Same Image Error
|
||||
|
SROTAR_EXT_MEM_READ_ERR = 0x16, // Failed to read from external memory device
|
||||
|
|
||||
|
} SROTA_STATUS_VALUES; |
||||
|
|
||||
|
|
||||
|
typedef NS_ENUM(UInt8, EXCUTED_CMD) { |
||||
|
EXCUTED_CMD_SET_SPORT_MODE = 0x01, // Sport mode settings. abandoned
|
||||
|
EXCUTED_CMD_SET_HR_TEMP_MEASURE = 0x02, // Temperature Heart rate measurement settings. abandoned
|
||||
|
EXCUTED_CMD_SET_OXYGEN_MEASURE = 0x03, // Blood Oximetry Settings. abandoned
|
||||
|
EXCUTED_CMD_SYNC_TIME = 0x04, // time synchronization
|
||||
|
EXCUTED_CMD_GET_OXYGEN_HRV = 0x05, // Real-time acquisition of heart rate and blood oxygen
|
||||
|
EXCUTED_CMD_GET_STEPS = 0x06, // Get step count in real time
|
||||
|
EXCUTED_CMD_GET_TEMPERATURE = 0x07, // Get finger temperature in real time
|
||||
|
EXCUTED_CMD_SHUT_DOWN = 0X08, // shutdown
|
||||
|
EXCUTED_CMD_REBOOT = 0X09, // reboot
|
||||
|
|
||||
|
EXCUTED_CMD_FACTORY_RESET = 0x0a, // restore factory settings
|
||||
|
|
||||
|
EXCUTED_CMD_HIS_COUNT = 0x0c, // Report number of historical data
|
||||
|
EXCUTED_CMD_HIS_DATA = 0x0d, // Report historical data
|
||||
|
EXCUTED_CMD_CLEAR_HIS_DATA = 0x0e, // Clear the historical data cache
|
||||
|
EXCUTED_CMD_DEVICE_INFO = 0x0f, // Get device information
|
||||
|
EXCUTED_CMD_SN = 0x10, // serial number
|
||||
|
EXCUTED_CMD_BATTERY = 0X11, // battery power
|
||||
|
EXCUTED_CMD_SPORT_MODE = 0x20, // sport Mode
|
||||
|
EXCUTED_CMD_FUNCTIN_SWITCH = 0x31, // Device function switch
|
||||
|
};// 下发命令字
|
||||
|
|
||||
|
typedef NS_ENUM(NSUInteger, REALTIME_MEASURE_TYPE) { |
||||
|
REALTIME_MEASURE_HR = 0X00, // Measure heart rate in real time
|
||||
|
REALTIME_MEASURE_SPO = 0X01, // Real-time measurement of blood oxygen
|
||||
|
}; |
||||
|
|
||||
|
typedef NS_ENUM(NSInteger, FUNCTION_ERROR) { |
||||
|
FUNCTION_ERR_NONE = 0, // No errors
|
||||
|
FUNCTION_ERR_BLE_NOT_CONNECT, // Bluetooth not connected
|
||||
|
FUNCTION_ERR_BLE_NOTREADY_READWRITE,// Ring is not ready for reading and writing
|
||||
|
FUNCTION_ERR_OEMAUTH_NOTFINISH, // OEM certification is not completed
|
||||
|
}; |
||||
|
|
||||
|
|
||||
|
/* about ble device scan and connect */ |
||||
|
@protocol SRBleScanProtocal <NSObject> |
||||
|
|
||||
|
@optional |
||||
|
/// scan device list fresh
|
||||
|
/// @param perphelArray scaned devices
|
||||
|
-(void)srScanDeviceDidRefresh:(NSArray<SRBLeService *> *)perphelArray; |
||||
|
|
||||
|
/// Mobile phone Bluetooth status change notification. Only used when using sdk internal connections.
|
||||
|
/// @param state CBManagerState
|
||||
|
- (void)srBlePowerStateChange:(CBManagerState)state; |
||||
|
|
||||
|
/// Notify the device that Bluetooth has been connected.
|
||||
|
/// @param service Ring Peripherals
|
||||
|
- (void)srBleDidConnectPeripheral:(SRBLeService*)service; |
||||
|
|
||||
|
/// Notify the device that Bluetooth has been disconnected.
|
||||
|
/// @param service Ring Peripherals
|
||||
|
- (void)srBleDidDisconnectPeripheral:(SRBLeService*)service; |
||||
|
|
||||
|
@end |
||||
|
|
||||
|
|
||||
|
/* about ble data translate */ |
||||
|
@protocol SRBleDataProtocal <NSObject> |
||||
|
|
||||
|
/// perphel is ready for read write
|
||||
|
/// @param service current connect devices
|
||||
|
- (void)srBleDeviceDidReadyForReadAndWrite:(SRBLeService*)service; |
||||
|
|
||||
|
/// Call back for realtime spo2 measurement
|
||||
|
/// @param spo -- spo2
|
||||
|
- (void)srBleRealtimeSpo:(NSNumber *)spo; |
||||
|
|
||||
|
/// Call back for realtime heart rate measurement
|
||||
|
/// @param hr -- heart rate
|
||||
|
- (void)srBleRealtimeHeartRate:(NSNumber *)hr; |
||||
|
|
||||
|
/// Call back for realtime HRV measurement
|
||||
|
/// @param hrv -- HRV
|
||||
|
- (void)srBleRealtimeHrv:(NSNumber *)hrv; |
||||
|
|
||||
|
/// call back device's battery level and charging state
|
||||
|
/// @param batteryLevel battery level
|
||||
|
/// @param isCharging YES = device is charging
|
||||
|
- (void)srBleDeviceBatteryLevel:(NSUInteger)batteryLevel IsCharging:(BOOL)isCharging; |
||||
|
|
||||
|
/// call back value of device's sn code
|
||||
|
/// @param sn sn code
|
||||
|
- (void)srBleSN:(NSString *)sn; |
||||
|
|
||||
|
/// Bluetooth report device information
|
||||
|
/// @param devInfo device information
|
||||
|
- (void)srBleDeviceInfo:(SRDeviceInfo *)devInfo; |
||||
|
|
||||
|
/// call back value of history data
|
||||
|
/// @param currentCount current received data index
|
||||
|
/// @param isComplete YES = translate finish
|
||||
|
- (void)srBleHistorySr03DataWithCurrentCount:(NSInteger)currentCount IsComplete:(BOOL)isComplete DEPRECATED_MSG_ATTRIBUTE("deprecate from V1.0.7, use srBleCmdExcute:Succ:Reason: instead"); |
||||
|
|
||||
|
/// call back realtime steps
|
||||
|
/// @param steps steps
|
||||
|
- (void)srBleDeviceRealtimeSteps:(NSNumber *)steps DEPRECATED_MSG_ATTRIBUTE("deprecate from V1.1.1"); |
||||
|
|
||||
|
/// call back realtime skin temperature
|
||||
|
/// @param temperature skin temperature Unit(℃)
|
||||
|
- (void)srBleDeviceRealtimeTemperature:(NSNumber *)temperature; |
||||
|
|
||||
|
|
||||
|
/// call back for excute result of sended command
|
||||
|
/// @param cmd sended cmd
|
||||
|
/// @param isSucc YES = success
|
||||
|
- (void)srBleCmdExcute:(EXCUTED_CMD)cmd Succ:(BOOL)isSucc DEPRECATED_MSG_ATTRIBUTE("deprecate from V1.0.7, use srBleCmdExcute:Succ:Reason: instead"); |
||||
|
|
||||
|
/// call back for excute result of sended command
|
||||
|
/// @param cmd sended cmd
|
||||
|
/// @param isSucc YES = success
|
||||
|
- (void)srBleCmdExcute:(EXCUTED_CMD)cmd Succ:(BOOL)isSucc Reason:(CMD_EXECTE_ERROR_REASON)reason; |
||||
|
|
||||
|
/// Return historical data entries
|
||||
|
/// @param count The amount of historical data saved by the device
|
||||
|
- (void)srBleHistoryDataCount:(NSInteger)count DEPRECATED_MSG_ATTRIBUTE("deprecate from V1.0.7, use srBleHistoryDataProgress:IsComplete: instead"); |
||||
|
|
||||
|
/// Historical data synchronization progress
|
||||
|
/// @param percent range (0.0 - 1.0)
|
||||
|
/// @param isComplete YES = complete
|
||||
|
- (void)srBleHistoryDataProgress:(float)percent IsComplete:(BOOL)isComplete; |
||||
|
|
||||
|
/// gain device's cache data time out
|
||||
|
- (void)srBleHistoryDataTimeout; |
||||
|
|
||||
|
/// Report device binding status
|
||||
|
/// @param isBinded YES = device activated. NO = device not activated
|
||||
|
- (void)srBleIsbinded:(BOOL)isBinded; |
||||
|
|
||||
|
/// Call back for OEM auth result
|
||||
|
/// - Parameter authSucceddful: YES = auth successfully NO = please check company name.
|
||||
|
-(void)srBleOEMAuthResult:(BOOL)authSucceddful; |
||||
|
|
||||
|
/// Exception callback when issuing Bluetooth commands
|
||||
|
/// - Parameter error:error code
|
||||
|
-(void)srBleFunctionErrorCallBack:(FUNCTION_ERROR)error MehthodName:(NSString *)methodNm; |
||||
|
|
||||
|
|
||||
|
@optional |
||||
|
|
||||
|
/// Notify that the sleep calculation is complete
|
||||
|
- (void)calculatSleepFinish; |
||||
|
|
||||
|
/// call back to report device's measure duration
|
||||
|
/// - Parameter seconds: measuration druration
|
||||
|
-(void)srBleMeasureDuration:(NSInteger)seconds; |
||||
|
|
||||
|
/// Report real-time measurement infrared data
|
||||
|
/// - Parameter irData: infrared data
|
||||
|
-(void)srBleIrData:(uint16_t)irData; |
||||
|
|
||||
|
/// Report real-time measured red light data
|
||||
|
/// - Parameter redData: red light data
|
||||
|
-(void)srBleRedData:(uint16_t)redData; |
||||
|
|
||||
|
/// Report the blood oxygen measurement interval value and whether blood oxygen measurement is turned on
|
||||
|
/// - Parameters:
|
||||
|
/// - minuteInterval: Blood oxygen measurement interval (unit: minutes)
|
||||
|
/// - on: YES = Blood oxygen measurement is on.
|
||||
|
-(void)srBleOxygenMeasureInterval:(uint16_t)minuteInterval OxygenSwitch:(BOOL)on; |
||||
|
|
||||
|
// ecg+ ppg混合
|
||||
|
-(void)srBleEcgAndPPgWave:(SrEcgData *)ecgPpgObj; |
||||
|
|
||||
|
/// Callback ecg waveform data
|
||||
|
/// - Parameters ecgObj: ecg waveform data object
|
||||
|
-(void)srBleEcgWave:(SrEcgData *)ecgObj; |
||||
|
|
||||
|
/// ecg algorithm results
|
||||
|
/// - Parameter ecgResult: algorithm results
|
||||
|
-(void)srBleEcgAlgorithmResult:(SrEcgAlgorithmResults *)ecgResult; |
||||
|
|
||||
|
/// Detect whether the finger is completely in contact with the ring
|
||||
|
/// - Parameter leadOn: yes = full contact
|
||||
|
-(void)srBleEcgEcgLeadOn:(BOOL)leadOn; |
||||
|
|
||||
|
@end |
||||
|
|
||||
|
|
||||
|
@protocol SROTAProtocal <NSObject> |
||||
|
|
||||
|
/// ota error callback
|
||||
|
/// @param errorCode error code
|
||||
|
-(void)srOtaError:(uint8_t)errorCode; |
||||
|
|
||||
|
/// OTA completed
|
||||
|
/// @param isSuccessful YES = successful
|
||||
|
-(void)srOtaFinish:(BOOL)isSuccessful; |
||||
|
|
||||
|
/// OTA upgrade progress
|
||||
|
/// @param progress percentage. Range (0-1)
|
||||
|
-(void)srOtaUpdateProgress:(float)progress; |
||||
|
|
||||
|
@end |
||||
|
|
||||
|
|
||||
|
|
||||
|
@interface LTSRingSDK : NSObject |
||||
|
|
||||
|
@property(weak, nonatomic)id<SRBleScanProtocal> blescanDelegate; // Bluetooth scan callback object
|
||||
|
@property(weak, nonatomic)id<SRBleDataProtocal> bleDataDelegate; // Bluetooth data callback object
|
||||
|
@property(weak, nonatomic)id<SROTAProtocal> bleOtaDelegate; // ota proxy callback object
|
||||
|
|
||||
|
@property(assign, nonatomic) BOOL debugCollect;// If it is YES, the SDK will also collect all historical data, regardless of whether it is worn or not. Used for debugging
|
||||
|
|
||||
|
|
||||
|
+(instancetype)instance; |
||||
|
|
||||
|
/// Register sdk. Must be called first.
|
||||
|
/// - Parameter cp: company name . defalt is Linktop
|
||||
|
-(void)registWithCompany:(NSString * _Nullable )cp; |
||||
|
|
||||
|
/// Set the SDK's lower filter limit for heart rate data.If this interface is not called, the default lower limit is 50.You only need to call this method once after calling registWithCompany to take effect. Available since 1.2.0
|
||||
|
/// - Parameter hrLimitLow: Lower limit value range [0-200]
|
||||
|
-(void)setHeartrateFilterLowerLimit:(NSUInteger)hrLimitLow; |
||||
|
|
||||
|
// Get the SDK's lower filter limit for heart rate data. Available since 1.2.0
|
||||
|
-(NSUInteger)heartrateFilterLowerLimit; |
||||
|
|
||||
|
/// Notify the sdk of internally connected or disconnected devices
|
||||
|
/// @param peripheralService SRBLeService instance
|
||||
|
-(void)setCurrentPeripheralService:(SRBLeService* _Nullable)peripheralService; |
||||
|
|
||||
|
/// iOS ble state
|
||||
|
/// @return CBManagerState
|
||||
|
- (CBManagerState)bleCenterManagerState; |
||||
|
|
||||
|
/// Start Bluetooth scanning for peripherals inside the sdk.
|
||||
|
-(void)startBleScan; |
||||
|
|
||||
|
/// Stop Bluetooth scanning for peripherals inside the sdk.
|
||||
|
-(void)stopBleScan; |
||||
|
|
||||
|
/// Use sdk internal bluetooth management mechanism to connect devices
|
||||
|
-(void)connectDevice:(SRBLeService *)device; |
||||
|
|
||||
|
/// Disconnect the Bluetooth device. Only used when using sdk internal bluetooth scanning.
|
||||
|
-(void)disconnectCurrentService; |
||||
|
|
||||
|
// current connected ring
|
||||
|
-(SRBLeService *)currentDevice; |
||||
|
|
||||
|
/// Get sdk version
|
||||
|
-(NSString *)functionGetSdkVersion; |
||||
|
|
||||
|
/// send cmd to power off device
|
||||
|
-(void)functionShutDownDevice; |
||||
|
|
||||
|
/// send cmd to reboot device
|
||||
|
-(void)functionRebootDevice; |
||||
|
|
||||
|
/// get device's battery
|
||||
|
-(void)functionGetDeviceBattery; |
||||
|
|
||||
|
/// device reset to factory status
|
||||
|
-(void)functionDeviceReset; |
||||
|
|
||||
|
/// get device's SN code
|
||||
|
-(void)functionGetDeviceSN; |
||||
|
/// get device's infomation
|
||||
|
-(void)functionGetDeviceInfo; |
||||
|
|
||||
|
/// get device's cache history data
|
||||
|
/// retrun YES = cmd send successful retrun NO = the last history data process is translating
|
||||
|
-(BOOL)functionGetHistoryData; |
||||
|
|
||||
|
/// clear device's history data cache
|
||||
|
-(void)functionClearDeviceHistoryCache; |
||||
|
|
||||
|
|
||||
|
/// Device activation status settings
|
||||
|
/// @param bind YES = activation device NO = deactivate device
|
||||
|
-(void)functionSetBindeDevice:(BOOL)bind; |
||||
|
|
||||
|
/// get heart rate or spo2 data by realtime measurement
|
||||
|
/// @param type measurement mode
|
||||
|
/// @param isStart NO=off yes=on
|
||||
|
-(void)functionOxygenOrHeartRate:(REALTIME_MEASURE_TYPE)type IsOpen:(BOOL)isStart; |
||||
|
|
||||
|
/// get skin temperature
|
||||
|
-(void)functionGetTemperatureOnce; |
||||
|
|
||||
|
/// get steps once from ring by realtime measurement
|
||||
|
-(void)functionGetStepsOnce DEPRECATED_MSG_ATTRIBUTE("deprecate from V1.1.1"); |
||||
|
|
||||
|
|
||||
|
/// Get the duration of each measurement that the device has set
|
||||
|
-(void)functionGetDeviceMeasureDuration; |
||||
|
|
||||
|
|
||||
|
/// Set the duration of each measurement of the device
|
||||
|
/// - Parameter duration: duration of each measurement, uint:second
|
||||
|
-(void)functionSetDeviceMeasureDuration:(NSInteger)duration; |
||||
|
|
||||
|
/// Set the original waveform reporting switch in real-time measurement
|
||||
|
/// @param isON YES = ON
|
||||
|
-(void)functionSetRealmeasureWaveSwitch:(BOOL)isON; |
||||
|
|
||||
|
/// blood oxygen measuring setting
|
||||
|
/// @param startHor start hour, range in [0 23]
|
||||
|
/// @param startMin start minute, range in [0 59]
|
||||
|
/// @param startSecond start second, range in [0 59]
|
||||
|
/// @param endHor end hour, range in [0 23]
|
||||
|
/// @param endMin end minute, range in [0 59]
|
||||
|
/// @param endSec end second, range in [0 59]
|
||||
|
/// @param interval uint:minute
|
||||
|
/// @param isOn switch YES = turn on
|
||||
|
-(BOOL)functionSettingOxygenMeasure:(NSUInteger)startHor StartMin:(NSUInteger)startMin StartSec:(NSUInteger)startSecond Endhor:(NSUInteger)endHor EndMin:(NSUInteger)endMin EndSec:(NSUInteger)endSec Interval:(NSUInteger)interval IsOn:(BOOL)isOn; |
||||
|
|
||||
|
|
||||
|
/// ecg measurement on and off
|
||||
|
/// - Parameter on: YES= Turn on , NO = Turn off
|
||||
|
/// - Parameter paramObj : Parameters required for measurement
|
||||
|
/// - Parameter isFilterWave: YES= Use device ecg algorithm
|
||||
|
-(BOOL)functionECGMeasure:(BOOL)on Param:(EcgParamObj * _Nullable)paramObj DispSrc:(BOOL)isFilterWave; |
||||
|
|
||||
|
-(EcgParamObj *)ecgParamObj; |
||||
|
|
||||
|
/** About OTA **/ |
||||
|
|
||||
|
/// Start ota to upgrade the ring firmware
|
||||
|
/// - Parameter fileUrl: Device firmware image
|
||||
|
-(void)functionStartOta:(NSURL *)fileUrl; |
||||
|
|
||||
|
/** About OTA **/ |
||||
|
|
||||
|
/* sprot mode */ |
||||
|
/// Turn on sport mode
|
||||
|
/// @param durationMinutes Duration Unit: Minute Range (5min - 180min)
|
||||
|
/// @param valueInterval Device value interval, unit - second
|
||||
|
-(void)functionStartSportMode:(uint16_t)durationMinutes ValueInterval:(uint16_t)valueInterval DEPRECATED_MSG_ATTRIBUTE("deprecate from V1.1.1, use functionStartSportMode: ValueInterval: WorkType: instead"); |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// Turn on sport mode
|
||||
|
/// @param durationMinutes Duration Unit: Minute Range (5min - 180min)
|
||||
|
/// @param valueInterval Device value interval, unit - second
|
||||
|
/// @param wkType workout type
|
||||
|
-(void)functionStartSportMode:(uint16_t)durationMinutes ValueInterval:(uint16_t)valueInterval WorkType:(WORKOUT_TYPE)wkType; |
||||
|
|
||||
|
/// Turn off sport mode manually
|
||||
|
-(void)functionShutdownSportMode; |
||||
|
|
||||
|
|
||||
|
- (instancetype)init NS_UNAVAILABLE; |
||||
|
+ (instancetype)new NS_UNAVAILABLE; |
||||
|
|
||||
|
@end |
||||
|
|
||||
|
NS_ASSUME_NONNULL_END |
@ -0,0 +1,17 @@ |
|||||
|
//
|
||||
|
// SDKConstant.h
|
||||
|
// sr01sdkProject
|
||||
|
//
|
||||
|
// Created by Linktop on 2023/12/5.
|
||||
|
//
|
||||
|
|
||||
|
#ifndef SDKConstant_h |
||||
|
#define SDKConstant_h |
||||
|
|
||||
|
|
||||
|
typedef NS_ENUM(NSUInteger, WORKOUT_TYPE) { |
||||
|
WORKOUT_TYPE_OTHER = 0, |
||||
|
WORKOUT_TYPE_RUNNING = 1, |
||||
|
}; |
||||
|
|
||||
|
#endif /* SDKConstant_h */ |
@ -0,0 +1,82 @@ |
|||||
|
//
|
||||
|
// DBDevices.h
|
||||
|
// CareRingApp
|
||||
|
//
|
||||
|
// Created by Linktop on 2022/6/7.
|
||||
|
// 绑定设备表
|
||||
|
|
||||
|
#import <Foundation/Foundation.h> |
||||
|
|
||||
|
#import "SRDeviceInfo.h" |
||||
|
NS_ASSUME_NONNULL_BEGIN |
||||
|
|
||||
|
@class DeviceOtherInfo; |
||||
|
|
||||
|
|
||||
|
typedef NS_ENUM(NSInteger, DBDEVICE_CHARGE_TYPE) { |
||||
|
CHARGE_UNKNOW = -1, // Charging type not obtained
|
||||
|
CHARGE_MA = 0, // Magnetic charging
|
||||
|
CHARGE_WILESS = 1, // Wireless charging
|
||||
|
CHARGE_NFC = 2, // NFC charging
|
||||
|
}; |
||||
|
|
||||
|
typedef NS_ENUM(NSUInteger, RING_PROJECT_ID) { |
||||
|
PROJ_NOT_SUPPORT = 0, //Older device versions do not support this parameter
|
||||
|
PROJ_SR03 = 0x10, |
||||
|
PROJ_SRO9W = 0x20 , |
||||
|
PROJ_SRO9N = 0x21 , |
||||
|
PROJ_SR01A = 0x22 , |
||||
|
PROJ_SR23_NFC = 0x30 , |
||||
|
PROJ_SR26 = 0x40 , |
||||
|
}; |
||||
|
|
||||
|
@interface DBDevices : NSObject |
||||
|
@property(assign, nonatomic)NSNumber *cId; // unique index
|
||||
|
@property(strong, nonatomic)NSString *macAddress; // Bluetooth peripheral mac address
|
||||
|
@property(strong, nonatomic)DeviceOtherInfo *otherInfo; // Other information about the device
|
||||
|
|
||||
|
|
||||
|
/// Query all DBDevices instances saved locally
|
||||
|
/// - Parameter cmpBlk: return result
|
||||
|
+(void)queryAllByCpmplete:(void(^)(NSMutableArray<DBDevices *> *results))cmpBlk; |
||||
|
|
||||
|
|
||||
|
/// Save a new binded device record locally
|
||||
|
/// - Parameter complete: return result
|
||||
|
-(void)insert:(void(^)(BOOL succ))complete; |
||||
|
|
||||
|
|
||||
|
/// Update other information of the device saved locally
|
||||
|
/// - Parameter complete: return result
|
||||
|
-(void)updateOtherInfo:(void(^)(BOOL succ))complete; |
||||
|
|
||||
|
|
||||
|
/// delete binded device,All data associated with the mac address of this device will
|
||||
|
/// be cleared.
|
||||
|
/// - Parameter cmpBlk: call back
|
||||
|
-(void)deleteFromTable:(void (^)(void))cmpBlk; |
||||
|
|
||||
|
/// Select ota parameters
|
||||
|
/// - Parameter blk: call back. cat:Used to query firmware package information.If it is nil, an error has occurred.
|
||||
|
-(void)chooseOTAugument:(void(^)(NSString * _Nullable cat))blk; |
||||
|
|
||||
|
@end |
||||
|
|
||||
|
@interface DeviceOtherInfo :NSObject |
||||
|
|
||||
|
@property(assign, nonatomic)DEV_COLOR color; // ring's color
|
||||
|
@property(assign, nonatomic)NSInteger size; // ring's size
|
||||
|
@property(strong, nonatomic)NSString *sn, *fireWareVersion;// sn=serial number, fireWareVersion=Device firmware version number
|
||||
|
@property(assign, nonatomic)MAIN_CHIP_TYPE mainChipType; // 主芯片型号
|
||||
|
@property(assign, nonatomic)NSUInteger deviceGeneration; // 迭代版本
|
||||
|
@property(assign, nonatomic)BOOL isSupportSportMode; |
||||
|
@property(assign, nonatomic)DBDEVICE_CHARGE_TYPE chargeType; |
||||
|
@property(assign, nonatomic)BOOL isSupportEcg; |
||||
|
@property(assign, nonatomic)RING_PROJECT_ID projectId;// Distinguish the model of the ring
|
||||
|
|
||||
|
/// Convert to a.b.c format
|
||||
|
-(NSString *)transFirmVersionToRemoteType; |
||||
|
|
||||
|
@end |
||||
|
|
||||
|
NS_ASSUME_NONNULL_END |
@ -0,0 +1,36 @@ |
|||||
|
//
|
||||
|
// DBHeartRate.h
|
||||
|
// CareRingApp
|
||||
|
//
|
||||
|
// Created by Linktop on 2022/6/7.
|
||||
|
//
|
||||
|
|
||||
|
#import <Foundation/Foundation.h> |
||||
|
#import "DBValueSuper.h" |
||||
|
|
||||
|
NS_ASSUME_NONNULL_BEGIN |
||||
|
|
||||
|
@interface DBHeartRate : DBValueSuper |
||||
|
|
||||
|
|
||||
|
/// Get the heart rate data reported by the device
|
||||
|
/// - Parameters:
|
||||
|
/// - macAddress: device mac address
|
||||
|
/// - beginDate: start of time range
|
||||
|
/// - endDate: end of time range
|
||||
|
/// - isDesc: YES = reverse chronological order , NO=chronologically ascending
|
||||
|
/// - cmpBlk: return result. maxHr -- Returns the largest value in the list,
|
||||
|
/// minHr -- Returns the smallest value in the list,
|
||||
|
/// avgHr -- Returns the average of the data in the list
|
||||
|
+(void)queryBy:(NSString * _Nonnull)macAddress |
||||
|
Begin:(NSDate *)beginDate |
||||
|
End:(NSDate *)endDate |
||||
|
OrderBeTimeDesc:(BOOL)isDesc |
||||
|
Cpmplete:(void(^)(NSMutableArray<DBHeartRate *> *results, |
||||
|
NSNumber *maxHr, NSNumber *minHr, |
||||
|
NSNumber *avgHr))cmpBlk; |
||||
|
|
||||
|
|
||||
|
@end |
||||
|
|
||||
|
NS_ASSUME_NONNULL_END |
@ -0,0 +1,52 @@ |
|||||
|
//
|
||||
|
// DBHistoryDataSr03.h
|
||||
|
// CareRingApp
|
||||
|
//
|
||||
|
// Created by Linktop on 2022/8/15.
|
||||
|
//
|
||||
|
|
||||
|
#import <Foundation/Foundation.h> |
||||
|
|
||||
|
|
||||
|
NS_ASSUME_NONNULL_BEGIN |
||||
|
@class FMDatabase; |
||||
|
@class DBSleepData; |
||||
|
|
||||
|
@interface DBHistoryDataSr03 : NSObject |
||||
|
|
||||
|
|
||||
|
/// Query resting heart rate
|
||||
|
/// - Parameters:
|
||||
|
/// - macAdres: device mac address
|
||||
|
/// - date: The date you want to query
|
||||
|
/// - cmpBlk: return result. restHr -- 24-hour resting heart rate for the day of the incoming date
|
||||
|
+(void)queryueryRestHrBymacAdres:(NSString *)macAdres Date:(NSDate *)date CMP:(void(^)(NSNumber *restHr ))cmpBlk; |
||||
|
|
||||
|
/// Query resting heart rate with sleep object
|
||||
|
/// - Parameters:
|
||||
|
/// - sleepObj: sleep object
|
||||
|
/// - cmpBlk: return result. restHr -- lowest heart rate during sleep
|
||||
|
+(void)queryueryRestHrBySleepObj:(DBSleepData *)sleepObj CMP:(void(^)(NSNumber *restHr ))cmpBlk; |
||||
|
|
||||
|
/// Query the measurement data of the sport mode.
|
||||
|
/// - Parameters:
|
||||
|
/// - macAddress: device mac address
|
||||
|
/// - beginDate: start of time
|
||||
|
/// - endDate: end of time
|
||||
|
/// - isDesc: YES= output in reverse chronological order
|
||||
|
/// - cmpBlk: return result.
|
||||
|
+(void)queryForSportBy:(NSString * _Nonnull)macAddress Begin:(NSDate *)beginDate End:(NSDate *)endDate OrderBeTimeDesc:(BOOL)isDesc Cpmplete:(void(^)(NSMutableArray<NSDictionary *> *results))cmpBlk; |
||||
|
|
||||
|
|
||||
|
/// Query the device power history list
|
||||
|
/// - Parameters:
|
||||
|
/// - macAdres: mac address
|
||||
|
/// - beginDate: start of time
|
||||
|
/// - endDate: end of time
|
||||
|
/// - isDesc: Output results in reverse chronological order
|
||||
|
/// - cmpBlk: return result. structure of results: @{@"time":(NSInteger), @"macAdres":NSString, @"battery":int }
|
||||
|
+(void)queryBatteryList:(NSString * _Nonnull)macAdres Begin:(NSDate *)beginDate End:(NSDate *)endDate OrderBeTimeDesc:(BOOL)isDesc Cpmplete:(void(^)(NSMutableArray<NSDictionary *> *results))cmpBlk; |
||||
|
|
||||
|
@end |
||||
|
|
||||
|
NS_ASSUME_NONNULL_END |
@ -0,0 +1,42 @@ |
|||||
|
//
|
||||
|
// DBHrv.h
|
||||
|
// CareRingApp
|
||||
|
//
|
||||
|
// Created by Linktop on 2022/6/7.
|
||||
|
//
|
||||
|
|
||||
|
#import <Foundation/Foundation.h> |
||||
|
#import "DBValueSuper.h" |
||||
|
NS_ASSUME_NONNULL_BEGIN |
||||
|
|
||||
|
@interface DBHrv : DBValueSuper |
||||
|
|
||||
|
|
||||
|
/// Get hrv average over time range
|
||||
|
/// - Parameters:
|
||||
|
/// - macAddress: device mac address
|
||||
|
/// - beginDate: start of time range
|
||||
|
/// - endDate: end of time range
|
||||
|
/// - cmpBlk: return result. average -- average value
|
||||
|
/// maxTime -- Last data in ascending time order
|
||||
|
/// minTime -- First data in ascending order by time
|
||||
|
+(void)queryAverage:(NSString * _Nonnull)macAddress Begin:(NSDate *)beginDate End:(NSDate *)endDate Cpmplete:(void(^)(NSNumber * _Nullable average, NSNumber * _Nullable maxTime, NSNumber * _Nullable minTime ) )cmpBlk; |
||||
|
|
||||
|
|
||||
|
/// Get the hrv data collection in the time range
|
||||
|
/// - Parameters:
|
||||
|
/// - macAddress: device mac address
|
||||
|
/// - beginDate: start of time range
|
||||
|
/// - endDate: end of time range
|
||||
|
/// - isDesc: YES = reverse chronological order , NO=chronologically ascending
|
||||
|
/// - cmpBlk: return result. maxHrv -- Returns the largest value in the list,
|
||||
|
/// minHrv -- Returns the smallest value in the list,
|
||||
|
/// avgHrv -- Returns the average of the data in the list
|
||||
|
+(void)queryBy:(NSString * _Nonnull)macAddress Begin:(NSDate *)beginDate End:(NSDate *)endDate OrderBeTimeDesc:(BOOL)isDesc Cpmplete:(void(^)(NSMutableArray<DBHrv *> *results, NSNumber *maxHrv, NSNumber *minHrv, NSNumber *avgHrv))cmpBlk; |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
@end |
||||
|
|
||||
|
NS_ASSUME_NONNULL_END |
@ -0,0 +1,25 @@ |
|||||
|
//
|
||||
|
// DBOxygen.h
|
||||
|
// CareRingApp
|
||||
|
//
|
||||
|
// Created by Linktop on 2022/6/7.
|
||||
|
//
|
||||
|
|
||||
|
#import <Foundation/Foundation.h> |
||||
|
#import "DBValueSuper.h" |
||||
|
NS_ASSUME_NONNULL_BEGIN |
||||
|
|
||||
|
@interface DBOxygen : DBValueSuper |
||||
|
|
||||
|
/// Get the oxygen data reported by the device
|
||||
|
/// - Parameters:
|
||||
|
/// - macAddress: device mac address
|
||||
|
/// - beginDate: start of time range
|
||||
|
/// - endDate: end of time range
|
||||
|
/// - isDesc: YES = reverse chronological order , NO=chronologically ascending
|
||||
|
/// - cmpBlk: return result
|
||||
|
+(void)query:(NSString * _Nonnull)macAddress Begin:(NSTimeInterval)beginTime End:(NSTimeInterval)endTime Desc:(BOOL)isDesc Cpmplete:(void(^)(NSMutableArray<DBOxygen *> * results) )cmpBlk; |
||||
|
|
||||
|
@end |
||||
|
|
||||
|
NS_ASSUME_NONNULL_END |
@ -0,0 +1,26 @@ |
|||||
|
//
|
||||
|
// DBRespiratory.h
|
||||
|
// CareRingApp
|
||||
|
//
|
||||
|
// Created by Linktop on 2024/2/5.
|
||||
|
// respiratory rate
|
||||
|
|
||||
|
#import <Foundation/Foundation.h> |
||||
|
#import "DBValueSuper.h" |
||||
|
|
||||
|
NS_ASSUME_NONNULL_BEGIN |
||||
|
|
||||
|
@interface DBRespiratory : DBValueSuper |
||||
|
|
||||
|
/// Get the respiratory rate data reported by the device
|
||||
|
/// - Parameters:
|
||||
|
/// - macAddress: device mac address
|
||||
|
/// - beginDate: start of time range
|
||||
|
/// - endDate: end of time range
|
||||
|
/// - isDesc: YES = reverse chronological order , NO=chronologically ascending
|
||||
|
/// - cmpBlk: return result
|
||||
|
+(void)query:(NSString * _Nonnull)macAddress Begin:(NSTimeInterval)beginTime End:(NSTimeInterval)endTime Desc:(BOOL)isDesc Cpmplete:(void(^)(NSMutableArray<DBRespiratory *> * results) )cmpBlk; |
||||
|
|
||||
|
@end |
||||
|
|
||||
|
NS_ASSUME_NONNULL_END |
@ -0,0 +1,53 @@ |
|||||
|
//
|
||||
|
// DBSleepData.h
|
||||
|
// CareRingApp
|
||||
|
//
|
||||
|
// Created by Linktop on 2022/11/1.
|
||||
|
// 睡眠数据的缓存
|
||||
|
|
||||
|
#import <Foundation/Foundation.h> |
||||
|
#import "StagingDataV2.h" |
||||
|
|
||||
|
@class TrendCommonObj; |
||||
|
|
||||
|
NS_ASSUME_NONNULL_BEGIN |
||||
|
@class FMDatabase; |
||||
|
@interface DBSleepData : NSObject |
||||
|
|
||||
|
@property(strong, nonatomic) NSNumber *sleepStart; // sleep start timestamp
|
||||
|
@property(strong, nonatomic) NSNumber *sleepEnd; // Sleep end timestamp
|
||||
|
@property(strong, nonatomic) NSString *dateString; |
||||
|
@property(strong, nonatomic) NSString *macAddress; |
||||
|
|
||||
|
@property(strong, nonatomic) NSNumber *hr; //Average heart rate during sleep
|
||||
|
@property(strong, nonatomic) NSNumber *hrv; //hrv during sleep
|
||||
|
@property(strong, nonatomic) NSNumber *br; //Average respiration rate during sleep
|
||||
|
@property(strong, nonatomic) NSNumber *spo2; //Average Blood Oxygen During Sleep
|
||||
|
|
||||
|
|
||||
|
@property(strong, nonatomic) NSNumber *hrDip; //Heart rate immersion ratio float
|
||||
|
@property(strong, nonatomic) NSNumber *duration; //Sleep duration unit (seconds)
|
||||
|
@property(strong, nonatomic) NSNumber *qulalityDuration; //Quality sleep duration unit (seconds)
|
||||
|
@property(strong, nonatomic) NSNumber *deepDuration; //Deep sleep duration unit (seconds)
|
||||
|
|
||||
|
@property(strong, nonatomic) NSNumber *effieiency; // Other times except wake and divided by the total time
|
||||
|
@property(strong, nonatomic) StagingDataV2 *stagingData; // sleep staging data
|
||||
|
|
||||
|
@property(assign, nonatomic)BOOL isNap; |
||||
|
|
||||
|
/// copy object
|
||||
|
/// - Parameter oriSleep: original instance
|
||||
|
+(instancetype)copyWithDbSleepData:(DBSleepData *)oriSleep; |
||||
|
|
||||
|
|
||||
|
/// Query for sleep data
|
||||
|
/// - Parameters:
|
||||
|
/// - macAddress: devic's macaddress
|
||||
|
/// - beginTime: start of time range
|
||||
|
/// - endTime: end of time range
|
||||
|
/// - cmpBlk: return result
|
||||
|
+(void)queryDbSleepBy:(NSString *)macAddress Begin:(NSTimeInterval)beginTime EndTime:(NSTimeInterval)endTime Comp:(void(^)(NSMutableArray<DBSleepData *> *results))cmpBlk; |
||||
|
|
||||
|
@end |
||||
|
|
||||
|
NS_ASSUME_NONNULL_END |
@ -0,0 +1,33 @@ |
|||||
|
//
|
||||
|
// DBSteps.h
|
||||
|
// CareRingApp
|
||||
|
//
|
||||
|
// Created by Linktop on 2022/7/4.
|
||||
|
//
|
||||
|
|
||||
|
#import "DBValueSuper.h" |
||||
|
|
||||
|
NS_ASSUME_NONNULL_BEGIN |
||||
|
|
||||
|
@interface DBSteps : DBValueSuper |
||||
|
|
||||
|
@property(strong, nonatomic)NSNumber *motion; |
||||
|
|
||||
|
|
||||
|
/// Get the pedometer data reported by the device
|
||||
|
/// - Parameters:
|
||||
|
/// - macAddress: device mac address
|
||||
|
/// - beginDate: start of time range
|
||||
|
/// - endDate: end of time range
|
||||
|
/// - isDesc: YES = reverse chronological order , NO=chronologically ascending
|
||||
|
/// - cmpBlk: return result
|
||||
|
+(void)queryBy:(NSString * _Nonnull)macAddress |
||||
|
Begin:(NSDate *)beginDate End:(NSDate *)endDate |
||||
|
OrderBeTimeDesc:(BOOL)isDesc |
||||
|
Cpmplete:(void(^)(NSMutableArray<DBSteps *> *results))cmpBlk; |
||||
|
|
||||
|
|
||||
|
|
||||
|
@end |
||||
|
|
||||
|
NS_ASSUME_NONNULL_END |
@ -0,0 +1,20 @@ |
|||||
|
//
|
||||
|
// DBTables.h
|
||||
|
// CareRingApp
|
||||
|
//
|
||||
|
// Created by Linktop on 2022/6/7.
|
||||
|
//
|
||||
|
|
||||
|
#ifndef DBTables_h |
||||
|
#define DBTables_h |
||||
|
|
||||
|
#import "DBDevices.h" |
||||
|
|
||||
|
#import "DBHeartRate.h" |
||||
|
#import "DBThermemoter.h" |
||||
|
#import "DBHrv.h" |
||||
|
#import "DBSleepData.h" |
||||
|
#import "DBSteps.h" |
||||
|
|
||||
|
|
||||
|
#endif /* DBTables_h */ |
@ -0,0 +1,30 @@ |
|||||
|
//
|
||||
|
// DBThermemoter.h
|
||||
|
// CareRingApp
|
||||
|
//
|
||||
|
// Created by Linktop on 2022/6/7.
|
||||
|
//
|
||||
|
|
||||
|
#import <Foundation/Foundation.h> |
||||
|
#import "DBValueSuper.h" |
||||
|
|
||||
|
NS_ASSUME_NONNULL_BEGIN |
||||
|
|
||||
|
@interface DBThermemoter : DBValueSuper |
||||
|
|
||||
|
|
||||
|
/// Get the finger temperature data reported by the device
|
||||
|
/// - Parameters:
|
||||
|
/// - macAddress: device mac address
|
||||
|
/// - beginDate: start of time range
|
||||
|
/// - endDate: end of time range
|
||||
|
/// - isDesc: YES = reverse chronological order , NO=chronologically ascending
|
||||
|
/// - cmpBlk: return result. maxThermemoter -- Returns the largest value in the list,
|
||||
|
/// minThermemoter -- Returns the smallest value in the list,
|
||||
|
/// avgThermemoter -- Returns the average of the data in the list
|
||||
|
+(void)queryBy:(NSString * _Nonnull)macAddress Begin:(NSDate *)beginDate EndDate:(NSDate *)endDate OrderBeTimeDesc:(BOOL)isDesc Cpmplete:(void(^)(NSMutableArray<DBThermemoter *> *results, NSNumber *maxThermemoter, NSNumber *minThermemoter, NSNumber *avgThermemoter))cmpBlk; |
||||
|
|
||||
|
|
||||
|
@end |
||||
|
|
||||
|
NS_ASSUME_NONNULL_END |
@ -0,0 +1,25 @@ |
|||||
|
//
|
||||
|
// DBValueSuper.h
|
||||
|
// CareRingApp
|
||||
|
//
|
||||
|
// Created by Linktop on 2022/6/7.
|
||||
|
//
|
||||
|
|
||||
|
#import <Foundation/Foundation.h> |
||||
|
|
||||
|
#define DB_WEAK_SELF __weak typeof(self) weakSelf = self; |
||||
|
#define DB_STRONG_SELF __strong typeof(weakSelf) strongSelf = weakSelf; |
||||
|
|
||||
|
NS_ASSUME_NONNULL_BEGIN |
||||
|
|
||||
|
@interface DBValueSuper : NSObject |
||||
|
|
||||
|
@property(assign, nonatomic)int cId; // unique index
|
||||
|
@property(strong, nonatomic)NSDate *time; // Data sampling time point
|
||||
|
@property(strong, nonatomic)NSNumber *value; // Data
|
||||
|
@property(strong, nonatomic)NSString *macAddress; // The mac address of the device to which it belongs
|
||||
|
|
||||
|
|
||||
|
@end |
||||
|
|
||||
|
NS_ASSUME_NONNULL_END |
@ -0,0 +1,22 @@ |
|||||
|
//
|
||||
|
// SleepStageHeader.h
|
||||
|
// sr01sdkProject
|
||||
|
//
|
||||
|
// Created by Linktop on 2022/10/19.
|
||||
|
//
|
||||
|
|
||||
|
#ifndef SleepStageHeader_h |
||||
|
#define SleepStageHeader_h |
||||
|
|
||||
|
typedef NS_ENUM(NSUInteger, SleepStagingType) { |
||||
|
NONE, // no sleep
|
||||
|
WAKE, // wake up
|
||||
|
NREM1, // NREM1
|
||||
|
NREM2, // NREM2
|
||||
|
NREM3, // NREM3
|
||||
|
REM, // REM
|
||||
|
NAP, // NAP
|
||||
|
|
||||
|
}; // sleep type staging
|
||||
|
|
||||
|
#endif /* SleepStageHeader_h */ |
@ -0,0 +1,21 @@ |
|||||
|
//
|
||||
|
// StagingDataV2.h
|
||||
|
// sr01sdkProject
|
||||
|
//
|
||||
|
// Created by Linktop on 2022/8/16.
|
||||
|
//
|
||||
|
|
||||
|
#import <Foundation/Foundation.h> |
||||
|
#import "StagingSubObj.h" |
||||
|
NS_ASSUME_NONNULL_BEGIN |
||||
|
|
||||
|
@interface StagingDataV2 : NSObject |
||||
|
|
||||
|
@property(assign, nonatomic)NSTimeInterval startTime; // sleep start timestamp
|
||||
|
@property(assign, nonatomic)NSTimeInterval endTime; // Sleep end timestamp
|
||||
|
@property(assign, nonatomic)double averageHr; // sleep average heart rate
|
||||
|
@property(strong, nonatomic, nullable)NSMutableArray<StagingSubObj *> *ousideStagingList;// sleep staging data
|
||||
|
|
||||
|
@end |
||||
|
|
||||
|
NS_ASSUME_NONNULL_END |
@ -0,0 +1,21 @@ |
|||||
|
//
|
||||
|
// StagingListObj.h
|
||||
|
// sr01sdkProject
|
||||
|
//
|
||||
|
// Created by Linktop on 2022/10/19.
|
||||
|
// Node data for sleep staging
|
||||
|
|
||||
|
#import <Foundation/Foundation.h> |
||||
|
|
||||
|
NS_ASSUME_NONNULL_BEGIN |
||||
|
|
||||
|
@interface StagingListObj : NSObject |
||||
|
|
||||
|
@property(strong, nonatomic)NSNumber *time; // timestamp
|
||||
|
@property(strong, nonatomic)NSNumber *hr; // heart rate data
|
||||
|
@property(strong, nonatomic)NSNumber *motion; // motion count
|
||||
|
|
||||
|
|
||||
|
@end |
||||
|
|
||||
|
NS_ASSUME_NONNULL_END |
@ -0,0 +1,22 @@ |
|||||
|
//
|
||||
|
// StagingSubObj.h
|
||||
|
// sr01sdkProject
|
||||
|
//
|
||||
|
// Created by Linktop on 2022/10/19.
|
||||
|
// staging node set
|
||||
|
|
||||
|
#import <Foundation/Foundation.h> |
||||
|
#import "SleepStageHeader.h" |
||||
|
#import "StagingListObj.h" |
||||
|
NS_ASSUME_NONNULL_BEGIN |
||||
|
|
||||
|
@interface StagingSubObj : NSObject |
||||
|
|
||||
|
@property(assign, nonatomic)SleepStagingType type; // sleep stage type
|
||||
|
@property(strong, nonatomic)NSMutableArray<StagingListObj *> *list; // staging node set
|
||||
|
|
||||
|
|
||||
|
|
||||
|
@end |
||||
|
|
||||
|
NS_ASSUME_NONNULL_END |
Binary file not shown.
Loading…
Reference in new issue