Snippets

OICP 2.1 Pull EVSE Data | C#

Updated by Julius Poessnecker

File (0) OICP Added

  • Ignore whitespace
  • Hide word diff
+The service description can be found in the OICP 2.1 (EMP).
+
+Section:
+3.4.1 eRoamingPullEVSEData
+
+To download the latest OICP Version, please visit our website:
+https://www.hubject.com/downloads/
Updated by Gregor Schermuly

File (1) Pull EVSE Data | C#.cs Added

  • Ignore whitespace
  • Hide word diff
+/// <summary>
+/// Create a new task querying EVSE data from the OICP server.
+/// The request might either have none, 'SearchCenter + DistanceKM' or 'LastCall' parameters.
+/// Because of limitations at Hubject the SearchCenter and LastCall parameters can not be used at the same time!
+/// </summary>
+/// <param name="ProviderId">The unique identification of the EVSP.</param>
+/// <param name="SearchCenter">An optional geo coordinate of the search center.</param>
+/// <param name="DistanceKM">An optional search distance relative to the search center.</param>
+/// <param name="LastCall">An optional timestamp of the last call.</param>
+/// <param name="QueryTimeout">An optional timeout for this query.</param>
+public async Task<HTTPResponse<IEnumerable<eRoamingEVSEData>>>
+
+    PullEVSEData(EVSP_Id        ProviderId,
+                 GeoCoordinate  SearchCenter  = null,
+                 UInt64         DistanceKM    = 0,
+                 DateTime?      LastCall      = null,
+                 TimeSpan?      QueryTimeout  = null)
+
+{
+    [...]
+}

File (2) Example.cs Added

  • Ignore whitespace
  • Hide word diff
+var req = new EMPClient("api.playground.hubject.com").
+
+              PullEVSEData(EVSP_Id.Parse("DE*GDF"),
+                           SearchCenter:  new GeoCoordinate(Latitude. Parse(49.731102),
+                                                            Longitude.Parse(10.142533)),
+                           DistanceKM:    100,
+                           QueryTimeout:  TimeSpan.FromSeconds(120)).
+
+              ContinueWith(task => {
+
+                  var eRoamingEVSEData = task.Result.Content;
+
+                  if (eRoamingEVSEData.StatusCode.HasResult)
+                      Console.WriteLine(eRoamingEVSEData.
+                                            OperatorEVSEData.
+                                            Select(evsedata => "'" + evsedata.OperatorName +
+                                                               "' has " +
+                                                               evsedata.EVSEDataRecords.Count() +
+                                                               " EVSEs").
+                                            AggregateWith(Environment.NewLine) +
+                                            Environment.NewLine));
+
+                  else
+                  {
+                      Console.WriteLine(eRoamingEVSEData.StatusCode.Code);
+                      Console.WriteLine(eRoamingEVSEData.StatusCode.Description);
+                      Console.WriteLine(eRoamingEVSEData.StatusCode.AdditionalInfo);
+                  }
+
+              });
+
+req.Wait();

File Example.cs Deleted

  • Ignore whitespace
  • Hide word diff
-var req = new EMPClient("api.playground.hubject.com").
-
-              PullEVSEData(EVSP_Id.Parse("DE*GDF"),
-                           SearchCenter:  new GeoCoordinate(Latitude. Parse(49.731102),
-                                                            Longitude.Parse(10.142533)),
-                           DistanceKM:    100,
-                           QueryTimeout:  TimeSpan.FromSeconds(120)).
-
-              ContinueWith(task => {
-
-                  var eRoamingEVSEData = task.Result.Content;
-
-                  if (eRoamingEVSEData.StatusCode.HasResult)
-                      Console.WriteLine(eRoamingEVSEData.
-                                            OperatorEVSEData.
-                                            Select(evsedata => "'" + evsedata.OperatorName +
-                                                               "' has " +
-                                                               evsedata.EVSEDataRecords.Count() +
-                                                               " EVSEs").
-                                            AggregateWith(Environment.NewLine) +
-                                            Environment.NewLine));
-
-                  else
-                  {
-                      Console.WriteLine(eRoamingEVSEData.StatusCode.Code);
-                      Console.WriteLine(eRoamingEVSEData.StatusCode.Description);
-                      Console.WriteLine(eRoamingEVSEData.StatusCode.AdditionalInfo);
-                  }
-
-              });
-
-req.Wait();

