Snippets
Revised by
Gregor Schermuly
7a5f26a
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | /// <summary>
/// Create a new task pushing a single EVSE data record onto the OICP server.
/// </summary>
/// <param name="EVSEDataRecord">A EVSE data record.</param>
/// <param name="OICPAction">An optional OICP action.</param>
/// <param name="OperatorId">An optional EVSE operator Id to use. Otherwise it will be taken from the EVSE data record.</param>
/// <param name="OperatorName">An optional EVSE operator name.</param>
/// <param name="IncludeEVSEs">An optional delegate for filtering EVSE data records before pushing them to the server.</param>
/// <param name="QueryTimeout">An optional timeout for this query.</param>
public async Task<HTTPResponse<HubjectAcknowledgement>>
PushEVSEData(EVSEDataRecord EVSEDataRecord,
ActionType OICPAction = ActionType.insert,
EVSEOperator_Id OperatorId = null,
String OperatorName = null,
Func<EVSEDataRecord, Boolean> IncludeEVSEs = null,
TimeSpan? QueryTimeout = null)
{ ... }
/// <summary>
/// Create a new task pushing EVSE data records onto the OICP server.
/// </summary>
/// <param name="OICPAction">The OICP action.</param>
/// <param name="EVSEDataRecords">An array of EVSE data records.</param>
public async Task<HTTPResponse<HubjectAcknowledgement>>
PushEVSEData(ActionType OICPAction,
params EVSEDataRecord[] EVSEDataRecords)
{ ... }
/// <summary>
/// Create a new task pushing EVSE data records onto the OICP server.
/// </summary>
/// <param name="OICPAction">The OICP action.</param>
/// <param name="OperatorId">The EVSE operator Id to use.</param>
/// <param name="EVSEDataRecords">An array of EVSE data records.</param>
public async Task<HTTPResponse<HubjectAcknowledgement>>
PushEVSEData(ActionType OICPAction,
EVSEOperator_Id OperatorId,
params EVSEDataRecord[] EVSEDataRecords)
{ ... }
/// <summary>
/// Create a new task pushing EVSE data records onto the OICP server.
/// </summary>
/// <param name="OICPAction">The OICP action.</param>
/// <param name="OperatorId">The EVSE operator Id to use.</param>
/// <param name="OperatorName">The EVSE operator name.</param>
/// <param name="EVSEDataRecords">An array of EVSE data records.</param>
public async Task<HTTPResponse<HubjectAcknowledgement>>
PushEVSEData(ActionType OICPAction,
EVSEOperator_Id OperatorId,
String OperatorName,
params EVSEDataRecord[] EVSEDataRecords)
{ ... }
/// <summary>
/// Create a new task pushing EVSE data records onto the OICP server.
/// </summary>
/// <param name="EVSEDataRecords">An enumeration of EVSE data records.</param>
/// <param name="OICPAction">An optional OICP action.</param>
/// <param name="OperatorId">An optional EVSE operator Id to use. Otherwise it will be taken from the EVSE data records.</param>
/// <param name="OperatorName">An optional EVSE operator name.</param>
/// <param name="IncludeEVSEs">An optional delegate for filtering EVSE data records before pushing them to the server.</param>
/// <param name="QueryTimeout">An optional timeout for this query.</param>
public async Task<HTTPResponse<HubjectAcknowledgement>>
PushEVSEData(IEnumerable<EVSEDataRecord> EVSEDataRecords,
ActionType OICPAction = ActionType.fullLoad,
EVSEOperator_Id OperatorId = null,
String OperatorName = null,
Func<EVSEDataRecord, Boolean> IncludeEVSEs = null,
TimeSpan? QueryTimeout = null)
{ ... }
///Example
var EVSEDataRecords = Enumeration.Create(
new EVSEDataRecord(
EVSEId: EVSE_Id. Parse("DE*GEF*E123456789*1"),
ChargingStationId: ChargingStation_Id.Parse("DE*GEF*S123456789"),
ChargingStationName: I18NString. Create(Languages.de, "Testbox 1").
Add(Languages.en, "Testbox One").,
Address: Address.Create(
Country.Germany,
"07749", "Jena",
"Biberweg", "18"
),
GeoCoordinate: GeoCoordinate.Create(
Latitude. Parse(49.731102),
Longitude.Parse(10.142530)
),
Plugs: Enumeration.Create(
PlugTypes.TypeFSchuko,
PlugTypes.Type2Outlet
),
AuthenticationModes: Enumeration.Create(
AuthenticationModes.NFC_RFID_Classic,
AuthenticationModes.NFC_RFID_DESFire,
AuthenticationModes.REMOTE
),
PaymentOptions: Enumeration.Create(
PaymentOptions.Contract,
PaymentOptions.Direct
),
Accessibility: AccessibilityTypes.Paying_publicly_accessible,
HotlinePhoneNumber: "+49 555 12345678",
IsHubjectCompatible: true,
DynamicInfoAvailable: true,
IsOpen24Hours: true
),
new EVSEDataRecord(...)
);
var req = new CPOClient("api.playground.hubject.com").
PushEVSEData(EVSEDataRecords,
ActionType.insert,
IncludeEVSEs: evse => evse.EVSEId.ToString().
StartsWith("DE")).
ContinueWith(task => {
var Acknowledgement = task.Result.Content;
if (Acknowledgement.Result)
Console.WriteLine("success!");
else
{
Console.WriteLine(Acknowledgement.StatusCode.Code);
Console.WriteLine(Acknowledgement.StatusCode.Description);
Console.WriteLine(Acknowledgement.StatusCode.AdditionalInfo);
}
});
// Wait for the task to complete...
req.Wait();
|
You can clone a snippet to your computer for local editing. Learn more.