// -----------------------------------------------------------------------------
// CCbsTopicMessages::GetNextAndPrevMsgHandleL
// Retrieves and returns the handles of messages that
// precede and succeed the given message in topic.
// Also returns two flags indicating whether the
// given message is the first and/or the last message in topic.
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CCbsTopicMessages::GetNextAndPrevMsgHandleL()
    {
    // Retrieve the requested topic number
    TPckgBuf< TCbsMessageHandle > pckgCurrentMsg( 0 );
    Message().ReadL( 0, pckgCurrentMsg );

    // Determine requested information
    TCbsMessageHandle nextMsg(0);
    TCbsMessageHandle prevMsg(0);
    TInt position(0);
    iMessages.GetNextAndPrevMsgHandleL(
        pckgCurrentMsg(), nextMsg, prevMsg, position);

    // Write results back
    TPckgBuf< TCbsNextPrevMsgAndPosition > pckgResults;
    pckgResults().iPrevMsg = prevMsg;
    pckgResults().iNextMsg = nextMsg;
    pckgResults().iPosition = position;

    Message().WriteL( 1, pckgResults );

    // Complete request
    Message().Complete( KErrNone );

    }
Example #2
0
thermocouplePort::thermocouplePort( QObject *parent ) : labPort( parent ),
    _sendCounter( 0 ), _answerPending( -1 ),
    _emitProbeTemperature( false ), _emitAmbientTemperature( false ),
    _idStringSet( false ), _probeTemperatureOnly( true )
{
    setSerialValues();
    setLabPortVariables();

    connect( this, SIGNAL( dataReceived( QByteArray ) ), this,
                           SLOT( receivedMsg( QByteArray ) ) );
    connect( &_checkForAnswerTimer, SIGNAL( timeout() ), this,
             SLOT( nextMsg() ) );
}
Example #3
0
void thermocouplePort::sendUtcCmd( QString cmd, int numAnswers )
{
    for( int i = 0; i < numAnswers; i++ )
    {
        if( cmd != CMD_ID
                && cmd != CMD_PROBE_TEMPERATURE
                && cmd != CMD_BOTH_TEMPERATURES )
        {
            _expectedAnswer.push_back( CMD_OTHER );
        }
        else
        {
            _expectedAnswer.push_back( cmd );
        }
    }

    _msgToSend.push_back( (numAnswers > 0 ? "y" : "n") + cmd + "\r\n" );

    if( !_checkForAnswerTimer.isActive() )
    {
        _answerPending = -1;
        nextMsg();
    }
}