static int dst_ci_command(struct dst_state* state, u8 * data, u8 *ca_string, u8 len, int read) { u8 reply; dst_comm_init(state); msleep(65); if (write_dst(state, data, len)) { dprintk(verbose, DST_CA_INFO, 1, " Write not successful, trying to recover"); dst_error_recovery(state); return -1; } if ((dst_pio_disable(state)) < 0) { dprintk(verbose, DST_CA_ERROR, 1, " DST PIO disable failed."); return -1; } if (read_dst(state, &reply, GET_ACK) < 0) { dprintk(verbose, DST_CA_INFO, 1, " Read not successful, trying to recover"); dst_error_recovery(state); return -1; } if (read) { if (! dst_wait_dst_ready(state, LONG_DELAY)) { dprintk(verbose, DST_CA_NOTICE, 1, " 8820 not ready"); return -1; } if (read_dst(state, ca_string, 128) < 0) { /* Try to make this dynamic */ dprintk(verbose, DST_CA_INFO, 1, " Read not successful, trying to recover"); dst_error_recovery(state); return -1; } } return 0; }
Ut::Ut(QWidget *parent) : QDialog(parent) { qDebug() << "start Ut"; ui.setupUi(this); connect(ui.convert, SIGNAL(clicked()), this, SLOT(read_write())); connect(ui.file, SIGNAL(textChanged(QString)), this, SLOT(newfile())); connect(ui.cat, SIGNAL(textChanged(QString)), this, SLOT(newcat())); connect(ui.observatory, SIGNAL(currentIndexChanged(int)), this, SLOT(observatory(int))); connect(ui.dir, SIGNAL(textChanged(QString)), this, SLOT(newdir())); connect(ui.convert, SIGNAL(pressed()), this, SLOT(processing())); connect(ui.LT2UT, SIGNAL(clicked()), this, SLOT(inpfilename())); connect(ui.ST2UT, SIGNAL(clicked()), this, SLOT(inpfilename())); connect(ui.JD2UT, SIGNAL(clicked()), this, SLOT(inpfilename())); red.setColor(QPalette::Base,QColor(Qt::red)); white.setColor(QPalette::Base,QColor(Qt::white)); // filename = "..\\data\\" + ui.file->text() + "maindata_lt.txt"; int index = 0; read_cfg(index); newfile(); read_cat(); observatory(index); read_dst(); inpfilename(); qDebug() << "stop Ut"; }
/********************** slots *****************************************/ void Ut::newfile() { QString s = ui.dir->text() + ui.file->text() + ui.label4->text(); qDebug() << "newfile:" << s; QFileInfo f(s); if (f.isFile()) { ui.file->setPalette(white); if (read_cat()) { ui.convert->setDisabled(false); filename = s; QString ss; if (ui.LT2UT->isChecked()) ss = "_lt"; else if (ui.JD2UT->isChecked()) ss = "_jd"; else ss = "_st"; s = ui.file->text() + ui.label4->text(); ui.outfile->setText(s.replace(ss, "_ut")); ui.outfile->update(); read_dst(); } else ui.convert->setDisabled(true); } else { ui.file->setPalette(red); ui.convert->setDisabled(true); } }
void Ut::inpfilename() { qDebug() << "inpfilename"; if (ui.LT2UT->isChecked()) { ui.label4->setText("maindata_lt.txt"); read_dst(); } else if (ui.ST2UT->isChecked()) ui.label4->setText("maindata_st.txt"); else ui.label4->setText("maindata_jd.txt"); ui.label4->update(); newfile(); }