localconnectivityservice/modematplugin/src/modematplugin.cpp
author hgs
Sat, 24 Apr 2010 00:11:33 +0300
changeset 29 ce4f184690c9
parent 25 c4f07256ff37
permissions -rw-r--r--
201009
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
* All rights reserved.
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
*
hgs
parents:
diff changeset
     9
* Initial Contributors:
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
*
hgs
parents:
diff changeset
    12
* Contributors:
hgs
parents:
diff changeset
    13
*
hgs
parents:
diff changeset
    14
* Description:  Main handler for incoming requests
hgs
parents:
diff changeset
    15
*
hgs
parents:
diff changeset
    16
*/
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
hgs
parents:
diff changeset
    19
#include "modematplugin.h"
hgs
parents:
diff changeset
    20
#include "atcopscmd.h"
hgs
parents:
diff changeset
    21
#include "debug.h"
hgs
parents:
diff changeset
    22
hgs
parents:
diff changeset
    23
const TInt KErrorReplyLength = 9;  // CR+LF+"ERROR"+CR+LF
hgs
parents:
diff changeset
    24
hgs
parents:
diff changeset
    25
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
    26
// Two-phased constructor.
hgs
parents:
diff changeset
    27
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
    28
//
hgs
parents:
diff changeset
    29
CModemAtPlugin* CModemAtPlugin::NewL()
hgs
parents:
diff changeset
    30
    {
hgs
parents:
diff changeset
    31
    CModemAtPlugin* self = new (ELeave) CModemAtPlugin();
hgs
parents:
diff changeset
    32
    CleanupStack::PushL(self);
hgs
parents:
diff changeset
    33
    self->ConstructL();
hgs
parents:
diff changeset
    34
    CleanupStack::Pop(self);
hgs
parents:
diff changeset
    35
    return self;
hgs
parents:
diff changeset
    36
    }
hgs
parents:
diff changeset
    37
hgs
parents:
diff changeset
    38
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
    39
// Destructor.
hgs
parents:
diff changeset
    40
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
    41
//
hgs
parents:
diff changeset
    42
CModemAtPlugin::~CModemAtPlugin()
hgs
parents:
diff changeset
    43
	{
hgs
parents:
diff changeset
    44
    TRACE_FUNC_ENTRY
hgs
parents:
diff changeset
    45
	iHandlers.ResetAndDestroy();
hgs
parents:
diff changeset
    46
	iHandlers.Close();
hgs
parents:
diff changeset
    47
    iReplyBuffer.Close();
hgs
parents:
diff changeset
    48
    TRACE_FUNC_EXIT
hgs
parents:
diff changeset
    49
	}
hgs
parents:
diff changeset
    50
hgs
parents:
diff changeset
    51
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
    52
// CModemAtPlugin::CModemAtPlugin
hgs
parents:
diff changeset
    53
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
    54
//
hgs
parents:
diff changeset
    55
CModemAtPlugin::CModemAtPlugin() : CATExtPluginBase()
hgs
parents:
diff changeset
    56
    {
hgs
parents:
diff changeset
    57
    TRACE_FUNC_ENTRY
hgs
parents:
diff changeset
    58
    iHandler = NULL;
hgs
parents:
diff changeset
    59
    TRACE_FUNC_EXIT
hgs
parents:
diff changeset
    60
    }
hgs
parents:
diff changeset
    61
hgs
parents:
diff changeset
    62
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
    63
// CModemAtPlugin::ConstructL
hgs
parents:
diff changeset
    64
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
    65
//
hgs
parents:
diff changeset
    66
void CModemAtPlugin::ConstructL()
hgs
parents:
diff changeset
    67
    {
hgs
parents:
diff changeset
    68
    TRACE_FUNC_ENTRY
hgs
parents:
diff changeset
    69
    CATCommandHandlerBase* handler = NULL;
hgs
parents:
diff changeset
    70
    handler = CATCOPSCmd::NewL( this );
hgs
parents:
diff changeset
    71
    CleanupStack::PushL( handler );
hgs
parents:
diff changeset
    72
    iHandlers.AppendL( handler );
hgs
parents:
diff changeset
    73
    CleanupStack::Pop( handler );
hgs
parents:
diff changeset
    74
    TRACE_FUNC_EXIT
hgs
parents:
diff changeset
    75
   	}
