telephonyserverplugins/attestltsy/atcommand/sms/src/smsatutil.cpp
author Tom Pritchard <tomp@symbian.org>
Tue, 09 Feb 2010 12:31:43 +0000
branchAT_Test_LTSY
changeset 1 4047d69ee0e4
permissions -rw-r--r--
Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     1
// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     2
// All rights reserved.
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     3
// This component and the accompanying materials are made available
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     5
// which accompanies this distribution, and is available
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     7
//
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     8
// Initial Contributors:
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    10
//
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    11
// Contributors:
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    12
//
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    13
// Description:
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    14
// @file smsatutil.cpp
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    15
// This contains SmsAtUtil which is util for Sms At command
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    16
// 
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    17
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    18
// user include
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    19
#include "smsatutil.h"
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    20
#include "ltsycommondefine.h"
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    21
#include "panic.h"
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    22
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    23
/**
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    24
 * Receive PDU example 
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    25
 * 0891683108200805F0040D91683188902848F4000850208151754500108FD9662F4E0067616D4B8BD577ED4FE1
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    26
 * 08 ocet length including 91
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    27
 * 91 Identify Address Type
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    28
 * 683108200805F0 SCA address
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    29
 * 04
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    30
 * 0D91683188902848F4
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    31
 * 00
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    32
 * 08
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    33
 * 50208151754500
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    34
 * 10   
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    35
 * 8FD9662F4E0067616D4B8BD577ED4FE1
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    36
 */
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    37
// ---------------------------------------------------------------------------
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    38
// SmsAtUtil::ConvertAsciiToBinary
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    39
// other items were commented in a header
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    40
// ---------------------------------------------------------------------------
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    41
TInt SmsAtUtil::ConvertAsciiToBinary(const TDesC8& aAscii,TDes8& aData)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    42
	{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    43
	aData.Zero();
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    44
	TLex8 lex;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    45
	TUint8 val;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    46
	TInt ret;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    47
	const TInt count(aAscii.Length());
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    48
	for(TInt i = 0;i < count;i = i + 2)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    49
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    50
		lex = aAscii.Mid(i,2);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    51
		ret = lex.Val(val,EHex);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    52
		if(ret != KErrNone)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    53
			{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    54
			return ret;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    55
			}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    56
		aData.Append(val);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    57
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    58
	return KErrNone;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    59
	}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    60
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    61
// -------------------------------------------------------------------------------
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    62
// SmsAtUtil::AppendAddressToAscii
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    63
// other items were commented in a header
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    64
// -------------------------------------------------------------------------------
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    65
TInt SmsAtUtil::AppendAddressToAscii(TDes8& aAscii,
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    66
		                             const RMobilePhone::TMobileAddress& aAddress)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    67
	{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    68
	// Duplicate tel number, removing all the weird chars
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    69
	TBuf<RMobilePhone::KMaxMobileTelNumberSize> telNumber;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    70
	const TInt count(aAddress.iTelNumber.Length());
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    71
	// Validate the size of the supplied SCA
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    72
    if(count >= RMobilePhone::KMaxMobileTelNumberSize)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    73
    	{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    74
    	return KErrOverflow;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    75
    	}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    76
	TInt i;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    77
	for(i = 0;i < count;++i)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    78
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    79
		if(IsAddressChar(TChar(aAddress.iTelNumber[i])))
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    80
			telNumber.Append(aAddress.iTelNumber[i]);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    81
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    82
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    83
	const TInt telNumberLength(telNumber.Length());
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    84
	
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    85
	// Code Address-Length
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    86
	AppendOctet(1 + (telNumberLength/2) + (telNumberLength%2),aAscii);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    87
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    88
	// Code Type-Of-Address
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    89
	TInt typeOfNumber = ConvertTypeOfNumber(aAddress.iTypeOfNumber);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    90
	TInt numberingPlan = ConvertNumberingPlan(aAddress.iNumberPlan);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    91
	AppendOctet(0x80+(typeOfNumber<<4) + (numberingPlan),aAscii);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    92
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    93
	// Code Address-Value
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    94
	TInt highSemiOctet;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    95
	TInt lowSemiOctet;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    96
	const TInt octets(telNumberLength/2);	// This division will be rounded down
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    97
	for(i = 0; i < octets; ++i)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    98
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    99
		// See ETSI 03.40 section 9.1.2.3
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   100
		// Address digits are coded into octets as pairs.
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   101
		lowSemiOctet = ConvertAddressChar(TChar(telNumber[i*2]));
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   102
		highSemiOctet = ConvertAddressChar(TChar(telNumber[(i*2)+1]));
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   103
		AppendOctet((highSemiOctet<<4)+lowSemiOctet,aAscii);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   104
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   105
				
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   106
	// If number of semi octects is odd then process the final octet
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   107
	if(telNumberLength%2 == 1)		
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   108
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   109
		lowSemiOctet = ConvertAddressChar(TChar(telNumber[telNumberLength-1]));
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   110
		AppendOctet(0xf0+lowSemiOctet,aAscii);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   111
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   112
				
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   113
	__ASSERT_DEBUG(aAscii.Length()%2 == 0,Panic(EATSmsUtilsOddNumberOfSemiOctets));
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   114
	return KErrNone;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   115
	}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   116
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   117
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   118
// ---------------------------------------------------------------------------
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   119
// SmsAtUtil::AppendDataToAscii
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   120
// other items were commented in a header
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   121
// ---------------------------------------------------------------------------
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   122
void SmsAtUtil::AppendDataToAscii(TDes8& aAscii,const TDesC8& aData)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   123
 	{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   124
	const TInt count(aData.Length());
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   125
	__ASSERT_DEBUG((aAscii.MaxLength()-aAscii.MaxLength())<=(count*2),Panic(EATSmsUtilsDescriptorOverflow));
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   126
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   127
	for(TInt i = 0; i < count; ++i)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   128
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   129
		AppendOctet(aData[i],aAscii);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   130
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   131
		
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   132
	__ASSERT_DEBUG(aAscii.Length()%2==0,Panic(EATSmsUtilsOddNumberOfSemiOctets));
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   133
	}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   134
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   135
// ----------------------------------------------------------------------------------
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   136
// SmsAtUtil::ReadAndRemoveAddressFromAscii
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   137
// other items were commented in a header
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   138
// ----------------------------------------------------------------------------------
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   139
TInt SmsAtUtil::ReadAndRemoveAddressFromAscii(TDes8& aAscii,
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   140
		                                      RMobilePhone::TMobileAddress& aAddress)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   141
	{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   142
	__ASSERT_DEBUG(aAscii.Length()%2==0,Panic(EATSmsUtilsOddNumberOfSemiOctets));
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   143
	TInt ret(KErrNone);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   144
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   145
	ret = ReadAddressFromAscii(aAscii,aAddress);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   146
	
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   147
	if(ret==KErrNone)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   148
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   149
		// Delete address from aAscii (using Address-length at start of string)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   150
		TLex8 lex(aAscii.Mid(0,2));
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   151
		TUint val;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   152
		ret=lex.Val(val,EHex);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   153
		if(ret == KErrNone)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   154
			{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   155
			// +1 to include 1 octect of Address-Length 
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   156
			val = val+1;		
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   157
			
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   158
			// double value to change from 'octets used' to 'ASCII chars used'
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   159
			val = val*2;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   160
			
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   161
			aAscii.Delete(0,val);		
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   162
			__ASSERT_DEBUG(aAscii.Length()%2==0,Panic(EATSmsUtilsOddNumberOfSemiOctets));
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   163
			}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   164
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   165
	return ret;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   166
	}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   167
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   168
// ---------------------------------------------------------------------------
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   169
// SmsAtUtil::ReadAddressFromAscii
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   170
// other items were commented in a header
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   171
// ---------------------------------------------------------------------------
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   172
TInt SmsAtUtil::ReadAddressFromAscii(const TDesC8& aAscii,
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   173
		                             RMobilePhone::TMobileAddress& aAddress)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   174
	{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   175
	TLex8 lex;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   176
	TInt ret;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   177
	TUint8 val;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   178
	
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   179
	// get address length + 1 octet Address Type(91)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   180
	lex = aAscii.Mid(0,2);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   181
	ret = lex.Val(val,EHex);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   182
	if(ret != KErrNone)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   183
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   184
		return ret;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   185
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   186
		
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   187
	// we exclude the Address Type as address should not include this 
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   188
	TInt addrLen = val-1;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   189
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   190
	// Type-Of-Number (see example above as 9)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   191
	lex = aAscii.Mid(2,1);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   192
	ret = lex.Val(val,EHex);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   193
	if(ret != KErrNone)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   194
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   195
		return ret;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   196
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   197
	
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   198
	// Highest bit is not part of Type-Of-Number
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   199
	aAddress.iTypeOfNumber = ConvertTypeOfNumber(val&0x07);	
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   200
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   201
	// Number-Plan
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   202
	lex = aAscii.Mid(3,1);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   203
	ret = lex.Val(val,EHex);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   204
	if(ret != KErrNone)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   205
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   206
		return ret;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   207
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   208
	
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   209
	// we got Number-Plan which should be compatiable with Symbian defination
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   210
	aAddress.iNumberPlan = ConvertNumberingPlan(val);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   211
	
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   212
	// Address (loop for each octet ie. two hex chars from aAscii)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   213
	aAddress.iTelNumber.Zero();
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   214
	for(TInt i = 0; i < addrLen; ++i)		
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   215
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   216
		// Process semi-octet
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   217
		lex = aAscii.Mid((i*2)+5,1);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   218
		ret = lex.Val(val,EHex);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   219
		if(ret != KErrNone)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   220
			{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   221
			return ret;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   222
			}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   223
		// 0xF is consider a pedding when the address length is odd number, so we do not need to append it to address field
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   224
		if(val < 0xF)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   225
			aAddress.iTelNumber.Append(ConvertAddressChar(val));
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   226
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   227
		// Process semi-octet
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   228
		lex = aAscii.Mid((i*2)+4,1);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   229
		ret = lex.Val(val,EHex);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   230
		if(ret != KErrNone)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   231
			{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   232
			return ret;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   233
			}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   234
		
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   235
		// 0xF is consider a pedding when the address length is odd number, so we do not need to append it to address field
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   236
		if(val < 0xF)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   237
			aAddress.iTelNumber.Append(ConvertAddressChar(val));
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   238
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   239
	return KErrNone;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   240
	}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   241
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   242
// ----------------------------------------------------------------------------------------
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   243
// SmsAtUtil::ReadAndRemoveAddressFromPdu
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   244
// other items were commented in a header
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   245
// ----------------------------------------------------------------------------------------
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   246
void SmsAtUtil::ReadAndRemoveAddressFromPdu(TPtrC8& aPdu, 
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   247
		                                    RMobilePhone::TMobileAddress& aGsmServiceCentre)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   248
	{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   249
	const TUint8 KTONBitMask = 0x70;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   250
	const TUint8 KNPIBitMask = 0x0f;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   251
	const TUint8 KTONBitShift = 4;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   252
	const TUint8 KNPIBitShift = 0;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   253
	_LIT(KInternationalPrefix,"+");
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   254
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   255
	aGsmServiceCentre.iTypeOfNumber = (RMobilePhone::TMobileTON)0;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   256
	aGsmServiceCentre.iNumberPlan = (RMobilePhone::TMobileNPI)0;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   257
	aGsmServiceCentre.iTelNumber.Zero();
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   258
	
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   259
	TUint8 len = aPdu[0];
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   260
	
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   261
	if(len == 0)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   262
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   263
		// A zero length SCA has been prepended - just strip this first byte off
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   264
		aPdu.Set(aPdu.Mid(len+1));
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   265
		return;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   266
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   267
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   268
	TUint8 numDes = aPdu[1];
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   269
	aGsmServiceCentre.iTypeOfNumber = (RMobilePhone::TMobileTON)((numDes&KTONBitMask)>>KTONBitShift);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   270
	aGsmServiceCentre.iNumberPlan = (RMobilePhone::TMobileNPI)((numDes&KNPIBitMask)>>KNPIBitShift);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   271
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   272
	if(aGsmServiceCentre.iTypeOfNumber == RMobilePhone::EInternationalNumber)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   273
		aGsmServiceCentre.iTelNumber.Append(KInternationalPrefix);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   274
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   275
	TInt i;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   276
	TUint16 digit;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   277
	for(i = 2;i<(len+1);i++)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   278
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   279
		digit = (TUint16)((aPdu[i]&0x0f) + 0x30);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   280
		aGsmServiceCentre.iTelNumber.Append(digit);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   281
		digit = (TUint16)(((aPdu[i]&0xf0)>>4) + 0x30);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   282
		if(digit == 0x003f)		// 'F' is the padding digit at the end of a number
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   283
			break;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   284
		aGsmServiceCentre.iTelNumber.Append(digit);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   285
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   286
	aPdu.Set(aPdu.Mid(len + 1));
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   287
	}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   288
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   289
// ---------------------------------------------------------------------------
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   290
// SmsAtUtil::IsAddressChar
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   291
// other items were commented in a header
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   292
// ---------------------------------------------------------------------------
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   293
TBool SmsAtUtil::IsAddressChar(TChar aChar)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   294
 	{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   295
	if(aChar.IsDigit())
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   296
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   297
		return ETrue;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   298
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   299
	if(aChar == TChar('*') ||
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   300
	   aChar == TChar('#') ||
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   301
	   aChar == TChar('a') ||
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   302
	   aChar == TChar('b') ||
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   303
	   aChar == TChar('c'))
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   304
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   305
		return ETrue;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   306
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   307
	return EFalse;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   308
	}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   309
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   310
// ---------------------------------------------------------------------------
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   311
// SmsAtUtil::ConvertNumberingPlan
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   312
// other items were commented in a header
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   313
// ---------------------------------------------------------------------------
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   314
RMobilePhone::TMobileNPI SmsAtUtil::ConvertNumberingPlan(TInt aValue)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   315
	{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   316
	switch(aValue)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   317
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   318
		// The below 'magic numbers' come from the ETSI 03.40
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   319
		// specification for Address Fields (section 9.1.2.5)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   320
	case 1:
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   321
		return RMobilePhone::EIsdnNumberPlan;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   322
	case 3:
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   323
		return RMobilePhone::EDataNumberPlan;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   324
	case 4:
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   325
		return RMobilePhone::ETelexNumberPlan;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   326
	case 8:
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   327
		return RMobilePhone::ENationalNumberPlan;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   328
	case 9:
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   329
		return RMobilePhone::EPrivateNumberPlan;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   330
	default:
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   331
		return RMobilePhone::EUnknownNumberingPlan;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   332
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   333
	}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   334
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   335
// ---------------------------------------------------------------------------
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   336
// SmsAtUtil::ConvertTypeOfNumber
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   337
// other items were commented in a header
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   338
// ---------------------------------------------------------------------------
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   339
RMobilePhone::TMobileTON SmsAtUtil::ConvertTypeOfNumber(TInt aValue) 
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   340
	{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   341
	switch(aValue)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   342
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   343
		// The below 'magic numbers' come from the ETSI 03.40
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   344
		// specification for Address Fields (section 9.1.2.5)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   345
	case 0:		
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   346
		return RMobilePhone::EUnknownNumber;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   347
	case 1:		
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   348
		return RMobilePhone::EInternationalNumber;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   349
	case 2:
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   350
		return RMobilePhone::ENationalNumber;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   351
	case 3:
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   352
		return RMobilePhone::ENetworkSpecificNumber;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   353
	case 4:
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   354
		return RMobilePhone::ESubscriberNumber;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   355
	default:
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   356
		return RMobilePhone::EUnknownNumber;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   357
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   358
	}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   359
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   360
// ---------------------------------------------------------------------------
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   361
// SmsAtUtil::AppendOctet
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   362
// other items were commented in a header
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   363
// ---------------------------------------------------------------------------
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   364
void SmsAtUtil::AppendOctet(TInt aOctet,TDes8& aAscii)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   365
	{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   366
	// Ensure client has only passed us a octet (ie. low 8 bits only)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   367
	aOctet = aOctet&0xff;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   368
	// Append octet 
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   369
	// (prefix '0' if the octets value only uses one digit as final 
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   370
    //  octet coding must use two digits)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   371
	if(aOctet <= 0x0f)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   372
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   373
		aAscii.Append(TChar('0'));
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   374
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   375
	
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   376
	aAscii.AppendNum(aOctet,EHex);
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   377
	}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   378
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   379
// ---------------------------------------------------------------------------
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   380
// SmsAtUtil::ConvertAddressChar
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   381
// other items were commented in a header
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   382
// ---------------------------------------------------------------------------
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   383
TInt SmsAtUtil::ConvertAddressChar(TChar aChar)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   384
 	{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   385
	aChar.LowerCase();
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   386
	if(aChar-TChar('0') <= 9)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   387
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   388
		// it should be digital number from 0~9
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   389
		return aChar-TChar('0');
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   390
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   391
	else if(aChar == TChar('*'))
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   392
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   393
		return 10;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   394
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   395
	else if(aChar == TChar('#'))
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   396
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   397
		return 11;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   398
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   399
	else if(aChar == TChar('a'))
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   400
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   401
		return 12;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   402
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   403
	else if(aChar == TChar('b'))
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   404
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   405
		return 13;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   406
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   407
	else if(aChar == TChar('c'))
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   408
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   409
		return 14;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   410
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   411
	return 15;
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   412
	}	
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   413
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   414
// ---------------------------------------------------------------------------
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   415
// SmsAtUtil::ConvertAddressChar
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   416
// other items were commented in a header
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   417
// ---------------------------------------------------------------------------
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   418
TChar SmsAtUtil::ConvertAddressChar(TInt aBinary)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   419
	{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   420
	if(aBinary >= 0 && aBinary <= 9)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   421
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   422
		return aBinary + TChar('0');  	// Assumes digit characters are one after each other
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   423
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   424
	else if(aBinary == 10)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   425
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   426
		return TChar('*');
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   427
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   428
	else if(aBinary == 11)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   429
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   430
		return TChar('#');
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   431
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   432
	else if(aBinary == 12)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   433
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   434
		return TChar('a');
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   435
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   436
	else if(aBinary == 13)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   437
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   438
		return TChar('b');
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   439
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   440
	else if(aBinary == 14)
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   441
		{
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   442
		return TChar('c');
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   443
		}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   444
	return TChar(0);		// This is the cloest I can find to a NULL char 
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   445
	}
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   446
4047d69ee0e4 Initial upload of Nokia's AT based test LTSY which uses the dispatcher
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   447
// End of file