Пример #1
0
void CMoviePlayerDlg::SetTransport(int State)
{
	m_Play.SetCheck(State == PLAY);
	m_Play.SetIcon(AfxGetApp()->LoadIcon(State == PLAY ? IDI_PLAYD : IDI_PLAYU));
	m_Pause.SetCheck(State == PAUSE);
	m_Pause.SetIcon(AfxGetApp()->LoadIcon(State == PAUSE ? IDI_PAUSED : IDI_PAUSEU));
	m_Stop.SetCheck(State == STOP);
	m_Stop.SetIcon(AfxGetApp()->LoadIcon(State == STOP ? IDI_STOPD : IDI_STOPU));
	switch (State) {
	case PLAY:
		if (IsOpen())
			EnableTimer(round(1000.0 / m_Movie.GetFrameRate()));
		break;
	case STOP:
		EnableTimer(0);
		m_Movie.Rewind();
		m_Movie.Read();	// display initial frame
		m_Movie.Rewind();
		UpdatePos();
		Hide(FALSE);
		break;
	case PAUSE:
		EnableTimer(0);
		break;
	}
	m_Transport = State;
}
nsresult
DiscardTracker::Reset(Node *node)
{
  // We shouldn't call Reset() with a null |img| pointer, on images which can't
  // be discarded, or on animated images (which should be marked as
  // non-discardable, anyway).
  MOZ_ASSERT(NS_IsMainThread());
  MOZ_ASSERT(sInitialized);
  MOZ_ASSERT(node->img);
  MOZ_ASSERT(node->img->CanDiscard());
  MOZ_ASSERT(!node->img->mAnim);

  // Insert the node at the front of the list and note when it was inserted.
  bool wasInList = node->isInList();
  if (wasInList) {
    node->remove();
  }
  node->timestamp = TimeStamp::Now();
  sDiscardableImages.insertFront(node);

  // If the node wasn't already in the list of discardable images, then we may
  // need to discard some images to stay under the sMaxDecodedImageKB limit.
  // Call MaybeDiscardSoon to do this check.
  if (!wasInList) {
    MaybeDiscardSoon();
  }

  // Make sure the timer is running.
  nsresult rv = EnableTimer();
  NS_ENSURE_SUCCESS(rv,rv);

  return NS_OK;
}
Пример #3
0
void svrNoiseFloorSetAvailable(bool _debug_output,int *timerSwitch, int *timerNoise) {
    SVR_DEBUG(_debug_output,VT100_RESET VT100_STYLE_ALERT "\n(%d,%03d)to channel %d\n",
              nTimer_ticks,static_chp.m_nCommBusy,static_chp.m_nCurrentChannel);
    iw_setchannel(static_chp.m_nCurrentChannel,static_chp.m_pKpi,static_chp.m_nIdentifier);
    svrQueryNoise(NULL,static_chp.m_pKpi,static_chp.m_nIdentifier);                 //reset noise floor
    DisableTimer(*timerSwitch);
    EnableTimer(*timerNoise,PERIOD_READ_NF * MSEC_TICKS); //read noise floor in the comming 1000 msecs
}
Пример #4
0
//
/// Computes the size of the sheet, activates the designated 'startPage'
/// and sets focus to the tab control...
//
void
TPropertySheet::SetupWindow()
{
  TWindow::SetupWindow();

  // if 'WantTimer' is enabled, start a timer
  //
  if (WantTimer)
    EnableTimer();
}
Пример #5
0
void svrGwsRequest(bool _debug_output,SerialCom* comm,int* nTimer) {
    if (COM_TEST) {
        COM_LOCK(SECOND_TICKS);    //occupy serial port
        SVR_DEBUG(_debug_output,VT100_RESET VT100_INVERT "(%d,%03d)Radio query...\n",
                  nTimer_ticks,static_chp.m_nCommBusy);
        static char* cmd = "rfinfo 2\n";
        ScSend(comm, cmd, strlen(cmd));
        EnableTimer(*nTimer,SECOND_TICKS);
    }
}
Пример #6
0
short svrSetChannel(SerialCom* comm,int region,short channel,int *nTimer) {
    char command[64];

    if (MIN_CHANNEL(region) <= channel && channel <= MAX_CHANNEL(region)) {
        EnableTimer(*nTimer,PERIOD_SWITCH * MSEC_TICKS);    //500 ms to ensure the pll done
        memset (command, 0x00, 64);
        sprintf(command, "setchan %d\n", channel);
        ScSend(comm, command, strlen(command));
        return channel;
    } else return MIN_CHANNEL(region);
}
Пример #7
0
void CIdlePreventDlg::OnTrayOptions()
{
    OptionsDlg o((CWnd*) this);
    ToggleTrayMenu(FALSE);
    o.DoModal();
    LoadSettings();
    if(isTimerEnabled)
    {
        EnableTimer(TRUE); // Refreshing the timeout value.
    }   
    ToggleTrayMenu(TRUE);
}
Пример #8
0
BOOL CIdlePreventDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	// when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
    mnuTray.LoadMenu(IDR_MENU1);
	ShellIcon_Initialize(0, 0);
	EnableTimer(TRUE);
	return TRUE;  // return TRUE  unless you set the focus to a control
}
/**
 * Read the discard timeout from about:config.
 */
