telephonyserverplugins/simatktsy/src/CSatNotifyTimerMgmt.cpp
branchRCL_3
changeset 65 630d2f34d719
parent 0 3553901f7fa8
child 66 07a122eea281
equal deleted inserted replaced
61:17af172ffa5f 65:630d2f34d719
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2005-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".
    18 //
    18 //
    19 
    19 
    20 
    20 
    21 
    21 
    22 //INCLUDES
    22 //INCLUDES
       
    23 
       
    24 #include "OstTraceDefinitions.h"
       
    25 #ifdef OST_TRACE_COMPILER_IN_USE
       
    26 #include "CSatNotifyTimerMgmtTraces.h"
       
    27 #endif
       
    28 
    23 #include <satcs.h>                  // Etel SAT IPC definitions
    29 #include <satcs.h>                  // Etel SAT IPC definitions
    24 #include "CSatTsy.h"                // Tsy class header
    30 #include "CSatTsy.h"                // Tsy class header
    25 #include "CSatNotifyTimerMgmt.h"    // Class header
    31 #include "CSatNotifyTimerMgmt.h"    // Class header
    26 #include "CSatNotificationsTsy.h"   // Tsy class header
    32 #include "CSatNotificationsTsy.h"   // Tsy class header
    27 #include "CBerTlv.h"                // Ber Tlv data handling
    33 #include "CBerTlv.h"                // Ber Tlv data handling
    28 #include "TTlv.h"					// TTlv class
    34 #include "TTlv.h"					// TTlv class
    29 #include "CSatDataPackage.h"        // Parameter packing 
    35 #include "CSatDataPackage.h"        // Parameter packing 
    30 #include "TfLogger.h"               // For TFLOGSTRING
       
    31 #include "TSatUtility.h"            // Utilities
    36 #include "TSatUtility.h"            // Utilities
    32 #include "cmmmessagemanagerbase.h"  // Message manager class for forwarding req.
    37 #include "cmmmessagemanagerbase.h"  // Message manager class for forwarding req.
    33 #include "MSatTsy_IPCDefs.h"        // Sat Tsy internal request types
    38 #include "MSatTsy_IPCDefs.h"        // Sat Tsy internal request types
    34 
    39 
    35 
    40 
    41 CSatNotifyTimerMgmt* CSatNotifyTimerMgmt::NewL
    46 CSatNotifyTimerMgmt* CSatNotifyTimerMgmt::NewL
    42         ( 
    47         ( 
    43         CSatNotificationsTsy* aNotificationsTsy 
    48         CSatNotificationsTsy* aNotificationsTsy 
    44         )
    49         )
    45     {
    50     {
    46     TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::NewL");
    51     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_NEWL_1, "CSAT: CSatNotifyTimerMgmt::NewL");
    47    	CSatNotifyTimerMgmt* const satNotifyTimerMgmt = 
    52    	CSatNotifyTimerMgmt* const satNotifyTimerMgmt = 
    48         new ( ELeave ) CSatNotifyTimerMgmt( aNotificationsTsy );
    53         new ( ELeave ) CSatNotifyTimerMgmt( aNotificationsTsy );
    49     CleanupStack::PushL( satNotifyTimerMgmt );
    54     CleanupStack::PushL( satNotifyTimerMgmt );
    50     satNotifyTimerMgmt->ConstructL();
    55     satNotifyTimerMgmt->ConstructL();
    51     CleanupStack::Pop( satNotifyTimerMgmt );
    56     CleanupStack::Pop( satNotifyTimerMgmt );
    52     TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::NewL, end of method");
    57     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_NEWL_2, "CSAT: CSatNotifyTimerMgmt::NewL, end of method");
    53     return satNotifyTimerMgmt;
    58     return satNotifyTimerMgmt;
    54     }
    59     }
    55 
    60 
    56 // -----------------------------------------------------------------------------
    61 // -----------------------------------------------------------------------------
    57 // CSatNotifyTimerMgmt::~CSatNotifyTimerMgmt
    62 // CSatNotifyTimerMgmt::~CSatNotifyTimerMgmt
    61 CSatNotifyTimerMgmt::~CSatNotifyTimerMgmt
    66 CSatNotifyTimerMgmt::~CSatNotifyTimerMgmt
    62         ( 
    67         ( 
    63 		// None
    68 		// None
    64         )
    69         )
    65     {
    70     {
    66     TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::~CSatNotifyTimerMgmt");
    71     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_DTOR_1, "CSAT: CSatNotifyTimerMgmt::~CSatNotifyTimerMgmt");
    67     }
    72     }
    68     
    73     
    69 // -----------------------------------------------------------------------------
    74 // -----------------------------------------------------------------------------
    70 // CSatNotifyTimerMgmt::CSatNotifyTimerMgmt
    75 // CSatNotifyTimerMgmt::CSatNotifyTimerMgmt
    71 // Default C++ constructor
    76 // Default C++ constructor
    87 void CSatNotifyTimerMgmt::ConstructL
    92 void CSatNotifyTimerMgmt::ConstructL
    88         (
    93         (
    89         // None
    94         // None
    90         )
    95         )
    91     {
    96     {
    92     TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::ConstructL, does nothing");
    97     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_CONSTRUCTL_1, "CSAT: CSatNotifyTimerMgmt::ConstructL, does nothing");
    93     }
    98     }
    94 
    99 
    95 // -----------------------------------------------------------------------------
   100 // -----------------------------------------------------------------------------
    96 // CSatNotifyTimerMgmt::CompleteNotifyL
   101 // CSatNotifyTimerMgmt::CompleteNotifyL
    97 // This method completes a NotifyTimerMgmt request by sending terminal response. 
   102 // This method completes a NotifyTimerMgmt request by sending terminal response. 
   101         (
   106         (
   102         CSatDataPackage* aDataPackage,   
   107         CSatDataPackage* aDataPackage,   
   103         TInt aErrorCode                  
   108         TInt aErrorCode                  
   104         )
   109         )
   105     {
   110     {
   106     TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::CompleteNotifyL");
   111     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_COMPLETENOTIFYL_1, "CSAT: CSatNotifyTimerMgmt::CompleteNotifyL");
   107 
   112 
   108     TInt ret( KErrNone );
   113     TInt ret( KErrNone );
   109     TInt returnValue( KErrNone );
   114     TInt returnValue( KErrNone );
   110     TUint8 generalResult ( RSat::KSuccess );
   115     TUint8 generalResult ( RSat::KSuccess );
   111 	
   116 	
   183                             ret = iNotificationsTsy->GetSatTimer()->Start( 
   188                             ret = iNotificationsTsy->GetSatTimer()->Start( 
   184                                 iTimerId, timeValue );
   189                                 iTimerId, timeValue );
   185 
   190 
   186                             if ( KErrNone != ret )
   191                             if ( KErrNone != ret )
   187                                 {
   192                                 {
   188                                 TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::\
   193                                 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_COMPLETENOTIFYL_2, "CSAT: CSatNotifyTimerMgmt::CompleteNotifyL, Unable to process cmd");
   189                                     CompleteNotifyL, Unable to process cmd");
       
   190                                 generalResult = RSat::KMeUnableToProcessCmd;
   194                                 generalResult = RSat::KMeUnableToProcessCmd;
   191                                 }
   195                                 }
   192                             }
   196                             }
   193                         else
   197                         else
   194                             {
   198                             {
   195                             TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::\
   199                             OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_COMPLETENOTIFYL_3, "CSAT: CSatNotifyTimerMgmt::CompleteNotifyL, Data not understood");
   196                                 CompleteNotifyL, Data not understood");
       
   197                             generalResult = RSat::KCmdDataNotUnderstood;
   200                             generalResult = RSat::KCmdDataNotUnderstood;
   198                             }
   201                             }
   199                         }
   202                         }
   200                     else
   203                     else
   201                         {
   204                         {
   202                         TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::\
   205                         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_COMPLETENOTIFYL_4, "CSAT: CSatNotifyTimerMgmt::CompleteNotifyL, Timer value missing");
   203                             CompleteNotifyL, Timer value missing");
       
   204                         generalResult = RSat::KErrorRequiredValuesMissing;
   206                         generalResult = RSat::KErrorRequiredValuesMissing;
   205                         }
   207                         }
   206                     }
   208                     }
   207                 // If operation type is KDeactivateTimer or KGetTimerValue
   209                 // If operation type is KDeactivateTimer or KGetTimerValue
   208                 else if ( ( KDeactivateTimer == cmdQualifier ) ||
   210                 else if ( ( KDeactivateTimer == cmdQualifier ) ||
   241                                 TSatUtility::ConvertToSemiOctet( num[i] );
   243                                 TSatUtility::ConvertToSemiOctet( num[i] );
   242                             }
   244                             }
   243                         }
   245                         }
   244                     else
   246                     else
   245                         {
   247                         {
   246                         TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::\
   248                         OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_COMPLETENOTIFYL_5, "CSAT: CSatNotifyTimerMgmt::CompleteNotifyL, Contradiction with timer state");
   247                             CompleteNotifyL, Contradiction with timer state");
       
   248                         generalResult = RSat::KContradictionWithTimerState;
   249                         generalResult = RSat::KContradictionWithTimerState;
   249                         }
   250                         }
   250                     }
   251                     }
   251                 else
   252                 else
   252                     {
   253                     {
   253                     TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::\
   254                     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_COMPLETENOTIFYL_6, "CSAT: CSatNotifyTimerMgmt::CompleteNotifyL, Cmd type not understood");
   254                         CompleteNotifyL, Cmd type not understood");
       
   255                     generalResult = RSat::KCmdTypeNotUnderstood;
   255                     generalResult = RSat::KCmdTypeNotUnderstood;
   256                     }
   256                     }
   257                 }
   257                 }
   258             }
   258             }
   259         else
   259         else
   260             {
   260             {
   261             TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::\
   261             OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_COMPLETENOTIFYL_7, "CSAT: CSatNotifyTimerMgmt::CompleteNotifyL, Required values missing");
   262                 CompleteNotifyL, Required values missing");
       
   263             generalResult = RSat::KErrorRequiredValuesMissing;
   262             generalResult = RSat::KErrorRequiredValuesMissing;
   264             }
   263             }
   265 
   264 
   266         CreateTerminalRespL( pCmdNumber, generalResult );  
   265         CreateTerminalRespL( pCmdNumber, generalResult );  
   267 
   266 
   280         ( 
   279         ( 
   281         TUint8 aPCmdNumber,             
   280         TUint8 aPCmdNumber,             
   282         TUint8 aGeneralResult	
   281         TUint8 aGeneralResult	
   283 		)
   282 		)
   284     {
   283     {
   285     TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::CreateTerminalRespL");
   284     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_CREATETERMINALRESPL_1, "CSAT: CSatNotifyTimerMgmt::CreateTerminalRespL");
   286 
   285 
   287     // Create and append response data
   286     // Create and append response data
   288     TTlv tlvSpecificData;
   287     TTlv tlvSpecificData;
   289     // Create General Result TLV here
   288     // Create General Result TLV here
   290     tlvSpecificData.AddTag( KTlvResultTag );
   289     tlvSpecificData.AddTag( KTlvResultTag );
   349 TUint32 CSatNotifyTimerMgmt::ConvertToSeconds
   348 TUint32 CSatNotifyTimerMgmt::ConvertToSeconds
   350          (
   349          (
   351          TPtrC8 time
   350          TPtrC8 time
   352          )
   351          )
   353     {
   352     {
   354     TFLOGSTRING("CSAT: CSatNotifyTimerMgmt::ConvertToSeconds");
   353     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSATNOTIFYTIMERMGMT_CONVERTTOSECONDS_1, "CSAT: CSatNotifyTimerMgmt::ConvertToSeconds");
   355     TUint32 timeValue( 0 );
   354     TUint32 timeValue( 0 );
   356     // Value of a timer, expressed using 
   355     // Value of a timer, expressed using 
   357     // the format hour, minute, second
   356     // the format hour, minute, second
   358     // Semi-octec presentation used (23.040)
   357     // Semi-octec presentation used (23.040)
   359     // time[0] is hours
   358     // time[0] is hours