32
|
1 |
/*
|
|
2 |
* Copyright (c) 2004 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: Declares disk status watcher class for ObexUtils.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
|
|
21 |
#include "obexutilspropertynotifier.h"
|
|
22 |
#include "obexutilsdebug.h"
|
|
23 |
|
|
24 |
// ================= MEMBER FUNCTIONS =======================
|
|
25 |
|
|
26 |
|
|
27 |
EXPORT_C CObexUtilsPropertyNotifier* CObexUtilsPropertyNotifier::NewL(
|
|
28 |
MObexUtilsPropertyNotifyHandler* aHandler,
|
|
29 |
TMemoryPropertyCheckType aCheckType )
|
|
30 |
{
|
|
31 |
FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::NewL()"));
|
|
32 |
CObexUtilsPropertyNotifier* self=new(ELeave) CObexUtilsPropertyNotifier(aHandler, aCheckType);
|
|
33 |
CleanupStack::PushL(self);
|
|
34 |
self->ConstructL();
|
|
35 |
CleanupStack::Pop(self);
|
|
36 |
FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::NewL() completed"));
|
|
37 |
return self;
|
|
38 |
}
|
|
39 |
|
|
40 |
// ---------------------------------------------------------
|
|
41 |
// CObexUtilsPropertyNotifier::CObexUtilsPropertyNotifier
|
|
42 |
// C++ default constructor can NOT contain any code, that
|
|
43 |
// might leave.
|
|
44 |
// ---------------------------------------------------------
|
|
45 |
//
|
|
46 |
CObexUtilsPropertyNotifier::CObexUtilsPropertyNotifier(
|
|
47 |
MObexUtilsPropertyNotifyHandler* aHandler,
|
|
48 |
TMemoryPropertyCheckType aCheckType )
|
|
49 |
: CActive( EPriorityNormal ), iHandler ( aHandler ), iCheckType ( aCheckType )
|
|
50 |
{
|
|
51 |
CActiveScheduler::Add(this);
|
|
52 |
FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::CObexUtilsPropertyNotifier() completed"));
|
|
53 |
}
|
|
54 |
|
|
55 |
// ---------------------------------------------------------
|
|
56 |
// Destructor.
|
|
57 |
// ---------------------------------------------------------
|
|
58 |
//
|
|
59 |
CObexUtilsPropertyNotifier::~CObexUtilsPropertyNotifier()
|
|
60 |
{
|
|
61 |
Cancel();
|
|
62 |
iProperty.Close();
|
|
63 |
FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::~CObexUtilsPropertyNotifier() completed"));
|
|
64 |
}
|
|
65 |
|
|
66 |
// ---------------------------------------------------------
|
|
67 |
// CObexUtilsPropertyNotifier::ConstructL
|
|
68 |
// ---------------------------------------------------------
|
|
69 |
//
|
|
70 |
void CObexUtilsPropertyNotifier::ConstructL()
|
|
71 |
{
|
|
72 |
FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::ConstructL()"));
|
|
73 |
if (iCheckType == ECheckPhoneMemory)
|
|
74 |
{
|
|
75 |
FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::ConstructL() Phone"));
|
|
76 |
User::LeaveIfError(iProperty.Attach(KPSUidUikon,KUikFFSFreeLevel));
|
|
77 |
}
|
|
78 |
else
|
|
79 |
{
|
|
80 |
FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::ConstructL() MMC"));
|
|
81 |
User::LeaveIfError(iProperty.Attach(KPSUidUikon,KUikMmcFFSFreeLevel));
|
|
82 |
}
|
|
83 |
Subscribe();
|
|
84 |
FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::ConstructL() completed"));
|
|
85 |
}
|
|
86 |
|
|
87 |
// ---------------------------------------------------------
|
|
88 |
// CObexUtilsPropertyNotifier::Subscribe
|
|
89 |
// ---------------------------------------------------------
|
|
90 |
//
|
|
91 |
void CObexUtilsPropertyNotifier::Subscribe()
|
|
92 |
{
|
|
93 |
iProperty.Subscribe(iStatus);
|
|
94 |
SetActive();
|
|
95 |
FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::Subscribe() completed"));
|
|
96 |
}
|
|
97 |
|
|
98 |
// ---------------------------------------------------------
|
|
99 |
// CObexUtilsPropertyNotifier::DoCancel
|
|
100 |
// ---------------------------------------------------------
|
|
101 |
//
|
|
102 |
void CObexUtilsPropertyNotifier::DoCancel()
|
|
103 |
{
|
|
104 |
FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::DoCancel()"));
|
|
105 |
iProperty.Cancel();
|
|
106 |
}
|
|
107 |
|
|
108 |
// ---------------------------------------------------------
|
|
109 |
// CObexUtilsPropertyNotifier::RunL
|
|
110 |
// ---------------------------------------------------------
|
|
111 |
//
|
|
112 |
void CObexUtilsPropertyNotifier::RunL()
|
|
113 |
{
|
|
114 |
FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::RunL()"));
|
|
115 |
|
|
116 |
Subscribe();
|
|
117 |
|
|
118 |
TInt memorystatus;
|
|
119 |
if ((iProperty.Get(memorystatus)!=KErrNotFound) && (memorystatus!=0))
|
|
120 |
{
|
|
121 |
FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::RunL() notify"));
|
|
122 |
TRAPD(retTrap, iHandler->HandleNotifyL( iCheckType ));
|
|
123 |
retTrap = retTrap;
|
|
124 |
FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::RunL() notify completed"));
|
|
125 |
}
|
|
126 |
FLOG(_L("[OBEXUTILS]\t CObexUtilsPropertyNotifier::RunL() completed"));
|
|
127 |
}
|