2
0
mirror of https://github.com/esiur/esiur-dart.git synced 2025-09-13 20:13:19 +00:00
This commit is contained in:
2022-03-28 20:18:32 +03:00
parent 47d2f7e923
commit 9be227a65e
8 changed files with 26 additions and 34636 deletions

View File

@@ -461,7 +461,7 @@ class DistributedConnection extends NetworkConnection with IStore {
String? link(IResource resource) {
if (resource is DistributedResource) {
if (resource.instance?.store == this)
return (this.instance?.name ?? "") + "/" + resource.id.toString();
return (this.instance?.name ?? "") + "/" + resource.distributedResourceInstanceId.toString();
}
return null;
@@ -995,7 +995,8 @@ class DistributedConnection extends NetworkConnection with IStore {
/// <returns></returns>
AsyncReply<bool> put(IResource resource) {
if (Codec.isLocalResource(resource, this))
_resources.add((resource as DistributedResource).id as int, resource);
_resources.add(
(resource as DistributedResource).distributedResourceInstanceId as int, resource);
// else .. put it in the server....
return AsyncReply.ready(true);
}
@@ -2347,7 +2348,7 @@ class DistributedConnection extends NetworkConnection with IStore {
return AsyncReply<DistributedResource>.ready(resource);
else
return request;
} else if (resource != null && !resource.suspended)
} else if (resource != null && !resource.distributedResourceSuspended)
return new AsyncReply<DistributedResource>.ready(resource);
var reply = new AsyncReply<DistributedResource>();
@@ -2544,7 +2545,9 @@ class DistributedConnection extends NetworkConnection with IStore {
} else {
rt.triggerError(Exception("Null response"));
}
})..error((ex) => rt.triggerError(ex));;
})
..error((ex) => rt.triggerError(ex));
;
} else {
var attrs = DC.stringArrayToBytes(attributes);
(sendRequest(IIPPacketAction.GetAttributes)
@@ -2567,7 +2570,9 @@ class DistributedConnection extends NetworkConnection with IStore {
} else {
rt.triggerError(Exception("Null response"));
}
})..error((ex) => rt.triggerError(ex));;
})
..error((ex) => rt.triggerError(ex));
;
}
return rt;
@@ -2585,7 +2590,7 @@ class DistributedConnection extends NetworkConnection with IStore {
if (resource is DistributedResource) {
var dr = resource as DistributedResource;
if (dr.connection != this)
if (dr.distributedResourceConnection != this)
return new AsyncReply<
KeyList<PropertyTemplate, List<PropertyValue>>?>.ready(null);
@@ -2593,7 +2598,7 @@ class DistributedConnection extends NetworkConnection with IStore {
new AsyncReply<KeyList<PropertyTemplate, List<PropertyValue>>>();
sendRequest(IIPPacketAction.ResourceHistory)
..addUint32(dr.id as int)
..addUint32(dr.distributedResourceInstanceId as int)
..addDateTime(fromDate)
..addDateTime(toDate)
..done().then<dynamic>((rt) {

View File

@@ -63,21 +63,21 @@ class DistributedResource extends IResource {
/// <summary>
/// Connection responsible for the distributed resource.
/// </summary>
DistributedConnection? get connection => _connection;
DistributedConnection? get distributedResourceConnection => _connection;
/// <summary>
/// Resource link
/// </summary>
String? get link => _link;
String? get distributedResourceLink => _link;
/// <summary>
/// Instance Id given by the other end.
/// </summary>
int? get id => _instanceId;
int? get distributedResourceInstanceId => _instanceId;
//bool get destroyed => _destroyed;
bool get suspended => _suspended;
bool get distributedResourceSuspended => _suspended;
bool _suspended = true;
AsyncReply<bool> trigger(ResourceTrigger trigger) => AsyncReply.ready(true);
@@ -227,7 +227,7 @@ class DistributedResource extends IResource {
return AsyncReply().triggerError(new AsyncException(
ErrorType.Management, ExceptionCode.NotListenable.index, ""));
return connection?.sendUnlistenRequest(_instanceId as int, et.index)
return _connection?.sendUnlistenRequest(_instanceId as int, et.index)
as AsyncReply;
}