mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-09-13 12:43:17 +00:00
Parsing
This commit is contained in:
@@ -197,6 +197,8 @@ public static class Codec
|
|||||||
|
|
||||||
var tt = dataType.Value;
|
var tt = dataType.Value;
|
||||||
|
|
||||||
|
Console.WriteLine("Parsing " + tt.Class + " " + tt.Identifier);
|
||||||
|
|
||||||
if (tt.Class == TransmissionTypeClass.Fixed)
|
if (tt.Class == TransmissionTypeClass.Fixed)
|
||||||
{
|
{
|
||||||
return (len, FixedAsyncParsers[tt.Exponent][tt.Index](data, dataType.Value.Offset, (uint)tt.ContentLength, connection, requestSequence));
|
return (len, FixedAsyncParsers[tt.Exponent][tt.Index](data, dataType.Value.Offset, (uint)tt.ContentLength, connection, requestSequence));
|
||||||
|
@@ -1692,23 +1692,30 @@ partial class DistributedConnection
|
|||||||
|
|
||||||
var rt = new AsyncReply<IResource>();
|
var rt = new AsyncReply<IResource>();
|
||||||
|
|
||||||
Query(path).Then(ar =>
|
SendRequest(IIPPacketRequest.GetResourceIdByLink, path)
|
||||||
{
|
.Then(result =>
|
||||||
|
{
|
||||||
|
rt.Trigger(result);
|
||||||
|
}).Error(ex => rt.TriggerError(ex));
|
||||||
|
|
||||||
//if (filter != null)
|
//Query(path).Then(ar =>
|
||||||
// ar = ar?.Where(filter).ToArray();
|
//{
|
||||||
|
|
||||||
// MISSING: should dispatch the unused resources.
|
// //if (filter != null)
|
||||||
if (ar?.Length > 0)
|
// // ar = ar?.Where(filter).ToArray();
|
||||||
rt.Trigger(ar[0]);
|
|
||||||
else
|
// // MISSING: should dispatch the unused resources.
|
||||||
rt.Trigger(null);
|
// if (ar?.Length > 0)
|
||||||
}).Error(ex => rt.TriggerError(ex));
|
// rt.Trigger(ar[0]);
|
||||||
|
// else
|
||||||
|
// rt.Trigger(null);
|
||||||
|
//}).Error(ex => rt.TriggerError(ex));
|
||||||
|
|
||||||
|
|
||||||
return rt;
|
return rt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public AsyncReply<TypeTemplate[]> GetLinkTemplates(string link)
|
public AsyncReply<TypeTemplate[]> GetLinkTemplates(string link)
|
||||||
{
|
{
|
||||||
var reply = new AsyncReply<TypeTemplate[]>();
|
var reply = new AsyncReply<TypeTemplate[]>();
|
||||||
@@ -1743,6 +1750,7 @@ partial class DistributedConnection
|
|||||||
/// <returns>DistributedResource</returns>
|
/// <returns>DistributedResource</returns>
|
||||||
public AsyncReply<DistributedResource> Fetch(uint id, uint[] requestSequence)
|
public AsyncReply<DistributedResource> Fetch(uint id, uint[] requestSequence)
|
||||||
{
|
{
|
||||||
|
|
||||||
DistributedResource resource = null;
|
DistributedResource resource = null;
|
||||||
|
|
||||||
attachedResources[id]?.TryGetTarget(out resource);
|
attachedResources[id]?.TryGetTarget(out resource);
|
||||||
@@ -1758,22 +1766,30 @@ partial class DistributedConnection
|
|||||||
{
|
{
|
||||||
if (resource != null && (requestSequence?.Contains(id) ?? false))
|
if (resource != null && (requestSequence?.Contains(id) ?? false))
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("Fetching DL " + id);
|
||||||
|
|
||||||
// dead lock avoidance for loop reference.
|
// dead lock avoidance for loop reference.
|
||||||
return new AsyncReply<DistributedResource>(resource);
|
return new AsyncReply<DistributedResource>(resource);
|
||||||
}
|
}
|
||||||
else if (resource != null && requestInfo.RequestSequence.Contains(id))
|
else if (resource != null && requestInfo.RequestSequence.Contains(id))
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("Fetching DL2 " + id);
|
||||||
|
|
||||||
// dead lock avoidance for dependent reference.
|
// dead lock avoidance for dependent reference.
|
||||||
return new AsyncReply<DistributedResource>(resource);
|
return new AsyncReply<DistributedResource>(resource);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("Fetching DL3 " + id);
|
||||||
|
|
||||||
return requestInfo.Reply;
|
return requestInfo.Reply;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (resource != null && !resource.DistributedResourceSuspended)
|
else if (resource != null && !resource.DistributedResourceSuspended)
|
||||||
{
|
{
|
||||||
// @REVIEW: this should never happen
|
// @REVIEW: this should never happen
|
||||||
|
Console.WriteLine("Fetching DLWWW " + id);
|
||||||
|
|
||||||
Global.Log("DCON", LogType.Error, "Resource not moved to attached.");
|
Global.Log("DCON", LogType.Error, "Resource not moved to attached.");
|
||||||
return new AsyncReply<DistributedResource>(resource);
|
return new AsyncReply<DistributedResource>(resource);
|
||||||
|
|
||||||
@@ -1783,6 +1799,7 @@ partial class DistributedConnection
|
|||||||
|
|
||||||
var reply = new AsyncReply<DistributedResource>();
|
var reply = new AsyncReply<DistributedResource>();
|
||||||
resourceRequests.Add(id, new DistributedResourceAttachRequestInfo(reply, newSequence));
|
resourceRequests.Add(id, new DistributedResourceAttachRequestInfo(reply, newSequence));
|
||||||
|
Console.WriteLine("Fetching " + id);
|
||||||
|
|
||||||
SendRequest(IIPPacketRequest.AttachResource, id)
|
SendRequest(IIPPacketRequest.AttachResource, id)
|
||||||
.Then((result) =>
|
.Then((result) =>
|
||||||
@@ -1802,6 +1819,8 @@ partial class DistributedConnection
|
|||||||
var hops = (byte)args[3];
|
var hops = (byte)args[3];
|
||||||
var pvData = (byte[])args[4];
|
var pvData = (byte[])args[4];
|
||||||
|
|
||||||
|
Console.WriteLine("Fetching CL " + id);
|
||||||
|
|
||||||
DistributedResource dr;
|
DistributedResource dr;
|
||||||
TypeTemplate template = null;
|
TypeTemplate template = null;
|
||||||
|
|
||||||
|
@@ -169,7 +169,7 @@ public class DistributedResource : DynamicObject, IResource, INotifyPropertyChan
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Export all properties with ResourceProperty attributed as bytes array.
|
/// Export properties as byte array.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
internal PropertyValue[] _Serialize()
|
internal PropertyValue[] _Serialize()
|
||||||
|
@@ -190,7 +190,7 @@ namespace Test
|
|||||||
var format = x.RequiredFormat;
|
var format = x.RequiredFormat;
|
||||||
|
|
||||||
if (format == IIPAuthPacketIAuthFormat.Number)
|
if (format == IIPAuthPacketIAuthFormat.Number)
|
||||||
return new AsyncReply<object>(Convert.ToInt32(Console.ReadLine()));
|
return new AsyncReply<object>(Convert.ToInt32(10));
|
||||||
else if (format == IIPAuthPacketIAuthFormat.Text)
|
else if (format == IIPAuthPacketIAuthFormat.Text)
|
||||||
return new AsyncReply<object>(Console.ReadLine().Trim());
|
return new AsyncReply<object>(Console.ReadLine().Trim());
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user