Skip to main content

BloodPressure Module

This module provides comprehensive blood pressure measurement and monitoring capabilities. It enables manual blood pressure measurements initiated by users, automatic periodic monitoring on the device, real-time data synchronization, and historical data retrieval. Blood pressure data includes systolic (high pressure) and diastolic (low pressure) values, which are critical cardiovascular health indicators.

Prerequisites

  • The connected wearable device must support blood pressure measurement functionality
  • Device must be properly paired and connected before measurement operations
  • For automatic monitoring, the device must support automatic monitoring features
  • Network connectivity is required for data synchronization operations
  • Appropriate user permissions must be granted for health data access

Data Models

TSBPValueItem

Single blood pressure measurement record.

PropertyTypeDescription
systolicUInt16Systolic (high) blood pressure value in mmHg
diastolicUInt16Diastolic (low) blood pressure value in mmHg
isUserInitiatedBOOLIndicates whether the measurement was initiated by the user (manual) or by automatic monitoring
timestampNSTimeIntervalMeasurement timestamp (inherited from TSHealthValueItem)

TSBPDailyModel

Daily aggregated blood pressure data for a single day.

PropertyTypeDescription
maxSystolicItemTSBPValueItem *Blood pressure item with the highest systolic value recorded during the day
minSystolicItemTSBPValueItem *Blood pressure item with the lowest systolic value recorded during the day
maxDiastolicItemTSBPValueItem *Blood pressure item with the highest diastolic value recorded during the day
minDiastolicItemTSBPValueItem *Blood pressure item with the lowest diastolic value recorded during the day
manualItemsNSArray<TSBPValueItem *> *Array of user-initiated blood pressure measurements, ordered chronologically
autoItemsNSArray<TSBPValueItem *> *Array of automatically monitored blood pressure measurements, ordered chronologically
dayStartTimeNSTimeIntervalStart timestamp of the day (inherited from TSHealthDailyModel)

Enumerations

No enumerations are defined for this module.

Callback Types

TSCompletionBlock

typedef void (^TSCompletionBlock)(NSError *_Nullable error);

Completion callback for operations that may succeed or fail.

ParameterTypeDescription
errorNSError *Error information if operation failed; nil if successful

Measurement Start Handler

void (^)(BOOL success, NSError * _Nullable error)

Callback invoked when a blood pressure measurement starts or fails to start.

ParameterTypeDescription
successBOOLYES if measurement started successfully, NO otherwise
errorNSError *Error information if failed to start; nil if successful

Measurement Data Handler

void (^)(TSBPValueItem * _Nullable data, NSError * _Nullable error)

Callback to receive real-time blood pressure measurement data during an active measurement.

ParameterTypeDescription
dataTSBPValueItem *Real-time blood pressure measurement data; nil if error occurs
errorNSError *Error information if data reception failed; nil if successful

Measurement End Handler

void (^)(BOOL success, NSError * _Nullable error)

Callback invoked when a blood pressure measurement ends (normally or abnormally).

ParameterTypeDescription
successBOOLYES if measurement ended normally, NO if interrupted
errorNSError *Error information if measurement ended abnormally; nil if normal end

Configuration Fetch Handler

void (^)(TSAutoMonitorBPConfigs * _Nullable configuration, NSError * _Nullable error)

Callback to receive the current automatic monitoring configuration.

ParameterTypeDescription
configurationTSAutoMonitorBPConfigs *Current automatic monitoring configuration; nil if error occurs
errorNSError *Error information if fetch failed; nil if successful

Raw Data Sync Handler

void (^)(NSArray<TSBPValueItem *> * _Nullable bpItems, NSError * _Nullable error)

Callback to receive synchronized raw blood pressure measurement records.

ParameterTypeDescription
bpItemsNSArray<TSBPValueItem *> *Array of raw blood pressure measurement items; nil if error occurs
errorNSError *Error information if sync failed; nil if successful

Daily Data Sync Handler

void (^)(NSArray<TSBPDailyModel *> * _Nullable dailyModels, NSError * _Nullable error)

Callback to receive synchronized daily aggregated blood pressure data.

