validDeviceOnlineType(params: Object)

Requires:
DeviceKit≥1.2.6@ray-js/ray≥0.6.23
Platforms:
iOSAndroid
import { device } from '@ray-js/ray';

const { validDeviceOnlineType } = device;

// Promise usage
try {
  const res = await validDeviceOnlineType({ ...params });
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

Description

Check whether the specified online type (onlineType) matches the connectivity type defined in the device thing model

Parameters

PropertyTypeRequiredDescription
deviceIdstringYesDevice ID
onlineTypenumberYesDevice network online types, represented as bitwise flags; multiple online states can be combined. Defined as follows: bit 0 (1 << 0): Wi‑Fi online (Cloud online || LAN online). If you only want to check cloud online, use bit 7 bit 1 (1 << 1): Local online, LAN online bit 2 (1 << 2): BLE online (Bluetooth online) bit 3 (1 << 3): BLEMesh online (Bluetooth mesh online) bit 4 (1 << 4): Beacon online bit 5 (1 << 5): Dayu online bit 6 (1 << 6): System BT online (system Bluetooth online) bit 7 (1 << 7): Cloud online bit 8 (1 << 8): Matter online (Matter local online)
complete() => voidNoCompletion callback (executed on both success and failure)
NoCallback on successful API call
fail(params: Object) => voidNoFailure callback
fail callback parameters
PropertyTypeDescription
errorMsgstringError message
errorCodestring | numberError code
Error extension

Return Value

None

Examples

import { device } from '@ray-js/ray'

device.validDeviceOnlineType({
  deviceId: "xx",
  onlineType: 1,
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});