|
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 // implementation for service change notifier |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 #include <e32def.h> |
|
24 |
|
25 #include "cservicechangenotifier.h" |
|
26 #include "PDPFSM.h" |
|
27 #include "spudteldebuglogger.h" |
|
28 #include "pdpfsmnmspace.h" |
|
29 |
|
30 #include <pcktcs.h> |
|
31 |
|
32 /** c'tor |
|
33 |
|
34 @param aPacketService - reference to packet service |
|
35 @param aPdpFsmInterface - reference to pdp fsm interface |
|
36 */ |
|
37 CServiceChangeNotifier::CServiceChangeNotifier(RPacketService& aPacketService, |
|
38 CPdpFsmInterface& aPdpFsmInterface) |
|
39 : CEtelDriverNotifier(aPdpFsmInterface), |
|
40 iPacketService(aPacketService), |
|
41 iServiceStatus(RPacketService::EStatusUnattached) |
|
42 { |
|
43 } |
|
44 |
|
45 CServiceChangeNotifier::~CServiceChangeNotifier() |
|
46 { |
|
47 Cancel(); |
|
48 } |
|
49 |
|
50 /** initiates notification */ |
|
51 void CServiceChangeNotifier::Start() |
|
52 { |
|
53 if (!IsActive()) |
|
54 { |
|
55 iPacketService.NotifyStatusChange(iStatus, iServiceStatus); |
|
56 SetActive(); |
|
57 } |
|
58 } |
|
59 |
|
60 /** notifies pdp fsm |
|
61 |
|
62 @param aStatus - request status |
|
63 */ |
|
64 void CServiceChangeNotifier::Notify(const TRequestStatus& aStatus) |
|
65 { |
|
66 if(aStatus == KErrNone) |
|
67 { |
|
68 SPUDTELVERBOSE_INFO_LOG(_L("FSM set ServiceStatus")); |
|
69 iPdpFsmInterface.Set(iServiceStatus); |
|
70 SPUDTELVERBOSE_INFO_LOG(_L("FSM input EServiceStatusChangeNetwork")); |
|
71 iPdpFsmInterface.Input(KAllContexts, |
|
72 PdpFsm::EServiceStatusChangeNetwork); |
|
73 } |
|
74 else |
|
75 { |
|
76 SPUDTEL_ERROR_LOG(_L("CServiceChangeNotifier::Notify(), error: %d"), |
|
77 aStatus.Int()); |
|
78 ASSERT(aStatus == KErrCancel); |
|
79 } |
|
80 } |
|
81 |
|
82 /** cancels notification */ |
|
83 void CServiceChangeNotifier::DoCancel() |
|
84 { |
|
85 if(IsActive()) |
|
86 { |
|
87 SPUDTELVERBOSE_INFO_LOG( |
|
88 _L("CServiceChangeNotifier::DoCancel EPacketNotifyStatusChange")); |
|
89 iPacketService.CancelAsyncRequest(EPacketNotifyStatusChange); |
|
90 } |
|
91 } |