Beispiel #1
0
        /// <summary>
        /// Waits for a slot event, such as token insertion or token removal, to occur
        /// </summary>
        /// <param name="waitType">Type of waiting for a slot event</param>
        /// <param name="eventOccured">Flag indicating whether event occured</param>
        /// <param name="slotId">PKCS#11 handle of slot that the event occurred in</param>
        public void WaitForSlotEvent(WaitType waitType, out bool eventOccured, out ulong slotId)
        {
            if (this._disposed)
            {
                throw new ObjectDisposedException(this.GetType().FullName);
            }

            if (Platform.UnmanagedLongSize == 4)
            {
                uint uintSlotId = CK.CK_INVALID_HANDLE;

                if (Platform.StructPackingSize == 0)
                {
                    _p11_40.WaitForSlotEvent(waitType, out eventOccured, out uintSlotId);
                }
                else
                {
                    _p11_41.WaitForSlotEvent(waitType, out eventOccured, out uintSlotId);
                }

                slotId = uintSlotId;
            }
            else
            {
                if (Platform.StructPackingSize == 0)
                {
                    _p11_80.WaitForSlotEvent(waitType, out eventOccured, out slotId);
                }
                else
                {
                    _p11_81.WaitForSlotEvent(waitType, out eventOccured, out slotId);
                }
            }
        }