Skip to main content

Setting

The Setting module provides comprehensive device configuration management, allowing you to control wearing habits, notifications, display settings, and health monitoring behavior. All settings are persisted on the device and retained after power off, ensuring consistent user preferences across sessions.

Prerequisites

  • Device must be connected via Bluetooth
  • User must have appropriate permissions for health and notification settings
  • Device firmware must support the setting operations being requested
  • For call ring functionality, call notification permission is required

Data Models

TSWristWakeUpModel

Configures the wrist wake up feature settings for screen activation.

PropertyTypeDescription
isEnableBOOLEnable/disable status of wrist wake up feature
startTimeNSIntegerStart time in minutes from midnight (0-1439). Example: 480 = 8:00 AM
endTimeNSIntegerEnd time in minutes from midnight (0-1439). Example: 1320 = 10:00 PM. Must be greater than startTime

TSDoNotDisturbModel

Configures the do not disturb mode settings for the device.

PropertyTypeDescription
isEnabledBOOLWhether do not disturb mode is enabled
isTimePeriodModeBOOLYES for time period mode, NO for all-day mode
startTimeNSIntegerStart time in minutes from midnight (0-1440). Only used in time period mode
endTimeNSIntegerEnd time in minutes from midnight (0-1440). Must be greater than startTime. Only used in time period mode

Enumerations

TSWearingHabit

Specifies which hand the device is worn on.

ValueDescription
TSWearingHabitLeftDevice is worn on the left hand
TSWearingHabitRightDevice is worn on the right hand

Callback Types

TSCompletionBlock

typedef void (^TSCompletionBlock)(BOOL success, NSError *_Nullable error);

Standard completion callback for setting operations.

ParameterTypeDescription
successBOOLWhether the operation was successful
errorNSError *Error information if operation failed, nil if successful

API Reference

Set wearing habit

Sets which hand the device is worn on, affecting screen orientation and gesture recognition.

- (void)setWearingHabit:(TSWearingHabit)habit
completion:(TSCompletionBlock)completion;
ParameterTypeDescription
habitTSWearingHabitTarget wearing habit (left or right hand)
completionTSCompletionBlockCallback block invoked when operation completes

Code Example:

id<TSSettingInterface> settingInterface = (id<TSSettingInterface>)device;

[settingInterface setWearingHabit:TSWearingHabitRight
completion:^(BOOL success, NSError *error) {
if (success) {
TSLog(@"Wearing habit set to right hand successfully");
} else {
TSLog(@"Failed to set wearing habit: %@", error.localizedDescription);
}
}];

Get current wearing habit

Retrieves the current wearing habit setting from the device.

- (void)getCurrentWearingHabit:(void(^)(TSWearingHabit habit, NSError * _Nullable error))completion;
ParameterTypeDescription
completionvoid (^)(TSWearingHabit, NSError *)Callback block with current habit and error

Code Example:

id<TSSettingInterface> settingInterface = (id<TSSettingInterface>)device;

[settingInterface getCurrentWearingHabit:^(TSWearingHabit habit, NSError *error) {
if (!error) {
NSString *habitStr = (habit == TSWearingHabitLeft) ? @"Left" : @"Right";
TSLog(@"Current wearing habit: %@", habitStr);
} else {
TSLog(@"Failed to get wearing habit: %@", error.localizedDescription);
}
}];

Set Bluetooth disconnection vibration

Controls whether the device vibrates when Bluetooth connection is lost.

- (void)setBluetoothDisconnectionVibration:(BOOL)enabled
completion:(TSCompletionBlock)completion;
ParameterTypeDescription
enabledBOOLYES to enable vibration on Bluetooth disconnection, NO to disable
completionTSCompletionBlockCallback block invoked when operation completes

Code Example:

id<TSSettingInterface> settingInterface = (id<TSSettingInterface>)device;

[settingInterface setBluetoothDisconnectionVibration:YES
completion:^(BOOL success, NSError *error) {
if (success) {
TSLog(@"Bluetooth disconnection vibration enabled");
} else {
TSLog(@"Failed to set Bluetooth disconnection vibration: %@", error.localizedDescription);
}
}];

