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;
}
Codec.parseStructure(attributes, 0, attributes.length, this)
.then((attrs) {
if (r.instance?.setAttributes(attrs, clearAttributes) == true)
sendReply(
clearAttributes
? IIPPacketAction.ClearAllAttributes
: IIPPacketAction.ClearAttributes,
callback)
.done();
else
sendError(ErrorType.Management, callback,
ExceptionCode.UpdateAttributeFailed.index);
});
});
}