API and Version Notes
Applies to react-native-gizwits-sdk-v5@1.7.11-beta, with native dependencies Android 1.4.12 and iOS ~> 2.1.8.
SDK Management
import RNGizSDKManagerModule from 'react-native-gizwits-sdk-v5';
const devicesResult = await RNGizSDKManagerModule.getDevices();
if (devicesResult.success) {
console.log(devicesResult.data);
}
const configResult = await RNGizSDKManagerModule.getProductDataPointConfig('PRODUCT_KEY');Devices returned by getDevices() have capability methods attached. The current declaration incorrectly uses a one-element tuple [IDevice]; runtime data can contain zero or more devices.
cleanCache() clears cached data; it does not destroy the SDK. There is no public destroy() or destory(). Initialize once with initSDK() to avoid duplicate native listeners, and remove component listeners with their corresponding remove...Listener methods.
Provisioning and OTA Differences
| Feature | Current supported path |
|---|---|
BLE bindWithUid | Use RNGizDeviceManagerModule.provideWiFiCredentials(id, 'BLE', ssid, password, timeout, callback, bindWithUid); the device convenience method drops the flag |
| AI module cloud binding | Enable bindWithUid and authorize the user when the AI module establishes its own cloud binding; see BLE provisioning |
LAN bindWithUid | The native bridge forces false, even when JS passes true |
| AirLink | Use the native callback API in AirLink provisioning |
| Cancel OTA | Available natively but not wrapped on the JS device; see Cancel OTA |
| Provisioning timeout | Seconds on Android and iOS; use 60 for 60 seconds |
Ordinary business failures resolve with GizResult.success === false rather than automatically rejecting the Promise. Also handle exceptions such as bridge errors. Do not rely on catch alone for business failures.
Types and Native Data
getAuthorizeData()normalizes authorization to{ uid, token }. Android login results do not contain that object, and registration results useuserId; query authorization explicitly.GizWiFiActivatorEvent.datais a string on Android and a number on iOS. The event list includes device log events missing from the current TypeScript union.- Serialized BLE profiles include
support5GConfigandbleModuleVariant, which are missing from RN declarations. - Native BLE
protocolVersionandauthenticationMethodvalues are strings, while RN still declares numbers. Narrow actual runtime values instead of relying on numeric comparisons. - Android
sendDp()reports success without guaranteeing a complete data point payload. ObserveaddDeviceDataListeneror callgetDp()for data. The currentsendDp()andstartUpgrade()declarations overstate theirdatapayloads; check that fields actually exist.
Musical Rhythm
Device objects expose startMusicalRhythm(sensitivity, mode, callback?) and stopMusicalRhythm(). mode is 'ROCK' or 'SOOTHING'; callbacks contain { deviceID, data }. Recording permission and device support are required.
const result = await device.startMusicalRhythm(50, 'ROCK', ({ deviceID, data }) => {
console.log(deviceID, data.isBeat, data.bpm);
});
// Stop when no longer needed:
// await device.stopMusicalRhythm();