hgs
parents:
diff changeset
    76
hgs
parents:
diff changeset
    77
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
    78
// Reports connection identifier name to the extension plugin.
hgs
parents:
diff changeset
    79
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
    80
//
hgs
parents:
diff changeset
    81
void CModemAtPlugin::ReportConnectionName( const TDesC8& /*aName*/ )
hgs
parents:
diff changeset
    82
    {
hgs
parents:
diff changeset
    83
    TRACE_FUNC_ENTRY
hgs
parents:
diff changeset
    84
    TRACE_FUNC_EXIT
hgs
parents:
diff changeset
    85
    }
hgs
parents:
diff changeset
    86
hgs
parents:
diff changeset
    87
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
    88
// Reports the support status of an AT command. This is a synchronous API.
hgs
parents:
diff changeset
    89
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
    90
//
hgs
parents:
diff changeset
    91
TBool CModemAtPlugin::IsCommandSupported( const TDesC8& aCmd )
hgs
parents:
diff changeset
    92
    {
hgs
parents:
diff changeset
    93
    TRACE_FUNC_ENTRY
hgs
parents:
diff changeset
    94
    TInt i;
hgs
parents:
diff changeset
    95
    TInt count = iHandlers.Count();
hgs
parents:
diff changeset
    96
    for ( i=0; i<count; i++ )
hgs
parents:
diff changeset
    97
        {
hgs
parents:
diff changeset
    98
        CATCommandHandlerBase* handler = iHandlers[i]; 
hgs
parents:
diff changeset
    99
        TBool supported = handler->IsCommandSupported( aCmd );
hgs
parents:
diff changeset
   100
        if ( supported )
hgs
parents:
diff changeset
   101
            {
hgs
parents:
diff changeset
   102
            iHandler = handler;
hgs
parents:
diff changeset
   103
            TRACE_FUNC_EXIT
hgs
parents:
diff changeset
   104
            return ETrue;
hgs
parents:
diff changeset
   105
            }
hgs
parents:
diff changeset
   106
        }
hgs
parents:
diff changeset
   107
    iHandler = NULL;
hgs
parents:
diff changeset
   108
    TRACE_FUNC_EXIT
hgs
parents:
diff changeset
   109
    return EFalse;
hgs
parents:
diff changeset
   110
    }
hgs
parents:
diff changeset
   111
hgs
parents:
diff changeset
   112
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   113
// Handles an AT command. Cancelling of the pending request is done by
hgs
parents:
diff changeset
   114
// HandleCommandCancel(). The implementation in the extension plugin should
hgs
parents:
diff changeset
   115
// be asynchronous.
hgs
parents:
diff changeset
   116
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   117
//
hgs
parents:
diff changeset
   118
void CModemAtPlugin::HandleCommand( const TDesC8& aCmd,
hgs
parents:
diff changeset
   119
                                     RBuf8& aReply,
hgs
parents:
diff changeset
   120
                                     TBool aReplyNeeded )
hgs
parents:
diff changeset
   121
	{
hgs
parents:
diff changeset
   122
	TRACE_FUNC_ENTRY
hgs
parents:
diff changeset
   123
	if ( iHandler )
hgs
parents:
diff changeset
   124
	    {
hgs
parents:
diff changeset
   125
        iHcCmd = &aCmd;
hgs
parents:
diff changeset
   126
        iHcReply = &aReply;
hgs
parents:
diff changeset
   127
	    iHandler->HandleCommand( aCmd, aReply, aReplyNeeded );
hgs
parents:
diff changeset
   128
	    }
hgs
parents:
diff changeset
   129
	TRACE_FUNC_EXIT
hgs
parents:
diff changeset
   130
    }
hgs
parents:
diff changeset
   131
hgs
parents:
diff changeset
   132
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   133
// Cancels a pending HandleCommand request.
hgs
parents:
diff changeset
   134
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   135
//
hgs
parents:
diff changeset
   136
