App Scanning IPC's QR Code for Activation and Binding

Last Updated on : 2024-01-30 09:56:12download

If an IPC has been connected to a WAN and generated a short URL, you can create a QR code with the short URL and place it on the device or display it on the screen. The user can scan the QR code with the mobile app to pair the device.

Process

DeviceRouterCloudAppConnect to the router's Wi-Fi.Connected.Access the WAN.Initiate connection over MQTT.Determine if thedevice can directlyconnect to thecloud.Connected.Request the short URL.Return the short URL.Display the short URLwith a QR code.App scans the device's QR code.Get the token.Return the token.Send the token.Disconnect the MQTT connection.Get registered and activated.Activated.Query device information.Return device information.DeviceRouterCloudAppActivation and Binding with QR Code

Development guide

Prerequisites

  • You have a Tuya-enabled app, router, and device ready.
  • You have connected the device to the router over a wired or wireless connection.
  • The device is capable of converting a short URL into a QR code. Or the QR code has been attached to the device body during production.
  • The router can access the WAN.

Device development

The callback for the short URL.

    ipc_sdk_run_var.qrcode_active_cb = TUYA_IPC_qrcode_shorturl_cb;

FAQs

Why hasn’t the callback for the short URL been triggered?

  1. Check if the WAN works fine.
  2. Check if all the required tkl_wifi.c and tkl_wired.c APIs are adapted.
  3. Verify if tkl_wifi_init(WIFI_EVENT_CB cb) or tkl_wired_set_status_cb(TKL_WIRED_STATUS_CHANGE_CB cb) notifies the SDK of the current network status when the network changes.
  4. Check with your project manager if the UUID has been flagged for direct cloud connectivity.

How can I set the pairing mode and connection mode?

Activation and binding with a QR code requires the device to connect to the internet. It is recommended to use the wired connection to set up the pairing mode and connection mode.

  • Set the pairing mode to: PARING_MODE_WIRED.
  • Set the connection mode to: TUYA_IPC_LINK_WIRE.
  • Adapt tkl_wired.c.