/// <summary>
        ///     Begin extend.
        /// </summary>
        /// <param name="payload">extend request payload</param>
        /// <param name="callback">callback when extending request is finished</param>
        /// <param name="asyncState">callback async state object</param>
        /// <returns>async result</returns>
        private IAsyncResult BeginExtend(ExtendRequestPayload payload, AsyncCallback callback, object asyncState)
        {
            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);
            ExtendRequestPdu pdu    = new ExtendRequestPdu(header, payload, _extendingMacAlgorithm, _extendingServiceCredentials.LoginKey);

            Logger.Debug("Begin extend. (request id: {0}){1}{2}", payload.RequestId, Environment.NewLine, pdu);
            return(_extendingServiceProtocol.BeginExtend(pdu.Encode(), payload.RequestId, callback, asyncState));
        }
Exemplo 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));
            }
        }