public void OnException(System.Exception ex) { Debug.LogError (ex.Message); if(onExceptionCallback != null) onExceptionCallback (ex); onExceptionCallback = null; }
/// <summary> /// Parse the given text representation of a GetCompositeSchedule request. /// </summary> /// <param name="Text">The text to be parsed.</param> /// <param name="RequestId">The request identification.</param> /// <param name="ChargeBoxId">The charge box identification.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static GetCompositeScheduleRequest Parse(String Text, Request_Id RequestId, ChargeBox_Id ChargeBoxId, OnExceptionDelegate OnException = null) { if (TryParse(Text, RequestId, ChargeBoxId, out GetCompositeScheduleRequest getCompositeScheduleRequest, OnException)) { return(getCompositeScheduleRequest); } throw new ArgumentException("The given text representation of a GetCompositeSchedule request is invalid!", nameof(Text)); }
/// <summary> /// Parse the given text representation of a MeterValues request. /// </summary> /// <param name="Text">The text to be parsed.</param> /// <param name="RequestId">The request identification.</param> /// <param name="ChargeBoxId">The charge box identification.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static MeterValuesRequest Parse(String Text, Request_Id RequestId, ChargeBox_Id ChargeBoxId, OnExceptionDelegate OnException = null) { if (TryParse(Text, RequestId, ChargeBoxId, out MeterValuesRequest meterValuesRequest, OnException)) { return(meterValuesRequest); } throw new ArgumentException("The given text representation of a MeterValues request is invalid!", nameof(Text)); }
/// <summary> /// Parse the given text-representation of an OICP identification. /// </summary> /// <param name="IdentificationText">The text to parse.</param> /// <param name="CustomIdentificationParser">A delegate to parse custom Identification XML elements.</param> /// <param name="CustomRFIDIdentificationParser">A delegate to parse custom RFID identification XML elements.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static Identification Parse(String IdentificationText, CustomXMLParserDelegate <Identification> CustomIdentificationParser = null, CustomXMLParserDelegate <RFIDIdentification> CustomRFIDIdentificationParser = null, OnExceptionDelegate OnException = null) { if (TryParse(IdentificationText, out Identification identification, CustomIdentificationParser, CustomRFIDIdentificationParser, OnException)) { return(identification); } return(null); }
/// <summary> /// Parse the given text representation of a UpdateFirmware request. /// </summary> /// <param name="Text">The text to be parsed.</param> /// <param name="RequestId">The request identification.</param> /// <param name="ChargeBoxId">The charge box identification.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static UpdateFirmwareRequest Parse(String Text, Request_Id RequestId, ChargeBox_Id ChargeBoxId, OnExceptionDelegate OnException = null) { if (TryParse(Text, RequestId, ChargeBoxId, out UpdateFirmwareRequest updateFirmwareRequest, OnException)) { return(updateFirmwareRequest); } throw new ArgumentException("The given text representation of a UpdateFirmware request is invalid!", nameof(Text)); }
// <soap:Envelope xmlns:soap = "http://www.w3.org/2003/05/soap-envelope" // xmlns:wsa = "http://www.w3.org/2005/08/addressing" // xmlns:ns = "urn://Ocpp/Cp/2015/10/"> // // <soap:Header> // ... // </soap:Header> // // <soap:Body> // <ns:resetRequest> // // <ns:type>?</ns:type> // // </ns:resetRequest> // </soap:Body> // // </soap:Envelope> // { // "$schema": "http://json-schema.org/draft-04/schema#", // "id": "urn:OCPP:1.6:2019:12:ResetRequest", // "title": "ResetRequest", // "type": "object", // "properties": { // "type": { // "type": "string", // "additionalProperties": false, // "enum": [ // "Hard", // "Soft" // ] // } // }, // "additionalProperties": false, // "required": [ // "type" // ] // } #endregion #region (static) Parse (XML, RequestId, ChargeBoxId, OnException = null) /// <summary> /// Parse the given XML representation of a reset request. /// </summary> /// <param name="XML">The XML to be parsed.</param> /// <param name="RequestId">The request identification.</param> /// <param name="ChargeBoxId">The charge box identification.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static ResetRequest Parse(XElement XML, Request_Id RequestId, ChargeBox_Id ChargeBoxId, OnExceptionDelegate OnException = null) { if (TryParse(XML, RequestId, ChargeBoxId, out ResetRequest resetRequest, OnException)) { return(resetRequest); } throw new ArgumentException("The given XML representation of a Reset request is invalid!", nameof(XML)); }
/// <summary> /// Parse the given text representation of a SendLocalList request. /// </summary> /// <param name="Text">The text to be parsed.</param> /// <param name="RequestId">The request identification.</param> /// <param name="ChargeBoxId">The charge box identification.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static SendLocalListRequest Parse(String Text, Request_Id RequestId, ChargeBox_Id ChargeBoxId, OnExceptionDelegate OnException = null) { if (TryParse(Text, RequestId, ChargeBoxId, out SendLocalListRequest sendLocalListRequest, OnException)) { return(sendLocalListRequest); } return(null); }
/// <summary> /// Parse the given text representation of a StopTransaction request. /// </summary> /// <param name="Text">The text to be parsed.</param> /// <param name="RequestId">The request identification.</param> /// <param name="ChargeBoxId">The charge box identification.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static StopTransactionRequest Parse(String Text, Request_Id RequestId, ChargeBox_Id ChargeBoxId, OnExceptionDelegate OnException = null) { if (TryParse(Text, RequestId, ChargeBoxId, out StopTransactionRequest stopTransactionRequest, OnException)) { return(stopTransactionRequest); } throw new ArgumentException("The given text representation of a StopTransaction request is invalid!", nameof(Text)); }
// <soap:Envelope xmlns:soap = "http://www.w3.org/2003/05/soap-envelope" // xmlns:wsa = "http://www.w3.org/2005/08/addressing" // xmlns:ns = "urn://Ocpp/Cp/2015/10/"> // // <soap:Header> // ... // </soap:Header> // // <soap:Body> // // <ns:getLocalListVersionRequest> // // </soap:Body> // // </soap:Envelope> // { // "$schema": "http://json-schema.org/draft-04/schema#", // "id": "urn:OCPP:1.6:2019:12:GetLocalListVersionRequest", // "title": "GetLocalListVersionRequest", // "type": "object", // "properties": {}, // "additionalProperties": false // } #endregion #region (static) Parse (XML, RequestId, ChargeBoxId, OnException = null) /// <summary> /// Parse the given XML representation of a GetLocalListVersion request. /// </summary> /// <param name="XML">The XML to be parsed.</param> /// <param name="RequestId">The request identification.</param> /// <param name="ChargeBoxId">The charge box identification.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static GetLocalListVersionRequest Parse(XElement XML, Request_Id RequestId, ChargeBox_Id ChargeBoxId, OnExceptionDelegate OnException = null) { if (TryParse(XML, RequestId, ChargeBoxId, out GetLocalListVersionRequest getLocalListVersionRequest, OnException)) { return(getLocalListVersionRequest); } throw new ArgumentException("The given XML representation of a GetLocalListVersion request is invalid!", nameof(XML)); }
/// <summary> /// Parse the given text representation of a FirmwareStatusNotification request. /// </summary> /// <param name="Text">The text to be parsed.</param> /// <param name="RequestId">The request identification.</param> /// <param name="ChargeBoxId">The charge box identification.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static FirmwareStatusNotificationRequest Parse(String Text, Request_Id RequestId, ChargeBox_Id ChargeBoxId, OnExceptionDelegate OnException = null) { if (TryParse(Text, RequestId, ChargeBoxId, out FirmwareStatusNotificationRequest diagnosticsStatusNotificationRequest, OnException)) { return(diagnosticsStatusNotificationRequest); } throw new ArgumentException("The given text representation of an AuthorizeRequest request is invalid!", nameof(Text)); }
// <soap:Envelope xmlns:soap = "http://www.w3.org/2003/05/soap-envelope" // xmlns:wsa = "http://www.w3.org/2005/08/addressing" // xmlns:ns = "urn://Ocpp/Cs/2015/10/"> // // <soap:Header> // ... // </soap:Header> // // <soap:Body> // <ns:firmwareStatusNotificationRequest> // // <ns:status>?</ns:status> // // </ns:firmwareStatusNotificationRequest> // </soap:Body> // // </soap:Envelope> // { // "$schema": "http://json-schema.org/draft-04/schema#", // "id": "urn:OCPP:1.6:2019:12:FirmwareStatusStatusNotificationRequest", // "title": "FirmwareStatusStatusNotificationRequest", // "type": "object", // "properties": { // "status": { // "type": "string", // "additionalProperties": false, // "enum": [ // "Downloaded", // "DownloadFailed", // "Downloading", // "Idle", // "InstallationFailed", // "Installing", // "Installed" // ] // } // }, // "additionalProperties": false, // "required": [ // "status" // ] // } #endregion #region (static) Parse (XML, RequestId, ChargeBoxId, OnException = null) /// <summary> /// Parse the given XML representation of a FirmwareStatusNotification request. /// </summary> /// <param name="XML">The XML to be parsed.</param> /// <param name="RequestId">The request identification.</param> /// <param name="ChargeBoxId">The charge box identification.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static FirmwareStatusNotificationRequest Parse(XElement XML, Request_Id RequestId, ChargeBox_Id ChargeBoxId, OnExceptionDelegate OnException = null) { if (TryParse(XML, RequestId, ChargeBoxId, out FirmwareStatusNotificationRequest diagnosticsStatusNotificationRequest, OnException)) { return(diagnosticsStatusNotificationRequest); } throw new ArgumentException("The given XML representation of a FirmwareStatusNotification request is invalid!", nameof(XML)); }
/// <summary> /// Parse the given text representation of a TriggerMessage request. /// </summary> /// <param name="Text">The text to be parsed.</param> /// <param name="RequestId">The request identification.</param> /// <param name="ChargeBoxId">The charge box identification.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static TriggerMessageRequest Parse(String Text, Request_Id RequestId, ChargeBox_Id ChargeBoxId, OnExceptionDelegate OnException = null) { if (TryParse(Text, RequestId, ChargeBoxId, out TriggerMessageRequest triggerMessageRequest, OnException)) { return(triggerMessageRequest); } throw new ArgumentException("The given text representation of a TriggerMessage request is invalid!", nameof(Text)); }
// <soap:Envelope xmlns:soap = "http://www.w3.org/2003/05/soap-envelope" // xmlns:eMIP = "https://api-iop.gireve.com/schemas/AuthorisationV1/"> // // [...] // // <chargeDetailRecord> // // <CDRNature>?</CDRNature> // // <serviceSessionId>?</serviceSessionId> // // <!--Optional:--> // <execPartnerSessionId>?</execPartnerSessionId> // // <!--Optional:--> // <execPartnerOperatorIdType>?</execPartnerOperatorIdType> // // <!--Optional:--> // <execPartnerOperatorId>?</execPartnerOperatorId> // // <!--Optional:--> // <salePartnerSessionId>?</salePartnerSessionId> // // <!--Optional:--> // <salePartnerOperatorIdType>?</salePartnerOperatorIdType> // // <!--Optional:--> // <salePartnerOperatorId>?</salePartnerOperatorId> // // <requestedServiceId>?</requestedServiceId> // // <EVSEIdType>?</EVSEIdType> // <EVSEId>?</EVSEId> // // <!--Optional:--> // <userContractIdAlias>?</userContractIdAlias> // // <userIdType>?</userIdType> // <userId>?</userId> // // <!--Optional:--> // <partnerProductId>?</partnerProductId> // // <startTime>?</startTime> // <endTime>?</endTime> // // <meterReportList> // <!--Zero or more repetitions:--> // <meterReport> // <meterTypeId>?</meterTypeId> // <meterValue>?</meterValue> // <meterUnit>?</meterUnit> // </meterReport> // </meterReportList> // // </chargeDetailRecord> // // [...] // // </soap:Envelope> #endregion #region (static) Parse (ChargeDetailRecordXML, ..., OnException = null) /// <summary> /// Parse the given XML representation of an eMIP charge detail record. /// </summary> /// <param name="ChargeDetailRecordXML">The XML to parse.</param> /// <param name="CustomChargeDetailRecordParser">An optional delegate to parse custom ChargeDetailRecord XML elements.</param> /// <param name="CustomMeterReportParser">An optional delegate to parse custom MeterReport XML elements.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static ChargeDetailRecord Parse(XElement ChargeDetailRecordXML, CustomXMLParserDelegate <ChargeDetailRecord> CustomChargeDetailRecordParser = null, CustomXMLParserDelegate <MeterReport> CustomMeterReportParser = null, OnExceptionDelegate OnException = null) { if (TryParse(ChargeDetailRecordXML, out ChargeDetailRecord _ChargeDetailRecord, CustomChargeDetailRecordParser, CustomMeterReportParser, OnException)) { return(_ChargeDetailRecord); } return(null); }
/// <summary> /// Try to parse the given XML representation of a charging profile. /// </summary> /// <param name="ChargingProfileXML">The XML to be parsed.</param> /// <param name="ChargingProfile">The parsed connector type.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static Boolean TryParse(XElement ChargingProfileXML, out ChargingProfile ChargingProfile, OnExceptionDelegate OnException = null) { try { ChargingProfile = new ChargingProfile( ChargingProfileXML.MapValueOrFail(OCPPNS.OCPPv1_6_CP + "chargingProfileId", ChargingProfile_Id.Parse), ChargingProfileXML.MapValueOrFail(OCPPNS.OCPPv1_6_CP + "stackLevel", UInt32.Parse), ChargingProfileXML.MapValueOrFail(OCPPNS.OCPPv1_6_CP + "chargingProfilePurpose", ChargingProfilePurposesExtentions.Parse), ChargingProfileXML.MapValueOrFail(OCPPNS.OCPPv1_6_CP + "chargingProfileKind", ChargingProfileKindsExtentions.Parse), ChargingProfileXML.MapElementOrFail(OCPPNS.OCPPv1_6_CP + "chargingSchedule", ChargingSchedule.Parse), ChargingProfileXML.MapValueOrNullable(OCPPNS.OCPPv1_6_CP + "transactionId", Transaction_Id.Parse), ChargingProfileXML.MapValueOrNull(OCPPNS.OCPPv1_6_CP + "recurrencyKind", RecurrencyKindsExtentions.Parse), ChargingProfileXML.MapValueOrNullable(OCPPNS.OCPPv1_6_CP + "validFrom", DateTime.Parse), ChargingProfileXML.MapValueOrNullable(OCPPNS.OCPPv1_6_CP + "validTo", DateTime.Parse) ); return(true); } catch (Exception e) { OnException?.Invoke(org.GraphDefined.Vanaheimr.Illias.Timestamp.Now, ChargingProfileXML, e); ChargingProfile = null; return(false); } }
/// <summary> /// Try to parse the given XML representation of an OICP EVSE data request. /// </summary> /// <param name="EVSEDataXML">The XML to parse.</param> /// <param name="EVSEData">The parsed EVSEData request.</param> /// <param name="CustomEVSEDataParser">A delegate to parse custom EVSEData XML elements.</param> /// <param name="CustomOperatorEVSEDataParser">A delegate to parse custom OperatorEVSEData XML elements.</param> /// <param name="CustomEVSEDataRecordParser">A delegate to parse custom EVSEDataRecord XML elements.</param> /// <param name="CustomAddressParser">A delegate to parse custom Address XML elements.</param> /// <param name="CustomChargingFacilityParser">A delegate to parse custom ChargingFacility XML elements.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static Boolean TryParse(XElement EVSEDataXML, out EVSEData EVSEData, CustomXMLParserDelegate <EVSEData> CustomEVSEDataParser = null, CustomXMLParserDelegate <OperatorEVSEData> CustomOperatorEVSEDataParser = null, CustomXMLParserDelegate <EVSEDataRecord> CustomEVSEDataRecordParser = null, CustomXMLParserDelegate <Address> CustomAddressParser = null, CustomXMLParserDelegate <ChargingFacility> CustomChargingFacilityParser = null, OnExceptionDelegate OnException = null) { try { if (EVSEDataXML.Name != OICPNS.EVSEData + "EvseData") { EVSEData = null; return(false); } EVSEData = new EVSEData( EVSEDataXML.MapElements(OICPNS.EVSEData + "OperatorEvseData", (OperatorEvseDataXML, onexception) => OICPv2_2.OperatorEVSEData.Parse(OperatorEvseDataXML, CustomOperatorEVSEDataParser, CustomEVSEDataRecordParser, CustomAddressParser, CustomChargingFacilityParser, onexception), OnException) ); if (CustomEVSEDataParser != null) { EVSEData = CustomEVSEDataParser(EVSEDataXML, EVSEData); } return(true); } catch (Exception e) { OnException?.Invoke(DateTime.UtcNow, EVSEDataXML, e); EVSEData = null; return(false); } }
/// <summary> /// Try to parse the given XML representation of an OICP provider authentication data. /// </summary> /// <param name="ProviderAuthenticationDataXML">The XML to parse.</param> /// <param name="ProviderAuthenticationData">The parsed provider authentication data.</param> /// <param name="CustomProviderAuthenticationDataParser">A delegate to parse custom ProviderAuthenticationData XML elements.</param> /// <param name="CustomIdentificationParser">A delegate to parse custom Identification XML elements.</param> /// <param name="CustomRFIDIdentificationParser">A delegate to parse custom RFID identification XML elements.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static Boolean TryParse(XElement ProviderAuthenticationDataXML, out ProviderAuthenticationData ProviderAuthenticationData, CustomXMLParserDelegate <ProviderAuthenticationData> CustomProviderAuthenticationDataParser = null, CustomXMLParserDelegate <Identification> CustomIdentificationParser = null, CustomXMLParserDelegate <RFIDIdentification> CustomRFIDIdentificationParser = null, OnExceptionDelegate OnException = null) { try { if (ProviderAuthenticationDataXML.Name != OICPNS.AuthenticationData + "ProviderAuthenticationData") { ProviderAuthenticationData = null; return(false); } ProviderAuthenticationData = new ProviderAuthenticationData( ProviderAuthenticationDataXML.MapValueOrFail(OICPNS.AuthenticationData + "ProviderID", Provider_Id.Parse), ProviderAuthenticationDataXML.MapElementsOrFail(OICPNS.AuthenticationData + "AuthenticationDataRecord", OICPNS.AuthenticationData + "Identification", (XML, e) => Identification.Parse(XML, CustomIdentificationParser, CustomRFIDIdentificationParser, e), OnException) ); if (CustomProviderAuthenticationDataParser != null) { ProviderAuthenticationData = CustomProviderAuthenticationDataParser(ProviderAuthenticationDataXML, ProviderAuthenticationData); } return(true); } catch (Exception e) { OnException?.Invoke(DateTime.UtcNow, ProviderAuthenticationDataXML, e); ProviderAuthenticationData = null; return(false); } }
/// <summary> /// Try to parse the given XML representation of an OICP push EVSE status request. /// </summary> /// <param name="PushEVSEStatusXML">The XML to parse.</param> /// <param name="PushEVSEStatus">The parsed push EVSE status request.</param> /// <param name="CustomOperatorEVSEStatusParser">A delegate to parse custom OperatorEVSEStatus XML elements.</param> /// <param name="CustomEVSEStatusRecordParser">A delegate to parse custom EVSEStatusRecord XML elements.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> /// /// <param name="Timestamp">The optional timestamp of the request.</param> /// <param name="CancellationToken">An optional token to cancel this request.</param> /// <param name="EventTrackingId">An optional event tracking identification for correlating this request with other events.</param> /// <param name="RequestTimeout">An optional timeout for this request.</param> public static Boolean TryParse(XElement PushEVSEStatusXML, out PushEVSEStatusRequest PushEVSEStatus, CustomXMLParserDelegate <OperatorEVSEStatus> CustomOperatorEVSEStatusParser = null, CustomXMLParserDelegate <EVSEStatusRecord> CustomEVSEStatusRecordParser = null, OnExceptionDelegate OnException = null, DateTime?Timestamp = null, CancellationToken?CancellationToken = null, EventTracking_Id EventTrackingId = null, TimeSpan?RequestTimeout = null) { try { if (PushEVSEStatusXML.Name != OICPNS.EVSEStatus + "eRoamingPushEvseStatus") { PushEVSEStatus = null; return(false); } PushEVSEStatus = new PushEVSEStatusRequest( OperatorEVSEStatus.Parse(PushEVSEStatusXML.ElementOrFail(OICPNS.EVSEStatus + "OperatorEvseStatus"), CustomOperatorEVSEStatusParser, CustomEVSEStatusRecordParser, OnException), PushEVSEStatusXML.MapValueOrFail(OICPNS.EVSEStatus + "ActionType", ActionTypesExtentions.Parse), Timestamp, CancellationToken, EventTrackingId, RequestTimeout ); return(true); } catch (Exception e) { OnException?.Invoke(DateTime.UtcNow, PushEVSEStatusXML, e); PushEVSEStatus = null; return(false); } }
/// <summary> /// Try to parse the given XML representation of an OCPP charging profile. /// </summary> /// <param name="ChargingProfileXML">The XML to parse.</param> /// <param name="ChargingProfile">The parsed connector type.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static Boolean TryParse(XElement ChargingProfileXML, out ChargingProfile ChargingProfile, OnExceptionDelegate OnException = null) { try { ChargingProfile = new ChargingProfile( ChargingProfileXML.MapValueOrFail(OCPPNS.OCPPv1_6_CP + "chargingProfileId", ChargingProfile_Id.Parse), ChargingProfileXML.MapValueOrFail(OCPPNS.OCPPv1_6_CP + "stackLevel", UInt32.Parse), ChargingProfileXML.MapEnumValuesOrFail(OCPPNS.OCPPv1_6_CP + "chargingProfilePurpose", XML_IO.AsChargingProfilePurpose), ChargingProfileXML.MapEnumValuesOrFail(OCPPNS.OCPPv1_6_CP + "chargingProfileKind", XML_IO.AsChargingProfileKind), ChargingProfileXML.MapElementOrFail(OCPPNS.OCPPv1_6_CP + "chargingSchedule", ChargingSchedule.Parse), ChargingProfileXML.MapValueOrNullable(OCPPNS.OCPPv1_6_CP + "transactionId", Transaction_Id.Parse), ChargingProfileXML.MapEnumValuesOrNull(OCPPNS.OCPPv1_6_CP + "recurrencyKind", XML_IO.AsRecurrencyKind), ChargingProfileXML.MapValueOrNullable(OCPPNS.OCPPv1_6_CP + "validFrom", DateTime.Parse), ChargingProfileXML.MapValueOrNullable(OCPPNS.OCPPv1_6_CP + "validTo", DateTime.Parse) ); return(true); } catch (Exception e) { OnException?.Invoke(DateTime.Now, ChargingProfileXML, e); ChargingProfile = null; return(false); } }
/// <summary> /// Try to parse the given XML representation of an OICP pull EVSE status by id request. /// </summary> /// <param name="PullEVSEStatusByOperatorIdXML">The XML to parse.</param> /// <param name="PullEVSEStatusByOperatorId">The parsed pull EVSE status by id request.</param> /// <param name="CustomPullEVSEStatusByOperatorIdRequestParser">A delegate to parse custom PullEVSEStatusByOperatorId requests.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> /// /// <param name="Timestamp">The optional timestamp of the request.</param> /// <param name="CancellationToken">An optional token to cancel this request.</param> /// <param name="EventTrackingId">An optional event tracking identification for correlating this request with other events.</param> /// <param name="RequestTimeout">An optional timeout for this request.</param> public static Boolean TryParse(XElement PullEVSEStatusByOperatorIdXML, out PullEVSEStatusByOperatorIdRequest PullEVSEStatusByOperatorId, CustomXMLParserDelegate <PullEVSEStatusByOperatorIdRequest> CustomPullEVSEStatusByOperatorIdRequestParser = null, OnExceptionDelegate OnException = null, DateTime?Timestamp = null, CancellationToken?CancellationToken = null, EventTracking_Id EventTrackingId = null, TimeSpan?RequestTimeout = null) { try { if (PullEVSEStatusByOperatorIdXML.Name != OICPNS.EVSEStatus + "eRoamingPullEvseStatusByOperatorId") { PullEVSEStatusByOperatorId = null; return(false); } PullEVSEStatusByOperatorId = new PullEVSEStatusByOperatorIdRequest(PullEVSEStatusByOperatorIdXML.MapValueOrFail(OICPNS.EVSEStatus + "ProviderID", Provider_Id.Parse), PullEVSEStatusByOperatorIdXML.MapValuesOrFail(OICPNS.EVSEStatus + "OperatorID", Operator_Id.Parse), Timestamp, CancellationToken, EventTrackingId, RequestTimeout); if (CustomPullEVSEStatusByOperatorIdRequestParser != null) { PullEVSEStatusByOperatorId = CustomPullEVSEStatusByOperatorIdRequestParser(PullEVSEStatusByOperatorIdXML, PullEVSEStatusByOperatorId); } return(true); } catch (Exception e) { OnException?.Invoke(DateTime.UtcNow, PullEVSEStatusByOperatorIdXML, e); PullEVSEStatusByOperatorId = null; return(false); } }
/// <summary> /// Try to parse the given XML representation of a Heartbeat response. /// </summary> /// <param name="Request">The Heartbeat request leading to this response.</param> /// <param name="HeartbeatResponseXML">The XML to parse.</param> /// <param name="HeartbeatResponse">The parsed Heartbeat response.</param> /// <param name="CustomSendHeartbeatResponseParser">An optional delegate to parse custom HeartbeatResponse XML elements.</param> /// <param name="HTTPResponse">The correlated HTTP response of this eMIP response.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static Boolean TryParse(HeartbeatRequest Request, XElement HeartbeatResponseXML, out HeartbeatResponse HeartbeatResponse, CustomXMLParserDelegate <HeartbeatResponse> CustomSendHeartbeatResponseParser = null, HTTPResponse HTTPResponse = null, OnExceptionDelegate OnException = null) { try { HeartbeatResponse = new HeartbeatResponse( Request, HeartbeatResponseXML.MapValueOrFail("heartBeatPeriod", s => TimeSpan.FromSeconds(UInt32.Parse(s))), HeartbeatResponseXML.MapValueOrFail("currentTime", s => DateTime.Parse(s)), HeartbeatResponseXML.MapValueOrFail("transactionId", Transaction_Id.Parse), HeartbeatResponseXML.MapValueOrFail("requestStatus", RequestStatus.Parse), HTTPResponse ); if (CustomSendHeartbeatResponseParser != null) { HeartbeatResponse = CustomSendHeartbeatResponseParser(HeartbeatResponseXML, HeartbeatResponse); } return(true); } catch (Exception e) { OnException?.Invoke(DateTime.UtcNow, HeartbeatResponseXML, e); HeartbeatResponse = null; return(false); } }
/// <summary> /// Try to parse the given XML representation of an OICP operator EVSE status request. /// </summary> /// <param name="OperatorEVSEStatusXML">The XML to parse.</param> /// <param name="OperatorEVSEStatus">The parsed operator EVSE status request.</param> /// <param name="CustomOperatorEVSEStatusParser">A delegate to parse custom OperatorEVSEStatus XML elements.</param> /// <param name="CustomEVSEStatusRecordParser">A delegate to parse custom EVSEStatusRecord XML elements.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static Boolean TryParse(XElement OperatorEVSEStatusXML, out OperatorEVSEStatus OperatorEVSEStatus, CustomXMLParserDelegate <OperatorEVSEStatus> CustomOperatorEVSEStatusParser = null, CustomXMLParserDelegate <EVSEStatusRecord> CustomEVSEStatusRecordParser = null, OnExceptionDelegate OnException = null) { try { if (OperatorEVSEStatusXML.Name != OICPNS.EVSEStatus + "OperatorEvseStatus") { OperatorEVSEStatus = null; return(false); } OperatorEVSEStatus = new OperatorEVSEStatus( OperatorEVSEStatusXML.MapElements(OICPNS.EVSEStatus + "EvseStatusRecord", (xml, e) => EVSEStatusRecord.Parse(xml, CustomEVSEStatusRecordParser, e), OnException). Where(operatorevsestatus => operatorevsestatus != null), OperatorEVSEStatusXML.MapValueOrFail(OICPNS.EVSEStatus + "OperatorID", Operator_Id.Parse), OperatorEVSEStatusXML.ElementValueOrDefault(OICPNS.EVSEStatus + "OperatorName") ); if (CustomOperatorEVSEStatusParser != null) { OperatorEVSEStatus = CustomOperatorEVSEStatusParser(OperatorEVSEStatusXML, OperatorEVSEStatus); } return(true); } catch (Exception e) { OnException?.Invoke(DateTime.UtcNow, OperatorEVSEStatusXML, e); OperatorEVSEStatus = null; return(false); } }
/// <summary> /// Try to parse the given XML representation of an OICP get charge detail records request. /// </summary> /// <param name="GetChargeDetailRecordsRequestXML">The XML to parse.</param> /// <param name="GetChargeDetailRecordsRequest">The parsed get charge detail records request.</param> /// <param name="CustomGetChargeDetailRecordsRequestParser">A delegate to parse custom GetChargeDetailRecords requests.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> /// /// <param name="Timestamp">The optional timestamp of the request.</param> /// <param name="CancellationToken">An optional token to cancel this request.</param> /// <param name="EventTrackingId">An optional event tracking identification for correlating this request with other events.</param> /// <param name="RequestTimeout">An optional timeout for this request.</param> public static Boolean TryParse(XElement GetChargeDetailRecordsRequestXML, out GetChargeDetailRecordsRequest GetChargeDetailRecordsRequest, CustomXMLParserDelegate <GetChargeDetailRecordsRequest> CustomGetChargeDetailRecordsRequestParser = null, OnExceptionDelegate OnException = null, DateTime?Timestamp = null, CancellationToken?CancellationToken = null, EventTracking_Id EventTrackingId = null, TimeSpan?RequestTimeout = null) { try { GetChargeDetailRecordsRequest = new GetChargeDetailRecordsRequest( GetChargeDetailRecordsRequestXML.MapValueOrFail(OICPNS.Authorization + "ProviderID", Provider_Id.Parse), GetChargeDetailRecordsRequestXML.MapValueOrFail(OICPNS.Authorization + "From", DateTime.Parse), GetChargeDetailRecordsRequestXML.MapValueOrFail(OICPNS.Authorization + "To", DateTime.Parse), Timestamp, CancellationToken, EventTrackingId, RequestTimeout); if (CustomGetChargeDetailRecordsRequestParser != null) { GetChargeDetailRecordsRequest = CustomGetChargeDetailRecordsRequestParser(GetChargeDetailRecordsRequestXML, GetChargeDetailRecordsRequest); } return(true); } catch (Exception e) { OnException?.Invoke(DateTime.UtcNow, GetChargeDetailRecordsRequestXML, e); GetChargeDetailRecordsRequest = null; return(false); } }
/// <summary> /// Try to parse the given XML representation of an OICP mobile authorize start request. /// </summary> /// <param name="MobileRemoteStartXML">The XML to parse.</param> /// <param name="MobileRemoteStart">The parsed mobile authorize start request.</param> /// <param name="CustomMobileRemoteStartRequestParser">A delegate to parse custom MobileRemoteStart requests.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> /// /// <param name="Timestamp">The optional timestamp of the request.</param> /// <param name="CancellationToken">An optional token to cancel this request.</param> /// <param name="EventTrackingId">An optional event tracking identification for correlating this request with other events.</param> /// <param name="RequestTimeout">An optional timeout for this request.</param> public static Boolean TryParse(XElement MobileRemoteStartXML, out MobileRemoteStartRequest MobileRemoteStart, CustomXMLParserDelegate <MobileRemoteStartRequest> CustomMobileRemoteStartRequestParser = null, OnExceptionDelegate OnException = null, DateTime?Timestamp = null, CancellationToken?CancellationToken = null, EventTracking_Id EventTrackingId = null, TimeSpan?RequestTimeout = null) { try { if (MobileRemoteStartXML.Name != OICPNS.MobileAuthorization + "eRoamingMobileRemoteStart") { MobileRemoteStart = null; return(false); } MobileRemoteStart = new MobileRemoteStartRequest( MobileRemoteStartXML.MapValueOrFail(OICPNS.MobileAuthorization + "SessionID", Session_Id.Parse), Timestamp, CancellationToken, EventTrackingId, RequestTimeout); if (CustomMobileRemoteStartRequestParser != null) { MobileRemoteStart = CustomMobileRemoteStartRequestParser(MobileRemoteStartXML, MobileRemoteStart); } return(true); } catch (Exception e) { OnException?.Invoke(DateTime.UtcNow, MobileRemoteStartXML, e); MobileRemoteStart = null; return(false); } }
/// <summary> /// Try to parse the given XML representation of an OCPP meter values response. /// </summary> /// <param name="MeterValuesResponseXML">The XML to parse.</param> /// <param name="MeterValuesResponse">The parsed meter values response.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static Boolean TryParse(XElement MeterValuesResponseXML, out MeterValuesResponse MeterValuesResponse, OnExceptionDelegate OnException = null) { try { MeterValuesResponse = new MeterValuesResponse(); return(true); } catch (Exception e) { OnException?.Invoke(DateTime.Now, MeterValuesResponseXML, e); MeterValuesResponse = null; return(false); } }
/// <summary> /// Try to parse the given XML representation of an OCPP heartbeat request. /// </summary> /// <param name="HeartbeatRequestXML">The XML to parse.</param> /// <param name="HeartbeatRequest">The parsed heartbeat request.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static Boolean TryParse(XElement HeartbeatRequestXML, out HeartbeatRequest HeartbeatRequest, OnExceptionDelegate OnException = null) { try { HeartbeatRequest = new HeartbeatRequest(); return(true); } catch (Exception e) { OnException?.Invoke(DateTime.Now, HeartbeatRequestXML, e); HeartbeatRequest = null; return(false); } }
// <soap:Envelope xmlns:soap = "http://www.w3.org/2003/05/soap-envelope" // xmlns:eMIP = "https://api-iop.gireve.com/schemas/EVCIDynamicV1/"> // // <soap:Header/> // // <soap:Body> // <eMIP:eMIP_ToIOP_SetChargingConnectorAvailabilityStatusResponse> // <transactionId>TRANSACTION_46151</transactionId> // <requestStatus>1</requestStatus> // </eMIP:eMIP_ToIOP_SetChargingConnectorAvailabilityStatusResponse> // </soap:Body> // // </soap:Envelope> #endregion #region (static) Parse (Request, SetChargingConnectorAvailabilityStatusResponseXML, ..., OnException = null) /// <summary> /// Parse the given XML representation of a SetChargingConnectorAvailabilityStatus response. /// </summary> /// <param name="Request">The SetChargingConnectorAvailabilityStatus request leading to this response.</param> /// <param name="SetChargingConnectorAvailabilityStatusResponseXML">The XML to parse.</param> /// <param name="CustomSendSetChargingConnectorAvailabilityStatusResponseParser">An optional delegate to parse custom SetChargingConnectorAvailabilityStatusResponse XML elements.</param> /// <param name="HTTPResponse">The correlated HTTP response of this eMIP response.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static SetChargingConnectorAvailabilityStatusResponse Parse(SetChargingConnectorAvailabilityStatusRequest Request, XElement SetChargingConnectorAvailabilityStatusResponseXML, CustomXMLParserDelegate <SetChargingConnectorAvailabilityStatusResponse> CustomSendSetChargingConnectorAvailabilityStatusResponseParser, HTTPResponse HTTPResponse = null, OnExceptionDelegate OnException = null) { if (TryParse(Request, SetChargingConnectorAvailabilityStatusResponseXML, out SetChargingConnectorAvailabilityStatusResponse SetChargingConnectorAvailabilityStatusResponse, CustomSendSetChargingConnectorAvailabilityStatusResponseParser, HTTPResponse, OnException)) { return(SetChargingConnectorAvailabilityStatusResponse); } return(null); }
/// <summary> /// Try to parse the given XML representation of an OCPP firmware status notification response. /// </summary> /// <param name="FirmwareStatusNotificationResponseXML">The XML to parse.</param> /// <param name="FirmwareStatusNotificationResponse">The parsed firmware status notification response.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static Boolean TryParse(XElement FirmwareStatusNotificationResponseXML, out FirmwareStatusNotificationResponse FirmwareStatusNotificationResponse, OnExceptionDelegate OnException = null) { try { FirmwareStatusNotificationResponse = new FirmwareStatusNotificationResponse(); return(true); } catch (Exception e) { OnException?.Invoke(DateTime.Now, FirmwareStatusNotificationResponseXML, e); FirmwareStatusNotificationResponse = null; return(false); } }
/// <summary> /// Parse the given text representation of a SetSessionEventReport response. /// </summary> /// <param name="Request">The SetSessionEventReport request leading to this response.</param> /// <param name="SetSessionEventReportResponseText">The text to parse.</param> /// <param name="CustomSetSessionEventReportResponseParser">An optional delegate to parse custom SetSessionEventReportResponse XML elements.</param> /// <param name="HTTPResponse">The correlated HTTP response of this eMIP response.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static SetSessionEventReportResponse Parse(SetSessionEventReportRequest Request, String SetSessionEventReportResponseText, CustomXMLParserDelegate <SetSessionEventReportResponse> CustomSetSessionEventReportResponseParser = null, HTTPResponse HTTPResponse = null, OnExceptionDelegate OnException = null) { if (TryParse(Request, SetSessionEventReportResponseText, out SetSessionEventReportResponse SetSessionEventReportResponse, CustomSetSessionEventReportResponseParser, HTTPResponse, OnException)) { return(SetSessionEventReportResponse); } return(null); }
/// <summary> /// Parse the given text representation of a Heartbeat response. /// </summary> /// <param name="Request">The Heartbeat request leading to this response.</param> /// <param name="HeartbeatResponseText">The text to parse.</param> /// <param name="CustomSendHeartbeatResponseParser">An optional delegate to parse custom HeartbeatResponse XML elements.</param> /// <param name="HTTPResponse">The correlated HTTP response of this eMIP response.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static HeartbeatResponse Parse(HeartbeatRequest Request, String HeartbeatResponseText, CustomXMLParserDelegate <HeartbeatResponse> CustomSendHeartbeatResponseParser = null, HTTPResponse HTTPResponse = null, OnExceptionDelegate OnException = null) { if (TryParse(Request, HeartbeatResponseText, out HeartbeatResponse HeartbeatResponse, CustomSendHeartbeatResponseParser, HTTPResponse, OnException)) { return(HeartbeatResponse); } return(null); }
/// <summary> /// Try to parse the given XML representation of an OCPP update firmware response. /// </summary> /// <param name="UpdateFirmwareResponseXML">The XML to parse.</param> /// <param name="UpdateFirmwareResponse">The parsed update firmware response.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static Boolean TryParse(XElement UpdateFirmwareResponseXML, out UpdateFirmwareResponse UpdateFirmwareResponse, OnExceptionDelegate OnException = null) { try { UpdateFirmwareResponse = new UpdateFirmwareResponse(); return(true); } catch (Exception e) { OnException?.Invoke(DateTime.Now, UpdateFirmwareResponseXML, e); UpdateFirmwareResponse = null; return(false); } }
/// <summary> /// Try to parse the given JSON representation of a get local list version request. /// </summary> /// <param name="GetLocalListVersionRequestJSON">The JSON to be parsed.</param> /// <param name="GetLocalListVersionRequest">The parsed get local list version request.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static Boolean TryParse(JObject GetLocalListVersionRequestJSON, out GetLocalListVersionRequest GetLocalListVersionRequest, OnExceptionDelegate OnException = null) { try { GetLocalListVersionRequest = new GetLocalListVersionRequest(); return(true); } catch (Exception e) { OnException?.Invoke(DateTime.UtcNow, GetLocalListVersionRequestJSON, e); GetLocalListVersionRequest = null; return(false); } }
public App42Response(OnSuccessDelegate pSuccessCallback, OnExceptionDelegate pExceptionCallback) { onSuccessCallback += pSuccessCallback; onExceptionCallback += pExceptionCallback; }