removeAttributes method

AsyncReply<bool> removeAttributes(
  1. IResource resource, [
  2. List<String>? attributes = null
])

Implementation

AsyncReply<bool> removeAttributes(IResource resource,
    [List<String>? attributes = null]) {
  var rt = new AsyncReply<bool>();

  if (attributes == null)
    (sendRequest(IIPPacketAction.ClearAllAttributes)
          ..addUint32(resource.instance?.id as int))
        .done()
      ..then((ar) => rt.trigger(true))
      ..error((ex) => rt.triggerError(ex));
  else {
    var attrs = DC.stringArrayToBytes(attributes);
    (sendRequest(IIPPacketAction.ClearAttributes)
          ..addUint32(resource.instance?.id as int)
          ..addInt32(attrs.length)
          ..addDC(attrs))
        .done()
      ..then<dynamic>((ar) => rt.trigger(true))
      ..error((ex) => rt.triggerError(ex));
  }

  return rt;
}