epoc32/include/bttypes.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) 1999-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 // BT protocol wide types
    15 // 
    16 //
    17 
    18 #ifndef _BTTYPES_H
    19 #define _BTTYPES_H
    20 
    21 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
    22 #include <bttypespartner.h>
    23 #endif
    24 
    25 #include <e32std.h>
    26 #include <bluetooth/eirdatacodec.h>
    27 
    28 /**
    29 @publishedAll
    30 @released
    31 
    32 Minimum eSCO connection latency in milliseconds.  Attempts to specify less than this will be silently
    33 increased to this level.
    34 */
    35 static const TInt KMinESCOLatency = 4;
    36 
    37 /**
    38 @publishedAll
    39 @released
    40 
    41 Typedef to represent a HCI connection handle.
    42 */
    43 typedef TUint16 THCIConnHandle;
    44 
    45 /**
    46 @publishedAll
    47 @released
    48 
    49 Bluetooth SIG specified values for specification of (piconet) role.
    50 */
    51 enum TBTBasebandRole
    52 	{
    53 	EMaster			= 0x00, /*!< Master role */
    54 	ESlave			= 0x01, /*!< Slave role */
    55 	ERoleUnknown,			/*!< Unknown role */
    56 	};
    57 
    58 /**
    59 @publishedAll
    60 @released
    61 
    62 Bluetooth SIG specified values for indicating link modes.
    63 */
    64 enum TBTLinkMode
    65     {
    66     EActiveMode		= 0x00, /*!< Active mode */
    67     EHoldMode		= 0x01, /*!< Hold mode */
    68     ESniffMode		= 0x02, /*!< Sniff mode */
    69     EParkMode		= 0x04, /*!< Park mode */
    70 	EScatterMode	= 0x08, /*!< Scatter mode */
    71     };
    72 
    73 /**
    74 @publishedAll
    75 @released
    76 
    77 Typedef to represent a union of TBTLinkMode values.
    78 */
    79 typedef TUint32 TBTLinkModeSet;
    80 
    81 /**
    82 @publishedAll
    83 @released
    84 
    85 Bitmask values to help request combinations of link modes.
    86 @see TBTLinkMode
    87 */
    88 enum TBTLinkModeCombinations
    89 	{
    90 	EAnyLowPowerMode = (EHoldMode | ESniffMode | EParkMode | EScatterMode) /*!< Any low power mode */
    91 	};
    92 
    93 /**
    94 @publishedAll
    95 @released
    96 
    97 Bluetooth SIG specified values for indicating packet types.
    98 
    99 DM1, DH1, DM3, DH3, DM5, DH5 are ACL packet types
   100 HV1, HV2, HV3 are SCO (synchronous link) packet types
   101 */
   102 enum TBTPacketType
   103 	{
   104 	EPacketsDM1			= 0x0008, /*!< DM1 ACL packet type */
   105 	EPacketsDH1			= 0x0010, /*!< DH1 ACL packet type */
   106 	EPacketsDM3			= 0x0400, /*!< DM3 ACL packet type */
   107 	EPacketsDH3			= 0x0800, /*!< DH3 ACL packet type */
   108 	EPacketsDM5			= 0x4000, /*!< DM5 ACL packet type */
   109 	EPacketsDH5			= 0x8000, /*!< DH5 ACL packet type */
   110 	
   111 	EPackets2_DH1		= 0x0002, /*!< 2-DH1 ACL packet type */
   112 	EPackets3_DH1		= 0x0004, /*!< 3-DH1 ACL packet type */
   113 	EPackets2_DH3		= 0x0100, /*!< 2-DH3 ACL packet type */
   114 	EPackets3_DH3		= 0x0200, /*!< 3-DH3 ACL packet type */
   115 	EPackets2_DH5		= 0x1000, /*!< 2-DH5 ACL packet type */
   116 	EPackets3_DH5		= 0x2000, /*!< 3-DH5 ACL packet type */
   117 
   118 	EPacketsHV1			= 0x0020, /*!< HV1 SCO packet type */
   119 	EPacketsHV2			= 0x0040, /*!< HV2 SCO packet type */
   120 	EPacketsHV3			= 0x0080, /*!< HV3 SCO packet type */
   121 	};
   122 
   123 /**
   124 @publishedAll
   125 @released
   126 
   127 Typedef to represent a set of SCO packet types.
   128 */
   129 typedef TUint16 TBTSCOPackets;
   130 
   131 /**
   132 @publishedAll
   133 @released
   134 
   135 Typedef to represent a set of ACL packet types.
   136 */
   137 typedef TUint16 TBTACLPackets;
   138 
   139 /**
   140 @publishedAll
   141 @released
   142 
   143 Bitmask values to help request combinations of packets.
   144 @see TBTPacketType
   145 */
   146 enum TBTPacketTypeCombinations
   147 	{
   148 	EAnyACLPacket	 = EPacketsDM1 | EPacketsDM3 | EPacketsDM5 | EPacketsDH1 | EPacketsDH3 | EPacketsDH5, /*!< Any ACL packet */
   149 	EAnyNonEdrACLPacket = EAnyACLPacket | EPackets2_DH1 | EPackets3_DH1 | EPackets2_DH3 | EPackets3_DH3 | EPackets2_DH5 | EPackets3_DH5, /*!< Any Non-EDR ACL packet */
   150 	EAnySCOPacket	 = EPacketsHV1 | EPacketsHV2 | EPacketsHV3, /*!< Any SCO packet */
   151 	EAnyPacket		= EAnyACLPacket | EAnySCOPacket  /*!< Any packet */
   152 	};
   153 
   154 
   155 /**
   156 @publishedAll
   157 @released
   158 
   159 Typedef to represent a set of synchronous packet types (SCO and eSCO on v1.2).
   160 @see TBTSyncPackets::TSyncPackets
   161 */
   162 typedef TUint32 TBTSyncPacketTypes;
   163 
   164 /**
   165 @publishedAll
   166 @deprecated
   167 
   168 This constant is no longer needed to translate the SCO mapping of HV packet types to Synchronous
   169 because CBluetoothSynchronousLink::SetupConnection(const TBTDevAddr& aBDAddr, const TUint16 aPacketTypes)
   170 adjusts aPacketTypes internally on behalf of clients.
   171 */
   172 static const TInt KSCOvsSyncHVOffset = 5;
   173 
   174 
   175 /**
   176 @publishedAll
   177 @released
   178 
   179 Class to represent a set of synchronous packet types (SCO and eSCO on v1.2).
   180 This differs from TBTSyncPacketTypes as it is the interface used by CBluetoothSynchronousLink
   181 in order to detect the difference between a pre and post eSCO caller.  This is necessary
   182 as HV1 packets in the SCO numbering clash with EV5 packets in the sync numbering.
   183 */
   184 NONSHARABLE_CLASS(TBTSyncPackets)
   185 	{
   186 	public:
   187 		/**
   188 		@publishedAll
   189 		@released
   190 		
   191 		Individual synchronous packet types.
   192 		@see TBTSyncPacketTypes
   193 		*/
   194 		enum TSyncPackets
   195 			{
   196 			ESyncPacketsHV1		= 0x10001,
   197 			ESyncPacketsHV2		= 0x10002,
   198 			ESyncPacketsHV3		= 0x10004,
   199 
   200 			ESyncPacketsEV3		= 0x20008,
   201 			ESyncPacketsEV4		= 0x20010,
   202 			ESyncPacketsEV5		= 0x20020,
   203 			
   204 			ESyncAnySCOPacket	= ESyncPacketsHV1 | ESyncPacketsHV2 | ESyncPacketsHV3,
   205 			ESyncAnyESCOPacket	= ESyncPacketsEV3 | ESyncPacketsEV4 | ESyncPacketsEV5
   206 			};
   207 	
   208 	public:
   209 		IMPORT_C explicit TBTSyncPackets(TBTSyncPacketTypes aPackets);
   210 		IMPORT_C TBTSyncPacketTypes operator()() const;
   211 		
   212 	private:
   213 		TUint32 iPacketTypes;
   214 
   215 		// This data padding has been added to help prevent future binary compatibility breaks	
   216 		// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
   217 		TUint32		iPadding1;
   218 		TUint32		iPadding2;
   219 	};
   220 
   221 
   222 /**
   223 @publishedAll
   224 @released
   225 
   226 eSCO links can have different retransmission options, optimised for link usage,
   227 power or reliability.
   228 
   229 @see CBluetoothSynchronousLink::SetRetransmissionEffort
   230 */
   231 enum TBTeSCORetransmissionTypes
   232 	{
   233 	EeSCORetransmitNone			= 0,
   234 	EeSCORetransmitPower		= 1,
   235 	EeSCORetransmitReliability	= 2,
   236 	EeSCORetransmitDontCare		= 0xff
   237 	};
   238 
   239 /**
   240 @publishedAll
   241 @released
   242 
   243 eSCO unspecified bandwidth.  This value can only be used by the accepting side
   244 of an eSCO link, to allow any bandwidth to be specified by the initiator.
   245 Otherwise both sides of the link must agree on the same bandwidth.
   246 
   247 @see CBluetoothSynchronousLink::SetBandwidth
   248 @see CBluetoothSynchronousLink::AcceptConnection
   249 */
   250 static const TUint32 KESCOBandwidthDontCare = KMaxTUint32;
   251 
   252 /**
   253 @publishedAll
   254 @released
   255 
   256 Bluetooth SIG specified values indicating whether a device
   257 is physically able to support a baseband (or link manager protocol) feature
   258 */
   259 enum TBTSupportedFeatures
   260 	{
   261 	ESupportedThreeSlotPackets				= 1<<0,  /*!< Three slot packets are supported */
   262 	ESupportedFiveSlotPackets				= 1<<1,  /*!< Five slot packets are supported */
   263 	ESupportedEncryption					= 1<<2,  /*!< Encryption is supported */
   264 	ESupportedSlotOffset					= 1<<3,  /*!< Slot offset is supported */
   265 	ESupportedTimingAccuracy				= 1<<4,  /*!< Timing accuracy is supported */
   266 	ESupportedSwitch						= 1<<5,  /*!< Role switch is supported */
   267 	ESupportedHoldMode						= 1<<6,  /*!< Hold mode is supported */
   268 	ESupportedSniffMode						= 1<<7,  /*!< Sniff mode is supported */
   269 	ESupportedParkMode						= 1<<8,  /*!< Park mode is supported */
   270 	ESupportedRSSI							= 1<<9,  /*!< Receive signal strength indication is supported */
   271 	ESupportedChannelQualityDrivenDataRate	= 1<<10, /*!< Channel quality driven data rate is supported */
   272 	ESupportedSCOLink						= 1<<11, /*!< SCO links are supported */
   273 	ESupportedHV2Packets					= 1<<12, /*!< HV2 packets are supported */
   274 	ESupportedHV3Packets					= 1<<13, /*!< HV3 packets are supported */
   275 	ESupportedu_lawLog						= 1<<14, /*!< SCO u-law encoding is supported */
   276 	ESupportedA_lawLog						= 1<<15, /*!< SCO A-law encoding is supported */
   277 	ESupportedCVSD							= 1<<16, /*!< SCO Continuously variable slope delta modulation is supported */
   278 	ESupportedPagingScheme					= 1<<17, /*!< Paging scheme is supported */
   279 	ESupportedPowerControl					= 1<<18, /*!< Power control is supported */
   280 	ESupportedTransparentSCOData			= 1<<19, /*!< Transparent SCO data is supported */
   281 	ESupportedFlowControlLagBit0			= 1<<20, /*!< Flow control lag bit 0 is supported */
   282 	ESupportedFlowControlLagBit1			= 1<<21, /*!< Flow control lag bit 1 is supported */
   283 	ESupportedFlowControlLagBit2			= 1<<22, /*!< Flow control lag bit 2 is supported */
   284 	};
   285 
   286 /**
   287 @publishedAll
   288 @released
   289 
   290 Bitmask values for notifying/requesting notification of the state of a physical link.
   291 
   292 These values have a two fold purpose:
   293 1) They can be used along with TBTPhysicalLinkStateNotifierCombinations to specify
   294 a set of baseband change events for which notification is desired.
   295 2) They can be used to notify the state of a physical link or a subset of that state.
   296 For example if only mode change events are being monitored, then at each mode change event
   297 only the bit reperesenting the new mode will be returned, however if the whole link state
   298 is required, then a combination of bit values indicating that state will be returned.
   299 
   300 THESE BIT VALUES MUST ONLY BE USED WHEN REQUESTING NOTIFICATION, OR WHEN PARSING THE
   301 RESULTS OF A NOTIFICATION. All other baseband state activities should use one of the 
   302 appropriate Bluetooth SIG specified enums
   303 @see TBTBasebandRole
   304 @see TBTLinkMode
   305 @see TBTLinkModeCombinations
   306 @see TBTPacketType
   307 @see TBTPacketTypeCombinations
   308 */
   309 enum TBTPhysicalLinkStateNotifier
   310 	{
   311 	ENotifyMaster					= 0x00000001, /*!< Master */
   312 	ENotifySlave					= 0x00000002, /*!< Slave */
   313 
   314 	ENotifyActiveMode				= 0x00000004, /*!< Active mode */
   315 	ENotifySniffMode				= 0x00000008, /*!< Sniff mode */
   316 	ENotifyParkMode					= 0x00000010, /*!< Park mode */
   317 	ENotifyHoldMode					= 0x00000020, /*!< Hold mode */
   318 
   319 	ENotifyMaxSlots1				= 0x00000040, /*!< Max slots 1 */
   320 	ENotifyMaxSlots3				= 0x00000080, /*!< Max slots 3 */
   321 	ENotifyMaxSlots5				= 0x00000100, /*!< Max slots 5 */
   322 
   323 	ENotifyPacketsDM1				= 0x00000200, /*!< Packets DM1 */
   324 	ENotifyPacketsDH1				= 0x00000400, /*!< Packets DH1 */
   325 	ENotifyPacketsDM3				= 0x00000800, /*!< Packets DM3 */
   326 	ENotifyPacketsDH3				= 0x00001000, /*!< Packets DH3 */
   327 	ENotifyPacketsDM5				= 0x00002000, /*!< Packets DM5 */
   328 	ENotifyPacketsDH5				= 0x00004000, /*!< Packets DH5 */
   329 
   330 	ENotifyPacketsHV1				= 0x00008000, /*!< HV1 */
   331 	ENotifyPacketsHV2				= 0x00010000, /*!< HV2 */
   332 	ENotifyPacketsHV3				= 0x00020000, /*!< HV3 */
   333 
   334 	ENotifyAuthenticationComplete	= 0x00040000, /*!< Authentication Complete */
   335 	ENotifyEncryptionChangeOn		= 0x00080000, /*!< Encryption Change On */
   336 	ENotifyEncryptionChangeOff		= 0x00100000, /*!< Encryption Change Off */
   337 
   338 	ENotifyPhysicalLinkUp			= 0x00200000, /*!< Physical Link Up */
   339 	ENotifyPhysicalLinkDown			= 0x00400000, /*!< Physical Link Down */
   340 	ENotifyPhysicalLinkError		= 0x00800000, /*!< Physical Link Error */
   341 
   342 	ENotifySynchronousLinkUp		= 0x01000000, /*!< Synchronous Link Up */
   343 	ENotifySynchronousLinkDown		= 0x02000000, /*!< Synchronous Link Down */
   344 	ENotifySynchronousLinkError		= 0x04000000, /*!< Synchronous Link Error */
   345 
   346 	
   347 	/**
   348 	@deprecated This has been superseded by ENotifySynchronousLinkUp
   349 	@see ENotifySynchronousLinkUp 
   350 	*/
   351 	ENotifySCOLinkUp				= ENotifySynchronousLinkUp,
   352 	/**
   353 	@deprecated This has been superseded by ENotifySynchronousLinkDown
   354 	@see ENotifySynchronousLinkDown 
   355 	*/
   356 	ENotifySCOLinkDown				= ENotifySynchronousLinkDown, 
   357 	/**
   358 	@deprecated This has been superseded by ENotifySynchronousLinkError
   359 	@see ENotifySynchronousLinkError 
   360 	*/
   361 	ENotifySCOLinkError				= ENotifySynchronousLinkError 
   362 
   363 	};
   364 
   365 /**
   366 @publishedAll
   367 @released
   368 
   369 Bitmask values to help request notification of the state of a physical link.
   370 @see TBTPhysicalLinkStateNotifier
   371 */
   372 enum TBTPhysicalLinkStateNotifierCombinations
   373 	{
   374 	ENotifyAnyRole					= ENotifyMaster | ENotifySlave,
   375 	ENotifyAnyLowPowerMode			= ENotifySniffMode | ENotifyParkMode | ENotifyHoldMode,
   376 	ENotifyAnyPowerMode				= ENotifyActiveMode | ENotifyAnyLowPowerMode,
   377 	ENotifyAnyMaxSlots				= ENotifyMaxSlots1 | ENotifyMaxSlots3 | ENotifyMaxSlots5,
   378 	ENotifyAnyACLPacketType			= ENotifyPacketsDM1 | ENotifyPacketsDH1 | ENotifyPacketsDM3 | EPacketsDH3 | EPacketsDM5 | EPacketsDH5,
   379 	ENotifyAnySCOPacketType			= ENotifyPacketsHV1 | ENotifyPacketsHV2 | ENotifyPacketsHV3,
   380 	ENotifyAnyPacketType			= ENotifyAnyACLPacketType | ENotifyAnySCOPacketType,
   381 	ENotifyAnyPhysicalLinkState		= 0xffffffff,
   382 	};
   383 
   384 /**
   385 @publishedAll
   386 @released
   387 
   388 The maximum length of an SDP UUID.
   389 */
   390 static const TInt KSdpUUIDMaxLength			= 16;
   391 
   392 /**
   393 @publishedAll
   394 @released
   395 
   396 The size of a bluetooth device address in bytes.
   397 */
   398 const TInt KBTDevAddrSize=0x06;
   399 
   400 /**
   401 @publishedAll
   402 @released
   403 
   404 The size of a bluetooth device address in bytes.
   405 */
   406 const TInt KBTMaxDevAddrSize = KBTDevAddrSize;
   407 
   408 /**
   409 @publishedAll
   410 @released
   411 
   412 48-bit bluetooth device address.
   413 Each bluetooth device has a unique address built into the hardware, which
   414 is represented by this class. Used for identifying remote addresses.
   415 The interface operates in a big-endian manner -- e.g. addr[0] refers
   416 to the most significant byte of the address. This is the same ordering
   417 as the addresses would naturally be written down on paper.
   418 **/
   419 NONSHARABLE_CLASS(TBTDevAddr)
   420 	{
   421 public:
   422 	IMPORT_C TBTDevAddr();
   423 	IMPORT_C TBTDevAddr(const TInt64 &aInt);
   424 	IMPORT_C TBTDevAddr(const TDesC8 &aDes);
   425 	IMPORT_C TBool operator==(const TBTDevAddr& aAddr) const;
   426 	IMPORT_C TBool operator!=(const TBTDevAddr& aAddr) const;
   427 	IMPORT_C const TUint8 &operator[](TInt aIndex) const;
   428 	IMPORT_C TUint8 &operator[](TInt aIndex);
   429 	IMPORT_C void Reset();
   430 	IMPORT_C TPtr8 Des();
   431 	IMPORT_C const TPtrC8 Des() const;
   432 	IMPORT_C TInt SetReadable(const TDesC& aSource);
   433 	IMPORT_C void GetReadable(TDes& aDest) const;
   434 	IMPORT_C void GetReadable(TDes& aDest, const TDesC& aPrepend, const TDesC& aByteSeperator, const TDesC& aAppend) const;
   435 	IMPORT_C TBool operator<=(const TBTDevAddr& aAddr) const;
   436 private:
   437 	TFixedArray<TUint8, KBTDevAddrSize> iAddr;
   438 
   439 	// This data padding has been added to help prevent future binary compatibility breaks	
   440 	// iPadding hasn't been zero'd because it is currently not used
   441 	TUint16		iPadding;
   442     };
   443 
   444 /** Array of device addresses
   445 @see Enumerate method
   446 */
   447 typedef RArray<TBTDevAddr> RBTDevAddrArray;
   448 
   449 /**
   450 @publishedAll
   451 @released
   452 
   453 A Bluetooth Universally Unique Identifier.
   454 
   455 This is a 128-bit quantity that can be created without a central registry 
   456 while still being globally unique.
   457 UUIDs are always held in full 128 bit format, however they can be set from 
   458 BT SIG short form (16 or 32 bit) addresses, and returned as down to their 
   459 shortest form using ShortestForm().
   460 **/
   461 NONSHARABLE_CLASS(TUUID)
   462 	{
   463 public:
   464 	IMPORT_C TUUID();
   465 	IMPORT_C TUUID(TUint32 aLong);
   466 	IMPORT_C TUUID(TUint32 aHH, TUint32 aHL, TUint32 aLH, TUint32 aLL);
   467 	IMPORT_C TUUID(const TUid& aUid);
   468 	IMPORT_C void SetL(const TDesC8& aDes);
   469 	IMPORT_C const TPtrC8 LongForm() const;
   470 	IMPORT_C const TPtrC8 ShortestForm() const;
   471 	IMPORT_C const TPtrC8 Des() const;
   472 	/**
   473 	@deprecated
   474 	Use SpecifiedLengthL(TInt aLength) instead
   475 	*/
   476 	IMPORT_C const TPtrC8 FixedLengthL(TInt aLength) const;
   477 	IMPORT_C TInt MinimumSize() const;
   478 	IMPORT_C TBool operator==(const TUUID& aUUID) const;
   479 	IMPORT_C TBool operator!=(const TUUID& aUUID) const;
   480 	IMPORT_C const TUint8 &operator[](TInt aIndex) const;
   481 	IMPORT_C TUint8 &operator[](TInt aIndex);
   482 	IMPORT_C const TPtrC8 SpecifiedLengthL(TInt aLength) const;
   483 	IMPORT_C void SetFromLittleEndianL(const TDesC8& aDes);
   484 private:
   485 	TFixedArray<TUint8, KSdpUUIDMaxLength> iUUID;	
   486 
   487 	// This data padding has been added to help prevent future binary compatibility breaks	
   488 	// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
   489 	TUint32		iPadding1;
   490 	TUint32		iPadding2;
   491 	};
   492 
   493 
   494 /**
   495 @publishedAll
   496 @released
   497 
   498 A UUID container class
   499 */
   500 NONSHARABLE_CLASS(RUUIDContainer)
   501 	{
   502 public:
   503 	IMPORT_C void Close();
   504 	IMPORT_C void Reset();
   505 	IMPORT_C TInt Count() const;
   506 	IMPORT_C TUUID& operator[](TInt aIndex);
   507 	IMPORT_C const TUUID& operator[](TInt aIndex) const;
   508 	IMPORT_C const TUUID& At(TInt aIndex) const;
   509 	IMPORT_C TBool IsPresent(const TUUID& aUuid) const;
   510 	IMPORT_C TInt Add(const TUUID& aUuid);
   511 
   512 private:
   513 	RArray<TUUID> iUUIDs;
   514 	
   515 	// This data padding has been added to help prevent future binary compatibility breaks
   516 	// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
   517 	TUint32		iPadding1;
   518 	TUint32		iPadding2;
   519 	};
   520 
   521 
   522 /**
   523 @publishedAll
   524 @released
   525 
   526 An EIR UUID container class. Contains UUIDs and indications of data completeness
   527 */
   528 NONSHARABLE_CLASS(RExtendedInquiryResponseUUIDContainer)
   529 	{
   530 public:
   531 	enum TUUIDType
   532 		{
   533 		EUUID16  = 0x1,
   534 		EUUID32  = 0x2,
   535 		EUUID128 = 0x4,
   536 		};
   537 	
   538 public:
   539 	IMPORT_C void Close();
   540 	IMPORT_C RUUIDContainer& UUIDs();
   541 	IMPORT_C void SetCompleteness(TUUIDType aType, TBool aIsComplete);
   542 	IMPORT_C TBool GetCompleteness(TUUIDType aType) const;
   543 
   544 private:
   545 	RUUIDContainer iUUIDs;
   546 	TInt iCompleteness;
   547 	
   548 	// This data padding has been added to help prevent future binary compatibility breaks
   549 	// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
   550 	TUint32     iPadding1;
   551 	TUint32     iPadding2;
   552 	};
   553 
   554 /**
   555 @publishedAll
   556 @released
   557 
   558 The size of a link key, in bytes.
   559 */
   560 const TUint8 KHCILinkKeySize=16;
   561 
   562 /**
   563 @publishedAll
   564 @released
   565 
   566 The size of a pin code, in bytes.
   567 */
   568 const TUint8 KHCIPINCodeSize=16;
   569 
   570 /**
   571 @publishedAll
   572 @released
   573 
   574 Link key structure.
   575 */
   576 NONSHARABLE_CLASS(TLinkKeyV10)
   577 	{
   578 public:
   579 	TUint8 iLinkKey[KHCILinkKeySize]; /*!< The link key */
   580 	};
   581 
   582 /**
   583 @publishedAll
   584 @released
   585 
   586 Typedef'ed TPckgBuf of the class TLinkKeyV10.
   587 */
   588 typedef TPckgBuf<TLinkKeyV10> TBTLinkKey;
   589 
   590 /**
   591 The type of a link key with a remote device
   592 @publishedAll
   593 @released
   594 */
   595 enum TBTLinkKeyType
   596 	{
   597 	ELinkKeyCombination,					/*!< this key has been generated with pairing with pre-v2.1 Bluetooth devices. */
   598 	ELinkKeyUnauthenticatedUpgradable,		/*!< this key hasn't yet been tried with MITM protection */
   599 	ELinkKeyUnauthenticatedNonUpgradable,	/*!< this key tried MITM protection; remote device incapable */
   600 	ELinkKeyAuthenticated,					/*!< this key authenticated with MITM protection */
   601 	ELinkKeyDebug							/*!< this key has been generated when in simple pairing debug mode */
   602 	};
   603 
   604 /**
   605 @publishedAll
   606 @released
   607 
   608 Bluetooth PIN Code structure.
   609 */
   610 NONSHARABLE_CLASS(TPINCodeV10)
   611 	{
   612 public:
   613 	IMPORT_C TBool operator==(const TPINCodeV10& aTPINCodeV10) const;
   614 	
   615 public:
   616 	TUint8 iLength; /*!< The length of the pin key */
   617 	TUint8 iPIN[KHCIPINCodeSize]; /*!< The pin code */
   618 	};
   619 
   620 /**
   621 @publishedAll
   622 @released
   623 
   624 Typedef'ed TPckgBuf of the class TPINCodeV10.
   625 */
   626 typedef TPckgBuf<TPINCodeV10> TBTPinCode;
   627 
   628 
   629 /**
   630 Extended Inquiry Response Class
   631 This class takes a reference from inquiry result, which could hold both local name and Extended Inquiry Response. 
   632 It provides API to parse and return the local name and data for any Extended Inquiry Response tag.
   633 To get Device Name, Manufacturer Specific Data or Flags, firstly getting length of the data, 
   634 and then allocating a suitable buffer, which is where the data will be placed. 
   635 */
   636 NONSHARABLE_CLASS(TBluetoothNameRecordWrapper)
   637 {
   638 public:
   639 	IMPORT_C explicit TBluetoothNameRecordWrapper(const TNameRecord& aNameRecord);
   640 	IMPORT_C TInt GetDeviceName(TDes16& aName, TBool& aIsComplete) const;
   641 	IMPORT_C TInt GetServiceClassUuids(RExtendedInquiryResponseUUIDContainer& aEIRContainer) const;
   642 	IMPORT_C TInt GetVendorSpecificData(TDes8& aDes) const;
   643 	IMPORT_C TInt GetTxPowerLevel(TInt8& aTxPowerLevel) const;
   644 	IMPORT_C TInt GetFlags(TDes8& aDes) const;
   645 	IMPORT_C TInt GetDeviceNameLength() const;
   646 	IMPORT_C TInt GetVendorSpecificDataLength() const;
   647 	IMPORT_C TInt GetFlagsLength() const;
   648 
   649 private:
   650 	TInt AddUuids16(RExtendedInquiryResponseUUIDContainer& aEIRContainer, TPtrC8& aUuids) const;
   651 	TInt AddUuids128(RExtendedInquiryResponseUUIDContainer& aEIRContainer, TPtrC8& aUuids) const;
   652 private:
   653 	TExtendedInquiryResponseDataCodec iEirCodec;
   654 	
   655 	// This data padding has been added to help prevent future binary compatibility breaks	
   656 	// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
   657 	TUint32		iPadding1;
   658 	TUint32		iPadding2;
   659 };
   660 
   661 /**
   662 @publishedAll
   663 @released
   664 
   665 Contains information resulting from a baseband notification.
   666 */
   667 NONSHARABLE_CLASS(TBTBasebandEventNotification)
   668 	{
   669 public:
   670 	/** 
   671 	Constructor.
   672 	@param aEventType The type of event.
   673 	@param aErrorCode The error code.
   674 	*/
   675 	TBTBasebandEventNotification(TUint32 aEventType, TInt aErrorCode = KErrNone) : iEventType(aEventType), iErrorCode(aErrorCode) {};
   676 
   677 	/**
   678 	Default constructor.
   679 	*/
   680 	TBTBasebandEventNotification() : iEventType(0), iErrorCode(KErrNone) {};
   681 
   682 	/**
   683 	Copy constructor.
   684 	@param aEvent The event to copy.
   685 	*/
   686 	TBTBasebandEventNotification(const TBTBasebandEventNotification& aEvent) : iEventType(aEvent.iEventType), iErrorCode(aEvent.iErrorCode) {};
   687 
   688 	/**
   689 	The event type.
   690 	@return The event type.
   691 	*/
   692 	TUint32 EventType() const	{ return iEventType; };
   693 
   694 	/**
   695 	The Bluetooth SIG error code associated with the event.
   696 	@return The SIG error code.
   697 	*/
   698 	TInt ErrorCode() const		{ return iErrorCode; };
   699 
   700 	/**
   701 	The Symbian HCI error code associated with the event.
   702 	@return The Symbian error code.
   703 	*/
   704 	IMPORT_C TInt SymbianErrorCode() const;
   705 
   706 	/**
   707 	Set the event type.
   708 	@param aEventType The event type.
   709 	*/
   710 	void SetEventType(TUint32 aEventType)	{ iEventType = aEventType; };
   711 
   712 	/**
   713 	Set the error code.
   714 	@param aErrorCode The Bluetooth SIG error code.
   715 	*/
   716 	void SetErrorCode(TInt aErrorCode)		{ iErrorCode = aErrorCode; };
   717 
   718 private:
   719 	TUint32 iEventType;
   720 	TInt iErrorCode;
   721 	};
   722 
   723 /**
   724 @publishedAll
   725 @released
   726 
   727 Typedef'ed pckgbuf of the class TBTBasebandEventNotification.
   728 */
   729 typedef TPckgBuf<TBTBasebandEventNotification> TBTBasebandEvent;
   730 
   731 /**
   732 @publishedAll
   733 @released
   734 
   735 General Unlimited Inquiry Access Code
   736 */
   737 const TUint KGIAC=0x9e8b33;
   738 
   739 /**
   740 @publishedAll
   741 @released
   742 
   743 Limited Inquiry Access Code
   744 */
   745 const TUint KLIAC=0x9e8b00;
   746 
   747 /**
   748 L2CAP channel modes
   749 @publishedAll
   750 @released
   751 */
   752 enum TL2CapChannelMode
   753 	{
   754 	EL2CAPBasicMode 					= 0x00,
   755 	EL2CAPRetransmissionMode 			= 0x01,
   756 	EL2CAPFlowControlMode 				= 0x02,
   757 	EL2CAPEnhancedRetransmissionMode	= 0x03,
   758 	EL2CAPStreamingMode					= 0x04,
   759 	};
   760 
   761 /**
   762 @publishedAll
   763 @released
   764 
   765 API class for setting up an L2Cap channel configuration.
   766 
   767 This class may be used to set all or a subset of the following configuration
   768 items:
   769 Channel Reliability (and associated timer)
   770 Maximum Transmission Unit (MTU) value preferred during MTU negotiation
   771 Maximum Receive Unit (MRU) value preferred during MRU negotiation
   772 Minimum MTU value acceptable during MTU negotiation
   773 Minimum MRU value acceptable during MRU negotiation
   774 Channel Priority
   775 
   776 If a configuration item is to be set, then its 'Set' or 'Configure'
   777 method should be called.
   778 
   779 Once a TL2CapConfig object has been set up it can be used to configure a socket
   780 using RSocket::SetOption or RSocket::Ioctl (or the CBluetoothSocket equivalents).
   781 
   782 If the preferred Maximum Transmission Unit (MTU) value is specified but its
   783 minimum acceptable value is not specified in the same object, then the minimum
   784 acceptable value will be implicitly taken to be equal to the preferred MTU by
   785 the L2CAP APIs processing the object. This means that only an MTU greater than or
   786 equal to the preferred MTU will be accepted from the peer during negotiation.
   787 
   788 If the Maximum Receive Unit (MRU) value is specified but its minimum acceptable
   789 value is not, then the minimum acceptable value is implicitly taken to be equal
   790 to the protocol minimum (48 bytes) by the L2CAP APIs processing the object.
   791 
   792 Note that even though this API allows setting of Obsolescence timer, outgoing
   793 packet flushing may not be supported on all hardware.
   794 
   795 @see RSocket
   796 @see CBluetoothSocket
   797 */
   798 NONSHARABLE_CLASS(TL2CapConfig)
   799 	{
   800 public:
   801 	/**	
   802 	Priority required for data on L2Cap channel
   803 	*/
   804 	enum TChannelPriority
   805 		{
   806 		EHigh		= 2,
   807 		EMedium		= 1,
   808 		ELow		= 0,
   809 		};
   810 
   811 	/**	
   812 	Reliability of data transfer preferred for L2Cap channel.
   813 	*/
   814 	enum TChannelReliability
   815 		{
   816 		EReliableChannel,
   817 		EUnreliableChannel,
   818 		EUnreliableDesiredChannel
   819 		};	
   820 
   821 	/**	
   822 	Timer values in milliseconds for reliable and unreliable channels
   823 	*/
   824 	enum TL2CapConfigSpecifiedTimers
   825 		{
   826 		/**
   827 		This is a time in milliseconds. However 0xffff has been given a special
   828 		meaning in this interface.  It means "Allow maximum possible number of
   829 		transmissions of a single packet before giving up and disconnecting the
   830 		L2Cap channel." This is the maximum number of transmissions effectively
   831 		allowed by the spec. It only applies to reliable modes and is 255 for
   832 		Retransmission Mode and Infinity for Enhanced Retransmission Mode.
   833 		*/
   834 		EDefaultRetransmission = 0xffff,
   835 		/**
   836 		Minimum data obsolescence timeout required because data packets 
   837 		will not ever be sent if we flush them too quickly.
   838 		Speed of sending data depends on how many channels are open and channel priority.
   839 		Note that flushing of outgoing packets may not be implemented on all Symbian OS
   840 		platforms.
   841 		*/
   842 		EMinDataObsolescenceTimeout = 0x0a,
   843 		/**
   844 		This is translated to mean never flush (as per spec).
   845 		*/
   846 		EDefaultDataObsolescenceTimeout = 0xffff, 
   847 		};	
   848 
   849 	/**	
   850 	Used to indicate which config options have been specified by the user
   851 	*/
   852 	enum TL2CapConfigSpecifiedMask
   853 		{
   854 		ENoConfigElementsSpecified			= 0x0000,
   855 		EMTUSizeSpecifiedMask				= 0x0001,
   856 		EMRUSizeSpecifiedMask				= 0x0002,
   857 		EReliabilitySpecifiedMask			= 0x0004,
   858 		EPrioritySpecifiedMask				= 0x0008,
   859 		EMinMTUSizeSpecifiedMask			= 0x0010,
   860 		EMinMRUSizeSpecifiedMask			= 0x0020,
   861 		ELegacyModesDisallowedSpecifiedMask	= 0x0040
   862 		};
   863 		
   864 	IMPORT_C TL2CapConfig();
   865 
   866 	IMPORT_C TInt SetMaxTransmitUnitSize(TUint16 aSize = 0xffff);
   867 	IMPORT_C TUint16 MaxTransmitUnitSize(TBool& aIsSpecified) const;
   868 	IMPORT_C TInt SetMaxReceiveUnitSize(TUint16 aSize = 0xffff);
   869 	IMPORT_C TUint16 MaxReceiveUnitSize(TBool& aIsSpecified) const;
   870 	
   871 	IMPORT_C TInt SetMinMTU(TUint16 aSize);
   872 	IMPORT_C TUint16 MinMTU(TBool& aIsSpecified) const;
   873 
   874 	IMPORT_C TInt SetMinMRU(TUint16 aSize);
   875 	IMPORT_C TUint16 MinMRU(TBool& aIsSpecified) const;
   876 
   877 	IMPORT_C TInt ConfigureReliableChannel(TUint16 aRetransmissionTimer);
   878 	IMPORT_C TInt ConfigureUnreliableChannel(TUint16 aObsolescenceTimer);
   879 	IMPORT_C TInt ConfigureUnreliableDesiredChannel(TUint16 aObsolescenceTimer, TUint16 aRetransmissionTimer);
   880 	IMPORT_C void SetLegacyModesDisallowed(TBool aDisallowed);
   881 	IMPORT_C TBool LegacyModesDisallowed() const;
   882 
   883 	IMPORT_C TChannelReliability ChannelReliability(TBool& aIsSpecified, TUint16& aAssociatedTimer) const;
   884 
   885 	IMPORT_C TChannelReliability ChannelReliability(TBool& aIsSpecified) const;
   886 	IMPORT_C TUint16 RetransmissionTimer(TBool& aIsSpecified) const;
   887 	IMPORT_C TUint16 ObsolescenceTimer(TBool& aIsSpecified) const;
   888 	
   889 	IMPORT_C TInt ConfigureChannelPriority(TChannelPriority aPriority);
   890 	IMPORT_C TChannelPriority ChannelPriority(TBool& aIsSpecified) const;
   891 
   892 	/**
   893 	@deprecated
   894 	Use ConfigureReliableChannel(TUint16 aRetransmissionTimer) instead
   895 	*/
   896 	IMPORT_C TInt SetupReliableChannel(TUint16 aRetransmissionTimer = EDefaultRetransmission);
   897 	/**
   898 	@deprecated
   899 	Use ConfigureUnreliableChannel(TUint16 aObsolescenceTimer) instead
   900 	*/
   901 	IMPORT_C TInt SetupUnreliableChannel(TUint16 aObsolescenceTimer = EDefaultDataObsolescenceTimeout);
   902 	/**
   903 	@deprecated
   904 	Use ConfigureChannelPriority(TChannelPriority aPriority) instead
   905 	*/
   906 	IMPORT_C TInt SetChannelPriority(TChannelPriority aPriority = ELow);
   907 
   908 private:
   909 	TUint16				iMTUSize;
   910 	TUint16				iMRUSize;
   911 	TChannelReliability	iChannelReliability;
   912 	TUint16				iChannelReliabilityTimer;	// see note below
   913 	TChannelPriority	iChannelPriority;
   914 	TUint16				iSpecifiedMask;
   915 	TUint16 			iMinMTUSize;	// Minimum acceptable MTU.
   916 	TUint16				iMinMRUSize;	// Minimum acceptable MRU.
   917 	TUint16				iAdditionalChannelReliabilityTimer;	// see note below
   918 	// This data padding has been added to help prevent future binary compatibility breaks.
   919 	TUint16				iPadding;
   920 
   921 	// Note on the timer fields:
   922 	// iAdditionalChannelReliabilityTimer has been added when a need to pass two timers within
   923 	// one object arose. To maintain BC with existing clients of this class, when a single timer
   924 	// is passed, it's always stored in iChannelReliabilityTimer. Changing this to just having
   925 	// iRetransmissionTimer & iObsolescenceTimer would break BC.
   926 	// When both timers are stored, Flush timeout goes in iChannelReliabilityTimer and
   927 	// Retransmission timeout goes in iAdditionalChannelReliabilityTimer.
   928 	};
   929 
   930 /**
   931 @publishedAll
   932 @released
   933 
   934 Typedef to represent a L2CAP Config object.
   935 */
   936 typedef TPckgBuf<TL2CapConfig> TL2CapConfigPkg;
   937 
   938 
   939 enum TEirWrapperPanics
   940 	{
   941 	EEirBadUuid16List = 0,
   942 	EEirBadUuid128List = 1,
   943 	};
   944 _LIT(KEirWrapperPanicName, "ExtendedInquiryResponseWrapper");
   945 
   946 #endif	//_BTTYPES_H