mirror of
https://github.com/esiur/esiur-dart.git
synced 2025-05-06 12:02:57 +00:00
IIP3.5
This commit is contained in:
parent
53d801bc38
commit
7971c836b7
@ -1183,7 +1183,7 @@ class DistributedConnection extends NetworkConnection with IStore
|
|||||||
var item = new AsyncReply<DistributedResourceQueueItem>();
|
var item = new AsyncReply<DistributedResourceQueueItem>();
|
||||||
_queue.add(item);
|
_queue.add(item);
|
||||||
|
|
||||||
Codec.parseVarArray(content, 0, content.length, this).then((arguments)
|
Codec.parse(content, 0, this).then((arguments)
|
||||||
{
|
{
|
||||||
var et = r.instance.template.getEventTemplateByIndex(index);
|
var et = r.instance.template.getEventTemplateByIndex(index);
|
||||||
if (et != null)
|
if (et != null)
|
||||||
@ -1846,16 +1846,21 @@ class DistributedConnection extends NetworkConnection with IStore
|
|||||||
{
|
{
|
||||||
Warehouse.query(resourceLink).then((r)
|
Warehouse.query(resourceLink).then((r)
|
||||||
{
|
{
|
||||||
//if (r != null)
|
if (r == null)
|
||||||
//{
|
{
|
||||||
var list = r.where((x) => x.instance.applicable(session, ActionType.Attach, null) != Ruling.Denied).toList();
|
|
||||||
|
|
||||||
if (list.length == 0)
|
|
||||||
sendError(ErrorType.Management, callback, ExceptionCode.ResourceNotFound.index);
|
sendError(ErrorType.Management, callback, ExceptionCode.ResourceNotFound.index);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sendReply(IIPPacketAction.QueryLink, callback)
|
{
|
||||||
.addDC(Codec.composeResourceArray(list, this, true))
|
var list = r.where((x) => x.instance.applicable(session, ActionType.Attach, null) != Ruling.Denied).toList();
|
||||||
.done();
|
|
||||||
|
if (list.length == 0)
|
||||||
|
sendError(ErrorType.Management, callback, ExceptionCode.ResourceNotFound.index);
|
||||||
|
else
|
||||||
|
sendReply(IIPPacketAction.QueryLink, callback)
|
||||||
|
.addDC(Codec.composeResourceArray(list, this, true))
|
||||||
|
.done();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1895,8 +1900,6 @@ class DistributedConnection extends NetworkConnection with IStore
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
var fi = null ;//r.GetType().GetTypeInfo().GetMethod(ft.name);
|
var fi = null ;//r.GetType().GetTypeInfo().GetMethod(ft.name);
|
||||||
|
|
||||||
|
|
||||||
@ -2595,7 +2598,7 @@ class DistributedConnection extends NetworkConnection with IStore
|
|||||||
|
|
||||||
// private void Instance_EventOccurred(IResource resource, string name, string[] users, DistributedConnection[] connections, object[] args)
|
// private void Instance_EventOccurred(IResource resource, string name, string[] users, DistributedConnection[] connections, object[] args)
|
||||||
|
|
||||||
void _instance_EventOccurred(IResource resource, issuer, List<Session> receivers, String name, List args)
|
void _instance_EventOccurred(IResource resource, issuer, List<Session> receivers, String name, dynamic args)
|
||||||
{
|
{
|
||||||
var et = resource.instance.template.getEventTemplateByName(name);
|
var et = resource.instance.template.getEventTemplateByName(name);
|
||||||
|
|
||||||
@ -2614,7 +2617,7 @@ class DistributedConnection extends NetworkConnection with IStore
|
|||||||
sendEvent(IIPPacketEvent.EventOccurred)
|
sendEvent(IIPPacketEvent.EventOccurred)
|
||||||
.addUint32(resource.instance.id)
|
.addUint32(resource.instance.id)
|
||||||
.addUint8(et.index)
|
.addUint8(et.index)
|
||||||
.addDC(Codec.composeVarArray(args, this, true))
|
.addDC(Codec.compose(args, this, true))
|
||||||
.done();
|
.done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,14 +165,13 @@ class DistributedResource extends IResource {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void emitEventByIndex(int index, List<dynamic> args) {
|
void emitEventByIndex(int index, dynamic args) {
|
||||||
// neglect events when the object is not yet attached
|
// neglect events when the object is not yet attached
|
||||||
if (!_attached) return;
|
if (!_attached) return;
|
||||||
|
|
||||||
var et = instance.template.getEventTemplateByIndex(index);
|
var et = instance.template.getEventTemplateByIndex(index);
|
||||||
//events[index]?.Invoke(this, args);
|
emitArgs(et.name, [args]);
|
||||||
emitArgs(et.name, args);
|
//emitArgs(event, arguments)
|
||||||
|
|
||||||
instance.emitResourceEvent(null, null, et.name, args);
|
instance.emitResourceEvent(null, null, et.name, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +177,8 @@ class IIPPacket
|
|||||||
|
|
||||||
offset += cl;
|
offset += cl;
|
||||||
}
|
}
|
||||||
else if (event == IIPPacketEvent.PropertyUpdated)
|
else if (event == IIPPacketEvent.PropertyUpdated
|
||||||
|
|| event == IIPPacketEvent.EventOccurred)
|
||||||
{
|
{
|
||||||
if (_notEnough(offset, ends, 2))
|
if (_notEnough(offset, ends, 2))
|
||||||
return -_dataLengthNeeded;
|
return -_dataLengthNeeded;
|
||||||
@ -210,23 +211,23 @@ class IIPPacket
|
|||||||
offset += size;
|
offset += size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (event == IIPPacketEvent.EventOccurred)
|
// else if (event == IIPPacketEvent.EventOccurred)
|
||||||
{
|
// {
|
||||||
if (_notEnough(offset, ends, 5))
|
// if (_notEnough(offset, ends, 5))
|
||||||
return -_dataLengthNeeded;
|
// return -_dataLengthNeeded;
|
||||||
|
|
||||||
methodIndex = data[offset++];
|
// methodIndex = data[offset++];
|
||||||
|
|
||||||
var cl = data.getUint32( offset);
|
// var cl = data.getUint32( offset);
|
||||||
offset += 4;
|
// offset += 4;
|
||||||
|
|
||||||
if (_notEnough(offset, ends, cl))
|
// if (_notEnough(offset, ends, cl))
|
||||||
return -_dataLengthNeeded;
|
// return -_dataLengthNeeded;
|
||||||
|
|
||||||
content = data.clip(offset, cl);
|
// content = data.clip(offset, cl);
|
||||||
offset += cl;
|
// offset += cl;
|
||||||
|
|
||||||
}
|
// }
|
||||||
// Attribute
|
// Attribute
|
||||||
else if (event == IIPPacketEvent.AttributesUpdated)
|
else if (event == IIPPacketEvent.AttributesUpdated)
|
||||||
{
|
{
|
||||||
|
@ -453,7 +453,7 @@ class Instance extends IEventHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
emitResourceEvent(issuer, List<Session> receivers, String name, List<dynamic> args)
|
emitResourceEvent(issuer, List<Session> receivers, String name, dynamic args)
|
||||||
{
|
{
|
||||||
emitArgs("resourceEventOccurred", [_resource, issuer, receivers, name, args]);
|
emitArgs("resourceEventOccurred", [_resource, issuer, receivers, name, args]);
|
||||||
}
|
}
|
||||||
|
@ -20,10 +20,10 @@ class EventTemplate extends MemberTemplate
|
|||||||
var exp = DC.stringToBytes(expansion);
|
var exp = DC.stringToBytes(expansion);
|
||||||
return new BinaryList()
|
return new BinaryList()
|
||||||
.addUint8(0x50)
|
.addUint8(0x50)
|
||||||
.addInt32(exp.length)
|
|
||||||
.addDC(exp)
|
|
||||||
.addUint8(name.length)
|
.addUint8(name.length)
|
||||||
.addDC(name)
|
.addDC(name)
|
||||||
|
.addInt32(exp.length)
|
||||||
|
.addDC(exp)
|
||||||
.toDC();
|
.toDC();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user