44
|
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 |
// @file smsatutil.h
|
|
15 |
// This contains SmsAtUtil which is util for Sms At command
|
|
16 |
//
|
|
17 |
|
|
18 |
#ifndef SMSATUTIL_H
|
|
19 |
#define SMSATUTIL_H
|
|
20 |
// system include
|
|
21 |
#include <e32std.h>
|
|
22 |
#include <e32base.h>
|
|
23 |
#include <etelmm.h>
|
|
24 |
|
|
25 |
|
|
26 |
/**
|
|
27 |
* SmsAtUtil
|
|
28 |
*
|
|
29 |
*/
|
|
30 |
class SmsAtUtil : public CBase
|
|
31 |
{
|
|
32 |
public:
|
|
33 |
|
|
34 |
/**
|
|
35 |
* Converts aAscii ASCII chars to Semi Octets in aData.
|
|
36 |
* One ASCII char (8bits in aAscii) is translated to one Semi-Octet (4bits in aData).
|
|
37 |
*
|
|
38 |
* @param aAscii input ascii string
|
|
39 |
* @param aData output binary data
|
|
40 |
* @return Standard KErr... values
|
|
41 |
*/
|
|
42 |
static TInt ConvertAsciiToBinary(const TDesC8& aAscii,TDes8& aData);
|
|
43 |
|
|
44 |
/**
|
|
45 |
* Default operation is to code Address-Length according to=
|
|
46 |
* 04.11 spec (ie. Address-Length=number of digits in Address-Value).
|
|
47 |
* Append this sca adress to the ascii string
|
|
48 |
*
|
|
49 |
* @param aAscii an ascii string
|
|
50 |
* @param aAddress a SCA adress
|
|
51 |
* @return Standard KErr... values
|
|
52 |
*/
|
|
53 |
static TInt AppendAddressToAscii(TDes8& aAscii,const RMobilePhone::TMobileAddress& aAddress);
|
|
54 |
|
|
55 |
/**
|
|
56 |
* Appends the binary data (aData) onto the end of an ASCII string (aAscii) in ASCII format.
|
|
57 |
*
|
|
58 |
* @param aAscii an ascii string
|
|
59 |
* @param aData a binary string
|
|
60 |
*/
|
|
61 |
static void AppendDataToAscii(TDes8& aAscii,const TDesC8& aData);
|
|
62 |
|
|
63 |
/**
|
|
64 |
* Reads an address from the front of the ASCII string (aAscii) and fills up Address structure (aAddress).
|
|
65 |
* The address read from the ASCII string is removed from the ASCII string.
|
|
66 |
*
|
|
67 |
* @param aAscii an ascii string
|
|
68 |
* @param aAddress a SCA address
|
|
69 |
* @return Standard KErr... values
|
|
70 |
*/
|
|
71 |
static TInt ReadAndRemoveAddressFromAscii(TDes8& aAscii,RMobilePhone::TMobileAddress& aAddress);
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Default operation assumes has prefixed SCA which uses 04.11 format
|
|
75 |
* (ie. Address-Length=number of digits in Address-Value).
|
|
76 |
*
|
|
77 |
* @param aAscii an ascii string
|
|
78 |
* @param aAddress a SCA address
|
|
79 |
* @return Standard KErr... values
|
|
80 |
*/
|
|
81 |
static TInt ReadAddressFromAscii(const TDesC8& aAscii,RMobilePhone::TMobileAddress& aAddress);
|
|
82 |
|
|
83 |
/**
|
|
84 |
* get the SCA field in the aAscii structure from the SCA prepended in the PDU sring .
|
|
85 |
*
|
|
86 |
* @param aPdu a PDU string
|
|
87 |
* @param aAddress a SCA address
|
|
88 |
*/
|
|
89 |
static void ReadAndRemoveAddressFromPdu(TPtrC8& aPdu, RMobilePhone::TMobileAddress& aGsmServiceCentre);
|
|
90 |
/**
|
|
91 |
* Judge whether a char is an address char
|
|
92 |
*
|
|
93 |
* @param aChar
|
|
94 |
* @return ETrue if, and only if, the given ASCII charcater
|
|
95 |
* is valid as an ASCII address character.
|
|
96 |
*/
|
|
97 |
static TBool IsAddressChar(TChar aChar);
|
|
98 |
|
|
99 |
private:
|
|
100 |
|
|
101 |
/**
|
|
102 |
* @param aValue should be an ETSI Numbering-Plan-Identification field
|
|
103 |
* @return The equivalent RMobilePhone::TMobileNPI value for aValue
|
|
104 |
*/
|
|
105 |
static RMobilePhone::TMobileNPI ConvertNumberingPlan(TInt aValue);
|
|
106 |
|
|
107 |
/**
|
|
108 |
* @param aValue should be an ETSI Type-Of-Number field
|
|
109 |
* @return The equivalent RMobilePhone::TMobileTON value for aValue
|
|
110 |
*/
|
|
111 |
static RMobilePhone::TMobileTON ConvertTypeOfNumber(TInt aValue);
|
|
112 |
|
|
113 |
/**
|
|
114 |
* Converts a TInt octet value into ASCII representation and then appends that
|
|
115 |
* ASCII representation to the end of the given ASCII string.
|
|
116 |
*
|
|
117 |
* @param aOctet the octet value to append
|
|
118 |
* @param aAscii the ASCII string to which aOctet value should be appended
|
|
119 |
*/
|
|
120 |
static void AppendOctet(TInt aOctet,TDes8& aAscii);
|
|
121 |
|
|
122 |
/**
|
|
123 |
* Returns the equivalent numeric value for a given ASCII address character.
|
|
124 |
*
|
|
125 |
* @param aChar the address character to be converted
|
|
126 |
* @return The numeric value equivalent of the given address character.
|
|
127 |
*/
|
|
128 |
static TInt ConvertAddressChar(TChar aChar);
|
|
129 |
|
|
130 |
/**
|
|
131 |
* Returns the equivalent ASCII address character for a given address value.
|
|
132 |
*
|
|
133 |
* @param aBinary the numerix value of the address character to be returned
|
|
134 |
* @return The ASCII charcater which represents the given address numeric value.
|
|
135 |
*/
|
|
136 |
static TChar ConvertAddressChar(TInt aBinary);
|
|
137 |
|
|
138 |
};
|
|
139 |
|
|
140 |
#endif // SMSATUTIL_H
|