Ejemplo n.º 1
0
STATIC void Do_DosIdle_loop(struct dhdr FAR **pdev)
{
  /* the idle loop is only safe if we're using the character stack */
  if (user_r->AH < 0xd)
    while (Busy(pdev) && Busy(&syscon))
      DosIdle_int();
}
Ejemplo n.º 2
0
int CScionCamera::StartSequenceAcquisition(long numImages, 
				double interval_ms, bool stopOnOverflow)
{
#ifdef	LOG_ENABLED
sLogMessage("start seqquence acquisition\r\n");
#endif

if (Busy() || sequenceRunning_)
	{return DEVICE_CAMERA_BUSY_ACQUIRING;}

// prepare core
int ret = GetCoreCallback()->PrepareForAcq(this);
if (ret != DEVICE_OK)
	{return ret;}

// make sure the circular buffer is properly sized
GetCoreCallback()->InitializeImageBuffer(1, 1, GetImageWidth(), 
							GetImageHeight(), GetImageBytesPerPixel());

stopOnOverflow_ = stopOnOverflow;
interval_ms = interval_ms;
sequenceLength_ = numImages;
image_counter_ = 0;

ctp->SetLength(numImages);
ctp->Start();

sequenceRunning_ = true;

return DEVICE_OK;
}
Ejemplo n.º 3
0
STATIC unsigned char read_char_sft_dev(int sft_in, int sft_out,
                                       struct dhdr FAR **pdev,
                                       BOOL check_break)
{
  unsigned char c;

  if (pdev)
  {
    FOREVER
    {
      if (ctrl_break_pressed())
      {
        c = CTL_C;
        break;
      }
      if (!Busy(pdev))
      {
        c = CharIO(pdev, 0, C_INPUT);
        break;
      }
      if (check_break && *pdev != syscon)
        check_handle_break(&syscon);
      /* the idle int is only safe if we're using the character stack */
      if (user_r->AH < 0xd)
        DosIdle_int();
    }
  }
  else
Ejemplo n.º 4
0
void LCD_AddrSet(int addr)
{
	Busy();
	output_d(addr+DDRAM);
	output_high(LCD_CE);
	output_low(LCD_CE);
}
/*
 * 
 * 
 * @internalComponent
 */
void CSaaEmergencyCallRfAdaptation::DeactivateRfForEmergencyCall(TRequestStatus& aStatus)
	{
	// If this adaptation is busy then complete with KErrInUse
	if(Busy())
		{
		TRequestStatus* statusPtr = &aStatus;
		User::RequestComplete(statusPtr, KErrInUse);
		return;
		}
	// Set this request status
	SetRequestStatus(&aStatus);
	aStatus = KRequestPending;
	// No outstand requests so set up command id
	SetCommandId(StartupAdaptation::EDeactivateRfAfterEmergencyCall);
	// No parameters to set to pass in
	
	// Pass this to the adapter
	TRAPD(err, iAdapter->QueueDispatchL(this));
	if(err != KErrNone)
		{
		// Failed to queue adaptation, complete with error
		SetRequestStatus(NULL);
		TRequestStatus* statusPtr = &aStatus;
		User::RequestComplete(statusPtr, err);
		}
	}
Ejemplo n.º 6
0
static void local_await(long *p, long value)
/*
  Wait for (*p == value)
*/
{
  long pval;
  long nspin = 0;
#ifdef NOSPIN
  long spinlim = 100;
  long waittim = 10000;
#else
  long spinlim = 100000000;
  long waittim = 100000;
#endif  
  extern void flush_send_q(void);

  while ((pval = local_flag(p)) != value) {

    if (pval && (pval != value)) {
      fprintf(stdout,"%2ld: invalid value=%ld, local_flag=%lx %ld\n", 
              TCGMSG_nodeid, value, (unsigned long)p, pval);
      fflush(stdout);
      exit(1);
    }
    nspin++;
    if((nspin&7)==0)flush_send_q();
    if (nspin < spinlim)
      Busy(100);
    else 
      USleep(waittim);
  }
}
/*****************************************************************************
Name:        	WaitForNotBusy
Parameters:  	controller must be 1 or 2
Returns:        none
Description:    This function waits for a controller to clear its busy bit
*****************************************************************************/
void WaitForNotBusy(char controller)
{
	while (Busy(controller)) 
	{
		  DisplayDelay(10); 
	};
}
Ejemplo n.º 8
0
void
AppView::SelectAllUnsupported()
{
	PRINT(("AppView::SelectAllUnsupported()\n"));

	if (!Busy())
		m_list_view->SelectAllUnsupported();
}
Ejemplo n.º 9
0
void *RunSleep(void *num)
{
  int thrnum = (int)num;
  for(int i = 0 ; i < 3 ; i++) {
    printf("Thread %d is running.\n", thrnum);
    Busy();
  }
}
Ejemplo n.º 10
0
void FixedOpmlPage::Show() {
  if (!done_initial_load_) {
    emit Busy(true);
    done_initial_load_ = true;

    PodcastUrlLoaderReply* reply = loader_->Load(opml_url_);
    NewClosure(reply, SIGNAL(Finished(bool)), this,
               SLOT(LoadFinished(PodcastUrlLoaderReply*)), reply);
  }
Ejemplo n.º 11
0
int StdinBusy(void)
{
  sft FAR *s = get_sft(STDIN);
  struct dhdr FAR *dev = sft_to_dev(s);

  if (dev)
    return Busy(&dev);

  return s->sft_posit >= s->sft_size;
}
Ejemplo n.º 12
0
void ITunesSearchPage::SearchClicked() {
  emit Busy(true);

  QUrl url(QUrl::fromEncoded(kUrlBase));
  url.addQueryItem("term", ui_->query->text());

  QNetworkReply* reply = network_->get(QNetworkRequest(url));
  NewClosure(reply, SIGNAL(finished()), this,
             SLOT(SearchFinished(QNetworkReply*)), reply);
}
Ejemplo n.º 13
0
void
AppView::SelectAll()
{
	PRINT(("AppView::SelectAll()\n"));

	if (! Busy())
	{
		int numItems = m_list_view->CountItems();
		m_list_view->Select(0,(int32)numItems-1);
	}
}
Ejemplo n.º 14
0
void GPodderTopTagsPage::Show() {
  if (!done_initial_load_) {
    // Start the request for list of top-level tags
    emit Busy(true);
    done_initial_load_ = true;

    mygpo::TagList* tag_list = api_->topTags(kMaxTagCount);
    NewClosure(tag_list, SIGNAL(finished()),
               this, SLOT(TagListLoaded(mygpo::TagList*)),
               tag_list);
  }
Ejemplo n.º 15
0
void GPodderSearchPage::SearchClicked() {
  emit Busy(true);

  mygpo::PodcastListPtr list(api_->search(ui_->query->text()));
  NewClosure(list, SIGNAL(finished()), this,
             SLOT(SearchFinished(mygpo::PodcastListPtr)), list);
  NewClosure(list, SIGNAL(parseError()), this,
             SLOT(SearchFailed(mygpo::PodcastListPtr)), list);
  NewClosure(list, SIGNAL(requestError(QNetworkReply::NetworkError)), this,
             SLOT(SearchFailed(mygpo::PodcastListPtr)), list);
}
Ejemplo n.º 16
0
void GPodderSearchPage::SearchFinished(mygpo::PodcastListPtr list) {
  emit Busy(false);

  model()->clear();

  for (mygpo::PodcastPtr gpo_podcast : list->list()) {
    Podcast podcast;
    podcast.InitFromGpo(gpo_podcast.data());

    model()->appendRow(model()->CreatePodcastItem(podcast));
  }
}
Ejemplo n.º 17
0
////////////////////////////////////////////////////////////////////
// BOOL WINAPI CProgress::DlgProc
//
////////////////////////////////////////////////////////////////////
BOOL WINAPI CProgress::DlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
    switch(msg)
    {
    case WM_INITDIALOG:
    {
        //Save the this pointer, since this is a static method
        Busy();
        CProgress* pThis = (CProgress*)lParam;
        SetWindowLongPtrA(hWnd, GWLP_USERDATA, (LONG_PTR)pThis);

        //On INIT we know we have a valid hWnd to store
        pThis->m_hWnd = hWnd;

        CenterDialog(hWnd);
        return TRUE;
    }
    break;

    case WM_COMMAND:
    {
        // All buttons are handled the same way
        //Restore instance pointer, since this is a static function
        CProgress* pThis = (CProgress*)GetWindowLongPtrA(hWnd, GWLP_USERDATA);

        switch(GET_WM_COMMAND_ID(wParam, lParam))
        {
        case IDCANCEL:
            Busy();
            pThis->m_fCancel = TRUE;
            return TRUE;
        }
        return FALSE;
    }
    break;

    default:
        return FALSE;
    }
}
Ejemplo n.º 18
0
void wdata(uchar del)
{
	while(Busy());
	RS = 1;
	RW = 0;
	E = 0;
	delay();
	P0 = del;
    delay();
	E = 1;
	delay();
	E = 0;
}
Ejemplo n.º 19
0
/**
 * Wait for the operation referred to by msgid to complete.
 */
void msg_wait(long msgid)
{
    long nspin = 0;
    long spinlim = 1000000;

    while (!msg_status(msgid)) {
        nspin++;
        if (nspin < spinlim)
            Busy(100);
        else 
            usleep(1);
    }
}
Ejemplo n.º 20
0
/********************************************************************
* 名称 : wcmd(uchar del)
* 功能 : 1602命令函数
* 输入 : 输入的命令值
* 输出 : 无
***********************************************************************/
void wcmd(uchar del)
{
	while(Busy());
	RS = 0;
	RW = 0;
	E = 0;
	delay();
	P0 = del;
	delay();
	E = 1;
	delay();
	E = 0;
}
Ejemplo n.º 21
0
void
AppView::SetPreviousMode()
{
	if (! Busy())
	{
		int32 mode = m_pick_list_view->SelectedIndex();

		if (mode > 0)
		{
			mode--;
			m_pick_list_view->SelectView(mode);
		}
	}
}
Ejemplo n.º 22
0
void
AppView::Reset()
{
	PRINT(("AppView::Reset()\n"));

	if (! Busy())
	{
		AddOnView* view = (AddOnView*)m_pick_list_view->SelectedView();
		if(view)
		{
			view->Reset();
		}
	}
}
Ejemplo n.º 23
0
void
AppView::SetNextMode()
{
	if (! Busy())
	{
		int32 mode = m_pick_list_view->SelectedIndex();

		if ((mode+1) < m_pick_list_view->CountViews())
		{
			mode++;
			m_pick_list_view->SelectView(mode);
		}
	}
}
Ejemplo n.º 24
0
void Control::Up() {
    if (state_->Active()) {
	Control* target = state_->Selection();
	state_->Action(target);
	for (ControlState* c = state_; c != nil; c = c->Prev()) {
	    c->Deactivate();
	}
	if (target != nil) {
	    Busy();
	    target->Do();
	    Done();
	}
    }
}
Ejemplo n.º 25
0
void
AppView::SelectLastFile()
{
	PRINT(("AppView::SelectLastFile()\n"));

	if (! Busy())
	{
		if (m_list_view->CountItems() > 0)
		{
			m_list_view->DeselectAll();
			m_list_view->Select(m_list_view->CountItems() - 1);
			m_list_view->ScrollToSelection();
		}
	}
}
Ejemplo n.º 26
0
void ITunesSearchPage::SearchFinished(QNetworkReply* reply) {
  reply->deleteLater();
  emit Busy(false);

  model()->clear();

  // Was there a network error?
  if (reply->error() != QNetworkReply::NoError) {
    QMessageBox::warning(this, tr("Failed to fetch podcasts"),
                         reply->errorString());
    return;
  }

  QJson::Parser parser;
  QVariant data = parser.parse(reply);

  // Was it valid JSON?
  if (data.isNull()) {
    QMessageBox::warning(
        this, tr("Failed to fetch podcasts"),
        tr("There was a problem parsing the response from the iTunes Store"));
    return;
  }

  // Was there an error message in the JSON?
  if (data.toMap().contains("errorMessage")) {
    QMessageBox::warning(this, tr("Failed to fetch podcasts"),
                         data.toMap()["errorMessage"].toString());
    return;
  }

  for (const QVariant& result_variant : data.toMap()["results"].toList()) {
    QVariantMap result(result_variant.toMap());
    if (result["kind"].toString() != "podcast") {
      continue;
    }

    Podcast podcast;
    podcast.set_author(result["artistName"].toString());
    podcast.set_title(result["trackName"].toString());
    podcast.set_url(result["feedUrl"].toUrl());
    podcast.set_link(result["trackViewUrl"].toUrl());
    podcast.set_image_url_small(QUrl(result["artworkUrl30"].toString()));
    podcast.set_image_url_large(QUrl(result["artworkUrl100"].toString()));

    model()->appendRow(model()->CreatePodcastItem(podcast));
  }
}
Ejemplo n.º 27
0
void
AppView::Apply()
{
	PRINT(("AppView::Apply()\n"));

	if (! Busy())
	{
		DisableInterface();

		AddOnView* view = (AddOnView*)m_pick_list_view->SelectedView();
		if(view)
		{
			view->Apply();
		}
	}
}
Ejemplo n.º 28
0
void GPodderSearchPage::SearchFailed(mygpo::PodcastListPtr list) {
  emit Busy(false);

  model()->clear();

  if (QMessageBox::warning(
          nullptr, tr("Failed to fetch podcasts"),
          tr("There was a problem communicating with gpodder.net"),
          QMessageBox::Retry | QMessageBox::Close,
          QMessageBox::Retry) != QMessageBox::Retry) {
    return;
  }

  // Try doing the search again.
  SearchClicked();
}
Ejemplo n.º 29
0
void
AppView::ClearList()
{
	PRINT(("AppView::ClearList()\n"));

	if (! Busy())
	{
		m_list_view->DeselectAll();
		int numItems = m_list_view->CountItems();
		for(int i=0;i<numItems;i++)
		{
			BListItem* item = m_list_view->RemoveItem((int32)0);
			delete item;
		}
		m_list_view->Invalidate();
	}
}
Ejemplo n.º 30
0
void
AppView::SelectPreviousFile()
{
	PRINT(("AppView::SelectPreviousFile()\n"));

	if (! Busy())
	{
		int32 index = m_list_view->CurrentSelection(0);

		if (index < 0)
			m_list_view->Select(m_list_view->CountItems()-1);

		if (index > 0)
			m_list_view->Select(--index);

			m_list_view->ScrollToSelection();
	}
}