Device Registration
Device registration covers two different actions: creating a unified GizDevice in the SDK cache and registering that device with Gizwits Cloud. A transport module normally performs the first action when it discovers a device.
Register a unified device object
When an application must explicitly obtain a device by ProductKey and MAC address:
import { GizSDKManager } from '@gizwits/smart-sdk';
const device = GizSDKManager.registerDevice('your-product-key', 'AABBCCDDEEFF');
if (device === undefined) {
throw new Error('The product is not configured');
}The ProductKey must exist in GizConfiguration. Reusing the same ProductKey and MAC returns the same object from the unified cache.
Register with the cloud
After obtaining registration data and authenticating the user:
await device.register();The user manager also accepts explicit registration fields:
await userManager.registerDevice(productKey, mac, deviceId, randomCode);Cloud registration and user binding are separate operations. Call a binding API when the device must belong to the current account.