|
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 // CATGprsAttach |
|
15 // The execution command is used to attach the MT to, or detach the MT from, the GPRS |
|
16 // service. After the command has completed, the MT remains in V.25ter command state. |
|
17 // If the MT is already in the requested state, the command is ignored and the OK |
|
18 // response is returned. If the requested state cannot be achieved, an ERROR or +CME |
|
19 // ERROR response is returned. Extended error responses are enabled by the +CMEE |
|
20 // command. |
|
21 // Any active PDP contexts will be automatically deactivated when the attachment state |
|
22 // changes to detached. |
|
23 // The read command returns the current GPRS service state. |
|
24 // The test command is used for requesting information on the supported GPRS service |
|
25 // states. |
|
26 // +CGATT= [<state>] |
|
27 // <state>: indicates the state of GPRS attachment |
|
28 // 0 – detached |
|
29 // 1 – attached |
|
30 // Other values are reserved and will result in an ERROR response to the |
|
31 // execution command. |
|
32 // other items were commented in a header |
|
33 // |
|
34 |
|
35 #include "atgprsattach.h" |
|
36 #include "mslogger.h" |
|
37 |
|
38 _LIT8(KAttachCommand, "AT+CGATT=1\r"); |
|
39 |
|
40 // --------------------------------------------------------------------------- |
|
41 // CATGprsAttach::NewL |
|
42 // other items were commented in a header |
|
43 // -------------------------------------------------------------------------- |
|
44 CATGprsAttach* CATGprsAttach::NewL(CGlobalPhonemanager& aGloblePhone, |
|
45 CCtsyDispatcherCallback& aCtsyDispatcherCallback) |
|
46 { |
|
47 CATGprsAttach* self = new(ELeave) CATGprsAttach(aGloblePhone, |
|
48 aCtsyDispatcherCallback); |
|
49 CleanupStack::PushL(self ); |
|
50 self->ConstructL(); |
|
51 CleanupStack::Pop(self ); |
|
52 return self ; |
|
53 } |
|
54 |
|
55 // --------------------------------------------------------------------------- |
|
56 // CATGprsAttach::CATGprsAttach |
|
57 // other items were commented in a header |
|
58 // --------------------------------------------------------------------------- |
|
59 CATGprsAttach::CATGprsAttach(CGlobalPhonemanager& aGloblePhone, |
|
60 CCtsyDispatcherCallback& aCtsyDispatcherCallback) |
|
61 :CAtCommandBase(aGloblePhone,aCtsyDispatcherCallback) |
|
62 { |
|
63 } |
|
64 |
|
65 // --------------------------------------------------------------------------- |
|
66 // CATGprsAttach::ConstructL() |
|
67 // other items were commented in a header |
|
68 // --------------------------------------------------------------------------- |
|
69 void CATGprsAttach::ConstructL() |
|
70 { |
|
71 CAtCommandBase::ConstructL(); |
|
72 } |
|
73 |
|
74 // --------------------------------------------------------------------------- |
|
75 // CATGprsAttach::~CATGprsAttach() |
|
76 // other items were commented in a header |
|
77 // --------------------------------------------------------------------------- |
|
78 CATGprsAttach::~CATGprsAttach() |
|
79 { |
|
80 } |
|
81 |
|
82 // --------------------------------------------------------------------------- |
|
83 // CATGprsAttach::StartRequest() |
|
84 // other items were commented in a header |
|
85 // --------------------------------------------------------------------------- |
|
86 void CATGprsAttach::StartRequest() |
|
87 { |
|
88 ExecuteCommand(); |
|
89 } |
|
90 |
|
91 // --------------------------------------------------------------------------- |
|
92 // CATGprsAttach::ExecuteCommand() |
|
93 // other items were commented in a header |
|
94 // --------------------------------------------------------------------------- |
|
95 void CATGprsAttach::ExecuteCommand() |
|
96 { |
|
97 iTxBuffer.Copy(KAttachCommand); |
|
98 Write(); |
|
99 } |
|
100 |
|
101 // --------------------------------------------------------------------------- |
|
102 // CATGprsAttach::ParseResponseL |
|
103 // other items were commented in a header |
|
104 // --------------------------------------------------------------------------- |
|
105 void CATGprsAttach::ParseResponseL(const TDesC8& /*aResponseBuf*/) |
|
106 { |
|
107 if (CurrentLine().Match(KLtsyOkString) == 0) |
|
108 { |
|
109 iError = KErrNone; |
|
110 } |
|
111 else |
|
112 { |
|
113 iError = KErrGeneral; |
|
114 } |
|
115 } |
|
116 |
|
117 // --------------------------------------------------------------------------- |
|
118 // CATGprsAttach::EventSigna |
|
119 // other items were commented in a header |
|
120 // --------------------------------------------------------------------------- |
|
121 void CATGprsAttach::EventSignal(TAtEventSource aEventSource, TInt aStatus) |
|
122 { |
|
123 if(KErrNone ==aStatus) |
|
124 { |
|
125 if(aEventSource == EReadCompletion) |
|
126 { |
|
127 aStatus = iError; |
|
128 } |
|
129 else |
|
130 return; |
|
131 } |
|
132 iCtsyDispatcherCallback.CallbackPacketServicesPacketAttachComp(aStatus); |
|
133 CAtCommandBase::Complete(); |
|
134 iPhoneGlobals.iEventSignalActive = EFalse; |
|
135 } |
|
136 |
|
137 // |
|
138 // End of file |