×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Dec 2010
    Posts
    50

    Qt and Symbian Togethor Help needed?

    Hi All,
    I am trying to go with Symbian and Qt togethor for my telephony application.My App is simple but it detects the calls using Ctelephony API in Symbian.I am using Qt anf follows this link
    http://wiki.forum.nokia.com/index.ph...nals_.26_Slots

    Follwing are symbian CActive derive class which detect the call
    CallsMonitor.h
    Code:
    #ifndef CALLSMONITOR_H
    #define CALLSMONITOR_H
    #include <Etel3rdParty.h>
    class callMonitorStub;
    class CCallMonitor : public CActive
            {
            public:
                    ~CCallMonitor();
                    static CCallMonitor* NewLC(callMonitorStub& aObserver);
                    static CCallMonitor* NewL(callMonitorStub& aObserver);
            private:
                    CCallMonitor(callMonitorStub& aCallBack);
                    void ConstructL();
            protected:
                    void DoCancel();
                    void RunL();
            private:
                    void CancelOperation(void);
                    void StartListening();
                    void GetCallDetails(TBool aIsInCall);
            private:
                    callMonitorStub&              iCallBack;
                    TInt                          iState;
                    CTelephony::TCallStatusV1     iCurrentStatus;
                    CTelephony::TCallStatusV1Pckg iCurrentStatusPckg;
                    CTelephony::TCallStatus       iLastInformedLineStatus;
                    CTelephony*                   iTelephony;
    
            };
    #endif // CALLSMONITOR_H
    CallsMonitor.cpp
    Code:
    #include "CallsMonitor.h"
    #include "callMonitorStub.h"
    #include<QtCore>
    
    CCallMonitor* CCallMonitor::NewLC(callMonitorStub& aObserver)
            {
            CCallMonitor* self = new (ELeave) CCallMonitor(aObserver);
            CleanupStack::PushL(self);
            self->ConstructL();
            return self;
            }
    CCallMonitor* CCallMonitor::NewL(callMonitorStub& aObserver)
            {
            CCallMonitor* self = CCallMonitor::NewLC(aObserver);
            CleanupStack::Pop(); // self;
            return self;
            }
    CCallMonitor::CCallMonitor(callMonitorStub& aCallBack)
    :CActive(EPriorityStandard),iCallBack(aCallBack),iCurrentStatusPckg(iCurrentStatus)/*,iPhoneIdV1Pckg(iPhoneIdV1)*/
            {
            CActiveScheduler::Add(this);
            }
    CCallMonitor::~CCallMonitor()
            {
                    Cancel();
                    delete iTelephony;
            }
    void CCallMonitor::ConstructL(void)
            {
                    iTelephony = CTelephony::NewL();
                    iLastInformedLineStatus = CTelephony::EStatusUnknown;
    
                    iState=0;
                    StartListening();
            }
    void CCallMonitor::CancelOperation(void)
            {
                    Cancel();
            }
    void CCallMonitor::DoCancel()
            {
                    iTelephony->CancelAsync(CTelephony::EVoiceLineStatusChangeCancel);
            }
    void CCallMonitor::RunL()
    {
            if(iStatus == KErrNone)
            {
                    switch(iCurrentStatus.iStatus)
                    {
                            case CTelephony::EStatusDisconnecting:
    
                                    if(iState==1)
                                            GetCallDetails(ETrue);
                                    else
                                            GetCallDetails(EFalse);
                                    iState=0;
                                    break;
    
                            case CTelephony::EStatusDialling:
    
                                    iState=1;
                                    break;
    
                            case CTelephony::EStatusRinging:
                                    if(iLastInformedLineStatus != CTelephony::EStatusDialling)
                                    {
                                            iState=2;
                                    }
                                    break;
                            default:
                                    break;
                    }
                    iLastInformedLineStatus = iCurrentStatus.iStatus;
            }
            if(iStatus != KErrCancel)
            {
                    StartListening();
            }
    }
    /*if(iCurrentStatus.iStatus==CTelephony::EStatusDisconnecting)
                    {
                            if(iState==1)
                                    GetCallDetails(ETrue);
                            else
                                    GetCallDetails(EFalse);
                            iState=0;
                    }else if(iCurrentStatus.iStatus == CTelephony::EStatusDialling )
                    {
                            //Incoming Call is detected here
                            //GetCallDetails(ETrue);
                            if(iState==0)iState=1;
                    }else if(iCurrentStatus.iStatus == CTelephony::EStatusRinging)
                    {
                            if(iLastInformedLineStatus != CTelephony::EStatusDialling)
                    {
                                    if(iState==0)iState=2;
                                    //Outgoing call is detected here
                                    //GetCallDetails(EFalse);
                    }
                    }else
                    {
    
                    }*/
    
    
    void CCallMonitor::StartListening()
    {
            Cancel();
            iCurrentStatus.iStatus = CTelephony::EStatusUnknown;
    
            iTelephony->NotifyChange(iStatus,CTelephony::EVoiceLineStatusChange,iCurrentStatusPckg);
            SetActive();
    }
    void CCallMonitor::GetCallDetails(TBool aIsInCall)
    {
            CTelephony::TCallInfoV1 callInfoV1;
            CTelephony::TCallInfoV1Pckg callInfoV1Pckg( callInfoV1 );
            CTelephony::TCallSelectionV1 callSelectionV1;
            CTelephony::TCallSelectionV1Pckg callSelectionV1Pckg( callSelectionV1 );
            CTelephony::TRemotePartyInfoV1 remotePartyInfoV1;
            CTelephony::TRemotePartyInfoV1Pckg remotePartyInfoV1Pckg( remotePartyInfoV1 );
            callSelectionV1.iLine = CTelephony::EVoiceLine;
            callSelectionV1.iSelect = CTelephony::EInProgressCall;
            User::After(10);
            if(KErrNone==iTelephony->GetCallInfo( callSelectionV1Pckg, callInfoV1Pckg, remotePartyInfoV1Pckg ))
            {
                    if( remotePartyInfoV1.iRemoteNumber.iTelNumber.Length() > 0 )
                    {
    //This is for testing
                            QT_TRYCATCH_LEAVING(iCallBack.emitCallDetected(1,"9895042120","","");)
                            // Incoming call number can be read from
                            //iCallBack.CallStatusChangedL(iCurrentStatus.iStatus,iStatus.Int(),1,remotePartyInfoV1.iRemoteNumber.iTelNumber,callInfoV1.iStartTime,callInfoV1.iDuration);
                    }else if( callInfoV1.iDialledParty.iTelNumber.Length() > 0 )
                    {
    //This is for testing
                            QT_TRYCATCH_LEAVING(iCallBack.emitCallDetected(2,"9895042120","","");)
                            // Outgoing call number can be read from
                            //iCallBack.CallStatusChangedL(iCurrentStatus.iStatus,iStatus.Int(),2,callInfoV1.iDialledParty.iTelNumber,callInfoV1.iStartTime,callInfoV1.iDuration);
                    }else
                    {
    
                    }
    
            }
    }
    the Qt public class corresponding to this Symbian class is follows
    callMonitorStub.h

    Code:
    #ifndef CALLMONITORSTUB_H
    #define CALLMONITORSTUB_H
    #include<QObject>
    #include<QtCore>
    class CallsMonitor;
    class callMonitorStub:public QObject
    {
        Q_OBJECT
    public:
         callMonitorStub(QObject *parent=0);
        ~callMonitorStub();
        void emitCallDetected(int Type,QString number,QString dateTime,QString duration);
    signals:
        void callDetected(int Type,QString number,QString dateTime,QString duration);
    private:
       CallsMonitor *d_ptr; //private implementation
    private:
        friend class CallsMonitor;
    
    };
    #endif // CALLMONITORSTUB_H
    callMonitorStub.cpp
    Code:
    #include"callMonitorStub.h"
    #ifdef Q_OS_SYMBIAN
        #include"CallsMonitor.h"
    #endif
    
    callMonitorStub::callMonitorStub(QObject *parent):QObject(parent)
    {
        #ifdef Q_OS_SYMBIAN
            QT_TRAP_THROWING(d_ptr = CallsMonitor::NewL(this));
        #endif
    }
    callMonitorStub::~callMonitorStub()
    {
    }
    
    void callMonitorStub::emitCallDetected(int Type,QString number,QString dateTime,QString duration)
    {
        this->callDetected(Type,number,dateTime,duration);
    }

    I am getting an error in the line marked red in CallMonitorStub.cpp
    error: incomplete type 'CallsMonitor' used in nested name specifier

    Please help me

  2. #2
    Nokia Developer Champion
    Join Date
    Dec 2008
    Posts
    2,356

    Re: Qt and Symbian Togethor Help needed?

    please see this thead http://discussion.forum.nokia.com/fo...ork&highlight= and make sure that you are using the symbian code properly in Qt

Similar Threads

  1. Help needed regarding QML and Qt Version
    By narendar_discover in forum [Archived] Beginning Qt
    Replies: 9
    Last Post: 2011-02-25, 06:28
  2. Help needed to UI Design in Qt for Symbian
    By narendar_discover in forum [Archived] Beginning Qt
    Replies: 5
    Last Post: 2011-02-16, 11:35
  3. Help me about open and keep WAP/GPRS connection in Qt S60 for N97 and Symbian^3
    By songwei1984 in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2010-08-13, 02:30

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×