Wi-Fi AP Mode

Last Updated on : 2026-01-29 03:17:34download

This topic describes the access point (AP) to pair devices. It is a connection capability for pairing over Wi-Fi. In the pairing process, a mobile phone connects to the AP of the smart device and broadcasts the Wi-Fi credentials and pairing token over the LAN to enable the smart device to get this information for network connection and pairing. With a high success rate and good reliability, this mode adapts to 2.4 GHz and 5 GHz dual-band routers. However, users need to manually switch between the Wi-Fi bands connected to the mobile phone.

Pairing process

  • Before pairing.

    • Guide the user to reset the device to Wi-Fi AP mode, typically identified by a slow-blinking Wi-Fi indicator.
    • Guide the user to connect their phone to a Wi-Fi network, usually a 2.4 GHz Wi-Fi network.
  • Get the pairing token and Wi-Fi network credentials.

    • The app gets the pairing token by calling the method in the SDK.
    • The app gets the Wi-Fi network credentials (SSID and password) input by the user.
  • Connect to AP.

    Guide the user to connect their phone to the AP emitted by the device.

  • Start pairing.

    The app calls the pairing method in the SDK to set the Wi-Fi network credentials (SSID and password) and the pairing token.

  • Finish pairing.

    The device automatically turns off the AP. The app receives a callback from the SDK and finishes the pairing process.

AP pairing API example

For more information, see Device Pairing.

Get a pairing token

// Get a token.
this.activatorToken = await TSmartActivatorRequester.getActivatorToken(this.homeId)

Implement methods in the pairing listener

activatorListener: ITSmartActivatorListener = {
    onActiveSetpAndError: (step: TSmartActivatorStep, error?: Error, device?: TSmartDeviceModel) => {
      // Implement the relevant logic.
    },

    onActiveSuccess: (deviceModel: TSmartDeviceModel) => {
      // Handle the logic for successful pairing, such as updating the UI and navigating to the next page.
    },
};

Create AP pairing instance

const activatorBuilder = TSmartActivator.buildApActivatorBuilder(
            this.ssid,
            this.password,
            120 * 1000,
            this.activatorToken,
            this.activatorListener,
          )
this.activator = TSmartActivator.createActivator(activatorBuilder);

Start pairing

this.activator.startActive()

Stop pairing

this.activator.stopActive()