bluetoothengine/headsetsimulator/profiles/hfpprofile/src/features/hfpcallinglineidentification.cpp
branchheadsetsimulator
changeset 60 90dbfc0435e3
equal deleted inserted replaced
59:02103bf20ee5 60:90dbfc0435e3
       
     1 /* 
       
     2  *
       
     3  * Copyright (c) <2010> Comarch S.A. and/or its subsidiary(-ies).
       
     4  * All rights reserved.
       
     5  * This component and the accompanying materials are made available
       
     6  * under the terms of the License "Eclipse Public License v1.0"
       
     7  * which accompanies this distribution, and is available
       
     8  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     9  *
       
    10  * Original Contributors:
       
    11  * Comarch S.A. - original contribution.
       
    12  *
       
    13  * Contributors:
       
    14  *
       
    15  * Description:
       
    16  *
       
    17  */
       
    18 
       
    19 #include "hfpcallinglineidentification.h"
       
    20 #include "hfpcommand.h"
       
    21 #include "hfpsettings.h"
       
    22 #include "debug.h"
       
    23 
       
    24 CHsHFPCallingLineIdentification* CHsHFPCallingLineIdentification::NewL(
       
    25         MHsHFPFeatureProviderObserver* aObserver )
       
    26     {
       
    27     CHsHFPCallingLineIdentification *self =
       
    28             CHsHFPCallingLineIdentification::NewLC( aObserver );
       
    29     CleanupStack::Pop( self );
       
    30 
       
    31     return self;
       
    32     }
       
    33 
       
    34 CHsHFPCallingLineIdentification* CHsHFPCallingLineIdentification::NewLC(
       
    35         MHsHFPFeatureProviderObserver* aObserver )
       
    36     {
       
    37     CHsHFPCallingLineIdentification *self =
       
    38             new ( ELeave ) CHsHFPCallingLineIdentification( aObserver );
       
    39     CleanupStack::PushL( self );
       
    40     self->ConstructL();
       
    41     return self;
       
    42     }
       
    43 
       
    44 CHsHFPCallingLineIdentification::~CHsHFPCallingLineIdentification()
       
    45     {
       
    46     TRACE_FUNC_ENTRY
       
    47     if ( iSettings )
       
    48         {
       
    49         iSettings->Release();
       
    50         }
       
    51     TRACE_FUNC_EXIT
       
    52     }
       
    53 
       
    54 TInt CHsHFPCallingLineIdentification::ProcessCommand(
       
    55         const CHsHFPCommand &aInputCmd, CHsHFPCommand &aOutputCmd )
       
    56     {
       
    57     TRACE_FUNC_ENTRY
       
    58 
       
    59     TInt res = KErrNone;
       
    60     if ( aInputCmd.FromAG() )
       
    61         {
       
    62         if ( iWaitingForOK && aInputCmd.Type() == EHFPCmdOK )
       
    63             {
       
    64             iWaitingForOK = EFalse;
       
    65             iObserver->HandleProcedureCompleted( KErrNone );
       
    66             }
       
    67         else if ( aInputCmd.Type() == EHFPCmdCLIP )
       
    68             {
       
    69             iObserver->HandleProcedureCompleted( KErrNone );
       
    70             }
       
    71         else
       
    72             {
       
    73             res = KErrArgument;
       
    74             }
       
    75         }
       
    76     else
       
    77         {
       
    78         if ( aInputCmd.Type() == EHFPCmdCLIP )
       
    79             {
       
    80             iWaitingForOK = ETrue;
       
    81             TRAP(res,CHsHFPCommand::CopyL( aInputCmd, aOutputCmd ));
       
    82             }
       
    83         else
       
    84             {
       
    85             res = KErrArgument;
       
    86             }
       
    87         }
       
    88 
       
    89     TRACE_FUNC_EXIT
       
    90     return res;
       
    91     }
       
    92 
       
    93 CHsHFPCallingLineIdentification::CHsHFPCallingLineIdentification(
       
    94         MHsHFPFeatureProviderObserver* aObserver ) :
       
    95     iObserver( aObserver )
       
    96     {
       
    97 
       
    98     }
       
    99 
       
   100 void CHsHFPCallingLineIdentification::ConstructL()
       
   101     {
       
   102     iSettings = CHsHFPSettings::InstanceL();
       
   103     }
       
   104