void CModemAtPlugin::HandleCommandCancel()
hgs
parents:
diff changeset
   137
    {
hgs
parents:
diff changeset
   138
    TRACE_FUNC_ENTRY
hgs
parents:
diff changeset
   139
	if ( iHandler )
hgs
parents:
diff changeset
   140
	    {
hgs
parents:
diff changeset
   141
	    iHandler->HandleCommandCancel();
hgs
parents:
diff changeset
   142
	    }
hgs
parents:
diff changeset
   143
	TRACE_FUNC_EXIT
hgs
parents:
diff changeset
   144
    }
hgs
parents:
diff changeset
   145
hgs
parents:
diff changeset
   146
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   147
// Next reply part's length.
hgs
parents:
diff changeset
   148
// The value must be equal or less than KDefaultCmdBufLength.
hgs
parents:
diff changeset
   149
// When the reply from this method is zero, ATEXT stops calling
hgs
parents:
diff changeset
   150
// GetNextPartOfReply().
hgs
parents:
diff changeset
   151
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   152
//
hgs
parents:
diff changeset
   153
TInt CModemAtPlugin::NextReplyPartLength()
hgs
parents:
diff changeset
   154
    {
hgs
parents:
diff changeset
   155
    TRACE_FUNC_ENTRY
hgs
parents:
diff changeset
   156
    if ( iReplyBuffer.Length() < KDefaultCmdBufLength )
hgs
parents:
diff changeset
   157
        {
hgs
parents:
diff changeset
   158
        TRACE_FUNC_EXIT
hgs
parents:
diff changeset
   159
        return iReplyBuffer.Length();
hgs
parents:
diff changeset
   160
        }
hgs
parents:
diff changeset
   161
    TRACE_FUNC_EXIT
hgs
parents:
diff changeset
   162
    return KDefaultCmdBufLength;
hgs
parents:
diff changeset
   163
    }
hgs
parents:
diff changeset
   164
hgs
parents:
diff changeset
   165
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   166
// Gets the next part of reply initially set by HandleCommandComplete().
hgs
parents:
diff changeset
   167
// Length of aNextReply must be equal or less than KDefaultCmdBufLength.
hgs
parents:
diff changeset
   168
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   169
//
hgs
parents:
diff changeset
   170
TInt CModemAtPlugin::GetNextPartOfReply( RBuf8& aNextReply )
hgs
parents:
diff changeset
   171
    {
hgs
parents:
diff changeset
   172
    TRACE_FUNC_ENTRY
hgs
parents:
diff changeset
   173
    TInt retVal = CreatePartOfReply( aNextReply );
hgs
parents:
diff changeset
   174
    TRACE_FUNC_EXIT
hgs
parents:
diff changeset
   175
    return retVal;
hgs
parents:
diff changeset
   176
    }
hgs
parents:
diff changeset
   177
hgs
parents:
diff changeset
   178
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   179
// Receives unsolicited results. Cancelling of the pending request is done by
hgs
parents:
diff changeset
   180
// by ReceiveUnsolicitedResultCancel(). The implementation in the extension
hgs
parents:
diff changeset
   181
// plugin should be asynchronous.
hgs
parents:
diff changeset
   182
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   183
//
hgs
parents:
diff changeset
   184
void CModemAtPlugin::ReceiveUnsolicitedResult()
hgs
parents:
diff changeset
   185
    {
hgs
parents:
diff changeset
   186
    TRACE_FUNC_ENTRY
hgs
parents:
diff changeset
   187
    TRACE_FUNC_EXIT
hgs
parents:
diff changeset
   188
    }
hgs
parents:
diff changeset
   189
hgs
parents:
diff changeset
   190
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   191
// Cancels a pending ReceiveUnsolicitedResult request.
hgs
parents:
diff changeset
   192
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   193
//
hgs
parents:
diff changeset
   194
void CModemAtPlugin::ReceiveUnsolicitedResultCancel()
hgs
parents:
diff changeset
   195
    {
hgs
parents:
diff changeset
   196
    TRACE_FUNC_ENTRY
hgs
parents:
diff changeset
   197
    TRACE_FUNC_EXIT
hgs
parents:
diff changeset
   198
    }