ParameterTypeDescription
dailyModelsNSArray<TSBPDailyModel *> *Array of daily blood pressure models; nil if error occurs
errorNSError *Error information if sync failed; nil if successful

API Reference

Check if device supports manual blood pressure measurement

Query whether the connected device supports user-initiated blood pressure measurements.

- (BOOL)isSupportActivityMeasureByUser;

Returns: BOOLYES if the device supports manual blood pressure measurement, NO otherwise.

Code Example:

id<TSBloodPressureInterface> bpInterface = /* obtained from device */;

if ([bpInterface isSupportActivityMeasureByUser]) {
TSLog(@"Device supports manual blood pressure measurement");
} else {
TSLog(@"Device does not support manual blood pressure measurement");
}

Start blood pressure measurement

Initiate a blood pressure measurement with specified parameters and receive callbacks for start, real-time data, and completion events.

- (void)startMeasureWithParam:(TSActivityMeasureParam *_Nonnull)measureParam
startHandler:(void(^_Nullable)(BOOL success, NSError * _Nullable error))startHandler
dataHandler:(void(^_Nullable)(TSBPValueItem * _Nullable data, NSError * _Nullable error))dataHandler
endHandler:(void(^_Nullable)(BOOL success, NSError * _Nullable error))endHandler;
ParameterTypeDescription
measureParamTSActivityMeasureParam *Parameters for the measurement activity including duration and other settings
startHandlervoid (^)(BOOL success, NSError *)Block called when measurement starts or fails; receives success status and error if applicable
dataHandlervoid (^)(TSBPValueItem *, NSError *)Block to receive real-time measurement data; called repeatedly during measurement or with error
endHandlervoid (^)(BOOL success, NSError *)Block called when measurement ends normally or is interrupted; receives completion status and error if applicable

Code Example:

id<TSBloodPressureInterface> bpInterface = /* obtained from device */;
TSActivityMeasureParam *param = [[TSActivityMeasureParam alloc] init];
param.duration = 60; // 60 seconds

[bpInterface startMeasureWithParam:param
startHandler:^(BOOL success, NSError * _Nullable error) {
if (success) {
TSLog(@"Blood pressure measurement started");
} else {
TSLog(@"Failed to start measurement: %@", error.localizedDescription);
}
} dataHandler:^(TSBPValueItem * _Nullable data, NSError * _Nullable error) {
if (data) {
TSLog(@"Real-time BP: Systolic=%u, Diastolic=%u",
data.systolic, data.diastolic);
} else if (error) {
TSLog(@"Error receiving data: %@", error.localizedDescription);
}
} endHandler:^(BOOL success, NSError * _Nullable error) {
if (success) {
TSLog(@"Blood pressure measurement completed normally");
} else {
TSLog(@"Measurement interrupted or failed: %@",
error ? error.localizedDescription : @"unknown error");
}
}];

Stop blood pressure measurement

Terminate the currently active blood pressure measurement.

- (void)stopMeasureCompletion:(nonnull TSCompletionBlock)completion;
ParameterTypeDescription
completionvoid (^)(NSError *)Completion block called when the measurement stops or fails to stop; receives error if applicable

Code Example:

id<TSBloodPressureInterface> bpInterface = /* obtained from device */;

[bpInterface stopMeasureCompletion:^(NSError * _Nullable error) {
if (error) {
TSLog(@"Failed to stop measurement: %@", error.localizedDescription);
} else {
TSLog(@"Blood pressure measurement stopped successfully");
}
}];

Check if device supports automatic blood pressure monitoring

Query whether the connected device supports automatic periodic blood pressure monitoring.

- (BOOL)isSupportAutomaticMonitoring;

Returns: BOOLYES if the device supports automatic blood pressure monitoring, NO otherwise.

Code Example:

id<TSBloodPressureInterface> bpInterface = /* obtained from device */;

if ([bpInterface isSupportAutomaticMonitoring]) {
TSLog(@"Device supports automatic blood pressure monitoring");
} else {
TSLog(@"Device does not support automatic blood pressure monitoring");
}

Check if device supports configuring monitor time range

Query whether the device allows configuration of the start and end times for automatic blood pressure monitoring.

- (BOOL)isSupportMonitorScheduleTime;

