videoplayback/videohelix/src/mpxcalldetector.cpp
changeset 58 d2b028fd1f7d
child 66 adb51f74b890
equal deleted inserted replaced
55:4bfa887905cf 58:d2b028fd1f7d
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 // Version : %version: 1 %
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <ctsydomainpskeys.h>
       
    22 
       
    23 #include "mpxcalldetector.h"
       
    24 #include "mpxvideo_debug.h"
       
    25 
       
    26 
       
    27 // ---------------------------------------------------------------------------
       
    28 // CCallDetector::NewL
       
    29 //
       
    30 // ---------------------------------------------------------------------------
       
    31 //
       
    32 CMPXCallDetector* CMPXCallDetector::NewL( MMPXCallDetectorObserver* aObserver )
       
    33 {
       
    34     MPX_ENTER_EXIT(_L("CMPXCallDetector::NewL()"));
       
    35     
       
    36     CMPXCallDetector* self = new( ELeave ) CMPXCallDetector( aObserver );        
       
    37     CleanupStack::PushL( self );
       
    38     self->ConstructL();
       
    39     CleanupStack::Pop( self );    
       
    40     return self;
       
    41 }
       
    42 
       
    43 // ---------------------------------------------------------------------------
       
    44 // Destructor
       
    45 //
       
    46 // ---------------------------------------------------------------------------
       
    47 //
       
    48 CMPXCallDetector::~CMPXCallDetector()
       
    49 {
       
    50     Cancel();
       
    51     iTsyProperty.Close();
       
    52 }
       
    53 
       
    54 // ---------------------------------------------------------------------------
       
    55 // CCallDetector::RequestNotification
       
    56 // 
       
    57 // ---------------------------------------------------------------------------
       
    58 // 
       
    59 void CMPXCallDetector::RequestNotification()
       
    60 {
       
    61     MPX_ENTER_EXIT(_L("CCallDetector::RequestNotification()"));
       
    62 
       
    63     iTsyProperty.Subscribe( iStatus );
       
    64     SetActive();
       
    65 }
       
    66 
       
    67 // ---------------------------------------------------------------------------
       
    68 // Constructor
       
    69 //
       
    70 // ---------------------------------------------------------------------------
       
    71 //
       
    72 CMPXCallDetector::CMPXCallDetector( MMPXCallDetectorObserver* aObserver )
       
    73  : CActive( EPriorityStandard ), iObserver( aObserver )
       
    74 {
       
    75 }
       
    76 
       
    77 // ---------------------------------------------------------------------------
       
    78 // CCallDetector::ConstructL
       
    79 //
       
    80 // ---------------------------------------------------------------------------
       
    81 //
       
    82 void CMPXCallDetector::ConstructL()
       
    83 {
       
    84     MPX_ENTER_EXIT(_L("CCallDetector::ConstructL"));	
       
    85     
       
    86     User::LeaveIfError( iTsyProperty.Attach( KPSUidCtsyCallInformation, KCTsyCallState ) );
       
    87     
       
    88     CActiveScheduler::Add( this );
       
    89 }
       
    90 
       
    91 // ---------------------------------------------------------------------------
       
    92 // CCallDetector::RunL
       
    93 // Called when the voice line status changes.
       
    94 // ---------------------------------------------------------------------------
       
    95 //
       
    96 void CMPXCallDetector::RunL()
       
    97 {
       
    98     TInt status = iStatus.Int();
       
    99     
       
   100     RequestNotification();
       
   101     
       
   102     if ( status == KErrNone )
       
   103     {
       
   104         TInt status;
       
   105         iTsyProperty.Get( status );
       
   106         
       
   107         if ( status != EPSCTsyCallStateNone )
       
   108         {
       
   109             iObserver->CallDetectedL();
       
   110         }
       
   111     }
       
   112 }
       
   113 
       
   114 // ---------------------------------------------------------------------------
       
   115 // CCallDetector::DoCancel
       
   116 //
       
   117 // ---------------------------------------------------------------------------
       
   118 //
       
   119 void CMPXCallDetector::DoCancel()
       
   120 {
       
   121     iTsyProperty.Cancel();
       
   122 }
       
   123 
       
   124 // End of File