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 |
|
|
20 |
#ifndef _OBEXUTILSPROPERTYNOTIFIER_H
|
|
21 |
#define _OBEXUTILSPROPERTYNOTIFIER_H
|
|
22 |
|
|
23 |
// INCLUDES
|
|
24 |
#include <e32base.h>
|
|
25 |
#include <e32property.h>
|
|
26 |
#include <UikonInternalPSKeys.h>
|
|
27 |
|
|
28 |
// CLASS DECLARATION
|
|
29 |
|
|
30 |
/**
|
|
31 |
Type of memory property check,
|
|
32 |
@param ECheckPhoneMemory, phone memory is checked, default value if not mentioned explicitly.
|
|
33 |
@param ECheckMMCMemory, MMC memory is checked.
|
|
34 |
*/
|
|
35 |
|
|
36 |
enum TMemoryPropertyCheckType
|
|
37 |
{
|
|
38 |
ECheckPhoneMemory,
|
|
39 |
ECheckMMCMemory
|
|
40 |
};
|
|
41 |
|
|
42 |
/**
|
|
43 |
A callback interface for informing content change of disk status. Client must derive
|
|
44 |
from this class and implement HandleNotifyL() method. When disk space will cross warning
|
|
45 |
level or critical level this method will be call back.
|
|
46 |
*/
|
|
47 |
|
|
48 |
NONSHARABLE_CLASS( MObexUtilsPropertyNotifyHandler )
|
|
49 |
{
|
|
50 |
public:
|
|
51 |
/**
|
|
52 |
* Callback method for disk status change
|
|
53 |
* @param aUid UID identifying a shared data file where notify came from.
|
|
54 |
* @param aKey keyword of which value was changed
|
|
55 |
*/
|
|
56 |
virtual void HandleNotifyL( TMemoryPropertyCheckType aCheckType ) =0;
|
|
57 |
};
|
|
58 |
|
|
59 |
NONSHARABLE_CLASS( CObexUtilsPropertyNotifier ) : public CActive
|
|
60 |
{
|
|
61 |
public: // NewL, Constructors and destructor
|
|
62 |
|
|
63 |
/*
|
|
64 |
* Two-phased constructor.
|
|
65 |
* @param aHandler -Pointer to the MObexUtilsPropertyNotifyHandler derived class
|
|
66 |
* @param aCheckType -Constant defining type of memory checking to be done (phone/MMC)
|
|
67 |
* @return CObexUtilsPropertyNotifier* -Initialized object.
|
|
68 |
*/
|
|
69 |
|
|
70 |
IMPORT_C static CObexUtilsPropertyNotifier* NewL(
|
|
71 |
MObexUtilsPropertyNotifyHandler* aHandler,
|
|
72 |
TMemoryPropertyCheckType aCheckType=ECheckPhoneMemory );
|
|
73 |
|
|
74 |
/**
|
|
75 |
* Destructor.
|
|
76 |
*/
|
|
77 |
|
|
78 |
virtual ~CObexUtilsPropertyNotifier();
|
|
79 |
private: // Functions from base classes
|
|
80 |
|
|
81 |
/**
|
|
82 |
* Constructor.
|
|
83 |
* @param aHandler -Pointer to the MObexUtilsPropertyNotifyHandler derived class
|
|
84 |
* @param aCheckType -Constant defining type of memory checking to be done (phone/MMC)
|
|
85 |
*/
|
|
86 |
|
|
87 |
CObexUtilsPropertyNotifier(
|
|
88 |
MObexUtilsPropertyNotifyHandler* aHandler,
|
|
89 |
TMemoryPropertyCheckType aCheckType );
|
|
90 |
|
|
91 |
void ConstructL();
|
|
92 |
|
|
93 |
/**
|
|
94 |
Subscribes to a property and sets active
|
|
95 |
*/
|
|
96 |
void Subscribe();
|
|
97 |
|
|
98 |
/**
|
|
99 |
* From CActive Gets called when CActive::Cancel is called,
|
|
100 |
* cancels disk status watching.
|
|
101 |
*
|
|
102 |
* @param None.
|
|
103 |
* @return None.
|
|
104 |
*/
|
|
105 |
|
|
106 |
void DoCancel();
|
|
107 |
|
|
108 |
/**
|
|
109 |
* From CActive Gets called when content of disk status is changed,
|
|
110 |
* calls MObexUtilsPropertyNotifyHandler::HandleNotify.
|
|
111 |
*
|
|
112 |
* @param None.
|
|
113 |
* @return None.
|
|
114 |
*/
|
|
115 |
|
|
116 |
void RunL();
|
|
117 |
|
|
118 |
private:
|
|
119 |
// Reference to observer
|
|
120 |
MObexUtilsPropertyNotifyHandler* iHandler;
|
|
121 |
// Type of memory check (phone/MMC)
|
|
122 |
TMemoryPropertyCheckType iCheckType;
|
|
123 |
// Database handle
|
|
124 |
RProperty iProperty;
|
|
125 |
};
|
|
126 |
|
|
127 |
#endif // _OBEXUTILSPROPERTYNOTIFIER_H
|