Exemple #1
0
        /** private methods **/

        /* event callback method */
        private void PCI_0228_EventHandler(IntPtr pWdEvent, IntPtr pDev)
        {
            MarshalWdEvent wdEventMarshaler = new MarshalWdEvent();
            WD_EVENT       wdEvent          = (WD_EVENT)wdEventMarshaler.MarshalNativeToManaged(pWdEvent);

            m_wdcDevice.Event =
                (WD_EVENT)m_wdcDeviceMarshaler.MarshalDevWdEvent(pDev);
            if (m_userEventHandler != null)
            {
                m_userEventHandler(ref wdEvent, this);
            }
        }
Exemple #2
0
        private void PCI_0228_EventHandler(ref WD_EVENT wdEvent, PCI_0228_Device dev)
        {
            string sAction;

            switch ((WD_EVENT_ACTION)wdEvent.dwAction)
            {
            case WD_EVENT_ACTION.WD_INSERT:
                sAction = "WD_INSERT";
                break;

            case WD_EVENT_ACTION.WD_REMOVE:
                sAction = "WD_REMOVE";
                break;

            case WD_EVENT_ACTION.WD_POWER_CHANGED_D0:
                sAction = "WD_POWER_CHANGED_D0";
                break;

            case WD_EVENT_ACTION.WD_POWER_CHANGED_D1:
                sAction = "WD_POWER_CHANGED_D1";
                break;

            case WD_EVENT_ACTION.WD_POWER_CHANGED_D2:
                sAction = "WD_POWER_CHANGED_D2";
                break;

            case WD_EVENT_ACTION.WD_POWER_CHANGED_D3:
                sAction = "WD_POWER_CHANGED_D3";
                break;

            case WD_EVENT_ACTION.WD_POWER_SYSTEM_WORKING:
                sAction = "WD_POWER_SYSTEM_WORKING";
                break;

            case WD_EVENT_ACTION.WD_POWER_SYSTEM_SLEEPING1:
                sAction = "WD_POWER_SYSTEM_SLEEPING1";
                break;

            case WD_EVENT_ACTION.WD_POWER_SYSTEM_SLEEPING2:
                sAction = "WD_POWER_SYSTEM_SLEEPING2";
                break;

            case WD_EVENT_ACTION.WD_POWER_SYSTEM_SLEEPING3:
                sAction = "WD_POWER_SYSTEM_SLEEPING3";
                break;

            case WD_EVENT_ACTION.WD_POWER_SYSTEM_HIBERNATE:
                sAction = "WD_POWER_SYSTEM_HIBERNATE";
                break;

            case WD_EVENT_ACTION.WD_POWER_SYSTEM_SHUTDOWN:
                sAction = "WD_POWER_SYSTEM_SHUTDOWN";
                break;

            default:
                sAction = wdEvent.dwAction.ToString("X");
                break;
            }
            Log.TraceLog("Received event notification of type " + sAction +
                         " on " + dev.ToString(false));
        }