telephonyserverplugins/common_tsy/commontsy/src/mmfax/CMmTsyFax.cpp
branchRCL_3
changeset 65 630d2f34d719
parent 0 3553901f7fa8
child 66 07a122eea281
equal deleted inserted replaced
61:17af172ffa5f 65:630d2f34d719
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2006-2010 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".
    14 //
    14 //
    15 
    15 
    16 
    16 
    17 
    17 
    18 //  INCLUDE FILES
    18 //  INCLUDE FILES
    19 #include <ctsy/tflogger.h>
       
    20 #include "cmmtsyfax.h"
    19 #include "cmmtsyfax.h"
    21 #include "cmmfaxext.h"
    20 #include "cmmfaxext.h"
    22 
    21 
    23 
    22 
    24 // ======== MEMBER FUNCTIONS ========
    23 // ======== MEMBER FUNCTIONS ========
    26 CMmTsyFax::CMmTsyFax(
    25 CMmTsyFax::CMmTsyFax(
    27     CMmFaxExt* aFaxExt ) 
    26     CMmFaxExt* aFaxExt ) 
    28     :  iFaxExt( aFaxExt )
    27     :  iFaxExt( aFaxExt )
    29     
    28     
    30     {
    29     {
    31 TFLOGSTRING("TSY: CMmTsyFax::CMmTsyFax" );
    30 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMTSYFAX_CTOR_1 "TSY: CMmTsyFax::CMmTsyFax" );
    32     }
    31     }
    33 
    32 
    34 void CMmTsyFax::ConstructL()
    33 void CMmTsyFax::ConstructL()
    35     {
    34     {
    36 TFLOGSTRING("TSY: CMmTsyFax::ConstructL");
    35 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMTSYFAX_CONSTRUCTL_1, "TSY: CMmTsyFax::ConstructL");
    37     
    36     
    38     iTerminate     = EFalse;
    37     iTerminate     = EFalse;
    39     iDataDirection = EUnknown;
    38     iDataDirection = EUnknown;
    40 
    39 
    41     //  Used to be that CTsyFax could not be constructed before a call had
    40     //  Used to be that CTsyFax could not be constructed before a call had
    56     }
    55     }
    57 
    56 
    58 CMmTsyFax* CMmTsyFax::NewL(
    57 CMmTsyFax* CMmTsyFax::NewL(
    59         CMmFaxExt* aFaxExt )
    58         CMmFaxExt* aFaxExt )
    60     {
    59     {
    61 TFLOGSTRING("TSY: CMmTsyFax::NewL");
    60 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMTSYFAX_NEWL_1, "TSY: CMmTsyFax::NewL");
    62     //  Completes successfully if fax call has already been dialled creating
    61     //  Completes successfully if fax call has already been dialled creating
    63     //  a CFaxSession instance, and is not called if that is not true.
    62     //  a CFaxSession instance, and is not called if that is not true.
    64     CMmTsyFax* fax = new ( ELeave ) CMmTsyFax( aFaxExt );
    63     CMmTsyFax* fax = new ( ELeave ) CMmTsyFax( aFaxExt );
    65 
    64 
    66     CleanupClosePushL( *fax );
    65     CleanupClosePushL( *fax );
    70     return fax;
    69     return fax;
    71     }
    70     }
    72 
    71 
    73 CMmTsyFax::~CMmTsyFax()
    72 CMmTsyFax::~CMmTsyFax()
    74     {
    73     {
    75 TFLOGSTRING("TSY: CMmTsyFax::~CMmTsyFax" );
    74 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMTSYFAX_DTOR_1, "TSY: CMmTsyFax::~CMmTsyFax" );
    76 
    75 
    77 	if( iFaxExt )
    76 	if( iFaxExt )
    78 		{
    77 		{
    79 		iFaxExt->iFax = NULL;
    78 		iFaxExt->iFax = NULL;
    80 		iFaxExt = NULL;
    79 		iFaxExt = NULL;
    88 // ---------------------------------------------------------------------------
    87 // ---------------------------------------------------------------------------
    89 //
    88 //
    90 void CMmTsyFax::CloseFax(
    89 void CMmTsyFax::CloseFax(
    91         TAny* aObj )
    90         TAny* aObj )
    92     {
    91     {
    93 TFLOGSTRING("TSY: CMmTsyFax::CloseFax");
    92 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMTSYFAX_CLOSEFAX_1, "TSY: CMmTsyFax::CloseFax");
    94     
    93     
    95     ( ( CObject* )aObj )->Close();
    94     ( ( CObject* )aObj )->Close();
    96     }
    95     }
    97 
    96 
    98 // ---------------------------------------------------------------------------
    97 // ---------------------------------------------------------------------------
   102 // ---------------------------------------------------------------------------
   101 // ---------------------------------------------------------------------------
   103 //
   102 //
   104 TInt CMmTsyFax:: DeregisterNotification(
   103 TInt CMmTsyFax:: DeregisterNotification(
   105         const TInt /*aIpc*/ )
   104         const TInt /*aIpc*/ )
   106     {
   105     {
   107 TFLOGSTRING("TSY: CMmTsyFax::DeregisterNotification");
   106 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, DEREGISTERNOTIFICATION_1, "TSY: CMmTsyFax::DeregisterNotification");
   108     return KErrNone;
   107     return KErrNone;
   109     }
   108     }
   110 
   109 
   111 // ---------------------------------------------------------------------------
   110 // ---------------------------------------------------------------------------
   112 // CMmTsyFax::Init
   111 // CMmTsyFax::Init
   114 // Returns: None
   113 // Returns: None
   115 // ---------------------------------------------------------------------------
   114 // ---------------------------------------------------------------------------
   116 //
   115 //
   117 void CMmTsyFax::Init()
   116 void CMmTsyFax::Init()
   118     {
   117     {
   119 TFLOGSTRING("TSY: CMmTsyFax::Init");
   118 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMTSYFAX_INIT_1, "TSY: CMmTsyFax::Init");
   120     }
   119     }
   121 
   120 
   122 // ---------------------------------------------------------------------------
   121 // ---------------------------------------------------------------------------
   123 // CMmTsyFax::Read
   122 // CMmTsyFax::Read
   124 // Read fax data into descriptor, asynchronously.
   123 // Read fax data into descriptor, asynchronously.
   127 //
   126 //
   128 TInt CMmTsyFax::Read(
   127 TInt CMmTsyFax::Read(
   129         const TTsyReqHandle aTsyReqHandle, 
   128         const TTsyReqHandle aTsyReqHandle, 
   130         TDes8* aDes )                      
   129         TDes8* aDes )                      
   131     {
   130     {
   132 TFLOGSTRING2("TSY: CMmTsyFax::Read : %d" , aTsyReqHandle);
   131 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMTSYFAX_READ_1, "TSY: CMmTsyFax::Read : %d" , aTsyReqHandle);
   133 
   132 
   134     TInt errorCode( KErrNone );
   133     TInt errorCode( KErrNone );
   135 
   134 
   136     if ( !iFaxExt->GetFaxSession()
   135     if ( !iFaxExt->GetFaxSession()
   137          || iFaxExt->GetCallStatus() != RCall::EStatusConnected )
   136          || iFaxExt->GetCallStatus() != RCall::EStatusConnected )
   171 TInt CMmTsyFax::RegisterNotification
   170 TInt CMmTsyFax::RegisterNotification
   172         (
   171         (
   173         const TInt /*aIpc*/ 
   172         const TInt /*aIpc*/ 
   174         )
   173         )
   175     {
   174     {
   176 TFLOGSTRING("TSY: CMmTsyFax::RegisterNotification");
   175 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMTSYFAX_REGISTERNOTIFICATION_1, "TSY: CMmTsyFax::RegisterNotification");
   177     return KErrNone;
   176     return KErrNone;
   178     }
   177     }
   179 // ---------------------------------------------------------------------------
   178 // ---------------------------------------------------------------------------
   180 // CMmTsyFax::ReqModeL
   179 // CMmTsyFax::ReqModeL
   181 // Returns: Request mode
   180 // Returns: Request mode
   192 // Returns: None
   191 // Returns: None
   193 // ---------------------------------------------------------------------------
   192 // ---------------------------------------------------------------------------
   194 //
   193 //
   195 void CMmTsyFax::Terminate()
   194 void CMmTsyFax::Terminate()
   196 	{    
   195 	{    
   197 TFLOGSTRING("TSY: CMmTsyFax::Terminate");
   196 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMTSYFAX_TERMINATE_1, "TSY: CMmTsyFax::Terminate");
   198 	iTerminate = ETrue;
   197 	iTerminate = ETrue;
   199 	}
   198 	}
   200 
   199 
   201 // ---------------------------------------------------------------------------
   200 // ---------------------------------------------------------------------------
   202 // CMmTsyFax::TerminateFaxSession
   201 // CMmTsyFax::TerminateFaxSession
   205 // ---------------------------------------------------------------------------
   204 // ---------------------------------------------------------------------------
   206 //
   205 //
   207 TInt CMmTsyFax::TerminateFaxSession(
   206 TInt CMmTsyFax::TerminateFaxSession(
   208         const TTsyReqHandle aTsyReqHandle ) 
   207         const TTsyReqHandle aTsyReqHandle ) 
   209     {
   208     {
   210 TFLOGSTRING2("TSY: CMmTsyFax::TerminateFaxSession Handle: %d", aTsyReqHandle);
   209 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMTSYFAX_TERMINATEFAXSESSION_1, "TSY: CMmTsyFax::TerminateFaxSession Handle: %d", aTsyReqHandle);
   211     
   210     
   212     CFaxSession* session = iFaxExt->GetFaxSession();
   211     CFaxSession* session = iFaxExt->GetFaxSession();
   213 
   212 
   214     if ( !session )
   213     if ( !session )
   215         {
   214         {
   234 // ---------------------------------------------------------------------------
   233 // ---------------------------------------------------------------------------
   235 //
   234 //
   236 TInt CMmTsyFax::WaitForEndOfPage(
   235 TInt CMmTsyFax::WaitForEndOfPage(
   237         const TTsyReqHandle aTsyReqHandle ) 
   236         const TTsyReqHandle aTsyReqHandle ) 
   238     {
   237     {
   239 TFLOGSTRING2("TSY: CMmTsyFax::WaitForEndOfPage  Handle:%d", aTsyReqHandle);
   238 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMTSYFAX_WAITFORENDOFPAGE_1, "TSY: CMmTsyFax::WaitForEndOfPage  Handle:%d", aTsyReqHandle);
   240 
   239 
   241     if ( !iFaxExt->GetFaxSession() 
   240     if ( !iFaxExt->GetFaxSession() 
   242          || iFaxExt->GetCallStatus() != RCall::EStatusConnected )
   241          || iFaxExt->GetCallStatus() != RCall::EStatusConnected )
   243         {
   242         {
   244         // not ready
   243         // not ready
   272 //
   271 //
   273 TInt CMmTsyFax::Write(
   272 TInt CMmTsyFax::Write(
   274         const TTsyReqHandle aTsyReqHandle, 
   273         const TTsyReqHandle aTsyReqHandle, 
   275         TDesC8* aDes )                     
   274         TDesC8* aDes )                     
   276     {
   275     {
   277 TFLOGSTRING2("TSY: CMmTsyFax::Write : %d" , aTsyReqHandle);
   276 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMTSYFAX_WRITE_1, "TSY: CMmTsyFax::Write : %d" , aTsyReqHandle);
   278 
   277 
   279     TInt errorCode( KErrNone );
   278     TInt errorCode( KErrNone );
   280 
   279 
   281     if ( !iFaxExt->GetFaxSession() 
   280     if ( !iFaxExt->GetFaxSession() 
   282          || iFaxExt->GetCallStatus() != RCall::EStatusConnected )
   281          || iFaxExt->GetCallStatus() != RCall::EStatusConnected )