Skip to Content
本页目录

deviceSettings

设备设置

建议每次只修改一个属性,因为需要在设备上进行确认。

const result = await HardwareSDK.deviceSettings(connectId, params);

参数

可选通用参数

参数类型可用范围与含义
languagestring设备支持的语言代码;核对所安装 SDK 的设置能力。
labelstring设备显示名称。
usePassphraseboolean请求更改密码短语保护设置,需要设备确认。
autoLockDelayMsnumber自动锁定延迟;Protocol V2 只接受列举的选项,不是任意毫秒值。
autoShutdownDelayMsnumber自动关机延迟;Protocol V2 只接受列举的选项。
hapticFeedback、bluetoothEnabledboolean随设备能力变化的触觉反馈和蓝牙设置。
homescreenstringProtocol V1 主屏幕数据。
passphraseSourcenumberProtocol V1 密码短语输入源设置。
passphraseAlwaysOnDevicebooleanProtocol V1 设备端输入策略。
displayRotationnumberProtocol V1 显示旋转。
safetyChecksEnum_SafetyCheckLevelProtocol V1 安全策略。除非用户明确请求受支持的变更,否则保留严格检查。
experimentalFeaturesbooleanProtocol V1 实验性消息支持。
changeBrightnessbooleanProtocol V1 设备端亮度调整流程。
brightnessnumberProtocol V2 亮度,必须在支持范围内。
airgapModebooleanProtocol V2 设备端 Air-Gap 设置流程。
animationEnabled、tapToWake、deviceNameDisplayEnabledbooleanProtocol V2 显示与交互设置。
fidoEnabled、usbLockEnabled、randomKeypadbooleanProtocol V2 安全相关设置。

当前 DeviceSettingsParams 类型定义了公开字段。不支持当前协议的字段会被拒绝。展示设置控件前,读取已连接设备的设置和能力;类型中存在某字段不代表所有机型都支持它。

只更改用户选中的设置。密码短语保护或连接设置可能影响当前流程,操作后应刷新状态;宿主弹窗关闭不代表设备操作成功。

示例

const result = await HardwareSDK.deviceSettings(connectId, { label: 'My OneKey Wallet' }); if (!result.success) throw new Error(result.payload.error);

返回结果

{ success: true, payload: { message: string } }

错误

{ success: false, payload: { error: string, // 错误信息 code?: string | number // 错误码 } }
最后更新于