Archived:Monitoring video call status using Symbian C++
Archived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.
Article Metadata
Tested with
Devices(s): All (S60 3rd Ed)
Compatibility
Platform(s): S60 3rd Edition
S60 3rd Edition, FP1
S60 3rd Edition, FP2
S60 3rd Edition, FP1
S60 3rd Edition, FP2
Article
Keywords: KPSUidTelephonyCallHandling
Created: User:Technical writer 1
(23 Oct 2008)
Last edited: hamishwillee
(14 Jun 2012)
Description
The Call Status & Indicators API, part of the SDK API Plug-in packages for S60, provides a Publish & Subscribe key for monitoring the status of video calls.
The below sample code demonstrates how to implement a simple observer class to detect and handle changes in the video call status.
Solution
Header file:
/*
* --------------------------------------------------------------------
* CallStatusAppUi.h
* --------------------------------------------------------------------
*/
#ifndef __CALLSTATUSAPPUI_H__
#define __CALLSTATUSAPPUI_H__
#include <aknappui.h>
#include <e32property.h>
// FORWARD DECLARATIONS
class CCallStatusAppView;
class CPropertyWatch;
class MPropertyObserver
{
public:
virtual void PropertyDeleted() = 0;
virtual void PropertyChanged(TInt aNewValue) = 0;
};
class CCallStatusAppUi : public CAknAppUi, public MPropertyObserver
{
public:
CCallStatusAppUi() {}
~CCallStatusAppUi();
void ConstructL();
public:
void HandleCommandL(TInt aCommand);
void PropertyDeleted();
void PropertyChanged(TInt aNewValue);
private:
CCallStatusAppView* iAppView;
};
const TUid KPSUidTelephonyCallHandling = {0x101F8787};
const TUint32 KTelephonyCallState = 0x00000004;
enum TPSTelephonyCallType
{
EPSTelephonyCallTypeUninitialized,
EPSTelephonyCallTypeNone,
EPSTelephonyCallTypeCSVoice,
EPSTelephonyCallTypeFax,
EPSTelephonyCallTypeData,
EPSTelephonyCallTypeHSCSD,
EPSTelephonyCallTypeH324Multimedia,
EPSTelephonyCallTypeVoIP
};
enum TPSTelephonyCallState
{
EPSTelephonyCallStateUninitialized,
EPSTelephonyCallStateNone,
EPSTelephonyCallStateAlerting,
EPSTelephonyCallStateRinging,
EPSTelephonyCallStateDialling,
EPSTelephonyCallStateAnswering,
EPSTelephonyCallStateDisconnecting,
EPSTelephonyCallStateConnected,
EPSTelephonyCallStateHold
};
// Active object that tracks changes to the integer property
class CPropertyWatch : public CActive
{
public:
static CPropertyWatch* NewL(MPropertyObserver& aObserver);
~CPropertyWatch();
private:
CPropertyWatch(MPropertyObserver& aObserver);
void ConstructL();
// from CActive
void RunL();
void DoCancel();
private:
RProperty iProperty;
MPropertyObserver& iObserver;
};
#endif // __CCALLSTATUSAPPUI_H__
Source file:
By implementing the virtual functions of MPropertyObserver, the various states of a video call can be monitored.
/*
* --------------------------------------------------------------------
* CallStatusAppUi.cpp
* --------------------------------------------------------------------
*/
#include "CallStatusAppUi.h"
void CCallStatusAppUi::ConstructL()
{
BaseConstructL(EAknEnableSkin);
iAppView = CCallStatusAppView::NewL(ClientRect());
AddToStackL(iAppView);
CPropertyWatch* property = CPropertyWatch::NewL(*this);
}
CCallStatusAppUi::~CCallStatusAppUi()
{
if (iAppView)
{
RemoveFromStack(iAppView);
}
delete iAppView;
}
void CCallStatusAppUi::HandleCommandL( TInt aCommand )
{
switch(aCommand)
{
case EEikCmdExit:
case EAknSoftkeyExit:
Exit();
break;
default:
break;
}
}
CPropertyWatch* CPropertyWatch::NewL( MPropertyObserver& aObserver )
{
CPropertyWatch* self = new (ELeave) CPropertyWatch( aObserver );
CleanupStack::PushL( self );
self->ConstructL();
CleanupStack::Pop( self );
return self;
}
CPropertyWatch::CPropertyWatch( MPropertyObserver& aObserver )
: CActive( EPriorityStandard ),
iObserver( aObserver )
{
}
void CPropertyWatch::ConstructL()
{
User::LeaveIfError(iProperty.Attach(
KPSUidTelephonyCallHandling,
KTelephonyCallStat));
CActiveScheduler::Add(this);
// Call RunL manually once to subscribe to change notifications
// and retrieve current property value
RunL();
}
CPropertyWatch::~CPropertyWatch()
{
Cancel();
iProperty.Close();
}
void CPropertyWatch::DoCancel()
{
iProperty.Cancel();
}
void CPropertyWatch::RunL()
{
// (re)-subscribe to change notifications
iProperty.Subscribe( iStatus );
SetActive();
TInt value;
if ( iProperty.Get( value ) == KErrNotFound )
{
iObserver.PropertyDeleted();
}
else
{
iObserver.PropertyChanged( value );
}
}
void CCallStatusAppUi::PropertyDeleted()
{
// Property has been deleted
}
void CCallStatusAppUi::PropertyChanged( TInt aNewValue )
{
switch( aNewValue )
{
case EPSTelephonyCallStateUninitialized:
// handle each status change here
...
}
}


(no comments yet)