epoc32/include/mw/rconnmon.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 rconnmon.h
     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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  RConnectionMonitor provides an interface for an application to
       
    15 *                get information about active data connection. It also provides
       
    16 *                a way to close any connection or all the connections.
       
    17 *
       
    18 */
       
    19 
       
    20 #ifndef __CONNECTIONMONITOR_H
       
    21 #define __CONNECTIONMONITOR_H
       
    22 
       
    23 #include <e32base.h>
       
    24 
       
    25 
       
    26 // ===========================================================================
       
    27 // TInt attribute constants, used by GetIntAttribute, SetIntAttribute.
       
    28 // ===========================================================================
       
    29 //
       
    30 /** Bearer, defined in TConnMonBearerType.
       
    31 */
       
    32 const TUint KBearer = 1;
       
    33 /** Network status, defined in TConnMonNetworkStatus.
       
    34 */
       
    35 const TUint KNetworkStatus = 2;
       
    36 /** Connection status, progress constants are from nifvar.h.
       
    37 */
       
    38 const TUint KConnectionStatus = 3;
       
    39 /** Protocol, defined in TConnMonProtocolType.
       
    40 */
       
    41 const TUint KProtocolType = 4;
       
    42 /** Network registration values defined in TConnMonNetworkRegistration.
       
    43 */
       
    44 const TUint KNetworkRegistration = 5;
       
    45 /** Signal strength in dBm.
       
    46 */
       
    47 const TUint KSignalStrength = 6;
       
    48 /** WLAN mode, defined in TConnMonNetworkMode.
       
    49 */
       
    50 const TUint KNetworkMode = 7;
       
    51 /** WLAN connection security mode, defined in TConnMonSecurityMode.
       
    52 */
       
    53 const TUint KSecurityMode = 8;
       
    54 /** Bearer information, defined in TConnMonBearerInfo.
       
    55 */
       
    56 const TUint KBearerInfo = 9;
       
    57 /** Acceptable WLAN scan cache age in seconds. Set to -1 to use device
       
    58 default. Only has meaning if KWlanScanMaxDelay is set to 0.
       
    59 */
       
    60 const TUint KWlanScanCacheLifetime = 10;
       
    61 /** QoS - Not supported.
       
    62 */
       
    63 const TUint KTrafficClass = 30;
       
    64 /** QoS - Not supported.
       
    65 */
       
    66 const TUint KDeliveryOrder = 31;
       
    67 /** QoS - Not supported.
       
    68 */
       
    69 const TUint KErroneousSDUDelivery = 32;
       
    70 /** QoS - Not supported.
       
    71 */
       
    72 const TUint KResidualBitErrorRatio = 33;
       
    73 /** QoS - Not supported.
       
    74 */
       
    75 const TUint KSDUErrorRatio = 34;
       
    76 
       
    77 
       
    78 // ===========================================================================
       
    79 // TUint attribute constants, used by GetUintAttribute, SetUintAttribute.
       
    80 // ===========================================================================
       
    81 //
       
    82 /** Downlink data in bytes.
       
    83 */
       
    84 const TUint KDownlinkData = 100;
       
    85 /** Uplink data in bytes.
       
    86 */
       
    87 const TUint KUplinkData = 101;
       
    88 /** Used IAP ID.
       
    89 */
       
    90 const TUint KIAPId = 102;
       
    91 /** Network ID.
       
    92 */
       
    93 const TUint KNetworkIdentifier = 103;
       
    94 /** WLAN transmit power in mW.
       
    95 */
       
    96 const TUint KTransmitPower = 104;
       
    97 /** Current network mode, defined in TConnMonMobilePhoneNetworkMode.
       
    98 */
       
    99 const TUint KMobilePhoneNetworkMode = 105;
       
   100 /** QoS - Not supported.
       
   101 */
       
   102 const TUint KMaximumBitrateDownlink = 130;
       
   103 /** QoS - Not supported.
       
   104 */
       
   105 const TUint KMaximumBitrateUplink = 131;
       
   106 /** QoS - Not supported.
       
   107 */
       
   108 const TUint KMaximumSDUSize = 132;
       
   109 /** QoS - Not supported.
       
   110 */
       
   111 const TUint KTransferDelay = 133;
       
   112 /** QoS - Not supported.
       
   113 */
       
   114 const TUint KGuaranteedBitrateDownlink = 134;
       
   115 /** QoS - Not supported.
       
   116 */
       
   117 const TUint KGuaranteedBitrateUplink = 135;
       
   118 /** QoS - Not supported.
       
   119 */
       
   120 const TUint KTrafficHandlingPriority = 136;
       
   121 /** Enables EConnMonConnectionActivityChange events.
       
   122 0 means off, minimum allowed is 5 seconds.
       
   123 */
       
   124 const TUint KActivityTimeThreshold = 150;
       
   125 /** Enables EConnMonDownlinkDataThreshold events.
       
   126 0 means off, minimum allowed is 4096 bytes.
       
   127 */
       
   128 const TUint KDownlinkDataThreshold = 151;
       
   129 /** Enables EConnMonUplinkDataThreshold events.
       
   130 0 means off, minimum allowed is 4096 bytes.
       
   131 */
       
   132 const TUint KUplinkDataThreshold = 152;
       
   133 /** Enables EConnMonBearerAvailabilityChange events.
       
   134 */
       
   135 const TUint KBearerAvailabilityThreshold = 153;
       
   136 /** Enables EConnMonSignalStrengthChange events.
       
   137 */
       
   138 const TUint KSignalStrengthThreshold = 154;
       
   139 /** If set, disables EConnMonBearerChange events and enables
       
   140 EConnMonBearerInfoChange and EConnMonBearerGroupChange events instead.
       
   141 */
       
   142 const TUint KBearerGroupThreshold = 155;
       
   143 /** Acceptable delay in seconds for receiving WLAN scan results.
       
   144 If set to 0 (default), KWlanScanCacheLifetime will be used.
       
   145 */
       
   146 const TUint KWlanScanMaxDelay = 160;
       
   147 
       
   148 
       
   149 // ===========================================================================
       
   150 // TBool attribute constants, used by GetBoolAttribute, SetBoolAttribute.
       
   151 // ===========================================================================
       
   152 //
       
   153 /** Connection activity.
       
   154 */
       
   155 const TUint KConnectionActive = 200;
       
   156 /** Bearer availability.
       
   157 */
       
   158 const TUint KBearerAvailability = 201;
       
   159 /** Packet data availability. Can be blocked if phone call is active and no
       
   160 dual transfer mode support.
       
   161 */
       
   162 const TUint KPacketDataAvailability = 202;
       
   163 /** Stop a connection.
       
   164 */
       
   165 const TUint KConnectionStop = 250;
       
   166 /** Stop all connections.
       
   167 */
       
   168 const TUint KConnectionStopAll = 251;
       
   169 
       
   170 
       
   171 // ===========================================================================
       
   172 // TDes attribute constants, used by GetStringAttribute, SetStringAttribute.
       
   173 // ===========================================================================
       
   174 //
       
   175 /** Name of used IAP.
       
   176 */
       
   177 const TUint KIAPName = 300;
       
   178 /** Name of used access point.
       
   179 */
       
   180 const TUint KAccessPointName = 301;
       
   181 /** Used telephone number.
       
   182 */
       
   183 const TUint KTelNumber = 302;
       
   184 /** Name (SSID) of used WLAN.
       
   185 */
       
   186 const TUint KNetworkName = 303;
       
   187 /** WLAN name (SSID) to be used in SSID scan (KWlanSsidNetworks).
       
   188 */
       
   189 const TUint KWlanSsid = 304;
       
   190 
       
   191 
       
   192 // ===========================================================================
       
   193 // TPckgBuf attribute constants, used by GetPckgAttribute.
       
   194 // ===========================================================================
       
   195 //
       
   196 /** Connection start time. See TConnMonTimeBuf.
       
   197 */
       
   198 const TUint KStartTime = 400;
       
   199 /** All clients using a connection. See TConnMonClientEnumBuf.
       
   200 */
       
   201 const TUint KClientInfo = 401;
       
   202 /** Basic WLAN scan information. See TConnMonNetworkNamesBuf.
       
   203 */
       
   204 const TUint KNetworkNames = 402;
       
   205 /** Available IAP IDs. See TConnMonIapInfoBuf.
       
   206 */
       
   207 const TUint KIapAvailability = 403;
       
   208 /** Deprecated. Old WLAN scan results, use KWlanNetworks instead.
       
   209 */
       
   210 const TUint KWLANNetworks = 404;
       
   211 /** Available SNAP IDs. See TConnMonSNAPInfoBuf.
       
   212 */
       
   213 const TUint KSNAPsAvailability = 405;
       
   214 /** Available SNAP IDs, in a more flexible way. See ConnMonIdsArrayPckg.
       
   215 */
       
   216 const TUint KAvailableSNAPsIds = 406;
       
   217 /** WLAN scan results. See CConnMonWlanNetworksPtrArrayPckg.
       
   218 */
       
   219 const TUint KWlanNetworks = 407;
       
   220 /** Bearer group information. See TConnMonBearerGroupInfoBuf.
       
   221 */
       
   222 const TUint KBearerGroupInfo = 408;
       
   223 /** WLAN SSID scan results. Scans for WLANs with a specific SSID.
       
   224 See CConnMonWlanNetworksPtrArrayPckg.
       
   225 */
       
   226 const TUint KWlanSsidNetworks = 409;
       
   227 /** Information about the currently used WLAN.
       
   228 See CConnMonWlanNetworksPtrArrayPckg.
       
   229 */
       
   230 const TUint KWlanCurrentNetwork = 410;
       
   231 /** Beacon frames from a WLAN scan. See CConnMonWlanProbeRawBuffersPckg.
       
   232 */
       
   233 const TUint KWlanProbeRawBuffers = 411;
       
   234 
       
   235 
       
   236 /** Base value for plug-in specific attribute IDs.
       
   237 */
       
   238 const TUint KConnMonPluginAttributeBase = 3000000;
       
   239 
       
   240 
       
   241 /**
       
   242 * Bearer type.
       
   243 */
       
   244 enum TConnMonBearerType
       
   245     {
       
   246     EBearerUnknown           = 0,
       
   247     EBearerCSD               = 1,  ///< CSD (GSM)
       
   248     EBearerWCDMA             = 2,  ///< PSD (WCDMA)
       
   249     EBearerLAN               = 3,
       
   250     EBearerCDMA2000          = 4,
       
   251     EBearerGPRS              = 5,
       
   252     EBearerHSCSD             = 6,  ///< HSCSD (GSM)
       
   253     EBearerEdgeGPRS          = 7,
       
   254     EBearerWLAN              = 8,
       
   255     EBearerBluetooth         = 9,
       
   256     EBearerVirtual           = 10,
       
   257     EBearerVirtualVPN        = 11,
       
   258     EBearerWcdmaCSD          = 12, ///< CSD (WCDMA)
       
   259 
       
   260     EBearerExternalCSD       = 30, ///< external CSD (GSM)
       
   261     EBearerExternalWCDMA     = 31, ///< external PSD (WCDMA)
       
   262     EBearerExternalLAN       = 32,
       
   263     EBearerExternalCDMA2000  = 33,
       
   264     EBearerExternalGPRS      = 34,
       
   265     EBearerExternalHSCSD     = 35, ///< external HSCSD (GSM)
       
   266     EBearerExternalEdgeGPRS  = 36,
       
   267     EBearerExternalWLAN      = 37,
       
   268     EBearerExternalBluetooth = 38,
       
   269     EBearerExternalWcdmaCSD  = 39, ///< external CSD (WCDMA)
       
   270     };
       
   271 
       
   272 /**
       
   273 * Bearer specific general connection ID.
       
   274 */
       
   275 enum TConnMonBearerId
       
   276     {
       
   277     EBearerIdAll        = 0,
       
   278     EBearerIdGPRS       = 2000000, ///< Internal/external GPRS and EdgeGPRS
       
   279     EBearerIdWCDMA      = 2000001, ///< Internal/external PSD (WCDMA)
       
   280     EBearerIdCSD        = 2000002, ///< Internal/external CSD and HSCSD (GSM)
       
   281     EBearerIdGSM        = 2000003, ///< Union of EBearerIdGPRS and EBearerIdCSD
       
   282     EBearerIdWLAN       = 2000004,
       
   283     EBearerIdLAN        = 2000005,
       
   284     EBearerIdWcdmaCSD   = 2000006, ///< Internal/external CSD (WCDMA)
       
   285     EBearerIdCDMA2000   = 2000007,
       
   286     EBearerIdVirtualVPN = 2000008
       
   287     };
       
   288 
       
   289 /**
       
   290 * Network status.
       
   291 */
       
   292 enum TConnMonNetworkStatus
       
   293     {
       
   294     EConnMonStatusNotAvailable = 0,
       
   295     EConnMonStatusUnattached,
       
   296     EConnMonStatusAttached,
       
   297     EConnMonStatusActive,
       
   298     EConnMonStatusSuspended
       
   299     };
       
   300 
       
   301 /**
       
   302 * Protocol type (type of PDP). It may not be available for some
       
   303 * bearers (returns EProtocolTypeUnknown).
       
   304 */
       
   305 enum TConnMonProtocolType
       
   306     {
       
   307     EProtocolTypeUnknown = 0,
       
   308     EProtocolTypeIPv4,
       
   309     EProtocolTypeIPv6,
       
   310     EProtocolTypeX25,
       
   311     EProtocolTypePPP,
       
   312     EProtocolTypeCDPD,
       
   313     EProtocolTypeIP           ///< Connection uses both IPv4 and IPv6
       
   314     };
       
   315 
       
   316 /**
       
   317 * Asyncronous request codes.
       
   318 */
       
   319 enum TConnMonAsyncRequest
       
   320     {
       
   321     EConnMonGetConnectionCount = 1,
       
   322     EConnMonGetIntAttribute,
       
   323     EConnMonGetUintAttribute,
       
   324     EConnMonGetBoolAttribute,
       
   325     EConnMonGetStringAttribute,
       
   326     EConnMonGetPckgAttribute
       
   327     };
       
   328 
       
   329 /**
       
   330 * Events sent by Connection Monitor. See SDK documentation for more details.
       
   331 */
       
   332 enum TConnMonEvent
       
   333     {
       
   334     EConnMonCreateConnection          = 1,
       
   335     EConnMonDeleteConnection          = 2,
       
   336     EConnMonCreateSubConnection       = 3,  ///< Not supported
       
   337     EConnMonDeleteSubConnection       = 4,  ///< Not supported
       
   338     EConnMonDownlinkDataThreshold     = 5,
       
   339     EConnMonUplinkDataThreshold       = 6,
       
   340     EConnMonNetworkStatusChange       = 7,
       
   341     EConnMonConnectionStatusChange    = 8,
       
   342     EConnMonConnectionActivityChange  = 9,
       
   343     EConnMonNetworkRegistrationChange = 10,
       
   344     EConnMonBearerChange              = 11,
       
   345     EConnMonSignalStrengthChange      = 12, ///< For cellular, not WLAN
       
   346     EConnMonBearerAvailabilityChange  = 13,
       
   347     EConnMonIapAvailabilityChange     = 14,
       
   348     EConnMonTransmitPowerChange       = 15, ///< For WLAN
       
   349     EConnMonSNAPsAvailabilityChange   = 16,
       
   350     EConnMonNewWLANNetworkDetected    = 17,
       
   351     EConnMonOldWLANNetworkLost        = 18,
       
   352     EConnMonPacketDataAvailable       = 19,
       
   353     EConnMonPacketDataUnavailable     = 20,
       
   354     EConnMonBearerInfoChange          = 21,
       
   355     EConnMonBearerGroupChange         = 22,
       
   356 
       
   357     EConnMonPluginEventBase           = 4000000
       
   358     };
       
   359 
       
   360 /**
       
   361 * Network registration status. Valid for CSD, GPRS and WCDMA.
       
   362 */
       
   363 enum TConnMonNetworkRegistration
       
   364     {
       
   365     ENetworkRegistrationNotAvailable = 0,
       
   366     ENetworkRegistrationUnknown,
       
   367     ENetworkRegistrationNoService,
       
   368     ENetworkRegistrationEmergencyOnly,
       
   369     ENetworkRegistrationSearching,
       
   370     ENetworkRegistrationBusy,
       
   371     ENetworkRegistrationHomeNetwork,
       
   372     ENetworkRegistrationDenied,
       
   373     ENetworkRegistrationRoaming
       
   374     };
       
   375 
       
   376 /**
       
   377 * QoS. Traffic class.
       
   378 */
       
   379 enum TQosTrafficClass
       
   380     {
       
   381     EQosTrafficClassConversational = 1,
       
   382     EQosTrafficClassStreaming,
       
   383     EQosTrafficClassInteractive,
       
   384     EQosTrafficClassBackground
       
   385     };
       
   386 
       
   387 /**
       
   388 * QoS. Delivery order.
       
   389 */
       
   390 enum TQosDeliveryOrder
       
   391     {
       
   392     EQosDeliveryOrderYes = 1,
       
   393     EQosDeliveryOrderNo
       
   394     };
       
   395 
       
   396 /**
       
   397 * QoS. Delivery of erroneous SDUs.
       
   398 */
       
   399 enum TQosErroneousSDUDelivery
       
   400     {
       
   401     EQosErroneousSDUDeliveryYes = 1,
       
   402     EQosErroneousSDUDeliveryNo,
       
   403     EQosErroneousSDUDeliveryUnspecified
       
   404     };
       
   405 
       
   406 /**
       
   407 * QoS. Residual bit error ratio.
       
   408 */
       
   409 enum TQosBitErrorRatio
       
   410     {
       
   411     EQosBERFivePerHundred = 1,
       
   412     EQosBEROnePerHundred,
       
   413     EQosBERFivePerThousand,
       
   414     EQosBEROnePerThousand,
       
   415     EQosBEROnePerTenThousand,
       
   416     EQosBEROnePerMillion
       
   417     };
       
   418 
       
   419 /**
       
   420 * QoS. SDU error ratio.
       
   421 */
       
   422 enum TQosSDUErrorRatio
       
   423     {
       
   424     EQosSDUErrorRatioOnePerHundred = 1,
       
   425     EQosSDUErrorRatioSevenPerThousand,
       
   426     EQosSDUErrorRatioOnePerThousand,
       
   427     EQosSDUErrorRatioOnePerTenThousand,
       
   428     EQosSDUErrorRatioOnePerHundredThousand
       
   429     };
       
   430 
       
   431 /**
       
   432 * Client-server requests.
       
   433 */
       
   434 enum TConnMonRequests
       
   435     {
       
   436     EReqGetConnectionCount            = 0,
       
   437     EReqGetConnectionInfo             = 1,
       
   438     EReqGetSubConnectionInfo          = 2,
       
   439     EReqGetIntAttribute               = 3,
       
   440     EReqGetUintAttribute              = 4,
       
   441     EReqGetBoolAttribute              = 5,
       
   442     EReqGetStringAttribute            = 6,
       
   443     EReqGetPckgAttribute              = 7,
       
   444     EReqSetIntAttribute               = 8,
       
   445     EReqSetUintAttribute              = 9,
       
   446     EReqSetBoolAttribute              = 10,
       
   447     EReqSetStringAttribute            = 11,
       
   448     EReqSetPckgAttribute              = 12,
       
   449     EReqCancelAsyncRequest            = 13,
       
   450     EReqReceiveEvent                  = 14,
       
   451     EReqCancelReceiveEvent            = 15,
       
   452 
       
   453     EReqPluginCreateSubSession        = 500,
       
   454     EReqPluginCloseSubSession         = 501,
       
   455     EReqPluginRegisterAttribute       = 502,
       
   456     EReqPluginCancelRegisterAttribute = 503,
       
   457     EReqPluginEvent                   = 504,
       
   458     EReqPluginGetQuery                = 505,
       
   459     EReqPluginCancelGetQuery          = 506,
       
   460     EReqPluginAttribute               = 507,
       
   461 
       
   462     EReqInternalSetThreshold          = 600,
       
   463     EReqInternalResetThreshold        = 601
       
   464     };
       
   465 
       
   466 /**
       
   467 * WLAN connection modes.
       
   468 */
       
   469 enum TConnMonNetworkMode
       
   470     {
       
   471     EConnMonInfraStructure = 0,
       
   472     EConnMonAdHoc          = 1,
       
   473     EConnMonSecureInfra    = 2
       
   474     };
       
   475 
       
   476 /**
       
   477 * WLAN connection security modes.
       
   478 */
       
   479 enum TConnMonSecurityMode
       
   480     {
       
   481     EConnMonSecurityOpen   = 0,
       
   482     EConnMonSecurityWep    = 1,
       
   483     EConnMonSecurity802d1x = 2,
       
   484     EConnMonSecurityWpa    = 3,
       
   485     EConnMonSecurityWpaPsk = 4
       
   486     };
       
   487 
       
   488 /**
       
   489 * Network Modes.
       
   490 */
       
   491 enum TConnMonMobilePhoneNetworkMode
       
   492     {
       
   493     EConnMonNetworkModeUnknown = 0,  ///< Network mode is unknown
       
   494     EConnMonNetworkModeUnregistered, ///< ME is not registered
       
   495     EConnMonNetworkModeGsm,          ///< GSM/GPRS or DCS1800 network
       
   496     EConnMonNetworkModeAmps,         ///< AMPS network (CDMA)
       
   497     EConnMonNetworkModeCdma95,       ///< CDMA (IS-95) network
       
   498     EConnMonNetworkModeCdma2000,     ///< CDMA (cdma2000) network
       
   499     EConnMonNetworkModeWcdma,        ///< WCDMA (UTRA FDD) network
       
   500     EConnMonNetworkModeTdcdma        ///< TD-CDMA (UTRA TDD) network (WCDMA)
       
   501     };
       
   502 
       
   503 /** Maximum size of a plug-in's event data.
       
   504 */
       
   505 const TUint KConnMonMaxPluginDataSize = 512;
       
   506 /** Maximum size of a plug-in's attribute.
       
   507 */
       
   508 const TUint KConnMonMaxStringAttributeLength = 64;
       
   509 
       
   510 /**
       
   511 * Package class definition for getting the TTime.
       
   512 */
       
   513 typedef TPckgBuf<TTime> TConnMonTimeBuf;
       
   514 
       
   515 /** Maximum number of clients contained in TConnMonClientEnum class.
       
   516 */
       
   517 const TUint KConnMonMaxClientUids = 10;
       
   518 
       
   519 /**
       
   520 * Class to contain client UIDs of a connection.
       
   521 */
       
   522 class TConnMonClientEnum
       
   523     {
       
   524 public:
       
   525     /**
       
   526     * Constructor.
       
   527     */
       
   528     inline TConnMonClientEnum():iCount( 0 )
       
   529         {
       
   530         }
       
   531 public:
       
   532     /**
       
   533     * Number of UIDs in iUid array.
       
   534     */
       
   535     TUint iCount;
       
   536     /**
       
   537     * Array for client UIDs.
       
   538     */
       
   539     TUid iUid[KConnMonMaxClientUids];
       
   540     };
       
   541 
       
   542 /**
       
   543 * Package class definition for getting the client information.
       
   544 */
       
   545 typedef TPckgBuf<TConnMonClientEnum> TConnMonClientEnumBuf;
       
   546 
       
   547 /** Maximum number of WLANs contained in TConnMonNetworkNames class.
       
   548 */
       
   549 const TUint KConnMonMaxNetworkCount = 10;
       
   550 
       
   551 /**
       
   552 * Class to contain basic WLAN information.
       
   553 */
       
   554 class TConnMonNetwork
       
   555 {
       
   556 public:
       
   557     /**
       
   558     * Constructor.
       
   559     */
       
   560     inline TConnMonNetwork():iType( 0 ), iSignalStrength( 0 )
       
   561         {
       
   562         }
       
   563 public:
       
   564     /**
       
   565     * WLAN name (SSID).
       
   566     */
       
   567     TBuf8<32> iName;
       
   568     /**
       
   569     * WLAN mode, defined in TConnMonNetworkMode.
       
   570     */
       
   571     TInt8 iType;
       
   572     /**
       
   573     * Signal strength in dBm. Given as absolute, correct value is negative.
       
   574     */
       
   575     TUint8 iSignalStrength;
       
   576     };
       
   577 
       
   578 /**
       
   579 * Class to contain an array of basic WLAN information.
       
   580 */
       
   581 class TConnMonNetworkNames
       
   582     {
       
   583 public:
       
   584     /**
       
   585     * Constructor.
       
   586     */
       
   587     inline TConnMonNetworkNames():iCount( 0 )
       
   588         {
       
   589         }
       
   590     /**
       
   591     * This method returns the number of WLANs contained in this class.
       
   592     *
       
   593     * @return Number of WLANs.
       
   594     */
       
   595     inline TUint Count()
       
   596         {
       
   597         return iCount;
       
   598         }
       
   599 public:
       
   600     /**
       
   601     * Number of items in WLAN array.
       
   602     */
       
   603     TUint iCount;
       
   604     /**
       
   605     * Array of WLANs.
       
   606     */
       
   607     TConnMonNetwork iNetwork[KConnMonMaxNetworkCount];
       
   608     };
       
   609 
       
   610 /**
       
   611 * Package class definition for getting basic WLAN scan information.
       
   612 */
       
   613 typedef TPckgBuf<TConnMonNetworkNames> TConnMonNetworkNamesBuf;
       
   614 
       
   615 /** Maximum number of IAPs contained in TConnMonIapInfo class.
       
   616 */
       
   617 const TUint KConnMonMaxIAPCount = 25;
       
   618 
       
   619 /**
       
   620 * Class representing an IAP.
       
   621 */
       
   622 class TConnMonIap
       
   623     {
       
   624 public:
       
   625     /**
       
   626     * Constructor.
       
   627     */
       
   628     inline TConnMonIap():iIapId( 0 )
       
   629         {
       
   630         }
       
   631 public:
       
   632     /**
       
   633     * IAP ID number.
       
   634     */
       
   635     TUint iIapId;
       
   636     };
       
   637 
       
   638 /**
       
   639 * Class to contain an array of IAPs.
       
   640 */
       
   641 class TConnMonIapInfo
       
   642     {
       
   643 public:
       
   644     /**
       
   645     * Constructor.
       
   646     */
       
   647     inline TConnMonIapInfo():iCount( 0 )
       
   648         {
       
   649         }
       
   650     /**
       
   651     * This method returns the number of IAPs contained in this class.
       
   652     *
       
   653     * @return Number of IAPs.
       
   654     */
       
   655     inline TUint Count()
       
   656         {
       
   657         return iCount;
       
   658         }
       
   659 public:
       
   660     /**
       
   661     * Number of items in IAP array.
       
   662     */
       
   663     TUint iCount;
       
   664     /**
       
   665     * Array of IAPs.
       
   666     */
       
   667     TConnMonIap iIap[KConnMonMaxIAPCount];
       
   668     };
       
   669 
       
   670 /** Package class definiton for getting available IAPs.
       
   671 */
       
   672 typedef TPckgBuf<TConnMonIapInfo> TConnMonIapInfoBuf;
       
   673 
       
   674 /** Maximum number of SNAPs contained in TConnMonSNAPInfo class.
       
   675 */
       
   676 const TUint KConnMonMaxSNAPsCount = 25;
       
   677 
       
   678 /**
       
   679 * Class representing a SNAP.
       
   680 */
       
   681 class TConnMonSNAPId
       
   682     {
       
   683 public:
       
   684     /**
       
   685     * Constructor.
       
   686     */
       
   687     inline TConnMonSNAPId():iSNAPId( 0 )
       
   688         {
       
   689         }
       
   690 public:
       
   691     /**
       
   692     * SNAP ID number.
       
   693     */
       
   694     TUint iSNAPId;
       
   695     };
       
   696 
       
   697 /**
       
   698 * Class to contain an array of SNAPs.
       
   699 */
       
   700 class TConnMonSNAPInfo
       
   701     {
       
   702 public:
       
   703     /**
       
   704     * Constructor.
       
   705     */
       
   706     inline TConnMonSNAPInfo():iCount( 0 )
       
   707         {
       
   708         }
       
   709     /**
       
   710     * This method returns the number of SNAPs contained in this class.
       
   711     *
       
   712     * @return Number of SNAPs.
       
   713     */
       
   714     inline TUint Count()
       
   715         {
       
   716         return iCount;
       
   717         }
       
   718 public:
       
   719     /**
       
   720     * Number of items in SNAP array.
       
   721     */
       
   722     TUint iCount;
       
   723     /**
       
   724     * Array of SNAPs.
       
   725     */
       
   726     TConnMonSNAPId iSNAP[KConnMonMaxSNAPsCount];
       
   727     };
       
   728 
       
   729 /** Package class definiton for getting available SNAPs.
       
   730 */
       
   731 typedef TPckgBuf<TConnMonSNAPInfo> TConnMonSNAPInfoBuf;
       
   732 
       
   733 /**
       
   734 * Bearer group definition, new values will be added to the end of the
       
   735 * enumeration.
       
   736 */
       
   737 enum TConnMonBearerGroup
       
   738     {
       
   739     EBearerGroupUnknown                    = 0,
       
   740     EBearerGroupCellular                   = 0x00000001,
       
   741     EBearerGroupNonCellular                = 0x00000002,
       
   742     EBearerGroupCellularPacket             = 0x00000004,
       
   743     EBearerGroupCircuitSwitched            = 0x00000008,
       
   744     EBearerGroup2G                         = 0x00000010,
       
   745     EBearerGroup2GPacket                   = 0x00000020,
       
   746     EBearerGroup3G                         = 0x00000040,
       
   747     EBearerGroup3GPacket                   = 0x00000080,
       
   748     EBearerGroupHSPA                       = 0x00000100,
       
   749     EBearerGroupLANBased                   = 0x00000200,
       
   750     EBearerGroupWLAN                       = 0x00000400,
       
   751     EBearerGroupIPOverConnectivityProtocol = 0x00000800,
       
   752     EBearerGroupWired                      = 0x00001000,
       
   753     EBearerGroupVirtual                    = 0x00002000
       
   754     };
       
   755 
       
   756 /**
       
   757 * Bearer definition, new values will be added to the end of the enumeration.
       
   758 * These are used if KBearerInfo attribute is set or in events if
       
   759 * KBearerGroupThreshold is set.
       
   760 */
       
   761 enum TConnMonBearerInfo
       
   762     {
       
   763     EBearerInfoUnknown = 0,
       
   764     EBearerInfoCSD,
       
   765     EBearerInfoWCDMA,
       
   766     EBearerInfoLAN,
       
   767     EBearerInfoCDMA2000,
       
   768     EBearerInfoGPRS,
       
   769     EBearerInfoHSCSD,
       
   770     EBearerInfoEdgeGPRS,
       
   771     EBearerInfoWLAN,
       
   772     EBearerInfoBluetooth,
       
   773     EBearerInfoVirtual,
       
   774     EBearerInfoVirtualVPN,
       
   775     EBearerInfoWcdmaCSD,
       
   776     EBearerInfoHSDPA,
       
   777     EBearerInfoHSUPA,
       
   778     EBearerInfoHSxPA
       
   779     };
       
   780 
       
   781 /**
       
   782 * Class to contain bearer group information.
       
   783 */
       
   784 class TConnMonBearerGroupInfo
       
   785     {
       
   786 public:
       
   787     /**
       
   788     * Constructor.
       
   789     */
       
   790     inline TConnMonBearerGroupInfo():
       
   791             iInternal( ETrue ),
       
   792             iBearerGroups( 0 ),
       
   793             iBearerGroups2( 0 )
       
   794         {
       
   795         }
       
   796 public:
       
   797     /**
       
   798     * Connection is internal or external.
       
   799     */
       
   800     TBool iInternal;
       
   801     /**
       
   802     * Bearer group bitmask.
       
   803     */
       
   804     TUint iBearerGroups;
       
   805     /**
       
   806     * Reserved for future use.
       
   807     */
       
   808     TUint iBearerGroups2;
       
   809     };
       
   810 
       
   811 /** Package class definiton for getting bearer group information.
       
   812 */
       
   813 typedef TPckgBuf<TConnMonBearerGroupInfo> TConnMonBearerGroupInfoBuf;
       
   814 
       
   815 /**
       
   816 * Class to represent a WLAN. Used when reporting WLAN scan results back to a
       
   817 * client.
       
   818 */
       
   819 NONSHARABLE_CLASS( CConnMonWlanNetwork ) : public CBase
       
   820     {
       
   821 public:
       
   822     /** Maximum length of a WLAN name (SSID).
       
   823     */
       
   824     static const TUint KMaxNameLength = 32;
       
   825     /** WLAN BSSID length (mac address).
       
   826     */
       
   827     static const TUint KWlanBssId = 6;
       
   828     /** Reserved for future use.
       
   829     */
       
   830     static const TUint KExtraCount = 10;
       
   831 
       
   832     /**
       
   833     * Constructor.
       
   834     *
       
   835     * @param aName Name (SSID) of the network.
       
   836     * @param aConnectionMode Mode of the network.
       
   837     * @param aSignalStrength Signal strength of the network.
       
   838     * @param aSecurityMode Security mode of the network.
       
   839     * @param aBssId Mac address (BSSID) of the base station.
       
   840     * @param aVendorData Not in use.
       
   841     * @return Pointer to the created CConnMonWlanNetwork object.
       
   842     */
       
   843     IMPORT_C static CConnMonWlanNetwork* NewL(
       
   844             const TBuf<KMaxNameLength>& aName,
       
   845             TUint aConnectionMode,
       
   846             TUint aSignalStrength,
       
   847             TUint aSecurityMode,
       
   848             const TBuf8<KWlanBssId>& aBssId,
       
   849             const TDesC& aVendorData );
       
   850 
       
   851     /**
       
   852     * Constructor.
       
   853     *
       
   854     * @return Pointer to the created empty CConnMonWlanNetwork object.
       
   855     */
       
   856     IMPORT_C static CConnMonWlanNetwork* NewL();
       
   857 
       
   858     /**
       
   859     * Copy constructor.
       
   860     *
       
   861     * @param aConnMonWlanNetwork The object which is copied.
       
   862     * @return Pointer to the created CConnMonWlanNetwork object.
       
   863     */
       
   864     IMPORT_C static CConnMonWlanNetwork* NewL(
       
   865             CConnMonWlanNetwork& aConnMonWlanNetwork );
       
   866 
       
   867     /**
       
   868     * Destructor.
       
   869     */
       
   870     IMPORT_C ~CConnMonWlanNetwork();
       
   871 
       
   872     /**
       
   873     * Assignment operator.
       
   874     *
       
   875     * @param aConnMonWlanNetwork The object which is assigned.
       
   876     */
       
   877     IMPORT_C CConnMonWlanNetwork& operator=(
       
   878             CConnMonWlanNetwork& aConnMonWlanNetwork );
       
   879 
       
   880     /**
       
   881     * Compares two networks by signal strength.
       
   882     *
       
   883     * @param aFirst Reference to first WLAN object.
       
   884     * @param aSecond Reference to second WLAN object.
       
   885     * @return Result of the comparison, 1 if first is less than second, 0 if
       
   886     * they are equal and -1 otherwise.
       
   887     */
       
   888     IMPORT_C static TInt CompareBySignal(
       
   889             const CConnMonWlanNetwork& aFirst,
       
   890             const CConnMonWlanNetwork& aSecond );
       
   891 
       
   892     /**
       
   893     * Obtains the name (SSID) of the network.
       
   894     *
       
   895     * @return Name of the wlan network.
       
   896     */
       
   897     inline TBuf<KMaxNameLength> Name()
       
   898         {
       
   899         return iName;
       
   900         }
       
   901 
       
   902     /**
       
   903     * Obtains the connection mode of the network.
       
   904     *
       
   905     * @return Connection mode (defined in TConnMonNetworkMode).
       
   906     */
       
   907     inline TUint ConnectionMode()
       
   908         {
       
   909         return iConnectionMode;
       
   910         }
       
   911 
       
   912     /**
       
   913     * Obtains the signal strength of the network.
       
   914     *
       
   915     * @return Signal strength in dBm.
       
   916     */
       
   917     inline TUint SignalStrength()
       
   918         {
       
   919         return iSignalStrength;
       
   920         }
       
   921 
       
   922     /**
       
   923     * Obtains the security mode of the network.
       
   924     *
       
   925     * @return Security mode (defined in TConnMonSecurityMode).
       
   926     */
       
   927     inline TUint SecurityMode()
       
   928         {
       
   929         return iSecurityMode;
       
   930         }
       
   931 
       
   932     /**
       
   933     * Obtains the mac address (BSSID) of the base station.
       
   934     *
       
   935     * @return Mac address (BSSID).
       
   936     */
       
   937     inline TBuf8<KWlanBssId> WlanBssid()
       
   938         {
       
   939         return iWlanBssId;
       
   940         }
       
   941 
       
   942     /**
       
   943     * Obtains a pointer to vendor specific data buffer.
       
   944     * Ownership of the data is NOT transferred. Not in use, use package
       
   945     * attribute KWlanProbeRawBuffers instead.
       
   946     *
       
   947     * @return Pointer to vendor specific data if available.
       
   948     */
       
   949     inline HBufC* VendorData()
       
   950         {
       
   951         return iVendorData;
       
   952         }
       
   953 
       
   954     /**
       
   955     * Writes object of class CConnMonWlanNetwork to memory.
       
   956     * Ownership of newly created buffer is transferred to caller.
       
   957     *
       
   958     * @return Pointer to heap descriptor. NULL if memory allocation failed.
       
   959     */
       
   960     IMPORT_C const HBufC* ToBuf() const;
       
   961 
       
   962     /**
       
   963     * Reads object of class CConnMonWlanNetwork from memory.
       
   964     *
       
   965     * @param aPtrC Pointer to the beginning of the CConnMonWlanNetwork object
       
   966     * in buffer.
       
   967     * @param aConnMonWlanNetwork Pointer to CConnMonWlanNetwork object where
       
   968     * unpacked contents are written.
       
   969     * @return A Symbian OS error code.
       
   970     */
       
   971     IMPORT_C static TInt FromPtrC(
       
   972             const TPtrC& aPtrC,
       
   973             CConnMonWlanNetwork* aConnMonWlanNetwork );
       
   974 
       
   975 private:
       
   976     /**
       
   977     * Constructor.
       
   978     */
       
   979     CConnMonWlanNetwork();
       
   980 
       
   981     /**
       
   982     * Constructor.
       
   983     *
       
   984     * @param aName Name (SSID) of the network.
       
   985     * @param aConnectionMode Mode of the network.
       
   986     * @param aSignalStrength Signal strength of the network.
       
   987     * @param aSecurityMode Security mode of the network.
       
   988     * @param aBssId Mac address (BSSID) of the base station.
       
   989     * @param aVendorData Not in use.
       
   990     */
       
   991     CConnMonWlanNetwork(
       
   992             const TBuf<KMaxNameLength>& aName,
       
   993             TUint aConnectionMode,
       
   994             TUint aSignalStrength,
       
   995             TUint aSecurityMode,
       
   996             const TBuf8<KWlanBssId>& aBssId,
       
   997             const TDesC& aVendorData );
       
   998 
       
   999     /**
       
  1000     * Second-phase constructor.
       
  1001     */
       
  1002     void ConstructL();
       
  1003 
       
  1004 private:
       
  1005     TBuf<KMaxNameLength> iName;   // Network name
       
  1006     TUint iConnectionMode;        // WLAN mode, see TConnMonNetworkMode
       
  1007     TUint iSignalStrength;        // Signal strength in absolute dBm
       
  1008     TUint iSecurityMode;          // See TConnMonSecurityMode
       
  1009     TBuf8<KWlanBssId> iWlanBssId; // BSSID
       
  1010     HBufC* iVendorData;           // For vendor specific data
       
  1011     TUint iExtraBuf[KExtraCount]; // Reserved for future
       
  1012     };
       
  1013 
       
  1014 /** Class definition for a pointer array of CConnMonWlanNetwork objects.
       
  1015 */
       
  1016 typedef RPointerArray<CConnMonWlanNetwork> RConnMonWlanNetworksPtrArray;
       
  1017 
       
  1018 /**
       
  1019 * Class to contain a package of a pointer array of CConnMonWlanNetwork objects.
       
  1020 */
       
  1021 class CConnMonWlanNetworksPtrArrayPckg : public CBase
       
  1022     {
       
  1023 public:
       
  1024     /**
       
  1025     * Constructor. Constructs the package of an array of pointers to
       
  1026     * CConnMonWlanNetwork objects on the heap.
       
  1027     *
       
  1028     * @param aRef Array of pointers to CConnMonWlanNetwork objects.
       
  1029     * @param aBufSize Size of the buffer, intended to contain the package.
       
  1030     */
       
  1031     CConnMonWlanNetworksPtrArrayPckg(
       
  1032             const RPointerArray<CConnMonWlanNetwork>& aRef,
       
  1033             TUint aBufSize );
       
  1034 
       
  1035     /**
       
  1036     * Constructor. Constructs an empty package on the heap.
       
  1037     *
       
  1038     * @param aBufSize Size of the buffer, intended to contain the package.
       
  1039     */
       
  1040     IMPORT_C CConnMonWlanNetworksPtrArrayPckg( TUint aBufSize );
       
  1041 
       
  1042     /**
       
  1043     * Destructor.
       
  1044     */
       
  1045     IMPORT_C virtual ~CConnMonWlanNetworksPtrArrayPckg();
       
  1046 
       
  1047     /**
       
  1048     * Unpacks the package to a pointer array of CConnMonWlanNetwork objects.
       
  1049     *
       
  1050     * @param aRef Array that will contain the pointers to unpacked objects.
       
  1051     */
       
  1052     IMPORT_C void UnpackToL( RPointerArray<CConnMonWlanNetwork>& aRef ) const;
       
  1053 
       
  1054     /**
       
  1055     * Obtains a pointer to the package buffer.
       
  1056     *
       
  1057     * @return Pointer to the package buffer.
       
  1058     */
       
  1059     IMPORT_C HBufC* Buf() const;
       
  1060 
       
  1061 private:
       
  1062     /**
       
  1063     * Pointer to the package Buffer on the heap.
       
  1064     */
       
  1065     HBufC* iBuf;
       
  1066     };
       
  1067 
       
  1068 /**
       
  1069 * Class to represent a WLAN beacon frame. Used when reporting WLAN scan
       
  1070 * results back to a client.
       
  1071 */
       
  1072 NONSHARABLE_CLASS( CConnMonWlanProbeRawBuffer ) : public CBase
       
  1073     {
       
  1074     public:
       
  1075     /**
       
  1076     * Constructor.
       
  1077     *
       
  1078     * @param aRawBuffer Beacon frame buffer to be copied to this object.
       
  1079     * @return Pointer to the created CConnMonWlanProbeRawBuffer object.
       
  1080     */
       
  1081     IMPORT_C static CConnMonWlanProbeRawBuffer* NewL(
       
  1082             const HBufC8* aRawBuffer );
       
  1083 
       
  1084     /**
       
  1085     * Constructor.
       
  1086     *
       
  1087     * @return Pointer to the created empty CConnMonWlanProbeRawBuffer object.
       
  1088     */
       
  1089     IMPORT_C static CConnMonWlanProbeRawBuffer* NewL();
       
  1090 
       
  1091     /**
       
  1092     * Copy constructor.
       
  1093     *
       
  1094     * @param aConnMonWlanProbeRawBuffer The object which is copied.
       
  1095     * @return Pointer to the created CConnMonWlanProbeRawBuffer object.
       
  1096     */
       
  1097     IMPORT_C static CConnMonWlanProbeRawBuffer* NewL(
       
  1098             CConnMonWlanProbeRawBuffer& aConnMonWlanProbeRawBuffer );
       
  1099 
       
  1100     /**
       
  1101     * Destructor.
       
  1102     */
       
  1103     IMPORT_C virtual ~CConnMonWlanProbeRawBuffer();
       
  1104 
       
  1105     /**
       
  1106     * Assignment operator.
       
  1107     *
       
  1108     * @param aConnMonWlanProbeRawBuffer The object which is assigned.
       
  1109     */
       
  1110     IMPORT_C CConnMonWlanProbeRawBuffer& operator=(
       
  1111             CConnMonWlanProbeRawBuffer& aConnMonWlanProbeRawBuffer );
       
  1112 
       
  1113     /**
       
  1114     * Obtains a pointer to the beacon frame buffer.
       
  1115     *
       
  1116     * @return Pointer to the beacon frame buffer.
       
  1117     */
       
  1118     IMPORT_C HBufC8* RawBuffer() const;
       
  1119 
       
  1120     /**
       
  1121     * Writes object of class CConnMonWlanProbeRawBuffer to memory.
       
  1122     * Ownership of newly created buffer is transferred to caller.
       
  1123     *
       
  1124     * @return Pointer to heap descriptor, NULL if memory allocation failed.
       
  1125     */
       
  1126     const HBufC8* ToBuf() const;
       
  1127 
       
  1128     /**
       
  1129     * Reads object of class CConnMonWlanProbeRawBuffer from memory.
       
  1130     *
       
  1131     * @param aPtrC Pointer to the beginning of the CConnMonWlanProbeRawBuffer
       
  1132     * object in buffer.
       
  1133     * @param aConnMonWlanProbeRawBuffer Pointer to CConnMonWlanProbeRawBuffer
       
  1134     * object where unpacked contents are written.
       
  1135     * @return A Symbian OS error code.
       
  1136     */
       
  1137     static TInt FromPtrC(
       
  1138             const TPtrC8& aPtrC,
       
  1139             CConnMonWlanProbeRawBuffer* aConnMonWlanProbeRawBuffer );
       
  1140 
       
  1141 private:
       
  1142     /**
       
  1143     * Constructor.
       
  1144     */
       
  1145     CConnMonWlanProbeRawBuffer();
       
  1146 
       
  1147     /**
       
  1148     * Second-phase constructor.
       
  1149     */
       
  1150     void ConstructL();
       
  1151 
       
  1152     /**
       
  1153     * Second-phase constructor.
       
  1154     *
       
  1155     * @param aRawBuffer Buffer to be copied to this object.
       
  1156     */
       
  1157     void ConstructL( const HBufC8* aRawBuffer );
       
  1158 
       
  1159 private:
       
  1160     HBufC8* iRawBuffer; // Beacon frame buffer
       
  1161     };
       
  1162 
       
  1163 /** Class definition for a pointer array of CConnMonWlanProbeRawBuffer objects.
       
  1164 */
       
  1165 typedef RPointerArray<CConnMonWlanProbeRawBuffer> RConnMonWlanProbeRawBuffersPtrArray;
       
  1166 
       
  1167 /**
       
  1168 * Class to contain a package of a pointer array of CConnMonWlanProbeRawBuffer
       
  1169 * objects.
       
  1170 */
       
  1171 class CConnMonWlanProbeRawBuffersPckg : public CBase
       
  1172     {
       
  1173 public:
       
  1174     /**
       
  1175     * Constructor. Constructs the package of an array of pointers to
       
  1176     * CConnMonWlanProbeRawBuffer objects on the heap.
       
  1177     *
       
  1178     * @param aRef Array of pointers to CConnMonWlanProbeRawBuffer objects.
       
  1179     * @param aBufSize Size of the buffer, intended to contain the package.
       
  1180     */
       
  1181     CConnMonWlanProbeRawBuffersPckg(
       
  1182             const RConnMonWlanProbeRawBuffersPtrArray& aRef,
       
  1183             TUint aBufSize );
       
  1184 
       
  1185     /**
       
  1186     * Constructor. Constructs an empty package on the heap.
       
  1187     *
       
  1188     * @param aBufSize Size of the buffer, intended to contain the package.
       
  1189     */
       
  1190     IMPORT_C CConnMonWlanProbeRawBuffersPckg( TUint aBufSize );
       
  1191 
       
  1192     /**
       
  1193     * Destructor.
       
  1194     */
       
  1195     IMPORT_C virtual ~CConnMonWlanProbeRawBuffersPckg();
       
  1196 
       
  1197     /**
       
  1198     * Unpacks the package to a pointer array of CConnMonWlanProbeRawBuffer
       
  1199     * objects.
       
  1200     *
       
  1201     * @param aRef Array that will contain the pointers to unpacked objects.
       
  1202     */
       
  1203     IMPORT_C void UnpackToL( RConnMonWlanProbeRawBuffersPtrArray& aRef ) const;
       
  1204 
       
  1205     /**
       
  1206     * Obtains a pointer to the package buffer.
       
  1207     *
       
  1208     * @return Pointer to the package buffer.
       
  1209     */
       
  1210     IMPORT_C HBufC8* Buf() const;
       
  1211 
       
  1212     /**
       
  1213     * Obtains the total number of found WLANs.
       
  1214     *
       
  1215     * @return Total count (iBuf[0]).
       
  1216     */
       
  1217     IMPORT_C TUint Total() const;
       
  1218 
       
  1219     /**
       
  1220     * Obtains the number of trasferred WLANs. This will be less than total
       
  1221     * count if there was not enough memory in buffer to include all found
       
  1222     * WLANs.
       
  1223     *
       
  1224     * @return Transfered count in buffer (iBuf[1]).
       
  1225     */
       
  1226     IMPORT_C TUint Count() const;
       
  1227 
       
  1228 private:
       
  1229     /**
       
  1230     * Pointer to the package buffer on the heap.
       
  1231     */
       
  1232     HBufC8* iBuf;
       
  1233     };
       
  1234 
       
  1235 /**
       
  1236 * Interface template for the class T serialization to/from HBuf/TPtr.
       
  1237 * Class T could be any type of class (T, C, etc.).
       
  1238 */
       
  1239 template <class T>
       
  1240     class MDesSerializer
       
  1241     {
       
  1242 public:
       
  1243     /**
       
  1244     * Have to pack the object of class T to HBufC.
       
  1245     * Ownership of newly created pointer is transferred to caller.
       
  1246     *
       
  1247     * @return Pointer to the heap descriptor.
       
  1248     */
       
  1249     virtual const HBufC* ToBuf() const = 0;
       
  1250 
       
  1251     /**
       
  1252     * Have to unpack object of class T from aPtrC.
       
  1253     *
       
  1254     * @return Constant pointer to the heap descriptor.
       
  1255     */
       
  1256     static T FromPtrC( const TPtrC& aPtrC );
       
  1257     };
       
  1258 
       
  1259 /**
       
  1260 * Class representing an ID number.
       
  1261 * MDesSerializer - abstract interface for class serialization.
       
  1262 */
       
  1263 class TConnMonId : public MDesSerializer<TConnMonId>
       
  1264     {
       
  1265 public:
       
  1266     /**
       
  1267     * Defines the maximum size of the object in TChar's.
       
  1268     * +1 is for rounding to bigger integer.
       
  1269     */
       
  1270     static const TUint KMaxSize = ( sizeof( TUint ) ) / sizeof( TChar ) + 1;
       
  1271 
       
  1272     /**
       
  1273     * Defines shifts of fields inside the object.
       
  1274     */
       
  1275     enum FieldsShifts
       
  1276         {
       
  1277         EId = 0
       
  1278         };
       
  1279 
       
  1280     /**
       
  1281     * Constructor.
       
  1282     *
       
  1283     * @param aId ID number.
       
  1284     */
       
  1285     IMPORT_C TConnMonId( TUint aId );
       
  1286 
       
  1287     /**
       
  1288     * Obtains the ID number.
       
  1289     *
       
  1290     * @return ID number.
       
  1291     */
       
  1292     IMPORT_C TUint Id() const;
       
  1293 
       
  1294     // From MDesSerializer
       
  1295 
       
  1296     /**
       
  1297     * Writes object of class TConnMonId to memory.
       
  1298     * Ownership of newly created buffer is transferred to caller.
       
  1299     *
       
  1300     * @return Pointer to heap descriptor, NULL if memory allocation failed.
       
  1301     */
       
  1302     IMPORT_C const HBufC* ToBuf() const;
       
  1303 
       
  1304     /**
       
  1305     * Reads object of class TConnMonId from memory.
       
  1306     *
       
  1307     * @param aPtrC Pointer to the beginning of the TConnMonId object in buffer.
       
  1308     * @return The newly created TConnMonId object.
       
  1309     */
       
  1310     IMPORT_C static TConnMonId FromPtrC( const TPtrC& aPtrC );
       
  1311 
       
  1312 protected:
       
  1313     /**
       
  1314     * ID number.
       
  1315     */
       
  1316     const TUint iId;
       
  1317     };
       
  1318 
       
  1319 /** Class definition for an array of TConnMonId objects.
       
  1320 */
       
  1321 typedef RArray<TConnMonId> RConnMonIdsArray;
       
  1322 
       
  1323 /**
       
  1324 * Class to contain a package of an array of TConnMonId objects.
       
  1325 */
       
  1326 class ConnMonIdsArrayPckg
       
  1327     {
       
  1328 public:
       
  1329     /**
       
  1330     * Constructor. Constructs the package of an array of TConnMonId objects
       
  1331     * on the heap.
       
  1332     *
       
  1333     * @param aRef Array of TConnMonId objects.
       
  1334     * @param aBufSize Size of the buffer, intended to contain the package.
       
  1335     */
       
  1336     ConnMonIdsArrayPckg( const RArray<TConnMonId>& aRef, TUint aBufSize );
       
  1337 
       
  1338     /**
       
  1339     * Constructor. Constructs an empty package on the heap.
       
  1340     *
       
  1341     * @param aBufSize Size of the buffer, intended to contain the package.
       
  1342     */
       
  1343     IMPORT_C ConnMonIdsArrayPckg( TUint aBufSize );
       
  1344 
       
  1345     /**
       
  1346     * Destructor.
       
  1347     */
       
  1348     IMPORT_C virtual ~ConnMonIdsArrayPckg();
       
  1349 
       
  1350     /**
       
  1351     * Unpacks the package to an array of TConnMonId objects.
       
  1352     *
       
  1353     * @param aRef Array that will contain the unpacked objects.
       
  1354     */
       
  1355     IMPORT_C void UnpackToL( RArray<TConnMonId>& aRef ) const;
       
  1356 
       
  1357     /**
       
  1358     * Obtains a pointer to the package buffer.
       
  1359     *
       
  1360     * @return Pointer to the package buffer.
       
  1361     */
       
  1362     IMPORT_C HBufC* Buf() const;
       
  1363 
       
  1364 protected:
       
  1365     /**
       
  1366     * Pointer to the package buffer on the heap.
       
  1367     */
       
  1368     HBufC* iBuf;
       
  1369     };
       
  1370 
       
  1371 // Forward declarations
       
  1372 class CConnMonEventBase;
       
  1373 class CConnMonEventHandler;
       
  1374 
       
  1375 /**
       
  1376 * Client application must implement the MConnectionMonitorObserver interface in
       
  1377 * order to receive notifications. MConnectionMonitorObserver::EventL() method
       
  1378 * will be called every time an event arrives.
       
  1379 *
       
  1380 * @lib CONNMON.LIB
       
  1381 */
       
  1382 class MConnectionMonitorObserver
       
  1383     {
       
  1384 public:
       
  1385     /**
       
  1386     * This method is called every time an event occurs.
       
  1387     *
       
  1388     * @param aConnMonEvent The event information.
       
  1389     */
       
  1390     virtual void EventL( const CConnMonEventBase &aConnMonEvent ) = 0;
       
  1391     };
       
  1392 
       
  1393 /**
       
  1394 * RConnectionMonitor
       
  1395 *
       
  1396 * @lib CONNMON.LIB
       
  1397 */
       
  1398 class RConnectionMonitor : public RSessionBase
       
  1399     {
       
  1400 public:
       
  1401     /**
       
  1402     * Constructor.
       
  1403     */
       
  1404     inline RConnectionMonitor():
       
  1405             RSessionBase(),
       
  1406             iHandler( 0 ),
       
  1407             iPtrArray(),
       
  1408             iIndex( 0 )
       
  1409         {
       
  1410         }
       
  1411 
       
  1412 public:
       
  1413     /**
       
  1414     * Connects the client to the Connection Monitor Server. It must be called
       
  1415     * before any of other methods during the Connection Monitor session.
       
  1416     *
       
  1417     * @return KErrNone if successful, a system-wide error code if not.
       
  1418     */
       
  1419     IMPORT_C TInt ConnectL();
       
  1420 
       
  1421     /**
       
  1422     * Closes the Connection Monitor session. An opened RConnectionMonitor must
       
  1423     * be closed explicitily to prevent a resource (memory) leak.
       
  1424     */
       
  1425     IMPORT_C void Close();
       
  1426 
       
  1427     /**
       
  1428     * Gathers information on currently active connections.
       
  1429     *
       
  1430     * @param aConnectionCount On completion, contains the number of active
       
  1431     * connections.
       
  1432     * @param aStatus KErrNone if successful, a system-wide error code if not.
       
  1433     */
       
  1434     IMPORT_C void GetConnectionCount(
       
  1435             TUint& aConnectionCount,
       
  1436             TRequestStatus& aStatus );
       
  1437 
       
  1438     /**
       
  1439     * Gets the connection ID and the count of the subconnections for the given
       
  1440     * index. GetConnectionCount() must be called to gather the information on
       
  1441     * active connections before calling this method.
       
  1442     *
       
  1443     * @param aIndex Must be between 1 and the count returned by
       
  1444     * GetConnectionCount().
       
  1445     * @param aConnectionId On return, contains the connection ID.
       
  1446     * @param aSubConnectionCount On return, contains the number of
       
  1447     * subconnections.
       
  1448     * @return KErrNone if successful, a system-wide error code if not.
       
  1449     */
       
  1450     IMPORT_C TInt GetConnectionInfo(
       
  1451             const TUint aIndex,
       
  1452             TUint& aConnectionId,
       
  1453             TUint& aSubConnectionCount ) const;
       
  1454 
       
  1455     /**
       
  1456     * Gets the subconnection ID for the given index.
       
  1457     *
       
  1458     * @param aConnectionId Connection ID.
       
  1459     * @param aIndex Must be between 1 and the subconnection count returned by
       
  1460     * GetConnectionInfo().
       
  1461     * @param aSubConnectionId On return, contains the subconnection ID.
       
  1462     * @return KErrNone if successful, a system-wide error code if not.
       
  1463     */
       
  1464     IMPORT_C TInt GetSubConnectionInfo(
       
  1465             const TUint aConnectionId,
       
  1466             const TUint aIndex,
       
  1467             TUint& aSubConnectionId ) const;
       
  1468 
       
  1469     /**
       
  1470     * Gets the value for a TInt attribute.
       
  1471     *
       
  1472     * @param aConnectionId Connection ID.
       
  1473     * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
       
  1474     * connection.
       
  1475     * @param aAttribute Identifies the attribute to be retrieved.
       
  1476     * @param aValue On completion, contains the requested TInt attribute.
       
  1477     * @param aStatus KErrNone if successful, a system-wide error code if not.
       
  1478     */
       
  1479     IMPORT_C void GetIntAttribute(
       
  1480             const TUint aConnectionId,
       
  1481             const TUint aSubConnectionId,
       
  1482             const TUint aAttribute,
       
  1483             TInt& aValue,
       
  1484             TRequestStatus& aStatus );
       
  1485 
       
  1486     /**
       
  1487     * Gets the value for a TUint attribute.
       
  1488     *
       
  1489     * @param aConnectionId Connection ID.
       
  1490     * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
       
  1491     * connection.
       
  1492     * @param aAttribute Identifies the attribute to be retrieved.
       
  1493     * @param aValue On completion, contains the requested TUint attribute.
       
  1494     * @param aStatus KErrNone if successful, a system-wide error code if not.
       
  1495     */
       
  1496     IMPORT_C void GetUintAttribute(
       
  1497             const TUint aConnectionId,
       
  1498             const TUint aSubConnectionId,
       
  1499             const TUint aAttribute,
       
  1500             TUint& aValue,
       
  1501             TRequestStatus& aStatus );
       
  1502 
       
  1503     /**
       
  1504     * Gets the value for a TBool attribute.
       
  1505     *
       
  1506     * @param aConnectionId Connection ID.
       
  1507     * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
       
  1508     * connection.
       
  1509     * @param aAttribute Identifies the attribute to be retrieved.
       
  1510     * @param aValue On completion, contains the requested TBool attribute.
       
  1511     * @param aStatus KErrNone if successful, a system-wide error code if not.
       
  1512     */
       
  1513     IMPORT_C void GetBoolAttribute(
       
  1514             const TUint aConnectionId,
       
  1515             const TUint aSubConnectionId,
       
  1516             const TUint aAttribute,
       
  1517             TBool& aValue,
       
  1518             TRequestStatus& aStatus );
       
  1519 
       
  1520     /**
       
  1521     * Gets the value for a string attribute.
       
  1522     *
       
  1523     * @param aConnectionId Connection ID.
       
  1524     * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
       
  1525     * connection.
       
  1526     * @param aAttribute Identifies the attribute to be retrieved.
       
  1527     * @param aValue On completion, contains the requested string. Use a 16-bit
       
  1528     * descriptor!
       
  1529     * @param aStatus KErrNone if successful, a system-wide error code if not.
       
  1530     */
       
  1531     IMPORT_C void GetStringAttribute(
       
  1532             const TUint aConnectionId,
       
  1533             const TUint aSubConnectionId,
       
  1534             const TUint aAttribute,
       
  1535             TDes& aValue,
       
  1536             TRequestStatus& aStatus ) const;
       
  1537 
       
  1538     /**
       
  1539     * Gets the value for a packaged attribute.
       
  1540     *
       
  1541     * @param aConnectionId Connection ID.
       
  1542     * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
       
  1543     * connection.
       
  1544     * @param aAttribute Identifies the attribute to be retrieved.
       
  1545     * @param aValue On completion, contains the requested packaged attribute.
       
  1546     * @param aStatus KErrNone if successful, a system-wide error code if not.
       
  1547     */
       
  1548     IMPORT_C void GetPckgAttribute(
       
  1549             const TUint aConnectionId,
       
  1550             const TUint aSubConnectionId,
       
  1551             const TUint aAttribute,
       
  1552             TDes8& aValue,
       
  1553             TRequestStatus& aStatus ) const;
       
  1554 
       
  1555     /**
       
  1556     * Gets the value for a packaged attribute.
       
  1557     *
       
  1558     * @param aConnectionId Connection ID.
       
  1559     * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
       
  1560     * connection.
       
  1561     * @param aAttribute Identifies the attribute to be retrieved.
       
  1562     * @param aValue On completion, contains the requested packaged attribute.
       
  1563     * @param aStatus KErrNone if successful, a system-wide error code if not.
       
  1564     */
       
  1565     IMPORT_C void GetPckgAttribute(
       
  1566             const TUint aConnectionId,
       
  1567             const TUint aSubConnectionId,
       
  1568             const TUint aAttribute,
       
  1569             TDes16& aValue,
       
  1570             TRequestStatus& aStatus ) const;
       
  1571 
       
  1572     /**
       
  1573     * Sets the value for a TInt attribute.
       
  1574     *
       
  1575     * @param aConnectionId Connection ID.
       
  1576     * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
       
  1577     * connection.
       
  1578     * @param aAttribute Identifies the attribute to be set.
       
  1579     * @param aValue The value to be set.
       
  1580     * @return KErrNone if successful, a system-wide error code if not.
       
  1581     */
       
  1582     IMPORT_C TInt SetIntAttribute(
       
  1583             const TUint aConnectionId,
       
  1584             const TUint aSubConnectionId,
       
  1585             const TUint aAttribute,
       
  1586             const TInt aValue ) const;
       
  1587 
       
  1588     /**
       
  1589     * Sets the value for a TUint attribute.
       
  1590     *
       
  1591     * @param aConnectionId Connection ID.
       
  1592     * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
       
  1593     * connection.
       
  1594     * @param aAttribute Identifies the attribute to be set.
       
  1595     * @param aValue The value to be set.
       
  1596     * @return KErrNone if successful, a system-wide error code if not.
       
  1597     */
       
  1598     IMPORT_C TInt SetUintAttribute(
       
  1599             const TUint aConnectionId,
       
  1600             const TUint aSubConnectionId,
       
  1601             const TUint aAttribute,
       
  1602             const TUint aValue ) const;
       
  1603 
       
  1604     /**
       
  1605     * Sets the value for a TBool attribute.
       
  1606     *
       
  1607     * This method can be used to stop a connection (KConnectionStop).
       
  1608     * @param aConnectionId Connection ID.
       
  1609     * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
       
  1610     * connection.
       
  1611     * @param aAttribute Identifies the attribute to be set.
       
  1612     * @param aValue The value to be set.
       
  1613     * @return KErrNone if successful, a system-wide error code if not.
       
  1614     */
       
  1615     IMPORT_C TInt SetBoolAttribute(
       
  1616             const TUint aConnectionId,
       
  1617             const TUint aSubConnectionId,
       
  1618             const TUint aAttribute,
       
  1619             const TBool aValue ) const;
       
  1620 
       
  1621     /**
       
  1622     * Sets the value for a string attribute.
       
  1623     *
       
  1624     * @param aConnectionId Connection ID.
       
  1625     * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
       
  1626     * connection.
       
  1627     * @param aAttribute Identifies the attribute to be set.
       
  1628     * @param aValue The string value to be set. Must be a 16-bit descriptor.
       
  1629     * @return KErrNone if successful, a system-wide error code if not.
       
  1630     */
       
  1631     IMPORT_C TInt SetStringAttribute(
       
  1632             const TUint aConnectionId,
       
  1633             const TUint aSubConnectionId,
       
  1634             const TUint aAttribute,
       
  1635             const TDes& aValue ) const;
       
  1636 
       
  1637     /**
       
  1638     * Sets the value for a packaged attribute. There is currently no packaged
       
  1639     * attributes that can be set.
       
  1640     *
       
  1641     * @param aConnectionId Connection ID.
       
  1642     * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
       
  1643     * connection.
       
  1644     * @param aAttribute Identifies the attribute to be set.
       
  1645     * @param aValue The value to be set.
       
  1646     * @return KErrNone if successful, a system-wide error code if not.
       
  1647     */
       
  1648     IMPORT_C TInt SetPckgAttribute(
       
  1649             const TUint aConnectionId,
       
  1650             const TUint aSubConnectionId,
       
  1651             const TUint aAttribute,
       
  1652             const TDes8& aValue ) const;
       
  1653 
       
  1654     /**
       
  1655     * Cancels an asyncronous request. If there is several active requests of
       
  1656     * the same type (for example GetIntAttribute), they will all be cancelled.
       
  1657     * When a request is cancelled, it is completed with error code KErrCancel.
       
  1658     *
       
  1659     * @param aReqToCancel Identifies the request type to be cancelled.
       
  1660     * The different types are defined in TConnMonAsyncRequest.
       
  1661     */
       
  1662     IMPORT_C void CancelAsyncRequest( TInt aReqToCancel );
       
  1663 
       
  1664     /**
       
  1665     * Registers an event observer to catch connection monitor events.
       
  1666     *
       
  1667     * @param aObserver The event observer.
       
  1668     * @return KErrNone if successful, a system-wide error code if not.
       
  1669     */
       
  1670     IMPORT_C TInt NotifyEventL( MConnectionMonitorObserver& aObserver );
       
  1671 
       
  1672     /**
       
  1673     * Cancels the notifications from connection monitor.
       
  1674     */
       
  1675     IMPORT_C void CancelNotifications();
       
  1676 
       
  1677 private:
       
  1678     void ReceiveEvent(
       
  1679             TDes8& aBuffer,
       
  1680             TDes8& aExtraBuf,
       
  1681             TRequestStatus& aStatus );
       
  1682     void CancelReceiveEvent();
       
  1683     TBool IsConnected() const;
       
  1684     TPtr8& NextPtr();
       
  1685 
       
  1686 private:
       
  1687     CConnMonEventHandler* iHandler;
       
  1688     RArray<TPtr8> iPtrArray;
       
  1689     TInt iIndex;
       
  1690 
       
  1691 private:
       
  1692     friend class CConnMonEventHandler;
       
  1693     };
       
  1694 
       
  1695 /**
       
  1696 * Base class for all ConnMon event types.
       
  1697 *
       
  1698 * Example how to convert an event according to type.
       
  1699 * @code
       
  1700 * void CMyConnMonObserver::EventL( const CConnMonEventBase& aEvent )
       
  1701 *     {
       
  1702 *     switch( aEvent.EventType() )
       
  1703 *         {
       
  1704 *         case EConnMonCreateConnection:
       
  1705 *             CConnMonCreateConnection* realEvent;
       
  1706 *             realEvent = (CConnMonCreateConnection*) &aEvent;
       
  1707 *             //...
       
  1708 * @endcode
       
  1709 */
       
  1710 NONSHARABLE_CLASS( CConnMonEventBase ) : public CBase
       
  1711     {
       
  1712 public:
       
  1713     /**
       
  1714     * Constructor.
       
  1715     *
       
  1716     * @param aEventType Event type.
       
  1717     * @param iConnectionId Connection ID.
       
  1718     */
       
  1719     CConnMonEventBase( const TInt aEventType, const TUint iConnectionId );
       
  1720 
       
  1721     /**
       
  1722     * Destructor.
       
  1723     */
       
  1724     ~CConnMonEventBase();
       
  1725 
       
  1726 public:
       
  1727     /**
       
  1728     * Gets the type of the event.
       
  1729     *
       
  1730     * @return Type of the event. Values are defined in TConnMonEventType.
       
  1731     */
       
  1732     IMPORT_C TInt EventType() const;
       
  1733 
       
  1734     /**
       
  1735     * Gets the connection ID of the connection.
       
  1736     *
       
  1737     * @return Connection ID.
       
  1738     */
       
  1739     IMPORT_C TUint ConnectionId() const;
       
  1740 
       
  1741 private:
       
  1742     TInt iEventType;
       
  1743     TUint iConnectionId;
       
  1744     };
       
  1745 
       
  1746 /**
       
  1747 * This event is triggered when a new connection has been created. The
       
  1748 * connection ID passed in the event is a new ID number that ConnMon assigned to
       
  1749 * the new connection.
       
  1750 *
       
  1751 * @lib CONNMON.LIB
       
  1752 */
       
  1753 NONSHARABLE_CLASS( CConnMonCreateConnection ) : public CConnMonEventBase
       
  1754     {
       
  1755 public:
       
  1756     /**
       
  1757     * Constructor.
       
  1758     *
       
  1759     * @param aConnectionId Connection ID.
       
  1760     */
       
  1761     CConnMonCreateConnection( const TUint aConnectionId );
       
  1762 
       
  1763     /**
       
  1764     * Destructor.
       
  1765     */
       
  1766     ~CConnMonCreateConnection();
       
  1767     };
       
  1768 
       
  1769 /**
       
  1770 * This event is triggered when a connection has been deleted. The connection ID
       
  1771 * passed in the event is the connection ID of the deleted connection.
       
  1772 *
       
  1773 * @lib CONNMON.LIB
       
  1774 */
       
  1775 NONSHARABLE_CLASS( CConnMonDeleteConnection ) : public CConnMonEventBase
       
  1776     {
       
  1777 public:
       
  1778     /**
       
  1779     * Constructor.
       
  1780     *
       
  1781     * @param aConnectionId Connection ID.
       
  1782     * @param aDownlinkData Downlink data volume.
       
  1783     * @param aUplinkData Uplink data volume.
       
  1784     * @param aAuthDelete Was connection stopped in an authoritative way.
       
  1785     */
       
  1786     CConnMonDeleteConnection(
       
  1787             const TUint aConnectionId,
       
  1788             const TUint aDownlinkData,
       
  1789             const TUint aUplinkData,
       
  1790             const TBool aAuthDelete );
       
  1791 
       
  1792     /**
       
  1793     * Destructor.
       
  1794     */
       
  1795     ~CConnMonDeleteConnection();
       
  1796 
       
  1797 public:
       
  1798     /**
       
  1799     * Gets the downlink data volume.
       
  1800     *
       
  1801     * @return Downlink data volume in bytes.
       
  1802     */
       
  1803     IMPORT_C TUint DownlinkData() const;
       
  1804 
       
  1805     /**
       
  1806     * Gets the uplink data volume.
       
  1807     *
       
  1808     * @return Uplink data volume in bytes.
       
  1809     */
       
  1810     IMPORT_C TUint UplinkData() const;
       
  1811 
       
  1812     /**
       
  1813     * Checks if the connection was stopped in an authoritative way.
       
  1814     * ETrue will be returned if the user has deactivated the connection by
       
  1815     * using Connection Monitor or if some application has issued
       
  1816     * RConnection::Stop( RConnection::EStopAuthoritative ).
       
  1817     *
       
  1818     * @return ETrue if connection has been deactivated in an authoritative
       
  1819     * way, otherwise returns EFalse.
       
  1820     */
       
  1821     IMPORT_C TBool AuthoritativeDelete() const;
       
  1822 
       
  1823 private:
       
  1824     TUint iDownlinkData;
       
  1825     TUint iUplinkData;
       
  1826     TBool iAuthDelete;
       
  1827     };
       
  1828 
       
  1829 /**
       
  1830 * This event is triggered when a new subconnection has been created.
       
  1831 * Subconnections are not supported currently.
       
  1832 *
       
  1833 * @lib CONNMON.LIB
       
  1834 */
       
  1835 NONSHARABLE_CLASS( CConnMonCreateSubConnection ) : public CConnMonEventBase
       
  1836     {
       
  1837 public:
       
  1838     /**
       
  1839     * Constructor.
       
  1840     *
       
  1841     * @param aConnectionId Connection ID.
       
  1842     * @param aSubConnectionId Subconnection ID.
       
  1843     */
       
  1844     CConnMonCreateSubConnection(
       
  1845             const TUint aConnectionId,
       
  1846             const TUint aSubConnectionId );
       
  1847 
       
  1848     /**
       
  1849     * Destructor.
       
  1850     */
       
  1851     ~CConnMonCreateSubConnection();
       
  1852 
       
  1853 public:
       
  1854     /**
       
  1855     * Gets the new subconnection ID.
       
  1856     *
       
  1857     * @return Subconnection ID.
       
  1858     */
       
  1859     IMPORT_C TUint SubConnectionId() const;
       
  1860 
       
  1861 private:
       
  1862     TUint iSubConnectionId;
       
  1863     };
       
  1864 
       
  1865 /**
       
  1866 * This event is triggered when a subconnection has been deleted.
       
  1867 * Subconnections are not supported currently.
       
  1868 *
       
  1869 * @lib CONNMON.LIB
       
  1870 */
       
  1871 NONSHARABLE_CLASS( CConnMonDeleteSubConnection ) : public CConnMonEventBase
       
  1872     {
       
  1873 public:
       
  1874     /**
       
  1875     * Constructor.
       
  1876     *
       
  1877     * @param aConnectionId Connection ID.
       
  1878     * @param aSubConnectionId Subconnection ID.
       
  1879     * @param aDownlinkData Downlink data volume.
       
  1880     * @param aUplinkData Uplink data volume.
       
  1881     * @param aAuthDelete Was connection stopped in an authoritative way.
       
  1882     */
       
  1883     CConnMonDeleteSubConnection(
       
  1884             const TUint aConnectionId,
       
  1885             const TUint aSubConnectionId,
       
  1886             const TUint aDownlinkData,
       
  1887             const TUint aUplinkData,
       
  1888             const TBool aAuthDelete );
       
  1889 
       
  1890     /**
       
  1891     * Destructor.
       
  1892     */
       
  1893     ~CConnMonDeleteSubConnection();
       
  1894 
       
  1895 public:
       
  1896     /**
       
  1897     * Gets the subconnection ID of the deleted subconnection.
       
  1898     *
       
  1899     * @return Subconnection ID.
       
  1900     */
       
  1901     IMPORT_C TUint SubConnectionId() const;
       
  1902 
       
  1903     /**
       
  1904     * Gets the downlink data volume.
       
  1905     *
       
  1906     * @return Downlink data volume in bytes.
       
  1907     */
       
  1908     IMPORT_C TUint DownlinkData() const;
       
  1909 
       
  1910     /**
       
  1911     * Gets the uplink data volume.
       
  1912     *
       
  1913     * @return Uplink data volume in bytes.
       
  1914     */
       
  1915     IMPORT_C TUint UplinkData() const;
       
  1916 
       
  1917     /**
       
  1918     * Checks if the connection was stopped in an authoritative way.
       
  1919     * ETrue will be returned if the user has deactivated the connection by
       
  1920     * using Connection Monitor or if some application has issued
       
  1921     * RConnection::Stop( RConnection::EStopAuthoritative ).
       
  1922     *
       
  1923     * @return ETrue if connection has been deactivated in an authoritative
       
  1924     * way, otherwise returns EFalse.
       
  1925     */
       
  1926     IMPORT_C TBool AuthoritativeDelete() const;
       
  1927 
       
  1928 private:
       
  1929     TUint iSubConnectionId;
       
  1930     TUint iDownlinkData;
       
  1931     TUint iUplinkData;
       
  1932     TBool iAuthDelete;
       
  1933     };
       
  1934 
       
  1935 /**
       
  1936 * This event is triggered when there is a sufficient change in the volume of
       
  1937 * downlink data for a specific connection. The event is sent each time a client
       
  1938 * specified amount (KDownlinkDataThreshold) of new data has been sent. If
       
  1939 * another ConnMon client has requested for these events for the same
       
  1940 * connection, the smallest threshold value will be used globally. If
       
  1941 * KDownlinkDataThreshold is 0 (default), events will not be sent for that
       
  1942 * connection. To prevent rapid flooding of these events, different bearers have
       
  1943 * appropriate minimum threshold values which will be used to override too small
       
  1944 * thresholds when necessary.
       
  1945 *
       
  1946 * @lib CONNMON.LIB
       
  1947 */
       
  1948 NONSHARABLE_CLASS( CConnMonDownlinkDataThreshold ) : public CConnMonEventBase
       
  1949     {
       
  1950 public:
       
  1951     /**
       
  1952     * Constructor.
       
  1953     *
       
  1954     * @param aConnectionId Connection ID.
       
  1955     * @param aSubConnectionId Subconnection ID.
       
  1956     * @param aDownlinkData Downlink data volume.
       
  1957     */
       
  1958     CConnMonDownlinkDataThreshold(
       
  1959             const TUint aConnectionId,
       
  1960             const TUint aSubConnectionId,
       
  1961             const TUint aDownlinkData );
       
  1962 
       
  1963     /**
       
  1964     * Destructor.
       
  1965     */
       
  1966     ~CConnMonDownlinkDataThreshold();
       
  1967 
       
  1968 public:
       
  1969     /**
       
  1970     * Gets the subconnection ID.
       
  1971     *
       
  1972     * @return Subconnection ID.
       
  1973     */
       
  1974     IMPORT_C TUint SubConnectionId() const;
       
  1975 
       
  1976     /**
       
  1977     * Gets the downlink data volume.
       
  1978     *
       
  1979     * @return Downlink data volume in bytes.
       
  1980     */
       
  1981     IMPORT_C TUint DownlinkData() const;
       
  1982 
       
  1983 private:
       
  1984     TUint iSubConnectionId;
       
  1985     TUint iDownlinkData;
       
  1986     };
       
  1987 
       
  1988 /**
       
  1989 * This event is triggered when there is a sufficient change in the volume of
       
  1990 * uplink data for a specific connection. The event is sent each time a client
       
  1991 * specified amount (KUplinkDataThreshold) of new data has been received. If
       
  1992 * another ConnMon client has requested for these events for the same
       
  1993 * connection, the smallest threshold value will be used globally. If
       
  1994 * KUplinkDataThreshold is 0 (default), events will not be sent for that
       
  1995 * connection. To prevent rapid flooding of these events, different bearers have
       
  1996 * appropriate minimum threshold values which will be used to override too small
       
  1997 * thresholds when necessary.
       
  1998 *
       
  1999 * @lib CONNMON.LIB
       
  2000 */
       
  2001 NONSHARABLE_CLASS( CConnMonUplinkDataThreshold ) : public CConnMonEventBase
       
  2002     {
       
  2003 public:
       
  2004     /**
       
  2005     * Constructor.
       
  2006     *
       
  2007     * @param aConnectionId Connection ID.
       
  2008     * @param aSubConnectionId Subconnection ID.
       
  2009     * @param aUplinkData Uplink data volume.
       
  2010     */
       
  2011     CConnMonUplinkDataThreshold(
       
  2012             const TUint aConnectionId,
       
  2013             const TUint aSubConnectionId,
       
  2014             const TUint aUplinkData );
       
  2015 
       
  2016     /**
       
  2017     * Destructor.
       
  2018     */
       
  2019     ~CConnMonUplinkDataThreshold();
       
  2020 
       
  2021 public:
       
  2022     /**
       
  2023     * Gets the subconnection ID.
       
  2024     *
       
  2025     * @return Subconnection ID.
       
  2026     */
       
  2027     IMPORT_C TUint SubConnectionId() const;
       
  2028 
       
  2029     /**
       
  2030     * Gets the uplink data volume.
       
  2031     *
       
  2032     * @return Uplink data volume in bytes.
       
  2033     */
       
  2034     IMPORT_C TUint UplinkData() const;
       
  2035 
       
  2036 private:
       
  2037     TUint iSubConnectionId;
       
  2038     TUint iUplinkData;
       
  2039     };
       
  2040 
       
  2041 /**
       
  2042 * This event is triggered when network status changes for some packet data
       
  2043 * connection. The connection ID passed in the event is a bearer specific
       
  2044 * connection ID (see TConnMonBearerId). The same information can be retrieved
       
  2045 * with TInt attribute KNetworkStatus.
       
  2046 *
       
  2047 * @lib CONNMON.LIB
       
  2048 */
       
  2049 NONSHARABLE_CLASS( CConnMonNetworkStatusChange ) : public CConnMonEventBase
       
  2050     {
       
  2051 public:
       
  2052     /**
       
  2053     * Constructor.
       
  2054     *
       
  2055     * @param aConnectionId Connection ID.
       
  2056     * @param aNetworkStatus Network status.
       
  2057     */
       
  2058     CConnMonNetworkStatusChange(
       
  2059             const TUint aConnectionId,
       
  2060             const TInt aNetworkStatus );
       
  2061 
       
  2062     /**
       
  2063     * Destructor.
       
  2064     */
       
  2065     ~CConnMonNetworkStatusChange();
       
  2066 
       
  2067 public:
       
  2068     /**
       
  2069     * Gets the network status.
       
  2070     *
       
  2071     * @return Network status. Values are defined in TConnMonNetworkStatus.
       
  2072     */
       
  2073     IMPORT_C TInt NetworkStatus() const;
       
  2074 
       
  2075 private:
       
  2076     TInt iNetworkStatus;
       
  2077     };
       
  2078 
       
  2079 /**
       
  2080 * This event is triggered when the status of some connection changes.
       
  2081 * The same information can be retrieved with TInt attribute KConnectionStatus.
       
  2082 * Connection status values are defined in nifvar.h.
       
  2083 *
       
  2084 * @lib CONNMON.LIB
       
  2085 */
       
  2086 NONSHARABLE_CLASS( CConnMonConnectionStatusChange ) : public CConnMonEventBase
       
  2087     {
       
  2088 public:
       
  2089     /**
       
  2090     * Constructor.
       
  2091     *
       
  2092     * @param aConnectionId Connection ID.
       
  2093     * @param aSubConnectionId Subconnection ID.
       
  2094     * @param aConnectionStatus Connection status.
       
  2095     */
       
  2096     CConnMonConnectionStatusChange(
       
  2097             const TUint aConnectionId,
       
  2098             const TUint aSubConnectionId,
       
  2099             const TInt aConnectionStatus );
       
  2100 
       
  2101     /**
       
  2102     * Destructor.
       
  2103     */
       
  2104     ~CConnMonConnectionStatusChange();
       
  2105 
       
  2106 public:
       
  2107     /**
       
  2108     * Gets the subconnection ID.
       
  2109     *
       
  2110     * @return Subconnection ID.
       
  2111     */
       
  2112     IMPORT_C TUint SubConnectionId() const;
       
  2113 
       
  2114     /**
       
  2115     * Gets the connection status.
       
  2116     *
       
  2117     * @return Connection status. Values are defined in nifvar.h.
       
  2118     */
       
  2119     IMPORT_C TInt ConnectionStatus() const;
       
  2120 
       
  2121 private:
       
  2122     TUint iSubConnectionId;
       
  2123     TInt iConnectionStatus;
       
  2124     };
       
  2125 
       
  2126 /**
       
  2127 * This event is triggered when some connection changes from active to idle or
       
  2128 * vice versa. The client must set KActivityTimeThreshold to receive these
       
  2129 * events. KActivityTimeThreshold defines the period (in seconds) for checking
       
  2130 * wether the connection is active or not. The minimum allowed value is 5
       
  2131 * seconds. The connection is considered active, if data has been passed during
       
  2132 * the last period, otherwise it is considered inactive. The same information
       
  2133 * can be retrieved with TBool attribute KConnectionActive.
       
  2134 *
       
  2135 * @lib CONNMON.LIB
       
  2136 */
       
  2137 NONSHARABLE_CLASS( CConnMonConnectionActivityChange ) : public CConnMonEventBase
       
  2138     {
       
  2139 public:
       
  2140     /**
       
  2141     * Constructor.
       
  2142     *
       
  2143     * @param aConnectionId Connection ID.
       
  2144     * @param aSubConnectionId Subconnection ID.
       
  2145     * @param aActivity Connection activity.
       
  2146     */
       
  2147     CConnMonConnectionActivityChange(
       
  2148             const TUint aConnectionId,
       
  2149             const TUint aSubConnectionId,
       
  2150             const TBool aActivity );
       
  2151 
       
  2152     /**
       
  2153     * Destructor.
       
  2154     */
       
  2155     ~CConnMonConnectionActivityChange();
       
  2156 
       
  2157 public:
       
  2158     /**
       
  2159     * Gets the subconnection ID.
       
  2160     *
       
  2161     * @return Subconnection ID.
       
  2162     */
       
  2163     IMPORT_C TUint SubConnectionId() const;
       
  2164 
       
  2165     /**
       
  2166     * Gets the connection activity.
       
  2167     *
       
  2168     * @return ETrue if the connection is active, EFalse if not.
       
  2169     */
       
  2170     IMPORT_C TBool ConnectionActivity() const;
       
  2171 
       
  2172 private:
       
  2173     TUint iSubConnectionId;
       
  2174     TBool iActivity;
       
  2175     };
       
  2176 
       
  2177 /**
       
  2178 * This event is triggered when network registration status (GSM/GPRS/WCDMA)
       
  2179 * changes. The connection ID passed in the event is a bearer specific
       
  2180 * connection ID (see TConnMonBearerId). The same information can be retrieved
       
  2181 * with TInt attribute KNetworkRegistration. Network registration values are
       
  2182 * defined in TConnMonNetworkRegistration.
       
  2183 *
       
  2184 * @lib CONNMON.LIB
       
  2185 */
       
  2186 NONSHARABLE_CLASS( CConnMonNetworkRegistrationChange ) : public CConnMonEventBase
       
  2187     {
       
  2188 public:
       
  2189     /**
       
  2190     * Constructor.
       
  2191     *
       
  2192     * @param aConnectionId Connection ID.
       
  2193     * @param aRegistrationStatus Network registration status.
       
  2194     */
       
  2195     CConnMonNetworkRegistrationChange(
       
  2196             const TUint aConnectionId,
       
  2197             const TInt aRegistrationStatus );
       
  2198 
       
  2199     /**
       
  2200     * Destructor.
       
  2201     */
       
  2202     ~CConnMonNetworkRegistrationChange();
       
  2203 
       
  2204 public:
       
  2205     /**
       
  2206     * Gets the network registration status.
       
  2207     *
       
  2208     * @return Registration status. Values are defined in
       
  2209     * TConnMonNetworkRegistration.
       
  2210     */
       
  2211     IMPORT_C TInt RegistrationStatus() const;
       
  2212 
       
  2213 private:
       
  2214     TInt iRegistrationStatus;
       
  2215     };
       
  2216 
       
  2217 /**
       
  2218 * This event is triggered when bearer type (GPRS/EdgeGPRS/WCDMA) changes. The
       
  2219 * connection ID passed in the event is a bearer specific connection ID, either
       
  2220 * EBearerIdGPRS or EBearerIdWCDMA (see TConnMonBearerId). The new bearer passed
       
  2221 * in the event can be EBearerGPRS, EBearerEdgeGPRS or EBearerWCDMA (see
       
  2222 * TConnMonBearerType). The same information can be retrieved with TInt
       
  2223 * attribute KBearer.
       
  2224 *
       
  2225 * Note: If TUint attribute KBearerGroupThreshold is set, these events are
       
  2226 * disabled and events EConnMonBearerInfoChange and EConnMonBearerGroupChange
       
  2227 * are used instead. Use these events, for example, if HSDPA related information
       
  2228 * is required.
       
  2229 *
       
  2230 * @lib CONNMON.LIB
       
  2231 */
       
  2232 NONSHARABLE_CLASS( CConnMonBearerChange ) : public CConnMonEventBase
       
  2233     {
       
  2234 public:
       
  2235     /**
       
  2236     * Constructor.
       
  2237     *
       
  2238     * @param aConnectionId Connection ID.
       
  2239     * @param aBearer Bearer.
       
  2240     */
       
  2241     CConnMonBearerChange( const TUint aConnectionId, const TInt aBearer );
       
  2242 
       
  2243     /**
       
  2244     * Destructor.
       
  2245     */
       
  2246     ~CConnMonBearerChange();
       
  2247 
       
  2248 public:
       
  2249     /**
       
  2250     * Gets the new bearer.
       
  2251     *
       
  2252     * @return New bearer. Values are defined in TConnMonBearerType.
       
  2253     */
       
  2254     IMPORT_C TInt Bearer() const;
       
  2255 
       
  2256 private:
       
  2257     TInt iBearer;
       
  2258     };
       
  2259 
       
  2260 /**
       
  2261 * This event is triggered when signal strength changes. The connection ID
       
  2262 * passed in the event is a bearer specific connection ID (see
       
  2263 * TConnMonBearerId). This event is valid only for cellular (GPRS, WCDMA, etc.)
       
  2264 * bearers and not for other bearers, e.g. WLAN. The client must set
       
  2265 * KSignalStrengthThreshold to 1 to receive these events.
       
  2266 *
       
  2267 * @lib CONNMON.LIB
       
  2268 */
       
  2269 NONSHARABLE_CLASS( CConnMonSignalStrengthChange ) : public CConnMonEventBase
       
  2270     {
       
  2271 public:
       
  2272     /**
       
  2273     * Constructor.
       
  2274     *
       
  2275     * @param aConnectionId Connection ID.
       
  2276     * @param aSignalStrength Signal strength in dBm.
       
  2277     */
       
  2278     CConnMonSignalStrengthChange(
       
  2279             const TUint aConnectionId,
       
  2280             const TInt aSignalStrength );
       
  2281 
       
  2282     /**
       
  2283     * Destructor.
       
  2284     */
       
  2285     ~CConnMonSignalStrengthChange();
       
  2286 
       
  2287 public:
       
  2288     /**
       
  2289     * Gets the signal strength.
       
  2290     *
       
  2291     * @return Signal strength in dBm.
       
  2292     */
       
  2293     IMPORT_C TInt SignalStrength() const;
       
  2294 
       
  2295 private:
       
  2296     TInt iSignalStrength;
       
  2297     };
       
  2298 
       
  2299 /**
       
  2300 * This event is triggered when the availability of some bearer changes. The
       
  2301 * connection ID passed in the event is a bearer specific connection ID (see
       
  2302 * TConnMonBearerId). The client must set KBearerAvailabilityThreshold to 1 to
       
  2303 * receive these events. Using this event for detecting changes in WLAN
       
  2304 * availability requires WLAN background scanning to be enabled.
       
  2305 *
       
  2306 * @lib CONNMON.LIB
       
  2307 */
       
  2308 NONSHARABLE_CLASS( CConnMonBearerAvailabilityChange ) : public CConnMonEventBase
       
  2309     {
       
  2310 public:
       
  2311     /**
       
  2312     * Constructor.
       
  2313     *
       
  2314     * @param aConnectionId Connection ID.
       
  2315     * @param aAvailability Availability of the bearer.
       
  2316     */
       
  2317     CConnMonBearerAvailabilityChange(
       
  2318             const TUint aConnectionId,
       
  2319             const TBool aAvailability );
       
  2320 
       
  2321     /**
       
  2322     * Destructor.
       
  2323     */
       
  2324     ~CConnMonBearerAvailabilityChange();
       
  2325 
       
  2326 public:
       
  2327     /**
       
  2328     * Gets the availability of the bearer.
       
  2329     *
       
  2330     * @return ETrue if the bearer is available, EFalse if not.
       
  2331     */
       
  2332     IMPORT_C TBool Availability() const;
       
  2333 
       
  2334 private:
       
  2335     TBool iAvailability;
       
  2336     };
       
  2337 
       
  2338 /**
       
  2339 * This event is triggered when a plug-in sends a bearer specific event that is
       
  2340 * unknown to ConnMon.
       
  2341 *
       
  2342 * @lib CONNMON.LIB
       
  2343 */
       
  2344 NONSHARABLE_CLASS( CConnMonGenericEvent ) : public CConnMonEventBase
       
  2345     {
       
  2346 public:
       
  2347     /**
       
  2348     * Constructor.
       
  2349     *
       
  2350     * @param aType Event type.
       
  2351     * @param aConnectionId Connection ID.
       
  2352     * @param aData Pointer to the event data.
       
  2353     */
       
  2354     CConnMonGenericEvent(
       
  2355             const TUint aType,
       
  2356             const TUint aConnectionId,
       
  2357             TAny* aData );
       
  2358 
       
  2359     /**
       
  2360     * Destructor.
       
  2361     */
       
  2362     ~CConnMonGenericEvent();
       
  2363 
       
  2364 public:
       
  2365     /**
       
  2366     * Gets a pointer to the event data.
       
  2367     * The pointer is valid only inside EventL().
       
  2368     *
       
  2369     * @return Pointer to the event data.
       
  2370     */
       
  2371     IMPORT_C TAny* Data() const;
       
  2372 
       
  2373 private:
       
  2374     TAny* iData;
       
  2375     };
       
  2376 
       
  2377 /**
       
  2378 * This event is triggered when IAP availability changes. The connection ID
       
  2379 * passed in the event is the generic connection ID EBearerIdAll. The ID numbers
       
  2380 * of available IAPs are included in the event (see TConnMonIapInfo). The same
       
  2381 * information can be retrieved with packaged attribute KIapAvailability.
       
  2382 *
       
  2383 * @lib CONNMON.LIB
       
  2384 */
       
  2385 NONSHARABLE_CLASS( CConnMonIapAvailabilityChange ) : public CConnMonEventBase
       
  2386     {
       
  2387 public:
       
  2388     /**
       
  2389     * Constructor.
       
  2390     *
       
  2391     * @param aConnectionId Connection ID.
       
  2392     * @param aIapInfoPtr Pointer to the IAP availability information.
       
  2393     */
       
  2394     CConnMonIapAvailabilityChange(
       
  2395             const TUint aConnectionId,
       
  2396             const TConnMonIapInfo* aIapInfoPtr );
       
  2397 
       
  2398     /**
       
  2399     * Destructor.
       
  2400     */
       
  2401     ~CConnMonIapAvailabilityChange();
       
  2402 
       
  2403 public:
       
  2404     /**
       
  2405     * Gets the IAP availability information.
       
  2406     *
       
  2407     * @return IAP availability information.
       
  2408     */
       
  2409     IMPORT_C TConnMonIapInfo IapAvailability() const;
       
  2410 
       
  2411 private:
       
  2412     TConnMonIapInfo iIapInfo;
       
  2413     };
       
  2414 
       
  2415 /**
       
  2416 * This event is triggered when the used WLAN transmit power changes. The
       
  2417 * connection ID passed in the event is the bearer specific connection ID
       
  2418 * EBearerIdWLAN. Transmit power is given in milliwatts (mW). The same
       
  2419 * information can be retrieved with TUint attribute KTransmitPower.
       
  2420 *
       
  2421 * @lib CONNMON.LIB
       
  2422 */
       
  2423 NONSHARABLE_CLASS( CConnMonTransmitPowerChange ) : public CConnMonEventBase
       
  2424     {
       
  2425 public:
       
  2426     /**
       
  2427     * Constructor.
       
  2428     *
       
  2429     * @param aConnectionId Connection ID.
       
  2430     * @param aTransmitPower Transmit power in mW.
       
  2431     */
       
  2432     CConnMonTransmitPowerChange(
       
  2433             const TUint aConnectionId,
       
  2434             const TUint aTransmitPower );
       
  2435 
       
  2436     /**
       
  2437     * Destructor.
       
  2438     */
       
  2439     ~CConnMonTransmitPowerChange();
       
  2440 
       
  2441 public:
       
  2442     /**
       
  2443     * Gets the transmit power.
       
  2444     *
       
  2445     * @return Transmit power in mW.
       
  2446     */
       
  2447     IMPORT_C TUint TransmitPower() const;
       
  2448 
       
  2449 private:
       
  2450     TUint iTransmitPower;
       
  2451     };
       
  2452 
       
  2453 /**
       
  2454 * This event is triggered when SNAP availability changes. The connection ID
       
  2455 * passed in the event is the generic connection ID EBearerIdAll. The ID numbers
       
  2456 * of available SNAPs are included in the event (see TConnMonSNAPInfo). The same
       
  2457 * information can be retrieved with packaged attributes KSNAPsAvailability and
       
  2458 * KAvailableSNAPsIds.
       
  2459 *
       
  2460 * @lib CONNMON.LIB
       
  2461 */
       
  2462 NONSHARABLE_CLASS( CConnMonSNAPsAvailabilityChange ) : public CConnMonEventBase
       
  2463     {
       
  2464 public:
       
  2465     /**
       
  2466     * Constructor.
       
  2467     *
       
  2468     * @param aConnectionId Connection ID.
       
  2469     * @param aSNAPsAvailable Number of available SNAPs.
       
  2470     * @param aSNAPInfoPtr Pointer to the SNAP availability information.
       
  2471     */
       
  2472     CConnMonSNAPsAvailabilityChange(
       
  2473             const TUint aConnectionId,
       
  2474             const TUint aSNAPsAvailable,
       
  2475             const TConnMonSNAPInfo* aSNAPInfoPtr );
       
  2476 
       
  2477     /**
       
  2478     * Destructor.
       
  2479     */
       
  2480     ~CConnMonSNAPsAvailabilityChange();
       
  2481 
       
  2482 public:
       
  2483     /**
       
  2484     * Gets the SNAP availability information.
       
  2485     *
       
  2486     * @return SNAP availability information.
       
  2487     */
       
  2488     IMPORT_C TConnMonSNAPInfo SNAPAvailability() const;
       
  2489 
       
  2490     /**
       
  2491     * Gets the number of available SNAPs.
       
  2492     *
       
  2493     * @return Number of available SNAPs.
       
  2494     */
       
  2495     IMPORT_C TUint SNAPsAvailabile() const;
       
  2496 
       
  2497 private:
       
  2498     TConnMonSNAPInfo iSNAPInfo;
       
  2499     TUint iSNAPsAvailable;
       
  2500     };
       
  2501 
       
  2502 /**
       
  2503 * This event is triggered when new WLAN networks are detected during a WLAN
       
  2504 * scan. The connection ID passed in the event is the bearer specific connection
       
  2505 * ID EBearerIdWLAN. To receive these events, WLAN background scanning must be
       
  2506 * enabled, or some other mechanism must be used to trigger the necessary WLAN
       
  2507 * scans.
       
  2508 *
       
  2509 * @lib CONNMON.LIB
       
  2510 */
       
  2511 NONSHARABLE_CLASS( CConnMonNewWLANNetworkDetected ) : public CConnMonEventBase
       
  2512     {
       
  2513 public:
       
  2514     /**
       
  2515     * Constructor.
       
  2516     *
       
  2517     * @param aConnectionId Connection ID.
       
  2518     */
       
  2519     CConnMonNewWLANNetworkDetected( const TUint aConnectionId );
       
  2520 
       
  2521     /**
       
  2522     * Destructor.
       
  2523     */
       
  2524     ~CConnMonNewWLANNetworkDetected();
       
  2525     };
       
  2526 
       
  2527 /**
       
  2528 * This event is triggered when one or more WLAN networks have been lost since
       
  2529 * the last WLAN scan. The connection ID passed in the event is the bearer
       
  2530 * specific connection ID EBearerIdWLAN. To receive these events, WLAN
       
  2531 * background scanning must be enabled, or some other mechanism must be used to
       
  2532 * trigger the necessary WLAN scans.
       
  2533 *
       
  2534 * @lib CONNMON.LIB
       
  2535 */
       
  2536 NONSHARABLE_CLASS( CConnMonOldWLANNetworkLost ) : public CConnMonEventBase
       
  2537     {
       
  2538 public:
       
  2539     /**
       
  2540     * Constructor.
       
  2541     *
       
  2542     * @param aConnectionId Connection ID.
       
  2543     */
       
  2544     CConnMonOldWLANNetworkLost( const TUint aConnectionId );
       
  2545 
       
  2546     /**
       
  2547     * Destructor.
       
  2548     */
       
  2549     ~CConnMonOldWLANNetworkLost();
       
  2550     };
       
  2551 
       
  2552 /**
       
  2553 * This event is triggered when GPRS or WCDMA bearer availability changes, a
       
  2554 * phone call is started, or a phone call ends. The connection ID passed in the
       
  2555 * event is a bearer specific connection ID, either EBearerIdGPRS or
       
  2556 * EBearerIdWCDMA (see TConnMonBearerId).
       
  2557 *
       
  2558 * EConnMonPacketDataUnavailable and EConnMonPacketDataAvailable events form a
       
  2559 * pair. Two events are always sent, one with connection ID EBearerIdGPRS for 2G
       
  2560 * network, and one with connection ID EBearerIdWCDMA for 3G network. The event
       
  2561 * for the network that the phone is not registered to is always of type
       
  2562 * EConnMonPacketDataUnavailable. If the phone does not support dual transfer
       
  2563 * mode and a call is started, a GPRS or WCDMA packet data connection will be
       
  2564 * put on hold. In this scenario, both will be of type
       
  2565 * EConnMonPacketDataUnavailable. The same information can be retrieved with
       
  2566 * TBool attribute KPacketDataAvailability.
       
  2567 *
       
  2568 * @lib CONNMON.LIB
       
  2569 */
       
  2570 NONSHARABLE_CLASS( CConnMonPacketDataUnavailable ) : public CConnMonEventBase
       
  2571     {
       
  2572 public:
       
  2573     /**
       
  2574     * Constructor.
       
  2575     *
       
  2576     * @param aConnectionId Bearer specific connection ID, EBearerIdGPRS or
       
  2577     * EBearerIdWCDMA.
       
  2578     */
       
  2579     CConnMonPacketDataUnavailable( const TUint aConnectionId );
       
  2580 
       
  2581     /**
       
  2582     * Destructor.
       
  2583     */
       
  2584     virtual ~CConnMonPacketDataUnavailable();
       
  2585     };
       
  2586 
       
  2587 /**
       
  2588 * This event is triggered when GPRS or WCDMA bearer availability changes, a
       
  2589 * phone call is started, or a phone call ends. The connection ID passed in the
       
  2590 * event is a bearer specific connection ID, either EBearerIdGPRS or
       
  2591 * EBearerIdWCDMA (see TConnMonBearerId).
       
  2592 *
       
  2593 * EConnMonPacketDataAvailable and EConnMonPacketDataUnavailable events form a
       
  2594 * pair. Two events are always sent, one with connection ID EBearerIdGPRS for 2G
       
  2595 * network, and one with connection ID EBearerIdWCDMA for 3G network. The event
       
  2596 * for the network that the phone is not registered to is always of type
       
  2597 * EConnMonPacketDataUnavailable. If the phone does not support dual transfer
       
  2598 * mode and a call is started, a GPRS or WCDMA packet data connection will be
       
  2599 * put on hold. In this scenario, both will be of type
       
  2600 * EConnMonPacketDataUnavailable. The same information can be retrieved with
       
  2601 * TBool attribute KPacketDataAvailability.
       
  2602 *
       
  2603 * @lib CONNMON.LIB
       
  2604 */
       
  2605 NONSHARABLE_CLASS( CConnMonPacketDataAvailable ) : public CConnMonEventBase
       
  2606     {
       
  2607 public:
       
  2608     /**
       
  2609     * Constructor.
       
  2610     *
       
  2611     * @param aConnectionId Bearer specific connection ID, EBearerIdGPRS or
       
  2612     * EBearerIdWCDMA.
       
  2613     */
       
  2614     CConnMonPacketDataAvailable( const TUint aConnectionId );
       
  2615 
       
  2616     /**
       
  2617     * Destructor.
       
  2618     */
       
  2619     virtual ~CConnMonPacketDataAvailable();
       
  2620     };
       
  2621 
       
  2622 /**
       
  2623 * This event is triggered when there is a change in bearer information for an
       
  2624 * existing connection, or if the network mode changes e.g. from 2G to 3G. For
       
  2625 * connection specific events, the connection ID passed in the event is the
       
  2626 * respective connection specific ID, and for network level events, the
       
  2627 * connection ID is EBearerIdAll. The same connection level information can be
       
  2628 * retrieved with TInt attribute KBearerInfo. The bearer info values are defined
       
  2629 * in TConnMonBearerInfo.
       
  2630 *
       
  2631 * Note: The client needs to set the TUint attribute KBearerGroupThreshold in
       
  2632 * order to receive these events. This also disables EConnMonBearerChange events.
       
  2633 *
       
  2634 * @lib CONNMON.LIB
       
  2635 */
       
  2636 NONSHARABLE_CLASS( CConnMonBearerInfoChange ) : public CConnMonEventBase
       
  2637     {
       
  2638 public:
       
  2639     /**
       
  2640     * Constructor.
       
  2641     *
       
  2642     * @param aConnectionId Connection ID.
       
  2643     * @param aBearerInfo Bearer information.
       
  2644     */
       
  2645     CConnMonBearerInfoChange(
       
  2646             const TUint aConnectionId,
       
  2647             const TInt aBearerInfo );
       
  2648 
       
  2649     /**
       
  2650     * Destructor.
       
  2651     */
       
  2652     ~CConnMonBearerInfoChange();
       
  2653 
       
  2654 public:
       
  2655     /**
       
  2656     * Gets the new bearer information. Values are defined in TConnMonBearerInfo.
       
  2657     *
       
  2658     * @return New bearer information.
       
  2659     */
       
  2660     IMPORT_C TInt BearerInfo() const;
       
  2661 
       
  2662 private:
       
  2663     TInt iBearerInfo;
       
  2664     };
       
  2665 
       
  2666 /**
       
  2667 * This event is triggered when there is a change in bearer group information
       
  2668 * for an existing connection. The connection ID passed in the event is the
       
  2669 * respective connection specific ID. The same information can be retrieved with
       
  2670 * packaged attribute KBearerGroupInfo. The bearer group bitmask is defined in
       
  2671 * TConnMonBearerGroup.
       
  2672 *
       
  2673 * Note: The client needs to set the TUint attribute KBearerGroupThreshold in
       
  2674 * order to receive these events. This also disables EConnMonBearerChange events.
       
  2675 *
       
  2676 * @lib CONNMON.LIB
       
  2677 */
       
  2678 NONSHARABLE_CLASS( CConnMonBearerGroupChange ) : public CConnMonEventBase
       
  2679     {
       
  2680 public:
       
  2681     /**
       
  2682     * Constructor.
       
  2683     *
       
  2684     * @param aConnectionId Connection ID.
       
  2685     * @param aBearerGroups1 First bearer group bitmask.
       
  2686     * @param aBearerGroups2 Second bearer group bitmask.
       
  2687     * @param aInternal ETrue if connection is internal, EFalse if external.
       
  2688     */
       
  2689     CConnMonBearerGroupChange(
       
  2690             const TUint aConnectionId,
       
  2691             const TUint aBearerGroups1,
       
  2692             const TUint aBearerGroups2,
       
  2693             const TBool aInternal );
       
  2694 
       
  2695     /**
       
  2696     * Destructor.
       
  2697     */
       
  2698     ~CConnMonBearerGroupChange();
       
  2699 
       
  2700 public:
       
  2701     /**
       
  2702     * Gets the new bearer groups. Values are defined in TConnMonBearerGroup.
       
  2703     *
       
  2704     * @param aBearerGroups1 Will contain the first bearer group bitmask.
       
  2705     * @param aBearerGroups2 Will contain the second bearer group bitmask.
       
  2706     */
       
  2707     IMPORT_C void BearerGroups(
       
  2708             TUint& aBearerGroups1,
       
  2709             TUint& aBearerGroups2 ) const;
       
  2710 
       
  2711     /**
       
  2712     * Gets the information whether the current connection bearer is internal
       
  2713     * or external.
       
  2714     *
       
  2715     * @return ETrue if the bearer is internal and EFalse if external.
       
  2716     */
       
  2717     IMPORT_C TBool Internal() const;
       
  2718 
       
  2719 private:
       
  2720     TBool iInternal;      // ETrue for internal, EFalse for external connection.
       
  2721     TUint iBearerGroups1; // Contains the groups as bitmask.
       
  2722     TUint iBearerGroups2; // Reserved for the future use.
       
  2723     };
       
  2724 
       
  2725 #endif // __CONNECTIONMONITOR_H
       
  2726 
       
  2727 // End of file