adaptationlayer/tsy/simatktsy_dll/src/satmosmsctrl.cpp
author mikaruus
Tue, 19 Oct 2010 13:16:20 +0300
changeset 9 8486d82aef45
parent 8 6295dc2169f3
permissions -rw-r--r--
modemadaptation release 2010wk40
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
     1
/*
8
6295dc2169f3 New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 7
diff changeset
     2
* Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
     3
* All rights reserved.
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
     8
*
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
     9
* Initial Contributors:
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    11
*
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    12
* Contributors:
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    13
*
5
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
    14
* Description:
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    15
*
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    16
*/
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    17
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    18
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    19
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    20
//  INCLUDE FILES
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    21
#include "satmosmsctrl.h"       // sat mo sms control class
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    22
#include "satmessaging.h"       // sat messaging class
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    23
#include "satmesshandler.h"     // sat message handler class
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    24
#include "ber_tlv.h"            // sat ber-tlv classes
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    25
#include "satutil.h"            // sat utility class
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    26
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    27
#include <pn_const.h>           // server id constants
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    28
#include <tisi.h>               // isi message
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    29
#include <uiccisi.h>            // UICC server
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    30
#include <smsisi.h>             // sms server
5
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
    31
#include "OstTraceDefinitions.h"
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    32
#ifdef OST_TRACE_COMPILER_IN_USE
5
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
    33
#include "satmosmsctrlTraces.h"
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    34
#endif
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    35
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    36
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    37
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    38
// CONSTANTS
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    39
const TUint8 KReservedTonNpi1           = 0x7F;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    40
const TUint8 KReservedTonNpi2           = 0xF7;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    41
const TUint8 KMaxLengthAddr1Addr2       = 249;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    42
const TUint8 KMaxLengthOfAtkSwDataNtf   = 255;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    43
const TUint8 KMaxLengthOfResourceReq    = 255;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    44
const TUint8 KSmControlAllowed          = 0;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    45
const TUint8 KSmControlNotAllowed       = 1;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    46
const TUint8 KSmControlAllowedWithModif = 2;
7
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
    47
const TUint8 KSmsSubmitAddrDataIndex    = 3;
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
    48
const TUint8 KMessageParamsIndex        = 0;
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
    49
const TUint8 KCommandTypeMask           = 0x03;
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
    50
const TUint8 KSmsCommandAddrIndex       = 5;
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
    51
const TUint8 KSmsSubmitAddrIndex        = 2;
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
    52
const TUint8 KTpDaTonNpiIndex           = 1;
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
    53
