queryDps(params: Object)

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

const { queryDps } = device;

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

Description

Query dps

Parameters

PropertyTypeRequiredDescriptionDeviceKit Since
deviceIdstringYesDevice ID-
dpIdsnumber[]Yesdpids array-
queryTypenumberNoQuery type 0: null dp query (MQTT protocol 5, LAN protocol 7, Bluetooth 03 command query) 1: regular query (MQTT protocol 31, LAN protocol 16, Bluetooth 03 command query) 2: send null dp query + regular query together 3: For single-point Bluetooth, perform a null dp query with the 03 command; other devices use regular query (aligned with the RN container's impl_getDpsWithDevId method). Note: Supported starting from TUNIDeviceKit 4.21.0; lower versions will use a null dp query > 3: is a null dp queryv4.1.10
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.queryDps({
  deviceId: "xx",
  dpIds: [1],
  queryType: 1,
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});