BLE Provisioning
timeout is in seconds on both Android and iOS. Pass 60 for 60 seconds.
AI module requirement: when an AI module establishes its own binding relationship with the cloud, SDK provisioning must set bindWithUid = true. Sign in first, or supply a valid uid and token. This mode uses the current user’s bound-device list to confirm provisioning. Pass false for ordinary provisioning. The flag does not replace sign-in or mean that the app calls the device’s bind() method.
In 1.7.11-beta, device.bleCapability.provideWiFiCredentials does not forward bindWithUid. To enable it, use RNGizDeviceManagerModule as shown below.
import { RNGizDeviceManagerModule } from 'react-native-gizwits-sdk-v5';
import type { Types } from 'react-native-gizwits-sdk-v5';
const progressHandler: Types.GizProvideWiFiCredentialsCallback = event => {
// Android uses strings; iOS uses numbers. See the provisioning event list.
if (event.data === 'WIFI_CONFIG_SUCCESS' || event.data === 1013) {
console.log('Provisioning succeeded');
}
};
const bindWithUid = true; // The AI module establishes its own cloud binding
if (!device.bleCapability.profile.configured && device.bleCapability.netStatus >= 1) {
const result = await RNGizDeviceManagerModule.provideWiFiCredentials(
device.id, 'BLE', ssid, password, 60, progressHandler, bindWithUid,
);
if (!result.success) console.log(result.error, result.message);
}Stop Provisioning
await device.bleCapability.stopProvideWiFiCredentials();