publishDpsWithPipeType(params: Object)

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

const { publishDpsWithPipeType } = device;

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

Description

Send dps control commands over a specified channel

Parameters

PropertyTypeRequiredDescription
deviceIdstringYesDevice ID
Yesdps
modenumberYesDelivery channel type 0: LAN 1: Network 2: Auto
pipelinesnumber[]YesPriority of delivery channels LAN = 0, // LAN MQTT = 1, // MQTT HTTP = 2, // Http BLE = 3, // Single Point Bluetooth SIGMesh = 4, // Sig Mesh BLEMesh = 5, // Thing Private Mesh BLEBeacon = 6, // Beacon
YesReserved flag for delivery logic configuration; can be extended later, for example to deliver sounds or define follow-up actions
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.publishDpsWithPipeType({
  deviceId: "xx",
  dps: { "xx": {} },
  mode: 1,
  pipelines: [1],
  options: { "xx": {} },
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});