void
DiscardTracker::ReloadTimeout()
{
  // Read the timeout pref.
  int32_t discardTimeout;
  nsresult rv = Preferences::GetInt(sDiscardTimeoutPref, &discardTimeout);

  // If we got something bogus, return.
  if (!NS_SUCCEEDED(rv) || discardTimeout <= 0)
    return;

  // If the value didn't change, return.
  if ((uint32_t) discardTimeout == sMinDiscardTimeoutMs)
    return;

  // Update the value.
  sMinDiscardTimeoutMs = (uint32_t) discardTimeout;

  // Restart the timer so the new timeout takes effect.
  DisableTimer();
  EnableTimer();
}
Пример #10
0
void CIdlePreventDlg::ToggleTimer()
{
    EnableTimer(!isTimerEnabled);  
}
Пример #11
0
void svrTimer(int sig) {
    if (0 == pthread_mutex_trylock(&mutex_lock_timer)) {
        SerialCom*  comm = static_chp.m_comm;
        int         nQid = static_chp.m_nQid;
        bool        dbg = static_debug_gws;

        if (!svrIncreaseTicks(sig)) {
            pthread_mutex_unlock(&mutex_lock_timer);
            return;
        }
        if (CheckPeriod(nTimer_ticks,2 * SECOND_TICKS)) {
            svrIamAlive(-1);
        }
        const int nNoiseScanPeriod = PERIOD_TOTAL * MSEC_TICKS;
        switch (svrIsScanning()) {
        case SCANNING_FIXED_INIT:           //fixed channel scanning...
            svrQueryNoise(NULL,static_chp.m_pKpi,static_chp.m_nIdentifier);                 //reset noise floor
            PRE_SCAN_COMMAND(comm,"setrxatten 0 0");
            PRE_SCAN_COMMAND(comm,"setrxatten 1 36");
            EnableTimer(timer_chan_switch,2000 * MSEC_TICKS);    //500 ms to ensure the pll done
            static_chp.m_uChanScan = SCANNING_FIXED_READ;
            break;
        case SCANNING_FIXED_READ:           //channel scanning...
            if (IsTimerTimeout(timer_chan_switch))
                svrNoiseFloorRead(dbg,static_chp.m_ifName, static_chp.m_pKpi, static_chp.m_nIdentifier);
            break;
        case SCANNING_FIXED_DONE:
            do {    //channel scan done
                int region = 0;
                int ch = -1;
                RW_KPI_VAR(static_chp.m_nIdentifier,region,static_chp.m_pKpi->m_radio.m_nRegion);
                ch = static_chp.m_nCurrentChannel - MIN_CHANNEL(region);
                RW_KPI_VAR(static_chp.m_nIdentifier,static_chp.m_pKpi->m_noise_floor[ch].m_noise_cur,
                           static_chp.m_pKpi->m_noise_floor[ch].m_noise_avg);
                CHANNEL_SCAN_ON_OFF(static_chp.m_uChanScan,SCANNING_DONE);
                APP_SCAN_COMMAND(comm,static_chp.m_nOriginChannel);
            } while (0);
            break;
        case SCANNING_ALL_INIT:             //channel scanning...
            if (TimeDiff(nTimer_ticks, &nRecentChanSW, nNoiseScanPeriod)) { //handler for noise scan
                svrNoiseFloorSwitchChan(dbg,comm,&timer_chan_switch);
            } else if (IsTimerTimeout(timer_chan_switch)) {    //switch done, notify that noise available
                svrNoiseFloorSetAvailable(dbg,&timer_chan_switch,&timer_noise_floor);
                static_chp.m_uChanScan = SCANNING_ALL_READ;
            }
            break;
        case SCANNING_ALL_READ:             //channel scanning...
            if (IsTimerDisabled(timer_chan_switch) && IsTimerRunning(timer_noise_floor)) {
                svrNoiseFloorRead(dbg,static_chp.m_ifName, static_chp.m_pKpi, static_chp.m_nIdentifier);
            } else if (IsTimerTimeout(timer_noise_floor)) {
                svrNoiseFloorDone(dbg,comm,&timer_noise_floor,&static_chp.m_uChanScan);
            }
            break;
        default:                            //routine...
            if (CheckPeriod(nTimer_ticks,3 * SECOND_TICKS)) {   //radio polling.....
                svrGwsRequest(dbg,comm,&timer_radio_query);
            } else if (IsTimerRunning(timer_radio_query)) {    //within radio query timeout
                svrGwsPolling(dbg,comm,&timer_radio_query);
            } else if (IsTimerTimeout(timer_radio_query)) {   //radio query done or timeout
                svrGwsParse(dbg,&timer_radio_query);
            }
            if (IsTimerDisabled(timer_noise_floor)) { // ensure noise is not reading currently
                svrQueryWifi(dbg,static_chp.m_ifName, static_chp.m_pKpi, static_chp.m_nIdentifier,nTimer_ticks);
            }
        }
        if (TASK_COMMAND == latest_msg.m_nType) {
            if (0 == svrCmdHandler(comm,&latest_msg,&static_chp)) {
                SVR_DEBUG(dbg,VT100_RESET VT100_STYLE_HOT "\nDone : idel = %d\n",nSvrTimerBusy);
                pthread_mutex_unlock(&mutex_lock_timer);
                svrExitCommandHandler();
                return;
            }
        }
        if (COM_TEST) { //latest message has already done
            if (msgrcv(nQid, &latest_msg, MSG_SZ, latest_msg.m_nType, IPC_NOWAIT) > 0) {
                //no task currently, try to detect new task
            } else {    //no new message, we can handle the channel scan things
            }
        }   //else, consider there is still a task not handled yet
        pthread_mutex_unlock(&mutex_lock_timer);
    }
    return;
}
Пример #12
0
	CATCH (CException, e) {
		EnableTimer(0);
		e->ReportError();
	}