hgs
parents:
diff changeset
   199
hgs
parents:
diff changeset
   200
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   201
// Reports NVRAM status change to the plugins.
hgs
parents:
diff changeset
   202
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   203
//
hgs
parents:
diff changeset
   204
void CModemAtPlugin::ReportNvramStatusChange( const TDesC8& /*aNvram*/ )
hgs
parents:
diff changeset
   205
    {
hgs
parents:
diff changeset
   206
    TRACE_FUNC_ENTRY
hgs
parents:
diff changeset
   207
    TRACE_FUNC_EXIT
hgs
parents:
diff changeset
   208
    }
hgs
parents:
diff changeset
   209
hgs
parents:
diff changeset
   210
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   211
// Reports about external handle command error condition.
hgs
parents:
diff changeset
   212
// This is for cases when for example DUN decided the reply contained an
hgs
parents:
diff changeset
   213
// error condition but the plugin is still handling the command internally.
hgs
parents:
diff changeset
   214
// Example: in command line "AT+TEST;ATDT1234" was given. "AT+TEST" returns
hgs
parents:
diff changeset
   215
// "OK" and "ATDT" returns "CONNECT". Because "OK" and "CONNECT" are
hgs
parents:
diff changeset
   216
// different reply types the condition is "ERROR" and DUN ends processing.
hgs
parents:
diff changeset
   217
// This solution keeps the pointer to the last AT command handling plugin
hgs
parents:
diff changeset
   218
// inside ATEXT and calls this function there to report the error.
hgs
parents:
diff changeset
   219
// It is to be noted that HandleCommandCancel() is not sufficient to stop
hgs
parents:
diff changeset
   220
// the processing as the command handling has already finished.
hgs
parents:
diff changeset
   221
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   222
//
hgs
parents:
diff changeset
   223
void CModemAtPlugin::ReportExternalHandleCommandError()
hgs
parents:
diff changeset
   224
    {
hgs
parents:
diff changeset
   225
    TRACE_FUNC_ENTRY
hgs
parents:
diff changeset
   226
    TRACE_FUNC_EXIT
hgs
parents:
diff changeset
   227
    }
hgs
parents:
diff changeset
   228
hgs
parents:
diff changeset
   229
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   230
// Creates part of reply from the global reply buffer to the destination
hgs
parents:
diff changeset
   231
// buffer. Used with APIs which need the next part of reply in multipart reply
hgs
parents:
diff changeset
   232
// requests.
hgs
parents:
diff changeset
   233
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   234
//
hgs
parents:
diff changeset
   235
TInt CModemAtPlugin::CreatePartOfReply( RBuf8& aDstBuffer )
hgs
parents:
diff changeset
   236
    {
hgs
parents:
diff changeset
   237
    TRACE_FUNC_ENTRY
hgs
parents:
diff changeset
   238
    if ( iReplyBuffer.Length() <= 0 )
hgs
parents:
diff changeset
   239
        {
hgs
parents:
diff changeset
   240
        TRACE_FUNC_EXIT
hgs
parents:
diff changeset
   241
        return KErrGeneral;
hgs
parents:
diff changeset
   242
        }
hgs
parents:
diff changeset
   243
    TInt partLength = NextReplyPartLength();
hgs
parents:
diff changeset
   244
    if ( iReplyBuffer.Length() < partLength )
hgs
parents:
diff changeset
   245
        {
hgs
parents:
diff changeset
   246
        TRACE_FUNC_EXIT
hgs
parents:
diff changeset
   247
        return KErrNotFound;
hgs
parents:
diff changeset
   248
        }
hgs
parents:
diff changeset
   249
    aDstBuffer.Create( iReplyBuffer, partLength );
hgs
parents:
diff changeset
   250
    iReplyBuffer.Delete( 0, partLength );
hgs
parents:
diff changeset
   251
    if ( iReplyBuffer.Length() == 0 )
hgs
parents:
diff changeset
   252
        {
hgs
parents:
diff changeset
   253
        iReplyBuffer.Close();
hgs
parents:
diff changeset
   254
        }
hgs
parents:
diff changeset
   255
    TRACE_FUNC_EXIT
hgs
parents:
diff changeset
   256
    return KErrNone;
hgs
parents:
diff changeset
   257
    }
