VeepooSDK iOS API Document - HBandSDK/iOS_Ble_SDK GitHub Wiki
Version | Modifications | Modification Date |
---|---|---|
1.0.0 | SDK initial version | 2023.05.15 |
1.0.1 | Add language setting document | 2023.06.06 |
1.0.2 | Add metric and imperial unit switching, 12/24 hour switching, and other personalized setting documents | 2023.06.26 |
1.0.3 | Add some function status monitoring interfaces, add 127 sports enumeration, support obtaining original temperature (surface temperature) for body temperature, support self-scan connection, add device time setting interface, etc. | 2023.08.24 |
1.0.4 | Add interface for obtaining device charging status and power | 2023.09.07 |
1.0.5 | Description of watch face transmission and battery power limit added to OTA | 2023.09.11 |
1.0.6 | Added documents related to body composition, blood composition, blood glucose multi-calibration, contact SOS settings, ECG offline storage, etc. | 2023.10.31 |
1.0.7 | Added documents related to blood glucose risk level and body temperature integration into daily data interface | 2024.04.15 |
1.0.8 | Add multi settings for skin colour, private mode support for manual blood glucose measurement | 2024.12.02 |
1.0.9 | Compatibility with Z-series (Zhongke) platforms | 2024.12.30 |
-
VPBleCentralManager: SDK main entry
-
sharedBleManager: Get singleton object, SDK interface exists in singleton form
-
Initialize VPBleCentralManage first, or initialize in the main controller. In short, initialize before using the Bluetooth function
**Note
**Note
The data generated by automatic measurement on the device side can be read to the APP side through the relevant interfaces of the SDK. The SDK provides two ways to read the data generated by these automatic measurements. One is DB persistence within the SDK. After the user calls [Daily Data Reading Interface], etc., the persistent data object is obtained from the DB. The other is to read the data directly through the interface, and the persistence operation is performed by the SDK itself.
It is recommended to use the SDK persistence method, which is less difficult to integrate and most customers choose this method.
SDK persistence method:
// VPPeripheralManage
VPBleCentralManage.sharedBleManager().peripheralManage = VPPeripheralManage.shareVPPeripheralManager()
Application layer self-persistence method:
// VPPeripheralAddManage
VPBleCentralManage.sharedBleManager().peripheralManage = VPPeripheralAddManage.shareVPPeripheralManager()
VPPublicDefine.h -> VeepooBleSDKVersion
When the Bluetooth of the mobile phone system is turned on, if you enter the scanning device scanning interface and call the following code, there will be a callback of the device model after scanning the device. A device may be scanned multiple times, so when displaying, it is necessary to perform repetitive filtering based on the device address attribute deviceAddress of the model VPPeripheralModel, and the user can be displayed based on the attribute value of the model
VPBleCentralManager
- (void)veepooSDKStartScanDeviceAndReceiveScanningDevice:(ReceiveScanningDevice)scanningDevice;
Parameter | Parameter type | Remarks |
---|---|---|
scanningDevice | void(^)(VPPeripheralModel *peripheralModel) | Device model |
When multiple SDK scenarios need to be integrated, it cannot be used when internal scanning is used.
The parameter CBPeripheral
is obtained from the external CBCentralManager
implementation of the scanning delegate method. For related codes, refer to the VPCustomScanManage
class in the Demo
The internal scan will be re-executed, and the connection will be initiated only when the CBPeripheral
with the same UUID is scanned.
///Used when scanning and connecting devices by yourself, suitable for integrating multiple SDK scenarios, used in connection status:VPBleConnectStateChangeBlock
///Cannot be used with {@link veepooSDKConnectDevice:deviceConnectBlock:}
- (void)veepooSDKSelfScanConnectDevice:(CBPeripheral *)peripheral
deviceConnectBlock:(DeviceConnectBlock)connectBlock;
- When the Bluetooth of the mobile phone system is turned on, if you leave the scanning interface, prepare to connect to a device, or need to stop scanning, be sure to call this interface
VPBleCentralManager
- (void)veepooSDKStopScanDevice;
VPBleCentralManage.sharedBleManager().veepooSDKStopScanDevice()
Make sure the Bluetooth of the mobile phone system is turned on
VPBleCentralManager
- (void)veepooSDKConnectDevice:(VPPeripheralModel *)peripheralModel deviceConnectBlock:(DeviceConnectBlock)connectBlock;
Parameter | Parameter Type | Remark |
---|---|---|
peripheralModel | VPPeripheralModel | Peripheral Model |
connectBlock | void(^)(DeviceConnectState connectState) | Callback connection status |
typedef NS_ENUM(NSInteger, DeviceConnectState) {
BlePoweredOff = 0, //Bluetooth is not turned on
BleConnecting = 1, //Bluetooth is connecting
BleConnectSuccess = 2, //Bluetooth connection is successful
BleConnectFailed = 3, //Bluetooth connection failed
BleVerifyPasswordSuccess = 4, //Password verification is successful
BleVerifyPasswordFailure = 5, //Password verification failed
};
- Disconnect, no longer automatically connect, SDK will no longer help automatically reconnect if manually disconnected
VPBleCentralManager
- (void)veepooSDKDisconnectDevice;
VPBleCentralManage.sharedBleManager().veepooSDKDisconnectDevice()
Special note
The OTA process is long, and it is recommended that the battery power is above 30% before the upgrade is allowed.
Device is connected
VPPeripheralBaseManage
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage`
// Read the device's battery level
- (void)veepooSDKReadDeviceBatteryInfo:(void(^)(BOOL isPercent, BOOL percenTypeIsLowBat, NSUInteger battery))deviceBatteryInfoBlock;
// Interface with charging status
- (void)veepooSDKReadDeviceBatteryAndChargeInfo:(void(^)(BOOL isPercent, VPDeviceChargeState chargeState, BOOL percenTypeIsLowBat, NSUInteger battery))deviceBatteryInfoBlock
Parameter | Parameter Type | Remarks |
---|---|---|
isPercent | BOOL | Indicates whether the battery level is a percentage |
percenTypeIsLowBat | BOOL | Indicates whether the device is in low battery state when isPercent is true; |
battery | NSUInteger | Battery level. If it is a percentage, the range is [0, 100]; otherwise, it indicates the number of battery cells, [0, 4] |
Parameter | Parameter Type | Remarks |
---|---|---|
chargeState | VPDeviceChargeState | Device charging state. For details of the enumeration type, see below |
// Charging state of the device
typedef NS_ENUM(NSUInteger, VPDeviceChargeState) {
VPDeviceChargeStateNormal = 0, // The device is in normal use, not charging
VPDeviceChargeStateCharging, // Charging
VPDeviceChargeStateLowPressure, // Low pressure state, has been abandoned
VPDeviceChargeStateFull // Full state, unreliable
};
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSDKReadDeviceBatteryInfo { isPercent, percenTypeIsLowBat, battery in
let str = isPercent ? "Power" : "Voltage"
let percentSign = isPercent ? "%" : ""
weakSelf.vpDeviceBatteryLevelLabel.text = "Battery" + str + ":" + String(battery) + percentSign
}
Example with charging status
veepooBleManager.peripheralManage.veepooSDKReadDeviceBatteryAndChargeInfo { [weak self]isPercent, chargeState, percenTypeIsLowBat, battery in
let str = isPercent ? "Power" : "Voltage"
var state = "Normal use"
if chargeState == .charging {
state = "Charging"
}
if chargeState == .full {
state = "Full"
}
print("Charging status:\(state)")
let percentSign = isPercent ? "%" : ""
self?.vpDeviceBatteryLevelLabel.text = "Battery" + str + ":" + String(battery) + percentSign
}
- The device is connected
VPPeripheralBaseManage
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
The settings of height and weight will affect the calorie calculation results
- (void)veepooSDKSynchronousPersonalInformation:(VPSyncPersonalInfo *)personalInfo result:(void(^)(NSUInteger settingResult))synchronousPersonalInformationBlock;
Parameter | Parameter type | Remarks |
---|---|---|
personalInfo | VPSyncPersonalInfo | Model of personal information to be synchronized. The specific meaning is as follows. It is recommended to store a copy of user data locally and synchronize it to the device every time the information changes or the device is connected. |
result | void(^)(NSUInteger settingResult) | When settingResult = 1, it means the setting is successful. In other cases, it means the setting fails. |
@interface VPSyncPersonalInfo : NSObject
//Height, unit cm
@property(nonatomic, assign) int status;
//Weight, unit kg
@property(nonatomic, assign) int weight;
//Age (current yeart - birth year) Current year - user's birth year
@property(nonatomic, assign) int age;
//Gender 0 represents female, 1 represents male
@property(nonatomic, assign) int sex;
//Target number of steps Unit step (step)
@property(nonatomic, assign) int targetStep;
//Target sleep duration Unit minute (minute) To confirm whether this function exists in the project, you can also set it if not
@property(nonatomic, assign) int targetSleepDuration;
@end
public func synchoronusPersonlInfo(personalInfo: UserModel, result: ((Bool) -> Void)?) {
guard bleCentralM.isConnected else {
return
}
vpPeripheralManager.veepooSDKSynchronousPersonalInformation(personalInfo.vpSyncPersonalInfo) { settingResult in
result?(settingResult == 1 ? true : false)
}
}
Set the language. If the device does not have a language, English will be displayed by default.
It is recommended to use the automatic SDK to follow the phone language settings.
If you use this interface, be sure to set the value of systemLanguage
in VPBleCentralManage
to NO
- The device is connected
VPPeripheralBaseManage
- (void)veepooSDKSettingLanguage:(UInt8)languageType result:(void(^)(BOOL success))settingLangueResult;
Parameter | Parameter Type | Remarks |
---|---|---|
languageType | UInt8 | Chinese (1) English (2) Japanese (3) Korean (4) German (5) Russian (6) Spanish (7) Italian (8) French (9) Vietnamese (10) Portuguese (11) Traditional Chinese (12) Thai (13) Polish (14) Swedish (15) Turkish (16) Dutch (17) Czech (18) Arabic (19) Hungarian (20) Greek (21) Romanian (22) Slovak (23) Indonesian (24) Brazilian Portuguese (25) Croatian (26) Lithuanian (27) Ukrainian (28) Hindi (29) Hebrew (30) Danish(31) Persian(32) Finnish(33) Malay(34) |
settingLangueResult | void(^)(BOOL success) | Set callback result |
- The device is connected
VPPeripheralBaseManage
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
- (void)veepooSDKSettingBaseFunctionType:(VPSettingBaseFunctionSwitchType)baseFunctionType settingState:(VPSettingFunctionState)settingState completeBlock:(void(^)(VPSettingFunctionCompleteState completeState))settingCompleteBlock;
Parameter | Parameter Type | Remarks |
---|---|---|
baseFunctionType | VPSettingBaseFunctionSwitchType | Pass in VPSettingMetric |
settingState | VPSettingFunctionState | Metric: Pass in VPSettingFunctionOpen Imperial: Pass in VPSettingFunctionClose Read: Pass in VPReadFunctionState |
settingCompleteBlock | VPSettingFunctionCompleteState | Set or read the state after a function is completed |
typedef NS_ENUM(NSInteger, VPSettingFunctionCompleteState) {//Set the state after a function is completed
VPFunctionCompleteUnknown = 0, //The device does not have this function
VPFunctionCompleteOpen = 1, //(Metric)
VPFunctionCompleteClose = 2, //(Imperial)
VPFunctionCompleteFailure = 3, //Setting or reading failed
VPFunctionCompleteComplete = 4, //Setting completed, response to Data setting
};
peripheralM.baseFunctionType(type: .metric, settingState: .init(rawValue: (preferenceM.preference.metricImperialUnit.rawValue + 1)) ?? .settingFunctionOpen, completeBlock: nil)
- The device is connected
VPPeripheralBaseManage
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
- (void)veepooSDKSettingBaseFunctionType:(VPSettingBaseFunctionSwitchType)baseFunctionType settingState:(VPSettingFunctionState)settingState completeBlock:(void(^)(VPSettingFunctionCompleteState completeState))settingCompleteBlock;
Parameter | Parameter Type | Remarks |
---|---|---|
baseFunctionType | VPSettingBaseFunctionSwitchType | Pass in VPSettingTimeFormat |
settingState | VPSettingFunctionState | 24 hours: pass in VPSettingFunctionOpen 12 hours: pass in VPSettingFunctionClose Read: pass in VPReadFunctionState |
settingCompleteBlock | VPSettingFunctionCompleteState | Set the state after a function is completed |
typedef NS_ENUM(NSInteger, VPSettingFunctionCompleteState) {//Set the state after a function is completed
VPFunctionCompleteUnknown = 0, //The device does not have this function
VPFunctionCompleteOpen = 1, //(24 hours)
VPFunctionCompleteClose = 2, //(12 hours)
VPFunctionCompleteFailure = 3, //Setting or reading failed
VPFunctionCompleteComplete = 4, //Setting completed, response to Data setting
};
peripheralM.baseFunctionType(type: .timeFormat, settingState: .init(rawValue: sysHourFormat.rawValue) ?? .settingFunctionOpen, completeBlock: nil)
- The device is already connected
VPPeripheralBaseManage
/// Synchronize time, used in special cases, the default connection will automatically synchronize time
/// @param year year
/// @param month month 1-12
/// @param day day 1-31
/// @param hour hour 0-23
/// @param min minute 0-59
/// @param sec second 0-59
/// @param system 0 is not set 1 is 12 hours 2 is 24 hours If it is useless, you need to set it again through the standard in the switch setting
/// @param result failure/success result callback, the internal will be empty
- (void)veepooSDKSettingTimeWithYear:(int)year
month:(int)month
day:(int)day
hour:(int)hour
minute:(int)min
second:(int)sec
timeSystem:(int)system
result:(void(^)(BOOL success))result;
/// Synchronize the current time of the phone to the device. The time parameters are obtained by the SDK from the current data of the phone.
/// This Interface cannot be used with {@link veepooSDKSettingTimeWithYear:month:day:hour:minute:second:timeSystem:result:}
/// The time format setting of this Interface is invalid. To set the time format, please call {@link veepooSDKSettingBaseFunctionType:settingState:completeBlock:}
/// @param result Failure/success result callback, which will be set to null internally
- (void)veepooSDKSettingTimeWithResult:(void(^)(BOOL success))result;
None
veepooBleManager.peripheralManage.veepooSDKSettingTime(withYear: 2023, month: 08, day: 15, hour: 18, minute: 00, second: 00, timeSystem: 0) { success in
print(success)
}
veepooBleManager.peripheralManage.veepooSDKSettingTime { success in
print(success)
}
- The device is connected
VPPeripheralBaseManage
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
- (void)veepooSDKSettingBaseFunctionType:(VPSettingBaseFunctionSwitchType)baseFunctionType settingState:(VPSettingFunctionState)settingState completeBlock:(void(^)(VPSettingFunctionCompleteState completeState))settingCompleteBlock;
Device status change monitoring
/// Callback for active reporting of device switch status changes
@property (nonatomic, copy) void(^deviceFunctionSwitchDidChangeBlock)(void);
Parameter | Parameter type | Remarks |
---|---|---|
baseFunctionType | VPSettingBaseFunctionSwitchType | Various personalized settings, enumeration values are as follows |
settingState | VPSettingFunctionState | Set or read a function, enumeration values are as follows |
settingCompleteBlock | VPSettingFunctionCompleteState | Set the state after a function is completed, enumeration values are as follows |
For the "/" in the Remarks column, settingState is set to VPSettingFunctionOpen to open this function, and VPSettingFunctionClose to close this function. For other special cases, see the non-"/" Remarks
Parameter | Definition | Remarks |
---|---|---|
VPSettingRaiseHand | Set the screen to light up when raising the hand | / |
VPSettingDeviceLose | Device anti-loss | / |
VPSettingWearDetection | Wear detection | / |
VPSettingAutomaticHRTest | Set automatic heart rate detection | / |
VPSettingAutomaticBPTest | Set automatic blood pressure detection | / |
VPSettingExercise | Set excessive exercise reminder, mainly used in headset projects | / |
VPSettingVoiceAnnouncements | Voice announcement of heart rate, blood pressure, blood oxygen, etc., mainly used in headset projects | / |
VPSettingSearchPhoneInterFace | Set whether the search phone interface is displayed on the bracelet | / |
VPSettingStopwatchInterFace | Set whether the stopwatch interface is displayed on the bracelet | / |
VPSettingOxygenLowerRemind | Set the warning after low blood oxygen | / |
VPSettingLedGrade | Set the level of the LED light, off is the black gear, on is the normal skin gear | / |
VPSettingAutomaticHRVTest | Set whether the HRV night automatic detection switch is turned on | / |
VPSettingAutoAnswer | Set the automatic answer switch for incoming calls, effective for headphones | / |
VPSettingDisconnectRemind | Set the disconnection reminder | / |
VPSettingSOSRemind | SOS, similar to the find phone function | / |
VPSettingAutomaticPPGTest | Pulse rate automatic detection switch, mainly used by ECG bracelets | / |
VPSettingAccurateSleep | Accurate sleep switch | Temporarily invalid, currently using the VPSettingAutomaticPPGTest control, when turned off, accurate sleep will also be turned off |
VPSettingMusicControl | Music control | / |
VPSettingLongpressUnlock | Long press to unlock | / |
VPSettingMessageScreenLight | Message screen light | / |
VPSettingAutomaticTemperatureTest | Automatic temperature detection switch | / |
VPSettingTemperatureUnit | Temperature unit setting | 1 means Celsius 2 means Fahrenheit |
VPSettingECGNormallyOpen | ECG normally open function | / |
VPSettingAutomaticBloodGlucoseTest | Automatic blood sugar detection switch | / |
VPSettingMet | Met function switch | / |
VPSettingStress | Stress function switch | / |
VPSettingBloodGlucoseUnit | Blood sugar unit setting | 1 means mmol/L 2 means mg/dl |
VPSettingAutomaticOxygenTest | Automatic blood oxygen detection at night | / |
typedef NS_ENUM(NSInteger, VPSettingFunctionState) {//Set to get a function to read
VPReadFunctionState = 0, //Read the switch and existence of a function
VPSettingFunctionOpen = 1, //Open a function
VPSettingFunctionClose = 2, //Close a function
VPSettingFunctionCancel = 3, //Only dynamic blood pressure calibration is valid now
VPSettingFunction = 4, //Set a function
};
typedef NS_ENUM(NSInteger, VPSettingFunctionCompleteState) {//Set the state after a function is completed
VPFunctionCompleteUnknown = 0, //The device does not have this function
VPFunctionCompleteOpen = 1, //This function is already turned on
VPFunctionCompleteClose = 2, //This function is already closed
VPFunctionCompleteFailure = 3, //Setting or reading failed
VPFunctionCompleteComplete = 4, //Setting completed, response to Data setting
};
@objc func baseFunctionOpenOrCloseRemindAction(sender: UISwitch) {//Start setting the message reminder switch function
if VPBleCentralManage.sharedBleManager().isConnected == false {
print();
_ = AppDelegate.showHUD(message: "Device not connected, setup failed", hudModel: MBProgressHUDModeText, showView: view)
self.perform(#selector(settingBaseFunctionRemindFarilure(sender:)), with: sender, afterDelay: 0.5)
return
}
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSDKSettingBaseFunctionType(VPSettingBaseFunctionSwitchType(rawValue: sender.tag)!, settingState: VPSettingFunctionState(rawValue: sender.isOn ? 1 : 2)!) {[weak self] (settingFunctionCompleteState) in
if self == nil {
return
}
switch settingFunctionCompleteState {
case .functionCompleteUnknown:
_ = AppDelegate.showHUD(message: "No such feature", hudModel: MBProgressHUDModeText, showView: (self?.view)!)
fallthrough
case .functionCompleteFailure:
self?.perform(#selector(self?.settingBaseFunctionRemindFarilure(sender:)), with: sender, afterDelay: 0.5)
_ = AppDelegate.showHUD(message: "Setup failed", hudModel: MBProgressHUDModeText, showView: (self?.view)!)
case .functionCompleteOpen:
_ = AppDelegate.showHUD(message: "Setup successful,opened", hudModel: MBProgressHUDModeText, showView: (self?.view)!)
case .functionCompleteClose:
_ = AppDelegate.showHUD(message: "Setup successful,closed", hudModel: MBProgressHUDModeText, showView: (self?.view)!)
case .functionCompleteComplete:
_ = AppDelegate.showHUD(message: "Setup complete", hudModel: MBProgressHUDModeText, showView: (self?.view)!)
}
}
}
Multi LedGrade Setting(Skin Color)
// let support = VPPeripheralModel.skinType == 2
// rawValue is [1, 6], 1为最靠近白色肤色,6为最靠近黑色肤色,5和6都是原来的黑人模式,1-4佩戴有不同的阈值
let state = VPSettingFunctionState(rawValue: 6) ?? .settingFunctionOpen
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSDKSettingBaseFunctionType(.ledGrade, settingState: state) { state in
print(state)
}
This refers to the device's step count, distance and calories. The data returned by this interface is real-time, which is different from the number of steps in daily data. The number of steps in daily data is a summary every 5 minutes and has a lag. If the application layer needs to synchronously obtain the number of steps on the device side, it needs to call this interface at a fixed frequency to obtain data.
- The device is connected
VPPeripheralBaseManage
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
SDK persistence method:
//
+ (void)veepooSDKGetStepDataWithDate:(NSString *)queryDate andTableID:(NSString *)tableID changeUserStature:(NSUInteger)userStature result:(void(^)(NSDictionary *stepDict))resultBlock;
Application layer self-persistence method:
// If it is the data of the day, the device is always generating data, and the application layer needs to control the timing of reading. Data other than the day is idempotent, and each read will produce the same result. The application layer can persist it by itself, and the persisted data can avoid repeated acquisition.
// dayNumber represents which day 0 represents today, 1 represents yesterday, and 2 represents the day before yesterday. It cannot be greater than the value of the attribute saveDays in VPPeripheralModel
- (void)veepooSDK_readStepDataWithDayNumber:(NSInteger)dayNumber result:(void(^)(NSDictionary *stepDict))readStepBlock;
Parameter | Parameter type | Remarks |
---|---|---|
queryDate | NSString | The date to be queried, in the format of yyyy-MM-dd |
tableID | NSString | The ID of the query data. Pass the MAC address of the device to obtain the data |
userStature | NSUInteger | The user's height. This parameter is used to convert the number of steps into distance and calories. The height must be consistent with the personal information sent to the device. The default height of the device is 175 |
resultBlock | NSDictionary | The returned format uses the specific name as the key and the specific value as the value. The format is as follows |
{
Step = 5000; //Total number of steps per day
Dis = 80.00; //Converted distance unit is km
Cal = 1600.0; //Converted calories unit is kcal (kilocalories)
}
/// Get the current step count data of the bracelet and synchronize it with the step count data displayed on the device
@objc func startRealTimeStep() {
if veepooBleManager.isConnected == false {
return
}
if stepTimer == nil {
stepTimer = Timer.scheduledTimer(timeInterval: 5.0, target: self, selector: #selector(self.startRealTimeStep), userInfo: nil, repeats: true)
}
unowned let weakSelf = self
VPDataBaseOperation .veepooSDKGetStepData(withDate: 0.getOneDayDateString(), andTableID: veepooBleManager.peripheralModel.deviceAddress, changeUserStature: veepooBleManager.peripheralModel.deviceStature) { (stepDict) in
guard let deviceStepDict = stepDict else {
return
}
if deviceStepDict["Step"] != nil && deviceStepDict["Dis"] != nil && deviceStepDict["Cal"] != nil {
weakSelf.vpDeviceCurrentStepLabel.text = "Real-time step count:" + (deviceStepDict["Step"] as! String) + " " + (deviceStepDict["Dis"] as! String) + "km " + (deviceStepDict["Cal"] as! String) + "kcal "
}
}
}
- The device is connected
VPPeripheralBaseManage
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
Simple reading method, suitable for stand-alone version. After reading, data can be directly extracted from the SDK database.
- (void)veepooSdkStartReadDeviceAllDataWithReadStateChangeBlock:(void(^)(VPReadDeviceBaseDataState readState, NSUInteger totalDay, NSUInteger currentReadDayNumber, NSUInteger readCurrentDayProgress))readStateChangeBlock;
Parameter | Parameter type | Remarks |
---|---|---|
readState | VPReadDeviceBaseDataState | Read the state change of the basic data of the device. All enumeration values are as follows |
totalDay | NSUInteger | The number of days the device has saved data |
currentReadDayNumber | NSUInteger | The subscript of the current number of days read |
readCurrentDayProgress | NSUInteger | The progress of reading the current day |
typedef NS_ENUM(NSInteger, VPReadDeviceBaseDataState) {//Changes in the state of reading basic device data
VPReadDeviceBaseDataIdle = 0, // Status of not starting to read
VPReadDeviceBaseDataStart = 1, // Start reading data
VPReadDeviceBaseDataReading = 2, // Reading
VPReadDeviceBaseDataComplete, // Reading is complete
VPReadDeviceBaseDataInvalid, // Not available in SDK
};
//After the password is successfully verified, the bracelet data will be read (sleep, step count, heart rate, blood pressure, blood oxygen level, blood sugar, blood composition and other basic data)
//When the body temperature type is 5, the reading is also triggered in this Interface
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSdkStartReadDeviceAllData {[weak self] (readDeviceBaseDataState, totalDay, currentReadDayNumber, readCurrentDayProgress) in
switch readDeviceBaseDataState {
case .start: //Start reading data
hud.show(true)
hud.labelText = "Start reading data"
case .reading://Reading data
let progressString: String = String(currentReadDayNumber) + "/" + String(totalDay) + " " + String(readCurrentDayProgress) + "%"
hud.labelText = progressString
case .complete://Read data completed
hud.labelText = "Read data completed"
hud.hide(true, afterDelay: 1.0)
self?.readOxygenData()
default:
break
}
}
- The device is connected
VPPeripheralModel
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage.peripheralModel
@property (nonatomic, strong) NSData *deviceFuctionData;
if let data = model?.deviceFuctionData {
if data[18] != 1 {
result.append(.heartRate)
}
- The device is connected and supports this function
- Perform the measurement after all daily data has been read, otherwise the device will report an error callback that the device is busy
- Turn on or off the heart rate test. If an abnormal end state is found during the test, it means that the test has ended. The heart rate test is a dynamic test process. There will be multiple result callbacks during the test. After the user completes the test, he must actively call this method to end the test
VPPeripheralBaseManage
How to get it:[VPBleCentralManage sharedBleManager].peripheralManage
- (void)veepooSDKTestHeartStart:(BOOL)start testResult:(void(^)(VPTestHeartState testHeartState, NSUInteger heartValue))testHeartResultBlock;
Parameter | Parameter type | Remarks |
---|---|---|
start | BOOL | Turn on or off the heart rate test. If an abnormal end state is found during the test, it means that the test has ended. The heart rate test is a dynamic test process. There will be multiple result callbacks during the test. After the test is completed, the user should actively call this method to end the test. |
testHeartResultBlock | void(^)(VPTestHeartState testHeartState, NSUInteger heartValue) | VPTestHeartState: state changes during the heart rate test, heartValue: measured instantaneous heart rate value |
typedef NS_ENUM(NSInteger,VPTestHeartState) {//State changes during heart rate test
VPTestHeartStateStart = 0, //Starting to test heart rate, no result yet
VPTestHeartStateTesting = 1, //Testing heart rate, heart rate value has been measured
VPTestHeartStateNotWear = 2, //Wearing test failed, test has ended
VPTestHeartStateDeviceBusy = 3, //The device is busy and cannot be tested, test has ended
VPTestHeartStateOver = 4, //Test ended normally, ended manually
};
- The device is connected and supports this function
- After calling daily data reading, get heart rate data from the SDK database
VPDataBaseOperation
+ (NSDictionary *)veepooSDKGetOriginalDataWithDate:(NSString *)queryDate andTableID:(NSString *)tableID;
Get the raw data of a certain day. Usually it is every 5 minutes or 10 minutes. If the interval is long, it means that the device has not read the data. The raw data is mainly used for data analysis and saved to its own server. It is generally not displayed to users.
Parameter | Parameter type | Remarks |
---|---|---|
queryDate | NSString | The date to be queried. The format is 2017-02-09 |
tableID | NSString | The ID of the query data. Pass the MAC address of the device to obtain the data |
{
"10:40" = {
diastolic = 0; // high pressure value
systolic = 0; // low pressure value
heartValue = 0; // heart rate value
sportValue = 17; // amount of exercise
stepValue = 0; // number of steps
calValue = 0; // calories
disValue = 0; // distance
ppgs = [array]; // when using, if there is heartValue, use heartValue, if not, use ecgs first, if there is neither heartValue nor ecgs, use ppgs, ppgs and ecgs are the heart rate arrays of this time period
ecgs = [array];
};
"10:45" = {
diastolic = 0;
systolic = 0;
heartValue = 0;
sportValue = 25;
stepValue = 0;
calValue = 0;
disValue = 0;
ppgs = [array];
ecgs = [array];
};
}
-
The device is connected and supports this function
-
After calling daily data reading, get heart rate data from the SDK database
VPDataBaseOperation
Get half-hour heart rate. Note that different devices measure heart rate automatically at different frequencies, with the highest frequency being once a minute. This Interface returns a dictionary array of all heart rate data processed into the average heart rate every half hour.
+ (NSDictionary *)veepooSDKGetOriginalChangeHalfHourDataWithDate:(NSString *)queryDate andTableID:(NSString *)tableID;
Parameter | Parameter type | Remarks |
---|---|---|
queryDate | NSString | The date to be queried. The format is 2017-02-09 |
tableID | NSString | The ID of the query data. Pass the MAC address of the device to obtain the data |
Special note: Heart rate average: 10:30 is the average value of 10:30-11:00 11:00 is the average value of 11:00-11:30, exercise volume and steps are the accumulation of all values within half an hour
{
"10:30" = {
heartValue = 0; // half-hour heart rate average value
sportValue = 108; // half-hour exercise accumulation value
stepValue = 0; // half-hour step accumulation value
calValue = 0; // half-hour calorie accumulation value
disValue = 0; // half-hour distance accumulation value
};
"11:00" = {
heartValue = 0;
sportValue = 33;
stepValue = 0;
calValue = 0; // half-hour calorie accumulation value
disValue = 0; // half-hour distance accumulation value
};
}
none
The device is connected and supports this function
VPPeripheralBaseManage
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
- (void)veepooSDKSettingBaseFunctionType:(VPSettingBaseFunctionSwitchType)baseFunctionType settingState:(VPSettingFunctionState)settingState completeBlock:(void(^)(VPSettingFunctionCompleteState completeState))settingCompleteBlock;
Parameter | Parameter type | Remarks |
---|---|---|
baseFunctionType | VPSettingBaseFunctionSwitchType | Type of information to set and read |
settingState | VPSettingFunctionState | Set or read |
settingCompleteBlock | void(^)(VPSettingFunctionCompleteState completeState) | Set the state after a function is completed |
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSDKSettingBaseFunctionType(.automaticHRTest, settingState: .readFunctionState) { [weak self] state in
if state == .functionCompleteUnknown || state == .functionCompleteFailure {
monitorHeight = 0
} else {
self?.monitorSW.isOn = state == .functionCompleteOpen
}
}
The device is connected and supports this function
VPPeripheralBaseManage
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
- (void)veepooSDKSettingDeviceHeartAlarmWithHeartAlarmModel:(VPDeviceHeartAlarmModel *)heartAlarmModel settingMode:(NSUInteger)settingMode successResult:(void(^)(VPDeviceHeartAlarmModel *heartAlarmModel))settingHeartAlarmResultBlock failureResult:(void(^)(void))settingHeartAlarmFailureBlock;
Parameter | Parameter type | Remarks |
---|---|---|
heartAlarmModel | VPDeviceHeartAlarmModel | Heart rate alarm model (ps: when settingMode is 2, pass VPDeviceHeartAlarmModel()) |
settingMode | NSUInteger | Set the heart rate alarm mode. 0 means off 1 means on 2 means read device heart rate alarm information |
settingHeartAlarmResultBlock | void(^)(VPDeviceHeartAlarmModel *heartAlarmModel) | Callback after successful reading and setting |
settingHeartAlarmFailureBlock | void(^)(void) | Callback after failed reading and setting |
// MARK: - Heart rate reminder
/// Read device heart rate reminder data
public func getHeartRate(successResult: @escaping ((VPDeviceHeartAlarmModel?) -> Void), failureResult: @escaping (() -> Void)) {
vpPeripheralManager.veepooSDKSettingDeviceHeartAlarm(with: VPDeviceHeartAlarmModel(), settingMode: 2, successResult: successResult, failureResult: failureResult)
}
/// Set device heart rate reminder data
/// - Parameters:
/// - model: Heart rate reminder model
public func setHearRate(model: VPDeviceHeartAlarmModel, successResult: @escaping ((VPDeviceHeartAlarmModel?) -> Void), failureResult: @escaping (() -> Void)) {
vpPeripheralManager.veepooSDKSettingDeviceHeartAlarm(with: model, settingMode: model.isOpen ? 1 : 0, successResult: successResult, failureResult: failureResult)
}
- The device is connected
VPPeripheralModel
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage.peripheralModel
Body temperature function 0: No 1: Body temperature but no automatic measurement 2/4/5: Body temperature and automatic measurement
The automatic measurement data reading of body temperature type 5 has been integrated into the daily data reading, and there is no need to call a separate interface to trigger the reading.
@property (nonatomic, assign) NSUInteger temperatureType;
- The device is connected and supports this function
VPPeripheralBaseManage
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
- (void)veepooSDK_temperatureTestStart:(BOOL)start result:(void (^)(VPTemperatureTestState state, BOOL enable, NSInteger progress, NSInteger tempValue, NSInteger originalTempValue))result;
Parameter | Parameter type | Remarks |
---|---|---|
start | Bool | YES start/ NO close |
result | void (^)(VPTemperatureTestState state, BOOL enable, NSInteger progress, NSInteger tempValue, NSInteger originalTempValue) | Result callback |
Parameter | Parameter Type | Remarks |
---|---|---|
state | VPTemperatureTestState | YES Enable / NO Disable |
enable | BOOL | Parameter indicates whether the device is busy |
progress | NSInteger | Indicates the measurement progress (0~100) |
tempValue | NSInteger | Indicates 10 times the body temperature value (in degrees Celsius) |
originalTempValue | NSInteger | Indicates 10 times the original temperature value (in degrees Celsius), corresponding to the body surface temperature in the H Band |
//Body temperature manual test/automatic monitoring switch status
typedef NS_ENUM(NSUInteger, VPTemperatureTestState) {
VPTemperatureTestStateUnsupported, //Body temperature monitoring function is not supported
VPTemperatureTestStateOpen, //Body temperature monitoring is turned on
VPTemperatureTestStateClose, //Body temperature monitoring is turned off
};
- After reading the data, store it in the database and get the data directly from the database
- Note
⚠️ Do not read concurrently with hrv/blood oxygen/daily data, etc. - When the temperature type (temperatureType) is 5, this interface is not supported
VPPeripheralBaseManage
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
- (void)veepooSdkStartReadDeviceTemperatureData:(void(^)(VPReadDeviceBaseDataState readState, NSUInteger totalDay, NSUInteger currentReadDayNumber, NSUInteger readCurrentDayProgress))readStateChangeBlock{}
Parameter | Parameter type | Remarks |
---|---|---|
readState | VPReadDeviceBaseDataState | Enumeration definition as follows |
totalDay | NSUInteger | Number of days the device stores body temperature |
currentReadDayNumber | NSUInteger | Number of days currently read |
readCurrentDayProgress | NSUInteger | Read progress for the day (0~100) |
typedef NS_ENUM(NSInteger, VPReadDeviceBaseDataState) {//Changes in the state of reading basic device data
VPReadDeviceBaseDataIdle = 0, // Status of not starting to read
VPReadDeviceBaseDataStart = 1, // Start reading data
VPReadDeviceBaseDataReading = 2, // Reading
VPReadDeviceBaseDataComplete, // Reading is complete
VPReadDeviceBaseDataInvalid, // Not available in SDK
};
-
The device is connected and supports the temperature function
-
After the temperature reading data is completed, it is stored in the database, and the data is directly taken from the database
VPDataBaseOperation
+ (NSArray *)veepooSDKGetDeviceTemperatureDataWithDate:(NSString *)queryDate andTableID:(NSString *)tableID;
Parameter | Parameter type | Remarks |
---|---|---|
queryDate | NSString | The date format to be queried is 2021-06-07 |
tableID | NSString | The mac address of the device, which device's data to obtain |
/* Get the array of automatic temperature measurement data for one day. The array contains dictionaries every 5 minutes. The format is as follows
NSDictionary *dataDic = {
VPDeviceTemperatrueDataMonthKey: month, month
VPDeviceTemperatrueDataDayKey: day, day
VPDeviceTemperatrueDataHourKey: hour, hour
VPDeviceTemperatrueDataMinuteKey: minute, minute
VPDeviceTemperatrueDataValueKey: value, temperature value (Celsius)
VPDeviceTemperatrueDataOriginalValueKey: riginalValue, skin temperature value (Celsius)
}
*/
- The device is connected and supports this function
VPPeripheralBaseManage
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
- (void)veepooSDKSettingBaseFunctionType:(VPSettingBaseFunctionSwitchType)baseFunctionType settingState:(VPSettingFunctionState)settingState completeBlock:(void(^)(VPSettingFunctionCompleteState completeState))settingCompleteBlock;
Parameter | Parameter type | Remarks |
---|---|---|
baseFunctionType | VPSettingBaseFunctionSwitchType | Function type, pass in this enumeration value VPSettingTemperatureUnit |
settingState | VPSettingFunctionState | Set or read a function, all enumeration values are as follows |
settingCompleteBlock | void(^)(VPSettingFunctionCompleteState completeState) | The state enumeration values in the callback are as follows |
typedef NS_ENUM(NSInteger, VPSettingFunctionState) {//Set to get a function to read
VPReadFunctionState = 0, //Read the switch and existence of a function
VPSettingFunctionOpen = 1, //Open a function
VPSettingFunctionClose = 2, //Close a function
VPSettingFunctionCancel = 3, //Only dynamic blood pressure calibration is valid now
VPSettingFunction = 4, //Set a function
};
typedef NS_ENUM(NSInteger, VPSettingFunctionCompleteState) {//Set the state after a function is completed
VPFunctionCompleteUnknown = 0, //The device does not have this function
VPFunctionCompleteOpen = 1, //This function has been turned on
VPFunctionCompleteClose = 2, //This function has been turned off
VPFunctionCompleteFailure = 3, //Setting or reading failed
VPFunctionCompleteComplete = 4, //Setting completed, reply to Data setting
};
- The device is connected and supports this function
VPPeripheralBaseManage
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
- (void)veepooSDKSettingBaseFunctionType:(VPSettingBaseFunctionSwitchType)baseFunctionType settingState:(VPSettingFunctionState)settingState completeBlock:(void(^)(VPSettingFunctionCompleteState completeState))settingCompleteBlock;
Parameter | Parameter type | Remarks |
---|---|---|
baseFunctionType | VPSettingBaseFunctionSwitchType | Function type, pass in this enumeration value VPSettingAutomaticTemperatureTest |
settingState | VPSettingFunctionState | Set to get a function to read, all enumeration values are as follows |
settingCompleteBlock | void(^)(VPSettingFunctionCompleteState completeState) | The state enumeration values in the callback are as follows |
typedef NS_ENUM(NSInteger, VPSettingFunctionState) {//Set to get a function to read
VPReadFunctionState = 0, //Read the switch and existence of a function
VPSettingFunctionOpen = 1, //Open a function
VPSettingFunctionClose = 2, //Close a function
VPSettingFunctionCancel = 3, //Only dynamic blood pressure calibration is valid now
VPSettingFunction = 4, //Set a function
};
typedef NS_ENUM(NSInteger, VPSettingFunctionCompleteState) {//Set the state after a function is completed
VPFunctionCompleteUnknown = 0, //The device does not have this function
VPFunctionCompleteOpen = 1, //This function has been turned on
VPFunctionCompleteClose = 2, //This function has been turned off
VPFunctionCompleteFailure = 3, //Setting or reading failed
VPFunctionCompleteComplete = 4, //Setting completed, reply to Data setting
};
- The device is connected
VPPeripheralModel
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage.peripheralModel
0
: This function is not available in the generation
1
: This represents the E series
2
: This represents the G series
@property (nonatomic, assign) NSInteger ecgType;
- The device is connected and supports this function
VPPeripheralBaseManage
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
- (void)veepooSDKAddPTTStateListener:(void(^)(NSInteger pttState))pttListener;
Parameter | Parameter Type | Notes |
---|---|---|
pttState | NSInteger | 0 means the device is not in PTT mode, 1 means the device is in PTT mode |
//Whether the monitoring device is in PTT mode
VPBleCentralManage.sharedBleManager()?
.peripheralManage.veepooSDKAddPTTStateListener({[weak self] (state) in
self?.pttStateLabel.text = state == 1 ? "The device has entered PTT mode" : "The device is not in PTT mode"
})
- The device is connected and supports this function
VPPeripheralBaseManage
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
- (void)veepooSDKPTTTest:(BOOL)start valueBlock:(void(^)(VPPttValueModel *valueModel))valueBlock signalBlock:(void(^)(NSArray <NSNumber *>*signals))signalBlock;
Parameter | Parameter type | Remarks |
---|---|---|
start | BOOL | Start or stop PTT test |
Parameter | Parameter type | Remarks |
---|---|---|
valueModel | VPPttValueModel | PPT data |
signals | <NSNumber *> | PPT signal changes |
VPBleCentralManage.sharedBleManager()?
.peripheralManage.veepooSDKPTTTest(sender.isSelected, valueBlock: {[weak self] (valueModel) in
self?.handleValue(valueModel)
}, signal: {[weak self] (signals) in
self?.handleSignals(signals)
})
func handleValue(_ model: VPPttValueModel?) {
switch model!.testState {
case .normal:
valueLabel.text = "Heart rate:\(model!.heart) HRV:\(model!.hrv) QT:\(model!.qt)"
case .busy:
valueLabel.text = "The device is processing other things"
case .leadFail:
valueLabel.text = "Device leads fall off"
default:
valueLabel.text = ""
}
}
func handleSignals(_ signals: [NSNumber]?) {
guard let deviceSignals = signals else {
return;
}
signalLabel.text = ""
for signal in deviceSignals {
signalLabel.text = (signalLabel.text)! + " " + "\(signal)"
}
}
- The device is connected and supports this function
VPPeripheralBaseManage
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
Enable or disable ECG test. If an abnormal end state is found during the test, it means that the test has ended. ECG test is a dynamic test process. There will be multiple result callbacks during the test. After the test is completed, the user should actively call this method to end the test.
- (void)veepooSDKTestECGStart:(BOOL)start testResult:(void(^)(VPTestECGState testECGState, NSUInteger testProgress, VPECGTestDataModel *testModel))testECGResultBlock;
Parameter | Parameter type | Remarks |
---|---|---|
start | Bool | Turn ECG test on or off |
testECGResultBlock | VPSettingFunctionState | Set to get a function to read, all enumeration values are as follows |
settingCompleteBlock | void(^)(VPTestECGState testECGState, NSUInteger testProgress, VPECGTestDataModel *testModel) | Parameter Explanation in callback is as follows |
Parameter | Parameter type | Remarks |
---|---|---|
testECGState | VPTestECGState | State changes during the test, enumeration values are as follows |
testProgress | NSUInteger | Test progress (0-100) |
testModel | VPECGTestDataModel | Data returned during the test, note that the full amount of data is returned |
typedef NS_ENUM(NSInteger,VPTestECGState) {//State changes during ECG test
VPTestECGStateStart = 0, //Start testing ECG, no results yet
VPTestECGStateTesting = 1, //Testing ECG, heart rate value has been measured
VPTestECGStateNotLead = 2, //Lead off
VPTestECGStateDeviceBusy = 3, //The device is busy and cannot be tested, the test has ended
VPTestECGStateOver = 4, //Test ended normally, ended manually
VPTestECGStateFailure, //Test failed
VPTestECGStateComplete, //Test completed
VPTestECGStateNoFunction, //The device does not have this function
};
Device-side offline storage data reading is interspersed with daily data reading Interface
In the connected state, the SDK has an Interface for monitoring the completion of device offline measurements. You can subscribe to this Interface and trigger the daily data reading Interface while triggering the callback
The device supports ECG offline storage function
VPDataBaseOperation
&& VPPeripheralBaseManage
/// Get ECG data stored offline on all devices on a certain day
/// @param queryDate The date format to be queried is 2021-06-07
/// @param tableID The mac address of the device, which device's data is to be obtained
+ (NSArray<VPECGTestDataModel *> *)veepooSDKGetDeviceOffStoreECGWithDate:(NSString *)queryDate andTableID:(NSString *)tableID;
Device measurement offline storage completion callback interface
/// The device side measures the offline storage ECG function and completes the callback
@property (nonatomic, copy) void(^deviceTestOffStoreECGDidFinishBlock)(void);
none
private func subscribe() {
// Subscribe to the device-side ECG offline measurement completion event
VPBleCentralManage.sharedBleManager().peripheralManage.deviceTestOffStoreECGDidFinishBlock = {[weak self] in
// Here we can call to read all daily data
self?.reReadAllData()
}
}
private func reReadAllData() {
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSdkStartReadDeviceAllData {
[weak self] (readDeviceBaseDataState, totalDay, currentReadDayNumber, readCurrentDayProgress) in
if readDeviceBaseDataState == .complete {
print("Read Success")
}
}
}
- The device is connected
VPPeripheralModel
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage.peripheralModel
Non-zero means HRV function is enabled
@property (nonatomic, assign) NSInteger hrvType;
- The device has HRV function
VPDataBaseOperation
+ (NSArray *)veepooSDKGetDeviceHrvDataWithDate:(NSString *)queryDate andTableID:(NSString *)tableID;
Parameter | Parameter type | Remarks |
---|---|---|
queryDate | NSString | The date to be queried. The format is 2017-02-09 |
tableID | NSString | The ID of the query data. Pass the MAC address of the device to obtain the data |
// Get an array of hrv data for one day. The array contains a dictionary for each minute in the following format
NSDictionary *riginalDic = @{
VPHRVTimeKey:hrvTime, time
VPHRVValueKey:hrvValue, hrv value
VPHRVTempKey:hrvTemp1, reserved parameters
VPHRVHeartsKey:@[This is a string array representing all rr interval values within one minute. Each number multiplied by 10 represents a rr interval value. The Lorenz scatter plot is drawn based on this. All the rr interval values of the minutes should be combined together]
};
public func getHRVDataFromDB(date: Date) -> [[String : Any]] {
guard record.deviceAddress.isNotEmpty else {
return []
}
guard let dicArray = VPDataBaseOperation.veepooSDKGetDeviceHrvData(withDate: date.hf.toString(formatter: .yyyy_MM_dd_v), andTableID: record.deviceAddress) as? [[String : Any]] else {
return []
}
return dicArray
}
- The device is connected
VPPeripheralModel
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage.peripheralModel
0
represents normal sleep
1、3
represents precise sleep
@property (nonatomic, assign) NSInteger sleepType;
- The device supports normal
- sleep function
VPDataBaseOperation
Get the sleep data of a certain day. There may be multiple sleep periods in a day, such as sleeping at night and sleeping during the day. And each sleep period may have multiple awakenings at night.
+ (NSArray *)veepooSDKGetSleepDataWithDate:(NSString *)queryDate andTableID:(NSString *)tableID;
Parameter | Parameter type | Remarks |
---|---|---|
queryDate | NSString | The date to be queried. The format is 2017-02-09 |
tableID | NSString | The ID of the query data. Pass the MAC address of the device to obtain the data |
(
{
"DEEP_HOUR" = "2.833"; //Deep sleep time, unit hours
HeartBasic = 1; //Temporarily unused
"LIGHT_HOUR" = "3.667"; //Light sleep time, unit hours
"SLEEP_LEVEL" = 3; //Sleep level interval 1-5 levels: poor, average, good, very good, perfect, you can also customize the language
"SLEEP_TIME" = "2017/02/09 01:15"; //Sleep start time
"SLE_HOUR" = 6; //Total sleep hours, unit hours
"SLE_MINUTE" = 30; //Total sleep minutes, unit minutes SLE_HOUR + SLE_MINUTE or DEEP_HOUR + LIGHT_HOUR is the total sleep time or use WAKE_TIME - SLEEP_TIME to choose which one to use to calculate the total sleep time
"SLE_LINE" = 010000011111111011111111000001110020000001100200000000000001111111111100001100; //Deep and shallow sleep curve, 0 represents light sleep, 1 represents deep sleep, 2 represents waking up at night. Each value represents 5 minutes of sleep time. For example, the first 0 is the first 5 minutes of sleep, the second 1 is the first 5-10 minutes of sleep, the third 0 is 10-15 minutes of sleep, and so on. Customize the deep and shallow sleep curve or graph based on this string
"WAKE_TIME" = "2017/02/09 03:45"; //Sleep end time
WakeUpTime = 0; //Number of wake-ups in each sleep period
}
{
"DEEP_HOUR" = "2.833";
HeartBasic = 1;
"LIGHT_HOUR" = "3.667"; "SLEEP_LEVEL" = 3; "SLEEP_TIME" = "2017/02/09 04:15"; "SLE_HOUR" = 6; "SLE_MINUTE" = 30; "SLE_LINE" = 000000011111110111111110000011100 00000001100000000000000001111111111100001100; "WAKE_TIME" = "2017/02/09 07:45"; WakeUpTime = 0; } )
- The device supports the accurate sleep function
VPDataBaseOperation
Get the sleep data of a certain day. There may be multiple sleep periods in a day, such as sleeping at night and sleeping during the day. And each sleep period may have multiple awakenings at night.
+ (NSArray <VPAccurateSleepModel *>*)veepooSDKGetAccurateSleepDataWithDate:(NSString *)queryDate andTableID:(NSString *)tableID
Parameter | Parameter type | Remarks |
---|---|---|
queryDate | NSString | The date to be queried. The format is 2017-02-09 |
tableID | NSString | The ID of the query data. Pass the MAC address of the device to obtain the data |
@interface VPAccurateSleepModel : NSObject
//Type of sleep, upload A7 command sleep flag (sleep type, upload A7 command sleep flag)
@property (nonatomic, strong) NSString *sleepType;
//Sleep time sleep time
@property (nonatomic, strong) NSString *sleepTime;
//Wake up time wake up time
@property (nonatomic, strong) NSString *wakeTime;
//Sleep sign sleep sign
@property (nonatomic, strong) NSString *sleepTag;
//get up score wake up score
@property (nonatomic, strong) NSString *getUpScore;
//Deep sleep score deep sleep score
@property (nonatomic, strong) NSString *deepScore;
//Sleep efficiency score, efficiency score from night to deep sleep Sleeping efficiency score, efficiency score from getting up at night to deep sleep
@property (nonatomic, strong) NSString *sleepEfficiencyScore;
//Sleeping efficiency score, from the start of sleep to the first time into the deep sleep Sleeping efficiency score, from the start of sleep to the first time into the deep sleep efficiency
@property (nonatomic, strong) NSString *fallAsleepScore;
//Sleep duration score
@property (nonatomic, strong) NSString *sleepTimeScore;
//Exit sleep mode
@property (nonatomic, strong) NSString *exitSleepMode;
//Sleep quality 0 to 4, representing 1 to 5 stars respectively
@property (nonatomic, strong) NSString *sleepQuality;
//Number of getting up at night
@property (nonatomic, strong) NSString *getUpTimes;
//Deep and light sleep mode
@property (nonatomic, strong) NSString *deepAndLightMode;
//Total sleep time, in minutes
@property (nonatomic, strong) NSString *sleepDuration;
//Deep sleep time, in minutes
@property (nonatomic, strong) NSString *deepDuration;
//Light sleep time, in minutes
@property (nonatomic, strong) NSString *lightDuration;
//Time to wake up at night, in minutes, wake-up time
@property (nonatomic, strong) NSString *getUpDuration;
//Other sleep time, in minutes, REM period
@property (nonatomic, strong) NSString *otherDuration;
//Time to enter deep sleep for the first time, sleep efficiency
@property (nonatomic, strong) NSString *firstDeepDuration;
//Average value of time from waking up at night to deep sleep, sleep efficiency
@property (nonatomic, strong) NSString *getUpToDeepAve;
//Time represented by a point on the curve, in seconds, now 60s
@property (nonatomic, strong) NSString *onePointDuration;
//Accurate sleep type, 1 is accurate sleep, 0 is normal sleep
@property (nonatomic, strong) NSString *accurateType;
//Insomnia flag
@property (nonatomic, strong) NSString *insomniaTag;
//Insomnia score
@property (nonatomic, strong) NSString *insomniaScore;
//Number of insomnias
@property (nonatomic, strong) NSString *insomniaTimes;
//beginTime start time, how many minutes to start sleeping, endTime end time, how many minutes to start sleeping
@property (nonatomic, strong) NSArray *insomniaRecord;
//Sleep curve, hexadecimal string, converted into data stream when parsed by the client, each two bytes represent a point (one minute), the high bit is in front, the low bit is in the back, the high 3 bits represent the state of sleep, deep sleep (0), light sleep (1), rapid eye movement (2), insomnia (3), awake (4) For example, for the number 0x1000, take the high 3 bits 0x1000>>13, the value obtained depends on which one is between 0 and 4.
@property (nonatomic, strong) NSString *sleepLine;
//Insomnia duration converted according to the curve
@property (nonatomic, strong) NSString *insomniaDuration;
//These two fields, if lastType == 1, it means to be spliced with the previous sleep segment, if nextType==1, it means to be spliced with the next sleep segment, after splicing, except for falling asleep and waking up, which need to be modified, and the curve needs to be spliced, the rest use the last segment
@property (nonatomic, strong) NSString *lastType;
@property (nonatomic, strong) NSString *nextType;
@property (nonatomic, strong) NSString *mac;
@end
Sleep curve analysis method:
VPAccurateSleepModel
/*
sleepLine sleep curve analysis method, processed into a dictionary object, the data structure is
@{
@"index": 0, //NSNumber type index, corresponding to the number of minutes of data
@"type": 0 //NSNumber type current index of sleep state, deep sleep (0), light sleep (1), rapid eye movement (2), insomnia (3), awake (4)
}
Note: KH series does not have [rapid eye movement (2), insomnia (3)] two states
*/
- (NSArray<NSDictionary *> *)parseSleepLine;
- The device is connected
VPPeripheralModel
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage.peripheralModel
//Number of normal dials
@property (nonatomic, assign) NSUInteger dialCount;
//Number of market dials
@property (nonatomic, assign) NSUInteger marketDialCount;
//Number of photo dials
@property (nonatomic, assign) NSUInteger photoDialCount;
A value of 0 means that this function is not supported.
For example, marketDialCount = 0. This means that the device does not have the dial market function.
- The device is connected
- The device is not in the state of synchronizing daily data
- If the main control is on the JL (Jieli) platform, refer to the "Veepoo_iOS_2.2.XX集成文档.png" to import the libraries required by the manufacturer
⚠️ Note that if it is the Zhongke platform, the ABParTool.framework needs to be imported
VPPeripheralBaseManage
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
- (void)veepooSDK_dialChannelWithChannelModel:(VPDialChannelModel)model
dialType:(VPDeviceDialType)dialType
photoDialModel:(VPPhotoDialModel *)photoDialModel
result:(void (^)(VPPhotoDialModel *photoDialModel, VPDeviceMarketDialModel *deviceMarketDialModel, NSError *error))result
transformProgress:(void (^)(double progress))transformProgress;
Parameter | Parameter type | Remarks |
---|---|---|
model | VPDialChannelModel | Mode, enumeration definition as follows |
dialType | VPDeviceDialType | Dial type, enumeration definition as follows |
photoDialModel | VPPhotoDialModel | Photo dial model. Only required in VPDialChannelModelSetupPhotoDial mode |
result | void (^)(VPPhotoDialModel *photoDialModel, VPDeviceMarketDialModel *deviceMarketDialModel, NSError *error) | Callback function, invalid in VPDialChannelModelSetupPhotoDial mode. Different modes use different models |
transformProgress | void (^)(double progress) | Transmission progress callback function, only valid in VPDialChannelModelSetupPhotoDial |
typedef NS_ENUM(NSUInteger, VPDialChannelModel) {
VPDialChannelModelSetup = 1, // Setting mode for internal use
VPDialChannelModelRead, // Reading mode
VPDialChannelModelSetupPhotoDial, // Photo dial setting element mode
};
typedef NS_ENUM(NSUInteger, VPDeviceDialType) {
VPDeviceDialTypeDefault = 0, // Default burn-in dial
VPDeviceDialTypeMarket, // Market dial
VPDeviceDialTypePhoto, // Photo dial
};
Parameter | Parameter type | Remarks |
---|---|---|
photoDialModel | VPPhotoDialModel | Device photo dial data |
deviceMarketDialModel | VPDeviceMarketDialModel | Device market dial data |
progress | double | Photo dial setting progress |
error | NSError | Failure result callback |
@IBAction func readPhotoDialDetailInfo(_ sender: UIButton) {
VPBleCentralManage.sharedBleManager()?.peripheralManage.veepooSDK_dialChannel(with: .read, dialType: .photo, photoDialModel: nil, result: { [weak self](photoDialModel, deviceMarketDialModel, error) in
self?.photoDialModel = photoDialModel! as VPPhotoDialModel
}, transformProgress: nil);
}
- Need to get the device market dial data VPDeviceMarketDialModel in advance
- If the main control is on the JL (Jieli) platform, refer to the "Veepoo_iOS_2.2.XX集成文档.png" to import the libraries required by the manufacturer
⚠️ Note that if it is the Zhongke platform, the ABParTool.framework needs to be imported
VPMarketDialManager
- (void)getVeepooServerAllMarketDialsWithDeviceInfo:(VPDeviceMarketDialModel *)model
success:(void(^)(NSArray<VPServerMarketDialModel *> * _Nullable response))success
failure:(void(^)(NSError * _Nullable error, NSInteger errorcode))fairlure
Parameter | Parameter type | Remarks |
---|---|---|
model | VPDeviceMarketDialModel | Device market dial data |
success | void(^)(NSArray<VPServerMarketDialModel *> * _Nullable response) | Success callback |
fairlure | void(^)(NSError * _Nullable error, NSInteger errorcode) | Failure callback |
VPMarketDialManager.share().marketDialManager.getVeepooServerAllMarketDials(withDeviceInfo: deviceMarketDialModel) { [weak self](marketDialArray) in
guard let marketDialArray = marketDialArray else {
return
}
self?.marketDialArray = marketDialArray
if marketDialArray.count > 0 {
var str = ""
for item in marketDialArray {
str = str.appending("\(item.fileUrl) \n")
}
self?.textView.text = str
}
} failure: { (error, code) in
- You need to obtain the specified
market dial model
andmarket dial information read from the device
in advance
VPMarketDialManager
- (void)downloadMarketDialBinFileWithModel:(VPServerMarketDialModel *)model
deviceMarketDialModel:(VPDeviceMarketDialModel *)deviceMarketDialModel
success:(void(^)(NSURL * _Nullable filePath))success
failure:(void(^)(NSError * _Nullable error, NSInteger errorcode))fairlure;
Parameter | Parameter type | Remarks |
---|---|---|
model | VPServerMarketDialModel | Specified market dial model |
deviceMarketDialModel | VPDeviceMarketDialModel | The information read from the device is used for verification |
success | void(^)(NSURL * _Nullable filePath) | Success callback, returns filePath |
fairlure | void(^)(NSError * _Nullable error, NSInteger errorcode) | Failure callback |
VPMarketDialManager.share().downloadMarketDialBinFile(with: marketDialArray.first!, deviceMarketDialModel: deviceMarketDialModel) { [weak self](filePath) in
self?.filePath = filePath!
print("Download successful!")
} failure: { (error, code) in
}
-
The path of the bin file must be obtained in advance
-
The bin file path is obtained from the success callback in downloadMarketDialBinFileWithModel:success:failure: (download the market dial bin file)
-
Note
⚠️ The file name of the dial file cannot be modified, and the watch bottom layer will perform a check -
The watch has sufficient power. Note
⚠️ The dial transmission needs to add an abnormal protection scenario: when the watch power is very low, if the dial transmission is initiated, the watch may shut down due to low power during the transmission process. After recharging, the dial will turn black. We recommend that you read the current power of the watch before each transmission. If the power status is low, the transmission is prohibited.
VPMarketDialManager
- (void)startTransferWithFilePath:(NSURL *)filePath transformProgress:(void(^)(double progress))transformProgress failure:(void(^)(NSError * _Nullable error))fairlure;
Parameter | Parameter type | Remarks |
---|---|---|
filePath | NSURL | The path of the bin file. Obtained from the success callback in downloadMarketDialBinFileWithModel:success:failure: |
transformProgress | void(^)(double progress) | Transfer progress callback |
fairlure | void(^)(NSError * _Nullable error) | Error callback |
VPMarketDialManager.share().startTransfer(withFilePath: filePath) { (progress) in
print("Progress: \(progress * 100) %")
} failure: { (error) in
if error != nil{
print(error! as NSError)
}
}
- First, get the screen style setting interval according to screenTypes in VPPeripheralModel. If it is 3, it means that 1-3 can be set. If it is 0, it means that this function is not available.
VPPeripheralBaseManage
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
- (void)veepooSDKSettingDeviceScreenStyle:(int)screenStyle
settingMode:(NSUInteger)settingMode
dialType:(VPDeviceDialType)dialType
result:(void(^)(VPDeviceDialType dialType,int screenStyle, BOOL settingSuccess))settingScreenStyleWithDialTypeBlock;
Parameter | Parameter type | Remarks |
---|---|---|
screenStyle | int | Market dial/photo dial starts from 1, default dial starts from 0; pass 0 when reading |
settingMode | NSUInteger | 1 for setting, 2 for reading |
dialType | VPDeviceDialType | Dial type: 0 Default dial 1 Market dial 2 Photo dial |
settingScreenStyleWithDialTypeBlock | void(^)(VPDeviceDialType dialType,int screenStyle, BOOL settingSuccess) | Callback after setting, including setting success or failure and the style of the bracelet after setting |
VPBleCentralManage.sharedBleManager()?.peripheralManage.veepooSDKSettingDeviceScreenStyle(0, settingMode: 2, dialType: .market, result: { [weak self](dialType, screenStyle, settingSuccess) in
// print("Readed>> screenStyle: \(screenStyle), settingSuccess:\(settingSuccess)")
self?.dialTypeLabel.text = "\(dialType.rawValue) - \(screenStyle)"
})
- Used for K (Jerry) series devices, open Jerry's file system, CPUType==1 in the peripheral model indicates K (Jerry) series
VPMarketDialManager
- (void)openJLDialFileSystemWithAction:(void(^)(BOOL success))action;
Parameter | Parameter type | Remarks |
---|---|---|
action | void(^)(BOOL success) | Success or failure |
func openJLDialFileSystem(result: @escaping ((Bool) -> Void)) {
VPMarketDialManager.share().openJLDialFileSystem { isOpen in
result(isOpen)
}
}
- Used by K (Jerry) series devices, CPUType==1 in the peripheral model indicates K (Jerry) series
- Note
⚠️ Please call {@link openJLDialFileSystemWithAction:} to open the file system first
VPMarketDialManager
- (void)getJLWatchNamesWithAction:(void(^)(NSArray<NSString *> * _Nullable array))action
Parameter | Parameter type | Remarks |
---|---|---|
action | void(^)(NSArray<NSString *> * _Nullable array) | File name list |
- Used for K (Jerry) series devices, CPUType==1 in the peripheral model indicates K (Jerry) series
VPMarketDialManager
- (void)getJLCurrentPhotoAndMarketWatchNameWithArray:(NSArray<NSString *> *)array
result:(void(^)(NSString *_Nullable photoWatchName, NSString * _Nullable marketWatchName))result;
Parameter | Parameter type | Remarks |
---|---|---|
array | NSArray<NSString *> * | File list, please make sure the array to be transferred is not empty and contains WATCH elements |
result | void(^)(NSString *_Nullable photoWatchName, NSString * _Nullable marketWatchName) | Result callback of photo watch face and market watch face. If the photo watch face is empty, it means that there is no photo watch face in the project. If the market watch face is empty, it means that the device has not transferred the photo watch face at present |
- The device is connected
- Supports BT function
VPPeripheralModel
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage.peripheralModel
// Address book type, 1 means yes 0 means no
@property (nonatomic, assign) NSUInteger contactType;
- The device is connected
- BT is connected
- The device supports the contact function
VPPeripheralBaseManage
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
- (void)veepooSDKSettingDeviceContactsWithOpCode:(VPDeviceContactsOpCode)opCode
opModel:(VPDeviceContactsModel *)opModel
toID:(int)toID
resultBlock:(void(^)(VPDeviceContactsOpState state, NSArray<VPDeviceContactsModel *> *contactModels))resultBlock;
Parameter | Parameter type | Remarks |
---|---|---|
opCode | VPDeviceContactsOpCode | Operation type, all enumeration values are as follows |
opModel | VPDeviceContactsModel | Invalid when opCode is read |
toID | Int | Target ID is valid only for move operation |
resultBlock | void(^)(VPDeviceContactsOpState state, NSArray<VPDeviceContactsModel *> *contactModels) | Result callback |
// Device address book operation type
typedef NS_ENUM(NSUInteger, VPDeviceContactsOpCode) {
VPDeviceContactsOpCodeRead = 0, // Read
VPDeviceContactsOpCodeAdd, // Add
VPDeviceContactsOpCodeDelete, // Delete
VPDeviceContactsOpCodeMove // Move
};
Parameter | Parameter type | Remarks |
---|---|---|
state | VPDeviceContactsOpState | Address book operation state |
contactModels | NSArray<VPDeviceContactsModel *> | Array of contact models after operation returned by the device |
// Contacts operation status
typedef NS_ENUM(NSUInteger, VPDeviceContactsOpState) {
VPDeviceContactsOpStateNoFunction = 0, // This function is not supported
VPDeviceContactsOpStateReading, // Reading
VPDeviceContactsOpStateComplete, // Operation successful
VPDeviceContactsOpStateFailure // Operation failed
};
This function is attached to the contact. Setting the contact as an SOS contact can trigger an SOS call on the device
The contact function is available and the SOS function is supported. This can be determined by VPBleCentralManage.sharedBleManager().peripheralModel.contactType == 2
VPPeripheralBaseManage
/// Number of SOS calls made in the address book
/// @param opCode Operation type Read/Set
/// @param times Number, please limit it to [timesMin, timesMax] returned by resultBlock, only valid when setting
/// @param resultBlock result callback, when setting operation, timesMin and timesMax returned are 0
- (void)veepooSDKSettingDeviceContactsSOSInfoWithOpCode:(VPSOSOperationType)opCode
times:(int)times
resultBlock:(void(^)(VPDeviceContactsOpState state, int times, int timesMin, int timesMax))resultBlock;
Parameter | Parameter type | Remarks |
---|---|---|
opCode | VPSOSOperationType | Operation type |
times | int | Times, valid only when set |
resultBlock | Block | Result callback |
// SOS operation type
typedef NS_ENUM(NSUInteger, VPSOSOperationType) {
VPSOSOperationTypeSetting, // Set up
VPSOSOperationTypeRead // Read
};
Read
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSDKSettingDeviceContactsSOSInfo(withOpCode: .read, times: 0) { (state, curTime, timesMin, timesMax) in
if state == .complete {
print("curTime:\(curTime), timesMin:\(timesMin), timesMax:\(timesMax)")
}
}
Set up
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSDKSettingDeviceContactsSOSInfo(withOpCode: .setting, times: 2) { (state, curTime, timesMin, timesMax) in
if state == .complete {
print("curTime:\(curTime), timesMin:\(timesMin), timesMax:\(timesMax)")
}
}
The device is connected and supports this function. After the device clicks the find phone button, the interface below will trigger an event and the application layer will play an audio clip.
The event is triggered every 4 seconds, and the audio clip played should not exceed 3 seconds each time. Some devices will trigger once per second.
VPPeripheralBaseManage
//Receive the callback of the bracelet searching for the phone. You can set this property to monitor. The device will call back every 4 seconds during the process of searching for the phone. The user can play a 3-second audio after receiving the callback.
@property (nonatomic, copy) void(^ReceiveDeviceSearchIphoneCommand)(void);
none
none
// swift
VPBleCentralManage.sharedBleManager().peripheralManage.receiveDeviceSearchIphoneCommand = {
print("Play a 3-second piece of music")
}
- The device is connected
VPPeripheralModel
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage.peripheralModel
Mobile phone search bracelet function 0
represents no, 1
represents yes
@property (nonatomic, assign) NSUInteger searchDeviceFunction;
- The device is connected
- The device supports the mobile phone search function
VPPeripheralBaseManage
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
- (void)veepooSDK_searchDeviceFuntionWithState:(BOOL)open result:(void (^)(BOOL open, VPSearchDeviceFunctionState state))result;
Parameter | Parameter type | Remarks |
---|---|---|
open | BOOL | Turn on or off the phone's device search function |
result | void (^)(BOOL open, VPSearchDeviceFunctionState state) | open: whether to enable state: the phone's search status for the bracelet, the enumeration value list is as follows |
//Mobile phone searches for bracelet status
typedef NS_ENUM(NSUInteger, VPSearchDeviceFunctionState) {
VPSearchDeviceFunctionStateUnsupported, //Function not supported
VPSearchDeviceFunctionStateEnter, //Device enters search state
VPSearchDeviceFunctionStateExit, //Device exits search state
VPSearchDeviceFunctionStateTimeout, //Device search timeout
};
VPBleCentralManage.sharedBleManager()?.peripheralManage.veepooSDK_searchDeviceFuntion(withState: !sender.isSelected, result: { [weak self](start, state) in
print("state: \(state.rawValue)")
if state.rawValue == 2 || state.rawValue == 3 {//The device exits automatically or the search times out.
self?.searchDeviceBtn.isSelected = false
}
})
- The device is connected
VPPeripheralBaseManage
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
- (void)veepooSDKSettingMessageType:(VPSettingMessageSwitchType)messageType settingState:(VPSettingFunctionState)settingState completeBlock:(void(^)(VPSettingFunctionCompleteState completeState))settingCompleteBlock;
/// Message push (information reminder) batch processing interface, the push types that the device does not support will be automatically ignored
/// @param models array of push types to be processed
/// @param settingCompleteBlock setting status Block will be empty inside
- (void)veepooSDKBatchSettingWithMessageTypeModels:(NSArray<VPDeviceMessageTypeModel *> *)models
completeBlock:(void(^)(VPSettingFunctionCompleteState completeState))settingCompleteBlock;
Parameter | Parameter type | Remarks |
---|---|---|
messageType | VPSettingMessageSwitchType | Type of information to be set and read. All values are as follows |
settingState | VPSettingFunctionState | Set or read |
settingCompleteBlock | void(^)(VPSettingFunctionCompleteState completeState) | Callback for setting and reading completion, VPSettingFunctionCompleteState values are as follows |
typedef NS_ENUM(NSInteger, VPSettingMessageSwitchType) {//About the type of call reminder
VPSettingUnkonw = 1, //Unknown Type
VPSettingCall = 2, //Incoming call settings
VPSettingSMS,//SMS settings
VPSettingWechat,
VPSettingQQ,
VPSettingSina,
VPSettingFaceBook,
VPSettingTwitter,
VPSettingFlickr,
VPSettingLinkedln,
VPSettingwhatsapp,
VPSettingLine,
VPSettingInstagram,
VPSettingSnapchat,
VPSettingSkype,
VPSettingGMail,
VPSettingDingTalk,
VPSettingWeChatWork,
VPSettingOtherPlatform = 19,
// Second Package
VPSettingOtherTikTok = 20,
VPSettingOtherTelegram = 21,
VPSettingOtherConnected2 = 22,
VPSettingKakaoTalk = 23,
VPSettingJingYou = 24, // JingYou APP
VPSettingMessenger = 25,
VPSettingAll = 100,//Set all, read usage cannot use this
}
typedef NS_ENUM(NSInteger, VPSettingFunctionState) {//Set to get a function to read
VPReadFunctionState = 0, //Read the switch and existence of a function
VPSettingFunctionOpen = 1, //Open a function
VPSettingFunctionClose = 2, //Close a function
VPSettingFunctionCancel = 3, //Only dynamic blood pressure calibration is valid now
VPSettingFunction = 4, //Set a function
};
typedef NS_ENUM(NSInteger, VPSettingFunctionCompleteState) {//Set the state after a function is completed
VPFunctionCompleteUnknown = 0, //The device does not have this function
VPFunctionCompleteOpen = 1, //This function has been turned on
VPFunctionCompleteClose = 2, //This function has been turned off
VPFunctionCompleteFailure = 3, //Setting or reading failed
VPFunctionCompleteComplete = 4, //Setting completed, reply to Data setting
};
unowned let weakSelf = self
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSDKSettingMessageType(VPSettingMessageSwitchType.settingAll, settingState: VPSettingFunctionState(rawValue: sender.tag)!) { (settingFunctionCompleteState) in
switch settingFunctionCompleteState {
case .functionCompleteUnknown:
_ = AppDelegate.showHUD(message: "No such feature", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
case .functionCompleteFailure:
_ = AppDelegate.showHUD(message: "Setup failed", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
case .functionCompleteOpen:
_ = AppDelegate.showHUD(message: "Setup successful, opened", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
weakSelf.messageRemindTableView?.reloadData()
case .functionCompleteClose:
_ = AppDelegate.showHUD(message: "Setup successful, closed", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
weakSelf.messageRemindTableView?.reloadData()
case .functionCompleteComplete:
_ = AppDelegate.showHUD(message: "Setup complete", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
weakSelf.messageRemindTableView?.reloadData()
}
}
- The device is connected
VPPeripheralModel
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage.peripheralModel
The chip type of the device. Starting from the Jerry series, 1 indicates the Jerry series
CPUType =
1
means Bluetooth communication is supported, and the rest means it is not supported
@property (nonatomic, assign) NSUInteger CPUType;
- The device is connected and supports this function
VPPeripheralBaseManage
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
Turn on the BT switch of the device. If the device is not paired with the mobile phone system, a pairing request will be triggered.
The connection status of BT is uniformly judged using {@link VPBTConnectStateChangeBlock}
- (void)veepooSDK_openDeviceBTSwitch;
- The device is connected and supports this function
VPPeripheralBaseManage
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
Callback when the device BT connection status changes
@property (nonatomic, copy) void(^VPBTConnectStateChangeBlock)(VPDeviceBTState btState, BOOL btSwitchOpen, BOOL mediaSwitchOpen);
Parameter | Parameter Type | Remarks |
---|---|---|
btState | VPDeviceBTState | BT connection status |
btSwitchOpen | BOOL | Whether the BT switch of the device is turned on |
mediaSwitchOpen | BOOL | Whether to play mobile media audio through the device |
typedef NS_ENUM(NSInteger, VPDeviceBTState) {
VPDeviceBTStateDisConnect = 0, //Disconnected
VPDeviceBTStateConnected, //Connected
VPDeviceBTStateAdvertising, //Advertising
};
Note
-
SDK users need to integrate the manufacturer's DFU library of the product
-
The OTA process is long. If the battery is low, the transmission process may shut down due to low power. It is recommended that the battery power is above 30% before the upgrade is allowed;
- The device is connected
VPPeripheralModel
How to get it:VPBleCentralManage.sharedBleManager().peripheralModel
//The device's display version tells the user what the current version is
@property (nonatomic, strong, readonly) NSString *deviceVersion;
currentVersionLabel.text = "Current version: " + VPBleCentralManage.sharedBleManager().peripheralModel.deviceVersion
- The device is connected
VPPeripheralModel
How to get it:VPBleCentralManage.sharedBleManager().peripheralModel
//Device network upgrade version. When the user receives a new firmware version, the user will be informed of the upgraded version.
@property (nonatomic, strong, readonly) NSString *deviceNetVersion;
//Device upgrade update version description, multiple descriptions are separated by the $ symbol, and multiple descriptions can be split by $
@property (nonatomic, strong) NSString *deviceNetVersionDes;
if VPBleCentralManage.sharedBleManager().peripheralModel.deviceNetVersion == nil {
updateVersionLabel.text = "Upgraded version: " + "No new version"
}else {
// Upgrade version and upgrade new firmware description
updateVersionLabel.text = "Upgraded version: " + VPBleCentralManage.sharedBleManager().peripheralModel.deviceNetVersion
updateDesTextView.text = VPBleCentralManage.sharedBleManager().peripheralModel.deviceNetVersionDes.replacingOccurrences(of: "$", with: "\n")
}
- The device is connected
- There is new firmware available for upgrade
VPDFUOperation
/// Check whether the current device has a new firmware version. Please use this interface in production environment. For testing, you can use {@link checkDeviceOTAInfoWithDebug:downloadProgress:completionHandler:}
/// @param downloadProgressBlock firmware download progress
/// @param completionHandler request completion handler. If newVersion is not empty, it means there is a new firmware.
- (void)checkDeviceOTAInfoWithDownloadProgress:(void (^)(NSProgress *downloadProgress))downloadProgressBlock
completionHandler:(void (^)(NSString *newVersion, NSString *des, NSError *error))completionHandler;
/// Check if the current device has a new firmware version
/// @param debug is the test environment, ⚠️ note that the production environment cannot use yes
/// @param downloadProgressBlock firmware download progress
/// @param completionHandler request completion handler, newVersion is not empty to indicate new firmware
- (void)checkDeviceOTAInfoWithDebug:(BOOL)debug
downloadProgress:(void (^)(NSProgress *downloadProgress))downloadProgressBlock
completionHandler:(void (^)(NSString *newVersion, NSString *des, NSError *error))completionHandler;
/**
Interface for upgrading. SDK can automatically obtain firmware from our server and upgrade directly.
@param dfuBlock returns the status and progress of the block
*/
- (void)veepooSDKStartDfu:(DeviceDFUBlock)dfuBlock;
typedef void(^DeviceDFUBlock)(double progress, DeviceDFUState deviceDFUState);
Parameter | Parameter type | Remarks |
---|---|---|
progress | double | Upgrade progress |
deviceDFUState | DeviceDFUState | Upgrade status, all enumeration values are as follows |
typedef NS_ENUM(NSInteger, DeviceDFUState) {
DeviceDFUFileNotExist = 0, //Upgrade file does not exist
DeviceDFUStart, //Start upgrading
DeviceDFUUpdating, //Upgrading
DeviceDFUSuccess, //Upgrade successful
DeviceDFUFailure, //Upgrade failed
DeviceDFUPrepared, //Data verification of K series devices completed
DeviceDFUReboot //K series device restart
};
VPDFUOperation.dfuOperationShare().veepooSDKStartDfu { (dfuProgress, deviceDFUState) in
switch deviceDFUState {
case .fileNotExist:
sender.isSelected = false
_ = AppDelegate.showHUD(message: "The upgrade file does not exist and cannot be upgraded.", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
case .start:
_ = AppDelegate.showHUD(message: "Start Upgrading", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
case .updating:
weakSelf.dfuProgressLabel.text = "Upgrade Progress: " + String(dfuProgress) + "%"
case .success:
sender.isSelected = false
_ = AppDelegate.showHUD(message: "Upgrade Successfully", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
case .failure:
sender.isSelected = false
_ = AppDelegate.showHUD(message: "Upgrade Failed", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
}
}
- The device is connected
VPDFUOperation
/// Developers pass in the upgrade file path to upgrade
/// @param dfuBlock upgrade callback, if the file path does not exist or the file format is incorrect, the file path does not exist will be returned
- (void)veepooSDKStartDfuWithFilePath:(NSString *)filePath result:(DeviceDFUBlock)dfuBlock;
Parameter | Parameter Type | Remarks |
---|---|---|
filePath | NSString | Upgrade file path |
dfuBlock | void(^DeviceDFUBlock)(double progress, DeviceDFUState deviceDFUState) | Specific explanation is the same as the callback Parameter Explanation in remote OTAInterface |
VPDFUOperation.dfuOperationShare().veepooSDKStartDfu(withFilePath: filePath) { (dfuProgress, deviceDFUState) in
switch deviceDFUState {
case .fileNotExist:
sender.isSelected = false
_ = AppDelegate.showHUD(message: "The upgrade file does not exist and cannot be upgraded.", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
case .start:
_ = AppDelegate.showHUD(message: "Start Upgrading", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
case .updating:
weakSelf.dfuProgressLabel.text = "Upgrade Progress: " + String(dfuProgress) + "%"
case .success:
sender.isSelected = false
_ = AppDelegate.showHUD(message: "Upgrade Successfully", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
case .failure:
sender.isSelected = false
_ = AppDelegate.showHUD(message: "Upgrade Failed", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
}
}
The device is connected and supports this function.
Note that this interface does not have a flag to determine whether the device supports sedentary. To determine whether the device supports sedentary, you can use the interface to read the information. If the callback fails, it means that the device does not support this interface.
VPPeripheralBaseManage
- (void)veepooSDKSettingDeviceLongSeatWithLongSeatModel:(VPDeviceLongSeatModel *)longSeatModel
settingMode:(NSUInteger)settingMode
successResult:(void(^)(VPDeviceLongSeatModel *longSeatModel))settingLongSeatResultBlock
failureResult:(void(^)(void))settingLongSeatFailureBlock;
Parameter name | Type | Remarks |
---|---|---|
longSeatModel | VPDeviceLongSeatModel | Long-sitting model instance, see the table below |
settingMode | NSUInteger | Setting mode, 0 for off, 1 for on, 2 for reading |
settingLongSeatResultBlock | Block | Success result callback |
settingLongSeatFailureBlock | Block | Failure callback |
VPDeviceLongSeatModel
Parameter name | Type | Remarks |
---|---|---|
longSeatStartHour | NSUInteger | The hour when the sedentary reminder starts. The range is 0-23 |
longSeatStartMinute | NSUInteger | The minute when the sedentary reminder starts. The range is 0-59 |
longSeatEndHour | NSUInteger | The hour when the sedentary reminder ends. The range is 0-23 |
longSeatEndMinute | NSUInteger | The minute when the sedentary reminder ends. The range is 0-59 |
longSeatGateValue | NSUInteger | The gate value of the sedentary reminder in minutes. The range is [30 240] |
longSeatState | NSUInteger | This is the state of the sedentary reminder, 0 means off and 1 means on |
Success will triggersettingLongSeatResultBlock
Failure will triggersettingLongSeatFailureBlock
// swift
//Initialize the longSeatModel
let longSeatModel = VPDeviceLongSeatModel(longSeatStartHour: 2, longSeatStartMinute: 30, longSeatEndHour: 18, longSeatEndMinute: 50, longSeatGateValue: 30, longSeatState: 1)
//Setup
unowned let weakSelf = self;
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSDKSettingDeviceLongSeat(with: longSeatModel, settingMode: 1, successResult: { (longSeatModel) in
_ = AppDelegate.showHUD(message: "longSeat settings success", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
}) {
_ = AppDelegate.showHUD(message: "longSeat settings failed", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
}
Note that there are multiple versions of the alarm function of the device, and different versions of alarms will not exist at the same time. For example, if the device supports scene alarms, it does not support text alarms
The text alarm allows the device to operate the switch, time setting, etc., but text cannot be entered.
The device is connected and supports this function
VPPeripheralBaseManage
,可以参考SDK DEMO的 VPTextAlarmClockSettingController
类实现
The device supports up to 10 sets of alarms. The application layer adds logic to limit the number of alarms that can be added. Otherwise, the device may malfunction.
If settingTextAlarmResultBlock is not empty, operating the alarm status on the device side will trigger a callback and synchronize the data to the application layer
- (void)veepooSDKSettingDeviceTextAlarmWithTextAlarmModel:(VPDeviceTextAlarmModel *)alarmModel
settingMode:(VPDeviceTextAlarmSettingModel)settingMode
successResult:(void(^)(NSArray *alarmArray))settingTextAlarmResultBlock
failureResult:(void(^)(void))settingTextAlarmFailureBlock;
Parameter name | Type | Remarks |
---|---|---|
alarmModel | VPDeviceTextAlarmModel | Text alarm object, cannot be empty, the default object initialized when reading |
settingMode | VPDeviceTextAlarmSettingModel | 1 means deleting this alarm group, 2 means setting (adding or modifying), 3 means reading |
settingTextAlarmResultBlock | Block | Setting or reading successfully, returns the current number of all alarms |
settingTextAlarmFailureBlock | Block | Setting or reading alarm failed |
// Text alarm setting mode
typedef NS_ENUM(NSUInteger, VPDeviceTextAlarmSettingModel) {
VPDeviceTextAlarmSettingModelDelete = 1,
VPDeviceTextAlarmSettingModelAddOrChange,
VPDeviceTextAlarmSettingModelRead
};
Array of text alarm objects
Parameter name | Type | Remarks |
---|---|---|
alarmHour | NSString | Alarm hour |
alarmMinute | NSString | Alarm minute |
alarmState | NSString | Alarm state, 0 for off, 1 for on |
alarmID | NSString | Alarm ID, this is needed for adding, deleting, modifying, and checking |
repeatState | NSString | Alarm repeat state, see the explanation below the table for details |
alarmText | NSString | Alarm reminder text, up to 60 bytes |
alarmDate | NSString | Alarm reminder date, invalid field |
Alarm repeat state, 0 means no repeat. The date to set an alarm reminder. In other cases, it is a string converted from 8-bit binary to decimal, such as: 00000011, which means the repeating days are Monday and Tuesday, and repeatState is 3; binary is pushed forward from the back, the first digit at the beginning is always 0, the others represent Monday to Sunday, the second digit is Sunday, and the last digit is Monday. 1 means repeat, and 0 means no repeat this week
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSDKSettingDeviceTextAlarm(with: VPDeviceTextAlarmModel(), settingMode: .read) { arr in
// success
} failureResult: {
// fail
}
The new alarm is a design relative to the old alarm, not the latest version. It is equivalent to scene alarm and label alarm.
VPPeripheralBaseManage
Refer to SDK Demo VPEditNewAlarmController
implementation
- (void)veepooSDKSettingDeviceNewAlarmWithNewAlarmModel:(VPDeviceNewAlarmModel *)alarmModel
settingMode:(NSUInteger)settingMode
successResult:(void(^)(NSArray *alarmArray))settingNewAlarmResultBlock
failureResult:(void(^)(void))settingNewAlarmFailureBlock;
Parameter name | Type | Remarks |
---|---|---|
alarmModel | VPDeviceNewAlarmModel | Model of the new alarm, cannot be empty, pass the default value when reading |
settingMode | NSUInteger | 0 means deleting this alarm group, 1 means setting (adding or modifying), 2 means reading |
settingNewAlarmResultBlock | Block | Setting or reading successfully, returns the number of all current alarms |
settingNewAlarmFailureBlock | Block | Setting or reading alarms failed |
Scene alarm object array
Parameter name | Type | Remarks |
---|---|---|
alarmHour | NSString | Alarm hour |
alarmMinute | NSString | Alarm minute |
alarmState | NSString | Alarm state, 0 for off, 1 for on |
alarmID | NSString | Alarm ID, this is needed for adding, deleting, modifying, and checking |
repeatState | NSString | Alarm repeat state, see the explanation below the table for details |
alarmScene | NSString | Alarm reminder scene, 1-20, scene alarm icons are obtained from Demo, do not mix, the bracelet end is based on this one-to-one correspondence |
alarmDate | NSString | Alarm reminder date, valid for single reminder, repeat weekly reminder defaults to 0000-00-00, all formats are like this |
Alarm repeat state, 0 means no repeat. The date to set an alarm reminder. In other cases, it is a string converted from 8-bit binary to decimal, such as: 00000011, which means the repeating days are Monday and Tuesday, and repeatState is 3; binary is pushed forward from the back, the first digit at the beginning is always 0, the others represent Monday to Sunday, the second digit is Sunday, and the last digit is Monday. 1 means repeat, and 0 means no repeat this week
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSDKSettingDeviceNewAlarm(with: VPDeviceNewAlarmModel(), settingMode: 1) { arr in
// success
} failureResult: {
// fail
}
The device is connected and supports this function. The female function is a restricted function of the SDK. You need to contact our business first for business connection.
If the permission is not enabled, the function of the corresponding interface cannot take effect.
VPPeripheralBaseManage
, refer to SDK Demo VPSettingFemaleRelatedController
class implementation
- (void)veepooSDKSettingDeviceFemaleWithFemaleModel:(VPDeviceFemaleModel *)femaleModel
settingMode:(NSUInteger)settingMode
successResult:(void(^)(VPDeviceFemaleModel *deviceFemaleModel))settingFemaleResultBlock
failureResult:(void(^)(void))settingFemaleFailureBlock;
Parameter name | Type | Remarks |
---|---|---|
femaleModel | VPDeviceFemaleModel | Female function object instantiation, see the table below |
settingMode | NSUInteger | Setting mode 0 means off 1 means on 2 means read device female information |
settingFemaleResultBlock | Block | Setting or reading success |
settingFemaleFailureBlock | Block | Setting or reading failure |
VPDeviceFemaleModel
Parameter name | Type | Remarks |
---|---|---|
femaleState | VPDeviceFemaleState | Which menstrual period is it in |
lastMenstrualDate | NSString | Last menstrual date format yyyy-MM-dd |
menstrualCircle | NSInteger | Menstrual cycle |
menstrualDays | NSInteger | Menstrual days |
currentMenstrualDays | NSInteger | Current menstrual days. MenstrualDays is the number of days in a person's regular menstrual period, such as 5 days, but this month may have one day less or one day more, so this attribute is added. This attribute is valid on color screen projects |
expectedDateOfChildbirth | NSString | Expected date of birth |
babyBirthday | NSString | Baby's birthday format yyyy-MM-dd |
isGirl | BOOL | Is the baby a girl? |
typedef NS_ENUM(NSInteger,VPDeviceFemaleState) {//Which physiological period does the female project belong to
VPDeviceFemaleStateNone = 0, //No physiological period is set
VPDeviceFemaleStateMenstrual, //Menstrual period
VPDeviceFemaleStatePregnancy, //Pregnancy period
VPDeviceFemaleStateGestation, //Pregnancy period
VPDeviceFemaleStateBaoma, //Hot mom period
};
Success triggers the settingFemaleResultBlock
callback, and failure triggers the settingFemaleFailureBlock
callback
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSDKSettingDeviceFemale(with: femaleModel, settingMode: 2, successResult: { (deviceFemaleModel) in
guard let deviceFemaleModel = deviceFemaleModel else {
return
}
weakSelf.femaleModel = deviceFemaleModel
weakSelf.femaleRelatedTableView?.reloadData()
_ = AppDelegate.showHUD(message: "Read Success", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
}) {
_ = AppDelegate.showHUD(message: "Read failed", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
}
The device is connected and supports this function. This function requires the customer to design and implement the in-app photo function. The main function of the bracelet is to control the photo moment. After entering the photo mode, click the photo button on the bracelet or shake it. The SDK will receive a photo trigger event, and the application layer can trigger the photo.
VPPeripheralBaseManage
- (void)veepooSDKSettingCameraType:(VPCameraType)settingType settingAndMonitorResult:(void(^)(VPCameraType cameraType))cameraBlock;
Parameter name | Type | Remarks |
---|---|---|
settingType | VPCameraType | VPCameraType enumeration |
cameraBlock | Block | Result callback |
typedef NS_ENUM(NSInteger,VPCameraType) {
VPCameraTypeExit = 0, //Exit photo taking
VPCameraTypeEnter = 1, //Enter photo taking
VPCameraTypePhoto = 2 //Start photo taking
};
If the device supports taking photos, the cameraBlock callback will be triggered
// swift
VPPeripheralManage.shareVPPeripheralManager().veepooSDKSettingCameraType(.enter) { type in
print(type.rawValue)
}
The device is connected and supports this function
VPDataBaseOperation
、VPPeripheralBaseManage
// First call this Interface to synchronize data from the device to the SDK
- (void)veepooSDKStartReadDeviceRunningData:(void(^)(VPReadDeviceBaseDataState readState, NSUInteger totalTimes, NSUInteger currentReadTimes, NSUInteger readCurrentTimesProgress))readDeviceRunningBlock;
// Read data from the SDK database
+ (NSArray *)veepooSDKGetDeviceRunningDataWithDate:(NSString *)queryDate andTableID:(NSString *)tableID;
Parameter name | Type | Remarks |
---|---|---|
queryDate | NSString | The date to be queried, in the format: yyyy-MM-dd |
tableID | NSString | The mac address of the device |
[{
aerobTime = 1260;
averHeart = 81;
averPace = 0;
beginTime = "2023-05-17 20:16:25";
crcValue = 47136;
endTime = "2023-05-17 20:37:33";
isHide = 0;
oneMinuteData = (
{
calValue = 0;
disValue = 0;
heartValue = 86;
isPause = 0;
packageCount = 00001;
sportValue = 5;
stepValue = 0;
}
);
pauseCount = 0;
pauseTotalTime = 0;
recordCount = 5376;
totalCal = 0;
totalDis = 0;
totalSport = 124;
totalStep = 0;
totalTime = 1268;
type = 1;
}]
Parameter name | Type | Remarks |
---|---|---|
beginTime | NSString | Start time |
endTime | NSString | End time |
averHeart | NSString | Average heart rate |
averPace | NSString | Average pace |
pauseCount | NSString | Number of pauses |
pauseTotalTime | NSString | Pause duration |
recordCount | NSString | Record |
totalCal | NSString | Total calories, unit cal |
totalDis | NSString | Total distance, unit m |
totalSport | NSString | Total amount of exercise |
totalStep | NSString | Total number of steps |
totalTime | NSString | Total exercise time |
type | VPDeviceRuningMode | Exercise type |
oneMinuteData | NSArray | Array, data structure for each minute |
crcValue | NSString | crc value of the movement |
Data structure for each minute
Parameter name | Type | Remarks |
---|---|---|
heartValue | NSString | Heart rate |
disValue | NSString | Mileage |
calValue | NSString | Calories |
isPause | NSString | Pause or not |
packageCount | NSString | Current package number, no processing required |
sportValue | NSString | Amount of exercise |
stepValue | NSString | Number of steps |
// Read running data
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSDK_readDeviceRunningData(withBlockNumber: 0) { (deviceRunningDict, totalPackage, currentPackage) in
if currentPackage >= totalPackage {
print(deviceRunningDict ?? "No Running Data")
}else {
print("totalPackage:\(totalPackage) currentPackage:\(currentPackage)")
}
}
// Get a single day's Running Data from the database
let arr = VPDataBaseOperation.veepooSDKGetDeviceRunningData(withDate: 0.getOneDayDateString(), andTableID: VPBleCentralManage.sharedBleManager().peripheralModel.deviceAddress)
The device is connected and supports this function
VPPeripheralBaseManage
Please note that the equipment does not contain all types of sports. Different items have different types of sports. And the sports modes need to correspond one to one.
- (void)veepooSDKSettingDeviceRunning:(int)settingType
runMode:(VPDeviceRuningMode)runningMode
result:(void(^)(int runningType, BOOL settingSuccess))runningResultBlock;
Monitor the end of the wristband exercise event on the device, block triggers the callback, and can call the data reading interface
/// Callback when the device ends a set of motion and generates valid data
@property (nonatomic, copy) void(^deviceSportDidFinishBlock)(BOOL success);
Parameter name | Type | Remarks |
---|---|---|
settingType | int | 0 is to turn off the motion mode, 1 is to turn on the motion mode, 2 is to read the current device motion mode |
runningMode | VPDeviceRuningMode | Refer to the enumeration for details. If it is not multi-sport, give 0. For the method of judging multi-sport, see the runningType property description under VPPeripheralModel |
runningResultBlock | Block | Setting and reading results |
typedef NS_ENUM(NSInteger,VPDeviceRuningMode) {//Sport mode type
VPDeviceRuningModeCommon = 0, //Normal single sports mode
VPDeviceRuningModeOutdoorRun, //Outdoor running
VPDeviceRuningModeOutdoorWalk, //Outdoor walking
VPDeviceRuningModeIutdoorRun, //Indoor running
VPDeviceRuningModeIutdoorWalk, //Indoor walking
VPDeviceRuningModeHiking, //Hiking
VPDeviceRuningModeStairStepper, //Stepper
VPDeviceRuningModeOutdoorCycle, //Outdoor cycling
VPDeviceRuningModeStationaryBike, //Indoor cycling
VPDeviceRuningModeElliptical, //Elliptical machine
VPDeviceRuningModeRowingMachine, //Rowing machine
VPDeviceRuningModeMountaineering, //Mountaineering
VPDeviceRuningModeSwim, //Swimming
VPDeviceRuningModeSitUps, //Sit-ups
VPDeviceRuningModeSki, //Skiing
VPDeviceRuningModeJumpRope, //Rope skipping
VPDeviceRuningModeYoga, //Yoga
VPDeviceRuningModePingpong, //Table tennis
VPDeviceRuningModeBasketball, //Basketball
VPDeviceRuningModeVolleyball, //Volleyball
VPDeviceRuningModeFootball, //Football
VPDeviceRuningModeBadminton, //Badminton
VPDeviceRuningModeTennis, //Tennis
VPDeviceRuningModeClimbStairs, //Climbing stairs
VPDeviceRuningModeFitness, //Fitness
VPDeviceRuningModeWeightlifting, //Weightlifting
VPDeviceRuningModeDiving, //Diving
VPDeviceRuningModeBoxing, //Boxing
VPDeviceRuningModeGymBall, //Fitness ball
VPDeviceRuningModeSquatTraining, //Squat training
VPDeviceRuningModeTriathlon, //Triathlon
VPDeviceRuningModeDance, //Dance
VPDeviceRuningModeHIIT, //HIIT
VPDeviceRuningModeRockClimbing, //Rock climbing
VPDeviceRuningModeSports, //Athletics
VPDeviceRuningModeBalls, //Ball games
VPDeviceRuningModeFitnessGame, //Fitness games
VPDeviceRuningModeFreeTime, //Free time
VPDeviceRuningModeAerobics, //Aerobics
VPDeviceRuningModeGymnastics, //Gymnastics
VPDeviceRuningModeFloorExercise, //Floor exercises
VPDeviceRuningModeHorizontalBar, //Horizontal bar
VPDeviceRuningModeParallelBars, //Parallel bars
VPDeviceRuningModeTrampoline, //Trampoline
VPDeviceRuningModeTrackAndField, //Athletics
VPDeviceRuningModeMarathon, //Marathon
VPDeviceRuningModePushUps, //Pushups
VPDeviceRuningModeDumbbel, //Dumbbell
VPDeviceRuningModeRugbyFootball, //Rugby
VPDeviceRuningModeHandball, //Handball
VPDeviceRuningModeBaseballSoftball, //Baseball
VPDeviceRuningModeBaseball, //Baseball
VPDeviceRuningModeHockey, //Hockey
VPDeviceRuningModeGolf, //Golf
VPDeviceRuningModeBowling, //Bowling
VPDeviceRuningModeBilliards, //Billiards
VPDeviceRuningModeRowing, //Rowing
VPDeviceRuningModeSailboat, //Sailing
VPDeviceRuningModeSkate, //Ice skating
VPDeviceRuningModeCurling, //Curling
VPDeviceRuningModePuck, //Ice hockey
VPDeviceRuningModeSled, //Sled
VPDeviceRuningModeStrongWalk, //Strong walking
VPDeviceRuningModeTreadmill, //Treadmill
VPDeviceRuningModeTrailRunning, //Cross-country running
VPDeviceRuningModeRaceWalking, //Race walking
VPDeviceRuningModeMountainBiking, //Mountain biking
VPDeviceRuningModeBmx, //BMX
VPDeviceRuningModeOrienteering, //Orienteering
VPDeviceRuningModeFishing, //Fishing
VPDeviceRuningModeHunt, //hunting
VPDeviceRuningModeSkateboard, //skateboard
VPDeviceRuningModeRollerSkating, //roller skating
VPDeviceRuningModeParkour, //parkour
VPDeviceRuningModeAtv, //beach buggy
VPDeviceRuningModeMotocross, //off-road motorcycle
VPDeviceRuningModeClimbingMachine, //stair climbing machine
VPDeviceRuningModeSpinningBike, //spinning bike
VPDeviceRuningModeIndoorFitness, //indoor fitness
VPDeviceRuningModeMixedAerobic, //mixed aerobic
VPDeviceRuningModeCrossTraining, //cross training
VPDeviceRuningModeBodybuildingExercise, //fitness exercise
VPDeviceRuningModeGroupGymnastics, //group exercise
VPDeviceRuningModeKickboxing, //kickboxing exercise
VPDeviceRuningModeStrengthTraining, //Strength training
VPDeviceRuningModeSteppingTraining, //Stepping training
VPDeviceRuningModeCoreTraining, //Core training
VPDeviceRuningModeFlexibilityTraining, //Flexibility training
VPDeviceRuningModeFreeTraining, //Free training
VPDeviceRuningModePilates, //Pilates
VPDeviceRuningModeBattleRope, //Battle rope
VPDeviceRuningModeStretch, //Stretching
VPDeviceRuningModeSquareDance, //Square dance
VPDeviceRuningModeBallroomDancing, //Ballroom dance
VPDeviceRuningModeBellyDance, //Belly dance
VPDeviceRuningModeBallet, //Ballet
VPDeviceRuningModeHipHop, //Street dance
VPDeviceRuningModeZumba, //Zumba
VPDeviceRuningModeLatinDance, //Latin dance
VPDeviceRuningModeJazz, //Jazz dance
VPDeviceRuningModeHipHopDance, //Hip-hop dance
VPDeviceRuningModePoleDancing, //Pole dance
VPDeviceRuningModeBreakDance, //Break dance
VPDeviceRuningModeNationalDance, //National dance
VPDeviceRuningModeModernDance, //Modern dance
VPDeviceRuningModeDisco, //Disco
VPDeviceRuningModeTapDance, //Tap dance
VPDeviceRuningModeWrestling, //Wrestling
VPDeviceRuningModeMartialArts, //Martial Arts
VPDeviceRuningModeTaiChi, //Taichi
VPDeviceRuningModeMuayThai, //Muay Thai
VPDeviceRuningModeJudo, //Judo
VPDeviceRuningModeTaekwondo, //Taekwondo
VPDeviceRuningModeKarate, //Karate
VPDeviceRuningModeFreeSparring, //Free Sparring
VPDeviceRuningModeSwordsmanship, //Swordsmanship
VPDeviceRuningModeJujitsu, //Jujitsu
VPDeviceRuningModeFencing, //Fencing
VPDeviceRuningModeBeachSoccer, //Beach Soccer
VPDeviceRuningModeBeachVolleyball, //Beach Volleyball
VPDeviceRuningModeSoftball, //Softball
VPDeviceRuningModeSquash, //Squash
VPDeviceRuningModeCroquet, //Croquet
VPDeviceRuningModeCricket, //Cricket
VPDeviceRuningModePolo, //Polo
VPDeviceRuningModeWallball, //Wallball
VPDeviceRuningModeTakrawBall, //Sepakraw
VPDeviceRuningModeDodgeball, //Dodgeball
VPDeviceRuningModeWaterPolo, //Water Polo
VPDeviceRuningModeShuttlecock, //Shuttlecock
VPDeviceRuningModeIndoorSoccer, //Indoor Soccer
VPDeviceRuningModeSandbagBall, //Sandbag
VPDeviceRuningModeBocceBall, //Bocce
VPDeviceRuningModeJaileyball, //Plait
VPDeviceRuningModeFloorball, //Floorball
VPDeviceRuningModeOutdoorBoating, //Outdoor Boating
VPDeviceRuningModeKayak, //Kayaking
VPDeviceRuningModeDragonBoat, //Dragon Boat
VPDeviceRuningModePaddleBoard, //Paddle board surfing
VPDeviceRuningModeIndoorFillingWaves, //Indoor filling waves
VPDeviceRuningModeDrifting, //Rafting
VPDeviceRuningModeWaterSkiing, //Water skiing
VPDeviceRuningModeSnowboarding, //Snowboarding
VPDeviceRuningModeSnowboard, //Snowboarding
VPDeviceRuningModeAlpineSkiing, //Alpine skiing
VPDeviceRuningModeCrossCountrySkiing, //Cross-country skiing
VPDeviceRuningModeOrienteeringSki, //Orienteering skiing
VPDeviceRuningModeBathlon, //Biathlon
VPDeviceRuningModeOutdoorSkating, //Outdoor skating
VPDeviceRuningModeIndoorSkating, //Indoor skating
VPDeviceRuningModeSnowCar, //Snowmobile
VPDeviceRuningModeSnowmobile, //Snowmobile
VPDeviceRuningModeSnowshoeing, //Snowshoeing
VPDeviceRuningModeHulaHoop, //Hula Hoop
VPDeviceRuningModeFrisbee, //Frisbee
VPDeviceRuningModeDart, //Darts
VPDeviceRuningModeFlyAKite, //Kite Flying
VPDeviceRuningModeTugOfWar, //Tug of War
VPDeviceRuningModeShuttlecockKicking, //Shuttlecock Kicking
VPDeviceRuningModeESports, //Esports
VPDeviceRuningModeWanderingMachine, //Wandering Machine
VPDeviceRuningModeSwing, //Swing
VPDeviceRuningModeShuffleboard, //Shuffleboard
VPDeviceRuningModeTableSoccer, //Table Football
VPDeviceRuningModeSomatosensoryGame, //Sensory Game
VPDeviceRuningModeInternationalChess, //International Chess
VPDeviceRuningModeDraughts, //Draughts
VPDeviceRuningModeGo, //Go
VPDeviceRuningModeBridge, //Bridge
VPDeviceRuningModeBoardGame, //Board Games
VPDeviceRuningModeArchery, //Archery
VPDeviceRuningModeEquestrianSports, //Equestrian Sports
VPDeviceRuningModeClimbingTheStairs, //Stairs Climbing
VPDeviceRuningModeDrive, //Driving
VPDeviceRuningModeSeatedPush, //Seated Press
VPDeviceRuningModeSeatedChestPress, //Seated Chest Press
VPDeviceRuningModeBarbell, //Barbell
VPDeviceRuningModeLongDistanceRunning, //Long Distance Running
VPDeviceRuningModeFullSpeedRun, //Full Speed Running
VPDeviceRuningModeVariableSpeedRun, //Variable Speed Running
VPDeviceRunningModeRaceRiding, //Cycling on the track
VPDeviceRuningModeMilitaryChess, //Military chess
VPDeviceRuningModeMahjong, //Mahjong
VPDeviceRuningModePoker, //Poker
VPDeviceRuningModeGobang, //Gobang
VPDeviceRuningModeChineseChess, //Chinese chess
VPDeviceRuningModeHighJump, //High jump
VPDeviceRuningModeLongJump, //Long jump
VPDeviceRuningModeSpinningTop, //Spinning top
};
runningResultBlock
Parameter name | Type | Remarks |
---|---|---|
runningType | int | runningType is 0 for not in exercise mode, 1 for exercise mode, 2 for other busy states, and 3 for the end of exercise mode and the App is notified when the connection is active. This parameter is only used as a reference when reading or setting fails, or when the exercise is actively reported. |
settingSuccess | BOOL | Whether the setting or reading is successful. If it fails, you can refer to the runningType type to see the reason. For example, if the exercise mode is already turned on, it will fail if it is turned on again, or the device is doing other operations |
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSDKSettingDeviceRunning(1, run: VPDeviceRuningMode.outdoorRun ) { type, success in
// to do ...
}
The device is connected and supports this function. The application layer needs to access the third-party weather data source by itself. The SDK is only responsible for data transmission.
The third-party weather data source used by our company is Hefeng Weather https://www.qweather.com/
VPWeatherHandle
The application layer first reads the device's weather switch and other information, and then requests a third-party weather data source
typedef void(^VPSyncWeatherResult)(VPWeatherSettingState state);
typedef void(^VPSettingWeatherResult)(VPWeatherSettingState state);
typedef void(^VPReadWeatherResult)(VPWeatherSettingState state, VPWeatherConfigModel * _Nullable cofigModel);
//SDK users mainly call the following three methods, and the Model configures and sends it
//Synchronize the App's weather data to the device
- (void)syncWeatherDataToDeviceWithWeatherServerModel:(VPWeatherServerModel *)serverModel result:(VPSyncWeatherResult)result;
//Read weather switches and units
- (void)readWeatherInfo:(VPReadWeatherResult)result;
//Set weather switches and units
- (void)settingWeatherInfo:(VPWeatherConfigModel *)settingModel result:(VPSettingWeatherResult)result;
Parameter name | Type | Remarks |
---|---|---|
serverModel | VPWeatherServerModel | Instantiated object of weather data to be transmitted to the device |
result | VPSyncWeatherResult | Weather synchronization result |
settingModel | VPWeatherConfigModel | Instantiated object of weather-related configuration |
- VPWeatherServerModel
Parameter name | Type | Remarks |
---|---|---|
lon | double | Longitude |
lat | double | Latitude |
city | NSString | City or region of temperature |
update | NSString | Last updated 2020-05-09 09:08:34 |
hourly | NSArray<VPWeatherServerHourlyModel *> | Array of weather forecasts for 3 hours |
forecast | NSArray<VPWeatherServerForecastModel *> | Array of weather forecasts for the next day |
- VPWeatherServerHourlyModel
Parameter name | Type | Remarks |
---|---|---|
time | NSString | Time, format 2020-02-28 05:00 |
temp | double | Temperature in degrees Fahrenheit |
uvi | NSNumber | Ultraviolet intensity index |
code | Int | Weather status code The following notes have detailed corresponding weather status relationships |
wind_sc | NSString | Wind direction level 1-2 |
vis | NSNumber | Visibility |
- VPWeatherServerForecastModel
Parameter name | Type | Remarks |
---|---|---|
date | NSString | Date, format 2020-02-28 |
maxTemp | double | Maximum temperature in degrees Fahrenheit |
minTemp | double | Minimum temperature in degrees Fahrenheit |
uvi | NSNumber | Ultraviolet intensity index |
dayCode | NSNumber | Daytime weather status code |
nightCode | NSNumber | Nighttime weather status code |
wind_sc | NSString | Wind direction level 1-2 |
vis | NSNumber | Visibility |
/** VPWeatherServerHourlyModel
The weather status code corresponds to the weather status relationship. The hourly status is consistent with this relationship
"()" means not included
"[]" means included
[0, 4] means - sunny
(4, 12] means - sunny to cloudy
(12, 16] means - cloudy
(16, 20] means - showers
(20, 24] means - thunderstorms
(24, 32] means - hail
(32, 40] means - light rain
(40, 48] means - moderate rain
(48, 56] means - heavy rain
(56, 72] means - heavy rain
(72, 84] means - light snow
(84, 100] means - heavy snow
(100, 155] means - cloudy
Others - Unknown
*/
- VPWeatherConfigModel
Parameter name | Type | Remarks |
---|---|---|
switchState | int | 0 is off, 1 is on |
weatherUnit | int | 0 is Celsius, 1 is Fahrenheit |
crc | uint16_t | CRC of the current weather of the device, used to compare whether the weather data stored in the application layer is expired |
typedef NS_ENUM(NSInteger, VPWeatherSettingState) {
VPWeatherSettingStateNone = 0, //No such feature
VPWeatherSettingStateSuccess, //success
VPWeatherSettingStateFailure, //fail
};
[[VPWeatherHandle share] readWeatherInfo:^(VPWeatherSettingState state, VPWeatherConfigModel * _Nullable cofigModel) {
if (state == 1) {//Read Success
// todo...
}
}];
Blood sugar value range: [3.00, 15.00]
Blood sugar risk level requires the device's blood sugar type value to be 5 to support; bloodGlucoseType == 5
The device is connected and supports this function. After calling the daily data reading, obtain blood sugar history data from the SDK database
VPDataBaseOperation
This interface returns blood sugar historical data every 5 minutes. The application layer can process the returned data on its own to display it.
For the day, data is continuously generated, and the amount of data returned each time is uncertain.
+ (NSArray *)veepooSDKGetDeviceBloodGlucoseDataWithDate:(NSString *)queryDate andTableID:(NSString *)tableID;
Parameter name | Type | Remarks |
---|---|---|
queryDate | NSString | The date to be queried, in the format: yyyy-MM-dd |
tableID | NSString | The mac address of the device |
Dictionary Array
NSDictionary *dataDic = {
"time" = "16:30";
"bloodGlucoses" = [@"0.00"]; // Blood glucose value array every 5 minutes, with at least 1 element and at most 5 elements in the array.
"bloodGlucoseLevels" = [@"0"]; // Risk level corresponding to blood glucose value, 1-3 are low, medium, and high respectively. The device blood glucose type (bloodGlucoseType) is only supported when it is 5. If it is, it corresponds to the blood glucose value one by one. Note that this key needs to be checked for non-emptiness before use
}
Parameter name | Type | Remarks |
---|---|---|
time | NSString | Time, format: HH:mm |
bloodGlucoses | NSArray | Blood glucose value array |
bloodGlucoseLevels | NSArray | Blood glucose risk level array, one-to-one correspondence with blood glucose value |
@IBAction func readDataBtnAction(_ sender: UIButton) {
let tableID = VPBleCentralManage.sharedBleManager()?.peripheralModel.deviceAddress;
let dateFormatter = DateFormatter.init()
dateFormatter.dateFormat = "yyyy-MM-dd"
dateFormatter.timeZone = TimeZone.init(identifier: "Asia/Shanghai")
let dateStr = dateFormatter.string(from: Date.init())
let arr = VPDataBaseOperation.veepooSDKGetDeviceBloodGlucoseData(withDate: dateStr, andTableID: tableID)
print(arr as Any)
}
VPPeripheralBaseManage
The returned blood sugar value structure is: 0.00, the reported value is 100 times, and it is processed automatically when displayed. The blood sugar value unit conversion is as follows: mmol/L => mg/dL
Formula:floor((X mmol/L ) * 18 +0.5f) = Y mg/dL
The level risk level is only valid when bloodGlucoseType is 5
- (void)veepooSDKTestBloodGlucoseStart:(BOOL)start
isPersonalModel:(BOOL)isPersonalModel
testResult:(void(^)(VPDeviceBloodGlucoseTestState testState, NSUInteger testProgress, NSUInteger value, NSUInteger level))testResult;
Parameter name | Type | Remarks |
---|---|---|
start | BOOL | Start or end measurement |
isPersonalModel | BOOL | Private mode or not |
testResult | Block | Measurement result callback |
// Blood glucose function command test state
typedef NS_ENUM(NSUInteger, VPDeviceBloodGlucoseTestState) {
VPDeviceBloodGlucoseTestStateUnsupported, // Device not supported
VPDeviceBloodGlucoseTestStateOpen, // Open measurement
VPDeviceBloodGlucoseTestStateClose, // Close measurement
VPDeviceBloodGlucoseTestStateLowPower, // Low power of device
VPDeviceBloodGlucoseTestStateDeviceBusy, // Device busy
VPDeviceBloodGlucoseTestStateNotWear // Device wearing test failed
};
@IBAction func manualTestDataBtnAction(_ sender: UIButton) {
sender.isSelected = !sender.isSelected
VPBleCentralManage.sharedBleManager()?.peripheralManage.veepooSDKTestBloodGlucoseStart(sender.isSelected, isPersonalModel:false, testResult: { [weak self](state, progress, value, level) in
var txt = ""
if state == .unsupported{
txt = "The device does not support this function"
}
if state == .close {
txt = "Measurement ends"
}
if state == .lowPower {
txt = "Device low power"
}
if state == .deviceBusy {
txt = "Device busy"
}
if state == .notWear {
txt = "Device wear detection failed"
}
if state == .open {
txt = "Progress: \(progress) % Value: \(value) Level: \(level)"
}
_ = AppDelegate.showHUD(message: txt, hudModel: MBProgressHUDModeText, showView: self!.view)
});
}
The device is connected and supports this function
The blood sugar private mode requires the user to set a baseline blood sugar value first, which involves reading and setting the blood sugar baseline value
After the blood sugar private mode is turned on, the blood sugar automatic measurement data is measured in private mode
VPPeripheralBaseManage
- (void)veepooSDKBloodGlucosePersonalWithOpCode:(NSInteger)opCode
value:(CGFloat)value
open:(BOOL)open
result:(void(^)(BOOL success, CGFloat privateValue, NSInteger model))result;
Parameter name | Type | Remarks |
---|---|---|
opCode | NSInteger | 1 for setting 2 for reading |
value | CGFloat | Blood sugar value range [3.00, 15.00]. If it is not within this range, it will be forced to change to 4.00 (invalid when reading) |
open | BOOL | Whether to enable calibration mode 0 off 1 on (invalid when reading) |
result | Block | Callback |
Parameter name | Type | Remarks |
---|---|---|
success | BOOL | Success/failure |
privateValue | CGFloat | Blood sugar baseline value |
model | NSInteger | Whether it is enabled, 0 is not enabled, 1 is enabled |
VPBleCentralManage.sharedBleManager()?.peripheralManage
.veepooSDKBloodGlucosePersonal(withOpCode: 2, value: 0, open: true, result: { [weak self](success, value, isOpen) in
_ = AppDelegate.showHUD(message: "Read \(success), \(value), \(isOpen)", hudModel: MBProgressHUDModeText, showView: self!.view)
})
Single calibration and multi-calibration are mutually exclusive, and both will not appear in the same project
The types of blood glucose functions are 4/5/7 (different types may be added later, depending on the functions included in the specific project)
VPPeripheralBaseManage
/// Setting/reading blood glucose multi-calibration, mutually exclusive with {@link: veepooSDKBloodGlucosePersonalWithOpCode:value:open:result:}
/// Determine whether multi-calibration is supported by bloodGlucoseType, which has blood glucose reference values for 6 time periods
/// @param opCode 1 for setting 2 for reading
/// @param model Model for blood glucose multi-calibration
/// @param result callback function
- (void)veepooSDKBloodGlucoseMultiPersonalWithOpCode:(NSInteger)opCode
model:(VPMultiBloodGlucoseModel *)model
result:(void(^)(BOOL success, VPMultiBloodGlucoseModel * model))result;
Parameter name | Type | Remarks |
---|---|---|
opCode | NSInteger | 1 for setting, 2 for reading |
model | VPMultiBloodGlucoseModel | Multi-calibration parameter model, which can be omitted when reading |
result | Block | Callback |
VPMultiBloodGlucoseModel
Parameter name | Type | Remarks |
---|---|---|
open | BOOL | Whether private mode is turned on |
beforeBreakfast | VPMultiBloodGlucoseItemModel | Before breakfast, can only be set between 2:00 am and 12:00 am |
afterBreakfast | VPMultiBloodGlucoseItemModel | After breakfast |
beforeLunch | VPMultiBloodGlucoseItemModel | Before lunch |
afterLunch | VPMultiBloodGlucoseItemModel | After lunch |
beforeDinner | VPMultiBloodGlucoseItemModel | Before dinner |
afterDinner | VPMultiBloodGlucoseItemModel | After dinner |
VPMultiBloodGlucoseItemModel
Parameter name | Type | Remarks |
---|---|---|
hour | uint8_t | Hour, 24-bit, [0, 23] |
minute | uint8_t | Minute, [0, 59] |
value | uint16_t | Corresponding blood sugar value, range [300, 1500], actual range [3.0, 15.0] |
// setting
let model:VPMultiBloodGlucoseModel = .init()
model.open = true
model.beforeBreakfast = VPMultiBloodGlucoseItemModel(hour: 8, minute: 0, value: 8)
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSDKBloodGlucoseMultiPersonal(withOpCode: 1, model: model) { success, model in
if success {
guard let model = model else { return }
print(model)
}
}
The device is connected and supports this function. You can refer to the implementation in the VPBaseFunctionRemindController
class.
VPPeripheralBaseManage
- (void)veepooSDKSettingBaseFunctionType:(VPSettingBaseFunctionSwitchType)baseFunctionType
settingState:(VPSettingFunctionState)settingState
completeBlock:(void(^)(VPSettingFunctionCompleteState completeState))settingCompleteBlock;
Parameter name | Type | Remarks |
---|---|---|
baseFunctionType | VPSettingBaseFunctionSwitchType | Type to set or read, use VPSettingBloodGlucoseUnit |
settingState | VPSettingFunctionState | Set/Read |
settingCompleteBlock | Block | Callback |
typedef NS_ENUM(NSInteger, VPSettingFunctionState) {//Set to get a function to read
VPReadFunctionState = 0, //Read the switch and existence of a function
VPSettingFunctionOpen = 1, //Open a function
VPSettingFunctionClose = 2, //Close a function
VPSettingFunctionCancel = 3, //Only dynamic blood pressure calibration is valid now
VPSettingFunction = 4, //Set a function
};
typedef NS_ENUM(NSInteger, VPSettingFunctionCompleteState) {//Set the state after a function is completed
VPFunctionCompleteUnknown = 0, //The device does not have this function
VPFunctionCompleteOpen = 1, //This function is turned on
VPFunctionCompleteClose = 2, //This function is closed
VPFunctionCompleteFailure = 3, //Setting or reading failed
VPFunctionCompleteComplete = 4, //Setting completed, response to Data setting
};
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSDKSettingBaseFunctionType(.bloodGlucoseUnit, settingState: .readFunctionState) { state in
// todo...
}
The device is connected and supports this function. After calling the daily data reading, obtain the blood pressure data from the SDK database.
VPDataBaseOperation
, refer to SDK Demo VPTestBloodController
class implementation
Get the blood pressure history data for a certain day. By default, one blood pressure data is collected every 10 minutes. If one data is collected every 10 minutes, there will be a maximum of 144 data in a day.
The measurement frequency of different series of equipment is inconsistent.
+ (NSArray *)veepooSDKGetBloodDataWithDate:(NSString *)queryDate andTableID:(NSString *)tableID;
Parameter name | Type | Remarks |
---|---|---|
queryDate | NSString | Query date, format is yyyy-MM-dd |
tableID | NSString | Data ID, MAC address of the transmission device |
[
{
Time = "07:05";
diastolic = "106";
isManual = "N";
systolic = "71";
vein = "0";
},
{
Time = "08:05";
diastolic = "101";
isManual = "N";
systolic = "65";
vein = "0";
}
]
Parameter name | Type | Remarks |
---|---|---|
Time | NSString | Measurement time |
diastolic | NSString | Diastolic pressure (low pressure) |
isManual | NSString | Whether it is manual measurement, fixed as "N" |
systolic | NSString | Systolic pressure (high pressure) |
vein | NSString | Invalid field |
func obtainOneDayBloodData() {
self.bloodDateLabel.text = bloodDayIndex.getOneDayDateString()
let bloodDataBaseArray = VPDataBaseOperation.veepooSDKGetBloodData(withDate: self.bloodDateLabel.text, andTableID: VPBleCentralManage.sharedBleManager().peripheralModel.deviceAddress)
guard let bloodDataArray = bloodDataBaseArray else {
self.bloodArray = [[String: String]]()
testBloodTableView.reloadData()
return
}
self.bloodArray = bloodDataArray as! Array<[String : String]>
testBloodTableView.reloadData()
}
VPPeripheralBaseManage
, refer to SDK Demo VPTestBloodController
class implementation
Turn blood pressure test on or off. Blood pressure test is different from heart rate test. A blood pressure test takes about 50-55 seconds. Developers can customize the test progress according to this time. There will be results only after each test is completed, that is, there can only be one set of values for one test.
- (void)veepooSDKTestBloodStart:(BOOL)start
testMode:(NSUInteger)testMode
testResult:(void(^)(VPTestBloodState testBloodState, NSUInteger testBloodProgress, NSUInteger highBlood, NSUInteger lowBlood))testBloodResultBlock;
Parameter name | Type | Remarks |
---|---|---|
start | BOOL | Start/end measurement |
testMode | NSUInteger | Measurement mode, 0 is general mode, 1 is private mode, default is general mode |
testBloodResultBlock | Block | Test result callback |
testBloodResultBlock
typedef NS_ENUM(NSInteger,VPTestBloodState) {//State changes during blood pressure test
VPTestBloodStateTesting = 0, //Start testing blood pressure, no result yet
VPTestBloodStateDeviceBusy = 1, //Device busy, test ended
VPTestBloodStateTestFail = 2, //Test invalid, that is, test failure
VPTestBloodStateTestInterrupt = 3, //Test ended manually
VPTestBloodStateComplete = 4, //Test completed
VPTestBloodStateNoFunction = 5, //Device has no blood pressure function
};
Parameter name | Type | Remarks |
---|---|---|
testBloodState | VPTestBloodState | Measurement status |
testBloodProgress | NSUInteger | Measurement progress, 0-100 |
highBlood | NSUInteger | High blood pressure value |
lowBlood | NSUInteger | Low blood pressure value |
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSDKTestBloodStart(sender.isSelected, testMode: 0) { (testBloodState, progress, systolic, diastolic) in
if sender.isSelected {
weakSelf.testProgressLabel.text = "Testing progress:" + String(progress) + "%"
weakSelf.systolicLabel.text = "systolic:" + String(systolic)
weakSelf.diastolicLabel.text = "diastolic:" + String(diastolic)
switch testBloodState {
case .testing://Under testing
print("Under testing")
case .deviceBusy:
_ = AppDelegate.showHUD(message: "The device is busy, end the test", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
sender.isSelected = false
case .testFail:
_ = AppDelegate.showHUD(message: "Test failure", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
sender.isSelected = false
case .testInterrupt:
_ = AppDelegate.showHUD(message: "Manual end of test", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
sender.isSelected = false
case .complete:
_ = AppDelegate.showHUD(message: "Testing has been completed", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
sender.isSelected = false
case .noFunction:
_ = AppDelegate.showHUD(message: "The device does not have this function yet", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
sender.isSelected = false
}
}
}
Blood pressure private mode requires the user to set a baseline high and low blood pressure value first, which involves reading and setting the high and low blood pressure baseline values
After the blood pressure private mode is turned on, the blood pressure automatically measured data is measured in private mode
VPPeripheralBaseManage
Set the private blood pressure mode. When setting, make sure that the high pressure is greater than the low pressure. If the setting mode is to read the systolic and diastolic pressures, both will be 0.
- (void)veepooSDKSettingPersonalBloodWithModel:(VPDevicePrivateBloodModel *)privateBloodModel
settingMode:(VPSettingFunctionState)settingMode
successResult:(void(^)(VPDevicePrivateBloodModel *devicePrivateBloodModel))personalBloodModeResutBlock
failureResult:(void(^)(void))personalBloodModeFailureBlock;
Parameter name | Type | Remarks |
---|---|---|
privateBloodModel | VPDevicePrivateBloodModel | Private Blood Pressure Instantiation Object |
settingMode | VPSettingFunctionState | Setting Mode |
personalBloodModeResutBlock | Block | |
personalBloodModeFailureBlock | Block |
VPDevicePrivateBloodModel
Parameter name | Type | Remarks |
---|---|---|
systolicPressure | NSUInteger | Systolic pressure is high pressure |
diastolicPressure | NSUInteger | Diastolic pressure is low pressure |
privateMode | NSUInteger | Private mode status, 0 is off and 1 is on |
dynamicCalibration | BOOL | Whether it is a private mode that requires dynamic calibration |
settingState | NSUInteger | 0 is setting failure, 1 is setting success, 6 is dynamic calibration in progress, 7 is calibration failure, 8 is calibration success, 9 is a type of calibration failure when the device is in use |
calibrationProgress | NSUInteger | Calibration progress, only useful for devices with dynamic calibration function |
VPSettingFunctionState
typedef NS_ENUM(NSInteger, VPSettingFunctionState) {//Set to get a function to read
VPReadFunctionState = 0, //Read the switch and existence of a function
VPSettingFunctionOpen = 1, //Open a function
VPSettingFunctionClose = 2, //Close a function
VPSettingFunctionCancel = 3, //Only dynamic blood pressure calibration is valid now
VPSettingFunction = 4, //Set a function
};
If the setting/reading is successful, the personalBloodModeResutBlock
callback will be triggered, and if it fails, the personalBloodModeFailureBlock
will be triggered.
//You need to read the data of the bracelet first. This App generally displays the data of the bracelet.
unowned let weakSelf = self
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSDKSettingPersonalBlood(with: VPDevicePrivateBloodModel(), settingMode: .readFunctionState, successResult: { (devicePrivateModel) in
weakSelf.privateBloodModel = devicePrivateModel
if devicePrivateModel?.systolicPressure == 0 && devicePrivateModel?.diastolicPressure == 0 {
_ = AppDelegate.showHUD(message: "The bracelet has not set this function yet", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
}else {//Display the current bracelet value to the user
_ = AppDelegate.showHUD(message: "Reading blood pressure private mode successfully", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
weakSelf.systolicSlider.value = Float((devicePrivateModel?.systolicPressure)!)
weakSelf.diastolicSlider.value = Float((devicePrivateModel?.diastolicPressure)!)
weakSelf.bloodModeSegControl.selectedSegmentIndex = Int((devicePrivateModel?.privateMode)!)
weakSelf.systolicLabel.text = "systolic:" + String((devicePrivateModel?.systolicPressure)!)
weakSelf.diastolicLabel.text = "diastolic:" + String((devicePrivateModel?.diastolicPressure)!)
weakSelf.modeLabel.text = devicePrivateModel?.privateMode == 0 ? "Mode: General" : "Mode: Private"
}
}) {
_ = AppDelegate.showHUD(message: "Reading blood pressure private mode failed", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
}
The device is connected and supports this function. After calling the daily data reading, obtain the historical blood oxygen data from the SDK database
Note that the blood oxygen function is a restricted function of the SDK. You need to contact our business first for business docking. In the case of restriction, only the blood oxygen value is returned
VPDataBaseOperation
, refer to SDK Demo VPTestOxygenController
class implementation
Note that the data returned by the interface is all-day blood oxygen data, but the blood oxygen data of the device is only valid from 0-7 o'clock. This is a limitation made by the comprehensive evaluation of the algorithm, product and measurement conditions.
+ (NSArray *)veepooSDKGetDeviceOxygenDataWithDate:(NSString *)queryDate andTableID:(NSString *)tableID;
Parameter name | Type | Remarks |
---|---|---|
queryDate | NSString | The date to be queried, in the format: yyyy-MM-dd |
tableID | NSString | The mac address of the device |
Dictionary Array
NSDictionary *riginalDic = @{
ApneaResult = 0;
CardiacLoad = 0;
HRV = 0;
HeartValue = 65;
Hypopnea = 0;
HypoxiaTime = 0;
IsHypoxia = 0;
OxygenValue = 0;
RespirationRate = 255;
SportValue = 0;
StepValue = 0;
Temp1 = 75;
Time = "00:00";
protocolType = 2;
};
Parameter name | Type | Remarks |
---|---|---|
Time | NSString | Time |
OxygenValue | NSString | Blood oxygen value. In restricted mode, only the value of this field is returned |
ApneaResult | NSString | Number of apneas |
CardiacLoad | NSString | Cardiac load |
HRV | NSString | HRV heart rate variability |
HeartValue | NSString | Heart rate |
Hypopnea | NSString | Hypopnea |
HypoxiaTime | NSString | Hypoxia time |
IsHypoxia | NSString | Whether hypoxia |
RespirationRate | NSString | Respiration rate |
SportValue | NSString | Exercise volume |
StepValue | NSString | Number of steps |
Temp1 | NSString | Debugging parameters |
protocolTyp | NSString | Protocol version |
VPDataBaseOperation.veepooSDKGetDeviceOxygenData(withDate: "2020-05-27", andTableID: VPBleCentralManage.sharedBleManager().peripheralModel.deviceAddress)
The device is connected and supports this function
VPPeripheralBaseManage
Turn on or off the blood oxygen test. The principle of the test is the same as that of the heart rate test, that is, there will be multiple sets of values in one test.
- (void)veepooSDKTestOxygenStart:(BOOL)start
testResult:(void(^)(VPTestOxygenState testOxygenState, NSUInteger oxygenValue))testOxygenResultBlock;
Parameter name | Type | Remarks |
---|---|---|
start | BOOL | Start/stop measurement |
testOxygenResultBlock | Block | Measurement result callback |
Test result callback. When the test is in calibration state, value is the calibration progress. Otherwise, it is the blood oxygen test value.
typedef NS_ENUM(NSInteger,VPTestOxygenState) {//State changes during blood oxygen testing
VPTestOxygenStateStart = 0,//Start testing blood oxygen, no results yet
VPTestOxygenStateTesting = 1,//Testing blood oxygen, blood oxygen value has been measured
VPTestOxygenStateNotWear = 2,//Wearing test failed, test has ended
VPTestOxygenStateDeviceBusy = 3,//The device is busy and cannot be tested, the test has ended
VPTestOxygenStateOver = 4,//Test ended normally, ended manually
VPTestOxygenStateNoFunction = 5,//The device has no blood oxygen function
VPTestOxygenStateCalibration = 6,//Blood oxygen calibration in progress
VPTestOxygenStateCalibrationComplete = 7,//Blood oxygen calibration completed
VPTestOxygenStateInvalid = 8, // Blood oxygen function is temporarily unavailable
};
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSDKTestOxygenStart(sender.isSelected) { (testOxygenState, oxygenValue) in
if sender.isSelected {
switch testOxygenState {
case .start:
_ = AppDelegate.showHUD(message: "Preparing for the test, please maintain the correct posture", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
case .testing: // Blood oxygen is being tested, and the blood oxygen value has been measured
weakSelf.currentOxygenValueLabel.text = "Current blood oxygen value:" + String(oxygenValue) + "%"
case .notWear: // Wearing detection failed, the test has ended
_ = AppDelegate.showHUD(message: "Wearing detection failed", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
sender.isSelected = false
case .deviceBusy: //The device is busy and cannot be tested. The test has ended.
_ = AppDelegate.showHUD(message: "Device is operating", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
sender.isSelected = false
case .over: //The test ended normally, ended manually
_ = AppDelegate.showHUD(message: "Test ended", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
sender.isSelected = false
case .noFunction: //The device does not have this function
_ = AppDelegate.showHUD(message: "The device does not have this function", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
sender.isSelected = false
case .calibration: //Calibrating
weakSelf.currentOxygenValueLabel.text = "Calibration progress:" + String(oxygenValue) + "%"
case .calibrationComplete: //calibration completed
weakSelf.currentOxygenValueLabel.text = "Calibration progress:" + String(oxygenValue) + "%"
default:
break
}
}else {
if testOxygenState == .over {
_ = AppDelegate.showHUD(message: "Test completed", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
}
}
}
The device is connected and supports this function
var tbyte:[UInt8] = Array(repeating: 0x00, count: 20)
VPBleCentralManage.sharedBleManager().peripheralModel.deviceFuctionData.copyBytes(to: &tbyte, count: tbyte.count)
if tbyte[11] != 1 {//First determine whether this function exists
_ = AppDelegate.showHUD(message: "The bracelet does not have the function of turning the wrist to light up the screen", hudModel: MBProgressHUDModeText, showView: view)
return
}
VPPeripheralBaseManage
, refer to SDK VPRaiseHandSettingController
class implementation
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
- (void)veepooSDKSettingRaiseHandWithRaiseHandModel:(VPDeviceRaiseHandModel *)raiseHandModel
settingMode:(NSUInteger)settingMode
successResult:(void(^)(VPDeviceRaiseHandModel *raiseHandModel))settingRaiseHandResultBlock
failureResult:(void(^)(void))settingRaiseHandFailureBlock;
Parameter | Parameter type | Remarks |
---|---|---|
raiseHandModel | VPDeviceRaiseHandModel | Wrist-turning screen-lighting model |
settingMode | NSUInteger | Set the wrist-turning screen-lighting mode. 0 represents off. 1 represents on. 2 represents reading the device wrist-turning screen-lighting information. |
settingRaiseHandResultBlock | Block | Success callback |
settingRaiseHandFailureBlock | Block | Failure callback |
- VPDeviceRaiseHandModel
Parameter | Parameter type | Remarks |
---|---|---|
raiseHandStartHour | NSUInteger | The hour when the screen turns on by turning the wrist. The range is 0-23 |
raiseHandStartMinute | NSUInteger | The minute when the screen turns on by turning the wrist. The range is 0-59 |
raiseHandEndHour | NSUInteger | The hour when the screen turns on by turning the wrist. The range is 0-23 |
raiseHandEndMinute | NSUInteger | The minute when the screen turns on by turning the wrist. The range is 0-59 |
raiseHandState | NSUInteger | This is the state of the screen turning on by turning the wrist. 0 means off and 1 means on. When on, it is valid within the set time |
sensitive | NSUInteger | The current sensitivity of the bracelet |
defaultSensitive | NSUInteger | The default sensitivity of the bracelet. If not, it means that there is no sensitivity setting function |
@IBAction func startSettingLongseatAction(_ sender: UIButton) {
//Building the Model
let raiseHandModel = VPDeviceRaiseHandModel(raiseHandStartHour: UInt(startHourSlider.value), raiseHandStartMinute: UInt(startMinuteSlider.value), raiseHandEndHour: UInt(endHourSlider.value), raiseHandEndMinute: UInt(endMinuteSlider.value), raiseHandState: UInt(stateSegControl.selectedSegmentIndex), raiseHandSensitive: UInt(sensitiveSlider.value))
//Start setting up
unowned let weakSelf = self;
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSDKSettingRaiseHand(with: raiseHandModel, settingMode: UInt(stateSegControl.selectedSegmentIndex), successResult: { (raiseHandModel) in
_ = AppDelegate.showHUD(message: "Flip wrist to light up the screen setting successfully", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
}) {
_ = AppDelegate.showHUD(message: "Failed to set the screen to turn on when wrist is turned on", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
}
}
The device is connected and supports this function
var tbyte:[UInt8] = Array(repeating: 0x00, count: 20)
VPBleCentralManage
.sharedBleManager().peripheralModel.deviceFuctionData.copyBytes(to: &tbyte, count: tbyte.count)
if tbyte[13] != 1 {//First determine whether this function exists
_ = AppDelegate.showHUD(message: "The bracelet does not have a brightness adjustment function", hudModel: MBProgressHUDModeText, showView: view)
return
}
VPPeripheralBaseManage
, refer to SDK VPSettingBrightController
class implementation
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
For example, if you set a time period of 22:00-8:00 and the gear is firstBrightValue, and the brightness gear for other time periods is otherBrightValue, then the bracelet will display the brightness according to the gear of firstBrightValue during the time period of 22:00-8:00, and the brightness of the gear of otherBrightValue at other times
If it is set to automatic, different gears will be displayed according to different devices in different time periods, which is determined by the bracelet
The maximum gear of each device is also different
- (void)veepooSDKSettingBrightWithBrightModel:(VPDeviceBrightModel *)brightModel
settingMode:(NSUInteger)settingMode
successResult:(void(^)(VPDeviceBrightModel *brightModel))settingBrightResultBlock
failureResult:(void(^)(void))settingBrightFailureBlock;
Parameter | Parameter type | Remarks |
---|---|---|
brightModel | VPDeviceBrightModel | Brightness adjustment model |
settingMode | NSUInteger | 1 for setting 2 for reading |
settingBrightResultBlock | Block | Success callback |
settingBrightFailureBlock | Block | Failure callback |
- VPDeviceBrightModel
Parameter | Parameter type | Remarks |
---|---|---|
firstBrightStartHour | NSInteger | The first gear starts working hour |
firstBrightStartMinute | NSInteger | The first gear starts working minute |
firstBrightEndHour | NSInteger | The first gear ends working hour |
firstBrightEndMinute | NSInteger | The first gear ends working minute |
firstBrightValue | NSInteger | Set the first gear of the time period |
otherBrightValue | NSInteger | Brightness gear of other time periods |
isAutomatic | BOOL | Whether to adjust automatically |
maxBrightValue | NSInteger | Maximum brightness adjustment gear |
lastManualBrightValue | NSInteger | OtherBrightValue last gear manually set for each connection |
@IBAction func startSettingLongseatAction(_ sender: UIButton) {
//Building a brightness adjustment model
let brightModel = VPDeviceBrightModel(startHour: Int(brightStartHourSlider.value), startMinute: Int(brightStartMinuteSlider.value), endHour: Int(brightEndHourSlider.value), endMinute: Int(brightEndMinuteSlider.value), firstBrightValue: Int(firstBrightValueSlider.value), otherBrightValue: Int(otherBrightValueSlider.value))
//Start setting up
unowned let weakSelf = self;
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSDKSettingBright(with: brightModel, settingMode: 1, successResult: { (deviceBrightModel) in
_ = AppDelegate.showHUD(message: "Brightness adjustment setting is successful", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
}) {
_ = AppDelegate.showHUD(message: "Brightness adjustment setting failed", hudModel: MBProgressHUDModeText, showView: weakSelf.view)
}
}
The device is connected and supports this function
//1.First determine whether this function exists
let type = VPBleCentralManage.sharedBleManager().peripheralModel.screenDurationType
if type == 0 {
_ = AppDelegate.showHUD(message: "This device does not have the function of setting the screen duration", hudModel: MBProgressHUDModeText, showView: view)
return
}
VPPeripheralBaseManage
, refer to SDK VPSettingScreenDurationController
class implementation
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
- (void)veepooSDKSettingScreenDuration:(VPScreenDurationModel *)durationModel
settingMode:(NSUInteger)settingMode
successResult:(void(^)(VPScreenDurationModel *DurationModel))settingResult
failureResult:(void(^)(void))failureResult;
Parameter | Parameter type | Remarks |
---|---|---|
durationModel | VPScreenDurationModel | Set the screen duration model. It can be non-nil when reading. |
settingMode | NSUInteger | 1 for setting 2 for reading |
settingResult | Block | Success callback |
failureResult | Block | Failure callback |
- VPScreenDurationModel
Parameter | Parameter Type | Notes |
---|---|---|
currentDuration | NSInteger | Current screen-on duration |
defaultDuration | NSInteger | Default screen-on duration for the device |
minDuration | NSInteger | Minimum screen-on duration that can be set for the device |
maxDuration | NSInteger | Maximum screen-on duration that can be set for the device |
//2.Read the current device screen-on time information
VPBleCentralManage.sharedBleManager()
.peripheralManage.veepooSDKSettingScreenDuration(VPScreenDurationModel(), settingMode: 2, successResult: {[weak self] (durationModel) in
_ = AppDelegate.showHUD(message: "Read information successfully", hudModel: MBProgressHUDModeText, showView: (self?.view)!)
self?.durationModel = durationModel!
self?.updateUI()
}) {[weak self] in
_ = AppDelegate.showHUD(message: "Failed to read information", hudModel: MBProgressHUDModeText, showView: (self?.view)!)
}
The device is connected and supports this function
VPPeripheralBaseManage
, refer to SDK VPDeviceHealthRemindViewController
class implementation
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
- (void)veepooSDKSettingHealthRemindWithRemindType:(VPDeviceHealthRemindType)remindType
opCode:(NSInteger)opCode
remindModel:(VPDeviceHealthRemindModel *)remindModel
resultBlock:(void(^)(BOOL success, VPDeviceHealthRemindModel *successModel))resultBlock
deviceInfoDidChangeBlock:(void(^)(VPDeviceHealthRemindModel *changeModel))deviceInfoDidChangeBlock;
Parameter | Parameter type | Remarks |
---|---|---|
remindType | VPDeviceHealthRemindType | Reminder type |
opCode | NSInteger | 1 for setting, 2 for reading, remindModel can be empty when reading |
remindModel | VPDeviceHealthRemindModel | Set the model, only valid when setting |
resultBlock | Block | Result callback |
deviceInfoDidChangeBlock | Block | Trigger callback when device information changes |
// Health reminder function type
typedef NS_ENUM(NSUInteger, VPDeviceHealthRemindType) {
VPDeviceHealthRemindTypeAll, // All
VPDeviceHealthRemindTypeLongSeat, // Long-term sitting
VPDeviceHealthRemindTypeDrinkWater, // Drinking water
VPDeviceHealthRemindTypeLookFarAway, // Looking far away
VPDeviceHealthRemindTypeSport, // Sports
VPDeviceHealthRemindTypeTakeMedicine, // Take medicine
VPDeviceHealthRemindTypeRead, // Reading
VPDeviceHealthRemindTypeTrip, // Traveling
VPDeviceHealthRemindTypeWashHands, // Wash hands
};
- VPDeviceHealthRemindModel
Parameter | Parameter type | Remarks |
---|---|---|
type | VPDeviceHealthRemindType | Reminder type |
startHour | NSInteger | Start time - hour, please limit the range to [0,23] |
startMinute | NSInteger | Start time - minute, please limit the range to [0, 59] |
endHour | NSInteger | End time - hour, please limit the range to [0,23] |
endMinute | NSInteger | End time - minute, please limit the range to [0, 59] |
remindInterval | NSInteger | Reminder interval |
open | BOOL | Whether the reminder is turned on |
// Read
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSDKSettingHealthRemind(with: .all, opCode: 2, remindModel: nil) { [weak self]success, model in
if (success) {
if let model = model {
let index = Int(model.type.rawValue)
let start = String(format: "%02d:%02d", model.startHour, model.startMinute)
let end = String(format: "%02d:%02d", model.endHour, model.endMinute)
print("type:\(NameStrArr[index]), Start: \(start), End - \(end), Interval - \(model.remindInterval), Open: \(model.open)")
_ = AppDelegate.showHUD(message: "Read Success", hudModel: MBProgressHUDModeText, showView: self!.view)
self!.mArr.append(model)
self!.tableView.reloadData()
}
}
} deviceInfoDidChange: { [weak self] model in
self!.deviceDidChange(model: model)
}
The body composition function depends on ECG, which is consistent with the ECG measurement posture. It cannot be automatically measured when the watch is worn normally. Therefore, this function can only be measured manually, which is divided into command-activated measurement and device-side offline measurement.
Offline measurement means that the measurement result is stored in the watch side, which has a persistent effect. In the connected state, the data can be read into the SDK through [Daily Data Reading Interface](#Daily Data Reading Function).
Support this function, which can be judged by VPBleCentralManage.sharedBleManager().peripheralModel.bodyCompositionType
VPPeripheralBaseManage
, refer to SDK VPBodyCompositionViewController
class implementation
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
/// Single measurement of body composition on or off
/// - Parameters:
/// - start: start or close
/// - progress: progress callback, lead 0 means the lead has passed (indicates the hand is on the electrode), 1 means the lead has not passed
/// - testResult: result callback
- (void)veepooSDKTestBodyCompositionStart:(BOOL)start
progress:(void(^)(NSInteger lead, NSProgress *progress))progress
testResult:(void(^)(VPDeviceBodyCompositionState state, VPBodyCompositionValueModel *model))testResult;
/// Callback when the device completes measuring body composition
@property (nonatomic, copy) void(^deviceTestBodyCompositionDidFinishBlock)(void);
Parameter | Parameter type | Remarks |
---|---|---|
start | BOOL | Start or stop |
progress | Block | Progress and lead status callback |
testResult | Block | Result callback |
// Device body composition measurement status
typedef NS_ENUM(NSUInteger, VPDeviceBodyCompositionState) {
VPDeviceBodyCompositionStateNoFunction, // The device does not have this function
VPDeviceBodyCompositionStateDeviceBusy, // The device is busy and cannot start the test
VPDeviceBodyCompositionStateOver, // The test ended normally, ended manually
VPDeviceBodyCompositionStateLowPower, // The device is low power
VPDeviceBodyCompositionStateFailure, // The test failed
VPDeviceBodyCompositionStateComplete, // The test has been completed
};
VPBodyCompositionValueModel's Parameter Explanation and value range
Height, weight, and gender SDK do not have persistent data, so the application layer needs to handle it
Parameter | Parameter type | - | - | - | - | - |
---|---|---|---|---|---|---|
date | Measurement date yyyy-MM-dd | - | - | - | - | - |
testTime | Measurement time (end time) HH:mm:ss | Valid range | Low range | Normal range | High range | Excessive range |
bmi | BMI | [4,1114] kg/m2 | [4,18.5)Low | [18.5,24.0)Normal | [24.0,28.0)Overweight | [28.0,1114]Obese |
bodyFatPercentage | Body fat percentage | [2,48]% | Male [2,17], Female [2,25], low | male [18,22], female [26,31], normal | male [23,29], female [32,39], overweight | male [30,48], female [40,48], obese |
fatMass | fat mass | [10,248] kg | ||||
leanBodyMass | lean body mass | [1,132] kg | [1,45.8) low | [45.8,55.9], standard | (55.9,132], excellent | |
muscleRate | muscle rate | [39,90]% | [39,68.1), low | [68.1,84.8], standard | (84.8,90], excellent | |
muscleMass | muscle mass | [9,248] kg | [9,40.8), low | [40.8,50.8], standard | (50.8,248], excellent | |
subcutaneousFat | [1,47]% | [1,8.6), low | [8.6,16.7], normal | (16.7,47], high | ||
bodyMoisture | [28,79]% | [28,53.4), low | [53.4,66.6], standard | (66.6,79], excellent | ||
waterContent | [7,217] kg | |||||
skeletalMuscleRate | [13,69]% | [13,25), low | [25,35], standard | (35,69], Excellent | ||
boneMass | [2.3,4.8] kg | [2.3,2.9), Low | [2.9,3.7], Standard | (3.7,4.8], Excellent | ||
proportionOfProtein | [4,26]% | [4,14.1), Low | [14.1,17.7], Standard | (17.7,26], Excellent | ||
proteinAmount | [1,71] kg | |||||
basalMetabolicRate | [25,14995] kcal | [25,1619), Low | [1619,14995], Excellent |
测量
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSDKTestBodyCompositionStart(true) { lead, progress in
if let progress = progress {
print("lead = \(lead), progress = \(progress)")
}
} testResult: { [weak self]state, model in
if state == .complete {
if let model = model {
print(model)
}
}
if state == .failure {
print("Measurement failed")
}
if state == .over {
print("End measurement manually")
}
self?.opButton.isSelected = false
}
Offline storage data acquisition
let tableID = VPBleCentralManage.sharedBleManager()?.peripheralModel.deviceAddress;
var date = "2023-09-22"
let arr = VPDataBaseOperation.veepooSDKGetDeviceOffStoreBodyComposition(withDate: date, andTableID: tableID)
guard let arr = arr else {
print("No data")
return
}
if arr.isEmpty {
print("No data")
return
}
print(arr)
The blood composition function supports calibration logic, similar to blood pressure calibration
There is daily data
Support this function, which can be judged by VPBleCentralManage.sharedBleManager().peripheralModel.bloodAnalysisType
VPPeripheralBaseManage
, refer to SDK VPBloodAnalysisViewController
class implementation
How to get it:VPBleCentralManage.sharedBleManager().peripheralManage
Single measurement
/// Single blood component measurement on or off
/// @param start on/off
/// @param isPersonalModel whether it is in private mode
/// @param progress progress callback
/// @param testResult result callback
- (void)veepooSDKTestBloodAnalysisStart:(BOOL)start
isPersonalModel:(BOOL)isPersonalModel
progress:(void(^)(NSProgress *progress))progress
testResult:(void(^)(VPDeviceBloodAnalysisState state, VPBloodAnalysisResultModel *model))testResult;
Private Mode
/// Blood component private mode operation
/// @param opCode 1 for setting 2 for reading
/// @param open Whether to open, if open, the blood component automatically measured by the device is measured according to the set private mode value
/// @param model The private mode value to be set, can be empty when reading
/// @param result Result callback
- (void)veepooSDKBloodAnalysisPersonalWithOpCode:(NSInteger)opCode
open:(BOOL)open
model:(VPBloodAnalysisResultModel *)model
result:(void(^)(BOOL success, BOOL open, VPBloodAnalysisResultModel *model))result;
Daily data
/// Get the blood component automatic measurement data of the device on a certain day
/// @param queryDate The date format to be queried is 2021-06-07
/// @param tableID The mac address of the device, which device's data is to be obtained
+ (NSArray<VPDailyBloodAnalysisModel *> *)veepooSDKGetDeviceBloodAnalysisDataWithDate:(NSString *)queryDate
andTableID:(NSString *)tableID;
Parameter | Parameter type | Remarks |
---|---|---|
start | BOOL | Start or close |
isPersonalModel | BOOL | Whether it is private mode |
progress | Block | Progress callback |
testResult | Block | Result callback |
// Blood component measurement status
typedef NS_ENUM(NSUInteger, VPDeviceBloodAnalysisState) {
VPDeviceBloodAnalysisStateNoFunction, // The device does not have this function
VPDeviceBloodAnalysisStateDeviceBusy, // The device is busy and cannot start the test
VPDeviceBloodAnalysisStateOver, // The test ends normally, ended manually
VPDeviceBloodAnalysisStateLowPower, // The device is low power
VPDeviceBloodAnalysisStateFailure, // The test failed
VPDeviceBloodAnalysisStateNotWear, // The device wear detection failed
VPDeviceBloodAnalysisStateComplete, // The test has been completed
};
VPBloodAnalysisResultModel
Parameter | Parameter Type | Remarks | Valid Range | Normal Range |
---|---|---|---|---|
uricAcidValue | double | Uric acid, one decimal point, unit μmol/L | [90.0,1000.0] | Male [150.0,420.0] μmol/L Female [90.0,360.0] μmol/L |
totalCholesterolValue | double | Total cholesterol, two decimal points, unit mmol/L | [0.01,20.00] | [2.8,5.17]mmol/L |
triglycerideValue | double | Triglyceride, two decimal points, unit mmol/L | [0.01,20.00] | [2.8,5.17]mmol/L |
highDensityLipoproteinValue | double | High-density lipoprotein, two decimal places, unit mmol/L | [0.01,20.00] | [2.8,5.17]mmol/L |
lowDensityLipoproteinValue | double | Low-density lipoprotein, two decimal places, unit mmol/L | [0.01,20.00] | [2.8,5.17]mmol/L |
Unit conversion formula:
Parameter | Parameter Name | Unit Switching | Conversion Formula |
---|---|---|---|
uricAcidValue | Uric Acid | μmol/L => mg/dL | 1μmol/L = 59.5 mg/dL |
totalCholesterolValue | Total Cholesterol | mmol/L => mg/dL | 38.67mmol/L = 1 mg/dL |
triglycerideValue | Triglyceride | mmol/L => mg/dL | 88.545mmol/L = 1 mg/dL |
highDensityLipoproteinValue | High Density Lipoprotein | mmol/L => mg/dL | 38.67mmol/L = 1 mg/dL |
lowDensityLipoproteinValue | Low Density Lipoprotein | mmol/L => mg/dL | 38.67mmol/L = 1 mg/dL |
Measurement
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSDKTestBloodAnalysisStart(ture, isPersonalModel: false, progress: { progress in
if let progress = progress {
print("progress = \(progress)")
}
}, testResult: { [weak self]state, model in
if state == .complete {
if let model = model {
print(model)
}
}
if state == .failure {
print("Measurement failed")
}
if state == .over {
print("End measurement manually")
}
self?.opButton.isSelected = false
})
Calibration
let setModel:VPBloodAnalysisResultModel = .init()
setModel.uricAcidValue = 9.4
VPBleCentralManage.sharedBleManager().peripheralManage.veepooSDKBloodAnalysisPersonal(withOpCode: 1, open: false, model: nil) { success, openState, model in
if let model = model {
print(model)
}
}
Daily data
let tableID = VPBleCentralManage.sharedBleManager()?.peripheralModel.deviceAddress;
let arr = VPDataBaseOperation.veepooSDKGetDeviceBloodAnalysisData(withDate: "2023-10-18", andTableID: tableID)
guard let arr = arr else {
print("No blood component data for that day")
return
}