connectionmonitoring/connmon/connectionmonitor/inc/ConnMonDef.h
changeset 0 5a93021fdf25
child 52 bbe4544dfd31
equal deleted inserted replaced
-1:000000000000 0:5a93021fdf25
       
     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:  Definitions common to server and client API.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CONNMONDEF_H
       
    19 #define CONNMONDEF_H
       
    20 
       
    21 #include <e32base.h>
       
    22 #include <rconnmon.h>
       
    23 
       
    24 // Constants
       
    25 
       
    26 // Maximum connection identifier
       
    27 const TUint KMaxConnectionId = 1000000;
       
    28 
       
    29 // Number of message slots in the client-server interface
       
    30 // 1 common slot for all synchronous methods + 1 for each asyncronous method
       
    31 // = 1 common + 6 async client api methods + 1 for events
       
    32 const TInt KNumMessageSlots = 8;
       
    33 
       
    34 // Number of slots in CEventQueue
       
    35 const TInt KEventQueueSize = 25;
       
    36 
       
    37 // Number of pointers allocated for client-server inter-thread reads/writes
       
    38 const TInt KNumPtrs = 12;
       
    39 
       
    40 // Server will shutdown after a 2 second period after the last client
       
    41 // has disconnected. Note. Don't make this smaller. CTimerAO relies on this.
       
    42 const TUint KConnMonShutdownInterval = 2000000;
       
    43 
       
    44 // Update ConnMon documentation (attributes KDownlinkDataThreshold and
       
    45 // KUplinkDataThreshold) if changing these values (4096, 20480, 51200, 102400).
       
    46 const TUint KMinimumDataThreshold      = 4096;
       
    47 const TUint KMinimumGPRSDataThreshold  = 20480;
       
    48 const TUint KMinimumWCDMADataThreshold = 51200;
       
    49 const TUint KMinimumWLANDataThreshold  = 102400;
       
    50 
       
    51 // Update ConnMon documentation (attribute KActivityTimeThreshold) if changing
       
    52 // this value (KMinimumActivityThreshold = 5)
       
    53 const TUint KMinimumActivityThreshold = 5;
       
    54 
       
    55 // CSD/HSCSD in is not valid untill call is open
       
    56 const TInt KBearerQueryCount   = 5;
       
    57 const TInt KBearerQueryTimeout = 100000;
       
    58 
       
    59 const TUid KConnMonServerUid = { 0x101F6CF0 };
       
    60 const TUid KConnMonDllUid    = { 0x101F6CEE };
       
    61 const TUid KGenericDllUid    = { 0x1000008c };
       
    62 
       
    63 _LIT( KConnectionMonitorServerName, "!ConnectionMonitorServer" );
       
    64 
       
    65 _LIT( KConnectionMonitorServerExe, "ConnMonExe" );
       
    66 _LIT( KDoubleColon, "::" );
       
    67 
       
    68 _LIT( KPanicCaughtAnError, "ConnMon: cought an error." );
       
    69 _LIT( KPanicBadParameter, "ConnMon: bad parameter." );
       
    70 
       
    71 // Data types
       
    72 enum TConnMonPanic
       
    73     {
       
    74     // Server
       
    75     ECannotStartServer              = 100,
       
    76     EBadRequest                     = 101,
       
    77     EBadDescriptor                  = 102,
       
    78     EErrorFromNonClientObject       = 103,
       
    79     EReceiveAlreadyActive           = 104,
       
    80     EIapArrayError                  = 105,
       
    81     EConnMonBadHandle               = 106,
       
    82 
       
    83     // Used by Client API
       
    84     EConnMonPanicClientNotConnected = 150
       
    85     };
       
    86 
       
    87 enum TConnMonThreshold
       
    88      {
       
    89      EDownlinkThreshold = 0,
       
    90      EUplinkThreshold,
       
    91      EActivityTimeThreshold,
       
    92      EBearerAvailabilityThreshold,
       
    93      ESignalStrengthThreshold
       
    94      };
       
    95 
       
    96 enum TConnMonConnFlags
       
    97     {
       
    98     EConnTypeGPRS   = 0x01,
       
    99     EConnTypeWCDMA  = 0x02,
       
   100     EConnTypeCSD    = 0x04
       
   101     };
       
   102 
       
   103 enum TConnMonNotifierPriority
       
   104     {
       
   105     EConnMonPriorityNormal = 0,
       
   106     EConnMonPriorityMedium = 5,
       
   107     EConnMonPriorityHigh   = 10
       
   108     };
       
   109 
       
   110 /**
       
   111  * TEventInfo
       
   112  */
       
   113 class TEventInfo
       
   114     {
       
   115 public:
       
   116     inline void Reset()
       
   117         {
       
   118         iEventType = 0;
       
   119         iConnectionId = 0;
       
   120         iSubConnectionId = 0;
       
   121         iData = 0;
       
   122         iData2 = 0;
       
   123         iData3 = 0;
       
   124         }
       
   125 
       
   126 public: // Data
       
   127     TInt iEventType;
       
   128     TUint iConnectionId;
       
   129     TUint iSubConnectionId;
       
   130     TUint iData;
       
   131     TUint iData2;
       
   132     TUint iData3;
       
   133     };
       
   134 
       
   135 // An additional buffer for events that contain a lot of data.
       
   136 // E.g. EConnMonIapAvailabilityChange -event uses this buffer.
       
   137 typedef TBuf8<256> TConnMonExtraBuf;
       
   138 
       
   139 /**
       
   140  * TExtra
       
   141  */
       
   142 class TExtra
       
   143     {
       
   144 public:
       
   145     inline void Reset()
       
   146         {
       
   147         iPtr = NULL;
       
   148         iSize = 0;
       
   149         }
       
   150 public: // Data
       
   151     const TUint8* iPtr;
       
   152     TUint iSize;
       
   153     };
       
   154 
       
   155 /**
       
   156  * TEvent
       
   157  */
       
   158 class TEvent
       
   159     {
       
   160 public:
       
   161     TEventInfo iInfo;
       
   162     TTime iTime;
       
   163     TExtra iExtra;
       
   164     };
       
   165 
       
   166 /**
       
   167  * TFullIap
       
   168  */
       
   169 class TFullIap
       
   170     {
       
   171 public:
       
   172     TUint iIapId;
       
   173     TUint iNetId;
       
   174     TUint iBearerId;
       
   175     };
       
   176 
       
   177 class TFullIapInfo
       
   178     {
       
   179 public:
       
   180     inline void Reset()
       
   181         {
       
   182         iCount = 0;
       
   183         for ( TUint i = 0; i < KConnMonMaxIAPCount; i++ )
       
   184             {
       
   185             iIap[i].iIapId = 0;
       
   186             iIap[i].iNetId = 0;
       
   187             iIap[i].iBearerId = 0;
       
   188             }
       
   189         }
       
   190 
       
   191 public:
       
   192     TUint iCount;
       
   193     TFullIap iIap[KConnMonMaxIAPCount];
       
   194     };
       
   195 
       
   196 class TBearerInfo
       
   197     {
       
   198 public:
       
   199     TBearerInfo()
       
   200         {
       
   201         iBearer = 0;
       
   202         iInternal = ETrue;
       
   203         };
       
   204     TBearerInfo( TInt aBearer, TBool aInternal )
       
   205         {
       
   206         iBearer = aBearer,
       
   207         iInternal = aInternal;
       
   208         }
       
   209     inline void Reset()
       
   210         {
       
   211         iBearer = 0;
       
   212         iInternal = ETrue;
       
   213         }
       
   214     TInt iBearer;
       
   215     TBool iInternal;
       
   216     };
       
   217 
       
   218 // Prefix 'ConnMon' used to avoid any future problems or name overlapping with
       
   219 // other similar implementations.
       
   220 template <class T>
       
   221 class ConnMonCleanupResetAndDestroy
       
   222     {
       
   223 public:
       
   224     inline static void PushL( T& aRef );
       
   225 
       
   226 private:
       
   227     static void ResetAndDestroy( TAny *aPtr );
       
   228     };
       
   229 
       
   230 template <class T>
       
   231 inline void ConnMonCleanupResetAndDestroyPushL( T& aRef );
       
   232 
       
   233 template <class T>
       
   234 inline void ConnMonCleanupResetAndDestroy<T>::PushL( T& aRef )
       
   235     {
       
   236     CleanupStack::PushL( TCleanupItem( &ResetAndDestroy, &aRef ) );
       
   237     }
       
   238 
       
   239 template <class T>
       
   240 void ConnMonCleanupResetAndDestroy<T>::ResetAndDestroy( TAny *aPtr )
       
   241     {
       
   242     (STATIC_CAST(T*,aPtr))->ResetAndDestroy();
       
   243     }
       
   244 
       
   245 template <class T>
       
   246 inline void ConnMonCleanupResetAndDestroyPushL( T& aRef )
       
   247     {
       
   248     ConnMonCleanupResetAndDestroy<T>::PushL( aRef );
       
   249     }
       
   250 
       
   251 #endif // CONNMONDEF_H
       
   252 
       
   253 // End-of-file