按键防误触

更新时间:2025-04-11 02:05:56下载pdf

用途

解决网关按键误触重置问题。

接入

业务包版本要在 v6.2.0 及以上。

source 'https://github.com/tuya/tuya-pod-specs.git'
platform :ios, '11.0'

target 'Your_Project_Name' do
    pod "ThingSmartBusinessExtensionKit"
end

API 说明

模型

按键防误触管理类

open class ThingAntiMisoperationManager : NSObject {
    ...
}

按键防误触监听器

public protocol ThingAntiMisoperationManagerListener : NSObjectProtocol {
    optional func antiMisoperationManager(_ manager: ThingAntiMisoperationManager, statusDidUpdate status: Bool)
}

按键防误触管理类接口

  • 添加监听器

    open func add(_ listener: any ThingAntiMisoperationManagerListener)
    
    入参 类型 说明
    listener ThingAntiMisoperationManagerListener 监听器对象
  • 移除监听器

    open func remove(_ listener: any ThingAntiMisoperationManagerListener)
    
    入参 类型 说明
    listener ThingAntiMisoperationManagerListener 监听器对象
  • 判断设备是否支持按键防误触

    open func isSupport(success: ((Bool) -> Void)?, failure: ((any Error) -> Void)? = nil)
    
    入参 类型 说明
    success Bool 成功回调。true 表示支持,false 表示不支持
    failure error 错误信息
  • 获取按键防误触状态

    open func getStatus()
    

    需要通过监听器获取状态回调。

  • 更新按键防误触状态

    open func updateStatus(_ status: Bool)
    
    入参 类型 说明
    status Bool 按键防误触状态

    需要通过监听器获取状态回调。

使用示例

业务层SDK判断设备是否支持按键防误触是否支持设置监听器获取状态通过监听器回调状态更新状态通过监听器回调状态alt[支持]业务层SDK

Demo

更多信息,参考 Demo