Returns: BOOLYES if the device supports configuring start/end times for monitoring, NO otherwise.

Discussion: When this method returns YES, the startTime and endTime fields of TSMonitorSchedule are effective.

Code Example:

id<TSBloodPressureInterface> bpInterface = /* obtained from device */;

if ([bpInterface isSupportMonitorScheduleTime]) {
TSLog(@"Device supports configuring monitor time range");
} else {
TSLog(@"Device does not support configuring monitor time range");
}

Check if device supports configuring monitor interval

Query whether the device allows configuration of the monitoring interval for automatic blood pressure checks.

- (BOOL)isSupportMonitorScheduleInterval;

Returns: BOOLYES if the device supports configuring monitoring interval, NO otherwise.

Discussion: When this method returns YES, the interval field of TSMonitorSchedule is effective.

Code Example:

id<TSBloodPressureInterface> bpInterface = /* obtained from device */;

if ([bpInterface isSupportMonitorScheduleInterval]) {
TSLog(@"Device supports configuring monitor interval");
} else {
TSLog(@"Device does not support configuring monitor interval");
}

Configure automatic blood pressure monitoring

Push automatic blood pressure monitoring configuration to the device.

- (void)pushAutoMonitorConfigs:(TSAutoMonitorBPConfigs *_Nonnull)configuration
completion:(nonnull TSCompletionBlock)completion;
ParameterTypeDescription
configurationTSAutoMonitorBPConfigs *Configuration parameters for automatic monitoring including schedule and other settings
completionvoid (^)(NSError *)Completion block called when configuration is applied or fails; receives error if applicable

Code Example:

id<TSBloodPressureInterface> bpInterface = /* obtained from device */;
TSAutoMonitorBPConfigs *config = [[TSAutoMonitorBPConfigs alloc] init];
// Configure monitoring schedule
config.enabled = YES;
// Set other configuration properties as needed

[bpInterface pushAutoMonitorConfigs:config
completion:^(NSError * _Nullable error) {
if (error) {
TSLog(@"Failed to configure automatic monitoring: %@",
error.localizedDescription);
} else {
TSLog(@"Automatic blood pressure monitoring configured successfully");
}
}];

Get current automatic blood pressure monitoring configuration

Retrieve the current automatic monitoring configuration from the device.

- (void)fetchAutoMonitorConfigsWithCompletion:(nonnull void (^)(TSAutoMonitorBPConfigs *_Nullable configuration, NSError *_Nullable error))completion;
ParameterTypeDescription
completionvoid (^)(TSAutoMonitorBPConfigs *, NSError *)Completion block with the current configuration or error; configuration is nil if error occurs

Code Example:

id<TSBloodPressureInterface> bpInterface = /* obtained from device */;

[bpInterface fetchAutoMonitorConfigsWithCompletion:^(TSAutoMonitorBPConfigs * _Nullable configuration, NSError * _Nullable error) {
if (error) {
TSLog(@"Failed to fetch configuration: %@", error.localizedDescription);
} else if (configuration) {
TSLog(@"Current auto-monitor config: enabled=%@",
configuration.enabled ? @"YES" : @"NO");
}
}];

Synchronize raw blood pressure data within a time range

Retrieve all raw blood pressure measurements recorded between two specific timestamps.

- (void)syncRawDataFromStartTime:(NSTimeInterval)startTime
endTime:(NSTimeInterval)endTime
completion:(nonnull void (^)(NSArray<TSBPValueItem *> *_Nullable bpItems, NSError *_Nullable error))completion;
ParameterTypeDescription
startTimeNSTimeIntervalStart time for data synchronization (Unix timestamp in seconds since 1970-01-01 00:00:00 UTC)
endTimeNSTimeIntervalEnd time for data synchronization (Unix timestamp in seconds since 1970-01-01 00:00:00 UTC); must be later than startTime
completionvoid (^)(NSArray<TSBPValueItem *> *, NSError *)Completion block with array of synchronized raw BP items or error; items are nil if error occurs

Code Example:

id<TSBloodPressureInterface> bpInterface = /* obtained from device */;

// Sync data for the last 7 days
NSTimeInterval endTime = [[NSDate date] timeIntervalSince1970];
NSTimeInterval startTime = endTime - (7 * 24 * 3600);

