Rozdíly

Zde můžete vidět rozdíly mezi vybranou verzí a aktuální verzí dané stránky.

Odkaz na výstup diff

Obě strany předchozí revize Předchozí verze
Následující verze
Předchozí verze
cs:mervis-db:10-api [2021/10/25 12:31]
v.kohout [C#]
cs:mervis-db:10-api [2024/05/08 10:42] (aktuální)
Řádek 25: Řádek 25:
 ^GetVariableStatsAsync|Obsolete| ^GetVariableStatsAsync|Obsolete|
 ^CheckCredentials| | ^CheckCredentials| |
 +
 +===== Vlastnosti objektu =====
 +  * (UTC) Časová známka - UTC časová známka záznamu
 +  * Platnost do - UTC časová známka konce platnosti konkrétního záznamu
 +  * Interval - doba (v sekundách), kdy by měla být zaznamenána další hodnota
  
 ===== Příklady použití ===== ===== Příklady použití =====
Řádek 268: Řádek 273:
  }  }
  
- var res = await dbClient.ReplaceDataAsync(new List<ESG.Db.Server.Shared.KeyValuePair[]> { varKeys }, utcNow.Subtract(TimeSpan.FromMinutes(10)), utcNow, recsToSave.ToArray());+ var res = await dbClient.ReplaceDataAsync(new List<ESG.Db.Server.Shared.KeyValuePair[]> { varKeys }, utcNow.Subtract(recsLength), utcNow, recsToSave.ToArray());
  }  }
  }  }
Řádek 284: Řádek 289:
  class Program  class Program
  {  {
- static void Main(string[] args)+ static async Task Main(string[] args)
  {  {
  //  //
- // Demo of asynchronous method.+ // Create access to the real server. 
 + // Without SSL connections, you have to remove binding parameters "<security mode="Transport"/>" in the App.config. 
 + // The client is automatically generated from the WSDL file available here: https://kb.mervis.info/doku.php/en:mervis-db:10-api
  //  //
- var task = Task.Run(async () =>+ try
  {  {
- // + using (HistoryDbAccessClient client = new HistoryDbAccessClient(HistoryDbAccessClient.EndpointConfiguration.HistoryAccess, "http://localhost:9876/RcWareDbAccess"))
- // Create access to the real server. +
- // Without SSL connections, you have to remove binding parameters "<security mode="Transport"/>" in the App.config. +
- // The client is automatically generated from the WSDL file available here: https://kb.mervis.info/doku.php/en:mervis-db:10-api +
- // +
- using (HistoryDbAccessClient client = new HistoryDbAccessClient("HistoryAccess", "http://localhost:9876/RcWareDbAccess"))+
  {  {
  // Authentication credentials in the database.  // Authentication credentials in the database.
Řádek 303: Řádek 305:
  // Specification of the variables through Key-Value.  // Specification of the variables through Key-Value.
  // Here we use 2 variables.  // Here we use 2 variables.
- KeyValuePair[][] variableKeys = new KeyValuePair[][] { + ESG.Db.Server.Shared.KeyValuePair[][] variableKeys = new ESG.Db.Server.Shared.KeyValuePair[][] { 
- new KeyValuePair[] { + new ESG.Db.Server.Shared.KeyValuePair[] { 
- new KeyValuePair (false, /*Key*/ "DPGuid", /*Value*/ "338E2882-D72B-4D17-A241-73E8BC30F458"), + new ESG.Db.Server.Shared.KeyValuePair (/*IsKeyId*/ false, /*Key*/ "DPGuid", /*Value*/ "338E2882-D72B-4D17-A241-73E8BC30F458"), 
- new KeyValuePair (false, /*Key*/ "StationName", /*Value*/ "AAABBB")+ new ESG.Db.Server.Shared.KeyValuePair (/*IsKeyId*/ false, /*Key*/ "StationName", /*Value*/ "AAABBB")
  },  },
- new KeyValuePair[] { + new ESG.Db.Server.Shared.KeyValuePair[] { 
- new KeyValuePair (false, /*Key*/ "DPGuid", /*Value*/ "CC80211D-3D29-4CC2-91A2-F69483D566B5"), + new ESG.Db.Server.Shared.KeyValuePair (/*IsKeyId*/ false, /*Key*/ "DPGuid", /*Value*/ "CC80211D-3D29-4CC2-91A2-F69483D566B5"), 
- new KeyValuePair (false, /*Key*/ "StationName", /*Value*/ "AAABBB")+ new ESG.Db.Server.Shared.KeyValuePair (/*IsKeyId*/ false, /*Key*/ "StationName", /*Value*/ "AAABBB")
  }  }
  };  };
Řádek 321: Řádek 323:
  aggregation.IsoPattern = new string[] { "PT15M" }; // 15 min period (ISO 8601 duration pattern)  aggregation.IsoPattern = new string[] { "PT15M" }; // 15 min period (ISO 8601 duration pattern)
  aggregation.From = new DateTime(2018, 11, 24, 0, 0, 0, 0, DateTimeKind.Unspecified);  aggregation.From = new DateTime(2018, 11, 24, 0, 0, 0, 0, DateTimeKind.Unspecified);
- aggregation.To =   new DateTime(2018, 11, 25, 0, 0, 0, 0, DateTimeKind.Unspecified);+ aggregation.To = new DateTime(2018, 11, 25, 0, 0, 0, 0, DateTimeKind.Unspecified);
  aggregation.TimeZone = @"Europe/Prague";  aggregation.TimeZone = @"Europe/Prague";
  
Řádek 375: Řádek 377:
  } while (variableOffset != -1);  } while (variableOffset != -1);
  }  }
- }); 
  
  Console.WriteLine("DB communication is running in background");  Console.WriteLine("DB communication is running in background");
  
- try 
- { 
- task.Wait(); 
  }  }
  catch (Exception exc)  catch (Exception exc)
Řádek 392: Řádek 390:
  Console.ReadLine();  Console.ReadLine();
  }  }
- 
  }  }
 } }
  • © Energocentrum Plus, s.r.o. 2017 - 2024