File Pull EVSE Data | C#.cs Deleted

  • Ignore whitespace
  • Hide word diff
-/// <summary>
-/// Create a new task querying EVSE data from the OICP server.
-/// The request might either have none, 'SearchCenter + DistanceKM' or 'LastCall' parameters.
-/// Because of limitations at Hubject the SearchCenter and LastCall parameters can not be used at the same time!
-/// </summary>
-/// <param name="ProviderId">The unique identification of the EVSP.</param>
-/// <param name="SearchCenter">An optional geo coordinate of the search center.</param>
-/// <param name="DistanceKM">An optional search distance relative to the search center.</param>
-/// <param name="LastCall">An optional timestamp of the last call.</param>
-/// <param name="QueryTimeout">An optional timeout for this query.</param>
-public async Task<HTTPResponse<IEnumerable<eRoamingEVSEData>>>
-
-    PullEVSEData(EVSP_Id        ProviderId,
-                 GeoCoordinate  SearchCenter  = null,
-                 UInt64         DistanceKM    = 0,
-                 DateTime?      LastCall      = null,
-                 TimeSpan?      QueryTimeout  = null)
-
-{
-    [...]
-}
Created by Gregor Schermuly

File Example.cs Added

  • Ignore whitespace
  • Hide word diff
+var req = new EMPClient("api.playground.hubject.com").
+
+              PullEVSEData(EVSP_Id.Parse("DE*GDF"),
+                           SearchCenter:  new GeoCoordinate(Latitude. Parse(49.731102),
+                                                            Longitude.Parse(10.142533)),
+                           DistanceKM:    100,
+                           QueryTimeout:  TimeSpan.FromSeconds(120)).
+
+              ContinueWith(task => {
+
+                  var eRoamingEVSEData = task.Result.Content;
+
+                  if (eRoamingEVSEData.StatusCode.HasResult)
+                      Console.WriteLine(eRoamingEVSEData.
+                                            OperatorEVSEData.
+                                            Select(evsedata => "'" + evsedata.OperatorName +
+                                                               "' has " +
+                                                               evsedata.EVSEDataRecords.Count() +
+                                                               " EVSEs").
+                                            AggregateWith(Environment.NewLine) +
+                                            Environment.NewLine));
+
+                  else
+                  {
+                      Console.WriteLine(eRoamingEVSEData.StatusCode.Code);
+                      Console.WriteLine(eRoamingEVSEData.StatusCode.Description);
+                      Console.WriteLine(eRoamingEVSEData.StatusCode.AdditionalInfo);
+                  }
+
+              });
+
+req.Wait();

File Pull EVSE Data | C#.cs Added

  • Ignore whitespace
  • Hide word diff
+/// <summary>
+/// Create a new task querying EVSE data from the OICP server.
+/// The request might either have none, 'SearchCenter + DistanceKM' or 'LastCall' parameters.
+/// Because of limitations at Hubject the SearchCenter and LastCall parameters can not be used at the same time!
+/// </summary>
+/// <param name="ProviderId">The unique identification of the EVSP.</param>
+/// <param name="SearchCenter">An optional geo coordinate of the search center.</param>
+/// <param name="DistanceKM">An optional search distance relative to the search center.</param>
+/// <param name="LastCall">An optional timestamp of the last call.</param>
+/// <param name="QueryTimeout">An optional timeout for this query.</param>
+public async Task<HTTPResponse<IEnumerable<eRoamingEVSEData>>>
+
+    PullEVSEData(EVSP_Id        ProviderId,
+                 GeoCoordinate  SearchCenter  = null,
+                 UInt64         DistanceKM    = 0,
+                 DateTime?      LastCall      = null,
+                 TimeSpan?      QueryTimeout  = null)
+
+{
+    [...]
+}
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.