Exemple #1
0
elFlowPort::elFlowPort( QObject* parent ) : labPort( parent ), _inMsg( false ),
    _maxCapacity( 0.0 ), _setValueType( setValueType::setTypeNone ),
    _setFlowPercent( 0.0 ), _autoAdjust( false ),
    _emitFlow( false ), _emitPressure( false ), _emitTemperature( false )
{
    setSerialValues();
    setLabPortVariables();

    connect( this, SIGNAL( dataReceived( QByteArray ) ), this,
                           SLOT( receivedMsg( QByteArray ) ) );
}
Exemple #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() ) );
}
Exemple #3
0
eapsUta12Port::eapsUta12Port( QObject *parent ) : labPort( parent ), _id( 0 ),
    _maxVoltageOut( 0 ), _maxCurrentOut( 0 ),
    _maxVoltageIn( 1 ), _maxCurrentIn( 1 ),
    _minVoltageValue( 0.0 ), _maxVoltageValue( 10.0 ),
    _minCurrentValue( 0.0 ), _maxCurrentValue( 10.0 ),
    _lastVoltage( 0.0 ), _lastCurrent( 0.0 ), _lastPower( 0.0 ),
    _lastResistance( 0.0 ),
    _setValueType( setValueType::setTypeNone ), _autoAdjust( false ),
    _emitVoltage( false ), _emitCurrent( false ), _emitPower( false ),
    _emitResistance( false )
{
    setSerialValues();
    setLabPortVariables();

    connect( this, SIGNAL( dataReceived( QByteArray ) ), this,
                           SLOT( receivedMsg( QByteArray ) ) );
}
// ---------------------------------------------------------
// CDpMif::RunL
// This method handles received message from Isc Api and
// renews read from Isc Api.
// ---------------------------------------------------------
//
void CDpMif::RunL()
    {
    OstTrace0( TRACE_NORMAL, CDPMIF_RUNL, "CDpMif::RunL" );
    LOGM1("CDpMif::RunL - Port %d", iDataPort.PortUnit() );

    // we are always signaled from PhoNet ReceiveMessage
    if ( KErrNoMemory == iStatus.Int() )
        {
        LOGM(" ==> KErrNoMemory");
        OstTrace0( TRACE_NORMAL, DUP1_CDPMIF_RUNL, "CDpMif:: ==> KErrNoMemory" );

        // deallocate current message
        if ( iMsgReceiveBuffer )
            {
            delete iMsgReceiveBuffer;
            iMsgReceiveBuffer = NULL;
            iReceiveMessage.Set( NULL, 0, 0 );
            }
        //no else

        // ISA Handle receive
        // Trying to allocate a new message
        iMsgReceiveBuffer = HBufC8::NewL( ISI_HEADER_SIZE + iLen );
        _LIT( KPanicStr, "Dataport - CDpMif::RunL" );
        __ASSERT_ALWAYS( iMsgReceiveBuffer,
            User::Panic( KPanicStr, KErrNoMemory ) );
        iReceiveMessage.Set( iMsgReceiveBuffer->Des() );
        iLen = 0;

        if ( !IsActive() )
            {
            iDataPort.ISAHandle().Receive(
                iStatus, iReceiveMessage, iLen );

            SetActive();
            }
        //no else
        }
     else
        {
        OstTrace0( TRACE_NORMAL, DUP2_CDPMIF_RUNL, "CDpMif:: ==> ISI-message received" );
        OstPrintIsiMessage( iReceiveMessage );

        LOGM(" ==> ISI-message received");
        LOGMESSAGE( iReceiveMessage );

        TIsiReceiveC receivedMsg( iReceiveMessage );

        TUint8 resource_id( receivedMsg.Get8bit(
            ISI_HEADER_OFFSET_RESOURCEID ) );
        TUint8 message_id( receivedMsg.Get8bit(
            ISI_HEADER_OFFSET_MESSAGEID ) );

        switch ( resource_id )
            {
            case PN_NAMESERVICE:
                {
                switch ( message_id )
                    {
                    case PNS_NAME_ADD_RESP:
                        {
                        LOG(" ==> PNS_NAME_ADD_RESP received");
                        OstTrace0( TRACE_NORMAL, DUP4_CDPMIF_RUNL, "CDpMif:: ==> PNS_NAME_ADD_RESP received" );

                        TUint8 reason( receivedMsg.Get8bit( ISI_HEADER_SIZE +
                            PNS_NAME_ADD_RESP_OFFSET_REASON ) );
                        TInt error( KErrNone );

                        switch ( reason )
                            {
                            case PN_NAME_OK:
                                {
                                LOG(" ==> PN_NAME_OK");
                                OstTrace0( TRACE_NORMAL, DUP5_CDPMIF_RUNL, "CDpMif:: ==> PN_NAME_OK" );

                                error = KErrNone;
                                break;
                                }
                            default:
                                {
                                LOG1(" ==> reason: %d", reason );
                                OstTraceExt1( TRACE_NORMAL, DUP6_CDPMIF_RUNL, "CDpMif:: ==> reason: %hhu", reason );

                                error = KErrGeneral;
                                }
                            }
                            iDataPort.SignalPif( error );
                        break;
                        }
                    case PNS_NAME_REMOVE_RESP:
                        {
                        LOG(" ==> PNS_NAME_REMOVE_RESP received");
                        OstTrace0( TRACE_NORMAL, DUP7_CDPMIF_RUNL, "CDpMif:: ==> PNS_NAME_REMOVE_RESP received" );
                        break;
                        }
                    default:
                        {
                        LOG1(" ==> Unknown message received. ID: %d",
                            message_id );
                        OstTraceExt1( TRACE_NORMAL, DUP8_CDPMIF_RUNL, "CDpMif:: ==> Unknown message received. ID: %hhu", message_id );
                        }
                    }
                break;
                }
            case PN_PIPE:
                {
                switch ( message_id )
                    {
                    case PNS_PEP_CTRL_REQ:
                        {
                        LOG(" ==> PNS_PEP_CTRL_REQ received");
                        OstTrace0( TRACE_NORMAL, DUP9_CDPMIF_RUNL, "CDpMif:: ==> PNS_PEP_CTRL_REQ received" );

                        HandlePepCtrlReq( receivedMsg );
                        break;
                        }
                    case PNS_PEP_STATUS_IND:
                        {
                        LOG(" ==> PNS_PEP_STATUS_IND received");
                        OstTrace0( TRACE_NORMAL, DUP10_CDPMIF_RUNL, "CDpMif:: ==> PNS_PEP_STATUS_IND received" );

                        HandlePepStatusInd( receivedMsg );
                        break;
                        }
                    default:
                        {
                        LOG1(" ==> Unknown message received. ID: %d",
                            message_id );
                        OstTraceExt1( TRACE_NORMAL, DUP11_CDPMIF_RUNL, "CDpMif:: ==> Unknown message received. ID: %hhu", message_id );
                        }
                    }
                break;
                }
            default:
                {
                LOG1(" ==> Unknown message received. ID: %d", message_id );
                OstTraceExt1( TRACE_NORMAL, DUP12_CDPMIF_RUNL, "CDpMif:: ==> Unknown message received. ID: %hhu", message_id );
                }
            }

        iReceiveMessage.Zero();

        // Check if pipe is removed
        if ( PNS_NAME_REMOVE_RESP == message_id &&
            CDpPif::EDpPipeDisconnected == iPifDcs.PipeState() )
            {
            // Check if DataPort is ready to be deleted
            if ( iDataPort.IsReadyToDestruct() )
                {
                iDataPort.DeleteDataPort();
                }
            //no else
            }
        else
            {
            // Renew read
            User::LeaveIfError( Read() );
            }
        }
    }