Пример #1
0
WizardWelcome::WizardWelcome(QWidget* parent)
    : QBookForm(parent)
    , current_widget(0)
    , m_WizardLanguage(0)
    , m_WizardDateTime(0)
    , m_elfFinishWizard(0)
{
    qDebug() << Q_FUNC_INFO;
    setupUi(this);

    connect(nextStepBtn, SIGNAL(clicked()), this, SLOT(requestConnection()));
    connect(skipBtn, SIGNAL(clicked()), this, SLOT(skipWizard()));
    nextStepBtn->setFocus();

    if(QBook::settings().value("setting/initial_lang_selection",true).toBool())
    {
        if(!m_WizardLanguage)
            m_WizardLanguage = new WizardLanguage(this);


        connect(m_WizardLanguage, SIGNAL(languageSelected()), this, SLOT(hideLanguageSettings()));
        showElement(m_WizardLanguage);
    }
    if(QBookApp::instance()->isActivated())
    {
        intro3Lbl->hide();
        welcomeTitleLbl->setText(tr("Enlazar dispositivo"));
    }else
        intro3Lbl->show();

    // Check if: 1. language selection is needed, 2. initial power on for user is set and 3. Device has not been manually deactivated because of OTA
    if(!QBook::settings().value("setting/initial_lang_selection", true).toBool()&& QBook::settings().value("setting/initial",true).toBool()
            && !QBook::settings().value("setting/activated").isValid())
    {
        if(!m_WizardDateTime)
            m_WizardDateTime = new WizardDateTime(this);

        connect(m_WizardDateTime, SIGNAL(hideMe()), this, SLOT(hideWizardDateTime()));
        showElement(m_WizardDateTime);
    }
    QFile fileSpecific(":/res/wizard_styles.qss");
    QFile fileCommons(":/res/wizard_styles_generic.qss");
    fileSpecific.open(QFile::ReadOnly);
    fileCommons.open(QFile::ReadOnly);

    QString styles = QLatin1String(fileSpecific.readAll() + fileCommons.readAll());
    setStyleSheet(styles);
}
Пример #2
0
static
int
send_rcv(int opcode, int size)
{
	//COMENTDEBUG
	//printf("sending rcv\n");
	int s = requestConnection(&c);
	int qtyrec, qtysent;
	p.opc = opcode;
	qtysent = sendPacket(&c, &p, size + sizeof(opcode));
	qtyrec = receivePacket(&c, &p, sizeof(PACKET));
	endConnection(&c);
	int ret_opcode = p.opc;
	if(ret_opcode = RET_CURAR) {
		//COMENTDEBUG
		//printf("pokemones curados\n");
		
	}

	return qtyrec - sizeof ( OPC );
}
Пример #3
0
static int
requestInetConnection (const struct sockaddr_in *remoteAddress) {
  return requestConnection(getInetSocket,
                           (const struct sockaddr *)remoteAddress, sizeof(*remoteAddress));
}
Пример #4
0
static int
requestLocalConnection (const struct sockaddr_un *remoteAddress) {
  return requestConnection(getLocalSocket,
                           (const struct sockaddr *)remoteAddress, sizeof(*remoteAddress));
}
Пример #5
0
MainWindow::MainWindow() : QMainWindow() {
	
	setWindowTitle("Miroslav Beta 7");
	
	menuBar();

	fileMenu = menuBar()->addMenu(tr("File"));
	settingsMenu = menuBar()->addMenu(tr("Settings"));
	
	connectAction = new QAction(tr("Connect..."), this);
	reconnectAction = new QAction(tr("Reconnect"), this);
	disconnectAction = new QAction(tr("Disconnect"), this);
	disconnectAction->setEnabled(false);
	closeWindowAction = new QAction(tr("Close Window"), this);
	quitAction = new QAction(tr("Quit"), this);
	

	fileMenu->addAction(connectAction);
	fileMenu->addAction(reconnectAction);
	fileMenu->addAction(disconnectAction);
	fileMenu->addSeparator();
	fileMenu->addAction(closeWindowAction);
	fileMenu->addAction(quitAction);

	changeNickAction = new QAction(tr("Change Nickname..."), this);
	changeNickAction->setEnabled(false);
	changeColorAction = new QAction(tr("Change Text Color..."), this);
	changeColorAction->setEnabled(false);

	settingsMenu->addAction(changeNickAction);
	settingsMenu->addAction(changeColorAction);

	mainWidget = new MainWidget(this);
	setCentralWidget(mainWidget);
	resize(600,350);
	
	trayIcon = new TrayIcon(this);
	
	// Menu connections
	connect(connectAction, SIGNAL(triggered()), mainWidget, SLOT(requestConnection()));
	connect(reconnectAction, SIGNAL(triggered()), mainWidget, SLOT(loadSettings()));
	connect(disconnectAction, SIGNAL(triggered()), mainWidget, SLOT(requestDisconnect()));
	connect(closeWindowAction, SIGNAL(triggered()), trayIcon, SLOT(showHideWindow()));
	connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
	
	connect(changeNickAction, SIGNAL(triggered()), mainWidget, SLOT(requestChangeNick()));
	connect(changeColorAction, SIGNAL(triggered()), mainWidget, SLOT(requestChangeColor()));
	
	// Menu activate connections
	connect(mainWidget, SIGNAL(canConnect(bool)), this, SLOT(canConnect(bool)));
	connect(mainWidget, SIGNAL(canDisconnect(bool)), this, SLOT(canDisconnect(bool)));
	connect(mainWidget, SIGNAL(canChangeNick(bool)), this, SLOT(canChangeNick(bool)));
	connect(mainWidget, SIGNAL(canChangeColor(bool)), this, SLOT(canChangeColor(bool)));
	
	// Tray Icon connections
	connect(trayIcon, SIGNAL(requestExit()), qApp, SLOT(quit()));
	connect(trayIcon, SIGNAL(showChatWindow(bool)), this, SLOT(setVisible(bool)));	

	connect(mainWidget, SIGNAL(newMessage(QString, QString)), this, SLOT(newMessage(QString, QString)));
	
	mainWidget->loadSettings();
	show();
}
Пример #6
0
void WizardWelcome::goToWifi()
{
    qDebug() << Q_FUNC_INFO;    
    requestConnection();
}
Пример #7
0
//
// routine: receive and send on incoming messages
//
// Notes:
//		No analysis of the message is performed - that is left
//		to the command processor task.  Instead, the local copy
//		of the header
//		is demarshalled to determined whether or not there
//		is associated data; if there is, space is allocated to
//		contain it.
void *
SseInputTask::routine()
{
    extractArgs();

    Timer timer;
    if (cmdArgs->noSSE()) {
        processIpFromFile();
        while (1)
            timer.sleep(3000);
    };

    // run forever, waiting for messages from the SSE
    bool stopIssued = false;
    bool done = false;
    uint32_t lastCode = MESSAGE_CODE_UNINIT;
    int32_t lastLen = 0;
    uint32_t lastTime = 0;
    while (!done) {
        // if there's no connection, request that it be
        // established, then wait for that to happen
        if (!sse->isConnected()) {
            requestConnection();
            while (!sse->isConnected())
                timer.sleep(3000);
        }
        stopIssued = false;

        // got a connection - wait for data to come in
        SseInterfaceHeader hdr;
        Error err = sse->recv((void *) &hdr, sizeof(hdr));
        if (err) {
            switch (err) {
            case EAGAIN:
            case EINTR:
            case ENOTCONN:
            case ECONNRESET:
                stopAllActivities(stopIssued);
                continue;
            default:
                Fatal(err);
                break;
            }
        }
        // demarshall the header
        hdr.demarshall();

        if (cmdArgs->logSseMessages()) {
            LogWarning(ERR_NE, hdr.activityId,
                       "bad msg from Sse, code = %d, len = %d", hdr.code,
                       hdr.dataLength);
        }

        // allocate a message to hold the incoming message
        Msg *msg = msgList->alloc();
        msg->setHeader(hdr);
        msg->setUnit((sonata_lib::Unit) UnitSse);

        // if there's data associated with the message,
        // allocate space and retrieve it, demarshall it
        // based on the message type,
        // then send it on to the command processor
        void *data = 0;
        int32_t len = hdr.dataLength;
        timeval tv;
        gettimeofday(&tv, NULL);
        if (len > 10000) {
            LogWarning(ERR_NE, hdr.activityId,
                       "msg code = %d, len = %d, t = %u, last msg = %d, last len = %d, last t = %u",
                       hdr.code, len, tv.tv_sec, lastCode, lastLen, lastTime);
            Timer t;
            t.sleep(100);
        }
        else {
            lastCode = hdr.code;
            lastLen = len;
            lastTime = tv.tv_sec;
        }
        if (len) {
            MemBlk *blk = partitionSet->alloc(len);
            Assert(blk);
            if (!blk)
                Fatal(ERR_MAF);
            data = blk->getData();
            err = sse->recv(data, len);
            if (err) {
                switch (err) {
                case EAGAIN:
                case EINTR:
                case ENOTCONN:
                case ECONNRESET:
                    blk->free();
                    Assert(msgList->free(msg));
                    stopAllActivities(stopIssued);
                    continue;
                default:
                    Fatal(err);
                    break;
                }
            }
            msg->setData(data, len, blk);
        }

        // demarshall the data of the message depending on
        // the message type
        switch (hdr.code) {
        case REQUEST_INTRINSICS:
            break;
        case CONFIGURE_DX:
            (static_cast<DxConfiguration *> (data))->demarshall();
            break;

        case PERM_RFI_MASK:
        case BIRDIE_MASK:
        case RCVR_BIRDIE_MASK:
        case TEST_SIGNAL_MASK:
            demarshallFrequencyMask(data);
            break;
        case RECENT_RFI_MASK:
            demarshallRecentRFIMask(data);
            break;
        case REQUEST_DX_STATUS:
            break;
        case SEND_DX_ACTIVITY_PARAMETERS:
            (static_cast<DxActivityParameters *> (data))->demarshall();
            break;
        case DX_SCIENCE_DATA_REQUEST:
            (static_cast<DxScienceDataRequest *> (data))->demarshall();
            break;
#ifdef notdef
        case SEND_DOPPLER_PARAMETERS:
            (static_cast<DopplerParameters *> (data))->demarshall();
            break;
#endif
        case BEGIN_SENDING_FOLLOW_UP_SIGNALS:
            (static_cast<Count *> (data))->demarshall();
            break;
        case SEND_FOLLOW_UP_CW_SIGNAL:
            (static_cast<FollowUpCwSignal *> (data))->demarshall();
            break;
        case SEND_FOLLOW_UP_PULSE_SIGNAL:
            (static_cast<FollowUpPulseSignal *> (data))->demarshall();
            break;
        case DONE_SENDING_FOLLOW_UP_SIGNALS:
            break;
        case START_TIME:
            (static_cast<StartActivity *> (data))->demarshall();
            break;
        case BEGIN_SENDING_CANDIDATES:
            (static_cast<Count *> (data))->demarshall();
            break;
        case SEND_CANDIDATE_CW_POWER_SIGNAL:
            (static_cast<CwPowerSignal *> (data))->demarshall();
            break;
        case SEND_CANDIDATE_PULSE_SIGNAL:
            demarshallPulseSignal(data);
            break;
        case DONE_SENDING_CANDIDATES:
            break;
        case BEGIN_SENDING_CW_COHERENT_SIGNALS:
            break;
        case SEND_CW_COHERENT_SIGNAL:
            (static_cast<CwCoherentSignal *> (data))->demarshall();
            break;
        case DONE_SENDING_CW_COHERENT_SIGNALS:
            break;
        case REQUEST_ARCHIVE_DATA:
            (static_cast<ArchiveRequest *> (data))->demarshall();
            break;
        case DISCARD_ARCHIVE_DATA:
            (static_cast<ArchiveRequest *> (data))->demarshall();
            break;
        // the following commands arrive with no data
        case STOP_DX_ACTIVITY:
        case SHUTDOWN_DX:
        case RESTART_DX:
            Debug(DEBUG_CONTROL, hdr.activityId,
                  "STOP_DX_ACTIVITY, act");
            break;
        default:
            LogError(ERR_IMT, hdr.activityId, "activity %d, type %d",
                     hdr.activityId, hdr.code);
            Err(ERR_IMT);
            ErrStr(hdr.code, "msg code");
            Assert(msgList->free(msg));
            continue;
        }

        // at this point, the entire marshalled message is in
        // a generic Msg; send the message on for processing,
        // then go back to waiting
        cmdQ->send(msg);
    }
    return (0);
}