mirror of
https://github.com/esiur/esiur-dart.git
synced 2025-05-06 04:02:57 +00:00
1.4.8
This commit is contained in:
parent
897ac180b7
commit
7eae6b47ce
@ -1,3 +1,9 @@
|
||||
## [1.2.3] - Release
|
||||
Improved property updating
|
||||
|
||||
## [1.2.2] - Hotfix
|
||||
Bugfix
|
||||
|
||||
## [1.2.1] - Release.
|
||||
Reconnect error handling
|
||||
|
||||
|
7
lib/src/Data/KeyValuePair.dart
Normal file
7
lib/src/Data/KeyValuePair.dart
Normal file
@ -0,0 +1,7 @@
|
||||
class KeyValuePair<K, V>
|
||||
{
|
||||
K key;
|
||||
V value;
|
||||
|
||||
KeyValuePair(this.key, this.value);
|
||||
}
|
@ -1257,12 +1257,6 @@ class DistributedConnection extends NetworkConnection with IStore
|
||||
}
|
||||
|
||||
var r = res as IResource;
|
||||
r.instance.on("resourceEventOccurred", _instance_EventOccurred);
|
||||
r.instance.on("resourceModified", _instance_PropertyModified);
|
||||
r.instance.on("resourceDestroyed", _instance_ResourceDestroyed);
|
||||
r.instance.children.on("add", _children_OnAdd);
|
||||
r.instance.children.on("removed", _children_OnRemoved);
|
||||
r.instance.attributes.on("modified", _attributes_OnModified);
|
||||
|
||||
var link = DC.stringToBytes(r.instance.link);
|
||||
|
||||
@ -1288,6 +1282,14 @@ class DistributedConnection extends NetworkConnection with IStore
|
||||
.addDC(Codec.composePropertyValueArray(r.instance.serialize(), this, true))
|
||||
.done();
|
||||
}
|
||||
|
||||
r.instance.on("resourceEventOccurred", _instance_EventOccurred);
|
||||
r.instance.on("resourceModified", _instance_PropertyModified);
|
||||
r.instance.on("resourceDestroyed", _instance_ResourceDestroyed);
|
||||
r.instance.children.on("add", _children_OnAdd);
|
||||
r.instance.children.on("removed", _children_OnRemoved);
|
||||
r.instance.attributes.on("modified", _attributes_OnModified);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -23,6 +23,7 @@ SOFTWARE.
|
||||
*/
|
||||
|
||||
import 'package:esyur/esyur.dart';
|
||||
import 'package:esyur/src/Data/KeyValuePair.dart';
|
||||
|
||||
import '../../Resource/IResource.dart';
|
||||
import '../../Core/AsyncReply.dart';
|
||||
@ -43,10 +44,11 @@ class DistributedResource extends IResource
|
||||
|
||||
String _link;
|
||||
List _properties;
|
||||
|
||||
|
||||
bool _destroyed = false;
|
||||
|
||||
|
||||
List<KeyValuePair<int, dynamic>> _queued_updates =List<KeyValuePair<int, dynamic>>();
|
||||
|
||||
/// <summary>
|
||||
/// Connection responsible for the distributed resource.
|
||||
/// </summary>
|
||||
@ -162,12 +164,22 @@ class DistributedResource extends IResource
|
||||
|
||||
_attached = true;
|
||||
|
||||
if (_queued_updates.length > 0)
|
||||
{
|
||||
_queued_updates.forEach((kv)=>updatePropertyByIndex(kv.key, kv.value));
|
||||
_queued_updates.clear();
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void emitEventByIndex(int index, List<dynamic> args)
|
||||
{
|
||||
// neglect events when the object is not yet attached
|
||||
if (!_attached)
|
||||
return;
|
||||
|
||||
var et = instance.template.getEventTemplateByIndex(index);
|
||||
//events[index]?.Invoke(this, args);
|
||||
emitArgs(et.name, args);
|
||||
@ -296,9 +308,16 @@ class DistributedResource extends IResource
|
||||
|
||||
void updatePropertyByIndex(int index, dynamic value)
|
||||
{
|
||||
var pt = instance.template.getPropertyTemplateByIndex(index);
|
||||
_properties[index] = value;
|
||||
instance.emitModification(pt, value);
|
||||
if (!_attached)
|
||||
{
|
||||
_queued_updates.add(KeyValuePair(index, value));
|
||||
}
|
||||
else
|
||||
{
|
||||
var pt = instance.template.getPropertyTemplateByIndex(index);
|
||||
_properties[index] = value;
|
||||
instance.emitModification(pt, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: esyur
|
||||
description: Distributed Object Framework.
|
||||
version: 1.2.1
|
||||
version: 1.2.3
|
||||
# author: Ahmed Zamil <ahmed@dijlh.com>
|
||||
homepage: https://github.com/esyur/esyur-dart
|
||||
|
||||
|
@ -5,20 +5,29 @@ import 'dart:io';
|
||||
main() async
|
||||
{
|
||||
//test("Connect to server", () async {
|
||||
|
||||
// connect to the server
|
||||
var x = await Warehouse.get("iip://localhost:5000/sys/su", {"username": "admin", "password": "1234"
|
||||
, "domain": "example.com"});
|
||||
|
||||
var now = DateTime.now();
|
||||
|
||||
// // // connect to the server
|
||||
// var x = await Warehouse.get("iip://localhost:5000/sys/su", {"username": "admin", "password": "1234"
|
||||
// , "domain": "example.com"});
|
||||
|
||||
|
||||
var x = await Warehouse.get("iip://gps.dijlh.com:2628/app", {"username": "delta", "password": "interactivereflection2020"
|
||||
, "domain": "gps.dijlh.com"});
|
||||
|
||||
|
||||
// desc(x);
|
||||
|
||||
var date = DateTime.now();
|
||||
|
||||
var from =DateTime(date.year, date.month, date.day);
|
||||
var to =DateTime(date.year, date.month, date.day + 1);
|
||||
|
||||
List<dynamic> trackers = await x.getMyTrackers();
|
||||
|
||||
|
||||
|
||||
var rt = await x.getObjectTracks(trackers[0], from, to, 0, 0, 0);
|
||||
|
||||
print("Time ${DateTime.now().difference(now).inSeconds}");
|
||||
|
||||
print(x.suspended);
|
||||
|
Loading…
x
Reference in New Issue
Block a user