Last Updated on : 2026-01-30 01:42:25download
A wired device connects to a router over an Ethernet cable. During the pairing process, users do not need to enter the name and password of the router.
For more information, see Device Pairing.
The SDK provides the capability to discover a wired device pending pairing. The device must be connected to the same network as the mobile phone to enable pairing. Device information is then obtained by implementing the TSmartScannerListener scanning listener.
Implement the scan result listener
scanListener: TSmartScannerListener = {
onDeviceFound: (scanResult: TSmartScannerResult): void => {
// Implement the relevant logic.
}
};
Construct the scanner instance
// Create a scanner instance using the scan listener.
this.scanner = new TSmartScannerBuilder(this.scanListener);
// Set scan timeout and scan mode.
this.scanner.setScanTimeout(120000).addScanMode(TSmartScanMode.SCAN_MODE_LAN);
Start scanning
this.scanner.startScan();
Stop scanning
this.scanner.stopScan();
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 a wired pairing instance
const activatorBuilder = TSmartActivator.buildWiredActivatorBuilder(
this.homeId,
gwId,
productId,
120 * 1000,
this.activatorListener,
this.activatorToken
)
this.activator = TSmartActivator.createActivator(activatorBuilder);
Start pairing
this.activator.startActive()
Stop pairing
this.activator.stopActive()
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback