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; } }
void BlueToothSerial::setupPrintln(String label, int index, String value) { setupPrint(label); setupPrint("["); setupPrint(String(index, (byte)DEC)); setupPrint("]: "); setupPrint(value); setupPrintln(); }
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(); }
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(); }
String BlueToothSerial::endSetup() { setupPrint("\r\n\r\n== BlueTooth Setup End ==\r\n"); digitalWrite(atPin, LOW); return setupResult; }
void BlueToothSerial::setupPrintln(String label, String value) { setupPrint(label); setupPrint(": "); setupPrint(value); setupPrintln(); }
void BlueToothSerial::setupPrintln(String output) { setupPrint(output); setupPrintln(); }