convergedcallengine/csplugin/src/rcsplinecontainer.cpp
branchRCL_3
changeset 20 987c9837762f
parent 0 ff3b6d0fd310
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
       
     1 /*
       
     2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Container for ETel line subsessions.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 //  INCLUDES
       
    21 #include    <rmmcustomapi.h>
       
    22 #include    <mmtsy_names.h>  // tsy and phone names
       
    23 #include    <cccpcallparameters.h>
       
    24 #include    <cccecallparameters.h>
       
    25 
       
    26 #include    "rcsplinecontainer.h"
       
    27 #include    "csppanic.pan"
       
    28 #include    "csplogger.h"
       
    29 
       
    30 // ============================ MEMBER FUNCTIONS ===============================
       
    31 
       
    32 // Default c++ constructor
       
    33 RCSPLineContainer::RCSPLineContainer()
       
    34     {
       
    35     }
       
    36 
       
    37 // ---------------------------------------------------------
       
    38 // RCSPLineContainer::Open
       
    39 //
       
    40 // ---------------------------------------------------------
       
    41 //
       
    42 TInt RCSPLineContainer::Open( RMobilePhone& aPhone, TUint32 aServiceId )
       
    43     {
       
    44     CSPLOGSTRING( CSPINT, "RCSPLineContainer::Open" );
       
    45     iServiceId = aServiceId;
       
    46     
       
    47     TInt error = iPrimaryLine.Open( aPhone, KMmTsyVoice1LineName);
       
    48     if (error != KErrNone)
       
    49         {
       
    50         CSPLOGSTRING2( CSPINT, "RCSPLineContainer::Open voice ERROR %d", error );
       
    51         return error;
       
    52         }
       
    53 
       
    54     // Ignore errors on the rest of the lines - they are non-essential
       
    55     error = iAls2Line.Open( aPhone, KMmTsyVoice2LineName );
       
    56     if ( error )
       
    57         {
       
    58         CSPLOGSTRING2( CSPINT, "RCSPLineContainer::Open voice2 ERROR %d", error );
       
    59         }
       
    60         
       
    61     error = iDataLine.Open( aPhone, KMmTsyDataLineName );
       
    62     if ( error )
       
    63         {
       
    64         CSPLOGSTRING2( CSPINT, "RCSPLineContainer::Open data ERROR %d", error );
       
    65         }
       
    66         
       
    67     error = iFaxLine.Open( aPhone, KMmTsyFaxLineName );
       
    68     if ( error )
       
    69         {
       
    70         CSPLOGSTRING2( CSPINT, "RCSPLineContainer::Open fax ERROR %d", error );
       
    71         }
       
    72     return KErrNone;
       
    73     }
       
    74 
       
    75 // ---------------------------------------------------------
       
    76 // RCSPLineContainer::Close
       
    77 //
       
    78 // ---------------------------------------------------------
       
    79 //
       
    80 void RCSPLineContainer::Close()
       
    81     {
       
    82     CSPLOGSTRING( CSPINT, "RCSPLineContainer::Close" );
       
    83     iPrimaryLine.Close();
       
    84     iAls2Line.Close();
       
    85     iDataLine.Close(); 
       
    86     iFaxLine.Close(); 
       
    87     }
       
    88 
       
    89 // ---------------------------------------------------------
       
    90 // RCSPLineContainer::LineByType
       
    91 //
       
    92 // ---------------------------------------------------------
       
    93 //
       
    94 RMobileLine& RCSPLineContainer::LineByType( TCSPLineId aLine )
       
    95     {
       
    96     CSPLOGSTRING2( CSPINT, "RCSPLineContainer::LineByType %d", aLine );    
       
    97     switch(aLine)
       
    98         {
       
    99         case ECSPLineSpeech:
       
   100             CSPLOGSTRING2( CSPINT, "RCSPLineContainer::LineByType Speech %d", aLine );
       
   101             return iPrimaryLine;
       
   102         case ECSPLineAuxSpeech:
       
   103             CSPLOGSTRING2( CSPINT, "RCSPLineContainer::LineByType AuxSpeech %d", aLine );
       
   104             return iAls2Line;
       
   105         case ECSPLineData:
       
   106             CSPLOGSTRING2( CSPINT, "RCSPLineContainer::LineByType Data %d", aLine );
       
   107             return iDataLine;
       
   108         case ECSPLineFax:
       
   109             CSPLOGSTRING2( CSPINT, "RCSPLineContainer::LineByType Fax %d", aLine );
       
   110             return iFaxLine;
       
   111         default:
       
   112             CSPLOGSTRING2( CSPINT, "RCSPLineContainer::INVALID LINE ID %d", aLine );
       
   113             Panic( ECSPPanicInvalidParameter );
       
   114             return iPrimaryLine;
       
   115         }
       
   116     }
       
   117 
       
   118 // ---------------------------------------------------------
       
   119 // True if the line matching the line id is open.
       
   120 // ---------------------------------------------------------
       
   121 // 
       
   122 TBool RCSPLineContainer::LineIsOpen( TCSPLineId aType )
       
   123     {
       
   124     CSPLOGSTRING2( CSPINT, "RCSPLineContainer::LineIsOpen %d", aType );
       
   125     RMobileLine& line = LineByType(aType);
       
   126     return (line.SubSessionHandle() != KNullHandle);
       
   127     }
       
   128 
       
   129 // ---------------------------------------------------------
       
   130 // Resolves line id based on service id, call type and line 
       
   131 // type.
       
   132 // ---------------------------------------------------------
       
   133 // 
       
   134 RCSPLineContainer::TCSPLineId RCSPLineContainer::ResolveLineIdL( 
       
   135             const CCCECallParameters& aCallParameters ) const
       
   136     {
       
   137     CSPLOGSTRING(CSPOBJECT, "CSProvider::ResolveLineIdL");
       
   138     RCSPLineContainer::TCSPLineId lineId = RCSPLineContainer::ECSPLineSpeech;
       
   139     
       
   140     switch ( aCallParameters.CallType() )
       
   141         {
       
   142         case CCPCall::ECallTypeCSVoice:
       
   143             {
       
   144             if ( aCallParameters.LineType() == CCCECallParameters::ECCELineTypeAux )
       
   145                 {
       
   146                 lineId = RCSPLineContainer::ECSPLineAuxSpeech;
       
   147                 }
       
   148             else if ( aCallParameters.LineType() == CCCECallParameters::ECCELineTypePrimary )
       
   149                 {
       
   150                 lineId = RCSPLineContainer::ECSPLineSpeech;
       
   151                 }
       
   152             else
       
   153                 {
       
   154                 CSPLOGSTRING(CSPOBJECT, "CSProvider::ResolveLineIdL ERROR: Unknown line type.");
       
   155                 User::Leave( KErrNotSupported );
       
   156                 }
       
   157             break;
       
   158             }
       
   159         case CCPCall::ECallTypeVideo: // Fall through
       
   160             {
       
   161             lineId = RCSPLineContainer::ECSPLineData;
       
   162             break;
       
   163             }
       
   164   
       
   165         default:
       
   166             {
       
   167             CSPLOGSTRING(CSPOBJECT, "CSProvider::ResolveLineIdL ERROR: Unknown call type");
       
   168             User::Leave( KErrNotSupported );
       
   169             }
       
   170         }
       
   171         
       
   172     return lineId;
       
   173     }
       
   174     
       
   175 // ---------------------------------------------------------
       
   176 // Resolves call type, service id and line type based on 
       
   177 // line id.
       
   178 // ---------------------------------------------------------
       
   179 // 
       
   180 TInt RCSPLineContainer::ResolveCallInfo( RCSPLineContainer::TCSPLineId aLineId, 
       
   181                                   TUint32& aServiceId,
       
   182                                   CCPCall::TCallType& aCallType,
       
   183                                   CCCECallParameters::TCCELineType& aLineType ) const
       
   184                                   
       
   185     {
       
   186     TInt err(KErrNone);
       
   187     aLineType = CCCECallParameters::ECCELineTypePrimary;    
       
   188     aServiceId = iServiceId;
       
   189     
       
   190     if ( aLineId == RCSPLineContainer::ECSPLineSpeech )
       
   191         {
       
   192         aCallType = CCPCall::ECallTypeCSVoice;            
       
   193         }
       
   194     else if ( aLineId == RCSPLineContainer::ECSPLineAuxSpeech )
       
   195         {
       
   196         aCallType = CCPCall::ECallTypeCSVoice;
       
   197         aLineType = CCCECallParameters::ECCELineTypeAux;
       
   198         }
       
   199     else if ( aLineId == RCSPLineContainer::ECSPLineData )
       
   200         {
       
   201         aCallType = CCPCall::ECallTypeVideo;
       
   202         }
       
   203     else
       
   204         {
       
   205         CSPLOGSTRING(CSPOBJECT, "RCSPLineContainer::ResolveCallInfo() ERROR Unknown line id");
       
   206         err = KErrArgument;
       
   207         }
       
   208     CSPLOGSTRING2(CSPINT, "RCSPLineContainer::ResolveCallInfo() aCallType=%d", aCallType );
       
   209     CSPLOGSTRING2(CSPINT, "RCSPLineContainer::ResolveCallInfo() aLineType=%d", aLineType );
       
   210     
       
   211     return err;
       
   212     }
       
   213 
       
   214 
       
   215 //  End of File  
       
   216