Cambio modalità composizione elenco item da inviare a IO server x variabili cablate ICOEL, test 02

This commit is contained in:
Samuele Locatelli
2022-05-12 18:22:16 +02:00
parent 2c640b2dd7
commit fe0cbb5931
2 changed files with 19 additions and 13 deletions
+1 -1
View File
@@ -19,7 +19,7 @@
<add key="basePrgMemPath" value="CNCMEMUSER"/>
<add key="pingMsTimeout" value="1500"/>
<add key="serverPingDisabled" value="false"/>
<add key="urlCallTOut" value="9999"/>
<add key="urlCallTOut" value="10000"/>
<!-- ciclo corto x invio a server: ms -->
<add key="timerIntMs" value="10"/>
<add key="fastCount" value="20"/>
+18 -12
View File
@@ -597,7 +597,14 @@ namespace IOB_WIN_NEXT
private void sendDataItemsList(List<machDataItem> dataItems)
{
string rawData = JsonConvert.SerializeObject(dataItems);
utils.callUrlNow($"{urlSaveDataItems}", rawData);
try
{
utils.callUrlNow($"{urlSaveDataItems}", rawData);
}
catch(Exception exc)
{
lgError($"Eccezione in sendDataItemsList{Environment.NewLine} - url: {urlSaveDataItems}{Environment.NewLine}- payload:{rawData}{Environment.NewLine}Eccezione:{Environment.NewLine}{exc}");
}
}
/// <summary>
@@ -776,7 +783,6 @@ namespace IOB_WIN_NEXT
// provo a creare oggetto in memoria...
try
{
List<machDataItem> elencoDataItems = new List<machDataItem>();
int dSamplePeriod = 0;
int threshDBand = 0;
uuid = "";
@@ -786,20 +792,20 @@ namespace IOB_WIN_NEXT
currDataItem.valueTimestamp = adesso;
// aggiungo
dataItemMem.Add(uuid, currDataItem);
// salvo oggetto x registrazione su server MP-IO
var currMapoDataItem = new machDataItem()
// converto gli attuali nell'elenco dataitem...
List<machDataItem> elencoDataItems = dataItemMem.Select(d => new machDataItem()
{
uuid = uuid,
uuid = d.Key,
Category = DataItemCategory.EVENT,
Name = dataItem.DisplayName,
Type = $"{dataItem.NodeClass}",
Name = d.Value.DisplayName,
Type = $"{d.Value.NodeClass}",
SubType = $"{dataItem.StartNodeId}"
};
// aggiungo
elencoDataItems.Add(currMapoDataItem);
// aspetta un tempo random da 100-200 ms...
}
).ToList();
// aspetta un tempo random da 10-100 ms...
Random rnd = new Random();
Task.Delay(rnd.Next(100, 200));
Task.Delay(rnd.Next(10, 100));
// invio il dataItem serializzato...
sendDataItemsList(elencoDataItems);
}