24
|
1 |
// Copyright (c) 1997-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 |
//
|
|
15 |
|
|
16 |
#include <etelmm.h> // MultiMode Etel API
|
|
17 |
#include "set_cbst.h" // Header file for this file
|
|
18 |
#include "mSLOGGER.H" // For LOGTEXT macros
|
|
19 |
#include "ATIO.H" // For CATIO class
|
|
20 |
#include "Matstd.h" // For KCBSTResponseString
|
|
21 |
#include "CALL.H" // For CCallHayes
|
|
22 |
|
|
23 |
//
|
|
24 |
// Macro for logging
|
|
25 |
#ifdef __LOGDEB__
|
|
26 |
_LIT8(KLogEntry,"CATSetCBST::%S\t%S");
|
|
27 |
#define LOCAL_LOGTEXT(function,text) {_LIT8(F,function);_LIT8(T,text);LOGTEXT3(KLogEntry,&F,&T);}
|
|
28 |
#else
|
|
29 |
#define LOCAL_LOGTEXT(function,text)
|
|
30 |
#endif
|
|
31 |
|
|
32 |
|
|
33 |
CATSetCBST* CATSetCBST::NewL(CATIO* aIo, CTelObject* aTelObject,CATInit* aInit,CPhoneGlobals* aPhoneGlobals)
|
|
34 |
{
|
|
35 |
CATSetCBST* self=new(ELeave) CATSetCBST(aIo, aTelObject, aInit,aPhoneGlobals);
|
|
36 |
CleanupStack::PushL(self);
|
|
37 |
self->ConstructL();
|
|
38 |
CleanupStack::Pop();
|
|
39 |
return self;
|
|
40 |
}
|
|
41 |
|
|
42 |
CATSetCBST::CATSetCBST(CATIO* aIo, CTelObject* aTelObject,CATInit* aInit,CPhoneGlobals* aPhoneGlobals)
|
|
43 |
: CATCommands(aIo,aTelObject,aInit,aPhoneGlobals)
|
|
44 |
{}
|
|
45 |
|
|
46 |
|
|
47 |
void CATSetCBST::Stop(TTsyReqHandle)
|
|
48 |
{
|
|
49 |
// The CATSetCBST AT command can not be cancelled
|
|
50 |
}
|
|
51 |
|
|
52 |
|
|
53 |
void CATSetCBST::CompleteWithIOError(TEventSource /*aSource*/,TInt aStatus)
|
|
54 |
{
|
|
55 |
if (iState!=EATNotInProgress)
|
|
56 |
{
|
|
57 |
iState = EATNotInProgress;
|
|
58 |
iIo->WriteAndTimerCancel(this);
|
|
59 |
REINTERPRET_CAST(CCallHayes*,iTelObject)->SetToIdleAndCompleteReq(iReqHandle,aStatus);
|
|
60 |
}
|
|
61 |
}
|
|
62 |
|
|
63 |
void CATSetCBST::Start(TTsyReqHandle aTsyReqHandle, TAny* aNextCmdToExecute)
|
|
64 |
{
|
|
65 |
LOCAL_LOGTEXT("Start","Enter function");
|
|
66 |
|
|
67 |
iReqHandle = aTsyReqHandle;
|
|
68 |
iNextCmdToExecute=(CATCommands*)aNextCmdToExecute;
|
|
69 |
|
|
70 |
//
|
|
71 |
// Assemble and send (if required) the +CBST=... string to the phone
|
|
72 |
// to configure the settings for the next data call.
|
|
73 |
// Use utility function provided by CCallMobileData
|
|
74 |
CCallMobileData* parent=static_cast<CCallMobileData*>(iTelObject);
|
|
75 |
if(parent->AssembleCBSTSetString(iTxBuffer)==KErrNone)
|
|
76 |
{
|
|
77 |
//
|
|
78 |
// Send our AT command to the phone
|
|
79 |
iIo->Write(this,iTxBuffer);
|
|
80 |
iIo->SetTimeOut(this);
|
|
81 |
iState=EWaitForWriteComplete;
|
|
82 |
}
|
|
83 |
else
|
|
84 |
{
|
|
85 |
// We have not sent a +CBST= to the phone, so complete now
|
|
86 |
LOCAL_LOGTEXT("Start","Not enough parameters to send +CBST= command");
|
|
87 |
Complete(KErrNone,EReadCompletion); // This is not a read completeion, but pretend it is
|
|
88 |
}
|
|
89 |
}
|
|
90 |
|
|
91 |
|
|
92 |
void CATSetCBST::EventSignal(TEventSource aSource)
|
|
93 |
{
|
|
94 |
LOGTEXT2(_L8("CATSetCBST::EventSignal with iState %d"),iState);
|
|
95 |
if (aSource==ETimeOutCompletion && iState!=EATNotInProgress)
|
|
96 |
{
|
|
97 |
LOCAL_LOGTEXT("EventSignal","Timeout event");
|
|
98 |
iIo->RemoveExpectStrings(this);
|
|
99 |
iState = EATNotInProgress;
|
|
100 |
Complete(KErrTimedOut,aSource);
|
|
101 |
return;
|
|
102 |
}
|
|
103 |
|
|
104 |
switch(iState)
|
|
105 |
{
|
|
106 |
case EWaitForWriteComplete:
|
|
107 |
__ASSERT_ALWAYS(aSource==EWriteCompletion,Panic(EATCommand_IllegalCompletionWriteExpected));
|
|
108 |
iIo->WriteAndTimerCancel(this);
|
|
109 |
StandardWriteCompletionHandler(aSource, 5);
|
|
110 |
iState=EWaitForReadComplete;
|
|
111 |
break;
|
|
112 |
|
|
113 |
case EWaitForReadComplete:
|
|
114 |
__ASSERT_ALWAYS(aSource==EReadCompletion,Panic(EATCommand_IllegalCompletionWaitExpected));
|
|
115 |
iIo->WriteAndTimerCancel(this);
|
|
116 |
// There is no need to validate the response from the modem
|
|
117 |
// as we are going to ignore it anyway.
|
|
118 |
Complete(KErrNone,aSource);
|
|
119 |
break;
|
|
120 |
|
|
121 |
default: // Required to avoid warnings in ARMI UREL build
|
|
122 |
break;
|
|
123 |
}
|
|
124 |
}
|
|
125 |
|
|
126 |
|
|
127 |
void CATSetCBST::Complete(TInt aError,TEventSource aSource)
|
|
128 |
{
|
|
129 |
LOCAL_LOGTEXT("Complete","Enter function");
|
|
130 |
|
|
131 |
iIo->WriteAndTimerCancel(this);
|
|
132 |
iIo->RemoveExpectStrings(this);
|
|
133 |
|
|
134 |
// If we have been asked to kick off another AT state machine,
|
|
135 |
// then do it here. Otherwise complete the client request as normal.
|
|
136 |
if(iNextCmdToExecute)
|
|
137 |
{
|
|
138 |
LOCAL_LOGTEXT("Complete","Starting next AT command");
|
|
139 |
|
|
140 |
// We have to change the iEventSignalActive manually as we are not calling
|
|
141 |
// CATCommands::Complete. It is safe to do this as we know we have fisnihed
|
|
142 |
// our processing.
|
|
143 |
iPhoneGlobals->iEventSignalActive = EFalse;
|
|
144 |
|
|
145 |
iNextCmdToExecute->ExecuteCommand(iReqHandle,NULL,iCallInfo);
|
|
146 |
}
|
|
147 |
else
|
|
148 |
{
|
|
149 |
LOCAL_LOGTEXT("Complete","No need to start antoher AT command");
|
|
150 |
CATCommands::Complete(aError,aSource);
|
|
151 |
// This state machine should never complete a client request.
|
|
152 |
// There is no 'send CBST to phone' client request, this state machine
|
|
153 |
// is used as part of processing other client requests (eg. AnswerIncomingCall).
|
|
154 |
}
|
|
155 |
|
|
156 |
iState = EATNotInProgress;
|
|
157 |
}
|