hgs
parents:
diff changeset
   258
hgs
parents:
diff changeset
   259
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   260
// Creates an AT command reply based on the reply type and completes the
hgs
parents:
diff changeset
   261
// request to ATEXT. Uses iReplyBuffer for reply storage.
hgs
parents:
diff changeset
   262
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   263
//
hgs
parents:
diff changeset
   264
TInt CModemAtPlugin::CreateReplyAndComplete( TATExtensionReplyType aReplyType,
hgs
parents:
diff changeset
   265
                                              const TDesC8& aSrcBuffer,
hgs
parents:
diff changeset
   266
                                              TInt aError )
hgs
parents:
diff changeset
   267
    {
hgs
parents:
diff changeset
   268
    TRACE_FUNC_ENTRY
hgs
parents:
diff changeset
   269
    iReplyBuffer.Close();
hgs
parents:
diff changeset
   270
    if ( aError != KErrNone )
hgs
parents:
diff changeset
   271
        {
hgs
parents:
diff changeset
   272
        HandleCommandCompleted( aError, EReplyTypeUndefined );
hgs
parents:
diff changeset
   273
        iHcCmd = NULL;
hgs
parents:
diff changeset
   274
        iHcReply = NULL;
hgs
parents:
diff changeset
   275
        TRACE_FUNC_EXIT
hgs
parents:
diff changeset
   276
        return KErrNone;
hgs
parents:
diff changeset
   277
        }
hgs
parents:
diff changeset
   278
    if ( !iHcReply )
hgs
parents:
diff changeset
   279
        {
hgs
parents:
diff changeset
   280
        TRACE_FUNC_EXIT
hgs
parents:
diff changeset
   281
        return KErrGeneral;
hgs
parents:
diff changeset
   282
        }
hgs
parents:
diff changeset
   283
    switch ( aReplyType )
hgs
parents:
diff changeset
   284
        {
hgs
parents:
diff changeset
   285
        case EReplyTypeOther:
hgs
parents:
diff changeset
   286
            if ( iQuietMode )  //  In quite mode there should be no response at all. 
hgs
parents:
diff changeset
   287
                {
hgs
parents:
diff changeset
   288
                iReplyBuffer.Create( KNullDesC8 );
hgs
parents:
diff changeset
   289
                }
hgs
parents:
diff changeset
   290
            else
hgs
parents:
diff changeset
   291
                {
hgs
parents:
diff changeset
   292
                iReplyBuffer.Create( aSrcBuffer ); 
hgs
parents:
diff changeset
   293
                }
hgs
parents:
diff changeset
   294
            break;
hgs
parents:
diff changeset
   295
        case EReplyTypeOk:
hgs
parents:
diff changeset
   296
            CreateOkOrErrorReply( iReplyBuffer, ETrue );
hgs
parents:
diff changeset
   297
            break;
hgs
parents:
diff changeset
   298
        case EReplyTypeError:
hgs
parents:
diff changeset
   299
            CreateOkOrErrorReply( iReplyBuffer, EFalse );
hgs
parents:
diff changeset
   300
            break;
hgs
parents:
diff changeset
   301
        default:
hgs
parents:
diff changeset
   302
            TRACE_FUNC_EXIT
hgs
parents:
diff changeset
   303
            return KErrGeneral;
hgs
parents:
diff changeset
   304
        }
hgs
parents:
diff changeset
   305
    CreatePartOfReply( *iHcReply );
hgs
parents:
diff changeset
   306
    HandleCommandCompleted( KErrNone, aReplyType );
hgs
parents:
diff changeset
   307
    iHcCmd = NULL;
hgs
parents:
diff changeset
   308
    iHcReply = NULL;
hgs
parents:
diff changeset
   309
    TRACE_FUNC_EXIT
hgs
parents:
diff changeset
   310
    return KErrNone;
hgs
parents:
diff changeset
   311
    }
