williamr@2: // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@2: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // BT protocol wide types williamr@2: // williamr@2: // williamr@2: williamr@2: #ifndef _BTTYPES_H williamr@2: #define _BTTYPES_H williamr@2: williamr@4: #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS williamr@4: #include williamr@4: #endif williamr@4: williamr@2: #include williamr@2: #include williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Minimum eSCO connection latency in milliseconds. Attempts to specify less than this will be silently williamr@2: increased to this level. williamr@2: */ williamr@2: static const TInt KMinESCOLatency = 4; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Typedef to represent a HCI connection handle. williamr@2: */ williamr@2: typedef TUint16 THCIConnHandle; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Bluetooth SIG specified values for specification of (piconet) role. williamr@2: */ williamr@2: enum TBTBasebandRole williamr@2: { williamr@2: EMaster = 0x00, /*!< Master role */ williamr@2: ESlave = 0x01, /*!< Slave role */ williamr@2: ERoleUnknown, /*!< Unknown role */ williamr@2: }; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Bluetooth SIG specified values for indicating link modes. williamr@2: */ williamr@2: enum TBTLinkMode williamr@2: { williamr@2: EActiveMode = 0x00, /*!< Active mode */ williamr@2: EHoldMode = 0x01, /*!< Hold mode */ williamr@2: ESniffMode = 0x02, /*!< Sniff mode */ williamr@2: EParkMode = 0x04, /*!< Park mode */ williamr@2: EScatterMode = 0x08, /*!< Scatter mode */ williamr@2: }; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Typedef to represent a union of TBTLinkMode values. williamr@2: */ williamr@2: typedef TUint32 TBTLinkModeSet; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Bitmask values to help request combinations of link modes. williamr@2: @see TBTLinkMode williamr@2: */ williamr@2: enum TBTLinkModeCombinations williamr@2: { williamr@2: EAnyLowPowerMode = (EHoldMode | ESniffMode | EParkMode | EScatterMode) /*!< Any low power mode */ williamr@2: }; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Bluetooth SIG specified values for indicating packet types. williamr@2: williamr@2: DM1, DH1, DM3, DH3, DM5, DH5 are ACL packet types williamr@2: HV1, HV2, HV3 are SCO (synchronous link) packet types williamr@2: */ williamr@2: enum TBTPacketType williamr@2: { williamr@2: EPacketsDM1 = 0x0008, /*!< DM1 ACL packet type */ williamr@2: EPacketsDH1 = 0x0010, /*!< DH1 ACL packet type */ williamr@2: EPacketsDM3 = 0x0400, /*!< DM3 ACL packet type */ williamr@2: EPacketsDH3 = 0x0800, /*!< DH3 ACL packet type */ williamr@2: EPacketsDM5 = 0x4000, /*!< DM5 ACL packet type */ williamr@2: EPacketsDH5 = 0x8000, /*!< DH5 ACL packet type */ williamr@2: williamr@2: EPackets2_DH1 = 0x0002, /*!< 2-DH1 ACL packet type */ williamr@2: EPackets3_DH1 = 0x0004, /*!< 3-DH1 ACL packet type */ williamr@2: EPackets2_DH3 = 0x0100, /*!< 2-DH3 ACL packet type */ williamr@2: EPackets3_DH3 = 0x0200, /*!< 3-DH3 ACL packet type */ williamr@2: EPackets2_DH5 = 0x1000, /*!< 2-DH5 ACL packet type */ williamr@2: EPackets3_DH5 = 0x2000, /*!< 3-DH5 ACL packet type */ williamr@2: williamr@2: EPacketsHV1 = 0x0020, /*!< HV1 SCO packet type */ williamr@2: EPacketsHV2 = 0x0040, /*!< HV2 SCO packet type */ williamr@2: EPacketsHV3 = 0x0080, /*!< HV3 SCO packet type */ williamr@2: }; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Typedef to represent a set of SCO packet types. williamr@2: */ williamr@2: typedef TUint16 TBTSCOPackets; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Typedef to represent a set of ACL packet types. williamr@2: */ williamr@2: typedef TUint16 TBTACLPackets; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Bitmask values to help request combinations of packets. williamr@2: @see TBTPacketType williamr@2: */ williamr@2: enum TBTPacketTypeCombinations williamr@2: { williamr@2: EAnyACLPacket = EPacketsDM1 | EPacketsDM3 | EPacketsDM5 | EPacketsDH1 | EPacketsDH3 | EPacketsDH5, /*!< Any ACL packet */ williamr@2: EAnyNonEdrACLPacket = EAnyACLPacket | EPackets2_DH1 | EPackets3_DH1 | EPackets2_DH3 | EPackets3_DH3 | EPackets2_DH5 | EPackets3_DH5, /*!< Any Non-EDR ACL packet */ williamr@2: EAnySCOPacket = EPacketsHV1 | EPacketsHV2 | EPacketsHV3, /*!< Any SCO packet */ williamr@2: EAnyPacket = EAnyACLPacket | EAnySCOPacket /*!< Any packet */ williamr@2: }; williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Typedef to represent a set of synchronous packet types (SCO and eSCO on v1.2). williamr@2: @see TBTSyncPackets::TSyncPackets williamr@2: */ williamr@2: typedef TUint32 TBTSyncPacketTypes; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @deprecated williamr@2: williamr@2: This constant is no longer needed to translate the SCO mapping of HV packet types to Synchronous williamr@2: because CBluetoothSynchronousLink::SetupConnection(const TBTDevAddr& aBDAddr, const TUint16 aPacketTypes) williamr@2: adjusts aPacketTypes internally on behalf of clients. williamr@2: */ williamr@2: static const TInt KSCOvsSyncHVOffset = 5; williamr@2: williamr@4: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Class to represent a set of synchronous packet types (SCO and eSCO on v1.2). williamr@2: This differs from TBTSyncPacketTypes as it is the interface used by CBluetoothSynchronousLink williamr@2: in order to detect the difference between a pre and post eSCO caller. This is necessary williamr@2: as HV1 packets in the SCO numbering clash with EV5 packets in the sync numbering. williamr@2: */ williamr@2: NONSHARABLE_CLASS(TBTSyncPackets) williamr@2: { williamr@2: public: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Individual synchronous packet types. williamr@2: @see TBTSyncPacketTypes williamr@2: */ williamr@2: enum TSyncPackets williamr@2: { williamr@2: ESyncPacketsHV1 = 0x10001, williamr@2: ESyncPacketsHV2 = 0x10002, williamr@2: ESyncPacketsHV3 = 0x10004, williamr@2: williamr@2: ESyncPacketsEV3 = 0x20008, williamr@2: ESyncPacketsEV4 = 0x20010, williamr@2: ESyncPacketsEV5 = 0x20020, williamr@2: williamr@2: ESyncAnySCOPacket = ESyncPacketsHV1 | ESyncPacketsHV2 | ESyncPacketsHV3, williamr@2: ESyncAnyESCOPacket = ESyncPacketsEV3 | ESyncPacketsEV4 | ESyncPacketsEV5 williamr@2: }; williamr@2: williamr@2: public: williamr@2: IMPORT_C explicit TBTSyncPackets(TBTSyncPacketTypes aPackets); williamr@2: IMPORT_C TBTSyncPacketTypes operator()() const; williamr@2: williamr@2: private: williamr@2: TUint32 iPacketTypes; williamr@2: williamr@2: // This data padding has been added to help prevent future binary compatibility breaks williamr@2: // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used williamr@4: TUint32 iPadding1; williamr@4: TUint32 iPadding2; williamr@2: }; williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: eSCO links can have different retransmission options, optimised for link usage, williamr@2: power or reliability. williamr@2: williamr@2: @see CBluetoothSynchronousLink::SetRetransmissionEffort williamr@2: */ williamr@2: enum TBTeSCORetransmissionTypes williamr@2: { williamr@2: EeSCORetransmitNone = 0, williamr@2: EeSCORetransmitPower = 1, williamr@2: EeSCORetransmitReliability = 2, williamr@2: EeSCORetransmitDontCare = 0xff williamr@2: }; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: eSCO unspecified bandwidth. This value can only be used by the accepting side williamr@2: of an eSCO link, to allow any bandwidth to be specified by the initiator. williamr@2: Otherwise both sides of the link must agree on the same bandwidth. williamr@2: williamr@2: @see CBluetoothSynchronousLink::SetBandwidth williamr@2: @see CBluetoothSynchronousLink::AcceptConnection williamr@2: */ williamr@2: static const TUint32 KESCOBandwidthDontCare = KMaxTUint32; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Bluetooth SIG specified values indicating whether a device williamr@2: is physically able to support a baseband (or link manager protocol) feature williamr@2: */ williamr@2: enum TBTSupportedFeatures williamr@2: { williamr@2: ESupportedThreeSlotPackets = 1<<0, /*!< Three slot packets are supported */ williamr@2: ESupportedFiveSlotPackets = 1<<1, /*!< Five slot packets are supported */ williamr@2: ESupportedEncryption = 1<<2, /*!< Encryption is supported */ williamr@2: ESupportedSlotOffset = 1<<3, /*!< Slot offset is supported */ williamr@2: ESupportedTimingAccuracy = 1<<4, /*!< Timing accuracy is supported */ williamr@2: ESupportedSwitch = 1<<5, /*!< Role switch is supported */ williamr@2: ESupportedHoldMode = 1<<6, /*!< Hold mode is supported */ williamr@2: ESupportedSniffMode = 1<<7, /*!< Sniff mode is supported */ williamr@2: ESupportedParkMode = 1<<8, /*!< Park mode is supported */ williamr@2: ESupportedRSSI = 1<<9, /*!< Receive signal strength indication is supported */ williamr@2: ESupportedChannelQualityDrivenDataRate = 1<<10, /*!< Channel quality driven data rate is supported */ williamr@2: ESupportedSCOLink = 1<<11, /*!< SCO links are supported */ williamr@2: ESupportedHV2Packets = 1<<12, /*!< HV2 packets are supported */ williamr@2: ESupportedHV3Packets = 1<<13, /*!< HV3 packets are supported */ williamr@2: ESupportedu_lawLog = 1<<14, /*!< SCO u-law encoding is supported */ williamr@2: ESupportedA_lawLog = 1<<15, /*!< SCO A-law encoding is supported */ williamr@2: ESupportedCVSD = 1<<16, /*!< SCO Continuously variable slope delta modulation is supported */ williamr@2: ESupportedPagingScheme = 1<<17, /*!< Paging scheme is supported */ williamr@2: ESupportedPowerControl = 1<<18, /*!< Power control is supported */ williamr@2: ESupportedTransparentSCOData = 1<<19, /*!< Transparent SCO data is supported */ williamr@2: ESupportedFlowControlLagBit0 = 1<<20, /*!< Flow control lag bit 0 is supported */ williamr@2: ESupportedFlowControlLagBit1 = 1<<21, /*!< Flow control lag bit 1 is supported */ williamr@2: ESupportedFlowControlLagBit2 = 1<<22, /*!< Flow control lag bit 2 is supported */ williamr@2: }; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Bitmask values for notifying/requesting notification of the state of a physical link. williamr@2: williamr@2: These values have a two fold purpose: williamr@2: 1) They can be used along with TBTPhysicalLinkStateNotifierCombinations to specify williamr@2: a set of baseband change events for which notification is desired. williamr@2: 2) They can be used to notify the state of a physical link or a subset of that state. williamr@2: For example if only mode change events are being monitored, then at each mode change event williamr@2: only the bit reperesenting the new mode will be returned, however if the whole link state williamr@2: is required, then a combination of bit values indicating that state will be returned. williamr@2: williamr@2: THESE BIT VALUES MUST ONLY BE USED WHEN REQUESTING NOTIFICATION, OR WHEN PARSING THE williamr@2: RESULTS OF A NOTIFICATION. All other baseband state activities should use one of the williamr@2: appropriate Bluetooth SIG specified enums williamr@2: @see TBTBasebandRole williamr@2: @see TBTLinkMode williamr@2: @see TBTLinkModeCombinations williamr@2: @see TBTPacketType williamr@2: @see TBTPacketTypeCombinations williamr@2: */ williamr@2: enum TBTPhysicalLinkStateNotifier williamr@2: { williamr@2: ENotifyMaster = 0x00000001, /*!< Master */ williamr@2: ENotifySlave = 0x00000002, /*!< Slave */ williamr@2: williamr@2: ENotifyActiveMode = 0x00000004, /*!< Active mode */ williamr@2: ENotifySniffMode = 0x00000008, /*!< Sniff mode */ williamr@2: ENotifyParkMode = 0x00000010, /*!< Park mode */ williamr@2: ENotifyHoldMode = 0x00000020, /*!< Hold mode */ williamr@2: williamr@2: ENotifyMaxSlots1 = 0x00000040, /*!< Max slots 1 */ williamr@2: ENotifyMaxSlots3 = 0x00000080, /*!< Max slots 3 */ williamr@2: ENotifyMaxSlots5 = 0x00000100, /*!< Max slots 5 */ williamr@2: williamr@2: ENotifyPacketsDM1 = 0x00000200, /*!< Packets DM1 */ williamr@2: ENotifyPacketsDH1 = 0x00000400, /*!< Packets DH1 */ williamr@2: ENotifyPacketsDM3 = 0x00000800, /*!< Packets DM3 */ williamr@2: ENotifyPacketsDH3 = 0x00001000, /*!< Packets DH3 */ williamr@2: ENotifyPacketsDM5 = 0x00002000, /*!< Packets DM5 */ williamr@2: ENotifyPacketsDH5 = 0x00004000, /*!< Packets DH5 */ williamr@2: williamr@2: ENotifyPacketsHV1 = 0x00008000, /*!< HV1 */ williamr@2: ENotifyPacketsHV2 = 0x00010000, /*!< HV2 */ williamr@2: ENotifyPacketsHV3 = 0x00020000, /*!< HV3 */ williamr@2: williamr@2: ENotifyAuthenticationComplete = 0x00040000, /*!< Authentication Complete */ williamr@2: ENotifyEncryptionChangeOn = 0x00080000, /*!< Encryption Change On */ williamr@2: ENotifyEncryptionChangeOff = 0x00100000, /*!< Encryption Change Off */ williamr@2: williamr@2: ENotifyPhysicalLinkUp = 0x00200000, /*!< Physical Link Up */ williamr@2: ENotifyPhysicalLinkDown = 0x00400000, /*!< Physical Link Down */ williamr@2: ENotifyPhysicalLinkError = 0x00800000, /*!< Physical Link Error */ williamr@2: williamr@2: ENotifySynchronousLinkUp = 0x01000000, /*!< Synchronous Link Up */ williamr@2: ENotifySynchronousLinkDown = 0x02000000, /*!< Synchronous Link Down */ williamr@2: ENotifySynchronousLinkError = 0x04000000, /*!< Synchronous Link Error */ williamr@2: williamr@4: williamr@2: /** williamr@4: @deprecated This has been superseded by ENotifySynchronousLinkUp williamr@4: @see ENotifySynchronousLinkUp williamr@4: */ williamr@4: ENotifySCOLinkUp = ENotifySynchronousLinkUp, williamr@4: /** williamr@4: @deprecated This has been superseded by ENotifySynchronousLinkDown williamr@4: @see ENotifySynchronousLinkDown williamr@4: */ williamr@4: ENotifySCOLinkDown = ENotifySynchronousLinkDown, williamr@4: /** williamr@4: @deprecated This has been superseded by ENotifySynchronousLinkError williamr@4: @see ENotifySynchronousLinkError williamr@4: */ williamr@4: ENotifySCOLinkError = ENotifySynchronousLinkError williamr@2: williamr@2: }; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Bitmask values to help request notification of the state of a physical link. williamr@2: @see TBTPhysicalLinkStateNotifier williamr@2: */ williamr@2: enum TBTPhysicalLinkStateNotifierCombinations williamr@2: { williamr@2: ENotifyAnyRole = ENotifyMaster | ENotifySlave, williamr@2: ENotifyAnyLowPowerMode = ENotifySniffMode | ENotifyParkMode | ENotifyHoldMode, williamr@2: ENotifyAnyPowerMode = ENotifyActiveMode | ENotifyAnyLowPowerMode, williamr@2: ENotifyAnyMaxSlots = ENotifyMaxSlots1 | ENotifyMaxSlots3 | ENotifyMaxSlots5, williamr@2: ENotifyAnyACLPacketType = ENotifyPacketsDM1 | ENotifyPacketsDH1 | ENotifyPacketsDM3 | EPacketsDH3 | EPacketsDM5 | EPacketsDH5, williamr@2: ENotifyAnySCOPacketType = ENotifyPacketsHV1 | ENotifyPacketsHV2 | ENotifyPacketsHV3, williamr@2: ENotifyAnyPacketType = ENotifyAnyACLPacketType | ENotifyAnySCOPacketType, williamr@2: ENotifyAnyPhysicalLinkState = 0xffffffff, williamr@2: }; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: The maximum length of an SDP UUID. williamr@2: */ williamr@2: static const TInt KSdpUUIDMaxLength = 16; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: The size of a bluetooth device address in bytes. williamr@2: */ williamr@2: const TInt KBTDevAddrSize=0x06; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: The size of a bluetooth device address in bytes. williamr@2: */ williamr@2: const TInt KBTMaxDevAddrSize = KBTDevAddrSize; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: 48-bit bluetooth device address. williamr@2: Each bluetooth device has a unique address built into the hardware, which williamr@2: is represented by this class. Used for identifying remote addresses. williamr@2: The interface operates in a big-endian manner -- e.g. addr[0] refers williamr@2: to the most significant byte of the address. This is the same ordering williamr@2: as the addresses would naturally be written down on paper. williamr@2: **/ williamr@2: NONSHARABLE_CLASS(TBTDevAddr) williamr@4: { williamr@2: public: williamr@4: IMPORT_C TBTDevAddr(); williamr@4: IMPORT_C TBTDevAddr(const TInt64 &aInt); williamr@4: IMPORT_C TBTDevAddr(const TDesC8 &aDes); williamr@4: IMPORT_C TBool operator==(const TBTDevAddr& aAddr) const; williamr@4: IMPORT_C TBool operator!=(const TBTDevAddr& aAddr) const; williamr@2: IMPORT_C const TUint8 &operator[](TInt aIndex) const; williamr@2: IMPORT_C TUint8 &operator[](TInt aIndex); williamr@2: IMPORT_C void Reset(); williamr@2: IMPORT_C TPtr8 Des(); williamr@2: IMPORT_C const TPtrC8 Des() const; williamr@2: IMPORT_C TInt SetReadable(const TDesC& aSource); williamr@2: IMPORT_C void GetReadable(TDes& aDest) const; williamr@2: IMPORT_C void GetReadable(TDes& aDest, const TDesC& aPrepend, const TDesC& aByteSeperator, const TDesC& aAppend) const; williamr@4: IMPORT_C TBool operator<=(const TBTDevAddr& aAddr) const; williamr@2: private: williamr@2: TFixedArray iAddr; williamr@2: williamr@2: // This data padding has been added to help prevent future binary compatibility breaks williamr@2: // iPadding hasn't been zero'd because it is currently not used williamr@4: TUint16 iPadding; williamr@2: }; williamr@2: williamr@4: /** Array of device addresses williamr@4: @see Enumerate method williamr@4: */ williamr@4: typedef RArray RBTDevAddrArray; williamr@4: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: A Bluetooth Universally Unique Identifier. williamr@2: williamr@2: This is a 128-bit quantity that can be created without a central registry williamr@2: while still being globally unique. williamr@2: UUIDs are always held in full 128 bit format, however they can be set from williamr@2: BT SIG short form (16 or 32 bit) addresses, and returned as down to their williamr@2: shortest form using ShortestForm(). williamr@2: **/ williamr@2: NONSHARABLE_CLASS(TUUID) williamr@2: { williamr@2: public: williamr@2: IMPORT_C TUUID(); williamr@2: IMPORT_C TUUID(TUint32 aLong); williamr@2: IMPORT_C TUUID(TUint32 aHH, TUint32 aHL, TUint32 aLH, TUint32 aLL); williamr@2: IMPORT_C TUUID(const TUid& aUid); williamr@2: IMPORT_C void SetL(const TDesC8& aDes); williamr@2: IMPORT_C const TPtrC8 LongForm() const; williamr@2: IMPORT_C const TPtrC8 ShortestForm() const; williamr@2: IMPORT_C const TPtrC8 Des() const; williamr@2: /** williamr@2: @deprecated williamr@2: Use SpecifiedLengthL(TInt aLength) instead williamr@2: */ williamr@2: IMPORT_C const TPtrC8 FixedLengthL(TInt aLength) const; williamr@2: IMPORT_C TInt MinimumSize() const; williamr@4: IMPORT_C TBool operator==(const TUUID& aUUID) const; williamr@4: IMPORT_C TBool operator!=(const TUUID& aUUID) const; williamr@2: IMPORT_C const TUint8 &operator[](TInt aIndex) const; williamr@2: IMPORT_C TUint8 &operator[](TInt aIndex); williamr@2: IMPORT_C const TPtrC8 SpecifiedLengthL(TInt aLength) const; williamr@2: IMPORT_C void SetFromLittleEndianL(const TDesC8& aDes); williamr@2: private: williamr@2: TFixedArray iUUID; williamr@2: williamr@2: // This data padding has been added to help prevent future binary compatibility breaks williamr@2: // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used williamr@2: TUint32 iPadding1; williamr@2: TUint32 iPadding2; williamr@2: }; williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: A UUID container class williamr@2: */ williamr@2: NONSHARABLE_CLASS(RUUIDContainer) williamr@2: { williamr@2: public: williamr@2: IMPORT_C void Close(); williamr@2: IMPORT_C void Reset(); williamr@2: IMPORT_C TInt Count() const; williamr@2: IMPORT_C TUUID& operator[](TInt aIndex); williamr@2: IMPORT_C const TUUID& operator[](TInt aIndex) const; williamr@2: IMPORT_C const TUUID& At(TInt aIndex) const; williamr@2: IMPORT_C TBool IsPresent(const TUUID& aUuid) const; williamr@2: IMPORT_C TInt Add(const TUUID& aUuid); williamr@2: williamr@2: private: williamr@2: RArray iUUIDs; williamr@2: williamr@2: // This data padding has been added to help prevent future binary compatibility breaks williamr@2: // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used williamr@2: TUint32 iPadding1; williamr@2: TUint32 iPadding2; williamr@2: }; williamr@2: williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: An EIR UUID container class. Contains UUIDs and indications of data completeness williamr@2: */ williamr@2: NONSHARABLE_CLASS(RExtendedInquiryResponseUUIDContainer) williamr@2: { williamr@2: public: williamr@2: enum TUUIDType williamr@2: { williamr@2: EUUID16 = 0x1, williamr@2: EUUID32 = 0x2, williamr@2: EUUID128 = 0x4, williamr@2: }; williamr@2: williamr@2: public: williamr@2: IMPORT_C void Close(); williamr@2: IMPORT_C RUUIDContainer& UUIDs(); williamr@2: IMPORT_C void SetCompleteness(TUUIDType aType, TBool aIsComplete); williamr@2: IMPORT_C TBool GetCompleteness(TUUIDType aType) const; williamr@2: williamr@2: private: williamr@2: RUUIDContainer iUUIDs; williamr@2: TInt iCompleteness; williamr@2: williamr@2: // This data padding has been added to help prevent future binary compatibility breaks williamr@2: // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used williamr@2: TUint32 iPadding1; williamr@2: TUint32 iPadding2; williamr@2: }; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: The size of a link key, in bytes. williamr@2: */ williamr@2: const TUint8 KHCILinkKeySize=16; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: The size of a pin code, in bytes. williamr@2: */ williamr@2: const TUint8 KHCIPINCodeSize=16; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Link key structure. williamr@2: */ williamr@2: NONSHARABLE_CLASS(TLinkKeyV10) williamr@4: { williamr@2: public: williamr@4: TUint8 iLinkKey[KHCILinkKeySize]; /*!< The link key */ williamr@4: }; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Typedef'ed TPckgBuf of the class TLinkKeyV10. williamr@2: */ williamr@2: typedef TPckgBuf TBTLinkKey; williamr@2: williamr@2: /** williamr@2: The type of a link key with a remote device williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: enum TBTLinkKeyType williamr@2: { williamr@2: ELinkKeyCombination, /*!< this key has been generated with pairing with pre-v2.1 Bluetooth devices. */ williamr@2: ELinkKeyUnauthenticatedUpgradable, /*!< this key hasn't yet been tried with MITM protection */ williamr@2: ELinkKeyUnauthenticatedNonUpgradable, /*!< this key tried MITM protection; remote device incapable */ williamr@2: ELinkKeyAuthenticated, /*!< this key authenticated with MITM protection */ williamr@2: ELinkKeyDebug /*!< this key has been generated when in simple pairing debug mode */ williamr@2: }; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Bluetooth PIN Code structure. williamr@2: */ williamr@2: NONSHARABLE_CLASS(TPINCodeV10) williamr@4: { williamr@2: public: williamr@2: IMPORT_C TBool operator==(const TPINCodeV10& aTPINCodeV10) const; williamr@2: williamr@2: public: williamr@4: TUint8 iLength; /*!< The length of the pin key */ williamr@4: TUint8 iPIN[KHCIPINCodeSize]; /*!< The pin code */ williamr@4: }; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Typedef'ed TPckgBuf of the class TPINCodeV10. williamr@2: */ williamr@2: typedef TPckgBuf TBTPinCode; williamr@2: williamr@2: williamr@2: /** williamr@2: Extended Inquiry Response Class williamr@2: This class takes a reference from inquiry result, which could hold both local name and Extended Inquiry Response. williamr@2: It provides API to parse and return the local name and data for any Extended Inquiry Response tag. williamr@2: To get Device Name, Manufacturer Specific Data or Flags, firstly getting length of the data, williamr@2: and then allocating a suitable buffer, which is where the data will be placed. williamr@2: */ williamr@2: NONSHARABLE_CLASS(TBluetoothNameRecordWrapper) williamr@2: { williamr@2: public: williamr@2: IMPORT_C explicit TBluetoothNameRecordWrapper(const TNameRecord& aNameRecord); williamr@2: IMPORT_C TInt GetDeviceName(TDes16& aName, TBool& aIsComplete) const; williamr@2: IMPORT_C TInt GetServiceClassUuids(RExtendedInquiryResponseUUIDContainer& aEIRContainer) const; williamr@2: IMPORT_C TInt GetVendorSpecificData(TDes8& aDes) const; williamr@2: IMPORT_C TInt GetTxPowerLevel(TInt8& aTxPowerLevel) const; williamr@2: IMPORT_C TInt GetFlags(TDes8& aDes) const; williamr@2: IMPORT_C TInt GetDeviceNameLength() const; williamr@2: IMPORT_C TInt GetVendorSpecificDataLength() const; williamr@2: IMPORT_C TInt GetFlagsLength() const; williamr@2: williamr@2: private: williamr@2: TInt AddUuids16(RExtendedInquiryResponseUUIDContainer& aEIRContainer, TPtrC8& aUuids) const; williamr@2: TInt AddUuids128(RExtendedInquiryResponseUUIDContainer& aEIRContainer, TPtrC8& aUuids) const; williamr@2: private: williamr@2: TExtendedInquiryResponseDataCodec iEirCodec; williamr@2: williamr@2: // This data padding has been added to help prevent future binary compatibility breaks williamr@2: // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used williamr@2: TUint32 iPadding1; williamr@2: TUint32 iPadding2; williamr@2: }; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Contains information resulting from a baseband notification. williamr@2: */ williamr@2: NONSHARABLE_CLASS(TBTBasebandEventNotification) williamr@2: { williamr@2: public: williamr@2: /** williamr@2: Constructor. williamr@2: @param aEventType The type of event. williamr@2: @param aErrorCode The error code. williamr@2: */ williamr@2: TBTBasebandEventNotification(TUint32 aEventType, TInt aErrorCode = KErrNone) : iEventType(aEventType), iErrorCode(aErrorCode) {}; williamr@2: williamr@2: /** williamr@2: Default constructor. williamr@2: */ williamr@2: TBTBasebandEventNotification() : iEventType(0), iErrorCode(KErrNone) {}; williamr@2: williamr@2: /** williamr@2: Copy constructor. williamr@2: @param aEvent The event to copy. williamr@2: */ williamr@2: TBTBasebandEventNotification(const TBTBasebandEventNotification& aEvent) : iEventType(aEvent.iEventType), iErrorCode(aEvent.iErrorCode) {}; williamr@2: williamr@2: /** williamr@2: The event type. williamr@2: @return The event type. williamr@2: */ williamr@2: TUint32 EventType() const { return iEventType; }; williamr@2: williamr@2: /** williamr@2: The Bluetooth SIG error code associated with the event. williamr@2: @return The SIG error code. williamr@2: */ williamr@2: TInt ErrorCode() const { return iErrorCode; }; williamr@2: williamr@2: /** williamr@2: The Symbian HCI error code associated with the event. williamr@2: @return The Symbian error code. williamr@2: */ williamr@2: IMPORT_C TInt SymbianErrorCode() const; williamr@2: williamr@2: /** williamr@2: Set the event type. williamr@2: @param aEventType The event type. williamr@2: */ williamr@2: void SetEventType(TUint32 aEventType) { iEventType = aEventType; }; williamr@2: williamr@2: /** williamr@2: Set the error code. williamr@2: @param aErrorCode The Bluetooth SIG error code. williamr@2: */ williamr@2: void SetErrorCode(TInt aErrorCode) { iErrorCode = aErrorCode; }; williamr@2: williamr@2: private: williamr@2: TUint32 iEventType; williamr@2: TInt iErrorCode; williamr@2: }; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Typedef'ed pckgbuf of the class TBTBasebandEventNotification. williamr@2: */ williamr@2: typedef TPckgBuf TBTBasebandEvent; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: General Unlimited Inquiry Access Code williamr@2: */ williamr@2: const TUint KGIAC=0x9e8b33; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Limited Inquiry Access Code williamr@2: */ williamr@2: const TUint KLIAC=0x9e8b00; williamr@2: williamr@4: /** williamr@4: L2CAP channel modes williamr@4: @publishedAll williamr@4: @released williamr@4: */ williamr@4: enum TL2CapChannelMode williamr@4: { williamr@4: EL2CAPBasicMode = 0x00, williamr@4: EL2CAPRetransmissionMode = 0x01, williamr@4: EL2CAPFlowControlMode = 0x02, williamr@4: EL2CAPEnhancedRetransmissionMode = 0x03, williamr@4: EL2CAPStreamingMode = 0x04, williamr@4: }; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@4: API class for setting up an L2Cap channel configuration. williamr@2: williamr@4: This class may be used to set all or a subset of the following configuration williamr@4: items: williamr@2: Channel Reliability (and associated timer) williamr@4: Maximum Transmission Unit (MTU) value preferred during MTU negotiation williamr@4: Maximum Receive Unit (MRU) value preferred during MRU negotiation williamr@4: Minimum MTU value acceptable during MTU negotiation williamr@4: Minimum MRU value acceptable during MRU negotiation williamr@2: Channel Priority williamr@2: williamr@4: If a configuration item is to be set, then its 'Set' or 'Configure' williamr@2: method should be called. williamr@2: williamr@4: Once a TL2CapConfig object has been set up it can be used to configure a socket williamr@4: using RSocket::SetOption or RSocket::Ioctl (or the CBluetoothSocket equivalents). williamr@4: williamr@4: If the preferred Maximum Transmission Unit (MTU) value is specified but its williamr@4: minimum acceptable value is not specified in the same object, then the minimum williamr@4: acceptable value will be implicitly taken to be equal to the preferred MTU by williamr@4: the L2CAP APIs processing the object. This means that only an MTU greater than or williamr@4: equal to the preferred MTU will be accepted from the peer during negotiation. williamr@4: williamr@4: If the Maximum Receive Unit (MRU) value is specified but its minimum acceptable williamr@4: value is not, then the minimum acceptable value is implicitly taken to be equal williamr@4: to the protocol minimum (48 bytes) by the L2CAP APIs processing the object. williamr@4: williamr@4: Note that even though this API allows setting of Obsolescence timer, outgoing williamr@4: packet flushing may not be supported on all hardware. williamr@2: williamr@2: @see RSocket williamr@2: @see CBluetoothSocket williamr@2: */ williamr@2: NONSHARABLE_CLASS(TL2CapConfig) williamr@2: { williamr@2: public: williamr@2: /** williamr@2: Priority required for data on L2Cap channel williamr@2: */ williamr@2: enum TChannelPriority williamr@2: { williamr@2: EHigh = 2, williamr@2: EMedium = 1, williamr@2: ELow = 0, williamr@2: }; williamr@2: williamr@2: /** williamr@4: Reliability of data transfer preferred for L2Cap channel. williamr@2: */ williamr@2: enum TChannelReliability williamr@2: { williamr@2: EReliableChannel, williamr@2: EUnreliableChannel, williamr@4: EUnreliableDesiredChannel williamr@2: }; williamr@2: williamr@2: /** williamr@2: Timer values in milliseconds for reliable and unreliable channels williamr@2: */ williamr@2: enum TL2CapConfigSpecifiedTimers williamr@2: { williamr@2: /** williamr@4: This is a time in milliseconds. However 0xffff has been given a special williamr@4: meaning in this interface. It means "Allow maximum possible number of williamr@4: transmissions of a single packet before giving up and disconnecting the williamr@4: L2Cap channel." This is the maximum number of transmissions effectively williamr@4: allowed by the spec. It only applies to reliable modes and is 255 for williamr@4: Retransmission Mode and Infinity for Enhanced Retransmission Mode. williamr@2: */ williamr@2: EDefaultRetransmission = 0xffff, williamr@2: /** williamr@2: Minimum data obsolescence timeout required because data packets williamr@2: will not ever be sent if we flush them too quickly. williamr@2: Speed of sending data depends on how many channels are open and channel priority. williamr@4: Note that flushing of outgoing packets may not be implemented on all Symbian OS williamr@4: platforms. williamr@2: */ williamr@2: EMinDataObsolescenceTimeout = 0x0a, williamr@2: /** williamr@2: This is translated to mean never flush (as per spec). williamr@2: */ williamr@2: EDefaultDataObsolescenceTimeout = 0xffff, williamr@2: }; williamr@2: williamr@2: /** williamr@2: Used to indicate which config options have been specified by the user williamr@2: */ williamr@2: enum TL2CapConfigSpecifiedMask williamr@2: { williamr@2: ENoConfigElementsSpecified = 0x0000, williamr@2: EMTUSizeSpecifiedMask = 0x0001, williamr@2: EMRUSizeSpecifiedMask = 0x0002, williamr@2: EReliabilitySpecifiedMask = 0x0004, williamr@2: EPrioritySpecifiedMask = 0x0008, williamr@4: EMinMTUSizeSpecifiedMask = 0x0010, williamr@4: EMinMRUSizeSpecifiedMask = 0x0020, williamr@4: ELegacyModesDisallowedSpecifiedMask = 0x0040 williamr@2: }; williamr@2: williamr@2: IMPORT_C TL2CapConfig(); williamr@2: williamr@2: IMPORT_C TInt SetMaxTransmitUnitSize(TUint16 aSize = 0xffff); williamr@2: IMPORT_C TUint16 MaxTransmitUnitSize(TBool& aIsSpecified) const; williamr@2: IMPORT_C TInt SetMaxReceiveUnitSize(TUint16 aSize = 0xffff); williamr@2: IMPORT_C TUint16 MaxReceiveUnitSize(TBool& aIsSpecified) const; williamr@4: williamr@4: IMPORT_C TInt SetMinMTU(TUint16 aSize); williamr@4: IMPORT_C TUint16 MinMTU(TBool& aIsSpecified) const; williamr@4: williamr@4: IMPORT_C TInt SetMinMRU(TUint16 aSize); williamr@4: IMPORT_C TUint16 MinMRU(TBool& aIsSpecified) const; williamr@2: williamr@2: IMPORT_C TInt ConfigureReliableChannel(TUint16 aRetransmissionTimer); williamr@2: IMPORT_C TInt ConfigureUnreliableChannel(TUint16 aObsolescenceTimer); williamr@4: IMPORT_C TInt ConfigureUnreliableDesiredChannel(TUint16 aObsolescenceTimer, TUint16 aRetransmissionTimer); williamr@4: IMPORT_C void SetLegacyModesDisallowed(TBool aDisallowed); williamr@4: IMPORT_C TBool LegacyModesDisallowed() const; williamr@4: williamr@2: IMPORT_C TChannelReliability ChannelReliability(TBool& aIsSpecified, TUint16& aAssociatedTimer) const; williamr@4: williamr@4: IMPORT_C TChannelReliability ChannelReliability(TBool& aIsSpecified) const; williamr@4: IMPORT_C TUint16 RetransmissionTimer(TBool& aIsSpecified) const; williamr@4: IMPORT_C TUint16 ObsolescenceTimer(TBool& aIsSpecified) const; williamr@2: williamr@2: IMPORT_C TInt ConfigureChannelPriority(TChannelPriority aPriority); williamr@2: IMPORT_C TChannelPriority ChannelPriority(TBool& aIsSpecified) const; williamr@4: williamr@2: /** williamr@2: @deprecated williamr@2: Use ConfigureReliableChannel(TUint16 aRetransmissionTimer) instead williamr@2: */ williamr@2: IMPORT_C TInt SetupReliableChannel(TUint16 aRetransmissionTimer = EDefaultRetransmission); williamr@2: /** williamr@2: @deprecated williamr@2: Use ConfigureUnreliableChannel(TUint16 aObsolescenceTimer) instead williamr@2: */ williamr@2: IMPORT_C TInt SetupUnreliableChannel(TUint16 aObsolescenceTimer = EDefaultDataObsolescenceTimeout); williamr@2: /** williamr@2: @deprecated williamr@2: Use ConfigureChannelPriority(TChannelPriority aPriority) instead williamr@2: */ williamr@2: IMPORT_C TInt SetChannelPriority(TChannelPriority aPriority = ELow); williamr@4: williamr@2: private: williamr@4: TUint16 iMTUSize; williamr@4: TUint16 iMRUSize; williamr@4: TChannelReliability iChannelReliability; williamr@4: TUint16 iChannelReliabilityTimer; // see note below williamr@4: TChannelPriority iChannelPriority; williamr@4: TUint16 iSpecifiedMask; williamr@4: TUint16 iMinMTUSize; // Minimum acceptable MTU. williamr@4: TUint16 iMinMRUSize; // Minimum acceptable MRU. williamr@4: TUint16 iAdditionalChannelReliabilityTimer; // see note below williamr@4: // This data padding has been added to help prevent future binary compatibility breaks. williamr@4: TUint16 iPadding; williamr@2: williamr@4: // Note on the timer fields: williamr@4: // iAdditionalChannelReliabilityTimer has been added when a need to pass two timers within williamr@4: // one object arose. To maintain BC with existing clients of this class, when a single timer williamr@4: // is passed, it's always stored in iChannelReliabilityTimer. Changing this to just having williamr@4: // iRetransmissionTimer & iObsolescenceTimer would break BC. williamr@4: // When both timers are stored, Flush timeout goes in iChannelReliabilityTimer and williamr@4: // Retransmission timeout goes in iAdditionalChannelReliabilityTimer. williamr@2: }; williamr@2: williamr@2: /** williamr@2: @publishedAll williamr@2: @released williamr@2: williamr@2: Typedef to represent a L2CAP Config object. williamr@2: */ williamr@2: typedef TPckgBuf TL2CapConfigPkg; williamr@2: williamr@2: williamr@2: enum TEirWrapperPanics williamr@2: { williamr@2: EEirBadUuid16List = 0, williamr@2: EEirBadUuid128List = 1, williamr@2: }; williamr@2: _LIT(KEirWrapperPanicName, "ExtendedInquiryResponseWrapper"); williamr@2: williamr@2: #endif //_BTTYPES_H