const TUint8 KTpDaTonNpiSize            = 1;
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    54
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    55
// ==================== MEMBER FUNCTIONS ====================================
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    56
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    57
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    58
// CSatMoSmsCtrl::CSatMoSmsCtrl
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    59
// C++ default constructor can NOT contain any code, that
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    60
// might leave.
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    61
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    62
//
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    63
CSatMoSmsCtrl::CSatMoSmsCtrl
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    64
        (
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    65
        CSatMessHandler*    aSatMessHandler,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    66
        CTsySatMessaging*   aSatMessaging
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    67
        )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    68
        :
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    69
        iSatMessHandler( aSatMessHandler ),
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    70
        iSatMessaging( aSatMessaging ),
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    71
        iWaitingForEnvelopeResp( EFalse ),
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    72
        iIsMoSmsCtrlActivated( EFalse ),
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    73
        iMoSmsCtrlEnvelopeTransactionId( KZero ),
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    74
        iMoSmsCtrlReqTransactionId( KZero ),
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    75
        iSenderObject( KZero )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    76
    {
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
    77
    OstTrace0( TRACE_NORMAL,  CSATMOSMSCTRL_CSATMOSMSCTRL_TD, "CSatMoSmsCtrl::CSatMoSmsCtrl" );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    78
    }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    79
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    80
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    81
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    82
// CSatMoSmsCtrl::ConstructL
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    83
// Symbian 2nd phase constructor can leave.
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    84
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    85
//
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    86
void CSatMoSmsCtrl::ConstructL()
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    87
    {
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
    88
    OstTrace0( TRACE_NORMAL,  CSATMOSMSCTRL_CONSTRUCTL_TD, "CSatMoSmsCtrl::ConstructL" );
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
    89
/*#ifdef INFO_PP_ATK_MO_SM_CONTROL
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    90
    // Check MO SMS control is supported by ME's Product Profile
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    91
    iSatMessHandler->InfoPpReadReq( INFO_PP_ATK_MO_SM_CONTROL );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    92
#else
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    93
    // Check if MO-SMS control should be activated in SMS server
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    94
    // This is done by sending a request SimReadTableReq to Sim server, with
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    95
    // service type KSimStMoSmsSimControlAvail
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    96
    iSatMessHandler->SimReadTableReq( SIM_ST_MO_SMS_SIM_CONTROL_AVAIL );
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
    97
#endif // INFO_PP_ATK_MO_SM_CONTROL*/
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    98
    }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
    99
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   100
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   101
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   102
// CSatMoSmsCtrl::NewL
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   103
// Two-phased constructor.
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   104
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   105
//
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   106
CSatMoSmsCtrl* CSatMoSmsCtrl::NewL
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   107
        (
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   108
        CSatMessHandler*    aSatMessHandler,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   109
        CTsySatMessaging*   aSatMessaging
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   110
        )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   111
    {
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   112
    OstTrace0( TRACE_NORMAL,  CSATMOSMSCTRL_NEWL_TD, "CSatMoSmsCtrl::NewL" );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   113
    TFLOGSTRING("TSY: CSatMoSmsCtrl::NewL");
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   114
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   115
    CSatMoSmsCtrl* self =
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   116
        new( ELeave ) CSatMoSmsCtrl( aSatMessHandler, aSatMessaging );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   117
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   118
    CleanupStack::PushL( self );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   119
    self->ConstructL();
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   120
    CleanupStack::Pop( self );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   121
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   122
    return self;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   123
    }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   124
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   125
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   126
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   127
// CSatMoSmsCtrl::~CSatMoSmsCtrl
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   128
// Destructor
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   129
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   130
//
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   131
CSatMoSmsCtrl::~CSatMoSmsCtrl()
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   132
    {
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   133
    OstTrace0( TRACE_NORMAL,  DUP1_CSATMOSMSCTRL_CSATMOSMSCTRL_TD, "CSatMoSmsCtrl::~CSatMoSmsCtrl" );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   134
    TFLOGSTRING("TSY: CSatMoSmsCtrl::~CSatMoSmsCtrl");
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   135
    }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   136
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   137
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   138
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   139
// CSatMoSmsCtrl::IsActivated
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   140
// Returns ETrue if MO-SMS Control is activated
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   141
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   142
//
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   143
TBool CSatMoSmsCtrl::IsActivated()
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   144
    {
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   145
    OstTrace0( TRACE_NORMAL,  CSATMOSMSCTRL_ISACTIVATED_TD, "CSatMoSmsCtrl::IsActivated" );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   146
    TFLOGSTRING("TSY: CSatMoSmsCtrl::IsActivated");
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   147
    return iIsMoSmsCtrlActivated;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   148
    }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   149
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   150
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   151
// CSatMoSmsCtrl::Activate
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   152
// Set iIsMoSmsCtrlActivated to ETrue if MO-SMS Control has to be activated
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   153
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   154
//
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   155
void CSatMoSmsCtrl::Activate()
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   156
    {
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   157
    OstTrace0( TRACE_NORMAL,  CSATMOSMSCTRL_ACTIVATE_TD, "CSatMoSmsCtrl::Activate" );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   158
    TFLOGSTRING("TSY: CSatMoSmsCtrl::Activate");
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   159
    iIsMoSmsCtrlActivated = ETrue;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   160
    }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   161
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   162
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   163
// CSatMoSmsCtrl::Deactivate
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   164
// Set iIsMoSmsCtrlActivated to EFalse if MO-SMS Control has to be deactivated
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   165
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   166
//
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   167
void CSatMoSmsCtrl::Deactivate()
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   168
    {
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   169
    OstTrace0( TRACE_NORMAL,  CSATMOSMSCTRL_DEACTIVATE_TD, "CSatMoSmsCtrl::Deactivate" );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   170
    TFLOGSTRING("TSY: CSatMoSmsCtrl::Deactivate");
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   171
    iIsMoSmsCtrlActivated = EFalse;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   172
    }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   173
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   174
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   175
// CSatMoSmsCtrl::UiccCatRespEnvelopeReceived
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   176
// Handler function of incoming MO-SMS Control related data notification messages
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   177
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   178
//
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   179
TInt CSatMoSmsCtrl::UiccCatRespEnvelopeReceived
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   180
        (
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   181
        const TIsiReceiveC& aIsiMessage //Received data notification
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   182
        )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   183
    {
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   184
    OstTrace0( TRACE_NORMAL,  CSATMOSMSCTRL_UICCCATRESPENVELOPERECEIVED_TD, "CSatMoSmsCtrl::UiccCatRespEnvelopeReceived" );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   185
    TFLOGSTRING("TSY:CSatMoSmsCtrl::UiccCatRespEnvelopeReceived");
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   186
    TBuf8<KMaxLengthOfAtkSwDataNtf> addr1;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   187
    TBuf8<KMaxLengthOfAtkSwDataNtf> addr2;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   188
    iWaitingForEnvelopeResp = EFalse;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   189
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   190
    TUint8 status( aIsiMessage.Get8bit(
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   191
        ISI_HEADER_SIZE + UICC_CAT_RESP_OFFSET_STATUS ) );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   192
    TBool simRespDataConsistent = ETrue;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   193
    TUint8 resourceStatus = 0;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   194
    TUint8 sw1( 0 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   195
    TUint8 sw2( 0 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   196
    TInt8 atkResult( 0 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   197
    TUint8 numSb( 3 ); // Mandatory no of subblocks
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   198
    TBuf8<SIZE_SMS_RESOURCE_REQ+SIZE_SMS_SB_RESOURCE+SIZE_SMS_SB_RESOURCE_SEQ_ID+
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   199
        SIZE_SMS_SB_ADDRESS+SMS_ADDRESS_MAX_LEN+SIZE_SMS_SB_TPDU_PACKING+
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   200
        SMS_TPDU_MAX_LEN+SIZE_SMS_SB_CAUSE> dataResp;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   201
    TIsiSend resourceReq( dataResp );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   202
    dataResp.AppendFill( KPadding, 1 ); // filler byte
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   203
    dataResp.Append( numSb ); // no of Subblocks
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   204
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   205
    if ( UICC_STATUS_OK == status )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   206
        {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   207
        TUint uiccSbApduOffset( 0 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   208
        if ( KErrNone == aIsiMessage.FindSubBlockOffsetById(
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   209
            ISI_HEADER_SIZE + SIZE_UICC_CAT_RESP,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   210
            UICC_SB_APDU,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   211
            EIsiSubBlockTypeId16Len16,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   212
            uiccSbApduOffset ) )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   213
            {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   214
            TPtrC8 apduData;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   215
            TUint16 apduLength( aIsiMessage.Get16bit(
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   216
                uiccSbApduOffset + UICC_SB_APDU_OFFSET_APDULENGTH ) );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   217
            apduData.Set( aIsiMessage.GetData(
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   218
                uiccSbApduOffset + UICC_SB_APDU_OFFSET_APDU,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   219
                apduLength ) );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   220
            // Status bytes are two last bytes in APDU
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   221
            sw1 = apduData[apduLength - 2];
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   222
            sw2 = apduData[apduLength - 1];
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   223
            // Get Call Control General Result
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   224
            atkResult = TSatUtility::Sw1Sw2Check( sw1, sw2 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   225
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   226
            if ( KError != atkResult ) // If ATK result is OK
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   227
                {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   228
                TFLOGSTRING("TSY:CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, Ok");
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   229
                OstTrace0( TRACE_NORMAL,  DUP1_CSATMOSMSCTRL_ATKSWDATANTFRECEIVED_TD, "CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, Ok" );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   230
                RSat::TAlphaId alphaId;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   231
                alphaId.iAlphaId.Zero();
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   232
                TBool isAlphaIdEmpty( EFalse );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   233
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   234
                if ( KMaxLengthOfAtkSwDataNtf < apduLength ) // If data length greater than 255
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   235
                    {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   236
                    TFLOGSTRING("TSY:CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, the length of Sim resp data is > 255" );
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   237
                    OstTrace0( TRACE_NORMAL,  DUP2_CSATMOSMSCTRL_ATKSWDATANTFRECEIVED_TD, "CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, the length of Sim resp data is > 255" );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   238
                    // Data is not consistent, so not allowed condition
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   239
                    if( KSmControlNotAllowed == apduData[0] )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   240
                        {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   241
                        resourceStatus = SMS_RESOURCE_DENIED;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   242
                        }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   243
                    else
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   244
                        {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   245
                        resourceStatus  = SMS_RESOURCE_ALLOWED;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   246
                        }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   247
                    FormSmsResourceReqSb( resourceStatus, dataResp, addr1, addr2 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   248
                    // Send resp to SMS server
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   249
                    // Return to the calling function right now, even if it's not
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   250
                    // a good thing to have several returns in the same method.
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   251
                    // To avoid it, more if statements would be needed and
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   252
                    // this doesn't make it any better.
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   253
                    return ( iSatMessHandler->SendSmsResourceReq(
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   254
                        iMoSmsCtrlReqTransactionId,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   255
                        dataResp,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   256
                        iSenderObject ) );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   257
                    }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   258
                else if ( apduLength ) // If data length in non zero and less than 255
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   259
                    {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   260
                    TFLOGSTRING("TSY:CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, atkData.Length()!=0 ");
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   261
                    OstTrace0( TRACE_NORMAL,  DUP3_CSATMOSMSCTRL_ATKSWDATANTFRECEIVED_TD, "CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, atkData.Length()!=0 " );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   262
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   263
                    // Note: The alpha id can be provided by the SIM even if the addresses
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   264
                    // have not been modified.
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   265
                    ParseAtkSwDataNtf( apduData, addr1, addr2, alphaId, isAlphaIdEmpty );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   266
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   267
                    if ( KSmControlAllowedWithModif == apduData[0] )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   268
                        {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   269
                        simRespDataConsistent = VerifySimRespData( addr1, addr2 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   270
                        }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   271
                    if ( simRespDataConsistent )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   272
                        {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   273
                        if( KSmControlNotAllowed == apduData[0] )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   274
                            {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   275
                            resourceStatus = SMS_RESOURCE_DENIED;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   276
                            }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   277
                        else
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   278
                            {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   279
                            resourceStatus  = SMS_RESOURCE_ALLOWED;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   280
                            }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   281
                        FormSmsResourceReqSb( resourceStatus, dataResp, addr1, addr2 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   282
                        TFLOGSTRING2("TSY:CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, apduData[0]: %d",apduData[0] );
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   283
                        OstTrace1( TRACE_NORMAL,  DUP4_CSATMOSMSCTRL_ATKSWDATANTFRECEIVED_TD, "CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, apduData[0]: %d", apduData[0] );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   284
                       }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   285
                    else
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   286
                       {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   287
                       TFLOGSTRING("TSY:CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, Sim response data not consistent" );
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   288
                       OstTrace0( TRACE_NORMAL,  DUP5_CSATMOSMSCTRL_ATKSWDATANTFRECEIVED_TD, "CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, Sim response data not consistent" );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   289
                       if( KSmControlNotAllowed == apduData[0] )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   290
                           {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   291
                           resourceStatus = SMS_RESOURCE_DENIED;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   292
                           }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   293
                       else
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   294
                           {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   295
                           resourceStatus  = SMS_RESOURCE_ALLOWED;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   296
                           }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   297
                        FormSmsResourceReqSb( resourceStatus, dataResp, addr1, addr2 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   298
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   299
                        // Send resp to Sms server
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   300
                        // Return to the calling function right now, even if it's not
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   301
                        // a good thing to have several returns in the same method.
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   302
                        // To avoid it, more if statements would be needed and
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   303
                        // this doesn't make it any better.
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   304
                        return ( iSatMessHandler->SendSmsResourceReq(
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   305
                            iMoSmsCtrlReqTransactionId,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   306
                            dataResp,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   307
                            iSenderObject ) );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   308
                        }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   309
                    } // end of if statement for data length nonzero and less than 255
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   310
                else  // block for data length zero
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   311
                    {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   312
                    TFLOGSTRING("TSY:CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, atkData.Length()=0 ");
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   313
                    OstTrace0( TRACE_NORMAL,  DUP6_CSATMOSMSCTRL_ATKSWDATANTFRECEIVED_TD, "CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, atkData.Length()=0" );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   314
                    TUint8 resourceStatus( SMS_RESOURCE_ALLOWED );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   315
                    FormSmsResourceReqSb( resourceStatus, dataResp, addr1, addr2 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   316
                    }// end of block with data length zero
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   317
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   318
                // If AlphaID is present, the client SatServer
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   319
                // must be notified in order to inform it that the ETel
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   320
                // API MO-SMS Control structure TMoSmControlV1 has been modified.
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   321
                if ( alphaId.iAlphaId.Length() || isAlphaIdEmpty )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   322
                    {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   323
                    // Inform client
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   324
                    // Control result must be mapped to ETel API values.
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   325
                    TUint8 controlResult;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   326
                    switch ( apduData[0] )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   327
                        {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   328
                        case KSmControlAllowed:
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   329
                            {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   330
                            controlResult = RSat::EAllowedNoModification;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   331
                            break;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   332
                            }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   333
                        case KSmControlAllowedWithModif:
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   334
                            {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   335
                            controlResult = RSat::EAllowedWithModifications;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   336
                            break;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   337
                            }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   338
                        case KSmControlNotAllowed:
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   339
                            {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   340
                            controlResult = RSat::ENotAllowed;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   341
                            break;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   342
                            }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   343
                        default:
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   344
                            {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   345
                            controlResult = RSat::EControlResultNotSet;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   346
                            break;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   347
                            }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   348
                        }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   349
                    iSatMessaging->NotifyClientAboutMoSmControlEvent(
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   350
                    alphaId.iAlphaId, (RSat::TControlResult) controlResult );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   351
                    }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   352
                }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   353
            }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   354
        else // else for UICC status not ok
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   355
            {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   356
            TFLOGSTRING("TSY:CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, KAtkError = atkResult ");
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   357
            OstTrace0( TRACE_NORMAL,  DUP7_CSATMOSMSCTRL_ATKSWDATANTFRECEIVED_TD, "CSatMoSmsCtrl::UiccCatRespEnvelopeReceived, KAtkError = atkResult" );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   358
            TUint8 resourceStatus = SMS_RESOURCE_DENIED;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   359
            FormSmsResourceReqSb( resourceStatus, dataResp, addr1, addr2 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   360
            }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   361
        } // end if if UICC status is ok
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   362
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   363
    // Send resp to Sms server
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   364
    return ( iSatMessHandler->SendSmsResourceReq(
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   365
        iMoSmsCtrlReqTransactionId,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   366
        dataResp,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   367
        iSenderObject ) );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   368
    }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   369
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   370
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   371
// -----------------------------------------------------------------------------
8
6295dc2169f3 New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 7
diff changeset
   372
// CSatMoSmsCtrl::SmsResourceIndReceivedL
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   373
// Request received from SMS server with the SMS parameters
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   374
// of the SMS to be sent by the Mobile Equipment.
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   375
// The response will tell whether the SMS can be sent
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   376
// to network or not.
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   377
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   378
//
8
6295dc2169f3 New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 7
diff changeset
   379
void CSatMoSmsCtrl::SmsResourceIndReceivedL
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   380
        (
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   381
        const TIsiReceiveC& aIsiMessage //Received data notification
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   382
        )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   383
    {
8
6295dc2169f3 New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 7
diff changeset
   384
    TFLOGSTRING("TSY:CSatMoSmsCtrl::SmsResourceIndReceivedL");
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   385
    OstTrace0( TRACE_NORMAL,  CSATMOSMSCTRL_SMSRESOURCEINDRECEIVEDL_TD, "CSatMoSmsCtrl::SmsResourceIndReceivedL" );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   386
5
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   387
    TUint sbOffset;
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   388
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   389
    // Save the transaction id, which is going to
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   390
    // be re-used in the resp.
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   391
    iMoSmsCtrlReqTransactionId = aIsiMessage.Get8bit( ISI_HEADER_OFFSET_TRANSID );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   392
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   393
    // Save the sender object id, in order to re-use it
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   394
    // in the response to this request
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   395
    iSenderObject = aIsiMessage.Get8bit( ISI_HEADER_OFFSET_SENDEROBJECT );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   396
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   397
    // Save Sequence id to send it in request message
5
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   398
    if ( KErrNotFound != aIsiMessage.FindSubBlockOffsetById(
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   399
        ISI_HEADER_SIZE+SIZE_SMS_RESOURCE_IND,
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   400
        SMS_SB_RESOURCE_SEQ_ID,
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   401
        EIsiSubBlockTypeId16Len16,
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   402
        sbOffset ) )
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   403
        {
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   404
        iSequenceId = aIsiMessage.Get8bit(
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   405
            sbOffset + SMS_SB_RESOURCE_SEQ_ID_OFFSET_SEQUENCEID );
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   406
        }
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   407
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   408
    // save resource id to send it in request mesage
5
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   409
    if ( KErrNotFound != aIsiMessage.FindSubBlockOffsetById(
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   410
        ISI_HEADER_SIZE+SIZE_SMS_RESOURCE_IND,
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   411
        SMS_SB_RESOURCE,
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   412
        EIsiSubBlockTypeId16Len16,
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   413
        sbOffset ) )
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   414
        {
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   415
        iResourceId = aIsiMessage.Get16bit(
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   416
            sbOffset + SMS_SB_RESOURCE_OFFSET_RESOURCES );
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   417
        }
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   418
5
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   419
    // Save Service Centre Address Subblock to send it in request message if server has
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   420
    //denied to access
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   421
    if ( KErrNotFound != aIsiMessage.FindSubBlockOffsetById(
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   422
        ISI_HEADER_SIZE+SIZE_SMS_RESOURCE_IND,
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   423
        SMS_SB_ADDRESS,
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   424
        EIsiSubBlockTypeId16Len16,
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   425
        sbOffset ) )
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   426
        {
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   427
        TUint8 addressLength = aIsiMessage.Get8bit(
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   428
            sbOffset + SMS_SB_ADDRESS_OFFSET_ADDRESSDATALENGTH );
8
6295dc2169f3 New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 7
diff changeset
   429
        // According to sms_isi specification
6295dc2169f3 New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 7
diff changeset
   430
        __ASSERT_ALWAYS(
6295dc2169f3 New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 7
diff changeset
   431
            2 <= addressLength && SMS_ADDRESS_MAX_LEN >= addressLength,
6295dc2169f3 New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 7
diff changeset
   432
            User::Leave( KErrCorrupt ) );
5
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   433
        iAddressSubblock = aIsiMessage.GetData(
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   434
            sbOffset + SMS_SB_ADDRESS_OFFSET_ADDRESSDATA,
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   435
            addressLength );
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   436
        }
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   437
    else
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   438
        {
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   439
        iAddressSubblock.Zero();
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   440
        }
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   441
5
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   442
    // Save TPDU to send it in request message if server has
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   443
    // Denied the access for that address
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   444
     if ( KErrNotFound != aIsiMessage.FindSubBlockOffsetById(
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   445
         ISI_HEADER_SIZE+SIZE_SMS_RESOURCE_IND,
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   446
         SMS_SB_TPDU,
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   447
         EIsiSubBlockTypeId16Len16,
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   448
         sbOffset ) )
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   449
        {
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   450
        TUint8 tpduLength =
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   451
            aIsiMessage.Get8bit( sbOffset + SMS_SB_TPDU_OFFSET_DATALENGTH );
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   452
        iUserDataSubblock = aIsiMessage.GetData(
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   453
            sbOffset + SMS_SB_TPDU_OFFSET_DATABYTES,
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   454
            tpduLength );
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   455
         }
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   456
     else
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   457
         {
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   458
         iUserDataSubblock.Zero();
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   459
         }
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   460
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   461
    //Check if location data is present. Otherwise response to SmsResourceInd
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   462
    //is always ALLOWED.
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   463
    if ( !iSatMessHandler->ServiceAvailable() )
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   464
        {
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   465
        TFLOGSTRING("TSY:CSatMoSmsCtrl::SmsResourceIndReceivedL: Not Allowed Condition, Send response to SMS server");
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   466
        OstTrace0( TRACE_NORMAL,  DUP1_CSATMOSMSCTRL_SMSRESOURCEINDRECEIVEDL_TD, "CSatMoSmsCtrl::SmsResourceIndReceivedL: Not Allowed conditon, Send response to SMS server" );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   467
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   468
        SendSmsResourceReq(
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   469
            SMS_RESOURCE_ALLOWED,
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   470
            SMS_CAUSE_TYPE_COMMON,
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   471
            SMS_OK );
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   472
        }
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   473
    else
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   474
        {
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   475
        if( iIsMoSmsCtrlActivated )    // Check is MO SMS is activated or not
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   476
            {
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   477
TFLOGSTRING("TSY:CSatMoSmsCtrl::SmsResourceIndReceivedL, Send envelope");
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   478
OstTrace0( TRACE_NORMAL,  DUP3_CSATMOSMSCTRL_SMSRESOURCEINDRECEIVEDL_TD, "CSatMoSmsCtrl::SmsResourceIndReceivedL, Send envelope" );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   479
5
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   480
            iMoSmsCtrlEnvelopeTransactionId = iSatMessaging->GetTransactionId();
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   481
            FormMoSmsCtrlEnvelope();
5
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   482
            }
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   483
        else        // If MO SMS is not activated
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   484
            {
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   485
            SendSmsResourceReq(
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   486
                SMS_RESOURCE_DENIED,
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   487
                SMS_CAUSE_TYPE_COMMON,
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   488
                SMS_ERR_ROUTE_NOT_ALLOWED );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   489
            }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   490
        }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   491
    }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   492
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   493
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   494
// CSatMoSmsCtrl::SendMoSmsCtrlEnvelope
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   495
// Send an envelope to SIM server in order to check wheter the SMS
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   496
// can be sent or not. The response will be used to send a response
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   497
// to SMS server
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   498
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   499
//
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   500
void CSatMoSmsCtrl::SendMoSmsCtrlEnvelope
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   501
        (
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   502
        TUint8 aTraId,
5
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   503
        const TDesC8& aAddressData1,
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   504
        const TDesC8& aAddressData2
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   505
        )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   506
    {
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   507
    OstTrace0( TRACE_NORMAL,  CSATMOSMSCTRL_SENDMOSMSCTRLENVELOPE_TD, "CSatMoSmsCtrl::SendMoSmsCtrlEnvelope" );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   508
    TFLOGSTRING("TSY:CSatMoSmsCtrl::SendMoSmsCtrlEnvelope");
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   509
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   510
    // Get location info
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   511
    const CSatMessHandler::TLocationInfo& locInfo
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   512
        = iSatMessHandler->LocationInfo();
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   513
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   514
    // A SwDataNtf is expected later
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   515
    iWaitingForEnvelopeResp = ETrue;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   516
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   517
    TTlv envelope;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   518
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   519
    envelope.Begin( KBerTlvMoShortMessageControlTag );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   520
    //device identities
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   521
    envelope.AddTag( KTlvDeviceIdentityTag );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   522
    envelope.AddByte( KMe );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   523
    envelope.AddByte( KSim );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   524
    // Address Data object 1
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   525
    // Ton and Npi is in the first byte of address data
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   526
    envelope.AddTag( KTlvAddressTag );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   527
    envelope.AddData( aAddressData1 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   528
    // Address Data object 2
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   529
    // Ton and Npi is in the first byte of address data
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   530
    envelope.AddTag( KTlvAddressTag );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   531
    envelope.AddData( aAddressData2 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   532
    // Location info
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   533
    envelope.AddTag(KTlvLocationInformationTag);
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   534
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   535
    // This part assumes that location info (NetCellInfoInd)
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   536
    // has been received
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   537
    // Mobile Country & Network Codes (MCC & MNC)
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   538
    envelope.AddData( locInfo.iOperatorCode );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   539
    // Location Area Code (LAC)
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   540
    envelope.AddData( locInfo.iLac );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   541
    // Cell Id
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   542
    envelope.AddData( locInfo.iCellId );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   543
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   544
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   545
    // Send envelope only if its length is less than the maximum allowed
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   546
    // envelope length.
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   547
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   548
    iSatMessHandler->UiccCatReqEnvelope( aTraId, envelope.End() );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   549
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   550
    }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   551
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   552
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   553
// CSatMoSmsCtrl::ParseAtkSwDataNtf
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   554
// Extracts data from AtkSwDataNtf message data part.
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   555
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   556
//
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   557
void CSatMoSmsCtrl::ParseAtkSwDataNtf
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   558
        (
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   559
        TPtrC8& aAtkData,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   560
        TDes8& aAddr1,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   561
        TDes8& aAddr2,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   562
        RSat::TAlphaId& aAlphaId,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   563
        TBool& aEmptyAlphaId
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   564
        )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   565
    {
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   566
    OstTrace0( TRACE_NORMAL,  CSATMOSMSCTRL_PARSEATKSWDATANTF_TD, "CSatMoSmsCtrl::ParseAtkSwDataNtf" );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   567
    TFLOGSTRING("TSY:CSatMoSmsCtrl::ParseAtkSwDataNtf");
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   568
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   569
    // Input data:
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   570
    // aAtkData[0] : result
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   571
    // aAtkData[1][2] : length of BER-TLV, set n=1 if aAtkData[1]=0x81
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   572
    // aAtkData[2+n] : tag of first TLV
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   573
    // aAtkData[3+n][4+n] : length of first TLV, set nn=1 if aAtkData[3+n]=0x81
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   574
    // etc..
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   575
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   576
    // Comments drawn from SAT TS lab test cases:
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   577
    // - The SIM may insert a wild '0xD' character in addresses and therefore
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   578
    // the phone sw should prevent the sending of the SMS. At the time when this
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   579
    // comment is being written, it is not clear which part prevents it, and does
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   580
    // it really prevent it ? And this is not yet handled in SimAtkTsy.
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   581
    // - The SIM may insert a 0xF in addresses, and the phone sw should discard
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   582
    // all characters placed after the 0xF. At the time when this
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   583
    // comment is being written, it is not clear which part should do that,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   584
    // and this is not yet handled in SimAtkTsy.
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   585
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   586
    // Check if the BER-TLV length is coded with 2 bytes.
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   587
    TInt indexInBerTlv( 1 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   588
    TUint8 tag( aAtkData[indexInBerTlv] );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   589
    TUint8 lengthBerTlv( 0 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   590
    TInt n( (KTwoByteLengthCoding == tag)?1:0 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   591
    lengthBerTlv = aAtkData[1 + n];
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   592
    indexInBerTlv = 2 + n;
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   593
    // MO SMS control result
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   594
    TUint8 moSmsResult( aAtkData[0] );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   595
    // Extract TLVs and fill in output variables
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   596
    TBool address1_got( EFalse );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   597
    while( lengthBerTlv )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   598
        {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   599
        // Get tag value without 'comprehension required' bit
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   600
        tag = aAtkData[indexInBerTlv]&0x7F;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   601
        // Length of TLV with 2 bytes ?
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   602
        TInt nn( ( KTwoByteLengthCoding == aAtkData[indexInBerTlv+1] )?1:0 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   603
        // Length of TLV
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   604
        TInt lengthTlv( aAtkData[indexInBerTlv+nn+1] );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   605
        // Check what TLV is received
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   606
        if ( ( KTlvAddressTag == tag )
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   607
            && ( !address1_got )
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   608
            && KSmControlAllowedWithModif == moSmsResult )
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   609
            {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   610
            // RP address first
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   611
            address1_got = ETrue;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   612
            // Copy data to output variable
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   613
            aAddr1.Copy( aAtkData.Mid( indexInBerTlv + nn + 2,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   614
                lengthTlv ) );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   615
            if ( (1<lengthTlv) &&
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   616
                 KReservedTonNpi1!=aAddr1[0] && KReservedTonNpi2!=aAddr1[0] )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   617
                {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   618
                CleanAddressData( aAddr1 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   619
                }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   620
            }
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   621
        else if ( KTlvAddressTag == tag
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   622
            && KSmControlAllowedWithModif == moSmsResult )
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   623
            {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   624
            // TP address
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   625
            // Copy data to output variable
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   626
            aAddr2.Copy( aAtkData.Mid( indexInBerTlv + nn + 2,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   627
                lengthTlv ) );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   628
            if ( (1<lengthTlv) &&
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   629
                 KReservedTonNpi1!=aAddr2[0] && KReservedTonNpi2!=aAddr2[0] )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   630
                {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   631
                CleanAddressData( aAddr2 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   632
                }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   633
            }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   634
        else if ( KTlvAlphaIdentifierTag == tag )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   635
            {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   636
            // Alpha Id
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   637
            // Alpha id must be converted to TBuf16/unicode
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   638
            if ( lengthTlv )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   639
                {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   640
                TSatUtility::SetAlphaId( aAtkData.Mid( indexInBerTlv + nn + 2,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   641
                    lengthTlv ), aAlphaId.iAlphaId );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   642
                }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   643
            else
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   644
                {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   645
                aEmptyAlphaId = ETrue;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   646
                }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   647
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   648
            }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   649
        else
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   650
            {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   651
            TFLOGSTRING("TSY: CSatMoSmsCtrl::ParseAtkSwDataNtf, Tlv tag was not address/alpha id tag.");
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   652
            OstTrace0( TRACE_NORMAL,  DUP1_CSATMOSMSCTRL_PARSEATKSWDATANTF_TD, "CSatMoSmsCtrl::ParseAtkSwDataNtf, Tlv tag was not address/alpha id tag." );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   653
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   654
            }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   655
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   656
        // update length for the while loop
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   657
        lengthBerTlv -= ( lengthTlv+2+nn );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   658
        // updata index for the while loop
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   659
        indexInBerTlv += ( lengthTlv+2+nn );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   660
        }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   661
    }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   662
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   663
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   664
// CSatMoSmsCtrl::CleanAddressData
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   665
// This method cleans the input address data, so that all the bytes found
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   666
// after a 0xXF or a 0xFX are removed.
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   667
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   668
//
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   669
void CSatMoSmsCtrl::CleanAddressData
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   670
        (
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   671
        TDes8& aAddr
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   672
        )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   673
    {
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   674
    OstTrace0( TRACE_NORMAL,  CSATMOSMSCTRL_CLEANADDRESSDATA_TD, "CSatMoSmsCtrl::CleanAddressData" );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   675
    TFLOGSTRING("TSY: CSatMoSmsCtrl::CleanAddressData");
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   676
    // Starts from index 1, since index 0 is for TON/NPI
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   677
    for ( TInt i=1; i < aAddr.Length(); i++ )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   678
        {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   679
        if ( 0xF0==(aAddr[i]&0xF0) )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   680
            {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   681
            if ( ( i+1 ) < aAddr.Length() )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   682
                {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   683
                aAddr.Delete( i+1, aAddr.Length() - i - 1 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   684
                }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   685
            break;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   686
            }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   687
        else if ( 0x0F==(aAddr[i]&0x0F) )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   688
            {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   689
            aAddr.Delete( i, aAddr.Length() - i );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   690
            break;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   691
            }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   692
        }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   693
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   694
    }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   695
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   696
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   697
// CSatMoSmsCtrl::VerifySimRespData
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   698
// This method checks the consistency of the data sent by the SIM to the ME,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   699
// when the call is allowed and modified.
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   700
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   701
//
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   702
TBool CSatMoSmsCtrl::VerifySimRespData
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   703
        (
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   704
        TDes8& aRPAddr,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   705
        TDes8& aTPAddr
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   706
        )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   707
    {
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   708
    OstTrace0( TRACE_NORMAL,  CSATMOSMSCTRL_VERIFYSIMRESPDATA_TD, "CSatMoSmsCtrl::VerifySimRespData" );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   709
    TBool ret( ETrue );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   710
    if ( ( 0==aRPAddr.Length() && 0==aTPAddr.Length() )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   711
       || ( KMaxLengthAddr1Addr2 <= ( aRPAddr.Length()+aTPAddr.Length() ) )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   712
       )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   713
        {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   714
        ret = EFalse;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   715
        }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   716
    else
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   717
        {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   718
        // detect the presence of 'wild' values in the digits of the addresses
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   719
        for ( TInt i=0; i<aRPAddr.Length(); i++)
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   720
            {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   721
            if ( ( 0xA<(0x0F&aRPAddr[i]) && 0xF>(0x0F&aRPAddr[i]) )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   722
               ||( 0xA0<(0xF0&aRPAddr[i]) && 0xF0>(0xF0&aRPAddr[i]) ) )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   723
                {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   724
                ret = EFalse;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   725
                break;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   726
                }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   727
            }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   728
        for ( TInt i=0; i<aTPAddr.Length(); i++)
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   729
            {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   730
            if ( ( 0x9<(0x0F&aTPAddr[i]) && 0xF>(0x0F&aTPAddr[i]) )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   731
               ||( 0x90<(0xF0&aTPAddr[i]) && 0xF0>(0xF0&aTPAddr[i]) ) )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   732
                {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   733
                ret = EFalse;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   734
                break;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   735
                }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   736
            }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   737
        }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   738
    return ret;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   739
    }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   740
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   741
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   742
// CSatMoSmsCtrl::FormSmsResourceReqSb
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   743
// Form subblock of SMS_RESOURCE_REQ
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   744
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   745
//
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   746
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   747
void CSatMoSmsCtrl::FormSmsResourceReqSb
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   748
       (const TUint8 status,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   749
        TDes8& data,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   750
        const TDes8& address1,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   751
        const TDes8& address2
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   752
        )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   753
    {
7
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   754
    TFLOGSTRING("TSY: CSatMoSmsCtrl::FormSmsResourceReqSb");
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   755
    // First three mandatory subblocks
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   756
    TIsiSubBlock resource( data, SMS_SB_RESOURCE ,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   757
        EIsiSubBlockTypeId16Len16 );    // Message ID and Subblock length
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   758
    data.Append( iResourceId >> 8 );      // SMS resource IDs MSB same as received in indication
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   759
    data.Append( iResourceId );           // SMS resource IDs LSB
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   760
    resource.CompleteSubBlock();
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   761
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   762
    // Add Sequence ID subblock
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   763
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   764
    TIsiSubBlock resourceSeqId( data, SMS_SB_RESOURCE_SEQ_ID ,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   765
        EIsiSubBlockTypeId16Len16 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   766
    data.Append( iSequenceId );           // Sequence ID same as received in indication message
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   767
    resourceSeqId.CompleteSubBlock();
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   768
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   769
    // Add Resource Status subblock
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   770
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   771
    TIsiSubBlock resourceStatus( data, SMS_SB_RESOURCE_STATUS ,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   772
        EIsiSubBlockTypeId16Len16 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   773
    data.Append( status );                // Resource status
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   774
    resourceStatus.CompleteSubBlock();
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   775
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   776
    if(iIsMoSmsCtrlActivated)
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   777
        {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   778
            //Resource is disallowed   ||    Resource is allowed without modification
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   779
        if((SMS_RESOURCE_ALLOWED != status)||(0 == address1.Length()))
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   780
              {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   781
              // Increment subblock
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   782
              data[1]++;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   783
              // Copy address subblocks from Indication message
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   784
              // Add Address Subblock
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   785
              TIsiSubBlock address(
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   786
                  data,
7
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   787
                  SMS_SB_ADDRESS ,
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   788
                  EIsiSubBlockTypeId16Len16 );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   789
              data.Append( SMS_SMSC_ADDRESS );            // Address type
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   790
              data.Append( iAddressSubblock.Length() );     // Address data length
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   791
              data.Append( iAddressSubblock );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   792
              // Filler Bytes calculation
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   793
              address.CompleteSubBlock();
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   794
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   795
              // increment subblock
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   796
              data[1]++;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   797
              // Add User Data Subblock
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   798
              TIsiSubBlock userData(
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   799
                  data,
7
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   800
                  SMS_SB_TPDU ,
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   801
                  EIsiSubBlockTypeId16Len16 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   802
              data.Append( iUserDataSubblock.Length() );        // data Length
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   803
              data.Append( KPadding );        // Filler Byte
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   804
              data.Append( iUserDataSubblock ); // Data Bytes
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   805
              userData.CompleteSubBlock();
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   806
              }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   807
        else
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   808
              {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   809
              // when resource is allowed with modification
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   810
              // then copy SIM data in address subblock
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   811
              if ( address1.Length() )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   812
                  {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   813
                  // Add Address subblock
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   814
                  data[1]++;          // increase no of subblocks
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   815
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   816
                  TIsiSubBlock address(
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   817
                      data,
7
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   818
                      SMS_SB_ADDRESS ,
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   819
                      EIsiSubBlockTypeId16Len16 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   820
                  data.Append(SMS_SMSC_ADDRESS);            // Address Type
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   821
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   822
                  // Data in bytes
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   823
                  // First byte is the address length in 3GPP, GSM_0411 format
7
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   824
                  // "data length in bytes, including TON & NPI".
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   825
                  data.Append( address1.Length() + 1 );
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   826
                  // Actual address data.
7
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   827
                  data.Append( address1.Length());
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   828
                  data.Append( address1 );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   829
                  address.CompleteSubBlock();
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   830
                  }       // end of Service centre Address Subblock
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   831
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   832
                  // Add subblock for Address2 (Destination address, TP) if present
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   833
                  if ( address2.Length() )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   834
                      {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   835
                      // Add subblock
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   836
                      data[1]++;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   837
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   838
                      // For User Data Subblock
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   839
                      TIsiSubBlock userDataSb(
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   840
                          data,
7
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   841
                          SMS_SB_TPDU,
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   842
                          EIsiSubBlockTypeId16Len16 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   843
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   844
                      // Check what type of TPDU to be sent
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   845
                      switch( iMessageType )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   846
                          {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   847
                          case KSmsCommandType:
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   848
                              {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   849
                              // Data in bytes
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   850
                              // First byte is the address length in 3GPP, GSM_0340 format
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   851
                              // "number of useful semioctets ( = digits ), excluding TON & NPI "
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   852
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   853
                              if ( 1 == address2.Length() ||
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   854
                                 ( 1 < address2.Length() &&
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   855
                                 ( KReservedTonNpi1 == address2[0]
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   856
                                   || KReservedTonNpi2 == address2[0] ) )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   857
                                 )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   858
                                  {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   859
                                  // Only Ton&Npi is present
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   860
                                  // or TON&NPI has a reserved value
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   861
                                  iUserDataSubblock[6] = 0x00;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   862
                                  }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   863
                              else if ( 0xF0 == ( address2[address2.Length() - 1] & 0xF0 ) )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   864
                                  {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   865
                                  // Odd length destination address
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   866
                                  // Destination address length ( in semioctets )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   867
                                  iUserDataSubblock[5] = ( ( address2.Length() * 2 ) - 1 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   868
                                  }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   869
                              else
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   870
                                  {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   871
                                  // Even length destination address
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   872
                                  iUserDataSubblock[5] = ( address2.Length() * 2 );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   873
                                  }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   874
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   875
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   876
                              for( TUint8 i = 0; i < address2.Length(); i++)
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   877
                                  {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   878
                                  iUserDataSubblock[i+6] = address2[i];
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   879
                                  }
7
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   880
                               break;
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   881
                               }
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   882
                          case KSmsSubmitType:
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   883
                              {
7
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   884
                              TUint8 oldAddrLen( ( iUserDataSubblock[ 2 ] + 1 ) / 2 );
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   885
                              // Data in bytes
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   886
                              // First byte is the address length in 3GPP, GSM_0340 format
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   887
                              // "number of useful semioctets ( = digits ), excluding TON & NPI "
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   888
                              if ( 1 == address2.Length() ||
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   889
                                 ( 1 < address2.Length() &&
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   890
                                 ( KReservedTonNpi1 == address2[0]
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   891
                                 || KReservedTonNpi2 == address2[0] ) )
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   892
                                 )
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   893
                                  {
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   894
                                  // Only Ton&Npi is present
8
6295dc2169f3 New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 7
diff changeset
   895
                                  // or TON&NPI has a reserved value
6295dc2169f3 New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 7
diff changeset
   896
                                  iUserDataSubblock[2] = 0x00;
7
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   897
                                  }
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   898
                              else if ( 0xF0 == ( address2[address2.Length() - 1] & 0xF0 ) )
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   899
                                  {
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   900
                                  // Odd length destination address
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   901
                                  // Destination address lenght ( in semioctets )
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   902
                                  iUserDataSubblock[2] = ( ( ( address2.Length() - 1 ) * 2 ) - 1 );
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   903
                                  }
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   904
                              else
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   905
                                  {
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   906
                                  // Even length destination address
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   907
                                  iUserDataSubblock[2]  = ( ( address2.Length() - 1 ) * 2 );
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   908
                                  }
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   909
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   910
                              // old addresss needs to be deleted before new one can be inserted
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   911
                              // to the tpdu
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   912
                              iUserDataSubblock.Delete(
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   913
                                  KSmsSubmitAddrDataIndex,
7
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   914
                                  oldAddrLen + 1 );
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   915
                              iUserDataSubblock.Insert(
7
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   916
                                  KSmsSubmitAddrDataIndex,
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   917
                                  address2 );
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   918
                              break;
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   919
                              }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   920
                          default:
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   921
                              {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   922
                              break;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   923
                              }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   924
                          }
7
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   925
                      data.Append( iUserDataSubblock.Length() );
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   926
                      data.Append( KPadding );           // Filler Byte
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   927
                      data.Append( iUserDataSubblock );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   928
                      userDataSb.CompleteSubBlock();
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   929
                      }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   930
              }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   931
        if( SMS_RESOURCE_DENIED == status )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   932
            {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   933
            // Add SMS_SB_CAUSE subblock
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   934
            data[1]++;           //Increment no of subblocks
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   935
            TIsiSubBlock cause(
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   936
                data,
7
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   937
                SMS_SB_CAUSE ,
fa67e03b87df New release based on our 2010wk08 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 5
diff changeset
   938
                EIsiSubBlockTypeId16Len16 );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   939
            data.Append( SMS_CAUSE_TYPE_COMMON );            // Cause type
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   940
            data.Append( SMS_ERR_ROUTE_NOT_ALLOWED );    // Cause
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   941
            cause.CompleteSubBlock();
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   942
            }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   943
        }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   944
    }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   945
// -----------------------------------------------------------------------------
8
6295dc2169f3 New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 7
diff changeset
   946
// CSatMoSmsCtrl::MessageReceivedL
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   947
// Handle received messages related to MO-SMS Control
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   948
// -----------------------------------------------------------------------------
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   949
//
8
6295dc2169f3 New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 7
diff changeset
   950
TInt CSatMoSmsCtrl::MessageReceivedL
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   951
        (
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   952
        const TIsiReceiveC& aIsiMessage
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   953
        )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   954
    {
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   955
    OstTrace0( TRACE_NORMAL,  CSATMOSMSCTRL_MESSAGERECEIVED_TD, "CSatMoSmsCtrl::MessageReceived" );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   956
    TFLOGSTRING("TSY: CSatMoSmsCtrl::MessageReceived");
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   957
    // SMS server -> SimAtkTsy  : MO-SMS request sent to SAT (KSmsResourceReq)
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   958
    // UICC server <- SimAtkTsy  : Envelope sent to UICC server (KAtkEnvelopeNtf)
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   959
    // UICC server -> SimAtkTsy  : AtkSwNtf send to SAT, with modified (or not)
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   960
    //                            addresses and parameters  (KAtkSwDataNtf)
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   961
    // SMS server <- SimAtkTsy  : SAT sends final decision to SMS server
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   962
    //                            with modified (or not) addresses and parameters
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   963
    //                            (KSmsResourceResp)
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   964
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   965
    // Note: When SendSms proactive command is issued, and MO-SMS control
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   966
    // does not allow sending the SMS, then a terminal response with general result
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   967
    // "interaction with call control by SIM or MO short message control by SIM,
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   968
    // action not allowed".
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   969
    TUint8 resource = aIsiMessage.Get8bit( ISI_HEADER_OFFSET_RESOURCEID );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   970
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   971
    if ( PN_SMS == resource )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   972
        {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   973
        switch ( aIsiMessage.Get8bit( ISI_HEADER_OFFSET_MESSAGEID ) )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   974
            {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   975
            case SMS_RESOURCE_IND:
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   976
                {
8
6295dc2169f3 New release based on our 2010wk15 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 7
diff changeset
   977
                SmsResourceIndReceivedL( aIsiMessage );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   978
                break;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   979
                }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   980
            case SMS_RESOURCE_RESP:
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   981
                {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   982
                // Take a log
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   983
                TFLOGSTRING("TSY:CSatMoSmsCtrl::SmsResourceRespReceived: Response for Resource Req, Receive response from SMS server");
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
   984
                OstTrace0( TRACE_NORMAL,  DUP1_CSATMOSMSCTRL_SMSRESOURCERESPRECEIVED_TD, "CSatMoSmsCtrl::SmsResourceRespReceived: Response for Resource Req, Receive response from SMS server" );
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   985
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   986
                break;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   987
                }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   988
            default:
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   989
                {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   990
                // none
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   991
                break;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   992
                }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   993
            }
5
8ccc39f9d787 New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents: 0
diff changeset
   994
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   995
        }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   996
    else if ( PN_UICC == resource )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   997
        {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   998
        switch( aIsiMessage.Get8bit( ISI_HEADER_OFFSET_MESSAGEID ) )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
   999
            {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1000
            case UICC_CAT_RESP:
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1001
                {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1002
                // In case of envelope response handle the data
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1003
                TUint8 serviceType(
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1004
                    aIsiMessage.Get8bit(
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1005
                        ISI_HEADER_SIZE + UICC_CAT_RESP_OFFSET_SERVICETYPE ) );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1006
                if ( UICC_CAT_ENVELOPE == serviceType )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1007
                    {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1008
                    if ( iWaitingForEnvelopeResp &&
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1009
                         ( iMoSmsCtrlEnvelopeTransactionId ==
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1010
                            aIsiMessage.Get8bit( ISI_HEADER_OFFSET_TRANSID ) ) )
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1011
                        {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1012
                        // Set flag iWaitingForEnvelopeResp false
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1013
                        // since a response is received for the envelope
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1014
                        // that was sent for a received sms-pp message
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1015
                        iWaitingForEnvelopeResp = EFalse;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1016
                        UiccCatRespEnvelopeReceived( aIsiMessage );
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1017
                        }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1018
                    }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1019
                break;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1020
                }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1021
            default:
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1022
                {
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1023
                break;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1024
                }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1025
            }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1026
        }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1027
    return KErrNone;
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1028
    }
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1029
9
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1030
// -----------------------------------------------------------------------------
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1031
// CSatMoSmsCtrl::SendSmsResourceReq
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1032
// Constructs and sends SMS_RESOURCE_REQ
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1033
// -----------------------------------------------------------------------------
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1034
//
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1035
void CSatMoSmsCtrl::SendSmsResourceReq(
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1036
    TUint8 aResourceStatus,
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1037
    TUint8 aCauseType,
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1038
    TUint8 aCause )
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1039
    {
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1040
    TFLOGSTRING("TSY: CSatMoSmsCtrl::SendSmsResourceReq");
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1041
    OstTrace0( TRACE_NORMAL, CSATMOSMSCTRL_SENDSMSRESOURCEREQ_TD, "CSatMoSmsCtrl::SendSmsResourceReq" );
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1042
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1043
    TBuf8<KMaxLengthOfResourceReq> dataResp;
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1044
    TIsiSend resourceReq( dataResp );
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1045
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1046
    dataResp.AppendFill( KPadding, 1 );       // filler byte
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1047
    TUint8 sbCount( 0 );
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1048
    if ( SMS_RESOURCE_ALLOWED == aResourceStatus )
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1049
        {
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1050
        sbCount = 5; // in ok case there are 5 subblocks
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1051
        }
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1052
    else
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1053
        {
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1054
        sbCount = 4; // otherwise 4
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1055
        }
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1056
    dataResp.Append( sbCount );                // no of Subblocks
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1057
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1058
    // Add first SB Resource Subblock
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1059
    TIsiSubBlock resource(
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1060
        dataResp,
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1061
        SMS_SB_RESOURCE ,
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1062
        EIsiSubBlockTypeId16Len16 );                      // Message ID and Subblock length
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1063
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1064
    dataResp.Append( iResourceId >> 8 );        // SMS Resource IDs MSB
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1065
    dataResp.Append( iResourceId );           // SMS resource IDs LSB
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1066
    resource.CompleteSubBlock();
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1067
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1068
    // Add 2nd resource sequence ID subblock
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1069
    TIsiSubBlock resourceSeqId(
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1070
        dataResp,
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1071
        SMS_SB_RESOURCE_SEQ_ID ,
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1072
        EIsiSubBlockTypeId16Len16 );
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1073
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1074
    dataResp.Append(iSequenceId);                // Sequence ID
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1075
    resourceSeqId.CompleteSubBlock();
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1076
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1077
    // Add Third subblock SMS_SB_RESOURCE_STATUS
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1078
    TIsiSubBlock resourceStatus(
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1079
        dataResp,
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1080
        SMS_SB_RESOURCE_STATUS ,
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1081
        EIsiSubBlockTypeId16Len16 );
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1082
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1083
    dataResp.Append( aResourceStatus );            // Resource status
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1084
    resourceStatus.CompleteSubBlock();
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1085
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1086
    if ( SMS_RESOURCE_ALLOWED == aResourceStatus )
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1087
        {
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1088
        // Add 4th subblock SMS_SB_ADDRESS (SMSC)
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1089
        TIsiSubBlock addressSb(
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1090
            dataResp,
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1091
            SMS_SB_ADDRESS ,
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1092
            EIsiSubBlockTypeId16Len16 );
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1093
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1094
        dataResp.Append( SMS_SMSC_ADDRESS );            // Addrees Type
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1095
        dataResp.Append( iAddressSubblock.Length() );
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1096
        dataResp.Append( iAddressSubblock );
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1097
        addressSb.CompleteSubBlock();
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1098
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1099
        // Add 5th Subblock SMS_SB_TPDU (Destination address)
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1100
        TIsiSubBlock userDataSb(
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1101
            dataResp,
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1102
            SMS_SB_TPDU ,
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1103
            EIsiSubBlockTypeId16Len16 );
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1104
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1105
        dataResp.Append( iUserDataSubblock.Length() );            // Addrees Length
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1106
        dataResp.Append( KPadding );
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1107
        dataResp.Append( iUserDataSubblock );
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1108
        userDataSb.CompleteSubBlock();
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1109
        }
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1110
    else
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1111
        {
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1112
        // Add cause subblock
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1113
        TIsiSubBlock sbCause(
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1114
            dataResp,
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1115
            SMS_SB_CAUSE,
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1116
            EIsiSubBlockTypeId16Len16 );
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1117
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1118
        dataResp.Append( aCauseType );
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1119
        dataResp.Append( aCause );
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1120
        sbCause.CompleteSubBlock();
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1121
        }
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1122
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1123
    // Send resp to Sms server with not allowed status
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1124
    iSatMessHandler->SendSmsResourceReq(
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1125
        iMoSmsCtrlReqTransactionId,
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1126
        dataResp,
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1127
        iSenderObject );
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1128
    }
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1129
// -----------------------------------------------------------------------------
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1130
// CSatMoSmsCtrl::FormMoSmsCtrlEnvelope
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1131
// Forms and sends MO SMS Control envelope
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1132
// -----------------------------------------------------------------------------
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1133
//
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1134
void CSatMoSmsCtrl::FormMoSmsCtrlEnvelope()
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1135
    {
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1136
    TFLOGSTRING("TSY: CSatMoSmsCtrl::FormMoSmsCtrlEnvelope");
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1137
    OstTrace0( TRACE_NORMAL, CSATMOSMSCTRL_FORMMOSMSCTRLENVELOPE_TD, "CSatMoSmsCtrl::FormMoSmsCtrlEnvelope" );
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1138
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1139
    TPtrC8 addressData2;
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1140
    if ( iUserDataSubblock.Length() )
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1141
        {
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1142
        iMessageType = FetchTpDa( iUserDataSubblock, addressData2 );
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1143
        }
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1144
    // no else
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1145
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1146
    // Dialled Number String, the length has to be removed (first byte)
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1147
    // The envelope is sent if MO SMS is activated
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1148
    // iAddressSubblock is not sent as it's received
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1149
    // from SMS server because of iAddressSubblock's first
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1150
    // byte is length of the address data and MO SMS Control envelope
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1151
    // is NOT allowed to contain that in address data. So length
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1152
    // field is skipped
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1153
    SendMoSmsCtrlEnvelope(
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1154
        iMoSmsCtrlEnvelopeTransactionId,
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1155
        iAddressSubblock.Mid( 1, iAddressSubblock.Length() - 1 ),
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1156
        addressData2 );
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1157
    }
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1158
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1159
// -----------------------------------------------------------------------------
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1160
// CSatMoSmsCtrl::FetchTpDa
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1161
// Fetches TP-DA contents from TPDU
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1162
// -----------------------------------------------------------------------------
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1163
//
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1164
TUint8 CSatMoSmsCtrl::FetchTpDa( const TDesC8& aTpdu, TPtrC8& aTpda )
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1165
    {
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1166
    TFLOGSTRING("TSY: CSatMoSmsCtrl::FetchTpDa");
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1167
    OstTrace0( TRACE_NORMAL, CSATMOSMSCTRL_FETCHTPDA_TD, "CSatMoSmsCtrl::FetchTpDa" );
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1168
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1169
    TUint8 ret( 0 );
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1170
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1171
    // TP-DA has the following structure
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1172
    // (see 3GPP TS 23.040 clause 9.1.2.5)
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1173
    //      [0]     Address-Length
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1174
    //      [1]     TonNpi
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1175
    //      [2..]   Address-Value       ADN encoding
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1176
    // resulting descriptor contains TonNpi+Address-Value
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1177
    // 'Address-Length' does not count filler byte if it is present, so it
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1178
    // can be odd value. If it is we need to add 1 and then divide by 2 to
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1179
    // calculate number of bytes. Although if it is even, then adding 1 will
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1180
    // give us odd value which gives the same number of bytes after integer
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1181
    // division by 2.
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1182
    // So we always add 1 to Address-Length inside TP-DA
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1183
    if ( KSmsCommandType == ( aTpdu[KMessageParamsIndex] & KCommandTypeMask ) )
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1184
        {
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1185
        ret = KSmsCommandType;
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1186
        TUint8 addressLength = aTpdu[KSmsCommandAddrIndex] + 1;
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1187
        aTpda.Set( aTpdu.Mid(
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1188
            KSmsCommandAddrIndex + KTpDaTonNpiIndex,
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1189
            addressLength/2 + KTpDaTonNpiSize ) );
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1190
        }
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1191
    else if ( KSmsSubmitType == ( aTpdu[KMessageParamsIndex] & KCommandTypeMask ) )
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1192
        {
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1193
        ret = KSmsSubmitType;
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1194
        TUint8 addressLength = aTpdu[KSmsSubmitAddrIndex] + 1;
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1195
        aTpda.Set( aTpdu.Mid(
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1196
            KSmsSubmitAddrIndex + KTpDaTonNpiIndex,
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1197
            addressLength/2 + KTpDaTonNpiSize ) );
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1198
        }
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1199
    // no else
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1200
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1201
    return ret;
8486d82aef45 modemadaptation release 2010wk40
mikaruus
parents: 8
diff changeset
  1202
    }
0
63b37f68c1ce First Contribution. Vanilla as it came from Nokia
<dalarub>
parents:
diff changeset
  1203
// End of File