コード例 #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));
        }
コード例 #2
0
        /// <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));
        }