예제 #1
0
        /// <summary>
        /// Return the HashCode of this object.
        /// </summary>
        /// <returns>The HashCode of this object.</returns>
        public override Int32 GetHashCode()
        {
            if (RFIDId.HasValue)
            {
                return(RFIDId.GetHashCode());
            }

            if (RFIDIdentification.HasValue)
            {
                return(RFIDIdentification.GetHashCode());
            }

            if (QRCodeIdentification.HasValue)
            {
                return(QRCodeIdentification.GetHashCode());
            }

            if (PlugAndChargeIdentification.HasValue)
            {
                return(PlugAndChargeIdentification.GetHashCode());
            }

            if (RemoteIdentification.HasValue)
            {
                return(RemoteIdentification.GetHashCode());
            }

            return(0);
        }
예제 #2
0
        public JObject ToJSON()

        => JSONObject.Create(

            AuthToken.HasValue
                       ? new JProperty("authToken", AuthToken.ToString())
                       : null,

            QRCodeIdentification != null
                       ? new JProperty("QRCodeIdentification", QRCodeIdentification.ToString())
                       : null,

            PlugAndChargeIdentification.HasValue
                       ? new JProperty("plugAndChargeIdentification", PlugAndChargeIdentification.ToString())
                       : null,

            RemoteIdentification.HasValue
                       ? new JProperty("remoteIdentification", RemoteIdentification.ToString())
                       : null,

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

            PublicKey != null
                       ? new JProperty("publicKey", PublicKey.ToString())
                       : null

            );
예제 #3
0
        /// <summary>
        /// Return a XML representation of this object.
        /// </summary>
        /// <param name="XName">The XML name to use.</param>
        /// <param name="CustomIdentificationSerializer">A delegate to serialize custom Identification XML elements.</param>
        public XElement ToXML(XName XName = null,
                              CustomXMLSerializerDelegate <Identification> CustomIdentificationSerializer = null)

        {
            var XML = new XElement(XName ?? OICPNS.Authorization + "Identification",

                                   RFIDId.HasValue
                              ? new XElement(OICPNS.CommonTypes + "RFIDMifareFamilyIdentification",
                                             new XElement(OICPNS.CommonTypes + "UID", RFIDId.ToString()))
                              : null,

                                   RFIDIdentification.HasValue
                              ? RFIDIdentification.Value.ToXML()
                              : null,

                                   QRCodeIdentification.HasValue
                              ? QRCodeIdentification.Value.ToXML()
                              : null,

                                   PlugAndChargeIdentification.HasValue
                              ? new XElement(OICPNS.CommonTypes + "PlugAndChargeIdentification",
                                             new XElement(OICPNS.CommonTypes + "EvcoID", PlugAndChargeIdentification.ToString()))
                              : null,

                                   RemoteIdentification.HasValue
                              ? new XElement(OICPNS.CommonTypes + "RemoteIdentification",
                                             new XElement(OICPNS.CommonTypes + "EvcoID", RemoteIdentification.ToString()))
                              : null);

            return(CustomIdentificationSerializer != null
                       ? CustomIdentificationSerializer(this, XML)
                       : XML);
        }