smsprotocols/smsstack/smsprot/Src/smspcdb.cpp
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
child 42 3adadc800673
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/smsprotocols/smsstack/smsprot/Src/smspcdb.cpp	Tue Feb 02 01:41:59 2010 +0200
@@ -0,0 +1,91 @@
+// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Implements the CSmspCommDbEvent class
+// 
+//
+
+/**
+ @file
+*/
+
+#include "smspcdb.h"
+#include "smspmain.h"
+#include "smsuset.h"
+#include "SmsuTimer.h"
+
+
+/**
+ *  Private constructor used in the first phase of construction.
+ *  
+ *  @param aSmsSettings Reference to sms configuration settings
+ *  @param aSmsMessaging Reference to sms message
+ *  @param aPriority CActive priority
+ */
+CSmspCommDbEvent::CSmspCommDbEvent(const TSmsSettings& aSmsSettings, RMobileSmsMessaging& aSmsMessaging, TInt aPriority)
+  : CSmsuActiveBase(aPriority),
+	iSmsSettings(aSmsSettings),
+	iSmsMessaging(aSmsMessaging)
+	{
+	} // CSmspCommDbEvent::CSmspCommDbEvent
+
+
+CSmspCommDbEvent::~CSmspCommDbEvent()
+	{
+	iProperty.Close();
+	} // CSmspCommDbEvent::~CSmspCommDbEvent
+
+
+void CSmspCommDbEvent::ConstructL()
+	{
+	LOGSMSPROT1("CSmspCommDbEvent::ConstructL()");
+
+	ConstructTimeoutL();
+	} // CSmspCommDbEvent::ConstructL
+
+
+/**
+ *  Starts the state machine by requesting the property to notify us when
+ *  the CommDB change event is fired.
+ */
+void CSmspCommDbEvent::NotifyOnEvent()
+	{
+	LOGSMSPROT1("CSmspCommDbEvent::NotifyOnEvent()");
+
+	iProperty.Subscribe(iStatus);
+	SetActive();
+	} // CSmspCommDbEvent::NotifyOnEvent
+
+
+/**
+ *  Restart notification if there is an error other than KErrCancel
+ *  
+ *  @param aStatus a status value.
+ */
+void CSmspCommDbEvent::Complete(TInt aError)
+	{
+	LOGSMSPROT1("CSmspCommDbEvent::Complete()");
+
+	//
+	// Call the base function to perform the actual complete...
+	//
+	CSmsuActiveBase::Complete(aError);
+
+	//
+	// If the request was not cancelled, then restart it...
+	//
+	if (aError != KErrCancel  &&  aError != KErrTimedOut)
+		{
+		NotifyOnEvent();
+		}
+	} // CSmspCommDbEvent::Complete