2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
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.
20 #ifndef __CONNECTIONMONITOR_H
21 #define __CONNECTIONMONITOR_H
26 // ===========================================================================
27 // TInt attribute constants, used by GetIntAttribute, SetIntAttribute.
28 // ===========================================================================
30 /** Bearer, defined in TConnMonBearerType.
32 const TUint KBearer = 1;
33 /** Network status, defined in TConnMonNetworkStatus.
35 const TUint KNetworkStatus = 2;
36 /** Connection status, progress constants are from nifvar.h.
38 const TUint KConnectionStatus = 3;
39 /** Protocol, defined in TConnMonProtocolType.
41 const TUint KProtocolType = 4;
42 /** Network registration values defined in TConnMonNetworkRegistration.
44 const TUint KNetworkRegistration = 5;
45 /** Signal strength in dBm.
47 const TUint KSignalStrength = 6;
48 /** WLAN mode, defined in TConnMonNetworkMode.
50 const TUint KNetworkMode = 7;
51 /** WLAN connection security mode, defined in TConnMonSecurityMode.
53 const TUint KSecurityMode = 8;
54 /** Bearer information, defined in TConnMonBearerInfo.
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.
60 const TUint KWlanScanCacheLifetime = 10;
62 /** Network registration values defined in TConnMonNetworkRegistration_v2.
64 const TUint KNetworkRegistration_v2 = 11;
66 /** QoS - Not supported.
68 const TUint KTrafficClass = 30;
69 /** QoS - Not supported.
71 const TUint KDeliveryOrder = 31;
72 /** QoS - Not supported.
74 const TUint KErroneousSDUDelivery = 32;
75 /** QoS - Not supported.
77 const TUint KResidualBitErrorRatio = 33;
78 /** QoS - Not supported.
80 const TUint KSDUErrorRatio = 34;
83 // ===========================================================================
84 // TUint attribute constants, used by GetUintAttribute, SetUintAttribute.
85 // ===========================================================================
87 /** Downlink data in bytes.
89 const TUint KDownlinkData = 100;
90 /** Uplink data in bytes.
92 const TUint KUplinkData = 101;
95 const TUint KIAPId = 102;
98 const TUint KNetworkIdentifier = 103;
99 /** WLAN transmit power in mW.
101 const TUint KTransmitPower = 104;
102 /** Current network mode, defined in TConnMonMobilePhoneNetworkMode.
104 const TUint KMobilePhoneNetworkMode = 105;
105 /** QoS - Not supported.
107 const TUint KMaximumBitrateDownlink = 130;
108 /** QoS - Not supported.
110 const TUint KMaximumBitrateUplink = 131;
111 /** QoS - Not supported.
113 const TUint KMaximumSDUSize = 132;
114 /** QoS - Not supported.
116 const TUint KTransferDelay = 133;
117 /** QoS - Not supported.
119 const TUint KGuaranteedBitrateDownlink = 134;
120 /** QoS - Not supported.
122 const TUint KGuaranteedBitrateUplink = 135;
123 /** QoS - Not supported.
125 const TUint KTrafficHandlingPriority = 136;
126 /** Enables EConnMonConnectionActivityChange events.
127 0 means off, minimum allowed is 5 seconds.
129 const TUint KActivityTimeThreshold = 150;
130 /** Enables EConnMonDownlinkDataThreshold events.
131 0 means off, minimum allowed is 4096 bytes.
133 const TUint KDownlinkDataThreshold = 151;
134 /** Enables EConnMonUplinkDataThreshold events.
135 0 means off, minimum allowed is 4096 bytes.
137 const TUint KUplinkDataThreshold = 152;
138 /** Enables EConnMonBearerAvailabilityChange events.
140 const TUint KBearerAvailabilityThreshold = 153;
141 /** Enables EConnMonSignalStrengthChange events.
143 const TUint KSignalStrengthThreshold = 154;
144 /** If set, disables EConnMonBearerChange events and enables
145 EConnMonBearerInfoChange and EConnMonBearerGroupChange events instead.
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.
151 const TUint KWlanScanMaxDelay = 160;
154 // ===========================================================================
155 // TBool attribute constants, used by GetBoolAttribute, SetBoolAttribute.
156 // ===========================================================================
158 /** Connection activity.
160 const TUint KConnectionActive = 200;
161 /** Bearer availability.
163 const TUint KBearerAvailability = 201;
164 /** Packet data availability. Can be blocked if phone call is active and no
165 dual transfer mode support.
167 const TUint KPacketDataAvailability = 202;
168 /** Stop a connection.
170 const TUint KConnectionStop = 250;
171 /** Stop all connections.
173 const TUint KConnectionStopAll = 251;
176 // ===========================================================================
177 // TDes attribute constants, used by GetStringAttribute, SetStringAttribute.
178 // ===========================================================================
180 /** Name of used IAP.
182 const TUint KIAPName = 300;
183 /** Name of used access point.
185 const TUint KAccessPointName = 301;
186 /** Used telephone number.
188 const TUint KTelNumber = 302;
189 /** Name (SSID) of used WLAN.
191 const TUint KNetworkName = 303;
192 /** WLAN name (SSID) to be used in SSID scan (KWlanSsidNetworks).
194 const TUint KWlanSsid = 304;
197 // ===========================================================================
198 // TPckgBuf attribute constants, used by GetPckgAttribute.
199 // ===========================================================================
201 /** Connection start time. See TConnMonTimeBuf.
203 const TUint KStartTime = 400;
204 /** All clients using a connection. See TConnMonClientEnumBuf.
206 const TUint KClientInfo = 401;
207 /** Basic WLAN scan information. See TConnMonNetworkNamesBuf.
209 const TUint KNetworkNames = 402;
210 /** Available IAP IDs. See TConnMonIapInfoBuf.
212 const TUint KIapAvailability = 403;
213 /** Deprecated. Old WLAN scan results, use KWlanNetworks instead.
215 const TUint KWLANNetworks = 404;
216 /** Available SNAP IDs. See TConnMonSNAPInfoBuf.
218 const TUint KSNAPsAvailability = 405;
219 /** Available SNAP IDs, in a more flexible way. See ConnMonIdsArrayPckg.
221 const TUint KAvailableSNAPsIds = 406;
222 /** WLAN scan results. See CConnMonWlanNetworksPtrArrayPckg.
224 const TUint KWlanNetworks = 407;
225 /** Bearer group information. See TConnMonBearerGroupInfoBuf.
227 const TUint KBearerGroupInfo = 408;
228 /** WLAN SSID scan results. Scans for WLANs with a specific SSID.
229 See CConnMonWlanNetworksPtrArrayPckg.
231 const TUint KWlanSsidNetworks = 409;
232 /** Information about the currently used WLAN.
233 See CConnMonWlanNetworksPtrArrayPckg.
235 const TUint KWlanCurrentNetwork = 410;
236 /** Beacon frames from a WLAN scan. See CConnMonWlanProbeRawBuffersPckg.
238 const TUint KWlanProbeRawBuffers = 411;
241 /** Base value for plug-in specific attribute IDs.
243 const TUint KConnMonPluginAttributeBase = 3000000;
249 enum TConnMonBearerType
252 EBearerCSD = 1, ///< CSD (GSM)
253 EBearerWCDMA = 2, ///< PSD (WCDMA)
257 EBearerHSCSD = 6, ///< HSCSD (GSM)
260 EBearerBluetooth = 9,
262 EBearerVirtualVPN = 11,
263 EBearerWcdmaCSD = 12, ///< CSD (WCDMA)
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)
278 * Bearer specific general connection ID.
280 enum TConnMonBearerId
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
297 enum TConnMonNetworkStatus
299 EConnMonStatusNotAvailable = 0,
300 EConnMonStatusUnattached,
301 EConnMonStatusAttached,
302 EConnMonStatusActive,
303 EConnMonStatusSuspended
307 * Protocol type (type of PDP). It may not be available for some
308 * bearers (returns EProtocolTypeUnknown).
310 enum TConnMonProtocolType
312 EProtocolTypeUnknown = 0,
318 EProtocolTypeIP ///< Connection uses both IPv4 and IPv6
322 * Asyncronous request codes.
324 enum TConnMonAsyncRequest
326 EConnMonGetConnectionCount = 1,
327 EConnMonGetIntAttribute,
328 EConnMonGetUintAttribute,
329 EConnMonGetBoolAttribute,
330 EConnMonGetStringAttribute,
331 EConnMonGetPckgAttribute
335 * Events sent by Connection Monitor. See SDK documentation for more details.
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,
362 EConnMonPluginEventBase = 4000000
366 * Network registration status. Valid for CSD, GPRS and WCDMA.
368 enum TConnMonNetworkRegistration
370 ENetworkRegistrationNotAvailable = 0,
371 ENetworkRegistrationUnknown,
372 ENetworkRegistrationNoService,
373 ENetworkRegistrationEmergencyOnly,
374 ENetworkRegistrationSearching,
375 ENetworkRegistrationBusy,
376 ENetworkRegistrationHomeNetwork,
377 ENetworkRegistrationDenied,
378 ENetworkRegistrationRoaming
382 * Network registration status. Valid for CSD, GPRS and WCDMA.
383 * New values will be added to the end of the enumeration.
385 enum TConnMonNetworkRegistration_v2
387 ENetworkRegistrationExtNotAvailable = 0,
388 ENetworkRegistrationExtUnknown,
389 ENetworkRegistrationExtNoService,
390 ENetworkRegistrationExtEmergencyOnly,
391 ENetworkRegistrationExtSearching,
392 ENetworkRegistrationExtBusy,
393 ENetworkRegistrationExtHomeNetwork,
394 ENetworkRegistrationExtDenied,
395 ENetworkRegistrationExtRoamingNational,
396 ENetworkRegistrationExtRoamingInternational
400 * QoS. Traffic class.
402 enum TQosTrafficClass
404 EQosTrafficClassConversational = 1,
405 EQosTrafficClassStreaming,
406 EQosTrafficClassInteractive,
407 EQosTrafficClassBackground
411 * QoS. Delivery order.
413 enum TQosDeliveryOrder
415 EQosDeliveryOrderYes = 1,
420 * QoS. Delivery of erroneous SDUs.
422 enum TQosErroneousSDUDelivery
424 EQosErroneousSDUDeliveryYes = 1,
425 EQosErroneousSDUDeliveryNo,
426 EQosErroneousSDUDeliveryUnspecified
430 * QoS. Residual bit error ratio.
432 enum TQosBitErrorRatio
434 EQosBERFivePerHundred = 1,
435 EQosBEROnePerHundred,
436 EQosBERFivePerThousand,
437 EQosBEROnePerThousand,
438 EQosBEROnePerTenThousand,
443 * QoS. SDU error ratio.
445 enum TQosSDUErrorRatio
447 EQosSDUErrorRatioOnePerHundred = 1,
448 EQosSDUErrorRatioSevenPerThousand,
449 EQosSDUErrorRatioOnePerThousand,
450 EQosSDUErrorRatioOnePerTenThousand,
451 EQosSDUErrorRatioOnePerHundredThousand
455 * Client-server requests.
457 enum TConnMonRequests
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,
476 EReqPluginCreateSubSession = 500,
477 EReqPluginCloseSubSession = 501,
478 EReqPluginRegisterAttribute = 502,
479 EReqPluginCancelRegisterAttribute = 503,
480 EReqPluginEvent = 504,
481 EReqPluginGetQuery = 505,
482 EReqPluginCancelGetQuery = 506,
483 EReqPluginAttribute = 507,
485 EReqInternalSetThreshold = 600,
486 EReqInternalResetThreshold = 601
490 * WLAN connection modes.
492 enum TConnMonNetworkMode
494 EConnMonInfraStructure = 0,
496 EConnMonSecureInfra = 2
500 * WLAN connection security modes.
502 enum TConnMonSecurityMode
504 EConnMonSecurityOpen = 0,
505 EConnMonSecurityWep = 1,
506 EConnMonSecurity802d1x = 2,
507 EConnMonSecurityWpa = 3,
508 EConnMonSecurityWpaPsk = 4
514 enum TConnMonMobilePhoneNetworkMode
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)
526 /** Maximum size of a plug-in's event data.
528 const TUint KConnMonMaxPluginDataSize = 512;
529 /** Maximum size of a plug-in's attribute.
531 const TUint KConnMonMaxStringAttributeLength = 64;
534 * Package class definition for getting the TTime.
536 typedef TPckgBuf<TTime> TConnMonTimeBuf;
538 /** Maximum number of clients contained in TConnMonClientEnum class.
540 const TUint KConnMonMaxClientUids = 10;
543 * Class to contain client UIDs of a connection.
545 class TConnMonClientEnum
551 inline TConnMonClientEnum():iCount( 0 )
556 * Number of UIDs in iUid array.
560 * Array for client UIDs.
562 TUid iUid[KConnMonMaxClientUids];
566 * Package class definition for getting the client information.
568 typedef TPckgBuf<TConnMonClientEnum> TConnMonClientEnumBuf;
570 /** Maximum number of WLANs contained in TConnMonNetworkNames class.
572 const TUint KConnMonMaxNetworkCount = 10;
575 * Class to contain basic WLAN information.
577 class TConnMonNetwork
583 inline TConnMonNetwork():iType( 0 ), iSignalStrength( 0 )
592 * WLAN mode, defined in TConnMonNetworkMode.
596 * Signal strength in dBm. Given as absolute, correct value is negative.
598 TUint8 iSignalStrength;
602 * Class to contain an array of basic WLAN information.
604 class TConnMonNetworkNames
610 inline TConnMonNetworkNames():iCount( 0 )
614 * This method returns the number of WLANs contained in this class.
616 * @return Number of WLANs.
624 * Number of items in WLAN array.
630 TConnMonNetwork iNetwork[KConnMonMaxNetworkCount];
634 * Package class definition for getting basic WLAN scan information.
636 typedef TPckgBuf<TConnMonNetworkNames> TConnMonNetworkNamesBuf;
638 /** Maximum number of IAPs contained in TConnMonIapInfo class.
640 const TUint KConnMonMaxIAPCount = 25;
643 * Class representing an IAP.
651 inline TConnMonIap():iIapId( 0 )
662 * Class to contain an array of IAPs.
664 class TConnMonIapInfo
670 inline TConnMonIapInfo():iCount( 0 )
674 * This method returns the number of IAPs contained in this class.
676 * @return Number of IAPs.
684 * Number of items in IAP array.
690 TConnMonIap iIap[KConnMonMaxIAPCount];
693 /** Package class definiton for getting available IAPs.
695 typedef TPckgBuf<TConnMonIapInfo> TConnMonIapInfoBuf;
697 /** Maximum number of SNAPs contained in TConnMonSNAPInfo class.
699 const TUint KConnMonMaxSNAPsCount = 25;
702 * Class representing a SNAP.
710 inline TConnMonSNAPId():iSNAPId( 0 )
721 * Class to contain an array of SNAPs.
723 class TConnMonSNAPInfo
729 inline TConnMonSNAPInfo():iCount( 0 )
733 * This method returns the number of SNAPs contained in this class.
735 * @return Number of SNAPs.
743 * Number of items in SNAP array.
749 TConnMonSNAPId iSNAP[KConnMonMaxSNAPsCount];
752 /** Package class definiton for getting available SNAPs.
754 typedef TPckgBuf<TConnMonSNAPInfo> TConnMonSNAPInfoBuf;
757 * Bearer group definition, new values will be added to the end of the
760 enum TConnMonBearerGroup
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
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.
784 enum TConnMonBearerInfo
786 EBearerInfoUnknown = 0,
795 EBearerInfoBluetooth,
797 EBearerInfoVirtualVPN,
805 * Class to contain bearer group information.
807 class TConnMonBearerGroupInfo
813 inline TConnMonBearerGroupInfo():
821 * Connection is internal or external.
825 * Bearer group bitmask.
829 * Reserved for future use.
831 TUint iBearerGroups2;
834 /** Package class definiton for getting bearer group information.
836 typedef TPckgBuf<TConnMonBearerGroupInfo> TConnMonBearerGroupInfoBuf;
839 * Class to represent a WLAN. Used when reporting WLAN scan results back to a
842 NONSHARABLE_CLASS( CConnMonWlanNetwork ) : public CBase
845 /** Maximum length of a WLAN name (SSID).
847 static const TUint KMaxNameLength = 32;
848 /** WLAN BSSID length (mac address).
850 static const TUint KWlanBssId = 6;
851 /** Reserved for future use.
853 static const TUint KExtraCount = 10;
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.
866 IMPORT_C static CConnMonWlanNetwork* NewL(
867 const TBuf<KMaxNameLength>& aName,
868 TUint aConnectionMode,
869 TUint aSignalStrength,
871 const TBuf8<KWlanBssId>& aBssId,
872 const TDesC& aVendorData );
877 * @return Pointer to the created empty CConnMonWlanNetwork object.
879 IMPORT_C static CConnMonWlanNetwork* NewL();
884 * @param aConnMonWlanNetwork The object which is copied.
885 * @return Pointer to the created CConnMonWlanNetwork object.
887 IMPORT_C static CConnMonWlanNetwork* NewL(
888 CConnMonWlanNetwork& aConnMonWlanNetwork );
893 IMPORT_C ~CConnMonWlanNetwork();
896 * Assignment operator.
898 * @param aConnMonWlanNetwork The object which is assigned.
900 IMPORT_C CConnMonWlanNetwork& operator=(
901 CConnMonWlanNetwork& aConnMonWlanNetwork );
904 * Compares two networks by signal strength.
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.
911 IMPORT_C static TInt CompareBySignal(
912 const CConnMonWlanNetwork& aFirst,
913 const CConnMonWlanNetwork& aSecond );
916 * Obtains the name (SSID) of the network.
918 * @return Name of the wlan network.
920 inline TBuf<KMaxNameLength> Name()
926 * Obtains the connection mode of the network.
928 * @return Connection mode (defined in TConnMonNetworkMode).
930 inline TUint ConnectionMode()
932 return iConnectionMode;
936 * Obtains the signal strength of the network.
938 * @return Signal strength in dBm.
940 inline TUint SignalStrength()
942 return iSignalStrength;
946 * Obtains the security mode of the network.
948 * @return Security mode (defined in TConnMonSecurityMode).
950 inline TUint SecurityMode()
952 return iSecurityMode;
956 * Obtains the mac address (BSSID) of the base station.
958 * @return Mac address (BSSID).
960 inline TBuf8<KWlanBssId> WlanBssid()
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.
970 * @return Pointer to vendor specific data if available.
972 inline HBufC* VendorData()
978 * Writes object of class CConnMonWlanNetwork to memory.
979 * Ownership of newly created buffer is transferred to caller.
981 * @return Pointer to heap descriptor. NULL if memory allocation failed.
983 IMPORT_C const HBufC* ToBuf() const;
986 * Reads object of class CConnMonWlanNetwork from memory.
988 * @param aPtrC Pointer to the beginning of the CConnMonWlanNetwork object
990 * @param aConnMonWlanNetwork Pointer to CConnMonWlanNetwork object where
991 * unpacked contents are written.
992 * @return A Symbian OS error code.
994 IMPORT_C static TInt FromPtrC(
996 CConnMonWlanNetwork* aConnMonWlanNetwork );
1002 CConnMonWlanNetwork();
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.
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 );
1023 * Second-phase constructor.
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
1037 /** Class definition for a pointer array of CConnMonWlanNetwork objects.
1039 typedef RPointerArray<CConnMonWlanNetwork> RConnMonWlanNetworksPtrArray;
1042 * Class to contain a package of a pointer array of CConnMonWlanNetwork objects.
1044 class CConnMonWlanNetworksPtrArrayPckg : public CBase
1048 * Constructor. Constructs the package of an array of pointers to
1049 * CConnMonWlanNetwork objects on the heap.
1051 * @param aRef Array of pointers to CConnMonWlanNetwork objects.
1052 * @param aBufSize Size of the buffer, intended to contain the package.
1054 CConnMonWlanNetworksPtrArrayPckg(
1055 const RPointerArray<CConnMonWlanNetwork>& aRef,
1059 * Constructor. Constructs an empty package on the heap.
1061 * @param aBufSize Size of the buffer, intended to contain the package.
1063 IMPORT_C CConnMonWlanNetworksPtrArrayPckg( TUint aBufSize );
1068 IMPORT_C virtual ~CConnMonWlanNetworksPtrArrayPckg();
1071 * Unpacks the package to a pointer array of CConnMonWlanNetwork objects.
1073 * @param aRef Array that will contain the pointers to unpacked objects.
1075 IMPORT_C void UnpackToL( RPointerArray<CConnMonWlanNetwork>& aRef ) const;
1078 * Obtains a pointer to the package buffer.
1080 * @return Pointer to the package buffer.
1082 IMPORT_C HBufC* Buf() const;
1086 * Pointer to the package Buffer on the heap.
1092 * Class to represent a WLAN beacon frame. Used when reporting WLAN scan
1093 * results back to a client.
1095 NONSHARABLE_CLASS( CConnMonWlanProbeRawBuffer ) : public CBase
1101 * @param aRawBuffer Beacon frame buffer to be copied to this object.
1102 * @return Pointer to the created CConnMonWlanProbeRawBuffer object.
1104 IMPORT_C static CConnMonWlanProbeRawBuffer* NewL(
1105 const HBufC8* aRawBuffer );
1110 * @return Pointer to the created empty CConnMonWlanProbeRawBuffer object.
1112 IMPORT_C static CConnMonWlanProbeRawBuffer* NewL();
1117 * @param aConnMonWlanProbeRawBuffer The object which is copied.
1118 * @return Pointer to the created CConnMonWlanProbeRawBuffer object.
1120 IMPORT_C static CConnMonWlanProbeRawBuffer* NewL(
1121 CConnMonWlanProbeRawBuffer& aConnMonWlanProbeRawBuffer );
1126 IMPORT_C virtual ~CConnMonWlanProbeRawBuffer();
1129 * Assignment operator.
1131 * @param aConnMonWlanProbeRawBuffer The object which is assigned.
1133 IMPORT_C CConnMonWlanProbeRawBuffer& operator=(
1134 CConnMonWlanProbeRawBuffer& aConnMonWlanProbeRawBuffer );
1137 * Obtains a pointer to the beacon frame buffer.
1139 * @return Pointer to the beacon frame buffer.
1141 IMPORT_C HBufC8* RawBuffer() const;
1144 * Writes object of class CConnMonWlanProbeRawBuffer to memory.
1145 * Ownership of newly created buffer is transferred to caller.
1147 * @return Pointer to heap descriptor, NULL if memory allocation failed.
1149 const HBufC8* ToBuf() const;
1152 * Reads object of class CConnMonWlanProbeRawBuffer from memory.
1154 * @param aPtrC Pointer to the beginning of the CConnMonWlanProbeRawBuffer
1156 * @param aConnMonWlanProbeRawBuffer Pointer to CConnMonWlanProbeRawBuffer
1157 * object where unpacked contents are written.
1158 * @return A Symbian OS error code.
1160 static TInt FromPtrC(
1161 const TPtrC8& aPtrC,
1162 CConnMonWlanProbeRawBuffer* aConnMonWlanProbeRawBuffer );
1168 CConnMonWlanProbeRawBuffer();
1171 * Second-phase constructor.
1176 * Second-phase constructor.
1178 * @param aRawBuffer Buffer to be copied to this object.
1180 void ConstructL( const HBufC8* aRawBuffer );
1183 HBufC8* iRawBuffer; // Beacon frame buffer
1186 /** Class definition for a pointer array of CConnMonWlanProbeRawBuffer objects.
1188 typedef RPointerArray<CConnMonWlanProbeRawBuffer> RConnMonWlanProbeRawBuffersPtrArray;
1191 * Class to contain a package of a pointer array of CConnMonWlanProbeRawBuffer
1194 class CConnMonWlanProbeRawBuffersPckg : public CBase
1198 * Constructor. Constructs the package of an array of pointers to
1199 * CConnMonWlanProbeRawBuffer objects on the heap.
1201 * @param aRef Array of pointers to CConnMonWlanProbeRawBuffer objects.
1202 * @param aBufSize Size of the buffer, intended to contain the package.
1204 CConnMonWlanProbeRawBuffersPckg(
1205 const RConnMonWlanProbeRawBuffersPtrArray& aRef,
1209 * Constructor. Constructs an empty package on the heap.
1211 * @param aBufSize Size of the buffer, intended to contain the package.
1213 IMPORT_C CConnMonWlanProbeRawBuffersPckg( TUint aBufSize );
1218 IMPORT_C virtual ~CConnMonWlanProbeRawBuffersPckg();
1221 * Unpacks the package to a pointer array of CConnMonWlanProbeRawBuffer
1224 * @param aRef Array that will contain the pointers to unpacked objects.
1226 IMPORT_C void UnpackToL( RConnMonWlanProbeRawBuffersPtrArray& aRef ) const;
1229 * Obtains a pointer to the package buffer.
1231 * @return Pointer to the package buffer.
1233 IMPORT_C HBufC8* Buf() const;
1236 * Obtains the total number of found WLANs.
1238 * @return Total count (iBuf[0]).
1240 IMPORT_C TUint Total() const;
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
1247 * @return Transfered count in buffer (iBuf[1]).
1249 IMPORT_C TUint Count() const;
1253 * Pointer to the package buffer on the heap.
1259 * Interface template for the class T serialization to/from HBuf/TPtr.
1260 * Class T could be any type of class (T, C, etc.).
1263 class MDesSerializer
1267 * Have to pack the object of class T to HBufC.
1268 * Ownership of newly created pointer is transferred to caller.
1270 * @return Pointer to the heap descriptor.
1272 virtual const HBufC* ToBuf() const = 0;
1275 * Have to unpack object of class T from aPtrC.
1277 * @return Constant pointer to the heap descriptor.
1279 static T FromPtrC( const TPtrC& aPtrC );
1283 * Class representing an ID number.
1284 * MDesSerializer - abstract interface for class serialization.
1286 class TConnMonId : public MDesSerializer<TConnMonId>
1290 * Defines the maximum size of the object in TChar's.
1291 * +1 is for rounding to bigger integer.
1293 static const TUint KMaxSize = ( sizeof( TUint ) ) / sizeof( TChar ) + 1;
1296 * Defines shifts of fields inside the object.
1306 * @param aId ID number.
1308 IMPORT_C TConnMonId( TUint aId );
1311 * Obtains the ID number.
1313 * @return ID number.
1315 IMPORT_C TUint Id() const;
1317 // From MDesSerializer
1320 * Writes object of class TConnMonId to memory.
1321 * Ownership of newly created buffer is transferred to caller.
1323 * @return Pointer to heap descriptor, NULL if memory allocation failed.
1325 IMPORT_C const HBufC* ToBuf() const;
1328 * Reads object of class TConnMonId from memory.
1330 * @param aPtrC Pointer to the beginning of the TConnMonId object in buffer.
1331 * @return The newly created TConnMonId object.
1333 IMPORT_C static TConnMonId FromPtrC( const TPtrC& aPtrC );
1342 /** Class definition for an array of TConnMonId objects.
1344 typedef RArray<TConnMonId> RConnMonIdsArray;
1347 * Class to contain a package of an array of TConnMonId objects.
1349 class ConnMonIdsArrayPckg
1353 * Constructor. Constructs the package of an array of TConnMonId objects
1356 * @param aRef Array of TConnMonId objects.
1357 * @param aBufSize Size of the buffer, intended to contain the package.
1359 ConnMonIdsArrayPckg( const RArray<TConnMonId>& aRef, TUint aBufSize );
1362 * Constructor. Constructs an empty package on the heap.
1364 * @param aBufSize Size of the buffer, intended to contain the package.
1366 IMPORT_C ConnMonIdsArrayPckg( TUint aBufSize );
1371 IMPORT_C virtual ~ConnMonIdsArrayPckg();
1374 * Unpacks the package to an array of TConnMonId objects.
1376 * @param aRef Array that will contain the unpacked objects.
1378 IMPORT_C void UnpackToL( RArray<TConnMonId>& aRef ) const;
1381 * Obtains a pointer to the package buffer.
1383 * @return Pointer to the package buffer.
1385 IMPORT_C HBufC* Buf() const;
1389 * Pointer to the package buffer on the heap.
1394 // Forward declarations
1395 class CConnMonEventBase;
1396 class CConnMonEventHandler;
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.
1405 class MConnectionMonitorObserver
1409 * This method is called every time an event occurs.
1411 * @param aConnMonEvent The event information.
1413 virtual void EventL( const CConnMonEventBase &aConnMonEvent ) = 0;
1417 * RConnectionMonitor
1421 class RConnectionMonitor : public RSessionBase
1427 inline RConnectionMonitor():
1437 * Connects the client to the Connection Monitor Server. It must be called
1438 * before any of other methods during the Connection Monitor session.
1440 * @return KErrNone if successful, a system-wide error code if not.
1442 IMPORT_C TInt ConnectL();
1445 * Closes the Connection Monitor session. An opened RConnectionMonitor must
1446 * be closed explicitily to prevent a resource (memory) leak.
1448 IMPORT_C void Close();
1451 * Gathers information on currently active connections.
1453 * @param aConnectionCount On completion, contains the number of active
1455 * @param aStatus KErrNone if successful, a system-wide error code if not.
1457 IMPORT_C void GetConnectionCount(
1458 TUint& aConnectionCount,
1459 TRequestStatus& aStatus );
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.
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
1471 * @return KErrNone if successful, a system-wide error code if not.
1473 IMPORT_C TInt GetConnectionInfo(
1475 TUint& aConnectionId,
1476 TUint& aSubConnectionCount ) const;
1479 * Gets the subconnection ID for the given index.
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.
1487 IMPORT_C TInt GetSubConnectionInfo(
1488 const TUint aConnectionId,
1490 TUint& aSubConnectionId ) const;
1493 * Gets the value for a TInt attribute.
1495 * @param aConnectionId Connection ID.
1496 * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
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.
1502 IMPORT_C void GetIntAttribute(
1503 const TUint aConnectionId,
1504 const TUint aSubConnectionId,
1505 const TUint aAttribute,
1507 TRequestStatus& aStatus );
1510 * Gets the value for a TUint attribute.
1512 * @param aConnectionId Connection ID.
1513 * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
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.
1519 IMPORT_C void GetUintAttribute(
1520 const TUint aConnectionId,
1521 const TUint aSubConnectionId,
1522 const TUint aAttribute,
1524 TRequestStatus& aStatus );
1527 * Gets the value for a TBool attribute.
1529 * @param aConnectionId Connection ID.
1530 * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
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.
1536 IMPORT_C void GetBoolAttribute(
1537 const TUint aConnectionId,
1538 const TUint aSubConnectionId,
1539 const TUint aAttribute,
1541 TRequestStatus& aStatus );
1544 * Gets the value for a string attribute.
1546 * @param aConnectionId Connection ID.
1547 * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
1549 * @param aAttribute Identifies the attribute to be retrieved.
1550 * @param aValue On completion, contains the requested string. Use a 16-bit
1552 * @param aStatus KErrNone if successful, a system-wide error code if not.
1554 IMPORT_C void GetStringAttribute(
1555 const TUint aConnectionId,
1556 const TUint aSubConnectionId,
1557 const TUint aAttribute,
1559 TRequestStatus& aStatus ) const;
1562 * Gets the value for a packaged attribute.
1564 * @param aConnectionId Connection ID.
1565 * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
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.
1571 IMPORT_C void GetPckgAttribute(
1572 const TUint aConnectionId,
1573 const TUint aSubConnectionId,
1574 const TUint aAttribute,
1576 TRequestStatus& aStatus ) const;
1579 * Gets the value for a packaged attribute.
1581 * @param aConnectionId Connection ID.
1582 * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
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.
1588 IMPORT_C void GetPckgAttribute(
1589 const TUint aConnectionId,
1590 const TUint aSubConnectionId,
1591 const TUint aAttribute,
1593 TRequestStatus& aStatus ) const;
1596 * Sets the value for a TInt attribute.
1598 * @param aConnectionId Connection ID.
1599 * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
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.
1605 IMPORT_C TInt SetIntAttribute(
1606 const TUint aConnectionId,
1607 const TUint aSubConnectionId,
1608 const TUint aAttribute,
1609 const TInt aValue ) const;
1612 * Sets the value for a TUint attribute.
1614 * @param aConnectionId Connection ID.
1615 * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
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.
1621 IMPORT_C TInt SetUintAttribute(
1622 const TUint aConnectionId,
1623 const TUint aSubConnectionId,
1624 const TUint aAttribute,
1625 const TUint aValue ) const;
1628 * Sets the value for a TBool attribute.
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
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.
1638 IMPORT_C TInt SetBoolAttribute(
1639 const TUint aConnectionId,
1640 const TUint aSubConnectionId,
1641 const TUint aAttribute,
1642 const TBool aValue ) const;
1645 * Sets the value for a string attribute.
1647 * @param aConnectionId Connection ID.
1648 * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
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.
1654 IMPORT_C TInt SetStringAttribute(
1655 const TUint aConnectionId,
1656 const TUint aSubConnectionId,
1657 const TUint aAttribute,
1658 const TDes& aValue ) const;
1661 * Sets the value for a packaged attribute. There is currently no packaged
1662 * attributes that can be set.
1664 * @param aConnectionId Connection ID.
1665 * @param aSubConnectionId Subconnection ID. If set to 0, method applies to
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.
1671 IMPORT_C TInt SetPckgAttribute(
1672 const TUint aConnectionId,
1673 const TUint aSubConnectionId,
1674 const TUint aAttribute,
1675 const TDes8& aValue ) const;
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.
1682 * @param aReqToCancel Identifies the request type to be cancelled.
1683 * The different types are defined in TConnMonAsyncRequest.
1685 IMPORT_C void CancelAsyncRequest( TInt aReqToCancel );
1688 * Registers an event observer to catch connection monitor events.
1690 * @param aObserver The event observer.
1691 * @return KErrNone if successful, a system-wide error code if not.
1693 IMPORT_C TInt NotifyEventL( MConnectionMonitorObserver& aObserver );
1696 * Cancels the notifications from connection monitor.
1698 IMPORT_C void CancelNotifications();
1704 TRequestStatus& aStatus );
1705 void CancelReceiveEvent();
1706 TBool IsConnected() const;
1710 CConnMonEventHandler* iHandler;
1711 RArray<TPtr8> iPtrArray;
1715 friend class CConnMonEventHandler;
1719 * Base class for all ConnMon event types.
1721 * Example how to convert an event according to type.
1723 * void CMyConnMonObserver::EventL( const CConnMonEventBase& aEvent )
1725 * switch( aEvent.EventType() )
1727 * case EConnMonCreateConnection:
1728 * CConnMonCreateConnection* realEvent;
1729 * realEvent = (CConnMonCreateConnection*) &aEvent;
1733 NONSHARABLE_CLASS( CConnMonEventBase ) : public CBase
1739 * @param aEventType Event type.
1740 * @param iConnectionId Connection ID.
1742 CConnMonEventBase( const TInt aEventType, const TUint iConnectionId );
1747 ~CConnMonEventBase();
1751 * Gets the type of the event.
1753 * @return Type of the event. Values are defined in TConnMonEventType.
1755 IMPORT_C TInt EventType() const;
1758 * Gets the connection ID of the connection.
1760 * @return Connection ID.
1762 IMPORT_C TUint ConnectionId() const;
1766 TUint iConnectionId;
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.
1776 NONSHARABLE_CLASS( CConnMonCreateConnection ) : public CConnMonEventBase
1782 * @param aConnectionId Connection ID.
1784 CConnMonCreateConnection( const TUint aConnectionId );
1789 ~CConnMonCreateConnection();
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.
1798 NONSHARABLE_CLASS( CConnMonDeleteConnection ) : public CConnMonEventBase
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.
1809 CConnMonDeleteConnection(
1810 const TUint aConnectionId,
1811 const TUint aDownlinkData,
1812 const TUint aUplinkData,
1813 const TBool aAuthDelete );
1818 ~CConnMonDeleteConnection();
1822 * Gets the downlink data volume.
1824 * @return Downlink data volume in bytes.
1826 IMPORT_C TUint DownlinkData() const;
1829 * Gets the uplink data volume.
1831 * @return Uplink data volume in bytes.
1833 IMPORT_C TUint UplinkData() const;
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 ).
1841 * @return ETrue if connection has been deactivated in an authoritative
1842 * way, otherwise returns EFalse.
1844 IMPORT_C TBool AuthoritativeDelete() const;
1847 TUint iDownlinkData;
1853 * This event is triggered when a new subconnection has been created.
1854 * Subconnections are not supported currently.
1858 NONSHARABLE_CLASS( CConnMonCreateSubConnection ) : public CConnMonEventBase
1864 * @param aConnectionId Connection ID.
1865 * @param aSubConnectionId Subconnection ID.
1867 CConnMonCreateSubConnection(
1868 const TUint aConnectionId,
1869 const TUint aSubConnectionId );
1874 ~CConnMonCreateSubConnection();
1878 * Gets the new subconnection ID.
1880 * @return Subconnection ID.
1882 IMPORT_C TUint SubConnectionId() const;
1885 TUint iSubConnectionId;
1889 * This event is triggered when a subconnection has been deleted.
1890 * Subconnections are not supported currently.
1894 NONSHARABLE_CLASS( CConnMonDeleteSubConnection ) : public CConnMonEventBase
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.
1906 CConnMonDeleteSubConnection(
1907 const TUint aConnectionId,
1908 const TUint aSubConnectionId,
1909 const TUint aDownlinkData,
1910 const TUint aUplinkData,
1911 const TBool aAuthDelete );
1916 ~CConnMonDeleteSubConnection();
1920 * Gets the subconnection ID of the deleted subconnection.
1922 * @return Subconnection ID.
1924 IMPORT_C TUint SubConnectionId() const;
1927 * Gets the downlink data volume.
1929 * @return Downlink data volume in bytes.
1931 IMPORT_C TUint DownlinkData() const;
1934 * Gets the uplink data volume.
1936 * @return Uplink data volume in bytes.
1938 IMPORT_C TUint UplinkData() const;
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 ).
1946 * @return ETrue if connection has been deactivated in an authoritative
1947 * way, otherwise returns EFalse.
1949 IMPORT_C TBool AuthoritativeDelete() const;
1952 TUint iSubConnectionId;
1953 TUint iDownlinkData;
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.
1971 NONSHARABLE_CLASS( CConnMonDownlinkDataThreshold ) : public CConnMonEventBase
1977 * @param aConnectionId Connection ID.
1978 * @param aSubConnectionId Subconnection ID.
1979 * @param aDownlinkData Downlink data volume.
1981 CConnMonDownlinkDataThreshold(
1982 const TUint aConnectionId,
1983 const TUint aSubConnectionId,
1984 const TUint aDownlinkData );
1989 ~CConnMonDownlinkDataThreshold();
1993 * Gets the subconnection ID.
1995 * @return Subconnection ID.
1997 IMPORT_C TUint SubConnectionId() const;
2000 * Gets the downlink data volume.
2002 * @return Downlink data volume in bytes.
2004 IMPORT_C TUint DownlinkData() const;
2007 TUint iSubConnectionId;
2008 TUint iDownlinkData;
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.
2024 NONSHARABLE_CLASS( CConnMonUplinkDataThreshold ) : public CConnMonEventBase
2030 * @param aConnectionId Connection ID.
2031 * @param aSubConnectionId Subconnection ID.
2032 * @param aUplinkData Uplink data volume.
2034 CConnMonUplinkDataThreshold(
2035 const TUint aConnectionId,
2036 const TUint aSubConnectionId,
2037 const TUint aUplinkData );
2042 ~CConnMonUplinkDataThreshold();
2046 * Gets the subconnection ID.
2048 * @return Subconnection ID.
2050 IMPORT_C TUint SubConnectionId() const;
2053 * Gets the uplink data volume.
2055 * @return Uplink data volume in bytes.
2057 IMPORT_C TUint UplinkData() const;
2060 TUint iSubConnectionId;
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.
2072 NONSHARABLE_CLASS( CConnMonNetworkStatusChange ) : public CConnMonEventBase
2078 * @param aConnectionId Connection ID.
2079 * @param aNetworkStatus Network status.
2081 CConnMonNetworkStatusChange(
2082 const TUint aConnectionId,
2083 const TInt aNetworkStatus );
2088 ~CConnMonNetworkStatusChange();
2092 * Gets the network status.
2094 * @return Network status. Values are defined in TConnMonNetworkStatus.
2096 IMPORT_C TInt NetworkStatus() const;
2099 TInt iNetworkStatus;
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.
2109 NONSHARABLE_CLASS( CConnMonConnectionStatusChange ) : public CConnMonEventBase
2115 * @param aConnectionId Connection ID.
2116 * @param aSubConnectionId Subconnection ID.
2117 * @param aConnectionStatus Connection status.
2119 CConnMonConnectionStatusChange(
2120 const TUint aConnectionId,
2121 const TUint aSubConnectionId,
2122 const TInt aConnectionStatus );
2127 ~CConnMonConnectionStatusChange();
2131 * Gets the subconnection ID.
2133 * @return Subconnection ID.
2135 IMPORT_C TUint SubConnectionId() const;
2138 * Gets the connection status.
2140 * @return Connection status. Values are defined in nifvar.h.
2142 IMPORT_C TInt ConnectionStatus() const;
2145 TUint iSubConnectionId;
2146 TInt iConnectionStatus;
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.
2160 NONSHARABLE_CLASS( CConnMonConnectionActivityChange ) : public CConnMonEventBase
2166 * @param aConnectionId Connection ID.
2167 * @param aSubConnectionId Subconnection ID.
2168 * @param aActivity Connection activity.
2170 CConnMonConnectionActivityChange(
2171 const TUint aConnectionId,
2172 const TUint aSubConnectionId,
2173 const TBool aActivity );
2178 ~CConnMonConnectionActivityChange();
2182 * Gets the subconnection ID.
2184 * @return Subconnection ID.
2186 IMPORT_C TUint SubConnectionId() const;
2189 * Gets the connection activity.
2191 * @return ETrue if the connection is active, EFalse if not.
2193 IMPORT_C TBool ConnectionActivity() const;
2196 TUint iSubConnectionId;
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.
2209 NONSHARABLE_CLASS( CConnMonNetworkRegistrationChange ) : public CConnMonEventBase
2215 * @param aConnectionId Connection ID.
2216 * @param aRegistrationStatus Network registration status.
2218 CConnMonNetworkRegistrationChange(
2219 const TUint aConnectionId,
2220 const TInt aRegistrationStatus );
2225 ~CConnMonNetworkRegistrationChange();
2229 * Gets the network registration status.
2231 * @return Registration status. Values are defined in
2232 * TConnMonNetworkRegistration.
2234 IMPORT_C TInt RegistrationStatus() const;
2237 TInt iRegistrationStatus;
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.
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
2255 NONSHARABLE_CLASS( CConnMonBearerChange ) : public CConnMonEventBase
2261 * @param aConnectionId Connection ID.
2262 * @param aBearer Bearer.
2264 CConnMonBearerChange( const TUint aConnectionId, const TInt aBearer );
2269 ~CConnMonBearerChange();
2273 * Gets the new bearer.
2275 * @return New bearer. Values are defined in TConnMonBearerType.
2277 IMPORT_C TInt Bearer() const;
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.
2292 NONSHARABLE_CLASS( CConnMonSignalStrengthChange ) : public CConnMonEventBase
2298 * @param aConnectionId Connection ID.
2299 * @param aSignalStrength Signal strength in dBm.
2301 CConnMonSignalStrengthChange(
2302 const TUint aConnectionId,
2303 const TInt aSignalStrength );
2308 ~CConnMonSignalStrengthChange();
2312 * Gets the signal strength.
2314 * @return Signal strength in dBm.
2316 IMPORT_C TInt SignalStrength() const;
2319 TInt iSignalStrength;
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.
2331 NONSHARABLE_CLASS( CConnMonBearerAvailabilityChange ) : public CConnMonEventBase
2337 * @param aConnectionId Connection ID.
2338 * @param aAvailability Availability of the bearer.
2340 CConnMonBearerAvailabilityChange(
2341 const TUint aConnectionId,
2342 const TBool aAvailability );
2347 ~CConnMonBearerAvailabilityChange();
2351 * Gets the availability of the bearer.
2353 * @return ETrue if the bearer is available, EFalse if not.
2355 IMPORT_C TBool Availability() const;
2358 TBool iAvailability;
2362 * This event is triggered when a plug-in sends a bearer specific event that is
2363 * unknown to ConnMon.
2367 NONSHARABLE_CLASS( CConnMonGenericEvent ) : public CConnMonEventBase
2373 * @param aType Event type.
2374 * @param aConnectionId Connection ID.
2375 * @param aData Pointer to the event data.
2377 CConnMonGenericEvent(
2379 const TUint aConnectionId,
2385 ~CConnMonGenericEvent();
2389 * Gets a pointer to the event data.
2390 * The pointer is valid only inside EventL().
2392 * @return Pointer to the event data.
2394 IMPORT_C TAny* Data() const;
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.
2408 NONSHARABLE_CLASS( CConnMonIapAvailabilityChange ) : public CConnMonEventBase
2414 * @param aConnectionId Connection ID.
2415 * @param aIapInfoPtr Pointer to the IAP availability information.
2417 CConnMonIapAvailabilityChange(
2418 const TUint aConnectionId,
2419 const TConnMonIapInfo* aIapInfoPtr );
2424 ~CConnMonIapAvailabilityChange();
2428 * Gets the IAP availability information.
2430 * @return IAP availability information.
2432 IMPORT_C TConnMonIapInfo IapAvailability() const;
2435 TConnMonIapInfo iIapInfo;
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.
2446 NONSHARABLE_CLASS( CConnMonTransmitPowerChange ) : public CConnMonEventBase
2452 * @param aConnectionId Connection ID.
2453 * @param aTransmitPower Transmit power in mW.
2455 CConnMonTransmitPowerChange(
2456 const TUint aConnectionId,
2457 const TUint aTransmitPower );
2462 ~CConnMonTransmitPowerChange();
2466 * Gets the transmit power.
2468 * @return Transmit power in mW.
2470 IMPORT_C TUint TransmitPower() const;
2473 TUint iTransmitPower;
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.
2485 NONSHARABLE_CLASS( CConnMonSNAPsAvailabilityChange ) : public CConnMonEventBase
2491 * @param aConnectionId Connection ID.
2492 * @param aSNAPsAvailable Number of available SNAPs.
2493 * @param aSNAPInfoPtr Pointer to the SNAP availability information.
2495 CConnMonSNAPsAvailabilityChange(
2496 const TUint aConnectionId,
2497 const TUint aSNAPsAvailable,
2498 const TConnMonSNAPInfo* aSNAPInfoPtr );
2503 ~CConnMonSNAPsAvailabilityChange();
2507 * Gets the SNAP availability information.
2509 * @return SNAP availability information.
2511 IMPORT_C TConnMonSNAPInfo SNAPAvailability() const;
2514 * Gets the number of available SNAPs.
2516 * @return Number of available SNAPs.
2518 IMPORT_C TUint SNAPsAvailabile() const;
2521 TConnMonSNAPInfo iSNAPInfo;
2522 TUint iSNAPsAvailable;
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
2534 NONSHARABLE_CLASS( CConnMonNewWLANNetworkDetected ) : public CConnMonEventBase
2540 * @param aConnectionId Connection ID.
2542 CConnMonNewWLANNetworkDetected( const TUint aConnectionId );
2547 ~CConnMonNewWLANNetworkDetected();
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.
2559 NONSHARABLE_CLASS( CConnMonOldWLANNetworkLost ) : public CConnMonEventBase
2565 * @param aConnectionId Connection ID.
2567 CConnMonOldWLANNetworkLost( const TUint aConnectionId );
2572 ~CConnMonOldWLANNetworkLost();
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).
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.
2593 NONSHARABLE_CLASS( CConnMonPacketDataUnavailable ) : public CConnMonEventBase
2599 * @param aConnectionId Bearer specific connection ID, EBearerIdGPRS or
2602 CConnMonPacketDataUnavailable( const TUint aConnectionId );
2607 virtual ~CConnMonPacketDataUnavailable();
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).
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.
2628 NONSHARABLE_CLASS( CConnMonPacketDataAvailable ) : public CConnMonEventBase
2634 * @param aConnectionId Bearer specific connection ID, EBearerIdGPRS or
2637 CConnMonPacketDataAvailable( const TUint aConnectionId );
2642 virtual ~CConnMonPacketDataAvailable();
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.
2654 * Note: The client needs to set the TUint attribute KBearerGroupThreshold in
2655 * order to receive these events. This also disables EConnMonBearerChange events.
2659 NONSHARABLE_CLASS( CConnMonBearerInfoChange ) : public CConnMonEventBase
2665 * @param aConnectionId Connection ID.
2666 * @param aBearerInfo Bearer information.
2668 CConnMonBearerInfoChange(
2669 const TUint aConnectionId,
2670 const TInt aBearerInfo );
2675 ~CConnMonBearerInfoChange();
2679 * Gets the new bearer information. Values are defined in TConnMonBearerInfo.
2681 * @return New bearer information.
2683 IMPORT_C TInt BearerInfo() const;
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.
2696 * Note: The client needs to set the TUint attribute KBearerGroupThreshold in
2697 * order to receive these events. This also disables EConnMonBearerChange events.
2701 NONSHARABLE_CLASS( CConnMonBearerGroupChange ) : public CConnMonEventBase
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.
2712 CConnMonBearerGroupChange(
2713 const TUint aConnectionId,
2714 const TUint aBearerGroups1,
2715 const TUint aBearerGroups2,
2716 const TBool aInternal );
2721 ~CConnMonBearerGroupChange();
2725 * Gets the new bearer groups. Values are defined in TConnMonBearerGroup.
2727 * @param aBearerGroups1 Will contain the first bearer group bitmask.
2728 * @param aBearerGroups2 Will contain the second bearer group bitmask.
2730 IMPORT_C void BearerGroups(
2731 TUint& aBearerGroups1,
2732 TUint& aBearerGroups2 ) const;
2735 * Gets the information whether the current connection bearer is internal
2738 * @return ETrue if the bearer is internal and EFalse if external.
2740 IMPORT_C TBool Internal() const;
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.
2748 #endif // __CONNECTIONMONITOR_H