[bpInterface syncRawDataFromStartTime:startTime
endTime:endTime
completion:^(NSArray<TSBPValueItem *> * _Nullable bpItems, NSError * _Nullable error) {
if (error) {
TSLog(@"Failed to sync raw BP data: %@", error.localizedDescription);
} else {
TSLog(@"Synced %lu raw BP measurements", (unsigned long)bpItems.count);
for (TSBPValueItem *item in bpItems) {
TSLog(@"BP: %u/%u at %@", item.systolic, item.diastolic,
[NSDate dateWithTimeIntervalSince1970:item.timestamp]);
}
}
}];

Synchronize raw blood pressure data from start time to now

Retrieve all raw blood pressure measurements from a specified start time until the current moment.

- (void)syncRawDataFromStartTime:(NSTimeInterval)startTime
completion:(nonnull void (^)(NSArray<TSBPValueItem *> *_Nullable bpItems, NSError *_Nullable error))completion;
ParameterTypeDescription
startTimeNSTimeIntervalStart time for data synchronization (Unix timestamp in seconds since 1970-01-01 00:00:00 UTC)
completionvoid (^)(NSArray<TSBPValueItem *> *, NSError *)Completion block with array of synchronized raw BP items or error; items are nil if error occurs

Code Example:

id<TSBloodPressureInterface> bpInterface = /* obtained from device */;

// Sync all BP data since January 1, 2024
NSDateComponents *components = [[NSDateComponents alloc] init];
components.year = 2024;
components.month = 1;
components.day = 1;
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDate *startDate = [calendar dateFromComponents:components];

[bpInterface syncRawDataFromStartTime:[startDate timeIntervalSince1970]
completion:^(NSArray<TSBPValueItem *> * _Nullable bpItems, NSError * _Nullable error) {
if (error) {
TSLog(@"Failed to sync BP data: %@", error.localizedDescription);
} else {
TSLog(@"Successfully synced %lu BP records", (unsigned long)bpItems.count);
}
}];

Synchronize daily blood pressure data within a time range

Retrieve daily aggregated blood pressure statistics for the specified date range. Time parameters are automatically normalized to day boundaries (00:00:00 to 23:59:59).

- (void)syncDailyDataFromStartTime:(NSTimeInterval)startTime
endTime:(NSTimeInterval)endTime
completion:(nonnull void (^)(NSArray<TSBPDailyModel *> *_Nullable dailyModels, NSError *_Nullable error))completion;
ParameterTypeDescription
startTimeNSTimeIntervalStart time normalized to 00:00:00 of the specified date (Unix timestamp); must be earlier than endTime
endTimeNSTimeIntervalEnd time normalized to 23:59:59 of the specified date (Unix timestamp); must be later than startTime and not in the future
completionvoid (^)(NSArray<TSBPDailyModel *> *, NSError *)Completion block with array of daily BP models or error; each model represents one day; models are nil if error occurs

Discussion: This method synchronizes daily aggregated blood pressure data within the given time range. Time parameters are automatically normalized to day boundaries. Data is returned in ascending chronological order with each element representing one day's aggregated data.

Code Example:

id<TSBloodPressureInterface> bpInterface = /* obtained from device */;

// Sync daily data for the last 30 days
NSDate *endDate = [NSDate date];
NSDate *startDate = [endDate dateByAddingTimeInterval:-(30 * 24 * 3600)];

[bpInterface syncDailyDataFromStartTime:[startDate timeIntervalSince1970]
endTime:[endDate timeIntervalSince1970]
completion:^(NSArray<TSBPDailyModel *> * _Nullable dailyModels, NSError * _Nullable error) {
if (error) {
TSLog(@"Failed to sync daily BP data: %@", error.localizedDescription);
} else {
TSLog(@"Retrieved daily BP data for %lu days", (unsigned long)dailyModels.count);
for (TSBPDailyModel *dailyModel in dailyModels) {
TSLog(@"Date: %@, Max: %u/%u, Min: %u/%u, Measurements: %lu",
[NSDate dateWithTimeIntervalSince1970:dailyModel.dayStartTime],
[dailyModel maxSystolic], [dailyModel maxDiastolic],
[dailyModel minSystolic], [dailyModel minDiastolic],
(unsigned long)dailyModel.allMeasuredItems.count);
}
}
}];

