예제 #1
0
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        public XElement ToXML()

        => new XElement(OCPPNS.OCPPv1_6_CS + "startTransactionRequest",

                        new XElement(OCPPNS.OCPPv1_6_CS + "connectorId", ConnectorId),
                        new XElement(OCPPNS.OCPPv1_6_CS + "idTag", IdTag.ToString()),
                        new XElement(OCPPNS.OCPPv1_6_CS + "timestamp", StartTimestamp.ToIso8601()),
                        new XElement(OCPPNS.OCPPv1_6_CS + "meterStart", MeterStart),

                        ReservationId.HasValue
                       ? new XElement(OCPPNS.OCPPv1_6_CS + "reservationId", ReservationId.Value)
                       : null

                        );
예제 #2
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomStartTransactionRequestSerializer">A delegate to serialize custom start transaction requests.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <StartTransactionRequest> CustomStartTransactionRequestSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("connectorId", ConnectorId.ToString()),
                new JProperty("idTag", IdTag.ToString()),
                new JProperty("timestamp", StartTimestamp.ToIso8601()),
                new JProperty("meterStart", MeterStart),

                ReservationId.HasValue
                               ? new JProperty("reservationId", ReservationId.Value.ToString())
                               : null

                );

            return(CustomStartTransactionRequestSerializer != null
                       ? CustomStartTransactionRequestSerializer(this, JSON)
                       : JSON);
        }
예제 #3
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="Embedded">Whether this data is embedded into another data structure.</param>
        /// <param name="IncludeCryptoHash">Include the crypto hash value of this object.</param>
        public JObject ToJSON(Boolean Embedded          = false,
                              InfoStatus ExpandTags     = InfoStatus.ShowIdOnly,
                              InfoStatus ExpandAuthorId = InfoStatus.ShowIdOnly,
                              Boolean IncludeCryptoHash = false)

        => JSONObject.Create(

            new JProperty("@id", Id.ToString()),

            !Embedded
                       ? new JProperty("@context", JSONLDContext.ToString())
                       : null,

            new JProperty("text", Text.ToJSON()),

            new JProperty("startTimestamp", StartTimestamp.ToIso8601()),
            new JProperty("endTimestamp", EndTimestamp.ToIso8601()),
            new JProperty("author", JSONObject.Create(
                              new JProperty("@id", Author.Id.ToString()),
                              new JProperty("name", Author.Name)
                              ))

            );