コード例 #1
0
ファイル: FDEventMonitor.cpp プロジェクト: ssfdre38/xbmc
void CFDEventMonitor::AddFD(const MonitoredFD& monitoredFD, int& id)
{
  CSingleLock lock(m_mutex);
  InterruptPoll();

  AddFDLocked(monitoredFD, id);

  StartMonitoring();
}
コード例 #2
0
// -----------------------------------------------------------------------------
// CPESimStateMonitor::RunL
// In startup reads Sim state from System Agent, otherwise it is called 
// when Sim state is changed.
// -----------------------------------------------------------------------------
//
void CPESimStateMonitor::RunL()
    {
    TInt status = iStatus.Int(); 
    // resubscribe before processing new value to prevent missing updates
    StartMonitoring();

    iProperty.Get( KPSUidStartup, iPropertyKey, iSimState );

    if ( iStartUp )
        {
        iStartUp = EFalse;

        if ( iPropertyKey == KPSSimStatus )
            {
            if( iSimState != EPESimStatusUninitialized && iSimState != EPESimNotSupported )
                {
                iModel.SendMessage( MEngineMonitor::EPEMessageSIMStateChanged );
                }
            }
        else
            {
            iModel.SendMessage( MEngineMonitor::EPEMessageSIMChanged );
            }
        }
    else // Sim or Sim status has changed
        {
        if ( status == KErrNone ) 
            {
            TEFLOGSTRING3( KTAMESINT, 
                "PE CPESimStateMonitor::RunL, event: %d, property: %d"
                , iPropertyKey
                , iSimState );

            if ( iPropertyKey == KPSSimStatus )
                {    
                iModel.SendMessage( MEngineMonitor::EPEMessageSIMStateChanged );
                }
            else 
                {
                if ( iSimState == ESimChanged )
                    {
                    iModel.SendMessage( MEngineMonitor::EPEMessageSIMChanged );
                    }
                }
            }
        else
            {
            TEFLOGSTRING3( KTAERROR, "PE CPESimStateMonitor::RunL, event: %d, status: %d", iPropertyKey, status );
            }   
        }
    }
