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 |
// Sms AT Command Base Class Header
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
@internalAll
|
|
21 |
*/
|
|
22 |
|
|
23 |
|
|
24 |
#ifndef __SMSBASE_H__
|
|
25 |
#define __SMSBASE_H__
|
|
26 |
|
|
27 |
#include "ATBASE.H"
|
|
28 |
#include "smsutil.h" // for KMaxAsciiPduLength
|
|
29 |
|
|
30 |
// Constants
|
|
31 |
const TUint KATWriteTimeout=20000; // Is in milli seconds,
|
|
32 |
const TInt KATResponseTimeout=40; // Is in seconds, set to 40 seconds as +CMGS response
|
|
33 |
// can take upto 15 seconds when the GSM network is busy
|
|
34 |
const TUint KCapsCnmiMode1 = 0x02;
|
|
35 |
const TUint KCapsCnmiMode2 = 0x04;
|
|
36 |
const TUint KCapsCnmiMode3 = 0x08;
|
|
37 |
|
|
38 |
class CMobileSmsStore;
|
|
39 |
|
|
40 |
class CATSmsCommands : public CATCommands
|
|
41 |
{
|
|
42 |
public:
|
|
43 |
CATSmsCommands(CATIO* aIo, CTelObject* aTelObject,CATInit* aInit,CPhoneGlobals* aGsmStatus);
|
|
44 |
~CATSmsCommands();
|
|
45 |
|
|
46 |
protected:
|
|
47 |
// from CATBase
|
|
48 |
virtual void EventSignal(TEventSource aEventSource);
|
|
49 |
|
|
50 |
// Request common AT commands be carried out
|
|
51 |
enum TRequest {ENone,
|
|
52 |
EGetSCAFromPhone, ESetSCAInPhone,
|
|
53 |
ESetPhoneToCMTMode,ESetPhoneToCMTIMode};
|
|
54 |
TInt RequestATCommand(TRequest aReq);
|
|
55 |
void RequestATCommandCancel();
|
|
56 |
TRequest RequestATCompleted(); // Sets iRequestCcompleted to EFalse
|
|
57 |
TBool RequestATActive() const;
|
|
58 |
|
|
59 |
// Utility
|
|
60 |
void HandleWriteCompletion(TEventSource aSource);
|
|
61 |
TInt HandleResponseCompletion(TEventSource aSource,TBool aValidateExpectString=ETrue);
|
|
62 |
TInt ParseRxResultsForCSCAResponse(RMobilePhone::TMobileAddress& aTelNumber);
|
|
63 |
TInt DoParseRxResultsForCSCAResponseL(RMobilePhone::TMobileAddress& aTelNumber);
|
|
64 |
TInt CMSErrorValue();
|
|
65 |
TInt ConvertCMSErrorToKErr(const TInt& aCmsError) const;
|
|
66 |
TBool ComparePrefMem(const TStorageType& aName) const;
|
|
67 |
void SetCurrentPrefMem(const TStorageType& aStorageName);
|
|
68 |
|
|
69 |
private:
|
|
70 |
// Request functions
|
|
71 |
TInt GetSCAFromPhone(const TEventSource& aEventSource);
|
|
72 |
TInt SetSCAInPhone(const TEventSource& aEventSource);
|
|
73 |
TInt SetPhoneToCMTMode(const TEventSource& aEventSource);
|
|
74 |
TInt SetPhoneToCMTIMode(const TEventSource& aEventSource);
|
|
75 |
|
|
76 |
// Utility
|
|
77 |
void CompleteRequest(TInt aError=KErrNone);
|
|
78 |
void InitializeRequestData(TRequest aReq);
|
|
79 |
void ProcessCapsElementL(TDblQueIter<CATParamListEntry>& aIter,TInt32& aCapsMask);
|
|
80 |
void ParseCNMIFirstCapabilityL(TInt& aHighestValue);
|
|
81 |
|
|
82 |
protected:
|
|
83 |
TInt iRequestError; //KErr... value set when request completes
|
|
84 |
RMobilePhone::TMobileAddress iRequestSCA; // Used by EGetSCAFromPhone & ESetSCAInPhone
|
|
85 |
|
|
86 |
private:
|
|
87 |
enum { EStage0=0, EStage1, EStage2, EStage3, EStage4, EStage5, EStage6, EStage7 };
|
|
88 |
|
|
89 |
enum
|
|
90 |
{
|
|
91 |
ECnmiMode0,
|
|
92 |
ECnmiMode1,
|
|
93 |
ECnmiMode2,
|
|
94 |
ECnmiMode3
|
|
95 |
};
|
|
96 |
|
|
97 |
TBool iRequestCompleted; //ETrue if, and only if, a request has completed
|
|
98 |
TRequest iRequest;
|
|
99 |
TInt iRequestStage;
|
|
100 |
TBool iRequestCancel;
|
|
101 |
};
|
|
102 |
|
|
103 |
#endif
|