Ejemplo n.º 1
0
        /// <summary>
        /// Begin get additional extender configuration data (async)
        /// </summary>
        /// <param name="callback">callback when extender configuration request is finished</param>
        /// <param name="asyncState">callback async state object</param>
        /// <returns>async result</returns>
        public IAsyncResult BeginGetExtenderConfig(AsyncCallback callback, object asyncState)
        {
            if (IsLegacyPduVersion)
            {
                throw new KsiServiceException("Extender config request is not supported using PDU version v1. Configure the SDK to use PDU v2 format for the given Extender.");
            }

            if (_extendingServiceProtocol == null)
            {
                throw new KsiServiceException("Extending service protocol is missing from service.");
            }

            if (_extendingServiceCredentials == null)
            {
                throw new KsiServiceException("Extending service credentials are missing.");
            }

            PduHeader header = new PduHeader(_extendingServiceCredentials.LoginId);
            ExtenderConfigRequestPayload payload = new ExtenderConfigRequestPayload();
            ExtendRequestPdu             pdu     = new ExtendRequestPdu(header, payload, _extendingMacAlgorithm, _extendingServiceCredentials.LoginKey);
            ulong requestId = GenerateRequestId();

            Logger.Debug("Begin get extender config (request id: {0}){1}{2}", requestId, Environment.NewLine, pdu);
            return(_extendingServiceProtocol.BeginGetExtenderConfig(pdu.Encode(), requestId, callback, asyncState));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Parse child tag
        /// </summary>
        protected override ITlvTag ParseChild(ITlvTag childTag)
        {
            switch (childTag.Type)
            {
            case Constants.ExtendRequestPayload.TagType:
                ExtendRequestPayload extendRequestPayload = childTag as ExtendRequestPayload ?? new ExtendRequestPayload(childTag);
                Payloads.Add(extendRequestPayload);
                return(extendRequestPayload);

            case Constants.ExtenderConfigRequestPayload.TagType:
                ExtenderConfigRequestPayload configRequestPayload = childTag as ExtenderConfigRequestPayload ?? new ExtenderConfigRequestPayload(childTag);
                Payloads.Add(configRequestPayload);
                return(configRequestPayload);

            default:
                return(base.ParseChild(childTag));
            }
        }