Anti-Misoperation Mechanism for Buttons

Last Updated on : 2025-04-16 03:18:57Copy for LLMView as MarkdownDownload PDF

Purpose

Resolve the issue of the gateway resetting after the gateway button is accidentally pressed.

Integration

The UI BizBundle must be v6.2.0 or later.

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

target 'Your_Project_Name' do
    pod "ThingSmartBusinessExtensionKit"
end

API description

Model

Management class of the button anti-misoperation

open class ThingAntiMisoperationManager : NSObject {
    ...
}

Listener for the button anti-misoperation

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

APIs of the button anti-misoperation management

  • Add a listener.

    open func add(_ listener: any ThingAntiMisoperationManagerListener)
    
    Request parameter Type Description
    listener ThingAntiMisoperationManagerListener The listener object.
  • Remove a listener.

    open func remove(_ listener: any ThingAntiMisoperationManagerListener)
    
    Request parameter Type Description
    listener ThingAntiMisoperationManagerListener The listener object.
  • Check whether the device supports the button anti-misoperation mechanism.

    open func isSupport(success: ((Bool) -> Void)?, failure: ((any Error) -> Void)? = nil)
    
    Request parameter Type Description
    success Boolean The success callback. true: supported. false: not supported.
    failure error The error message.
  • Get the button anti-misoperation status.

    open func getStatus()
    

    Get the status callback via the listener.

  • Update the button anti-misoperation status.

    open func updateStatus(_ status: Bool)
    
    Request parameter Type Description
    status Boolean The button anti-misoperation status.

    Get the status callback via the listener.

Example

Service LayerSDKCheck support for button anti-misoperationSupported or notSet a listenerGet the statusGet the status callback via the listenerUpdate the statusGet the status callback via the listeneralt[Supported]Service LayerSDK

Demo

For more information, see the Demo.