Synchronize daily blood pressure data from start time to now

Retrieve daily aggregated blood pressure statistics from a specified start date until the current date. Start time is automatically normalized to 00:00:00 of the specified day.

- (void)syncDailyDataFromStartTime:(NSTimeInterval)startTime
completion:(nonnull void (^)(NSArray<TSBPDailyModel *> *_Nullable dailyModels, NSError *_Nullable error))completion;
ParameterTypeDescription
startTimeNSTimeIntervalStart time normalized to 00:00:00 of the specified date (Unix timestamp); data syncs from this time to current time
completionvoid (^)(NSArray<TSBPDailyModel *> *, NSError *)Completion block with array of daily BP models or error; each model represents one day; models are nil if error occurs

Discussion: This method is a convenience wrapper that automatically sets the end time to the current time. Start time is normalized to 00:00:00 of the specified day. Data is returned in ascending chronological order with each element representing one day's aggregated data.

Code Example:

id<TSBloodPressureInterface> bpInterface = /* obtained from device */;

// Sync daily BP data from January 1, 2024 to today
NSDateComponents *components = [[NSDateComponents alloc] init];
components.year = 2024;
components.month = 1;
components.day = 1;
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDate *startDate = [calendar dateFromComponents:components];

[bpInterface syncDailyDataFromStartTime:[startDate timeIntervalSince1970]
completion:^(NSArray<TSBPDailyModel *> * _Nullable dailyModels, NSError * _Nullable error) {
if (error) {
TSLog(@"Failed to sync daily BP data: %@", error.localizedDescription);
} else {
TSLog(@"Successfully retrieved %lu days of BP data", (unsigned long)dailyModels.count);

// Access specific daily data
if (dailyModels.count > 0) {
TSBPDailyModel *todayData = dailyModels.lastObject;
TSLog(@"Today's BP - Max: %u/%u, Min: %u/%u",
[todayData maxSystolic], [todayData maxDiastolic],
[todayData minSystolic], [todayData minDiastolic]);
TSLog(@"Manual measurements: %lu, Auto measurements: %lu",
(unsigned long)todayData.manualItems.count,
(unsigned long)todayData.autoItems.count);
}
}
}];

Important Notes

  1. **Device Capability Verification**: Always check device capabilities using isSupportActivityMeasureByUser, isSupportAutomaticMonitoring, isSupportMonitorScheduleTime, and isSupportMonitorScheduleInterval before attempting related operations.

  2. **Measurement Handler Lifecycle**: All three handlers (start, data, end) are required for comprehensive measurement control. The data handler may be called multiple times during an active measurement to provide real-time updates.

  3. **Time Range Parameters**: For data synchronization methods, always provide valid Unix timestamps (seconds since 1970-01-01 00:00:00 UTC). The SDK automatically normalizes daily data time ranges to day boundaries.

  4. **Automatic Monitoring Configuration**: Device support for monitoring intervals and time ranges varies by device model. Check isSupportMonitorScheduleTime and isSupportMonitorScheduleInterval before using those fields in configuration.

  5. **Data Aggregation**: Daily data models automatically aggregate raw measurements into min/max values for both systolic and diastolic pressures, plus separate lists for manual and automatic measurements.

  6. **Completion Handler Threading**: All completion handlers are invoked on the main thread, making it safe to update UI elements directly in the callbacks.

  7. **Error Handling**: Always check the error parameter in completion handlers. A non-nil error indicates operation failure, and data should not be relied upon when errors are present.

  8. **Measurement Duration**: The TSActivityMeasureParam passed to startMeasureWithParam: should be configured appropriately for the device, typically 30-60 seconds for blood pressure measurements.

  9. **User-Initiated vs Automatic**: Use the isUserInitiated property of TSBPValueItem to distinguish between user-initiated manual measurements and device automatic monitoring results.

  10. **Data Consistency**: Daily models organize measurements chronologically and maintain separate extrema tracking for systolic and diastolic pressures to provide comprehensive health insights.