author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 06 Jul 2010 15:24:15 +0300 | |
changeset 57 | 62e6d990246c |
parent 35 | 9d8b04ca6939 |
child 80 | e02eb84a14d2 |
permissions | -rw-r--r-- |
35 | 1 |
/* |
2 |
* Copyright (c) 2010 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: Monitors Obex ServiceMan errors. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include "obexsmwatcher.h" |
|
19 |
#include <e32base.h> |
|
20 |
#include <obexservicemanprop.h> |
|
57
62e6d990246c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
21 |
#include "debug.h" |
35 | 22 |
|
23 |
||
24 |
/** |
|
25 |
* @since S60 V5.2 |
|
26 |
*/ |
|
27 |
CObexSMWatcher* CObexSMWatcher::NewL(MObexSMObserver& aObserver) |
|
28 |
{ |
|
57
62e6d990246c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
29 |
LOG_FUNC |
35 | 30 |
|
31 |
CObexSMWatcher* self = new (ELeave) CObexSMWatcher(aObserver); |
|
32 |
CleanupStack::PushL( self); |
|
33 |
self->ConstructL(); |
|
34 |
CleanupStack::Pop(self); |
|
35 |
return self; |
|
36 |
} |
|
37 |
||
38 |
/** |
|
39 |
* |
|
40 |
*/ |
|
41 |
CObexSMWatcher::~CObexSMWatcher() |
|
42 |
{ |
|
43 |
LOG_FUNC |
|
44 |
Cancel(); |
|
45 |
iObexSMPostInit.Close(); |
|
46 |
} |
|
47 |
||
48 |
/** |
|
49 |
* Performs 2nd phase construction. |
|
50 |
*/ |
|
51 |
void CObexSMWatcher::ConstructL() |
|
52 |
{ |
|
53 |
LOG_FUNC |
|
54 |
||
55 |
TInt err = iObexSMPostInit.Attach(KUidObexSMCategory, KObexSMPostInitErrorProperty); |
|
56 |
User::LeaveIfError( err); |
|
57 |
||
58 |
RunL(); |
|
59 |
} |
|
60 |
||
61 |
/** |
|
62 |
* |
|
63 |
*/ |
|
64 |
||
65 |
CObexSMWatcher::CObexSMWatcher(MObexSMObserver& aObserver) : |
|
66 |
CActive(CActive::EPriorityStandard), iObserver(aObserver) |
|
67 |
{ |
|
68 |
LOG_FUNC |
|
69 |
CActiveScheduler::Add(this); |
|
70 |
} |
|
71 |
||
72 |
/** |
|
73 |
* |
|
74 |
*/ |
|
75 |
void CObexSMWatcher::RunL() |
|
76 |
{ |
|
77 |
LOG_FUNC |
|
78 |
||
57
62e6d990246c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
79 |
LOG1("iStatus=%d", iStatus.Int()); |
35 | 80 |
|
81 |
iObexSMPostInit.Subscribe( iStatus ); |
|
82 |
SetActive(); |
|
83 |
||
84 |
TInt value = KErrNone; |
|
85 |
TInt err = iObexSMPostInit.Get(value); |
|
86 |
if (err == KErrNone && value != KErrNone) |
|
87 |
{ |
|
88 |
iObserver.MosmError(value); |
|
57
62e6d990246c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
89 |
} |
62e6d990246c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
35
diff
changeset
|
90 |
|
35 | 91 |
} |
92 |
||
93 |
/** |
|
94 |
* |
|
95 |
*/ |
|
96 |
void CObexSMWatcher::DoCancel() |
|
97 |
{ |
|
98 |
LOG_FUNC |
|
99 |
iObexSMPostInit.Cancel(); |
|
100 |
} |