Get Bluetooth disconnection vibration status

Retrieves the current Bluetooth disconnection vibration setting.

- (void)getBluetoothDisconnectionVibrationStatus:(void(^)(BOOL enabled, NSError * _Nullable error))completion;
ParameterTypeDescription
completionvoid (^)(BOOL, NSError *)Callback block with current status and error

Code Example:

id<TSSettingInterface> settingInterface = (id<TSSettingInterface>)device;

[settingInterface getBluetoothDisconnectionVibrationStatus:^(BOOL enabled, NSError *error) {
if (!error) {
TSLog(@"Bluetooth disconnection vibration is %@", enabled ? @"enabled" : @"disabled");
} else {
TSLog(@"Failed to get Bluetooth disconnection vibration status: %@", error.localizedDescription);
}
}];

Set exercise goal achievement reminder

Controls whether the device notifies when exercise goals are achieved.

- (void)setExerciseGoalReminder:(BOOL)enabled
completion:(TSCompletionBlock)completion;
ParameterTypeDescription
enabledBOOLYES to enable goal achievement reminders, NO to disable
completionTSCompletionBlockCallback block invoked when operation completes

Code Example:

id<TSSettingInterface> settingInterface = (id<TSSettingInterface>)device;

[settingInterface setExerciseGoalReminder:YES
completion:^(BOOL success, NSError *error) {
if (success) {
TSLog(@"Exercise goal reminder enabled");
} else {
TSLog(@"Failed to set exercise goal reminder: %@", error.localizedDescription);
}
}];

Get exercise goal reminder status

Retrieves the current exercise goal reminder setting.

- (void)getExerciseGoalReminderStatus:(void(^)(BOOL enabled, NSError * _Nullable error))completion;
ParameterTypeDescription
completionvoid (^)(BOOL, NSError *)Callback block with current status and error

Code Example:

id<TSSettingInterface> settingInterface = (id<TSSettingInterface>)device;

[settingInterface getExerciseGoalReminderStatus:^(BOOL enabled, NSError *error) {
if (!error) {
TSLog(@"Exercise goal reminder is %@", enabled ? @"enabled" : @"disabled");
} else {
TSLog(@"Failed to get exercise goal reminder status: %@", error.localizedDescription);
}
}];

Set call ring

Controls device behavior for incoming calls, including ringtone and vibration.

- (void)setCallRing:(BOOL)enabled
completion:(TSCompletionBlock)completion;
ParameterTypeDescription
enabledBOOLYES to enable call ring and vibration, NO to disable
completionTSCompletionBlockCallback block invoked when operation completes

Code Example:

id<TSSettingInterface> settingInterface = (id<TSSettingInterface>)device;

[settingInterface setCallRing:YES
completion:^(BOOL success, NSError *error) {
if (success) {
TSLog(@"Call ring enabled");
} else {
TSLog(@"Failed to set call ring: %@", error.localizedDescription);
}
}];

Get call ring status

Retrieves the current call ring setting.

- (void)getCallRingStatus:(void(^)(BOOL enabled, NSError * _Nullable error))completion;
ParameterTypeDescription
completionvoid (^)(BOOL, NSError *)Callback block with current status and error

Code Example:

id<TSSettingInterface> settingInterface = (id<TSSettingInterface>)device;

[settingInterface getCallRingStatus:^(BOOL enabled, NSError *error) {
if (!error) {
TSLog(@"Call ring is %@", enabled ? @"enabled" : @"disabled");
} else {
TSLog(@"Failed to get call ring status: %@", error.localizedDescription);
}
}];

Set raise wrist to wake screen

Configures the wrist wake up feature including enable status and time period.

- (void)setRaiseWristToWake:(TSWristWakeUpModel *)model
completion:(TSCompletionBlock)completion;
ParameterTypeDescription
modelTSWristWakeUpModel *Model containing wake up settings with isEnable, startTime, and endTime properties
completionTSCompletionBlockCallback block invoked when operation completes

Code Example:

id<TSSettingInterface> settingInterface = (id<TSSettingInterface>)device;

