telephonyutils/telephonywatchers/src/ModemChangeObserver.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "ModemChangeObserver.h"
       
    17 
       
    18 // System includes
       
    19 #include <cdbcols.h>
       
    20 
       
    21 
       
    22 
       
    23 //
       
    24 // ------> CModemChangeObserver (source)
       
    25 //
       
    26 
       
    27 EXPORT_C CModemChangeObserver::CModemChangeObserver(MModemChangeObserver& aObserver)
       
    28 :	CActive(EPriorityNormal), iObserver(aObserver)
       
    29 	{
       
    30 	CActiveScheduler::Add(this);
       
    31 	}
       
    32 
       
    33 EXPORT_C CModemChangeObserver::~CModemChangeObserver()
       
    34 	{
       
    35 	Cancel();
       
    36 	}
       
    37 
       
    38 EXPORT_C void CModemChangeObserver::ConstructL()
       
    39 	{
       
    40 	User::LeaveIfError(iModemChangeProperty.Attach(KUidSystemCategory, KUidCommDbModemPhoneServicesAndSMSChange.iUid));	
       
    41 	IssueRequestL();
       
    42 	}
       
    43 
       
    44 //
       
    45 //
       
    46 //
       
    47 
       
    48 void CModemChangeObserver::IssueRequestL()
       
    49 	{
       
    50 	// Queue for notifications
       
    51 	iModemChangeProperty.Subscribe(iStatus);
       
    52 	//
       
    53 	SetActive();
       
    54 	}
       
    55 
       
    56 //
       
    57 //
       
    58 //
       
    59 
       
    60 void CModemChangeObserver::RunL()
       
    61 	{
       
    62 	// Notify client
       
    63 	iObserver.HandleModemChangedL();
       
    64 
       
    65 	// Re-issue request
       
    66 	IssueRequestL();
       
    67 	}
       
    68 
       
    69 void CModemChangeObserver::DoCancel()
       
    70 	{
       
    71 	iModemChangeProperty.Cancel();
       
    72 	}
       
    73 
       
    74 
       
    75 TInt CModemChangeObserver::RunError(TInt aError)
       
    76 	{
       
    77 	if	(aError != KErrNotSupported)
       
    78 		return KErrNone;
       
    79 	return aError;
       
    80 	}
       
    81