smsprotocols/smsstack/smsprot/Src/smspcdb.cpp
changeset 0 3553901f7fa8
child 19 630d2f34d719
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 1997-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 // Implements the CSmspCommDbEvent class
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20 */
       
    21 
       
    22 #include "smspcdb.h"
       
    23 #include "smspmain.h"
       
    24 #include "smsuset.h"
       
    25 #include "SmsuTimer.h"
       
    26 
       
    27 
       
    28 /**
       
    29  *  Private constructor used in the first phase of construction.
       
    30  *  
       
    31  *  @param aSmsSettings Reference to sms configuration settings
       
    32  *  @param aSmsMessaging Reference to sms message
       
    33  *  @param aPriority CActive priority
       
    34  */
       
    35 CSmspCommDbEvent::CSmspCommDbEvent(const TSmsSettings& aSmsSettings, RMobileSmsMessaging& aSmsMessaging, TInt aPriority)
       
    36   : CSmsuActiveBase(aPriority),
       
    37 	iSmsSettings(aSmsSettings),
       
    38 	iSmsMessaging(aSmsMessaging)
       
    39 	{
       
    40 	} // CSmspCommDbEvent::CSmspCommDbEvent
       
    41 
       
    42 
       
    43 CSmspCommDbEvent::~CSmspCommDbEvent()
       
    44 	{
       
    45 	iProperty.Close();
       
    46 	} // CSmspCommDbEvent::~CSmspCommDbEvent
       
    47 
       
    48 
       
    49 void CSmspCommDbEvent::ConstructL()
       
    50 	{
       
    51 	LOGSMSPROT1("CSmspCommDbEvent::ConstructL()");
       
    52 
       
    53 	ConstructTimeoutL();
       
    54 	} // CSmspCommDbEvent::ConstructL
       
    55 
       
    56 
       
    57 /**
       
    58  *  Starts the state machine by requesting the property to notify us when
       
    59  *  the CommDB change event is fired.
       
    60  */
       
    61 void CSmspCommDbEvent::NotifyOnEvent()
       
    62 	{
       
    63 	LOGSMSPROT1("CSmspCommDbEvent::NotifyOnEvent()");
       
    64 
       
    65 	iProperty.Subscribe(iStatus);
       
    66 	SetActive();
       
    67 	} // CSmspCommDbEvent::NotifyOnEvent
       
    68 
       
    69 
       
    70 /**
       
    71  *  Restart notification if there is an error other than KErrCancel
       
    72  *  
       
    73  *  @param aStatus a status value.
       
    74  */
       
    75 void CSmspCommDbEvent::Complete(TInt aError)
       
    76 	{
       
    77 	LOGSMSPROT1("CSmspCommDbEvent::Complete()");
       
    78 
       
    79 	//
       
    80 	// Call the base function to perform the actual complete...
       
    81 	//
       
    82 	CSmsuActiveBase::Complete(aError);
       
    83 
       
    84 	//
       
    85 	// If the request was not cancelled, then restart it...
       
    86 	//
       
    87 	if (aError != KErrCancel  &&  aError != KErrTimedOut)
       
    88 		{
       
    89 		NotifyOnEvent();
       
    90 		}
       
    91 	} // CSmspCommDbEvent::Complete