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