Beispiel #1
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomBootNotificationRequestSerializer">A delegate to serialize custom boot notification requests.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <BootNotificationRequest> CustomBootNotificationRequestSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("chargePointVendor", ChargePointVendor),
                new JProperty("chargePointModel", ChargePointModel),

                ChargePointSerialNumber.IsNotNullOrEmpty()
                               ? new JProperty("chargePointSerialNumber", ChargePointSerialNumber)
                               : null,

                ChargeBoxSerialNumber.IsNotNullOrEmpty()
                               ? new JProperty("chargeBoxSerialNumber", ChargeBoxSerialNumber)
                               : null,

                FirmwareVersion.IsNotNullOrEmpty()
                               ? new JProperty("firmwareVersion", FirmwareVersion)
                               : null,

                Iccid.IsNotNullOrEmpty()
                               ? new JProperty("iccid", Iccid)
                               : null,

                IMSI.IsNotNullOrEmpty()
                               ? new JProperty("imsi", IMSI)
                               : null,

                MeterType.IsNotNullOrEmpty()
                               ? new JProperty("meterType", MeterType)
                               : null,

                MeterSerialNumber.IsNotNullOrEmpty()
                               ? new JProperty("meterSerialNumber", MeterSerialNumber)
                               : null

                );

            return(CustomBootNotificationRequestSerializer != null
                       ? CustomBootNotificationRequestSerializer(this, JSON)
                       : JSON);
        }
Beispiel #2
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="CustomEnergyMeterSerializer">A delegate to serialize custom energy meter JSON objects.</param>
        public JObject ToJSON(CustomJObjectSerializerDelegate <EnergyMeter> CustomEnergyMeterSerializer = null)
        {
            var JSON = JSONObject.Create(

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

                Model.IsNotNullOrEmpty()
                               ? new JProperty("model", Model.ToString())
                               : null,

                HardwareVersion.IsNotNullOrEmpty()
                               ? new JProperty("hardware_version", HardwareVersion.ToString())
                               : null,

                FirmwareVersion.IsNotNullOrEmpty()
                               ? new JProperty("firmware_version", FirmwareVersion.ToString())
                               : null,

                Vendor.IsNotNullOrEmpty()
                               ? new JProperty("vendor", Vendor.ToString())
                               : null,

                PublicKey.HasValue
                               ? new JProperty("public_key", PublicKey.ToString())
                               : null,

                PublicKeyCertificate.IsNotNullOrEmpty()
                               ? new JProperty("public_key_certificate", PublicKeyCertificate.ToString())
                               : null

                );

            return(CustomEnergyMeterSerializer != null
                       ? CustomEnergyMeterSerializer(this, JSON)
                       : JSON);
        }