set method
Set property value.
Zero-based property index.
Value
Implementation
AsyncReply<dynamic> set(int index, dynamic value) {
if (index >= _properties.length)
throw Exception("Property with index `${index}` not found.");
var reply = new AsyncReply<dynamic>();
var con = _connection as DistributedConnection;
var parameters = Codec.compose(value, con);
(con.sendRequest(IIPPacketAction.SetProperty)
..addUint32(_instanceId as int)
..addUint8(index)
..addDC(parameters))
.done()
..then((res) {
// not really needed, server will always send property modified,
// this only happens if the programmer forgot to emit in property setter
_properties[index] = value;
reply.trigger(null);
});
return reply;
}