hgs
parents:
diff changeset
   312
hgs
parents:
diff changeset
   313
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   314
// Creates a buffer for "OK" or "ERROR" reply based on the line settings
hgs
parents:
diff changeset
   315
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   316
//
hgs
parents:
diff changeset
   317
TInt CModemAtPlugin::CreateOkOrErrorReply( RBuf8& aReplyBuffer,
hgs
parents:
diff changeset
   318
                                            TBool aOkReply )
hgs
parents:
diff changeset
   319
    {
hgs
parents:
diff changeset
   320
    TRACE_FUNC_ENTRY
hgs
parents:
diff changeset
   321
    if ( iQuietMode )
hgs
parents:
diff changeset
   322
        {
hgs
parents:
diff changeset
   323
        TRACE_FUNC_EXIT
hgs
parents:
diff changeset
   324
        return iReplyBuffer.Create( KNullDesC8 );
hgs
parents:
diff changeset
   325
        }
hgs
parents:
diff changeset
   326
    _LIT8( KErrorReplyVerbose, "ERROR" );
hgs
parents:
diff changeset
   327
    _LIT8( KOkReplyVerbose,    "OK" );
hgs
parents:
diff changeset
   328
    _LIT8( KErrorReplyNumeric, "4" );
hgs
parents:
diff changeset
   329
    _LIT8( KOkReplyNumeric,    "0" );
hgs
parents:
diff changeset
   330
    TBuf8<KErrorReplyLength> replyBuffer;
hgs
parents:
diff changeset
   331
    if ( iVerboseMode )
hgs
parents:
diff changeset
   332
        {
hgs
parents:
diff changeset
   333
        replyBuffer.Append( iCarriageReturn );
hgs
parents:
diff changeset
   334
        replyBuffer.Append( iLineFeed );
hgs
parents:
diff changeset
   335
        if ( aOkReply )
hgs
parents:
diff changeset
   336
            {
hgs
parents:
diff changeset
   337
            replyBuffer.Append( KOkReplyVerbose );
hgs
parents:
diff changeset
   338
            }
hgs
parents:
diff changeset
   339
        else
hgs
parents:
diff changeset
   340
            {
hgs
parents:
diff changeset
   341
            replyBuffer.Append( KErrorReplyVerbose );
hgs
parents:
diff changeset
   342
            }
hgs
parents:
diff changeset
   343
        replyBuffer.Append( iCarriageReturn );
hgs
parents:
diff changeset
   344
        replyBuffer.Append( iLineFeed );
hgs
parents:
diff changeset
   345
        }
hgs
parents:
diff changeset
   346
    else
hgs
parents:
diff changeset
   347
        {
hgs
parents:
diff changeset
   348
        if ( aOkReply )
hgs
parents:
diff changeset
   349
            {
hgs
parents:
diff changeset
   350
            replyBuffer.Append( KOkReplyNumeric );
hgs
parents:
diff changeset
   351
            }
hgs
parents:
diff changeset
   352
        else
hgs
parents:
diff changeset
   353
            {
hgs
parents:
diff changeset
   354
            replyBuffer.Append( KErrorReplyNumeric );
hgs
parents:
diff changeset
   355
            }
hgs
parents:
diff changeset
   356
        replyBuffer.Append( iCarriageReturn );
hgs
parents:
diff changeset
   357
        }
hgs
parents:
diff changeset
   358
    TInt retVal = aReplyBuffer.Create( replyBuffer );
hgs
parents:
diff changeset
   359
    TRACE_FUNC_EXIT
hgs
parents:
diff changeset
   360
    return retVal;
hgs
parents:
diff changeset
   361
    }
hgs
parents:
diff changeset
   362
hgs
parents:
diff changeset
   363
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   364
// From MLcCustomPlugin.
hgs
parents:
diff changeset
   365
// Returns the array of supported commands
hgs
parents:
diff changeset
   366
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   367
//
hgs
parents:
diff changeset
   368
