45
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
* Initial Contributors:
|
|
9 |
* Nokia Corporation - initial contribution.
|
|
10 |
*
|
|
11 |
* Contributors:
|
|
12 |
* Description :
|
|
13 |
*
|
|
14 |
*/
|
|
15 |
|
|
16 |
#include "cgsncommandhandler.h"
|
|
17 |
|
|
18 |
#include "atmisccmdpluginconsts.h"
|
|
19 |
#include "debug.h"
|
|
20 |
|
|
21 |
CCGSNCommandHandler* CCGSNCommandHandler::NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone)
|
|
22 |
{
|
|
23 |
TRACE_FUNC_ENTRY
|
|
24 |
CCGSNCommandHandler* self = new (ELeave) CCGSNCommandHandler(aCallback, aATCmdParser, aPhone);
|
|
25 |
CleanupStack::PushL(self);
|
|
26 |
self->ConstructL();
|
|
27 |
CleanupStack::Pop(self);
|
|
28 |
TRACE_FUNC_EXIT
|
|
29 |
return self;
|
|
30 |
}
|
|
31 |
|
|
32 |
CCGSNCommandHandler::CCGSNCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone) :
|
|
33 |
CATCmdSyncBase(aCallback, aATCmdParser, aPhone)
|
|
34 |
{
|
|
35 |
TRACE_FUNC_ENTRY
|
|
36 |
TRACE_FUNC_EXIT
|
|
37 |
}
|
|
38 |
|
|
39 |
void CCGSNCommandHandler::ConstructL()
|
|
40 |
{
|
|
41 |
TRACE_FUNC_ENTRY
|
|
42 |
iTelError = KErrNone;
|
|
43 |
iReply.CreateL(KDefaultCmdBufLength);
|
|
44 |
TRACE_FUNC_EXIT
|
|
45 |
}
|
|
46 |
|
|
47 |
CCGSNCommandHandler::~CCGSNCommandHandler()
|
|
48 |
{
|
|
49 |
TRACE_FUNC_ENTRY
|
|
50 |
iReply.Close();
|
|
51 |
TRACE_FUNC_EXIT
|
|
52 |
}
|
|
53 |
|
|
54 |
void CCGSNCommandHandler::HandleCommand(const TDesC8& /*aCmd*/, RBuf8& /*aReply*/, TBool /*aReplyNeeded*/)
|
|
55 |
{
|
|
56 |
TRACE_FUNC_ENTRY
|
|
57 |
|
|
58 |
TAtCommandParser::TCommandHandlerType cmdHandlerType = iATCmdParser.CommandHandlerType();
|
|
59 |
|
|
60 |
switch (cmdHandlerType)
|
|
61 |
{
|
|
62 |
case (TAtCommandParser::ECmdHandlerTypeTest):
|
|
63 |
{
|
|
64 |
iCallback->CreateReplyAndComplete( EReplyTypeOk );
|
|
65 |
break;
|
|
66 |
}
|
|
67 |
case (TAtCommandParser::ECmdHandlerTypeBase):
|
|
68 |
{
|
|
69 |
if(iTelError == KErrNone)
|
|
70 |
{
|
|
71 |
if (iReply.Length() == 0)
|
|
72 |
{
|
|
73 |
iReply.Append( KCRLF );
|
|
74 |
iReply.Append( iSN );
|
|
75 |
iReply.Append( KCRLF );
|
|
76 |
}
|
|
77 |
|
|
78 |
iCallback->CreateReplyAndComplete( EReplyTypeOk, iReply);
|
|
79 |
}
|
|
80 |
else
|
|
81 |
{
|
|
82 |
iCallback->CreateCMEReplyAndComplete(iTelError);
|
|
83 |
}
|
|
84 |
break;
|
|
85 |
}
|
|
86 |
default:
|
|
87 |
{
|
|
88 |
iCallback->CreateReplyAndComplete(EReplyTypeError);
|
|
89 |
break;
|
|
90 |
}
|
|
91 |
}
|
|
92 |
|
|
93 |
TRACE_FUNC_EXIT
|
|
94 |
}
|
|
95 |
|
|
96 |
void CCGSNCommandHandler::SetSerialNum(const TDesC8& aSerial)
|
|
97 |
{
|
|
98 |
TRACE_FUNC_ENTRY
|
|
99 |
ASSERT( aSerial.Length() <= CTelephony::KPhoneSerialNumberSize );
|
|
100 |
iSN.Zero();
|
|
101 |
iSN.Copy(aSerial);
|
|
102 |
TRACE_FUNC_EXIT
|
|
103 |
}
|
|
104 |
|
|
105 |
void CCGSNCommandHandler::SetTelephonyError(TInt aTelError)
|
|
106 |
{
|
|
107 |
TRACE_FUNC_ENTRY
|
|
108 |
iTelError = aTelError;
|
|
109 |
TRACE_FUNC_EXIT
|
|
110 |
}
|
|
111 |
|
|
112 |
|