TSWristWakeUpModel *model = [[TSWristWakeUpModel alloc] init];
model.isEnable = YES;
model.startTime = 480; // 8:00 AM
model.endTime = 1320; // 10:00 PM

[settingInterface setRaiseWristToWake:model
completion:^(BOOL success, NSError *error) {
if (success) {
TSLog(@"Raise wrist to wake configured successfully");
} else {
TSLog(@"Failed to set raise wrist to wake: %@", error.localizedDescription);
}
}];

Get raise wrist to wake screen settings

Retrieves the current wrist wake up feature configuration.

- (void)getRaiseWristToWakeStatus:(void(^)(TSWristWakeUpModel * _Nullable model, 
NSError * _Nullable error))completion;
ParameterTypeDescription
completionvoid (^)(TSWristWakeUpModel *, NSError *)Callback block with current model and error

Code Example:

id<TSSettingInterface> settingInterface = (id<TSSettingInterface>)device;

[settingInterface getRaiseWristToWakeStatus:^(TSWristWakeUpModel *model, NSError *error) {
if (!error && model) {
TSLog(@"Raise wrist to wake is %@, from %ld to %ld minutes from midnight",
model.isEnable ? @"enabled" : @"disabled",
(long)model.startTime,
(long)model.endTime);
} else {
TSLog(@"Failed to get raise wrist to wake status: %@", error.localizedDescription);
}
}];

Register raise wrist to wake configuration change listener

Registers a callback to receive notifications when wrist wake up settings change on the device.

- (void)registerRaiseWristToWakeDidChanged:(void(^)(TSWristWakeUpModel * _Nullable model,
NSError * _Nullable error))didChangeBlock;
ParameterTypeDescription
didChangeBlockvoid (^)(TSWristWakeUpModel *, NSError *)Callback block invoked when configuration changes, providing updated model or error

Code Example:

id<TSSettingInterface> settingInterface = (id<TSSettingInterface>)device;

void (^changeHandler)(TSWristWakeUpModel *, NSError *) = ^(TSWristWakeUpModel *model, NSError *error) {
if (!error && model) {
TSLog(@"Wrist wake up configuration changed: enabled=%d, from %ld to %ld",
model.isEnable,
(long)model.startTime,
(long)model.endTime);
} else {
TSLog(@"Configuration change notification error: %@", error.localizedDescription);
}
};

[settingInterface registerRaiseWristToWakeDidChanged:changeHandler];

Set do not disturb mode

Configures the do not disturb mode settings including enable status and time period.

- (void)setDoNotDisturb:(TSDoNotDisturbModel *)model
completion:(TSCompletionBlock)completion;
ParameterTypeDescription
modelTSDoNotDisturbModel *Model containing DND settings with isEnabled, isTimePeriodMode, startTime, and endTime properties
completionTSCompletionBlockCallback block invoked when operation completes

Code Example:

id<TSSettingInterface> settingInterface = (id<TSSettingInterface>)device;

TSDoNotDisturbModel *model = [[TSDoNotDisturbModel alloc] init];
model.isEnabled = YES;
model.isTimePeriodMode = YES;
model.startTime = 720; // 12:00 PM
model.endTime = 840; // 2:00 PM

[settingInterface setDoNotDisturb:model
completion:^(BOOL success, NSError *error) {
if (success) {
TSLog(@"Do not disturb mode configured successfully");
} else {
TSLog(@"Failed to set do not disturb mode: %@", error.localizedDescription);
}
}];

Get do not disturb mode settings

Retrieves the current do not disturb mode configuration from the device.

- (void)getDoNotDisturbInfo:(void(^)(TSDoNotDisturbModel * _Nullable model,
NSError * _Nullable error))completion;
ParameterTypeDescription
completionvoid (^)(TSDoNotDisturbModel *, NSError *)Callback block with current model and error

Code Example:

id<TSSettingInterface> settingInterface = (id<TSSettingInterface>)device;