コード例 #3
0
ファイル: FDEventMonitor.cpp プロジェクト: ssfdre38/xbmc
void CFDEventMonitor::AddFDs(const std::vector<MonitoredFD>& monitoredFDs,
                             std::vector<int>& ids)
{
  CSingleLock lock(m_mutex);
  InterruptPoll();

  for (unsigned int i = 0; i < monitoredFDs.size(); ++i)
  {
    int id;
    AddFDLocked(monitoredFDs[i], id);
    ids.push_back(id);
  }

  StartMonitoring();
}
コード例 #4
0
CCmdHandler::CCmdHandler()
    : m_hEventExit(INVALID_HANDLE_VALUE)
    , m_hThreadDeal(INVALID_HANDLE_VALUE)
    , m_pRecvBuffer(NULL)
    , m_ucKeyboardAddr(MY_SERIAL_NDX)
{
    m_pRecvBuffer = new CGenericBuffer();
    ASSERT(m_pRecvBuffer);

    m_hEventExit = CreateEvent(NULL, TRUE, FALSE, NULL);
    m_hThreadDeal = CreateThread(NULL, 0, ThreadDeal, this, 0, NULL);
    if (InitPort(NULL, 1, 9600)) {
        StartMonitoring();
    } else {
        AfxMessageBox(L"NO COM");
        ::PostQuitMessage(0);
    }
}
コード例 #5
0
ファイル: Meter.cpp プロジェクト: ruthmagnus/audacity
void Meter::OnMouse(wxMouseEvent &evt)
{
  #if wxUSE_TOOLTIPS // Not available in wxX11
   if (evt.Leaving()){
      GetActiveProject()->TP_DisplayStatusMessage(wxT(""));
   }
   else if (evt.Entering()) {
      // Display the tooltip in the status bar
      wxToolTip * pTip = this->GetToolTip();
      if( pTip ) {
         wxString tipText = pTip->GetTip();
         GetActiveProject()->TP_DisplayStatusMessage(tipText);
      }
   }
  #endif

   #if WANT_METER_MENU
      if (evt.RightDown() ||
          (evt.ButtonDown() && mMenuRect.Inside(evt.m_x, evt.m_y))) 
      {
         wxMenu *menu = new wxMenu();
         // Note: these should be kept in the same order as the enum
         if (mMeterDisabled)
            menu->Append(OnDisableMeterID, _("Enable Meter"));
         else
            menu->Append(OnDisableMeterID, _("Disable Meter"));
         if (mIsInput) {
            if (gAudioIO->IsMonitoring())
               menu->Append(OnMonitorID, _("Stop Monitoring"));
            else
               menu->Append(OnMonitorID, _("Start Monitoring"));
         }
         menu->AppendSeparator();

         menu->Append(OnHorizontalID, _("Horizontal Stereo"));
         menu->Append(OnVerticalID, _("Vertical Stereo"));
         //menu->Append(OnMultiID, _("Vertical Multichannel"));
         //menu->Append(OnEqualizerID, _("Equalizer"));
         //menu->Append(OnWaveformID, _("Waveform"));
         //menu->Enable(OnHorizontalID + mStyle, false);
         menu->Enable(mStyle==VerticalStereo? OnVerticalID: OnHorizontalID, false);
         menu->AppendSeparator();

         menu->Append(OnLinearID, _("Linear"));
         menu->Append(OnDBID, _("dB"));
         menu->Enable(mDB? OnDBID: OnLinearID, false);
         //menu->AppendSeparator();
         //menu->Append(OnClipID, _("Turn on clipping"));
         //menu->AppendSeparator();
         //menu->Append(OnFloatID, _("Float Window"));

         menu->AppendSeparator();
         menu->Append(OnPreferencesID, _("Preferences..."));


         if (evt.RightDown())
            PopupMenu(menu, evt.m_x, evt.m_y);
         #if WANT_METER_MENU
            else
               PopupMenu(menu, mMenuRect.x + 1, mMenuRect.y + mMenuRect.height + 1);
         #endif // WANT_METER_MENU
         delete menu;
      }       
      else 
   #endif // WANT_METER_MENU

   if (evt.ButtonDown()) {
      if (mIsInput)
         StartMonitoring();
   }
}
コード例 #6
0
ファイル: Meter.cpp プロジェクト: ruthmagnus/audacity
void Meter::OnMonitor(wxCommandEvent &evt)
{
   StartMonitoring();
}
コード例 #7
0
ファイル: ProcMon.c プロジェクト: 340211173/hf-2011
//-----------------------------------------------------------------------------
// Name: DispatchIoctl
// Object: Dispatch routine of IRP_MJ_DEVICE_CONTROL
// Parameters :
//     in  : 
//     out :
//     return : 
//-----------------------------------------------------------------------------
NTSTATUS DispatchIoctl(IN PDEVICE_OBJECT pDeviceObject,IN PIRP           pIrp)
{
    NTSTATUS               ntStatus = STATUS_UNSUCCESSFUL;
    PIO_STACK_LOCATION     pIrpStack  = IoGetCurrentIrpStackLocation(pIrp);
    PROCESS_CALLBACK_INFO  ProcCallbackInfo={0};
    ULONG                  BytesTransferred=0;

    UNREFERENCED_PARAMETER(pDeviceObject);
    /*

    // Reminder :D
    // Get the pointer to the input/output buffer and it's length
    // IRP_MJ_DEVICE_CONTROL specific
    BYTE  Buffer             = pIrp->AssociatedIrp.SystemBuffer;
    ULONG InputBufferLength  = pIrpStack->Parameters.DeviceIoControl.InputBufferLength;
    ULONG OutputBufferLength = pIrpStack->Parameters.DeviceIoControl.OutputBufferLength;

    */

    // switch IoControlCode pass through the DeviceIOControle user mode API
    switch(pIrpStack->Parameters.DeviceIoControl.IoControlCode)
    {
        case IOCTL_START_MONITORING:
            KernelDebugPrint((" ProcMon : START MONITORING"));

            ntStatus = StartMonitoring();
            break;

        case IOCTL_STOP_MONITORING:
            KernelDebugPrint((" ProcMon : STOP MONITORING"));

            ntStatus = StopMonitoring();
            break;

        case IOCTL_GET_PROCINFO:
            KernelDebugPrint((" ProcMon : GET PROCINFO"));
            // if monitoring is not started, don't try to access fifo
            if (!g_bMonotoringStarted)
            {
                KernelDebugPrint((" ProcMon : MONITORING NOT STARTED"));
                // return an invalid device state status
                ntStatus=STATUS_INVALID_DEVICE_STATE;
                pIrp->IoStatus.Status = ntStatus;
                pIrp->IoStatus.Information = 0;
                IoCompleteRequest(pIrp, IO_NO_INCREMENT);
                return ntStatus;

            }
            // else

            // if an IOCTL_GET_PROCINFO request is already pending
            KeWaitForSingleObject(&hevt_g_PendingIrpUnlocked,Executive,KernelMode,FALSE,NULL);
            if (g_PendingIrp)
            {
                KernelDebugPrint((" ProcMon : GET PROCINFO DEVICE BUSY"));
                // return a busy status
                ntStatus=STATUS_DEVICE_BUSY;
                pIrp->IoStatus.Status = ntStatus;
                pIrp->IoStatus.Information = 0;
                IoCompleteRequest(pIrp, IO_NO_INCREMENT);
                KeSetEvent(&hevt_g_PendingIrpUnlocked,IO_NO_INCREMENT,FALSE);
                return ntStatus;
            }
            // else

            // if there's not enough memory for output buffer
            if (pIrpStack->Parameters.DeviceIoControl.OutputBufferLength <sizeof(PROCESS_CALLBACK_INFO))
            {
                KernelDebugPrint((" ProcMon : GET PROCINFO BUFFER TOO SMALL"));

                ntStatus=STATUS_BUFFER_TOO_SMALL;
                pIrp->IoStatus.Status = ntStatus;
                pIrp->IoStatus.Information = 0;
                IoCompleteRequest(pIrp, IO_NO_INCREMENT);
                KeSetEvent(&hevt_g_PendingIrpUnlocked,IO_NO_INCREMENT,FALSE);
                return ntStatus;
            }
            // else

            if (!g_pFIFOProcess)
            {
                KernelDebugPrint((" ProcMon : PROCESS FIFO NULL"));

                ntStatus=STATUS_UNSUCCESSFUL;
                pIrp->IoStatus.Status = ntStatus;
                pIrp->IoStatus.Information = 0;
                IoCompleteRequest(pIrp, IO_NO_INCREMENT);
                KeSetEvent(&hevt_g_PendingIrpUnlocked,IO_NO_INCREMENT,FALSE);
                return ntStatus;
            }
            // else

            // pop fifo and check if it's empty
            if (KernelFIFOPop(g_pFIFOProcess,&ProcCallbackInfo))
            {
                // fill the output buffer
                RtlCopyMemory(pIrp->AssociatedIrp.SystemBuffer,&ProcCallbackInfo,sizeof(PROCESS_CALLBACK_INFO));

                BytesTransferred=sizeof(PROCESS_CALLBACK_INFO);
                ntStatus = STATUS_SUCCESS;

                KeSetEvent(&hevt_g_PendingIrpUnlocked,IO_NO_INCREMENT,FALSE);
            }
            else
            {
                KernelDebugPrint((" ProcMon : IRP PENDING"));

                // save pIrp for a future use
                g_PendingIrp=pIrp;

                // set cancel routine
                IoSetCancelRoutine(pIrp,CancelRoutine);

                // Mark the Irp as pending
                pIrp->PendingReturned=TRUE;
                pIrp->IoStatus.Status = STATUS_PENDING;
                pIrp->IoStatus.Information = 0;
                IoMarkIrpPending(pIrp);

                KeSetEvent(&hevt_g_PendingIrpUnlocked,IO_NO_INCREMENT,FALSE);

                // we have to return status pending
                return STATUS_PENDING;
            }
            break;

        case IOCTL_CANCEL_IO:
            KernelDebugPrint((" ProcMon : IOCTL_CANCEL_IO"));

            KeWaitForSingleObject(&hevt_g_PendingIrpUnlocked,Executive,KernelMode,FALSE,NULL);

            // As CancelPendingIrp() call IoCancelIrp, It can't be called from another thread
            // So we directly call the cancel routine giving the g_PendingIrp as parameter
            CancelRoutine(NULL,g_PendingIrp);

            KeSetEvent(&hevt_g_PendingIrpUnlocked,IO_NO_INCREMENT,FALSE);

            // return success for IOCTL_CANCEL_IO request
            ntStatus = STATUS_SUCCESS;
            break;

        default:
            KernelDebugPrint((" ProcMon : CONTROL CODE NOT IMPLEMENTED"));

            ntStatus=STATUS_NOT_IMPLEMENTED;
            break;
    }

    pIrp->IoStatus.Status = ntStatus;

    if(ntStatus == STATUS_SUCCESS)
        // Set number of bytes to copy back to user-mode
        pIrp->IoStatus.Information = BytesTransferred;
    else
        pIrp->IoStatus.Information = 0;

    // complete request
    IoCompleteRequest(pIrp, IO_NO_INCREMENT);
    return ntStatus;
}