Esempio n. 1
0
void MainWindow::mainCycle()
{
    while(chckBxInterView->isChecked()) {
        bool flag69 = false;
        if(!commLst.isEmpty()) {
            if((commLst.last().time == 0) || (commLst.last().command == 0x03))
                sendPack(commLst.last());
            qDebug() << "commLst.last().command =" << QString::number(commLst.last().command, 16);
            for(int i = commLst.size() - 1; i >= 0 ; i--) {
                if((commLst.at(i).numCh > 0) && (commLst.at(i).counter > 0) && (commLst.at(i).command != 0x03)) {
                    Command comm(commLst.takeAt(i));
                    int sni, bni;
                    sni = mdl->mdlDt(mdl->rowMdl(comm.numCh, comm.numClass), 29).toInt();
                    bni = mdl->mdlDt(mdl->rowMdl(comm.numCh, comm.numClass), 28).toInt();
                    qDebug() << "comm.time =" << comm.time << "sni * bni =" << sni * bni;
                    //if(comm.time < (sni * bni)) {
                    if(((bni / 2) < 1) || (comm.time < (bni / 2))) {
                        comm.time = 0;
                        commLst.push_back(comm);
                        sendPack(commLst.last());
                    }
                    else {
                        comm.time--;
                        commLst.push_front(comm);
                        mdl->setMdlDt(mdl->rowMdl(comm.numCh, comm.numClass), 19,
                                      QString::number(comm.time / 2));
                    }
                    flag69 = true;
                }
            }
        }
        if(flag69 || commLst.isEmpty()) {
            Command comm(-1, -1, 0x69);
            commLst.push_front(comm);
            sendPack(comm);
        }
        if(!answerFlag) {
            qDebug() << "!answerFlag" << tryConnect(pserial, currPair.port, currPair.baud);
            pb->wait(1000);
            answerFlag = true;
            sendPack(commLst.last());
        }
        qApp->processEvents();
    }
    if(customCommFlag)
        sendCustomComm();
    if(refreshFlag)
        refresh();
}
Esempio n. 2
0
const FchMsg *		IeParser::parseFch(	const BurstData *	pData	)
{
	int		i;
	const uint8 *	pBit = pData->pBit;

	//Debug::print( "FCH", pData->pBit, pData->len );
	if( ( pData->len != fchLen*2 )							||
		( memcmp( &pBit[0], &pBit[fchLen], fchLen ) != 0 )     )
		return NULL;

	sendPack( GSMTAP_WIMAX_FCH, pData->pBit, pData->len/2 );

	bool	isUsed = false;
	for( i = 0; i < dpGroupNum; i++ ) {
		fch.aIsSchGrpUsed[i] = ( *pBit++ != 0 );
		if( fch.aIsSchGrpUsed[i] )
			isUsed = true;
	}
	if( !isUsed ) // ignore FCH with all groups disabled
		return NULL;
	pBit++; // reserved
	fch.dlmapRepeat = (RepeatType)packBit( &pBit, 2 );
	fch.dlmapFec = (FecType)packBit( &pBit, 3 );
	if( fch.dlmapFec > FEC_LDPC )
		return NULL;
	fch.dlmapLen = packBit( &pBit, 8 );
	return &fch;
}
Esempio n. 3
0
const DlmapMsg *	IeParser::parseDlmap(	const BurstData *	pData	)
{
	int				i, htEc;
	const uint8 *	pBit = pData->pBit;

	isIncCid = false;
	sendPack( GSMTAP_WIMAX_PDU, pData->pBit, pData->len );

	if( ( htEc = packBit( &pBit, 2 ) ) == MSG_COMPR ) { // compressed 
		if( packBit( &pBit, 1 ) != MSG_COMPR_DLMAP )
			return NULL;
		if( pData->len < 88 ) // Compressed DL-MAP header size
			return NULL;
		parseCdlmapHdr( &pBit );
		if( ! chkCrc32IsOk( pData->pBit, dlmap.msgLen*8 ) )
			return NULL;
		for( i = 0; i < dlmap.ieCount; i++ )
			parseDlmapIe( &pBit, i );
	} else { // normal
		if( ( htEc != MSG_NOCOM )				||
			( packBit( &pBit, 6 ) != MSG_DLMAP )  )
			return NULL;
		if( pData->len < 152 ) // General MAC plus DL-MAP header size
			return NULL;
		parseDlmapHdr( &pBit );
		if( ! chkCrc32IsOk( pData->pBit, dlmap.msgLen*8 ) )
			return NULL;
		const uint8 *	pEnd = pData->pBit + dlmap.msgLen*8 - 4;
		while( pBit < pEnd )
			parseDlmapIe( &pBit, dlmap.ieCount++ );
	}

	return &dlmap;
}
Esempio n. 4
0
void MainWindow::initConnectParams()
{
    QEventLoop eventLoop, eventLoop2;
    for(int i = 0; i < availablePorts.size(); i++) {
        for(int j = 0; j < baudList.size(); j++) {
            currPair.port = availablePorts.at(i);
            currPair.baud = baudList.at(j);
            pserial = new AbstractSerial(this);
            if(tryConnect(pserial, currPair.port, currPair.baud)) {
                answerFlag = true;
                connect(this, SIGNAL(signPackReceive(QByteArray)), this, SLOT(parceAnswerPack(QByteArray)));
                connect(this, SIGNAL(signPackReceive(QByteArray)), &eventLoop2, SLOT(quit()));
                connect(pserial, SIGNAL(readyRead()), this, SLOT(onProcSerialReceive()));
                connect(pserial, SIGNAL(readyRead()), &eventLoop, SLOT(quit()));
                Command comm(-1, -1, 0x6c);
                sendPack(comm);
                QTimer::singleShot(100, &eventLoop, SLOT(quit()));
                eventLoop.exec();
                QTimer::singleShot(100, &eventLoop2, SLOT(quit()));
                eventLoop2.exec();
            }
            answerFlag = true;
            pserial->close();
        }
    }
}
Esempio n. 5
0
void MainWindow::slot6fBootFirmware()
{
    Command comm(-1, -1, 0x6f);
    sendPack(comm);
    answerFlag = true;
    bootFlag = true;
    disconnect(this, SIGNAL(signPackReceive(QByteArray)), this, SLOT(onPackReceiver(QByteArray)));
    connect(this, SIGNAL(signPackReceive(QByteArray)), bootWGT, SIGNAL(signal_serial_data(QByteArray)));
}
Esempio n. 6
0
// Send a data pack with debug msg
void HeliumModem::sendDebugMsg(char *msg)
{
    DataPack dp(1);
    dp.appendString(msg);
    sendPack(&dp);
}