telephonyserverplugins/common_tsy/commontsy/src/mmcustomtsy/CMmPacketTsy.cpp
branchRCL_3
changeset 66 07a122eea281
parent 65 630d2f34d719
child 74 9200f38b1324
equal deleted inserted replaced
65:630d2f34d719 66:07a122eea281
     1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    13 // Description:
    13 // Description:
    14 //
    14 //
    15 
    15 
    16 
    16 
    17 
    17 
    18 
    18 #include <ctsy/tflogger.h>
    19 #include "OstTraceDefinitions.h"
       
    20 #ifdef OST_TRACE_COMPILER_IN_USE
       
    21 #include "CMmPacketTsyTraces.h"
       
    22 #endif
       
    23 
    19 
    24 #include "CMmCustomTsy.h"
    20 #include "CMmCustomTsy.h"
    25 #include "CMmPacketTsy.h"
    21 #include "CMmPacketTsy.h"
    26 #include "Cmmpacketcontexttsy.h"
    22 #include "Cmmpacketcontexttsy.h"
    27 #include "Cmmpacketcontextlist.h"
    23 #include "Cmmpacketcontextlist.h"
    49 
    45 
    50 CMmPacketTsy* CMmPacketTsy::NewL(
    46 CMmPacketTsy* CMmPacketTsy::NewL(
    51     CMmCustomTsy* aMmCustomTsy, 
    47     CMmCustomTsy* aMmCustomTsy, 
    52     CMmPhoneTsy* aMmPhone )
    48     CMmPhoneTsy* aMmPhone )
    53     {
    49     {
    54 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMPACKETTSY_NEWL_1,  "CustomTSY: CMmPacketTsy::NewL" );
    50 TFLOGSTRING( "CustomTSY: CMmPacketTsy::NewL" );
    55     CMmPacketTsy* mmPacketTsy = new ( ELeave ) CMmPacketTsy();
    51     CMmPacketTsy* mmPacketTsy = new ( ELeave ) CMmPacketTsy();
    56     CleanupStack::PushL( mmPacketTsy );
    52     CleanupStack::PushL( mmPacketTsy );
    57     mmPacketTsy->iMmCustomTsy = aMmCustomTsy;
    53     mmPacketTsy->iMmCustomTsy = aMmCustomTsy;
    58     mmPacketTsy->iMmPhone = aMmPhone;
    54     mmPacketTsy->iMmPhone = aMmPhone;
    59     mmPacketTsy->ConstructL();
    55     mmPacketTsy->ConstructL();
    62     return mmPacketTsy;
    58     return mmPacketTsy;
    63     }
    59     }
    64 
    60 
    65 CMmPacketTsy::~CMmPacketTsy()
    61 CMmPacketTsy::~CMmPacketTsy()
    66     {
    62     {
    67 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMPACKETTSY_DTOR_1,  "CustomTSY: CMmPacketTsy::~CMmPacketTsy" );
    63 TFLOGSTRING( "CustomTSY: CMmPacketTsy::~CMmPacketTsy" );
    68     delete iTsyReqHandleStore;
    64     delete iTsyReqHandleStore;
    69     }
    65     }
    70 
    66 
    71 // ---------------------------------------------------------------------------
    67 // ---------------------------------------------------------------------------
    72 // CMmPacketTsy::Init
    68 // CMmPacketTsy::Init
   162 TInt CMmPacketTsy::DoExtFuncL(
   158 TInt CMmPacketTsy::DoExtFuncL(
   163     const TTsyReqHandle aTsyReqHandle, 
   159     const TTsyReqHandle aTsyReqHandle, 
   164     const TInt aIpc, 
   160     const TInt aIpc, 
   165     const TDataPackage& aPackage )
   161     const TDataPackage& aPackage )
   166     {
   162     {
   167 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMPACKETTSY_DOEXTFUNCL_1,  "CustomTSY: CMmPacketTsy::DoExtFuncL - IPC:%d Handle:%d", aIpc, aTsyReqHandle );
   163 TFLOGSTRING3( "CustomTSY: CMmPacketTsy::DoExtFuncL - IPC:%d Handle:%d", aIpc, aTsyReqHandle );
   168     TInt ret( KErrNotSupported );
   164     TInt ret( KErrNotSupported );
   169 
   165 
   170     switch ( aIpc )
   166     switch ( aIpc )
   171         {
   167         {
   172         case ECustomNotifyEGprsInfoChange:
   168         case ECustomNotifyEGprsInfoChange:
   174             break;
   170             break;
   175         case ECustomGetEGprsInfo:
   171         case ECustomGetEGprsInfo:
   176             ret = GetEGprsInfo( aTsyReqHandle, aPackage.Des1n() );
   172             ret = GetEGprsInfo( aTsyReqHandle, aPackage.Des1n() );
   177             break;
   173             break;
   178         case ECustomSetAlwaysOnMode:
   174         case ECustomSetAlwaysOnMode:
   179 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMPACKETTSY_DOEXTFUNCL_2,  "TSY:CMmPacketTsy::DoExtFuncL ECustomSetAlwaysOnMode");
   175 TFLOGSTRING( "TSY:CMmPacketTsy::DoExtFuncL ECustomSetAlwaysOnMode");
   180             ret = SetAlwaysOnL( aTsyReqHandle,
   176             ret = SetAlwaysOnL( aTsyReqHandle,
   181                ( REINTERPRET_CAST( RMmCustomAPI::TSetAlwaysOnMode*,
   177                ( REINTERPRET_CAST( RMmCustomAPI::TSetAlwaysOnMode*,
   182                               					aPackage.Ptr1() ) ) );
   178                               					aPackage.Ptr1() ) ) );
   183         default:
   179         default:
   184             break;
   180             break;
   280 //
   276 //
   281 TInt CMmPacketTsy::CancelService(
   277 TInt CMmPacketTsy::CancelService(
   282     const TInt aIpc, 
   278     const TInt aIpc, 
   283     const TTsyReqHandle aTsyReqHandle )
   279     const TTsyReqHandle aTsyReqHandle )
   284     {
   280     {
   285 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMPACKETTSY_CANCELSERVICE_1,  "CustomTSY: CMmPacketTsy::CancelService IPC:%d", aIpc );
   281 TFLOGSTRING2( "CustomTSY: CMmPacketTsy::CancelService IPC:%d", aIpc );
   286     TInt ret( KErrNone );
   282     TInt ret( KErrNone );
   287 
   283 
   288     // Req handle type
   284     // Req handle type
   289     TPacketRequestType reqHandletype( 
   285     TPacketRequestType reqHandletype( 
   290         EMultimodePacketContextReqHandleUnknown );
   286         EMultimodePacketContextReqHandleUnknown );
   336 //
   332 //
   337 void CMmPacketTsy::ReqCompleted(
   333 void CMmPacketTsy::ReqCompleted(
   338     const TTsyReqHandle aTsyReqHandle, 
   334     const TTsyReqHandle aTsyReqHandle, 
   339     const TInt aError )
   335     const TInt aError )
   340     {
   336     {
   341 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMPACKETTSY_REQCOMPLETED_1,  "CustomTSY: CMmPacketTsy::ReqCompleted Handle:%d Error:%d", aTsyReqHandle, aError );
   337 TFLOGSTRING3( "CustomTSY: CMmPacketTsy::ReqCompleted Handle:%d Error:%d", aTsyReqHandle, aError );
   342     iMmCustomTsy->ReqCompleted( aTsyReqHandle, aError );
   338     iMmCustomTsy->ReqCompleted( aTsyReqHandle, aError );
   343     }
   339     }
   344 
   340 
   345 // ---------------------------------------------------------------------------
   341 // ---------------------------------------------------------------------------
   346 // CMmPacketTsy::NotifyEGprsInfoChange
   342 // CMmPacketTsy::NotifyEGprsInfoChange
   350 //
   346 //
   351 TInt CMmPacketTsy::NotifyEGprsInfoChange(
   347 TInt CMmPacketTsy::NotifyEGprsInfoChange(
   352     const TTsyReqHandle aTsyReqHandle, 
   348     const TTsyReqHandle aTsyReqHandle, 
   353     TDes8* aGprsInformation )
   349     TDes8* aGprsInformation )
   354     {
   350     {
   355 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMPACKETTSY_NOTIFYEGPRSINFOCHANGE_1,  "CustomTSY: CMmPacketTsy::NotifyEGprsInfoChange" );
   351 TFLOGSTRING( "CustomTSY: CMmPacketTsy::NotifyEGprsInfoChange" );
   356 
   352 
   357     RMmCustomAPI::TGprsInformation temp;
   353     RMmCustomAPI::TGprsInformation temp;
   358 	RMmCustomAPI::TGprsInformationPckg tempPckg(temp);
   354 	RMmCustomAPI::TGprsInformationPckg tempPckg(temp);
   359 
   355 
   360 	TInt expectedLength = tempPckg.MaxLength();
   356 	TInt expectedLength = tempPckg.MaxLength();
   384 //
   380 //
   385 TInt CMmPacketTsy::GetEGprsInfo(
   381 TInt CMmPacketTsy::GetEGprsInfo(
   386     const TTsyReqHandle aTsyReqHandle, 
   382     const TTsyReqHandle aTsyReqHandle, 
   387     TDes8* aGprsInformation )
   383     TDes8* aGprsInformation )
   388     {
   384     {
   389 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMPACKETTSY_GETEGPRSINFO_1,  "CustomTSY: CMmPacketTsy::GetEGprsInfo" );
   385 TFLOGSTRING( "CustomTSY: CMmPacketTsy::GetEGprsInfo" );
   390 
   386 
   391     RMmCustomAPI::TGprsInformation temp;
   387     RMmCustomAPI::TGprsInformation temp;
   392 	RMmCustomAPI::TGprsInformationPckg tempPckg(temp);
   388 	RMmCustomAPI::TGprsInformationPckg tempPckg(temp);
   393 
   389 
   394 	TInt expectedLength = tempPckg.MaxLength();
   390 	TInt expectedLength = tempPckg.MaxLength();
   421 	        }
   417 	        }
   422 
   418 
   423 	    // if gprsSupportInCell is ETrue -> cell is supporting EGPRS connection 
   419 	    // if gprsSupportInCell is ETrue -> cell is supporting EGPRS connection 
   424 	    if ( edgeGprsSupportInCell )
   420 	    if ( edgeGprsSupportInCell )
   425 	        {
   421 	        {
   426 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMPACKETTSY_GETEGPRSINFO_2,  "CustomTSY: CMmPacketTsy::GetEGprsInfo  RMmCustomAPI::EEdgeGprs" );
   422 	TFLOGSTRING( "CustomTSY: CMmPacketTsy::GetEGprsInfo  RMmCustomAPI::EEdgeGprs" );
   427 	        gprsInformation.iGprsInfo = RMmCustomAPI::EEdgeGprs; 
   423 	        gprsInformation.iGprsInfo = RMmCustomAPI::EEdgeGprs; 
   428 	        }
   424 	        }
   429 
   425 
   430 	    // else EGPRS connection is not supported
   426 	    // else EGPRS connection is not supported
   431 	    else 
   427 	    else 
   432 	        {
   428 	        {
   433 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMPACKETTSY_GETEGPRSINFO_3,  "CustomTSY: CMmPacketTsy::GetEGprsInfo  RMmCustomAPI::EGprs" );
   429 	TFLOGSTRING( "CustomTSY: CMmPacketTsy::GetEGprsInfo  RMmCustomAPI::EGprs" );
   434 	        gprsInformation.iGprsInfo = RMmCustomAPI::EGprs;
   430 	        gprsInformation.iGprsInfo = RMmCustomAPI::EGprs;
   435 	        }
   431 	        }
   436 
   432 
   437 		ret = KErrNone;
   433 		ret = KErrNone;
   438 		
   434 		
   450 // ---------------------------------------------------------------------------
   446 // ---------------------------------------------------------------------------
   451 //
   447 //
   452 void CMmPacketTsy::CompleteNotifyEGprsInfoChange(
   448 void CMmPacketTsy::CompleteNotifyEGprsInfoChange(
   453     const TBool aGprsSupportInCell )
   449     const TBool aGprsSupportInCell )
   454     {
   450     {
   455 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMPACKETTSY_COMPLETENOTIFYEGPRSINFOCHANGE_1,  "CustomTSY: CMmPacketTsy::CompleteNotifyEGprsInfoChange" );
   451 TFLOGSTRING( "CustomTSY: CMmPacketTsy::CompleteNotifyEGprsInfoChange" );
   456     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
   452     TTsyReqHandle reqHandle = iTsyReqHandleStore->ResetTsyReqHandle(
   457         EMultimodePacketContextNotifyEGprsInfoChange );
   453         EMultimodePacketContextNotifyEGprsInfoChange );
   458 
   454 
   459     if ( EMultimodePacketContextReqHandleUnknown != reqHandle )
   455     if ( EMultimodePacketContextReqHandleUnknown != reqHandle )
   460         {
   456         {
   463             ( *iGprsInformationPckg )();
   459             ( *iGprsInformationPckg )();
   464 
   460 
   465         // if aGprsSupportInCell is ETrue -> cell is supporting edge GPRS
   461         // if aGprsSupportInCell is ETrue -> cell is supporting edge GPRS
   466         if ( aGprsSupportInCell )
   462         if ( aGprsSupportInCell )
   467             {
   463             {
   468 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMPACKETTSY_COMPLETENOTIFYEGPRSINFOCHANGE_2,  "CustomTSY: CMmPacketTsy::CompleteNotifyEGprsInfoChange  RMmCustomAPI::EEdgeGprs" );
   464 TFLOGSTRING( "CustomTSY: CMmPacketTsy::CompleteNotifyEGprsInfoChange  RMmCustomAPI::EEdgeGprs" );
   469             gprsInformation.iGprsInfo = RMmCustomAPI::EEdgeGprs;
   465             gprsInformation.iGprsInfo = RMmCustomAPI::EEdgeGprs;
   470             }
   466             }
   471 
   467 
   472         // if aGprsSupportInCell is EFalse -> cell is not supporting edge GPRS
   468         // if aGprsSupportInCell is EFalse -> cell is not supporting edge GPRS
   473         else 
   469         else 
   474             {
   470             {
   475 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMPACKETTSY_COMPLETENOTIFYEGPRSINFOCHANGE_3,  "CustomTSY: CMmPacketTsy::CompleteNotifyEGprsInfoChange  RMmCustomAPI::EGprs" );
   471 TFLOGSTRING( "CustomTSY: CMmPacketTsy::CompleteNotifyEGprsInfoChange  RMmCustomAPI::EGprs" );
   476             gprsInformation.iGprsInfo = RMmCustomAPI::EGprs;
   472             gprsInformation.iGprsInfo = RMmCustomAPI::EGprs;
   477             }
   473             }
   478                     
   474                     
   479         iGprsInformationPckg = NULL;
   475         iGprsInformationPckg = NULL;
   480 
   476 
   491 //
   487 //
   492 TInt CMmPacketTsy::SetAlwaysOnL( 
   488 TInt CMmPacketTsy::SetAlwaysOnL( 
   493 	TTsyReqHandle aTsyReqHandle,
   489 	TTsyReqHandle aTsyReqHandle,
   494 	RMmCustomAPI::TSetAlwaysOnMode* aMode )
   490 	RMmCustomAPI::TSetAlwaysOnMode* aMode )
   495     {
   491     {
   496 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMPACKETTSY_SETALWAYSONL_1,  "CMmPacketTsy::SetAlwaysOn Reg Handle = %d", aTsyReqHandle );
   492 TFLOGSTRING2( "CMmPacketTsy::SetAlwaysOn Reg Handle = %d", aTsyReqHandle );
   497 	
   493 	
   498 	TInt ret( KErrGeneral );
   494 	TInt ret( KErrGeneral );
   499 	
   495 	
   500 											
   496 											
   501 	//Save requested mode 
   497 	//Save requested mode 
   508         //request set allways on
   504         //request set allways on
   509         ret = packetDataSession->SetAlwaysOnL( aTsyReqHandle, iAllwaysOnMode );
   505         ret = packetDataSession->SetAlwaysOnL( aTsyReqHandle, iAllwaysOnMode );
   510         }
   506         }
   511     else
   507     else
   512         {
   508         {
   513 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMPACKETTSY_SETALWAYSONL_2,  "CMmPacketTsy::SetAlwaysOn packetDataSession is NULL " );
   509 TFLOGSTRING( "CMmPacketTsy::SetAlwaysOn packetDataSession is NULL " );		
   514         }	
   510         }	
   515 		
   511 		
   516     return ret;
   512     return ret;
   517     }
   513     }
   518 
   514 
   524 //
   520 //
   525 void CMmPacketTsy::CompleteSetAlwaysOn( 
   521 void CMmPacketTsy::CompleteSetAlwaysOn( 
   526 	TTsyReqHandle aReqHandle, 
   522 	TTsyReqHandle aReqHandle, 
   527 	TInt aError )
   523 	TInt aError )
   528     {
   524     {
   529 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMPACKETTSY_COMPLETESETALWAYSON_1,  "CMmPacketTsy::CompleteSetAlwaysOn" );
   525 TFLOGSTRING( "CMmPacketTsy::CompleteSetAlwaysOn" );
   530 
   526 
   531 	ReqCompleted( aReqHandle, aError );
   527 	ReqCompleted( aReqHandle, aError );
   532 
   528 
   533     }
   529     }
   534 
   530 
   538 // (other items were commented in a header).
   534 // (other items were commented in a header).
   539 //-----------------------------------------------------------------------------
   535 //-----------------------------------------------------------------------------
   540 //
   536 //
   541 void CMmPacketTsy::CancelSetAlwaysOn( TTsyReqHandle aReqHandle )
   537 void CMmPacketTsy::CancelSetAlwaysOn( TTsyReqHandle aReqHandle )
   542 	{
   538 	{
   543 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMPACKETTSY_CANCELSETALWAYSON_1,  "CMmPacketTsy::CancelSetAlwaysOn" );
   539 TFLOGSTRING( "CMmPacketTsy::CancelSetAlwaysOn" );
   544 	
   540 	
   545 	//Direct request to Service Tsy
   541 	//Direct request to Service Tsy
   546 	iMmPhone->PacketDataSession()->CancelSetAlwaysOn( aReqHandle );
   542 	iMmPhone->PacketDataSession()->CancelSetAlwaysOn( aReqHandle );
   547 	
   543 	
   548 	}
   544 	}