[settingInterface getDoNotDisturbInfo:^(TSDoNotDisturbModel *model, NSError *error) {
if (!error && model) {
if (model.isEnabled) {
if (model.isTimePeriodMode) {
TSLog(@"DND enabled in time period mode: from %ld to %ld",
(long)model.startTime,
(long)model.endTime);
} else {
TSLog(@"DND enabled in all-day mode");
}
} else {
TSLog(@"DND is disabled");
}
} else {
TSLog(@"Failed to get do not disturb info: %@", error.localizedDescription);
}
}];

Set enhanced monitoring mode

Enables or disables enhanced health monitoring with higher precision and data collection frequency.

- (void)setEnhancedMonitoring:(BOOL)enabled
completion:(TSCompletionBlock)completion;
ParameterTypeDescription
enabledBOOLYES to enable enhanced monitoring with higher precision, NO for standard monitoring
completionTSCompletionBlockCallback block invoked when operation completes

Code Example:

id<TSSettingInterface> settingInterface = (id<TSSettingInterface>)device;

[settingInterface setEnhancedMonitoring:YES
completion:^(BOOL success, NSError *error) {
if (success) {
TSLog(@"Enhanced monitoring enabled");
} else {
TSLog(@"Failed to set enhanced monitoring: %@", error.localizedDescription);
}
}];

Get enhanced monitoring mode status

Retrieves the current enhanced monitoring mode setting.

- (void)getEnhancedMonitoringStatus:(void(^)(BOOL enabled, NSError * _Nullable error))completion;
ParameterTypeDescription
completionvoid (^)(BOOL, NSError *)Callback block with current status and error

Code Example:

id<TSSettingInterface> settingInterface = (id<TSSettingInterface>)device;

[settingInterface getEnhancedMonitoringStatus:^(BOOL enabled, NSError *error) {
if (!error) {
TSLog(@"Enhanced monitoring is %@", enabled ? @"enabled" : @"disabled");
} else {
TSLog(@"Failed to get enhanced monitoring status: %@", error.localizedDescription);
}
}];

Check individual health monitor configuration support

Determines whether the device supports independent configuration for each health monitor type.

- (BOOL)isSupportIndividualHealthMonitorConfig;
Return ValueDescription
BOOLYES if individual health monitor types can be configured separately, NO if only global enhanced monitoring control is supported

Code Example:

id<TSSettingInterface> settingInterface = (id<TSSettingInterface>)device;

if ([settingInterface isSupportIndividualHealthMonitorConfig]) {
TSLog(@"Device supports individual health monitor configuration");
// Can call individual health monitor set/get config APIs
} else {
TSLog(@"Device only supports global enhanced monitoring control");
// Use setEnhancedMonitoring: / getEnhancedMonitoringStatus: instead
}

Important Notes

  1. Time format consistency: All time values are expressed as minutes from midnight (0-1439). For example, 480 = 8:00 AM, 1320 = 10:00 PM. Ensure end times are always greater than start times when configuring time periods.

  2. Bluetooth connection requirement: All setting operations require an active Bluetooth connection to the device. Operations will fail with an error if the device is disconnected.

  3. Persistence guarantee: All configuration changes are automatically persisted on the device and will be retained even after device power off and restart.

  4. Synchronous state validation: When setting new values, verify the changes by reading back the settings to ensure they were applied correctly, as device firmware may enforce validation rules.

  5. Multiple listener registration: For configuration change listeners (e.g., raise wrist to wake), you can register multiple callbacks simultaneously. Each will be invoked independently when changes occur.

  6. Enhanced monitoring impact: Enabling enhanced monitoring increases battery consumption. Consider battery life implications when configuring monitoring settings.

  7. Individual health monitor capability: Before using individual health monitor configuration APIs from other modules (e.g., TSAutoMonitorInterface), always call isSupportIndividualHealthMonitorConfig first. If it returns NO, fall back to global enhanced monitoring control.

  8. Do not disturb all-day mode: When isTimePeriodMode is NO, the device enters all-day do not disturb mode and the startTime and endTime values are ignored.

  9. Call notification permissions: Call ring functionality requires proper system permissions. Ensure the app has requested and received call notification permissions before enabling call ring settings.

  10. Wearing habit effects: Changing the wearing habit affects multiple device behaviors including screen orientation, gesture recognition direction, and raise wrist detection sensitivity. Notify users of these side effects when changing this setting.