示例#1
0
boolean BlueToothSerial::sendCommand(String command, sbyte retryTimes) {
  byte times;
  if(retryTimes == -1)
    retryTimes = retry;

    setupPrintln("Command", command);
  
  for(times = 0; times < retryTimes; times ++) {    
    stream->println(command); 
    stream->flush();
   
    String result = stream->readStringUntil('\n');
    if(result=="")
      result = "<TimeOut>";
      
    setupPrintln("Result", times, result);
    result.trim();
    if( result == "OK") {
      break;
    }
  }
  
  if(times == retryTimes) {
    setupPrint("Result: Failed\r\n\r\n");
    return false;
  }
  else {
    setupPrint("Result: Succeeded\r\n\r\n");
    return true;
  }
}
示例#2
0
void BlueToothSerial::setupPrintln(String label, int index, String value) {
  setupPrint(label);
  setupPrint("[");
  setupPrint(String(index, (byte)DEC));
  setupPrint("]: ");
  setupPrint(value);
  setupPrintln();
}
示例#3
0
void XAP_UnixDialog_Print::PrintDirectly(XAP_Frame * pFrame, const char * szFilename, const char * szPrinter)
{
	m_pFrame = pFrame;
	setupPrint();
	if(szFilename)
    {
		 gtk_print_operation_set_export_filename(m_pPO, szFilename);
		 gtk_print_operation_run (m_pPO,GTK_PRINT_OPERATION_ACTION_EXPORT,
								  NULL,NULL);
	}
	else
	{
		GtkPrintSettings *  pSettings = gtk_print_operation_get_print_settings(m_pPO);
		if(szPrinter)
		{
			gtk_print_settings_set_printer(pSettings, szPrinter);
		}
		else
		{
			gtk_print_settings_set_printer(pSettings, GTK_PRINT_SETTINGS_PRINTER);
		}
		gtk_print_operation_set_print_settings(m_pPO,pSettings);
		gtk_print_operation_run (m_pPO,GTK_PRINT_OPERATION_ACTION_PRINT,
								 NULL,NULL);
	}
	cleanup();
}
示例#4
0
void XAP_UnixDialog_Print::runModal(XAP_Frame * pFrame) 
{
	m_pFrame = pFrame;
	setupPrint();
    gtk_print_operation_set_show_progress(m_pPO, TRUE);

	XAP_UnixFrameImpl * pUnixFrameImpl = static_cast<XAP_UnixFrameImpl *>(m_pFrame->getFrameImpl());
	
	// Get the GtkWindow of the parent frame
	GtkWidget * parent = pUnixFrameImpl->getTopLevelWindow();
	GtkWindow * pPWindow = GTK_WINDOW(parent);
	//	const XAP_StringSet * pSS = XAP_App::getApp()->getStringSet();
	//	const gchar * szDialogName = einterpret_cast<const gchar *>(pSS->getValue(XAP_STRING_ID_DLG_UP_PrintTitle);

	gtk_print_operation_run (m_pPO,
							 (m_bIsPreview)? GTK_PRINT_OPERATION_ACTION_PREVIEW:
							 GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
							 pPWindow, NULL);

	cleanup();
}
示例#5
0
String BlueToothSerial::endSetup() {
  setupPrint("\r\n\r\n== BlueTooth Setup End ==\r\n");
  digitalWrite(atPin, LOW);
  return setupResult;
}
示例#6
0
void BlueToothSerial::setupPrintln(String label, String value) {
  setupPrint(label);
  setupPrint(": ");
  setupPrint(value);
  setupPrintln();
}
示例#7
0
void BlueToothSerial::setupPrintln(String output) { 
  setupPrint(output);
  setupPrintln(); 
}