|
1 // Copyright (c) 2004-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 // CSimNetStatChange.CPP |
|
15 // |
|
16 // |
|
17 |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <e32cons.h> |
|
21 #include <e32property.h> |
|
22 #include "CSimQoSChange.h" |
|
23 |
|
24 |
|
25 CSimQoSChange::CSimQoSChange(MQoSChangeCallBack* aCallback, CSimPubSub::TPubSubProperty aProperty) |
|
26 : CActive(EPriorityStandard), iPSProperty(aProperty), iCallback(aCallback) |
|
27 { |
|
28 CActiveScheduler::Add(this); |
|
29 } |
|
30 |
|
31 CSimQoSChange* CSimQoSChange::NewL(MQoSChangeCallBack* aCallback, CSimPubSub::TPubSubProperty aProperty) |
|
32 { |
|
33 CSimQoSChange* self = new (ELeave) CSimQoSChange(aCallback, aProperty); |
|
34 CleanupStack::PushL(self); |
|
35 self->ConstructL(); |
|
36 CleanupStack::Pop(self); |
|
37 return self; |
|
38 } |
|
39 |
|
40 void CSimQoSChange::ConstructL() |
|
41 { |
|
42 iProp.Attach(iPSProperty.iCategory, iPSProperty.iKey); |
|
43 iProp.Subscribe(iStatus); |
|
44 SetActive(); |
|
45 } |
|
46 |
|
47 CSimQoSChange::~CSimQoSChange() |
|
48 { |
|
49 Cancel(); |
|
50 iProp.Close(); |
|
51 } |
|
52 |
|
53 void CSimQoSChange::RunL() |
|
54 { |
|
55 //Resubscribe before retrieving the value so we don't miss any changes |
|
56 TInt status = iStatus.Int(); |
|
57 iProp.Subscribe(iStatus); |
|
58 SetActive(); |
|
59 |
|
60 if(status == KErrNone) |
|
61 { |
|
62 TInt newStat; |
|
63 TInt ret = iProp.Get(iPSProperty.iCategory, iPSProperty.iKey, newStat); |
|
64 if (ret == KErrNone) |
|
65 { |
|
66 iCallback->QoSChangeCallBack(newStat); |
|
67 } |
|
68 } |
|
69 } |
|
70 |
|
71 void CSimQoSChange::DoCancel() |
|
72 { |
|
73 iProp.Cancel(); |
|
74 } |
|
75 |