1 // Copyright (c) 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 // CATGprsContextDelete |
|
15 |
|
16 #include "atgprscontextdelete.h" // header file for this source file |
|
17 #include "mslogger.h" // for LOGTEXT macros |
|
18 |
|
19 _LIT8(KATContextDelete, "AT+CGDCONT=%d\r"); |
|
20 |
|
21 // --------------------------------------------------------------------------- |
|
22 // CATGprsContextDelete::NewL |
|
23 // AT state machine which will send AT+CGDCONT=x to delete a context from the phone. |
|
24 // other items were commented in a header |
|
25 // --------------------------------------------------------------------------- |
|
26 CATGprsContextDelete* CATGprsContextDelete::NewL(CGlobalPhonemanager& aGloblePhone, |
|
27 CCtsyDispatcherCallback& aCtsyDispatcherCallback) |
|
28 { |
|
29 CATGprsContextDelete* self = new(ELeave) CATGprsContextDelete(aGloblePhone, |
|
30 aCtsyDispatcherCallback); |
|
31 CleanupStack::PushL(self ); |
|
32 self->ConstructL(); |
|
33 CleanupStack::Pop(self ); |
|
34 return self ; |
|
35 } |
|
36 |
|
37 // --------------------------------------------------------------------------- |
|
38 // CATGprsContextDelete::CATGprsContextDelete |
|
39 // other items were commented in a header |
|
40 // --------------------------------------------------------------------------- |
|
41 CATGprsContextDelete::CATGprsContextDelete(CGlobalPhonemanager& aGloblePhone, |
|
42 CCtsyDispatcherCallback& aCtsyDispatcherCallback) |
|
43 :CAtCommandBase(aGloblePhone,aCtsyDispatcherCallback) |
|
44 { |
|
45 } |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // CATGprsContextDelete::ConstructL() |
|
49 // other items were commented in a header |
|
50 // --------------------------------------------------------------------------- |
|
51 void CATGprsContextDelete::ConstructL() |
|
52 { |
|
53 CAtCommandBase::ConstructL(); |
|
54 } |
|
55 |
|
56 // --------------------------------------------------------------------------- |
|
57 // CATGprsContextDelete::~CATGprsContextDelete() |
|
58 // other items were commented in a header |
|
59 // --------------------------------------------------------------------------- |
|
60 CATGprsContextDelete::~CATGprsContextDelete() |
|
61 { |
|
62 } |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // CATGprsContextDelete::StartRequest() |
|
66 // other items were commented in a header |
|
67 // --------------------------------------------------------------------------- |
|
68 void CATGprsContextDelete::StartRequest() |
|
69 { |
|
70 ExecuteCommand(); |
|
71 } |
|
72 |
|
73 // --------------------------------------------------------------------------- |
|
74 // CATGprsContextDelete::ExecuteCommand() |
|
75 // other items were commented in a header |
|
76 // --------------------------------------------------------------------------- |
|
77 void CATGprsContextDelete::ExecuteCommand() |
|
78 { |
|
79 LOGTEXT2(_L8("iCid=%d"),iContextId); |
|
80 // Send the AT+CGDCONT=x command to the phone |
|
81 iTxBuffer.Format(KATContextDelete,iContextId); |
|
82 Write(); |
|
83 } |
|
84 |
|
85 // --------------------------------------------------------------------------- |
|
86 // CATGprsContextDelete::SetContext |
|
87 // other items were commented in a header |
|
88 // --------------------------------------------------------------------------- |
|
89 void CATGprsContextDelete::SetContext(const TInt aContextId) |
|
90 { |
|
91 iContextId = aContextId; |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // CATGprsContextDelete::ParseResponseL |
|
96 // other items were commented in a header |
|
97 // --------------------------------------------------------------------------- |
|
98 void CATGprsContextDelete::ParseResponseL(const TDesC8& /*aResponseBuf*/) |
|
99 { |
|
100 if (CurrentLine().Match(KLtsyOkString) == 0) |
|
101 { |
|
102 iError = KErrNone; |
|
103 } |
|
104 else |
|
105 { |
|
106 iError = KErrGeneral; |
|
107 } |
|
108 } |
|
109 |
|
110 // --------------------------------------------------------------------------- |
|
111 // CATGprsContextDelete::EventSignal |
|
112 // other items were commented in a header |
|
113 // --------------------------------------------------------------------------- |
|
114 void CATGprsContextDelete::EventSignal(TAtEventSource aEventSource, TInt aStatus) |
|
115 { |
|
116 if((KErrNone ==aStatus)&&(aEventSource == EWriteCompletion)) |
|
117 { |
|
118 return; |
|
119 } |
|
120 TName Name; |
|
121 if((KErrNone ==aStatus)&&(aEventSource == EReadCompletion)&&(iError==KErrNone)) |
|
122 { |
|
123 TInt count = iPhoneGlobals.iContextList.Count(); |
|
124 TInt i; |
|
125 //Get the context from context list |
|
126 for(i = 0; i < count;i++) |
|
127 { |
|
128 if(iPhoneGlobals.iContextList[i]->iContextID == iContextId) |
|
129 { |
|
130 Name = iPhoneGlobals.iContextList[i]->iInfo.iName; |
|
131 delete iPhoneGlobals.iContextList[i]; |
|
132 iPhoneGlobals.iContextList[i] = NULL; |
|
133 iPhoneGlobals.iContextList.Remove(i); |
|
134 break; |
|
135 } |
|
136 } |
|
137 count = iPhoneGlobals.iContextList.Count(); |
|
138 } |
|
139 iCtsyDispatcherCallback.CallbackPacketServicesDeletePdpContextComp(aStatus,Name); |
|
140 CAtCommandBase::Complete(); |
|
141 iPhoneGlobals.iEventSignalActive = EFalse; |
|
142 } |
|
143 |
|
144 // End of file |
|