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

View File

@ -1,3 +1,7 @@
## [2.0.2] - Alpha Release
Bugfix
## [2.0.1] - Alpha Release
Bugfix
## [2.0.0] - Alpha Release ## [2.0.0] - Alpha Release
IIP Version 4 IIP Version 4

34618
lib/esiur.js

File diff suppressed because it is too large Load Diff

View File

@ -353,7 +353,7 @@ class Codec {
IResource resource, DistributedConnection? connection) { IResource resource, DistributedConnection? connection) {
if (connection == null) return false; if (connection == null) return false;
if (resource is DistributedResource) { if (resource is DistributedResource) {
if (resource.connection == connection) return true; if (resource.distributedResourceConnection == connection) return true;
} }
return false; return false;
} }

View File

@ -306,7 +306,7 @@ class DataSerializer {
var rt = new DC(4); var rt = new DC(4);
if (Codec.isLocalResource(resource, connection)) { if (Codec.isLocalResource(resource, connection)) {
rt.setUint32(0, (resource as DistributedResource).id ?? 0); rt.setUint32(0, (resource as DistributedResource).distributedResourceInstanceId ?? 0);
return DataSerializerComposeResults( return DataSerializerComposeResults(
TransmissionTypeIdentifier.ResourceLocal, rt); TransmissionTypeIdentifier.ResourceLocal, rt);
} else { } else {

View File

@ -1,4 +1,3 @@
import 'IEnum.dart'; import 'IEnum.dart';
import '../Resource/Template/TemplateType.dart'; import '../Resource/Template/TemplateType.dart';
import 'IRecord.dart'; import 'IRecord.dart';
@ -35,7 +34,7 @@ class RepresentationTypeIdentifier {
Record = 0x15, Record = 0x15,
List = 0x16, List = 0x16,
Map = 0x17, Map = 0x17,
Enum = 0x18, Enum = 0x44,
TypedResource = 0x45, // Followed by UUID TypedResource = 0x45, // Followed by UUID
TypedRecord = 0x46, // Followed by UUID TypedRecord = 0x46, // Followed by UUID
TypedList = 0x48, // Followed by element type TypedList = 0x48, // Followed by element type

View File

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

View File

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

View File

@ -1,6 +1,6 @@
name: esiur name: esiur
description: Distributed Object Framework. description: Distributed Object Framework.
version: 2.0.0 version: 2.0.2
#author: Ahmed Zamil <ahmed@esiur.com> #author: Ahmed Zamil <ahmed@esiur.com>
homepage: https://github.com/esiur/esiur-dart homepage: https://github.com/esiur/esiur-dart
@ -13,7 +13,7 @@ dependencies:
args: ^2.3.0 args: ^2.3.0
pubspec_parse: ^1.2.0 pubspec_parse: ^1.2.0
web_socket_channel: ^2.1.0 web_socket_channel: ^2.1.0
collection: ^1.16.0 collection: ^1.15.0
dev_dependencies: dev_dependencies:
test: test: