epoc32/include/lbscommon.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 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef __LBSCOMMON_H__
    17 #define __LBSCOMMON_H__
    18 
    19 #include <e32std.h>
    20 #include <e32math.h>
    21 #include <lbsrequestor.h>
    22 #include <lbsclasstypes.h>
    23 #include <lbserrors.h>
    24 #include <lbsvariant.h>
    25 
    26 /** 
    27 @publishedAll
    28 @released
    29 // A compile time assert macro. The aExpr parameter must evaluate to an
    30 // integer value at compile time.
    31 // eg. sizeof(TTime) == KSizeOfTInt64
    32 // If aExpr is false, the compiler generates an error.
    33 // If aExpr is true, the compilation continues, and use of this macro will not
    34 // result in any extra object code.
    35 */
    36 #define POSITION_COMPILE_TIME_ASSERT(aExpr)   typedef char assert_type[aExpr ? 1 : -1]
    37 
    38 /** 
    39 @publishedAll
    40 @released
    41 
    42 Maximum characters in module name.
    43 If __S60_ is defined in lbsvariant.h the constant is 64 otherwise it is 20
    44 */
    45 const TInt KPositionMaxModuleName = __LBS_MAX_MODULE_NAME;
    46 
    47 /** 
    48 @publishedAll
    49 @released
    50 
    51 Maximum size for TUInt
    52 */
    53 const TUint KPositionMaxSizeQualityItem = sizeof(TInt64);
    54 
    55 /** 
    56 @publishedAll
    57 @released
    58 
    59 Maximum size for fields
    60 */
    61 const TUint KPositionMaxSectionFields = 10;
    62 
    63 /** 
    64 @publishedAll
    65 @released
    66 
    67 Defines typedef for TPositionModuleId
    68 */
    69 typedef TUid  TPositionModuleId;
    70 
    71 /** 
    72 @publishedAll
    73 @released
    74 
    75 Defines NULL TUid
    76 */
    77 const TPositionModuleId KPositionNullModuleId = {KNullUidValue};
    78 
    79 
    80 class TPositionClassTypeBase
    81 /**
    82 The base class for classes used to store position information
    83 
    84 @publishedAll
    85 @released
    86  */
    87 	{
    88 public:
    89 	IMPORT_C TUint32 PositionClassType() const;
    90 	IMPORT_C TUint PositionClassSize() const;
    91 
    92 protected:
    93 	TPositionClassTypeBase();
    94 
    95 protected:
    96 	/** The type of the derived class */
    97 	TUint32 iPosClassType;
    98 	/** The size of the derived class */
    99 	TUint iPosClassSize;
   100 	};
   101 
   102 class TPositionQualityItem
   103 /**
   104 The class for classes used to store position quality
   105 
   106 @publishedAll
   107 @released
   108  */
   109 	{
   110 public:
   111 	/** Quality result */
   112 	enum TResult
   113 		{
   114 		/** Better */
   115 		EIsBetter,
   116 		/** Equal */
   117 		EIsEqual,
   118 		/** Worse */
   119 		EIsWorse
   120 		};
   121 
   122 	/** Preference */
   123 	enum TValuePreference
   124 		{
   125 		/** Smaller values */
   126 		EPreferSmallerValues,
   127 		/** Greater values */
   128 		EPreferGreaterValues
   129 		};
   130 
   131 	/** Size of data type
   132 	 */
   133 	enum TDataType
   134 		{
   135 		/** Undefined */
   136 		EUndefined,
   137 		/** TInt8 */
   138 		ETInt8,
   139 		/** TInt16 */
   140 		ETInt16,
   141 		/** TInt32 */
   142 		ETInt32,
   143 		/** Tint64 */
   144 		ETInt64,
   145 		/** TUint8 */
   146 		ETUint8,
   147 		/** TUint16 */
   148 		ETUint16,
   149 		/** TUint 32 */
   150 		ETUint32,
   151 		/** TReal32 */
   152 		ETReal32,
   153 		/** TReal64 */
   154 		ETReal64,
   155 		/** ETime */
   156 		ETTime,
   157 		/** Time in microseconds */
   158 		ETTimeIntervalMicroSeconds
   159 		};
   160 	/**
   161 	Constructor for TPositionQualityItem
   162 	 */
   163 	TPositionQualityItem();
   164 	
   165 	/**
   166 	Compare  method
   167 	 */			
   168 	TInt Compare(const TPositionQualityItem& aItem, TResult& aComparison) const;
   169 	/**
   170 	Sets Position Quality
   171 	 */	
   172 	void Set(TDataType aDataType, TValuePreference aValuePreference,
   173 			 const TAny* aData, TUint aSizeOfData);
   174 	/**
   175 	Gets position quality
   176 	 */	
   177 	TInt Get(TDataType aDataType, TAny* aData, TUint aSizeOfData) const;
   178 	
   179 	/**
   180 	Whether or not this element has a defined state
   181 	 */
   182 	TBool IsDefined() const;
   183 
   184 private:
   185 	/** Internal datatype */
   186 	TDataType iDataType;
   187 	/** Internel value preference */
   188 	TValuePreference iScaleDirection;
   189 	/** Unused variable for future expansion. */
   190 	TUint8 iData[KPositionMaxSizeQualityItem];
   191 	};
   192 
   193 class TPositionQualityBase : public TPositionClassTypeBase
   194 /**
   195 The base class for classes used to store position quality information
   196 
   197 @publishedAll
   198 @released
   199  */
   200 	{
   201 public:
   202 	IMPORT_C TInt Compare(const TPositionQualityBase& aPositionQuality,
   203 						  TInt aElementToCompare,
   204 						  TPositionQualityItem::TResult& aComparison) const;
   205 
   206 	/**
   207  	Returns whether an element is defined
   208 	@param aElementId The element Id of that we're interested in.
   209 	@return TBool if defined
   210  	*/
   211 	IMPORT_C TBool IsDefined(TInt aElementId) const;
   212 	IMPORT_C TInt HighWaterMark() const;
   213 protected:
   214 	IMPORT_C TPositionQualityBase();
   215 
   216 	IMPORT_C void ResetElement(TInt aElementId);
   217 
   218 
   219 	/**
   220 	Sets the data of an element from the array of elements.
   221 	@param aElementId The element Id of that we're interested in.
   222 	@param aDataType The datatype of the data to be fetched.
   223 	@param aValuePreference Quality preferences
   224 	@param aData A pointer to the data to be written into.
   225  	*/
   226 	template <class T>
   227 		inline void SetElement(TInt aElementId, TPositionQualityItem::TDataType aDataType,
   228 							   TPositionQualityItem::TValuePreference aValuePreference, T aData)
   229 		{DoSetElement(aElementId, aDataType, aValuePreference, &aData, sizeof(T));}
   230 
   231 	/**
   232 	Gets the data of an element from the array of elements.
   233 	@param aElementId The element Id of that we're interested in.
   234 	@param aDataType The datatype of the data to be fetched.
   235 	@param aData A pointer to the data to be written into.
   236 	@return Standard Symbian OS Error code
   237  	*/	
   238 	template <class T>
   239 		inline TInt GetElement(TInt aElementId, TPositionQualityItem::TDataType aDataType,
   240 							    T& aData) const
   241 		{return DoGetElement(aElementId, aDataType, &aData, sizeof(T));}
   242 
   243 private:
   244 	IMPORT_C void DoSetElement(TInt aElementId, TPositionQualityItem::TDataType aDataType,
   245 							   TPositionQualityItem::TValuePreference aValuePreference,
   246 							   const TAny* aData, TUint aSizeOfData);
   247 
   248 	IMPORT_C TInt DoGetElement(TInt aElementId, TPositionQualityItem::TDataType aDataType,
   249 								TAny* aData, TUint aSizeOfData) const;
   250 private:
   251 	/** Internal array */
   252 	TFixedArray<TPositionQualityItem, KPositionMaxSectionFields> iPositionQualityData;
   253 	/** Internal highwater mark */
   254 	TInt iHighwaterMark;
   255 	};
   256 
   257 class TPositionQuality : public TPositionQualityBase
   258 /**
   259 The standard position quality class.
   260 
   261 @publishedAll
   262 @released
   263  */
   264 	{
   265 public:
   266 	/** Cost Indicator for position request */
   267 	enum TCostIndicator
   268 		{
   269 		/** Unknown cost
   270 		This is the unassigned value and should not be returned */
   271 		ECostUnknown,
   272 
   273 		/** Zero cost
   274 		No cost is expected to be incurred when obtaining a position fix */
   275 		ECostZero,
   276 
   277 		/** Possible cost
   278 		The positioning module is uncertain if the user will incur a charge. */
   279 		ECostPossible,
   280 
   281 		/** Charged
   282 		The positioning module expects a charge to be levied when obtaining
   283  		position information */
   284 		ECostCharge
   285 		};
   286 
   287 	/** Power consumption */
   288 	enum TPowerConsumption
   289 		{
   290 		/** Unknown power consumption
   291 		The positioning module is unable to determine the likely power drain */
   292 		EPowerUnknown,
   293 
   294 		/** Zero power consumption
   295 		No internal power will be used when obtaining a position fix */
   296 		EPowerZero,
   297 
   298 		/** Low power consumption
   299 		The positioning module expects a minimum power drain when using the
   300 		associated technology. This may be comparable to the power usage when
   301 		the phone is in standby mode. */
   302 		EPowerLow,
   303 
   304 		/** Medium power consumption
   305 		The positioning module expects a moderate power drain when using the
   306 		associated technology. This may be comparable to the power usage when
   307 		the phone is being actively used */
   308 		EPowerMedium,
   309 
   310 		/** High power consumption
   311 		The positioning module expects a high power drain when using the
   312 		associated technology. Use of this module will quickly consume the phone's batteries */
   313 		EPowerHigh
   314 		};
   315 
   316 public:
   317 	IMPORT_C TPositionQuality();
   318 
   319 	IMPORT_C TTimeIntervalMicroSeconds TimeToFirstFix() const;
   320 	IMPORT_C TTimeIntervalMicroSeconds TimeToNextFix()  const;  
   321 
   322 	IMPORT_C TReal32 HorizontalAccuracy() const;
   323 	IMPORT_C TReal32 VerticalAccuracy()   const;
   324 
   325 	IMPORT_C TCostIndicator CostIndicator() const;
   326 	IMPORT_C TPowerConsumption PowerConsumption() const;
   327 
   328 	IMPORT_C void SetTimeToFirstFix(TTimeIntervalMicroSeconds aTimeToFirstFix);
   329 	IMPORT_C void SetTimeToNextFix(TTimeIntervalMicroSeconds aTimeToNextFix);
   330 
   331 	IMPORT_C void SetHorizontalAccuracy(TReal32 aHorizontalAccuracy);
   332 	IMPORT_C void SetVerticalAccuracy(TReal32 aVerticalAccuracy);
   333 
   334 	IMPORT_C void SetCostIndicator(TCostIndicator aCost);
   335 	IMPORT_C void SetPowerConsumption(TPowerConsumption aPower);
   336 
   337 private:
   338 	/** Unused variable for future expansion. */
   339 	TUint8 iReserved[16];
   340 	};
   341 
   342 
   343 class TPositionModuleInfoBase : public TPositionClassTypeBase
   344 /**
   345 The base class for classes storing information on position modules
   346 
   347 @publishedAll
   348 @released
   349  */
   350 	{
   351 protected:
   352 	IMPORT_C TPositionModuleInfoBase();
   353 	};
   354 
   355 class TPositionModuleInfo : public TPositionModuleInfoBase
   356 /**
   357 The standard class for storing information on position modules
   358 
   359 @publishedAll
   360 @released
   361  */
   362 	{
   363 public:
   364 	/**
   365 	 Technology types
   366 	 */
   367 	typedef TUint32 TTechnologyType;
   368 
   369 	/**
   370 	 Technology Type
   371 	 */ 
   372 	enum _TTechnologyType
   373 		{
   374 		/** Indicates that the positioning module is unaware of the technology
   375 		used to obtain position information */
   376 		ETechnologyUnknown	= 0,
   377 		/** The primary positioning technology is handset based.
   378 		For example standard GPS */
   379 		ETechnologyTerminal	= 0x01,
   380 		/** The primary positioning technology is network based.
   381 		For example, E-OTD */
   382 		ETechnologyNetwork	= 0x02,
   383 		/** The primary positioning mechanism receives assistance in some form.
   384 		Generally to obtain a quicker or more accurate fix */
   385 		ETechnologyAssisted	= 0x04
   386 		};
   387 
   388 	/**
   389 	 Device locations
   390 	 */
   391 	typedef TUint32 TDeviceLocation;
   392 
   393 	/**
   394 	 Device location
   395 	 */ 
   396 	enum _TDeviceLocation
   397 		{
   398 		/** The positioning module is unaware of the hardware used to supply
   399 		positioning information */
   400 		EDeviceUnknown	= 0,
   401 		/** The positioning hardware is integral to the terminal */
   402 		EDeviceInternal	= 0x01,
   403 		/** The positioning hardware is separate from the terminal */
   404 		EDeviceExternal	= 0x02
   405 		};
   406 
   407 	/**
   408 	 Position module capabilities
   409 	 */
   410 	typedef TUint32 TCapabilities;
   411 
   412 	/**
   413 	 Module Capabilities
   414 	 */ 
   415 	enum _TCapabilities
   416 		{
   417 		/** No Capabilities */
   418 		ECapabilityNone	       = 0,
   419 
   420 		/** Positioning modules with this capability will support the
   421 		TPositionInfo class and are able to provide latitude and longitude
   422 		related information
   423 		 */
   424 		ECapabilityHorizontal  = 0x0001,
   425 
   426 		/** Positioning modules with this capability will support the
   427 	 	TPositionInfo class and are able to provide height related information
   428 		 */
   429 		ECapabilityVertical    = 0x0002,
   430 
   431 		/** Positioning modules with this capability will support the
   432 		TPositionCourseInfo class and are able to provide information related
   433 		to the current horizontal speed
   434 		 */
   435 		ECapabilitySpeed       = 0x0004,
   436 
   437 		/** Positioning modules with this capability will support the
   438 		TPositionCourseInfo class and are able to provide heading related information
   439 		 */
   440 		ECapabilityDirection   = 0x0008,
   441 
   442 		/** Positioning modules with this capability will support the
   443 		TPositionSatelliteInfo class. Such a module will be able to return at
   444 		least some satellite data - but the extent of the information could vary.
   445 		Applications must ensure that any value returned is valid before it is used 
   446 		*/
   447 		ECapabilitySatellite   = 0x0010,
   448 
   449 		/** This value is reserved for future expansion.
   450 		Positioning modules with this capability will be able to return
   451 		information related to a magnetic compass. The API does not currently
   452 		define an extended class that encapsulates this type of information
   453  		*/
   454 		ECapabilityCompass     = 0x0020,
   455 
   456 		/** This value is reserved for future expansion.
   457 		Positioning modules with this capability will be able to return
   458 		location information using NMEA formatted text strings.
   459 		The API does not currently define an extended class that encapsulates
   460 		this type of information
   461  		*/
   462 		ECapabilityNmea        = 0x0040,
   463 
   464 		/** This value is reserved for future expansion.
   465 		Positioning modules with this capability will be able to return
   466 		information related to the postal address of the current location
   467 		 */
   468 		ECapabilityAddress     = 0x0080,
   469 
   470 		/** This value is reserved for future expansion.
   471 		Positioning modules with this capability will be able to return the
   472 		current position in terms of where within a building it is. For
   473 		example, this may include the floor and the room name.	
   474 		The API does not currently define an extended class that encapsulates
   475 		this type of information
   476 		 */
   477 		ECapabilityBuilding    = 0x0100,
   478 
   479 		/** This value is reserved for future expansion.
   480 		Positioning modules with this capability will be able to return provide
   481 		a link to further information about the location. The standard mechanism
   482 		is via a URL.
   483 		The API does not currently define an extended class that encapsulates
   484 		this type of information
   485  		*/
   486 		ECapabilityMedia       = 0x0200
   487 		};
   488 
   489 public:
   490 	IMPORT_C TPositionModuleInfo();
   491 
   492 	IMPORT_C TPositionModuleId ModuleId() const;
   493 	IMPORT_C TBool IsAvailable() const;
   494 	IMPORT_C void GetModuleName(TDes& aModuleName) const;
   495 	IMPORT_C void GetPositionQuality(TPositionQuality& aPosQuality) const;
   496 	IMPORT_C TTechnologyType TechnologyType() const;
   497 	IMPORT_C TDeviceLocation DeviceLocation() const;
   498 	IMPORT_C TCapabilities Capabilities() const ;
   499 	IMPORT_C TUint32 ClassesSupported(TPositionClassFamily aClassType) const;
   500 	IMPORT_C TVersion Version() const;
   501 
   502 	IMPORT_C void SetModuleId(TPositionModuleId aModuleId);
   503 	IMPORT_C void SetIsAvailable(TBool aIsAvailable);
   504 	IMPORT_C void SetModuleName(const TDesC& aModuleName);
   505 	IMPORT_C void SetPositionQuality(const TPositionQuality& aPosQuality);
   506 	IMPORT_C void SetTechnologyType(TTechnologyType aTechnologyType);
   507 	IMPORT_C void SetDeviceLocation(TDeviceLocation aDeviceLocation);
   508 	IMPORT_C void SetCapabilities(TCapabilities aDeviceCapabilities);
   509 	IMPORT_C void SetClassesSupported(TPositionClassFamily aClassType,
   510 									  TUint32 aSupportedClasses);
   511 	IMPORT_C void SetVersion(TVersion aVersion);
   512 
   513 protected:
   514 	/** The module ID */
   515 	TPositionModuleId	iModuleId;
   516 	/** Whether or not the module is available */
   517 	TBool iIsAvailable;
   518 	/** The module name */
   519 	TBuf<KPositionMaxModuleName> iModuleName;
   520 	/** The position quality */
   521 	TPositionQuality    iPosQuality;
   522 	/** The technology type */
   523 	TTechnologyType     iTechnologyType;
   524 	/** The location of the device associated with this module */
   525 	TDeviceLocation     iDeviceLocation;
   526 	/** The capabilities of this module */
   527 	TCapabilities		iCapabilities;
   528 	/** The array of supported classes for the different class types */
   529 	TFixedArray<TUint32, EPositionLastFamily> iSupportedClassTypes;
   530 	/** The version of this module */
   531 	TVersion            iVersion;
   532 
   533 private:
   534 	/** Unused variable for future expansion. */
   535 	TUint8 iReserved[16];
   536 	};
   537 
   538 
   539 class TPositionModuleStatusBase : public TPositionClassTypeBase
   540 /**
   541 The base class for classes storing a position module's status
   542 
   543 @publishedAll
   544 @released
   545  */
   546 	{
   547 protected:
   548 	IMPORT_C TPositionModuleStatusBase();
   549 	};
   550 
   551 class TPositionModuleStatus : public TPositionModuleStatusBase
   552 /**
   553 The normal class for storing a position module's status
   554 
   555 @publishedAll
   556 @released
   557  */
   558 	{
   559 public:
   560 	/** defined type for TDeviceStatus */
   561 	typedef TInt TDeviceStatus;
   562 
   563 	/**
   564 	 * The device status
   565 	 */
   566 	enum _TDeviceStatus 
   567 		{
   568 		/** Device unknown
   569 		This is not a valid state and should never be reported */
   570 		EDeviceUnknown,
   571 
   572 		/** Device error
   573 		There are problems using the device. For example, there may be
   574 		hardware errors. It should not be confused with complete loss of data
   575 		quality which indicates that the device is functioning correctly but
   576 		is currently unable to obtain position information.
   577 		The error state will be reported if the device can not be successfully
   578 		brought on line. For example, the positioning module may have been unable
   579 		to communicate with the device or it is not responding as expected.
   580  		*/
   581 		EDeviceError,
   582 
   583 		/** Device disabled
   584 		Although the device may be working properly, it has been taken off line
   585 		and is regarded as being unavailable to obtain position information.
   586 		This will generally have been done by the user via the control panel.
   587 		In this state, positioning framework will not use the device.
   588 		 */
   589 		EDeviceDisabled,
   590 
   591 		/** Device inactive
   592 		The device is not being used by the positioning framework. This is
   593 		typically because there are no clients currently obtaining the position
   594 		from it. This is the normal status that is returned for a module that
   595 		is not currently loaded by the system
   596 	 	*/
   597 		EDeviceInactive,
   598 
   599 		/** Device initialising
   600 		This is a transient state. The device is being brought out of the
   601 		"inactive" state but has not 	reached either the "ready" or "stand by"
   602 		modes. The initialising state will occur when the positioning module
   603 		is first selected to provide a client application with location information	
   604 		 */
   605 		EDeviceInitialising,
   606 
   607 		/** Device standby
   608 		This state indicates the device has entered "sleep" or "power save"
   609 		mode. This signifies that the device is online, but is not actively
   610 		retrieving position information. A device will generally enter this mode
   611 		when the next position update is not required for some time and it is
   612 		more 	efficient to partially power down.
   613 		Note: Not all positioning modules will support this state - particularly
   614 		when there is external hardware
   615 		 */
   616 		EDeviceStandBy,
   617 
   618 		/** Device ready
   619 		The positioning device is online and is ready to retrieve
   620 		position information
   621 		 */
   622 		EDeviceReady,
   623 
   624 		/** Device active
   625 		The positioning device is actively in the process of retrieving
   626 		position information.
   627 		Note: Not all positioning modules will support this state - particularly
   628 		when there is external hardware
   629 		 */
   630 		EDeviceActive
   631 		};
   632 
   633 	/** defined type for TDataQualityStatus */
   634 	typedef TInt TDataQualityStatus;
   635 
   636 	/**
   637 	 * The data quality status
   638 	 */
   639 	enum _TDataQualityStatus
   640 		{
   641 		/** Data Quality Unknown
   642 		This is the unassigned valued. This state should only be reported
   643 		during an event indicating that a positioning module has been removed 
   644 		or is not yet loaded.
   645  		*/
   646 		EDataQualityUnknown,
   647 
   648 		/** Data Quality Loss
   649 		The accuracy and contents of the position information has been
   650 		completely compromised. It is no longer possible to return any
   651 		coherent data.
   652 		This situation will occur if the device has lost track of all the
   653 		transmitters (for example, satellites or base stations).
   654 		It should be noted although it is currently not possible to obtain
   655 		position information, the device may still be functioning correctly.
   656 		This state should not be confused with a device error.
   657  		*/
   658 		EDataQualityLoss,
   659 
   660 		/** Data Quality Partial
   661 		There has been a partial degradation in the available position
   662 		information. In particular, it is not possible to provide the required
   663 		(or expected) quality of information.
   664 		This situation could occur if the device has lost track of one of the
   665 		transmitters (for example, satellites or base stations)
   666 		 */
   667 		EDataQualityPartial,
   668 
   669 		/** Data Quality Normal
   670 		The positioning device is functioning as expected
   671  		*/
   672 		EDataQualityNormal
   673 		};
   674 
   675 	IMPORT_C TPositionModuleStatus();
   676 
   677 	IMPORT_C TDeviceStatus DeviceStatus() const;
   678 	IMPORT_C TDataQualityStatus DataQualityStatus() const;
   679 
   680 
   681 	IMPORT_C void SetDeviceStatus(TDeviceStatus aStatus);
   682 	IMPORT_C void SetDataQualityStatus(TDataQualityStatus aStatus);
   683 	
   684 protected:
   685 	/** The device status */
   686 	TDeviceStatus      iDeviceStatus;
   687 	/** The data quality status */
   688 	TDataQualityStatus iDataQualityStatus;
   689 
   690 private:
   691 	/** Unused variable for future expansion. */
   692 	TUint8 iReserved[8];
   693 	};
   694 
   695 
   696 class TPositionModuleStatusEventBase : public TPositionClassTypeBase
   697 /**
   698 The base class for classes storing position module status events
   699 
   700 @publishedAll
   701 @released
   702  */
   703 	{
   704 public:
   705 	/** defined type for TSystemModuleEvent */
   706 	typedef TUint32 TSystemModuleEvent;
   707 
   708 	/**
   709 	 * Module events
   710 	 */
   711 	enum _TSystemModuleEvent
   712 		{
   713 		/** System Unknown
   714 		This is not a valid state and should never be reported */
   715 		ESystemUnknown				= 0,
   716 
   717 		/** System Error
   718 		There are problems using the module. For example, the module may have
   719 		terminated abnormally. It should not be confused with the module
   720 		reporting the error EDeviceError via TPositionModuleStatus::DeviceStatus().
   721 		That signifies the module itself is up and running - but it may be
   722 		unable to successful communicate with the hardware
   723  		*/
   724 		ESystemError,
   725 	
   726 		/** System Module Installed
   727 		A new positioning module has been dynamically added to the system. To
   728 		receive this event, the client application must have expressed interest
   729 		in status notifications from any positioning module. The Id of the newly
   730 		installed module can be found by calling TPositionModuleStatusEvent::ModuleId().
   731 		 */
   732 		ESystemModuleInstalled,
   733 
   734 		/** System Module Removed
   735 		A positioning module is uninstalled. The Id of the removed module can
   736 		be found by calling TPositionModuleStatusEvent::ModuleId()
   737 		 */
   738 		ESystemModuleRemoved
   739 		};
   740 
   741 	/** defined type for TModuleEvent */
   742 	typedef TUint32 TModuleEvent;
   743 
   744 	/**
   745 	 Module events
   746 	 */
   747 	enum _TModuleEvent
   748 		{
   749 		/** No module event
   750 		This is the unassigned value and should not be reported or used
   751  		*/
   752 		EEventNone				= 0,
   753 
   754 		/** Module event device status
   755 		Events about the general status of the device. When this type of event
   756 		occurs, client applications should inspect the value returned by the
   757  		TPositionModuleInfo::DeviceStatus() method for more information
   758  		*/
   759 		EEventDeviceStatus      = 0x01,
   760 		
   761 		/** Module Data Quality status
   762 		Events about the quality of the data a module is able to return. When
   763 		this type of event occurs, client applications should inspect the
   764 		value returned by the TPositionModuleInfo::DataQualityStatus() method
   765 		for more information.
   766  		*/
   767 		EEventDataQualityStatus = 0x02,
   768 
   769 		/** Module System Event
   770 		System level events about the status of modules. Events of this type
   771 		indicate when modules have been added or removed from the system. When
   772 		this event type occurs, client applications should inspect the value
   773 		returned by TPositionModuleInfo::SystemModuleEvent() to determine which
   774 		particular event was responsible
   775  		*/
   776 		EEventSystemModuleEvent = 0x04,
   777 
   778 		/** All events */
   779 		EEventAll				= EEventDeviceStatus |
   780 								  EEventDataQualityStatus |
   781 								  EEventSystemModuleEvent
   782 		};
   783 
   784 protected:
   785 	IMPORT_C TPositionModuleStatusEventBase();
   786 	IMPORT_C TPositionModuleStatusEventBase(TModuleEvent aRequestedEventMask);
   787 
   788 public:
   789 	IMPORT_C void SetRequestedEvents(TModuleEvent aRequestedEventMask);
   790 	IMPORT_C TModuleEvent RequestedEvents() const;
   791 
   792 	IMPORT_C void SetOccurredEvents(TModuleEvent aOccurredEventMask);
   793 	IMPORT_C TModuleEvent OccurredEvents() const;
   794 
   795 	IMPORT_C TPositionModuleId ModuleId() const;
   796 	IMPORT_C void SetModuleId(TPositionModuleId aModuleId);
   797 
   798 	IMPORT_C void SetSystemModuleEvent(TSystemModuleEvent aSystemModuleEvent);
   799 	IMPORT_C TSystemModuleEvent SystemModuleEvent() const;
   800 
   801 protected:
   802 	IMPORT_C virtual void DoReset(TInt aSizeOfClass);
   803 
   804 private:
   805 	friend class RPositionServer;
   806 	void Reset();
   807 
   808 protected:
   809 	/** A bitmask of the requested events */
   810 	TModuleEvent iRequestedEvents;
   811 	/** A bitmask of the events which occurred */
   812 	TModuleEvent iOccurredEvents;
   813 	/** System level module status events*/
   814 	TSystemModuleEvent iSystemModuleEvent;
   815 	/** The module ID causing the event*/
   816 	TPositionModuleId  iModuleId;
   817 	};
   818 
   819 class TPositionModuleStatusEvent : public TPositionModuleStatusEventBase
   820 /**
   821 The normal class for storing position module status events
   822 
   823 @publishedAll
   824 @released
   825  */
   826 	{
   827 public:
   828 	IMPORT_C TPositionModuleStatusEvent();
   829 	IMPORT_C TPositionModuleStatusEvent(TModuleEvent aRequestedEventMask);
   830 
   831 	IMPORT_C void SetModuleStatus(const TPositionModuleStatus& aModuleStatus);
   832 	IMPORT_C void GetModuleStatus(TPositionModuleStatus& aModuleStatus) const;
   833 
   834 protected:
   835 	IMPORT_C virtual void DoReset(TInt aSizeOfClass);
   836 
   837 protected:
   838 	/** The module status */
   839 	TPositionModuleStatus iModuleStatus;
   840 	};
   841 
   842 
   843 class TPositionUpdateOptionsBase : public TPositionClassTypeBase
   844 /**
   845 The base class for classes storing position update options
   846 
   847 @publishedAll
   848 @released
   849  */
   850 	{
   851 protected:
   852 	IMPORT_C TPositionUpdateOptionsBase();
   853 	IMPORT_C TPositionUpdateOptionsBase(TTimeIntervalMicroSeconds aInterval,
   854 	                                    TTimeIntervalMicroSeconds aTimeOut = TTimeIntervalMicroSeconds(0),
   855 	                                    TTimeIntervalMicroSeconds aMaxAge = TTimeIntervalMicroSeconds(0));
   856 
   857 public:
   858 	IMPORT_C void SetUpdateInterval(TTimeIntervalMicroSeconds aInterval);
   859 	IMPORT_C void SetUpdateTimeOut(TTimeIntervalMicroSeconds aTimeOut);
   860 	IMPORT_C void SetMaxUpdateAge(TTimeIntervalMicroSeconds aMaxAge);
   861 
   862 	IMPORT_C TTimeIntervalMicroSeconds UpdateInterval() const;
   863 	IMPORT_C TTimeIntervalMicroSeconds UpdateTimeOut() const;
   864 	IMPORT_C TTimeIntervalMicroSeconds MaxUpdateAge() const;
   865 
   866 protected:
   867 	/** The update interval */
   868 	TTimeIntervalMicroSeconds iUpdateInterval;
   869 	/** The update timeout */
   870 	TTimeIntervalMicroSeconds iUpdateTimeOut;
   871 	/** The maximum update age */
   872 	TTimeIntervalMicroSeconds iMaxUpdateAge;
   873 
   874 private:
   875 	/** Unused variable for future expansion. */
   876 	TUint8 iReserved[8];
   877 	};
   878 
   879 class TPositionUpdateOptions : public TPositionUpdateOptionsBase
   880 /**
   881 The normal class for storing position update options
   882 
   883 @publishedAll
   884 @released
   885  */
   886 	{
   887 public:
   888 	IMPORT_C TPositionUpdateOptions();
   889 	IMPORT_C TPositionUpdateOptions(TTimeIntervalMicroSeconds aInterval,
   890 	                                TTimeIntervalMicroSeconds aTimeOut = TTimeIntervalMicroSeconds(0),
   891 	                                TTimeIntervalMicroSeconds aMaxAge = TTimeIntervalMicroSeconds(0),
   892 	                                TBool aAcceptPartialUpdates = EFalse);
   893 
   894 	IMPORT_C void SetAcceptPartialUpdates(TBool aAcceptPartialUpdates);
   895 	IMPORT_C TBool AcceptPartialUpdates() const;
   896 
   897 protected:
   898 	/** Whether partial updates are accepted */
   899 	TBool iAcceptPartialUpdates;
   900 
   901 private:
   902 	/** Unused variable for future expansion. */
   903 	TUint8 iReserved[16];
   904 	};
   905 
   906 
   907 #endif //__LBSCOMMON_H__