iipRequestUpdateAttributes method
void
iipRequestUpdateAttributes(])
Implementation
void iipRequestUpdateAttributes(int callback, int resourceId, DC attributes,
[bool clearAttributes = false]) {
Warehouse.getById(resourceId).then((r) {
if (r == null) {
_sendError(ErrorType.Management, callback,
ExceptionCode.ResourceNotFound.index);
return;
}
if (r.instance?.store?.instance?.applicable(
_session as Session, ActionType.UpdateAttributes, null) !=
Ruling.Allowed) {
_sendError(ErrorType.Management, callback,
ExceptionCode.UpdateAttributeDenied.index);
return;
}
DataDeserializer.typedListParser(
attributes, 0, attributes.length, this, null)
.then((attrs) {
if (r.instance?.setAttributes(
attrs as Map<String, dynamic>, clearAttributes) ==
true)
_sendReply(
clearAttributes
? IIPPacketAction.ClearAllAttributes
: IIPPacketAction.ClearAttributes,
callback)
.done();
else
_sendError(ErrorType.Management, callback,
ExceptionCode.UpdateAttributeFailed.index);
});
});
}