TInt CModemAtPlugin::GetSupportedCommands( RPointerArray<HBufC8>& aCmds )
hgs
parents:
diff changeset
   369
    {
hgs
parents:
diff changeset
   370
    TRACE_FUNC_ENTRY
hgs
parents:
diff changeset
   371
    // Force superclass call here:
hgs
parents:
diff changeset
   372
    TInt retVal = CATExtPluginBase::GetSupportedCommands( aCmds );
hgs
parents:
diff changeset
   373
    TRACE_FUNC_EXIT
hgs
parents:
diff changeset
   374
    return retVal;
hgs
parents:
diff changeset
   375
    }
hgs
parents:
diff changeset
   376
hgs
parents:
diff changeset
   377
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   378
// From MLcCustomPlugin.
hgs
parents:
diff changeset
   379
// Returns plugin's character value settings (from CATExtPluginBase)
hgs
parents:
diff changeset
   380
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   381
//
hgs
parents:
diff changeset
   382
TInt CModemAtPlugin::GetCharacterValue( TCharacterTypes aCharType,
hgs
parents:
diff changeset
   383
                                         TChar& aChar )
hgs
parents:
diff changeset
   384
    {
hgs
parents:
diff changeset
   385
    TRACE_FUNC_ENTRY
hgs
parents:
diff changeset
   386
    TInt retVal = KErrNone;
hgs
parents:
diff changeset
   387
    switch ( aCharType )
hgs
parents:
diff changeset
   388
        {
hgs
parents:
diff changeset
   389
        case ECharTypeCR:
hgs
parents:
diff changeset
   390
            aChar = iCarriageReturn;
hgs
parents:
diff changeset
   391
            break;
hgs
parents:
diff changeset
   392
        case ECharTypeLF:
hgs
parents:
diff changeset
   393
            aChar = iLineFeed;
hgs
parents:
diff changeset
   394
            break;
hgs
parents:
diff changeset
   395
        case ECharTypeBS:
hgs
parents:
diff changeset
   396
            aChar = iBackspace;
hgs
parents:
diff changeset
   397
            break;
hgs
parents:
diff changeset
   398
        default:
hgs
parents:
diff changeset
   399
            retVal = KErrNotFound;
hgs
parents:
diff changeset
   400
            break;
hgs
parents:
diff changeset
   401
        }
hgs
parents:
diff changeset
   402
    TRACE_FUNC_EXIT
hgs
parents:
diff changeset
   403
    return retVal;
hgs
parents:
diff changeset
   404
    }
hgs
parents:
diff changeset
   405
hgs
parents:
diff changeset
   406
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   407
// From MLcCustomPlugin.
hgs
parents:
diff changeset
   408
// Returns plugin's mode value settings (from CATExtPluginBase)
hgs
parents:
diff changeset
   409
// ---------------------------------------------------------------------------
hgs
parents:
diff changeset
   410
//
hgs
parents:
diff changeset
   411
TInt CModemAtPlugin::GetModeValue( TModeTypes aModeType, TBool& aMode )
hgs
parents:
diff changeset
   412
    {
hgs
parents:
diff changeset
   413
    TRACE_FUNC_ENTRY
hgs
parents:
diff changeset
   414
    TInt retVal = KErrNone;
hgs
parents:
diff changeset
   415
    switch ( aModeType )
hgs
parents:
diff changeset
   416
        {
hgs
parents:
diff changeset
   417
        case EModeTypeQuiet:
hgs
parents:
diff changeset
   418
            aMode = iQuietMode;
hgs
parents:
diff changeset
   419
            break;
hgs
parents:
diff changeset
   420
        case EModeTypeVerbose:
hgs
parents:
diff changeset
   421
            aMode = iVerboseMode;
hgs
parents:
diff changeset
   422
            break;
hgs
parents:
diff changeset
   423
        default:
hgs
parents:
diff changeset
   424
            retVal = KErrNotFound;
hgs
parents:
diff changeset
   425
            break;
hgs
parents:
diff changeset
   426
        }
hgs
parents:
diff changeset
   427
    TRACE_FUNC_EXIT
hgs
parents:
diff changeset
   428
    return retVal;
hgs
parents:
diff changeset
   429
    }