2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-09-13 12:43:17 +00:00
This commit is contained in:
2025-08-25 03:39:37 +03:00
parent 3ea7adaebc
commit 4a7070ee6e
4 changed files with 33 additions and 12 deletions

View File

@@ -197,6 +197,8 @@ public static class Codec
var tt = dataType.Value;
Console.WriteLine("Parsing " + tt.Class + " " + tt.Identifier);
if (tt.Class == TransmissionTypeClass.Fixed)
{
return (len, FixedAsyncParsers[tt.Exponent][tt.Index](data, dataType.Value.Offset, (uint)tt.ContentLength, connection, requestSequence));

View File

@@ -1692,23 +1692,30 @@ partial class DistributedConnection
var rt = new AsyncReply<IResource>();
Query(path).Then(ar =>
SendRequest(IIPPacketRequest.GetResourceIdByLink, path)
.Then(result =>
{
//if (filter != null)
// ar = ar?.Where(filter).ToArray();
// MISSING: should dispatch the unused resources.
if (ar?.Length > 0)
rt.Trigger(ar[0]);
else
rt.Trigger(null);
rt.Trigger(result);
}).Error(ex => rt.TriggerError(ex));
//Query(path).Then(ar =>
//{
// //if (filter != null)
// // ar = ar?.Where(filter).ToArray();
// // MISSING: should dispatch the unused resources.
// if (ar?.Length > 0)
// rt.Trigger(ar[0]);
// else
// rt.Trigger(null);
//}).Error(ex => rt.TriggerError(ex));
return rt;
}
public AsyncReply<TypeTemplate[]> GetLinkTemplates(string link)
{
var reply = new AsyncReply<TypeTemplate[]>();
@@ -1743,6 +1750,7 @@ partial class DistributedConnection
/// <returns>DistributedResource</returns>
public AsyncReply<DistributedResource> Fetch(uint id, uint[] requestSequence)
{
DistributedResource resource = null;
attachedResources[id]?.TryGetTarget(out resource);
@@ -1758,22 +1766,30 @@ partial class DistributedConnection
{
if (resource != null && (requestSequence?.Contains(id) ?? false))
{
Console.WriteLine("Fetching DL " + id);
// dead lock avoidance for loop reference.
return new AsyncReply<DistributedResource>(resource);
}
else if (resource != null && requestInfo.RequestSequence.Contains(id))
{
Console.WriteLine("Fetching DL2 " + id);
// dead lock avoidance for dependent reference.
return new AsyncReply<DistributedResource>(resource);
}
else
{
Console.WriteLine("Fetching DL3 " + id);
return requestInfo.Reply;
}
}
else if (resource != null && !resource.DistributedResourceSuspended)
{
// @REVIEW: this should never happen
Console.WriteLine("Fetching DLWWW " + id);
Global.Log("DCON", LogType.Error, "Resource not moved to attached.");
return new AsyncReply<DistributedResource>(resource);
@@ -1783,6 +1799,7 @@ partial class DistributedConnection
var reply = new AsyncReply<DistributedResource>();
resourceRequests.Add(id, new DistributedResourceAttachRequestInfo(reply, newSequence));
Console.WriteLine("Fetching " + id);
SendRequest(IIPPacketRequest.AttachResource, id)
.Then((result) =>
@@ -1802,6 +1819,8 @@ partial class DistributedConnection
var hops = (byte)args[3];
var pvData = (byte[])args[4];
Console.WriteLine("Fetching CL " + id);
DistributedResource dr;
TypeTemplate template = null;

View File

@@ -169,7 +169,7 @@ public class DistributedResource : DynamicObject, IResource, INotifyPropertyChan
}
/// <summary>
/// Export all properties with ResourceProperty attributed as bytes array.
/// Export properties as byte array.
/// </summary>
/// <returns></returns>
internal PropertyValue[] _Serialize()

View File

@@ -190,7 +190,7 @@ namespace Test
var format = x.RequiredFormat;
if (format == IIPAuthPacketIAuthFormat.Number)
return new AsyncReply<object>(Convert.ToInt32(Console.ReadLine()));
return new AsyncReply<object>(Convert.ToInt32(10));
else if (format == IIPAuthPacketIAuthFormat.Text)
return new AsyncReply<object>(Console.ReadLine().Trim());